org.objectweb.easybeans.server.war
Class EasyBeansContextListener

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

public class EasyBeansContextListener
extends java.lang.Object
implements javax.servlet.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

Nested Class Summary
private static class EasyBeansContextListener.AvailableWebContainer
          List of available supported container.
 
Field Summary
private static java.lang.String COMMON_LIBRARIES_LIST
          Resource containing the list of files.
private  EasyBeansContextListener.AvailableWebContainer containerType
          Container detected ?.
static java.lang.String DEFAULT_XML_FILE
          Default XML file.
private  Embedded embedded
          Embedded instance.
private static JLog logger
          Logger.
 
Constructor Summary
EasyBeansContextListener()
           
 
Method Summary
 void contextDestroyed(javax.servlet.ServletContextEvent servletContextEvent)
          Notification that the servlet context is about to be shut down.
 void contextInitialized(javax.servlet.ServletContextEvent servletContextEvent)
          Notification that the web application initialization process is starting.
private  java.lang.String detectWebContainerDirectory()
          Gets the directory for EJB3 depending on the servlet container.
protected  void getLibraries(javax.servlet.ServletContext sContext, java.util.List<java.lang.String> libraries)
          Retrieve a List of libraries to be loaded by TopLevel ClassLoaders.
protected  ServerConfig getServerConfig()
           
private  void registerLibraries(javax.servlet.ServletContextEvent servletContextEvent)
          Register the EasyBeans libraries in the root classloader (allowing each applications to communicate with EasyBeans).
private  void registerTomcat(javax.servlet.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

COMMON_LIBRARIES_LIST

private static final java.lang.String COMMON_LIBRARIES_LIST
Resource containing the list of files.

See Also:
Constant Field Values

DEFAULT_XML_FILE

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

See Also:
Constant Field Values

logger

private static JLog logger
Logger.


embedded

private Embedded embedded
Embedded instance.


containerType

private EasyBeansContextListener.AvailableWebContainer containerType
Container detected ?.

Constructor Detail

EasyBeansContextListener

public EasyBeansContextListener()
Method Detail

contextInitialized

public void contextInitialized(javax.servlet.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 javax.servlet.ServletContextListener
Parameters:
servletContextEvent - event class for notifications about changes to the servlet context of a web application.

contextDestroyed

public void contextDestroyed(javax.servlet.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 javax.servlet.ServletContextListener
Parameters:
servletContextEvent - event class for notifications about changes to the servlet context of a web application.

detectWebContainerDirectory

private java.lang.String detectWebContainerDirectory()
Gets the directory for EJB3 depending on the servlet container.

Returns:
path to catalina.base/jetty.home/etc.

registerLibraries

private void registerLibraries(javax.servlet.ServletContextEvent servletContextEvent)
Register the EasyBeans libraries in the root classloader (allowing each applications to communicate with EasyBeans).

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

registerTomcat

private void registerTomcat(javax.servlet.ServletContextEvent servletContextEvent)
Register the EasyBeans libraries for Tomcat.

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

getLibraries

protected void getLibraries(javax.servlet.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.

getServerConfig

protected ServerConfig getServerConfig()
Returns:
returns the Easybeans ServerConfig object.