1 package org.onap.champ.util;
4 import java.io.FileInputStream;
5 import java.io.FileNotFoundException;
6 import java.io.FileOutputStream;
7 import java.io.IOException;
8 import java.util.Properties;
10 public class ChampProperties {
12 private static Properties properties;
15 properties = new Properties();
16 File file = new File(ChampServiceConstants.CHAMP_CONFIG_FILE);
18 properties.load(new FileInputStream(file));
19 } catch (IOException e) {
21 Runtime.getRuntime().halt(1);
25 public static String get(String key) {
26 return properties.getProperty(key);
29 public static String get(String key, String defaultValue) {
30 return properties.getProperty(key, defaultValue);
33 public static void put(String key, String value) {
34 properties.setProperty(key, value);
35 FileOutputStream fileOut = null;
37 fileOut = new FileOutputStream(new File(ChampServiceConstants.CHAMP_CONFIG_FILE));
38 properties.store(fileOut, "Added property: " + key);
39 } catch (Exception e) {
45 } catch (IOException ex) {