org.jboss.web.tomcat.tc5
Class StandardService

java.lang.Object
  extended byorg.jboss.web.tomcat.tc5.StandardService
All Implemented Interfaces:
MBeanRegistration (src)

public class StandardService
extends java.lang.Object
implements MBeanRegistration (src)

Standard implementation of the Service interface. The associated Container is generally an instance of Engine, but this is not required.

This version does not start the connectors in the start method so that all web apps may be completely deployed before enabling the transport layer.


Field Summary
protected  ObjectName (src) controller
           
protected  java.lang.String domain
           
protected  MBeanServer (src) mserver
           
protected  ObjectName (src) oname
           
protected  java.lang.String suffix
           
protected  java.beans.PropertyChangeSupport support
          The property change support for this component.
protected  java.lang.String type
           
 
Constructor Summary
StandardService()
           
 
Method Summary
 void addConnector(Connector connector)
          Add a new Connector to the set of defined Connectors, and associate it with this Service's Container.
 void addLifecycleListener(LifecycleListener listener)
          Add a LifecycleEvent listener to this component.
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Add a property change listener to this component.
 void destroy()
           
 Connector[] findConnectors()
          Find and return the set of Connectors associated with this Service.
 LifecycleListener[] findLifecycleListeners()
          Get the lifecycle listeners associated with this lifecycle.
 ObjectName (src) [] getConnectorNames()
           
 Container getContainer()
          Return the Container that handles requests for all Connectors associated with this Service.
 ObjectName (src) getContainerName()
           
 int getDebug()
          Return the debugging detail level of this component.
 java.lang.String getDomain()
           
 java.lang.String getInfo()
          Return descriptive information about this Service implementation and the corresponding version number, in the format <description>/<version>.
 java.lang.String getName()
          Return the name of this Service.
 ObjectName (src) getObjectName()
           
 Server getServer()
          Return the Server with which we are associated (if any).
 void init()
           
 void initialize()
          Invoke a pre-startup initialization.
 void postDeregister()
          This method is called by the MBeanServer after deregistration takes place.
 void postRegister(java.lang.Boolean registrationDone)
          This method is called by the MBeanServer after registration takes place or when registration fails.
 void preDeregister()
          This method is called by the MBeanServer before deregistration takes place.
 ObjectName (src) preRegister(MBeanServer (src)  server, ObjectName (src)  name)
          This method is called by the MBeanServer before registration takes place.
 void removeConnector(Connector connector)
          Remove the specified Connector from the set associated from this Service.
 void removeLifecycleListener(LifecycleListener listener)
          Remove a LifecycleEvent listener from this component.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Remove a property change listener from this component.
 void setContainer(Container container)
          Set the Container that handles requests for all Connectors associated with this Service.
 void setDebug(int debug)
          Set the debugging detail level of this component.
 void setName(java.lang.String name)
          Set the name of this Service.
 void setServer(Server server)
          Set the Server with which we are associated (if any).
 void start()
          Prepare for the beginning of active use of the public methods of this component.
 void stop()
          Gracefully terminate the active use of the public methods of this component.
 java.lang.String toString()
          Return a String representation of this component.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

support

protected java.beans.PropertyChangeSupport support
The property change support for this component.


type

protected java.lang.String type

domain

protected java.lang.String domain

suffix

protected java.lang.String suffix

oname

protected ObjectName (src)  oname

controller

protected ObjectName (src)  controller

mserver

protected MBeanServer (src)  mserver
Constructor Detail

StandardService

public StandardService()
Method Detail

getContainer

public Container getContainer()
Return the Container that handles requests for all Connectors associated with this Service.


setContainer

public void setContainer(Container container)
Set the Container that handles requests for all Connectors associated with this Service.

Parameters:
container - The new Container

getContainerName

public ObjectName (src)  getContainerName()

getDebug

public int getDebug()
Return the debugging detail level of this component.


setDebug

public void setDebug(int debug)
Set the debugging detail level of this component.

Parameters:
debug - The new debugging detail level

getInfo

public java.lang.String getInfo()
Return descriptive information about this Service implementation and the corresponding version number, in the format <description>/<version>.


getName

public java.lang.String getName()
Return the name of this Service.


setName

public void setName(java.lang.String name)
Set the name of this Service.

Parameters:
name - The new service name

getServer

public Server getServer()
Return the Server with which we are associated (if any).


setServer

public void setServer(Server server)
Set the Server with which we are associated (if any).

Parameters:
server - The server that owns this Service

addConnector

public void addConnector(Connector connector)
Add a new Connector to the set of defined Connectors, and associate it with this Service's Container.

Parameters:
connector - The Connector to be added

getConnectorNames

public ObjectName (src) [] getConnectorNames()

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Add a property change listener to this component.

Parameters:
listener - The listener to add

findConnectors

public Connector[] findConnectors()
Find and return the set of Connectors associated with this Service.


removeConnector

public void removeConnector(Connector connector)
Remove the specified Connector from the set associated from this Service. The removed Connector will also be disassociated from our Container.

Parameters:
connector - The Connector to be removed

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Remove a property change listener from this component.

Parameters:
listener - The listener to remove

toString

public java.lang.String toString()
Return a String representation of this component.


addLifecycleListener

public void addLifecycleListener(LifecycleListener listener)
Add a LifecycleEvent listener to this component.

Parameters:
listener - The listener to add

findLifecycleListeners

public LifecycleListener[] findLifecycleListeners()
Get the lifecycle listeners associated with this lifecycle. If this Lifecycle has no listeners registered, a zero-length array is returned.


removeLifecycleListener

public void removeLifecycleListener(LifecycleListener listener)
Remove a LifecycleEvent listener from this component.

Parameters:
listener - The listener to remove

start

public void start()
           throws LifecycleException
Prepare for the beginning of active use of the public methods of this component. This method should be called before any of the public methods of this component are utilized. It should also send a LifecycleEvent of type START_EVENT to any registered listeners.

Throws:
LifecycleException - if this component detects a fatal error that prevents this component from being used

stop

public void stop()
          throws LifecycleException
Gracefully terminate the active use of the public methods of this component. This method should be the last one called on a given instance of this component. It should also send a LifecycleEvent of type STOP_EVENT to any registered listeners.

Throws:
LifecycleException - if this component detects a fatal error that needs to be reported

initialize

public void initialize()
                throws LifecycleException
Invoke a pre-startup initialization. This is used to allow connectors to bind to restricted ports under Unix operating environments.

Throws:
LifecycleException

destroy

public void destroy()
             throws LifecycleException
Throws:
LifecycleException

init

public void init()

getObjectName

public ObjectName (src)  getObjectName()

getDomain

public java.lang.String getDomain()

preRegister

public ObjectName (src)  preRegister(MBeanServer (src)  server,
                              ObjectName (src)  name)
                       throws java.lang.Exception
Description copied from interface: MBeanRegistration (src)
This method is called by the MBeanServer before registration takes place. The MBean is passed a reference of the MBeanServer it is about to be registered with. The MBean must return the ObjectName it will be registered with. The MBeanServer can pass a suggested object depending upon how the MBean is registered.

The MBean can stop the registration by throwing an exception.The exception is forwarded to the invoker wrapped in an MBeanRegistrationException.

Specified by:
preRegister in interface MBeanRegistration (src)
Returns:
the actual ObjectName to register this MBean with.
Throws:
java.lang.Exception - for any error, the MBean is not registered.

postRegister

public void postRegister(java.lang.Boolean registrationDone)
Description copied from interface: MBeanRegistration (src)
This method is called by the MBeanServer after registration takes place or when registration fails.

Specified by:
postRegister in interface MBeanRegistration (src)
Parameters:
registrationDone - the MBeanServer passes true when the MBean was registered, false otherwise.

preDeregister

public void preDeregister()
                   throws java.lang.Exception
Description copied from interface: MBeanRegistration (src)
This method is called by the MBeanServer before deregistration takes place.

The MBean can throw an exception, this will stop the deregistration. The exception is forwarded to the invoker wrapped in an MBeanRegistrationException.

Specified by:
preDeregister in interface MBeanRegistration (src)
Throws:
java.lang.Exception

postDeregister

public void postDeregister()
Description copied from interface: MBeanRegistration (src)
This method is called by the MBeanServer after deregistration takes place.

Specified by:
postDeregister in interface MBeanRegistration (src)