Fix checkstyle for features submodules.
[policy/drools-pdp.git] / feature-state-management / src / main / java / org / onap / policy / drools / statemanagement / StateManagementProperties.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * feature-state-management
4  * ================================================================================
5  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.policy.drools.statemanagement;
22
23 import java.util.Properties;
24
25 import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties;
26 import org.slf4j.Logger;
27 import org.slf4j.LoggerFactory;
28
29 public class StateManagementProperties {
30     // get an instance of logger
31     private static final Logger logger = LoggerFactory.getLogger(StateManagementProperties.class);
32
33     public static final String NODE_NAME = "resource.name";
34     public static final String NODE_TYPE = "node_type";
35     public static final String SITE_NAME = "site_name";
36
37     public static final String DB_DRIVER = "javax.persistence.jdbc.driver";
38     public static final String DB_URL = "javax.persistence.jdbc.url";
39     public static final String DB_USER = "javax.persistence.jdbc.user";
40     public static final String DB_PWD = "javax.persistence.jdbc.password";
41
42     public static final String TEST_SERVICES = PolicyEndPointProperties.PROPERTY_HTTP_SERVER_SERVICES;
43     public static final String TEST_SERVICES_DEFAULT = "TEST";
44     public static final String TEST_HOST =
45             TEST_SERVICES + "." + TEST_SERVICES_DEFAULT + PolicyEndPointProperties.PROPERTY_HTTP_HOST_SUFFIX;
46     public static final String TEST_PORT =
47             TEST_SERVICES + "." + TEST_SERVICES_DEFAULT + PolicyEndPointProperties.PROPERTY_HTTP_PORT_SUFFIX;
48     public static final String TEST_REST_CLASSES =
49             TEST_SERVICES + "." + TEST_SERVICES_DEFAULT + PolicyEndPointProperties.PROPERTY_HTTP_REST_CLASSES_SUFFIX;
50     public static final String TEST_REST_CLASSES_DEFAULT = IntegrityMonitorRestManager.class.getName();
51     public static final String TEST_MANAGED =
52             TEST_SERVICES + "." + TEST_SERVICES_DEFAULT + PolicyEndPointProperties.PROPERTY_MANAGED_SUFFIX;
53     public static final String TEST_MANAGED_DEFAULT = "false";
54     public static final String TEST_SWAGGER =
55             TEST_SERVICES + "." + TEST_SERVICES_DEFAULT + PolicyEndPointProperties.PROPERTY_HTTP_SWAGGER_SUFFIX;
56     public static final String TEST_SWAGGER_DEFAULT = "true";
57     public static final String RESOURCE_NAME = "resource.name";
58     public static final String FP_MONITOR_INTERVAL = "fp_monitor_interval";
59     public static final String FAILED_COUNTER_THRESHOLD = "failed_counter_threshold";
60     public static final String TEST_TRANS_INTERVAL = "test_trans_interval";
61     public static final String WRITE_FPC_INTERVAL = "write_fpc_interval";
62     public static final String DEPENDENCY_GROUPS = "dependency_groups";
63
64     private static Properties properties = null;
65
66     private StateManagementProperties() {}
67
68     /**
69      * Initialize the parameter values from the feature-state-management.properties file values.
70      * 
71      * <p>This is designed so that the Properties object is obtained from the
72      * feature-state-management.properties file and then is passed to this method to initialize the
73      * value of the parameters. This allows the flexibility of JUnit tests using
74      * getProperties(filename) to get the properties while runtime methods can use
75      * getPropertiesFromClassPath(filename).
76      * 
77      * @param prop properties
78      */
79     public static void initProperties(Properties prop) {
80         logger.info("StateManagementProperties.initProperties(Properties): entry");
81         logger.info("\n\nStateManagementProperties.initProperties: Properties = \n{}\n\n", prop);
82
83         properties = prop;
84     }
85
86     public static String getProperty(String key) {
87         return properties.getProperty(key);
88     }
89
90     public static Properties getProperties() {
91         return properties;
92     }
93 }