package gov.epa.state.sample.web;

import gov.epa.cdx.commons.log.LogFactory;
import gov.epa.cdx.commons.log.LogInterface;
import gov.epa.cdx.commons.property.CDXPropertyManager;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;


public class InitServlet extends HttpServlet {

	//Change this if you need to change the name of the properties file, for example to run 
	//two different nodes in the same container.
    protected static final String USER_CONFIG_FILE="user_properties.xml";

    protected static LogInterface log =	LogFactory.getLog(InitServlet.class.getName());

    // Initialize configuration file on startup
    public void init() throws ServletException
    {

    	log.info("Initializing the CDX Property Manager.");
    	// Intitialize the property manager
        CDXPropertyManager.init(CDXPropertyManager.GLOBAL_CONFIG_FILE,
                USER_CONFIG_FILE);

    	log.info("Loading the properties.");
        // Load the properties
        CDXPropertyManager.loadProperties();

    }

}
