org.ow2.easybeans.server.war
Class EasyBeansContextListener

java.lang.Object
  extended by org.ow2.easybeans.server.war.EasyBeansContextListener
All Implemented Interfaces:
java.util.EventListener, ServletContextListener

public class EasyBeansContextListener
extends java.lang.Object
implements ServletContextListener

Listener class which is notified of lifecycle events. It allows to start EasyBeans at startup and stop it at the end.

Author:
Florent Benoit

Field Summary
static java.lang.String DEFAULT_BOOTSTRAP_CLASS
          Default Bootstrap class to instantiate.
static java.lang.String DEFAULT_XML_FILE
          Default XML file.
static java.lang.String DEPMONITOR_XML_FILE
          Depmonitor XML file.
 
Constructor Summary
EasyBeansContextListener()
           
 
Method Summary
protected  void addLib(java.lang.ClassLoader cl, ServletContextEvent servletContextEvent)
          Add libraries in the given classloader.
 void contextDestroyed(ServletContextEvent servletContextEvent)
          Notification that the servlet context is about to be shut down.
 void contextInitialized(ServletContextEvent servletContextEvent)
          Notification that the web application initialization process is starting.
protected  void detectContainerType()
          Detect the web Container type.
protected  java.lang.String getBootstrapClassName()
           
protected  java.util.List<java.lang.String> getExportedLibraries()
           
protected  void getLibraries(ServletContext sContext, java.util.List<java.lang.String> libraries)
          Retrieve a List of libraries to be loaded by TopLevel ClassLoaders.
protected  void registerJetty(ServletContextEvent servletContextEvent)
          Register the EasyBeans libraries for Jetty.
protected  void registerTomcat(ServletContextEvent servletContextEvent)
          Register the EasyBeans libraries for Tomcat.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_XML_FILE

public static final java.lang.String DEFAULT_XML_FILE
Default XML file.

See Also:
Constant Field Values

DEPMONITOR_XML_FILE

public static final java.lang.String DEPMONITOR_XML_FILE
Depmonitor XML file.

See Also:
Constant Field Values

DEFAULT_BOOTSTRAP_CLASS

public static final java.lang.String DEFAULT_BOOTSTRAP_CLASS
Default Bootstrap class to instantiate.

See Also:
Constant Field Values
Constructor Detail

EasyBeansContextListener

public EasyBeansContextListener()
Method Detail

contextInitialized

public void contextInitialized(ServletContextEvent servletContextEvent)
Notification that the web application initialization process is starting. All ServletContextListeners are notified of context initialization before any filter or servlet in the web application is initialized.

Specified by:
contextInitialized in interface ServletContextListener
Parameters:
servletContextEvent - event class for notifications about changes to the servlet context of a web application.

contextDestroyed

public void contextDestroyed(ServletContextEvent servletContextEvent)
Notification that the servlet context is about to be shut down. All servlets and filters have been destroy()ed before any ServletContextListeners are notified of context destruction.

Specified by:
contextDestroyed in interface ServletContextListener
Parameters:
servletContextEvent - event class for notifications about changes to the servlet context of a web application.

detectContainerType

protected void detectContainerType()
Detect the web Container type.


registerJetty

protected void registerJetty(ServletContextEvent servletContextEvent)
Register the EasyBeans libraries for Jetty.

Parameters:
servletContextEvent - event class for notifications about changes to the servlet context of a web application.

registerTomcat

protected void registerTomcat(ServletContextEvent servletContextEvent)
Register the EasyBeans libraries for Tomcat.

Parameters:
servletContextEvent - event class for notifications about changes to the servlet context of a web application.

addLib

protected void addLib(java.lang.ClassLoader cl,
                      ServletContextEvent servletContextEvent)
Add libraries in the given classloader.

Parameters:
cl - the classloader where to add jars (which needs to be an URLClassLoader)
servletContextEvent - the servlet context event

getLibraries

protected void getLibraries(ServletContext sContext,
                            java.util.List<java.lang.String> libraries)
Retrieve a List of libraries to be loaded by TopLevel ClassLoaders.

Parameters:
sContext - ServletContext.
libraries - List of libs.

getBootstrapClassName

protected java.lang.String getBootstrapClassName()
Returns:
the bootstrap class name to use.

getExportedLibraries

protected java.util.List<java.lang.String> getExportedLibraries()
Returns:
a List of resources that contains the libraries to be exported.


Copyright © 2006-2009 OW2 Consortium. All Rights Reserved.