74d80e04766f7296689e942699ca3f5c06b5955f
[sdc/sdc-workflow-designer.git] /
1 /**
2  * Copyright (c) 2017 ZTE Corporation.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the Apache License, Version 2.0
5  * and the Eclipse Public License v1.0 which both accompany this distribution,
6  * and are available at http://www.eclipse.org/legal/epl-v10.html
7  * and http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Contributors:
10  *     ZTE - initial API and implementation and/or initial documentation
11  */
12 package org.onap.sdc.workflowdesigner.config;
13
14 import java.io.FileNotFoundException;
15 import java.io.IOException;
16 import java.io.InputStream;
17 import java.util.Properties;
18
19 import org.slf4j.Logger;
20 import org.slf4j.LoggerFactory;
21
22 public class Config {
23     private static Logger log = LoggerFactory.getLogger(Config.class);
24     private static String configFilePath = "bpmn.config.properties";
25     public final static String HANDLER_ClASS = "handlerClass";
26     public final static String TEMPLATE_PATH = "templatePath";
27
28     public final static Properties PROPERTIES = load();
29
30     public static Properties load() {
31         Properties properties = new Properties();
32         InputStream in = null;
33         try {
34             in = Config.class.getClassLoader().getResourceAsStream(configFilePath);
35             properties.load(in);
36         } catch (FileNotFoundException e) {
37             log.error(configFilePath, e);
38         } catch (IOException e) {
39             log.error(configFilePath, e);
40         } catch (Exception e) {
41             log.error(configFilePath, e);
42         } finally {
43             if (in != null) {
44                 try {
45                     in.close();
46                 } catch (IOException e) {
47                     log.error(configFilePath, e);
48                 }
49             }
50         }
51
52         return properties;
53     }
54 }