org.apache.catalina.core

Class StandardService

Implemented Interfaces:
Lifecycle, MBeanRegistration, Service
Known Direct Subclasses:
Embedded

public class StandardService
extends java.lang.Object
implements Lifecycle, Service, MBeanRegistration

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

Author:
Craig R. McClanahan

Field Summary

protected Connector[]
connectors
The set of Connectors associated with this Service.
protected Container
container
The Container associated with this Service.
protected ObjectName
controller
protected int
debug
The debugging detail level for this component.
protected String
domain
protected boolean
initialized
Has this component been initialized?
protected MBeanServer
mserver
protected ObjectName
oname
protected String
suffix
protected PropertyChangeSupport
support
The property change support for this component.
protected String
type

Fields inherited from interface org.apache.catalina.Lifecycle

AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, START_EVENT, STOP_EVENT

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(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[]
getConnectorNames()
Container
getContainer()
Return the Container that handles requests for all Connectors associated with this Service.
ObjectName
getContainerName()
int
getDebug()
Return the debugging detail level of this component.
String
getDomain()
String
getInfo()
Return descriptive information about this Service implementation and the corresponding version number, in the format <description>/<version>.
String
getName()
Return the name of this Service.
ObjectName
getObjectName()
Server
getServer()
Return the Server with which we are associated (if any).
void
init()
void
initialize()
Invoke a pre-startup initialization.
void
postDeregister()
void
postRegister(Boolean registrationDone)
void
preDeregister()
ObjectName
preRegister(MBeanServer server, ObjectName name)
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(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(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.
String
toString()
Return a String representation of this component.

Field Details

connectors

protected Connector[] connectors
The set of Connectors associated with this Service.


container

protected Container container
The Container associated with this Service. (In the case of the org.apache.catalina.startup.Embedded subclass, this holds the most recently added Engine.)


controller

protected ObjectName controller


debug

protected int debug
The debugging detail level for this component.


domain

protected String domain


initialized

protected boolean initialized
Has this component been initialized?


mserver

protected MBeanServer mserver


oname

protected ObjectName oname


suffix

protected String suffix


support

protected PropertyChangeSupport support
The property change support for this component.


type

protected String type

Method Details

addConnector

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

Parameters:
connector - The Connector to be added


addLifecycleListener

public void addLifecycleListener(LifecycleListener listener)
Add a LifecycleEvent listener to this component.
Specified by:
addLifecycleListener in interface Lifecycle

Parameters:
listener - The listener to add


addPropertyChangeListener

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

Parameters:
listener - The listener to add


destroy

public void destroy()
            throws LifecycleException


findConnectors

public Connector[] findConnectors()
Find and return the set of Connectors associated with this Service.
Specified by:
findConnectors in interface Service


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.
Specified by:
findLifecycleListeners in interface Lifecycle


getConnectorNames

public ObjectName[] getConnectorNames()


getContainer

public Container getContainer()
Return the Container that handles requests for all Connectors associated with this Service.
Specified by:
getContainer in interface Service


getContainerName

public ObjectName getContainerName()


getDebug

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


getDomain

public String getDomain()


getInfo

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


getName

public String getName()
Return the name of this Service.
Specified by:
getName in interface Service


getObjectName

public ObjectName getObjectName()


getServer

public Server getServer()
Return the Server with which we are associated (if any).
Specified by:
getServer in interface Service


init

public void init()


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.
Specified by:
initialize in interface Service


postDeregister

public void postDeregister()


postRegister

public void postRegister(Boolean registrationDone)


preDeregister

public void preDeregister()
            throws Exception


preRegister

public ObjectName preRegister(MBeanServer server,
                              ObjectName name)
            throws Exception


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.
Specified by:
removeConnector in interface Service

Parameters:
connector - The Connector to be removed


removeLifecycleListener

public void removeLifecycleListener(LifecycleListener listener)
Remove a LifecycleEvent listener from this component.
Specified by:
removeLifecycleListener in interface Lifecycle

Parameters:
listener - The listener to remove


removePropertyChangeListener

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

Parameters:
listener - The listener to remove


setContainer

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

Parameters:
container - The new Container


setDebug

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

Parameters:
debug - The new debugging detail level


setName

public void setName(String name)
Set the name of this Service.
Specified by:
setName in interface Service

Parameters:
name - The new service name


setServer

public void setServer(Server server)
Set the Server with which we are associated (if any).
Specified by:
setServer in interface Service

Parameters:
server - The server that owns this Service


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.
Specified by:
start in interface Lifecycle

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.
Specified by:
stop in interface Lifecycle

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


toString

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


Copyright B) 2000-2003 Apache Software Foundation. All Rights Reserved.