package eu.dnetlib.espas.data.harvest;

import java.io.IOException;
import java.util.Properties;

import org.apache.log4j.Logger;

public class Configuration {

	public static String CONFIGURATION_KEY_HOST		= "host";
	public static String CONFIGURATION_KEY_PORT		= "port";

	private static Logger logger = Logger.getLogger(Configuration.class);
	private static Configuration configuration = null;
	private Properties properties = null;

	public static Configuration getConfiguration() {
		if(null == configuration) {
			configuration = new Configuration();
			configuration.configure();
		}
		return configuration;
	}

	protected Configuration() {}

	private void configure() {
		try {
			this.properties = new Properties();
			this.properties.load(getClass().getResourceAsStream("unittest.properties"));
		}
		catch (IOException e){
			logger.debug("IO exception.", e);
		}
	}

	public Properties getProperties() {
		return properties;
	}

	public void setProperties(Properties properties) {
		this.properties = properties;
	}

	public String getProperty(String key) {
		return this.properties.getProperty(key);
	}
}
