2 * ============LICENSE_START==========================================
4 * ===================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ===================================================================
8 * Unless otherwise specified, all software contained herein is licensed
9 * under the Apache License, Version 2.0 (the "License");
10 * you may not use this software except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
21 * Unless otherwise specified, all documentation contained herein is licensed
22 * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
23 * you may not use this documentation except in compliance with the License.
24 * You may obtain a copy of the License at
26 * https://creativecommons.org/licenses/by/4.0/
28 * Unless required by applicable law or agreed to in writing, documentation
29 * distributed under the License is distributed on an "AS IS" BASIS,
30 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31 * See the License for the specific language governing permissions and
32 * limitations under the License.
34 * ============LICENSE_END============================================
38 package org.onap.portalapp.portal.scheduler;
40 import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
41 import org.springframework.beans.factory.annotation.Autowired;
42 import org.springframework.context.annotation.Configuration;
43 import org.springframework.context.annotation.PropertySource;
44 import org.springframework.core.env.Environment;
47 @PropertySource(value = { "${container.classpath:}/WEB-INF/conf/scheduler.properties" })
49 public class SchedulerProperties {
51 private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(SchedulerProperties.class);
53 private static Environment environment;
56 public SchedulerProperties() {
59 protected Environment getEnvironment() {
64 public void setEnvironment(Environment environment) {
65 SchedulerProperties.environment = environment;
69 * Tests whether a property value is available for the specified key.
73 * @return True if the key is known, otherwise false.
75 public static boolean containsProperty(String key) {
76 return environment.containsProperty(key);
80 * Returns the property value associated with the given key (never
81 * {@code null}), after trimming any trailing space.
85 * @return Property value; the empty string if the environment was not
86 * autowired, which should never happen.
87 * @throws IllegalStateException
88 * if the key cannot be resolved
90 public static String getProperty(String key) {
92 if (environment == null) {
93 logger.error(EELFLoggerDelegate.errorLogger, "getProperty: environment is null, should never happen!");
95 value = environment.getRequiredProperty(key);
96 // java.util.Properties preserves trailing space
103 public static final String SCHEDULER_USER_NAME_VAL = "scheduler.user.name";
105 public static final String SCHEDULER_PASSWORD_VAL = "scheduler.password";
107 public static final String SCHEDULER_SERVER_URL_VAL = "scheduler.server.url";
109 public static final String SCHEDULER_CREATE_NEW_VNF_CHANGE_INSTANCE_VAL = "scheduler.create.new.vnf.change.instance";
111 public static final String SCHEDULER_GET_TIME_SLOTS = "scheduler.get.time.slots";
113 public static final String SCHEDULER_SUBMIT_NEW_VNF_CHANGE = "scheduler.submit.new.vnf.change";
115 public static final String SCHEDULERAUX_CLIENTAUTH_VAL = "scheduleraux.ClientAuth";
117 public static final String SCHEDULERAUX_CLIENT_MECHID_VAL = "scheduleraux.client.mechId";
119 public static final String SCHEDULERAUX_CLIENT_PASSWORD_VAL = "scheduleraux.client.password";
121 public static final String SCHEDULERAUX_USERNAME_VAL = "scheduleraux.username";
123 public static final String SCHEDULERAUX_PASSWORD_VAL = "scheduleraux.password";
125 public static final String SCHEDULERAUX_AUTHORIZATION_VAL = "scheduleraux.Authorization";
127 public static final String SCHEDULERAUX_SERVER_URL_VAL = "scheduleraux.server.url";
129 public static final String SCHEDULERAUX_ENVIRONMENT_VAL = "scheduleraux.environment";
131 public static final String SCHEDULERAUX_GET_CONFIG_VAL = "scheduleraux.get.config";
134 /** The Constant VID_TRUSTSTORE_FILENAME. */
135 public static final String VID_TRUSTSTORE_FILENAME = "vid.truststore.filename";
137 /** The Constant VID_TRUSTSTORE_PASSWD_X. */
138 public static final String VID_TRUSTSTORE_PASSWD_X = "vid.truststore.passwd.x";
140 /** The Constant FILESEPARATOR. */
141 public static final String FILESEPARATOR = (System.getProperty("file.separator") == null) ? "/" : System.getProperty("file.separator");
143 /** Scheduler UI constant **/
144 public static final String SCHEDULER_DOMAIN_NAME = "scheduler.domain.name";
146 public static final String SCHEDULER_SCHEDULE_NAME = "scheduler.schedule.name";
148 public static final String SCHEDULER_WORKFLOW_NAME = "scheduler.workflow.name";
150 public static final String SCHEDULER_CALLBACK_URL = "scheduler.callback.url";
152 public static final String SCHEDULER_APPROVAL_TYPE = "scheduler.approval.type";
154 public static final String SCHEDULER_APPROVAL_SUBMIT_STATUS = "scheduler.approval.submit.status";
156 public static final String SCHEDULER_APPROVAL_REJECT_STATUS = "scheduler.approval.reject.status";
158 public static final String SCHEDULER_INTERVAL_GET_TIMESLOT_RATE = "scheduler.interval.get.timeslot.rate";
160 public static final String SCHEDULER_POLICY_NAME = "scheduler.policy.name";
162 public static final String SCHEDULER_GROUP_ID = "scheduler.group.id";