org.slamb.axamol.library
Class ServletLibraryLoader

java.lang.Object
  extended by org.slamb.axamol.library.ServletLibraryLoader
All Implemented Interfaces:
java.util.EventListener, javax.servlet.ServletContextListener, javax.servlet.ServletRequestListener

public class ServletLibraryLoader
extends java.lang.Object
implements javax.servlet.ServletContextListener, javax.servlet.ServletRequestListener

Loads libraries and data sources in a servlet context.

This is a convenient way to ensure libraries are only instantiated once per servlet context, which improves efficiency. See the "Instantiating libraries" chapter of the manual for an example.


Field Summary
 boolean bindToRequest
           
static java.lang.String CONNECTION_ATTR
           
static java.lang.String DATASOURCE_ATTR
           
static java.lang.String DEFAULT_LIBRARY_PATH_PREFIX
           
static java.lang.String INITPARAM_BIND_TO_REQUEST
           
static java.lang.String INITPARAM_DATA_SOURCE
           
static java.lang.String INITPARAM_LIBRARIES
           
static java.lang.String INITPARAM_LIBRARY_PATH_PREFIX
           
static java.lang.String LIBRARY_ATTR_PREFIX
           
static java.lang.String LIBRARY_CONNECTION_ATTR_PREFIX
           
 
Constructor Summary
ServletLibraryLoader()
           
 
Method Summary
 void contextDestroyed(javax.servlet.ServletContextEvent sce)
           
 void contextInitialized(javax.servlet.ServletContextEvent sce)
          Finds database pools and parses the SQL libraries.
 void requestDestroyed(javax.servlet.ServletRequestEvent sre)
          Closes the LibraryConnections and Connection.
 void requestInitialized(javax.servlet.ServletRequestEvent sre)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INITPARAM_DATA_SOURCE

public static final java.lang.String INITPARAM_DATA_SOURCE
See Also:
Constant Field Values

INITPARAM_LIBRARIES

public static final java.lang.String INITPARAM_LIBRARIES
See Also:
Constant Field Values

INITPARAM_LIBRARY_PATH_PREFIX

public static final java.lang.String INITPARAM_LIBRARY_PATH_PREFIX
See Also:
Constant Field Values

INITPARAM_BIND_TO_REQUEST

public static final java.lang.String INITPARAM_BIND_TO_REQUEST
See Also:
Constant Field Values

DATASOURCE_ATTR

public static final java.lang.String DATASOURCE_ATTR
See Also:
Constant Field Values

CONNECTION_ATTR

public static final java.lang.String CONNECTION_ATTR
See Also:
Constant Field Values

LIBRARY_ATTR_PREFIX

public static final java.lang.String LIBRARY_ATTR_PREFIX
See Also:
Constant Field Values

LIBRARY_CONNECTION_ATTR_PREFIX

public static final java.lang.String LIBRARY_CONNECTION_ATTR_PREFIX
See Also:
Constant Field Values

DEFAULT_LIBRARY_PATH_PREFIX

public static final java.lang.String DEFAULT_LIBRARY_PATH_PREFIX
See Also:
Constant Field Values

bindToRequest

public boolean bindToRequest
Constructor Detail

ServletLibraryLoader

public ServletLibraryLoader()
Method Detail

contextInitialized

public void contextInitialized(javax.servlet.ServletContextEvent sce)
Finds database pools and parses the SQL libraries.

Specified by:
contextInitialized in interface javax.servlet.ServletContextListener

contextDestroyed

public void contextDestroyed(javax.servlet.ServletContextEvent sce)
Specified by:
contextDestroyed in interface javax.servlet.ServletContextListener

requestInitialized

public void requestInitialized(javax.servlet.ServletRequestEvent sre)
Specified by:
requestInitialized in interface javax.servlet.ServletRequestListener

requestDestroyed

public void requestDestroyed(javax.servlet.ServletRequestEvent sre)
Closes the LibraryConnections and Connection.

Specified by:
requestDestroyed in interface javax.servlet.ServletRequestListener


Copyright © 2002-2006 Scott Lamb. All Rights Reserved.