OpenNMS API 1.2.3

org.opennms.web
Class ServletInitializer

java.lang.Object
  extended byorg.opennms.web.ServletInitializer

public class ServletInitializer
extends java.lang.Object

Encapsulates all initialization and configuration needed by the OpenNMS servlets and JSPs.

Author:
Lawrence Karnowski , OpenNMS

Field Summary
protected static DbConnectionFactory factory
          A reference to the factory we set in Vaultduring initso we can destroy it in destroy.
 
Constructor Summary
private ServletInitializer()
          Private, empty constructor so that this class cannot be instantiated outside of itself.
 
Method Summary
static void destroy(javax.servlet.ServletContext context)
          Releases all shared resources on the first invocation of this method.
static java.lang.String getHomeDir()
          Deprecated. Use Vault.getHomeDirinstead.
static void init(javax.servlet.ServletContext context)
          Initialize servlet and JSP configuration on the first invocation of this method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

factory

protected static DbConnectionFactory factory
A reference to the factory we set in Vaultduring initso we can destroy it in destroy.

Maybe there's a better way to do this then storing a reference? Should we just add a method to Vault?

This reference also serves as a flag to determine whether or not this class has been initialized yet. If it is null, the class has not yet been initialized.

Constructor Detail

ServletInitializer

private ServletInitializer()
Private, empty constructor so that this class cannot be instantiated outside of itself.

Method Detail

init

public static void init(javax.servlet.ServletContext context)
                 throws javax.servlet.ServletException
Initialize servlet and JSP configuration on the first invocation of this method. All other invocations are ignored. This method is synchronized to ensure only the first invocation performs the initialization.

Call this method in the init method of your servlet or JSP. It will read the servlet initialization parameters from the ServletConfig and ServletContext and OpenNMS configuration files.

If this method finds the property opennms.db.poolman in the ServletContext, it will create an instance of the classname specified there to use as the DbConnectionManager.

Parameters:
context - the ServletContext instance in which your servlet is running
Throws:
javax.servlet.ServletException

destroy

public static void destroy(javax.servlet.ServletContext context)
                    throws javax.servlet.ServletException
Releases all shared resources on the first invocation of this method. All other invocations are ignored. This method is synchronized to ensure only the first invocation performs the destruction.

Call this method in the destroy method of your servlet or JSP.

Parameters:
context - the ServletContext instance in which your servlet is running
Throws:
javax.servlet.ServletException

getHomeDir

public static java.lang.String getHomeDir()
Deprecated. Use Vault.getHomeDirinstead.

Return the absolute pathname of where OpenNMS's configuration can be found.


OpenNMS API 1.2.3

Generated by eevans on May 29 2005 2015.