org.apache.catalina.mbeans
Class ServerLifecycleListener

java.lang.Object
  extended byorg.apache.catalina.mbeans.ServerLifecycleListener
All Implemented Interfaces:
ContainerListener, java.util.EventListener, LifecycleListener, java.beans.PropertyChangeListener

public class ServerLifecycleListener
extends java.lang.Object
implements ContainerListener, LifecycleListener, java.beans.PropertyChangeListener

Implementation of LifecycleListener that instantiates the set of MBeans associated with the components of a running instance of Catalina.

Version:
$Revision: 1.40 $ $Date: 2004/08/26 21:36:08 $
Author:
Craig R. McClanahan, Amy Roh

Field Summary
protected  int debug
          The debugging detail level for this component.
protected  java.lang.String descriptors
          Semicolon separated list of paths containing MBean desciptor resources.
 
Constructor Summary
ServerLifecycleListener()
           
 
Method Summary
 void containerEvent(ContainerEvent event)
          Handle a ContainerEvent from one of the Containers we are interested in.
protected  void createMBeans()
          Create the MBeans that correspond to every existing node of our tree.
protected  void createMBeans(Connector connector)
          Create the MBeans for the specified Connector and its nested components.
protected  void createMBeans(Context context)
          Create the MBeans for the specified Context and its nested components.
protected  void createMBeans(ContextEnvironment environment)
          Create the MBeans for the specified ContextEnvironment entry.
protected  void createMBeans(ContextResource resource)
          Create the MBeans for the specified ContextResource entry.
protected  void createMBeans(ContextResourceLink resourceLink)
          Create the MBeans for the specified ContextResourceLink entry.
protected  void createMBeans(DefaultContext dcontext)
          Create the MBeans for the specified DefaultContext and its nested components.
protected  void createMBeans(Engine engine)
          Create the MBeans for the specified Engine and its nested components.
protected  void createMBeans(Host host)
          Create the MBeans for the specified Host and its nested components.
protected  void createMBeans(MBeanFactory factory)
          Create the MBeans for MBeanFactory.
protected  void createMBeans(NamingResources resources)
          Create the MBeans for the specified NamingResources and its nested components.
protected  void createMBeans(Server server)
          Create the MBeans for the specified Server and its nested components.
protected  void createMBeans(Service service)
          Create the MBeans for the specified Service and its nested components.
protected  void createMBeans(Wrapper wrapper)
          Create the MBeans for the specified Servlet entry.
protected  void destroyMBeans()
          Destroy the MBeans that correspond to every existing node of our tree.
protected  void destroyMBeans(Connector connector, Service service)
          Deregister the MBeans for the specified Connector and its nested components.
protected  void destroyMBeans(Context context)
          Deregister the MBeans for the specified Context and its nested components.
protected  void destroyMBeans(ContextEnvironment environment)
          Deregister the MBeans for the specified ContextEnvironment entry.
protected  void destroyMBeans(ContextResource resource)
          Deregister the MBeans for the specified ContextResource entry.
protected  void destroyMBeans(ContextResourceLink resourceLink)
          Deregister the MBeans for the specified ContextResourceLink entry.
protected  void destroyMBeans(DefaultContext dcontext)
          Deregister the MBeans for the specified DefaultContext and its nested components.
protected  void destroyMBeans(Engine engine)
          Deregister the MBeans for the specified Engine and its nested components.
protected  void destroyMBeans(Host host)
          Deregister the MBeans for the specified Host and its nested components.
protected  void destroyMBeans(NamingResources resources)
          Deregister the MBeans for the specified NamingResources and its nested components.
protected  void destroyMBeans(Server server)
          Deregister the MBeans for the specified Server and its related components.
protected  void destroyMBeans(Service service)
          Deregister the MBeans for the specified Service and its nested components.
protected  void destroyMBeans(Wrapper wrapper)
          Deregister the MBeans for the specified wrapper entry.
 int getDebug()
           
 java.lang.String getDescriptors()
           
 boolean getJsr77Names()
          Enable registration of contexts and servlet wrappers using JSR77 naming pattern.
 void lifecycleEvent(LifecycleEvent event)
          Primary entry point for startup and shutdown events.
protected  void loadMBeanDescriptors()
          Load additional MBean descriptor resources.
protected  void log(java.lang.String message)
          Log a message.
protected  void log(java.lang.String message, java.lang.Throwable throwable)
          Log a message and associated exception.
protected  void processContainerAddChild(Container parent, Container child)
          Process the addition of a new child Container to a parent Container.
protected  void processContainerAddValve(Container container, Valve valve)
          Process the addition of a new Valve to a Container.
protected  void processContainerPropertyChange(Container container, java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)
          Process a property change event on a Container.
protected  void processContainerRemoveChild(Container parent, Container child)
          Process the removal of a child Container from a parent Container.
protected  void processContainerRemoveValve(Container container, Valve valve)
          Process the removal of a Valve from a Container.
protected  void processDefaultContextPropertyChange(DefaultContext defaultContext, java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)
          Process a property change event on a DefaultContext.
protected  void processNamingResourcesPropertyChange(NamingResources resources, java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)
          Process a property change event on a NamingResources.
protected  void processServerPropertyChange(Server server, java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)
          Process a property change event on a Server.
protected  void processServicePropertyChange(Service service, java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)
          Process a property change event on a Service.
 void propertyChange(java.beans.PropertyChangeEvent event)
          Handle a PropertyChangeEvent from one of the Containers we are interested in.
 void setDebug(int debug)
           
 void setDescriptors(java.lang.String descriptors)
           
 void setJsr77Names(boolean b)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debug

protected int debug
The debugging detail level for this component.


descriptors

protected java.lang.String descriptors
Semicolon separated list of paths containing MBean desciptor resources.

Constructor Detail

ServerLifecycleListener

public ServerLifecycleListener()
Method Detail

getDebug

public int getDebug()

setDebug

public void setDebug(int debug)

setJsr77Names

public void setJsr77Names(boolean b)

getJsr77Names

public boolean getJsr77Names()
Enable registration of contexts and servlet wrappers using JSR77 naming pattern.


getDescriptors

public java.lang.String getDescriptors()

setDescriptors

public void setDescriptors(java.lang.String descriptors)

containerEvent

public void containerEvent(ContainerEvent event)
Handle a ContainerEvent from one of the Containers we are interested in.

Specified by:
containerEvent in interface ContainerListener
Parameters:
event - The event that has occurred

lifecycleEvent

public void lifecycleEvent(LifecycleEvent event)
Primary entry point for startup and shutdown events.

Specified by:
lifecycleEvent in interface LifecycleListener
Parameters:
event - The event that has occurred

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent event)
Handle a PropertyChangeEvent from one of the Containers we are interested in.

Specified by:
propertyChange in interface java.beans.PropertyChangeListener
Parameters:
event - The event that has occurred

loadMBeanDescriptors

protected void loadMBeanDescriptors()
Load additional MBean descriptor resources.


createMBeans

protected void createMBeans()
Create the MBeans that correspond to every existing node of our tree.


createMBeans

protected void createMBeans(Connector connector)
                     throws java.lang.Exception
Create the MBeans for the specified Connector and its nested components.

Parameters:
connector - Connector for which to create MBeans
Throws:
java.lang.Exception - if an exception is thrown during MBean creation

createMBeans

protected void createMBeans(Context context)
                     throws java.lang.Exception
Create the MBeans for the specified Context and its nested components.

Parameters:
context - Context for which to create MBeans
Throws:
java.lang.Exception - if an exception is thrown during MBean creation

createMBeans

protected void createMBeans(ContextEnvironment environment)
                     throws java.lang.Exception
Create the MBeans for the specified ContextEnvironment entry.

Parameters:
environment - ContextEnvironment for which to create MBeans
Throws:
java.lang.Exception - if an exception is thrown during MBean creation

createMBeans

protected void createMBeans(Wrapper wrapper)
                     throws java.lang.Exception
Create the MBeans for the specified Servlet entry.

Parameters:
wrapper -
Throws:
java.lang.Exception - if an exception is thrown during MBean creation

createMBeans

protected void createMBeans(ContextResource resource)
                     throws java.lang.Exception
Create the MBeans for the specified ContextResource entry.

Parameters:
resource - ContextResource for which to create MBeans
Throws:
java.lang.Exception - if an exception is thrown during MBean creation

createMBeans

protected void createMBeans(ContextResourceLink resourceLink)
                     throws java.lang.Exception
Create the MBeans for the specified ContextResourceLink entry.

Parameters:
resourceLink - ContextResourceLink for which to create MBeans
Throws:
java.lang.Exception - if an exception is thrown during MBean creation

createMBeans

protected void createMBeans(DefaultContext dcontext)
                     throws java.lang.Exception
Create the MBeans for the specified DefaultContext and its nested components.

Parameters:
dcontext - DefaultContext for which to create MBeans
Throws:
java.lang.Exception - if an exception is thrown during MBean creation

createMBeans

protected void createMBeans(Engine engine)
                     throws java.lang.Exception
Create the MBeans for the specified Engine and its nested components.

Parameters:
engine - Engine for which to create MBeans
Throws:
java.lang.Exception - if an exception is thrown during MBean creation

createMBeans

protected void createMBeans(Host host)
                     throws java.lang.Exception
Create the MBeans for the specified Host and its nested components.

Parameters:
host - Host for which to create MBeans
Throws:
java.lang.Exception - if an exception is thrown during MBean creation

createMBeans

protected void createMBeans(MBeanFactory factory)
                     throws java.lang.Exception
Create the MBeans for MBeanFactory.

Parameters:
factory - MBeanFactory for which to create MBean
Throws:
java.lang.Exception - if an exception is thrown during MBean creation

createMBeans

protected void createMBeans(NamingResources resources)
                     throws java.lang.Exception
Create the MBeans for the specified NamingResources and its nested components.

Parameters:
resources - NamingResources for which to create MBeans
Throws:
java.lang.Exception

createMBeans

protected void createMBeans(Server server)
                     throws java.lang.Exception
Create the MBeans for the specified Server and its nested components.

Parameters:
server - Server for which to create MBeans
Throws:
java.lang.Exception - if an exception is thrown during MBean creation

createMBeans

protected void createMBeans(Service service)
                     throws java.lang.Exception
Create the MBeans for the specified Service and its nested components.

Parameters:
service - Service for which to create MBeans
Throws:
java.lang.Exception - if an exception is thrown during MBean creation

destroyMBeans

protected void destroyMBeans()
Destroy the MBeans that correspond to every existing node of our tree.


destroyMBeans

protected void destroyMBeans(Connector connector,
                             Service service)
                      throws java.lang.Exception
Deregister the MBeans for the specified Connector and its nested components.

Parameters:
connector - Connector for which to deregister MBeans
Throws:
java.lang.Exception - if an exception is thrown during MBean destruction

destroyMBeans

protected void destroyMBeans(Context context)
                      throws java.lang.Exception
Deregister the MBeans for the specified Context and its nested components.

Parameters:
context - Context for which to deregister MBeans
Throws:
java.lang.Exception - if an exception is thrown during MBean destruction

destroyMBeans

protected void destroyMBeans(Wrapper wrapper)
                      throws java.lang.Exception
Deregister the MBeans for the specified wrapper entry.

Parameters:
wrapper - ContextEnvironment for which to destroy MBeans
Throws:
java.lang.Exception - if an exception is thrown during MBean destruction

destroyMBeans

protected void destroyMBeans(ContextEnvironment environment)
                      throws java.lang.Exception
Deregister the MBeans for the specified ContextEnvironment entry.

Parameters:
environment - ContextEnvironment for which to destroy MBeans
Throws:
java.lang.Exception - if an exception is thrown during MBean destruction

destroyMBeans

protected void destroyMBeans(ContextResource resource)
                      throws java.lang.Exception
Deregister the MBeans for the specified ContextResource entry.

Parameters:
resource - ContextResource for which to destroy MBeans
Throws:
java.lang.Exception - if an exception is thrown during MBean destruction

destroyMBeans

protected void destroyMBeans(ContextResourceLink resourceLink)
                      throws java.lang.Exception
Deregister the MBeans for the specified ContextResourceLink entry.

Parameters:
resourceLink - ContextResourceLink for which to destroy MBeans
Throws:
java.lang.Exception - if an exception is thrown during MBean destruction

destroyMBeans

protected void destroyMBeans(DefaultContext dcontext)
                      throws java.lang.Exception
Deregister the MBeans for the specified DefaultContext and its nested components.

Parameters:
dcontext - DefaultContext for which to deregister MBeans
Throws:
java.lang.Exception - if an exception is thrown during MBean destruction

destroyMBeans

protected void destroyMBeans(Engine engine)
                      throws java.lang.Exception
Deregister the MBeans for the specified Engine and its nested components.

Parameters:
engine - Engine for which to destroy MBeans
Throws:
java.lang.Exception - if an exception is thrown during MBean destruction

destroyMBeans

protected void destroyMBeans(Host host)
                      throws java.lang.Exception
Deregister the MBeans for the specified Host and its nested components.

Parameters:
host - Host for which to destroy MBeans
Throws:
java.lang.Exception - if an exception is thrown during MBean destruction

destroyMBeans

protected void destroyMBeans(NamingResources resources)
                      throws java.lang.Exception
Deregister the MBeans for the specified NamingResources and its nested components.

Parameters:
resources - NamingResources for which to destroy MBeans
Throws:
java.lang.Exception - if an exception is thrown during MBean destruction

destroyMBeans

protected void destroyMBeans(Server server)
                      throws java.lang.Exception
Deregister the MBeans for the specified Server and its related components.

Parameters:
server - Server for which to destroy MBeans
Throws:
java.lang.Exception - if an exception is thrown during MBean destruction

destroyMBeans

protected void destroyMBeans(Service service)
                      throws java.lang.Exception
Deregister the MBeans for the specified Service and its nested components.

Parameters:
service - Service for which to destroy MBeans
Throws:
java.lang.Exception - if an exception is thrown during MBean destruction

log

protected void log(java.lang.String message)
Log a message.

Parameters:
message - The message to be logged

log

protected void log(java.lang.String message,
                   java.lang.Throwable throwable)
Log a message and associated exception.

Parameters:
message - The message to be logged
throwable - The exception to be logged

processContainerAddChild

protected void processContainerAddChild(Container parent,
                                        Container child)
Process the addition of a new child Container to a parent Container.

Parameters:
parent - Parent container
child - Child container

processContainerAddValve

protected void processContainerAddValve(Container container,
                                        Valve valve)
                                 throws java.lang.Exception
Process the addition of a new Valve to a Container.

Parameters:
container - The affected Container
valve - The new Valve
Throws:
java.lang.Exception

processContainerPropertyChange

protected void processContainerPropertyChange(Container container,
                                              java.lang.String propertyName,
                                              java.lang.Object oldValue,
                                              java.lang.Object newValue)
                                       throws java.lang.Exception
Process a property change event on a Container.

Parameters:
container - The container on which this event occurred
propertyName - The name of the property that changed
oldValue - The previous value (may be null)
newValue - The new value (may be null)
Throws:
java.lang.Exception - if an exception is thrown

processDefaultContextPropertyChange

protected void processDefaultContextPropertyChange(DefaultContext defaultContext,
                                                   java.lang.String propertyName,
                                                   java.lang.Object oldValue,
                                                   java.lang.Object newValue)
                                            throws java.lang.Exception
Process a property change event on a DefaultContext.

Parameters:
defaultContext - The DefaultContext on which this event occurred
propertyName - The name of the property that changed
oldValue - The previous value (may be null)
newValue - The new value (may be null)
Throws:
java.lang.Exception - if an exception is thrown

processContainerRemoveChild

protected void processContainerRemoveChild(Container parent,
                                           Container child)
Process the removal of a child Container from a parent Container.

Parameters:
parent - Parent container
child - Child container

processContainerRemoveValve

protected void processContainerRemoveValve(Container container,
                                           Valve valve)
Process the removal of a Valve from a Container.

Parameters:
container - The affected Container
valve - The old Valve

processNamingResourcesPropertyChange

protected void processNamingResourcesPropertyChange(NamingResources resources,
                                                    java.lang.String propertyName,
                                                    java.lang.Object oldValue,
                                                    java.lang.Object newValue)
                                             throws java.lang.Exception
Process a property change event on a NamingResources.

Parameters:
resources - The global naming resources on which this event occurred
propertyName - The name of the property that changed
oldValue - The previous value (may be null)
newValue - The new value (may be null)
Throws:
java.lang.Exception - if an exception is thrown

processServerPropertyChange

protected void processServerPropertyChange(Server server,
                                           java.lang.String propertyName,
                                           java.lang.Object oldValue,
                                           java.lang.Object newValue)
                                    throws java.lang.Exception
Process a property change event on a Server.

Parameters:
server - The server on which this event occurred
propertyName - The name of the property that changed
oldValue - The previous value (may be null)
newValue - The new value (may be null)
Throws:
java.lang.Exception - if an exception is thrown

processServicePropertyChange

protected void processServicePropertyChange(Service service,
                                            java.lang.String propertyName,
                                            java.lang.Object oldValue,
                                            java.lang.Object newValue)
                                     throws java.lang.Exception
Process a property change event on a Service.

Parameters:
service - The service on which this event occurred
propertyName - The name of the property that changed
oldValue - The previous value (may be null)
newValue - The new value (may be null)
Throws:
java.lang.Exception - if an exception is thrown


Copyright 2000-2002 Apache Software Foundation. All Rights Reserved.