/*
 * This file is part of DebGen Biobank Software developed by ASTRID Research.
 * All rights reserved. Reproduction, modification, use or disclosure
 * to third parties without express authority is forbidden.
 *
 * Copyright ASTRID Research Inc., Hungary, 2009-2011.
 *
 * ASTRID Research
 * Headquaters: Csapo utca 42. Debrecen H-4029 HUNGARY
 * Phone: +36-52-533-173        Fax: +36-52-533-174
 * Web: http://www.astrid.hu    E-mail: info@astrid.hu
 *
 * Project name: DebGen Biobank Software project.
 * URLS:
 * Developers: Istvan Zoltan Nagy (istvan.nagy@astrid.hu)
 */
package hu.astrid.debgen.server.startup;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

/**
 * Initializes the Applications parameters
 * @author inagy
 */
public class InitApplicationParametersContextListener implements ServletContextListener {

    /**
     * Initializes
     * @param event
     */
    public void contextInitialized(ServletContextEvent event) {
        ServletContext ctx = event.getServletContext();

        ApplicationParameters.setApplicationName(ctx.getInitParameter("applicationname"));
        ApplicationParameters.setApplicationURL(ctx.getInitParameter("applicationurl"));
        ApplicationParameters.setApplicationURI(ctx.getInitParameter("applicationuri"));
        ApplicationParameters.setLocaleIsoCode(ctx.getInitParameter("localeisocode"));
        ApplicationParameters.setLanguage(ctx.getInitParameter("language"));
    }

    /**
     * Destroys
     * @param arg0
     */
    public void contextDestroyed(ServletContextEvent arg0) {
        //Nothing to do.
    }
}
