1 package de.j32.pimstuff.conduit;
3 import java.io.FileInputStream;
4 import java.io.FileNotFoundException;
5 import java.io.IOException;
6 import java.util.InvalidPropertiesFormatException;
7 import java.util.Properties;
11 static Config instance;
12 Properties config = new Properties();
14 public static String get(String key, String defaultValue)
18 if (instance == null) return defaultValue;
20 String rv = instance.config.getProperty(key);
21 if (rv == null) return defaultValue;
26 public static String get(String key)
28 String rv = get(key, null);
29 if (rv == null) throw new ConfigurationException(
30 "missing configuration parameter: " + key);
36 if (instance == null) try {
37 instance = new Config();
39 catch (InvalidPropertiesFormatException e) {}
40 catch (FileNotFoundException e) {}
41 catch (IOException e) {}
44 Config() throws InvalidPropertiesFormatException, FileNotFoundException,
47 config.loadFromXML(new FileInputStream("config.xml"));