Replace ecomp references
[portal.git] / ecomp-portal-BE-common / src / main / java / org / onap / portalapp / portal / scheduler / SchedulerProperties.java
1 /*-
2  * ============LICENSE_START==========================================
3  * ONAP Portal
4  * ===================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ===================================================================
7  *
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
12  *
13  *             http://www.apache.org/licenses/LICENSE-2.0
14  *
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.
20  *
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
25  *
26  *             https://creativecommons.org/licenses/by/4.0/
27  *
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.
33  *
34  * ============LICENSE_END============================================
35  *
36  * 
37  */
38 package org.onap.portalapp.portal.scheduler;
39
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;
45
46 @Configuration
47 @PropertySource(value = { "${container.classpath:}/WEB-INF/conf/scheduler.properties" })
48
49 public class SchedulerProperties {
50
51         private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(SchedulerProperties.class);
52
53         private static Environment environment;
54
55
56         public SchedulerProperties() {
57         }
58
59         protected Environment getEnvironment() {
60                 return environment;
61         }
62
63         @Autowired
64         public void setEnvironment(Environment environment) {
65                 SchedulerProperties.environment = environment;
66         }
67
68         /**
69          * Tests whether a property value is available for the specified key.
70          * 
71          * @param key
72          *            Property key
73          * @return True if the key is known, otherwise false.
74          */
75         public static boolean containsProperty(String key) {
76                 return environment.containsProperty(key);
77         }
78
79         /**
80          * Returns the property value associated with the given key (never
81          * {@code null}), after trimming any trailing space.
82          * 
83          * @param key
84          *            Property key
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
89          */
90         public static String getProperty(String key) {
91                 String value = "";
92                 if (environment == null) {
93                         logger.error(EELFLoggerDelegate.errorLogger, "getProperty: environment is null, should never happen!");
94                 } else {
95                         value = environment.getRequiredProperty(key);
96                         // java.util.Properties preserves trailing space
97                         if (value != null)
98                                 value = value.trim();
99                 }
100                 return value;
101         }
102
103         public static final String SCHEDULER_USER_NAME_VAL = "scheduler.user.name";
104
105         public static final String SCHEDULER_PASSWORD_VAL = "scheduler.password";
106
107         public static final String SCHEDULER_SERVER_URL_VAL = "scheduler.server.url";
108
109         public static final String SCHEDULER_CREATE_NEW_VNF_CHANGE_INSTANCE_VAL = "scheduler.create.new.vnf.change.instance";
110
111         public static final String SCHEDULER_GET_TIME_SLOTS = "scheduler.get.time.slots";
112
113         public static final String SCHEDULER_SUBMIT_NEW_VNF_CHANGE = "scheduler.submit.new.vnf.change";
114
115         public static final String SCHEDULERAUX_CLIENTAUTH_VAL = "scheduleraux.ClientAuth";
116
117         public static final String SCHEDULERAUX_CLIENT_MECHID_VAL = "scheduleraux.client.mechId";
118
119         public static final String SCHEDULERAUX_CLIENT_PASSWORD_VAL = "scheduleraux.client.password";
120
121         public static final String SCHEDULERAUX_USERNAME_VAL = "scheduleraux.username";
122
123         public static final String SCHEDULERAUX_PASSWORD_VAL = "scheduleraux.password";
124
125         public static final String SCHEDULERAUX_AUTHORIZATION_VAL = "scheduleraux.Authorization";
126
127         public static final String SCHEDULERAUX_SERVER_URL_VAL = "scheduleraux.server.url";
128
129         public static final String SCHEDULERAUX_ENVIRONMENT_VAL = "scheduleraux.environment";
130
131         public static final String SCHEDULERAUX_GET_CONFIG_VAL = "scheduleraux.get.config";
132         
133
134         /** The Constant VID_TRUSTSTORE_FILENAME. */
135         public static final String VID_TRUSTSTORE_FILENAME = "vid.truststore.filename";
136
137         /** The Constant VID_TRUSTSTORE_PASSWD_X. */
138         public static final String VID_TRUSTSTORE_PASSWD_X = "vid.truststore.passwd.x";
139
140         /** The Constant FILESEPARATOR. */
141         public static final String FILESEPARATOR = (System.getProperty("file.separator") == null) ? "/" : System.getProperty("file.separator");
142         
143         /** Scheduler UI constant **/
144         public static final String SCHEDULER_DOMAIN_NAME = "scheduler.domain.name";
145
146         public static final String SCHEDULER_SCHEDULE_NAME = "scheduler.schedule.name";
147
148         public static final String SCHEDULER_WORKFLOW_NAME = "scheduler.workflow.name";
149
150         public static final String SCHEDULER_CALLBACK_URL = "scheduler.callback.url";
151         
152         public static final String SCHEDULER_APPROVAL_TYPE = "scheduler.approval.type";
153
154         public static final String SCHEDULER_APPROVAL_SUBMIT_STATUS = "scheduler.approval.submit.status";
155
156         public static final String SCHEDULER_APPROVAL_REJECT_STATUS = "scheduler.approval.reject.status";       
157         
158         public static final String SCHEDULER_INTERVAL_GET_TIMESLOT_RATE = "scheduler.interval.get.timeslot.rate";       
159         
160         public static final String SCHEDULER_POLICY_NAME = "scheduler.policy.name";
161
162         public static final String SCHEDULER_GROUP_ID = "scheduler.group.id";   
163
164 }