/*
 * 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 LoadVSAProperties {
    private static LoadVSAProperties singletonObject;
    
    public static Logger logger = Logger.getLogger("wsa.simple");
    
	/** A private Constructor prevents any other class from instantiating. */
	private LoadVSAProperties() {
	    
        
        
		//	 Optional Code
	    try {
	    InputStream inProp = getClass().getClassLoader().getResourceAsStream("VSA.properties");
	    
	    Properties properties = new Properties();
	
	    logger.info("loading VSA.properites");
           properties.load(inProp);

           VSASchema.VVVDB=FormatLines.commaSeparatedStringToStringArray(properties.getProperty("VVVDB").trim());
           logger.info("vvvdb0 "+VSASchema.VVVDB[0]);
           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.VIDEODB=FormatLines.commaSeparatedStringToStringArray(properties.getProperty("VIDEODB").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 VSA.properites "+e);
            e.printStackTrace();
        }
        
	}
	public static synchronized  void getSingletonObject() {
	  //  logger.info ("SO "+singletonObject);
		if (singletonObject == null) {
			singletonObject = new LoadVSAProperties();
		}
		logger.info ("SOEX "+singletonObject);
	//	return singletonObject;
	}
	public Object clone() throws CloneNotSupportedException {
		throw new CloneNotSupportedException();
	}
}
