/*
 * 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 LoadOSAProperties {
    private static LoadOSAProperties singletonObject;
    
    public static Logger logger = Logger.getLogger("wsa.simple");
    
	/** A private Constructor prevents any other class from instantiating. */
	private LoadOSAProperties() {
	    
        
        
		//	 Optional Code
	    try {
	    InputStream inProp = getClass().getClassLoader().getResourceAsStream("OSA.properties");
	    
	    Properties properties = new Properties();
	
	    logger.info("loading OSA.properites");
           properties.load(inProp);
           OSASchema.ATLASPASSTHROUGHPASSWORD=properties.getProperty("ATLASPASSTHROUGHPASSWORD");
           OSASchema.ATLASDB=FormatLines.commaSeparatedStringToStringArray(properties.getProperty("ATLASDB").trim());
           logger.info(OSASchema.ATLASDB[0]+" atlas0");
           OSASchema.WORLDATLASDB=FormatLines.commaSeparatedStringToStringArray(properties.getProperty("WORLDATLASDB").trim());
           logger.info(OSASchema.WORLDATLASDB[0]+" wordlatlas0");
/*
           VSASchema.WORLDVHSDB=FormatLines.commaSeparatedStringToStringArray(properties.getProperty("WORLDVHSDB").trim());
           VSASchema.EQUIVWORLDVHSDB=FormatLines.commaSeparatedStringToStringArray(properties.getProperty("EQUIVWORLDVHSDB").trim());
           VSASchema.WORLDVVVDB=FormatLines.commaSeparatedStringToStringArray(properties.getProperty("WORLDVVVDB").trim());
           VSASchema.EQUIVWORLDVVVDB=FormatLines.commaSeparatedStringToStringArray(properties.getProperty("EQUIVWORLDVVVDB").trim());
           VSASchema.WORLDVMCDB=FormatLines.commaSeparatedStringToStringArray(properties.getProperty("WORLDVMCDB").trim());
           VSASchema.EQUIVWORLDVMCDB=FormatLines.commaSeparatedStringToStringArray(properties.getProperty("EQUIVWORLDVMCDB").trim());
           
           VSASchema.WORLDVIKINGDB=FormatLines.commaSeparatedStringToStringArray(properties.getProperty("WORLDVIKINGDB").trim());
           VSASchema.WORLDVIDEODB=FormatLines.commaSeparatedStringToStringArray(properties.getProperty("WORLDVIDEODB").trim());
           VSASchema.EQUIVWORLDVIKINGDB=FormatLines.commaSeparatedStringToStringArray(properties.getProperty("EQUIVWORLDVIKINGDB").trim());
           VSASchema.EQUIVWORLDVIDEODB=FormatLines.commaSeparatedStringToStringArray(properties.getProperty("EQUIVWORLDVIDEODB").trim());
           VSASchema.WORLDULTRAVISTADB=FormatLines.commaSeparatedStringToStringArray(properties.getProperty("WORLDULTRAVISTADB").trim());
           VSASchema.WORLDSVORIONDB=FormatLines.commaSeparatedStringToStringArray(properties.getProperty("WORLDSVORIONDB").trim());
           VSASchema.WORLDSVNGC253DB=FormatLines.commaSeparatedStringToStringArray(properties.getProperty("WORLDSVNGC253DB").trim());
           VSASchema.WORLDCALDB=FormatLines.commaSeparatedStringToStringArray(properties.getProperty("WORLDCALDB").trim());
           VSASchema.WORLDCOMMDB=FormatLines.commaSeparatedStringToStringArray(properties.getProperty("WORLDCOMMDB").trim());
           */

        } catch (Exception e) {
            // TODO Auto-generated catch block
            logger.info("error in loading OSA.properites "+e);
            e.printStackTrace();
        }
        
	}
	public static synchronized  void getSingletonObject() {
	  //  logger.info ("SO "+singletonObject);
		if (singletonObject == null) {
			singletonObject = new LoadOSAProperties();
		}
		logger.info ("SOEX "+singletonObject);
	//	return singletonObject;
	}
	public Object clone() throws CloneNotSupportedException {
		throw new CloneNotSupportedException();
	}
}
