4 package jp.sourceforge.ea2ddl.common.config.impl;
\r
6 import java.io.IOException;
\r
7 import java.io.InputStream;
\r
8 import java.net.MalformedURLException;
\r
10 import java.util.Properties;
\r
12 import jp.sourceforge.ea2ddl.common.config.Config;
\r
14 import org.apache.commons.logging.Log;
\r
15 import org.apache.commons.logging.LogFactory;
\r
21 public class ConfigImpl implements Config {
\r
22 private static final Log _log = LogFactory.getLog(ConfigImpl.class);
\r
24 private Properties _prop = new Properties();
\r
26 public void load(String configPath) {
\r
27 InputStream in = null;
\r
29 in = new URL(configPath).openStream();
\r
30 } catch (MalformedURLException e) {
\r
31 } catch (IOException e) {
\r
32 _log.info("Failed to read resource:", e);
\r
35 in = Thread.currentThread().getContextClassLoader().getResourceAsStream(configPath);
\r
40 _log.info("config initialized.");
\r
41 } catch (IOException e) {
\r
42 _log.info("Failed to read resource:" + e);
\r
48 public String getProperty(String key) {
\r
49 return _prop.getProperty(key);
\r
53 public String getProperty(String key, String defaultValue) {
\r
54 return _prop.getProperty(key, defaultValue);
\r