2 * ============LICENSE_START=======================================================
3 * feature-state-management
4 * ================================================================================
5 * Copyright (C) 2017 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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.onap.policy.drools.statemanagement;
23 import java.util.Properties;
25 import org.slf4j.Logger;
26 import org.slf4j.LoggerFactory;
28 public class StateManagementProperties {
29 // get an instance of logger
30 private static final Logger logger = LoggerFactory.getLogger(StateManagementProperties.class);
32 public static final String NODE_NAME = "resource.name";
33 public static final String SITE_NAME = "site_name";
35 public static final String DB_DRIVER = "javax.persistence.jdbc.driver";
36 public static final String DB_URL = "javax.persistence.jdbc.url";
37 public static final String DB_USER = "javax.persistence.jdbc.user";
38 public static final String DB_PWD = "javax.persistence.jdbc.password";
40 private static Properties properties = null;
42 private StateManagementProperties(){
45 * Initialize the parameter values from the feature-state-management.properties file values
47 * This is designed so that the Properties object is obtained from the feature-state-management.properties
48 * file and then is passed to this method to initialize the value of the parameters.
49 * This allows the flexibility of JUnit tests using getProperties(filename) to get the
50 * properties while runtime methods can use getPropertiesFromClassPath(filename).
53 public static void initProperties (Properties prop){
54 logger.info("StateManagementProperties.initProperties(Properties): entry");
55 logger.info("\n\nStateManagementProperties.initProperties: Properties = \n{}\n\n", prop);
60 public static String getProperty(String key){
61 return properties.getProperty(key);
64 public static Properties getProperties() {