From 37c6737bc3f3d7f70ae6afd270b33c154d2153f1 Mon Sep 17 00:00:00 2001 From: Lvbo163 Date: Fri, 22 Sep 2017 16:34:05 +0800 Subject: Support load config properties Issue-ID: SDC-365 Change-Id: I2720c3fb47c9ab868518f3779c89b768ab0b92a3 Signed-off-by: Lvbo163 --- .../onap/sdc/workflowdesigner/config/Config.java | 43 ++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/config/Config.java (limited to 'sdc-workflow-designer-server/src/main/java') 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; + } +} -- cgit