org.jaffa.config
Class InitApp

java.lang.Object
  extended byjavax.servlet.GenericServlet
      extended byjavax.servlet.http.HttpServlet
          extended byorg.jaffa.config.InitApp
All Implemented Interfaces:
Serializable, Servlet, ServletConfig

public class InitApp
extends HttpServlet

This servlet is called by web.xml as part of the startup process. It is used to initialize the Logging API and to also get a handle on the base diretory that the web application is deployed in. This can be used as a reference point for locating resources relative to the deployment of the web app. The following optional parameters can be passed to this servlet: framework.ApplicationResourcesLocation - The physical path of where the ApplicationResources.properties is. Example Absolute location : "C:\tomcat\webapps\Tools\WEB-INF\classes\resources\ApplicationResources.properties" Example Relative to classpath : "resources/ApplicationResources.properties" NOTE: This value will have to be provided to the Struts ActionServlet as well in web.xml or struts-config.xml framework.ApplicationResourcesDefaultLocation - The physical path of where the ApplicationResources.default is. Example Absolute location : "C:\tomcat\webapps\Tools\WEB-INF\classes\resources\ApplicationResources.default" Example Relative to classpath : "resources/ApplicationResources.default" framework.ApplicationResourcesOverrideLocation - The physical path of where the ApplicationResources.override is. Example "C:/ApplicationResources.override" Example Relative to classpath : "resources/ApplicationResources.override" NOTE: It is recommended that this file will outside the webapp, so that it is not overwritten during product upgrades. If the values are provided for the above parameters, this servlet will combine the ApplicationResources.default and ApplicationResources.override files to generate the ApplicationResources.properties file. Additionally, the servlet will set the appropriate dynamic properties in the org.jaffa.config.Config class. These parameters control the working of the 'Jaffa.Admin.LabelEditor' component.

See Also:
Serialized Form

Constructor Summary
InitApp()
           
 
Method Summary
 void destroy()
          This is invoked by the servlet container when the servlet is destroyed.
static void generateApplicationResources()
          Combines the ApplicationResources.default and ApplicationResources.override files into the ApplicationResources.properties file.
 void init(ServletConfig cfg)
          This is invoked by the servlet container when the servlet is first loaded.
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InitApp

public InitApp()
Method Detail

init

public void init(ServletConfig cfg)
          throws ServletException
This is invoked by the servlet container when the servlet is first loaded. It first invokes the init method of the super class. It then initialises the logging API and gets a handle on the webapp which invoked this servlet.

Parameters:
cfg - the Servlet configuration passed by the container.
Throws:
ServletException - if any error occurs.

destroy

public void destroy()
This is invoked by the servlet container when the servlet is destroyed. It clears up the settings related to the logging API. It then invokes the destroy method of the super class.


generateApplicationResources

public static void generateApplicationResources()
                                         throws IOException
Combines the ApplicationResources.default and ApplicationResources.override files into the ApplicationResources.properties file. The locations for the files are obtained from the dynamic properties set in the Config class. If the locations are not set, then nothing will be done.

Throws:
IOException - if any I/O error occurs.


Copyright © 2002-2004 JAFFA Project.