diff options
author | Lvbo163 <lv.bo163@zte.com.cn> | 2017-09-22 16:34:05 +0800 |
---|---|---|
committer | Lvbo163 <lv.bo163@zte.com.cn> | 2017-09-22 16:34:05 +0800 |
commit | 37c6737bc3f3d7f70ae6afd270b33c154d2153f1 (patch) | |
tree | bb32b2ab40ce56a25ea2c031e4606d222915e309 /sdc-workflow-designer-server/src | |
parent | 8b2a52fcfd8b7e29a365eb784ecd7295f2201707 (diff) |
Support load config properties
Issue-ID: SDC-365
Change-Id: I2720c3fb47c9ab868518f3779c89b768ab0b92a3
Signed-off-by: Lvbo163 <lv.bo163@zte.com.cn>
Diffstat (limited to 'sdc-workflow-designer-server/src')
-rw-r--r-- | sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/config/Config.java | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/config/Config.java b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/config/Config.java new file mode 100644 index 00000000..5a5b54a7 --- /dev/null +++ b/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/config/Config.java @@ -0,0 +1,43 @@ +package org.onap.sdc.workflowdesigner.config;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class Config {
+ private static Logger log = LoggerFactory.getLogger(Config.class);
+ private static String configFilePath = "bpmn.config.properties";
+ public static String HANDLER_ClASS = "handlerClass";
+ public static String TEMPLATE_PATH = "templatePath";
+
+ public static Properties PROPERTIES = load();
+
+ public static Properties load() {
+ Properties properties = new Properties();
+ InputStream in = null;
+ try {
+ in = Config.class.getClassLoader().getResourceAsStream(configFilePath);
+ properties.load(in);
+ } catch (FileNotFoundException e) {
+ log.error(configFilePath, e);
+ } catch (IOException e) {
+ log.error(configFilePath, e);
+ } catch (Exception e) {
+ log.error(configFilePath, e);
+ } finally {
+ if(in != null) {
+ try {
+ in.close();
+ } catch (IOException e) {
+ log.error(configFilePath, e);
+ }
+ }
+ }
+
+ return properties;
+ }
+}
|