summaryrefslogtreecommitdiffstats
path: root/sdc-workflow-designer-server/src/main/java/org/onap/sdc/workflowdesigner/config/Config.java
blob: 5a5b54a7f786581da81effeda52493435cbc341b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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;
	}
}