/*
 * Created on 27-Oct-2009
 *
 * TODO 
 */
package uk.ac.roe.wfau;

import java.io.InputStream;
import java.util.Properties;

import org.apache.log4j.Logger;

/**
 * @author mar
 *
 */
public class LoadGESProperties {
    private static LoadGESProperties singletonObject;
    
    public static Logger logger = Logger.getLogger("wsa.simple");
    
	/** A private Constructor prevents any other class from instantiating. */
	private LoadGESProperties() {
	    
        
        
		//	 Optional Code
	    try {
	    InputStream inProp = getClass().getClassLoader().getResourceAsStream("GES.properties");
	    
	    Properties properties = new Properties();
	
	    logger.info("loading GES.properites");
           properties.load(inProp);
           GESSchema.WORLDGESDB=FormatLines.commaSeparatedStringToStringArray(properties.getProperty("WORLDGESDB").trim());
           GESSchema.EQUIVWORLDGESDB=FormatLines.commaSeparatedStringToStringArray(properties.getProperty("EQUIVWORLDGESDB").trim());

           GESSchema.WORLDVHSDB=FormatLines.commaSeparatedStringToStringArray(properties.getProperty("WORLDVHSDB").trim());
           GESSchema.EQUIVWORLDVHSDB=FormatLines.commaSeparatedStringToStringArray(properties.getProperty("EQUIVWORLDVHSDB").trim());
           GESSchema.WORLDVVVDB=FormatLines.commaSeparatedStringToStringArray(properties.getProperty("WORLDVVVDB").trim());
           GESSchema.EQUIVWORLDVVVDB=FormatLines.commaSeparatedStringToStringArray(properties.getProperty("EQUIVWORLDVVVDB").trim());
           GESSchema.WORLDVMCDB=FormatLines.commaSeparatedStringToStringArray(properties.getProperty("WORLDVMCDB").trim());
           GESSchema.EQUIVWORLDVMCDB=FormatLines.commaSeparatedStringToStringArray(properties.getProperty("EQUIVWORLDVMCDB").trim());
           
           GESSchema.WORLDVIKINGDB=FormatLines.commaSeparatedStringToStringArray(properties.getProperty("WORLDVIKINGDB").trim());
           GESSchema.WORLDVIDEODB=FormatLines.commaSeparatedStringToStringArray(properties.getProperty("WORLDVIDEODB").trim());
           GESSchema.EQUIVWORLDVIKINGDB=FormatLines.commaSeparatedStringToStringArray(properties.getProperty("EQUIVWORLDVIKINGDB").trim());
           GESSchema.EQUIVWORLDVIDEODB=FormatLines.commaSeparatedStringToStringArray(properties.getProperty("EQUIVWORLDVIDEODB").trim());
           GESSchema.WORLDULTRAVISTADB=FormatLines.commaSeparatedStringToStringArray(properties.getProperty("WORLDULTRAVISTADB").trim());
           GESSchema.WORLDSVORIONDB=FormatLines.commaSeparatedStringToStringArray(properties.getProperty("WORLDSVORIONDB").trim());
           GESSchema.WORLDSVNGC253DB=FormatLines.commaSeparatedStringToStringArray(properties.getProperty("WORLDSVNGC253DB").trim());
           GESSchema.WORLDCALDB=FormatLines.commaSeparatedStringToStringArray(properties.getProperty("WORLDCALDB").trim());
           GESSchema.WORLDCOMMDB=FormatLines.commaSeparatedStringToStringArray(properties.getProperty("WORLDCOMMDB").trim());

        } catch (Exception e) {
            // TODO Auto-generated catch block
            logger.info("error in loading GES.properites "+e);
            e.printStackTrace();
        }
     catch (Error err) {
        // TODO Auto-generated catch block
        logger.info("error in loading GES.properites "+err);
        err.printStackTrace();
    }
        
	}
	public static synchronized  void getSingletonObject() {
	  //  logger.info ("SO "+singletonObject);
		if (singletonObject == null) {
			singletonObject = new LoadGESProperties();
		}
		logger.info ("SOEX "+singletonObject);
	//	return singletonObject;
	}
	public Object clone() throws CloneNotSupportedException {
		throw new CloneNotSupportedException();
	}
}
