## org.apache.catalina.core
Class StandardService

    java.lang.Object
      |
      +--org.apache.catalina.core.StandardService

All Implemented Interfaces:
  Lifecycle, Service

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

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

Version:
  $Revision: 1.6 $ $Date: 2001/09/04 19:19:48 $
Author:
  Craig R. McClanahan

Field Summary

Fields inherited from interface org.apache.catalina.Lifecycle
`START_EVENT, STOP_EVENT`

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.
`Connector[]` `findConnectors()` Find and return the set of Connectors associated with this Service.
`Container` `getContainer()` Return the `Container` that handles requests for all `Connectors` associated with this Service.
`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.
`void` `initialize()` Invoke a pre-startup initialization.
`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` `setContainer(Container container)` Set the `Container` that handles requests for all `Connectors` associated with this Service.
`void` `setName(java.lang.String name)` Set the name of this Service.
`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`

Constructor Detail

### StandardService

    public StandardService()

Method Detail

### getContainer

    public Container getContainer()

  Return the `Container` that handles requests for all `Connectors` associated with this Service.

  Specified by:
    `getContainer` in interface `Service`

### 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

### getInfo

    public java.lang.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 java.lang.String getName()

  Return the name of this Service.

  Specified by:
    `getName` in interface `Service`

### setName

    public void setName(java.lang.String name)

  Set the name of this Service.

  Specified by:
    `setName` in interface `Service`
  Parameters:
    `name` - The new service name

### 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

### findConnectors

    public Connector[] findConnectors()

  Find and return the set of Connectors associated with this Service.

  Specified by:
    `findConnectors` in interface `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.

  Specified by:
    `removeConnector` in interface `Service`
  Parameters:
    `connector` - The Connector to be removed

### toString

    public java.lang.String toString()

  Return a String representation of this component.

  Overrides:
    `toString` in class `java.lang.Object`

### 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

### 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

### 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:
    `java.lang.IllegalStateException` - if this component has already been started
    `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:
    `java.lang.IllegalStateException` - if this component has not been started
    `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.

  Specified by:
    `initialize` in interface `Service`
  Throws:
    `LifecycleException` - If this server was already initialized.

Copyright © 2000-2001 Apache Software Foundation. All Rights Reserved.