Run stop.sh can not shutdown wso2 process
[vfc/nfvo/wfengine.git] / wso2bpel-ext / wso2bpel-core / wso2bpel-mgr / src / main / java / org / openo / carbon / bpel / config / ConfigManager.java
1 /**
2  * Copyright 2016 ZTE Corporation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package org.openo.carbon.bpel.config;
17
18 import org.apache.commons.lang3.StringUtils;
19
20 public class ConfigManager {
21   private static BpsExtraProperties extraProperties;
22   private static BpsCommonProperties commonProperties;
23   private static ConfigManager instance = null;
24
25   private ConfigManager() {
26     commonProperties = BpsCommonProperties.getInstance();
27     extraProperties = BpsExtraProperties.getInstance();
28   }
29
30   public static synchronized ConfigManager getInstance() {
31     if (instance == null) {
32       instance = new ConfigManager();
33     }
34     return instance;
35   }
36
37   public String getProperty(String key) {
38     String value = extraProperties.getProperty(key);
39     value = StringUtils.trimToEmpty(value);
40     if (StringUtils.isBlank(value)) {
41       return commonProperties.getProperty(key);
42     }
43     return value;
44   }
45
46 }