org.apache.catalina

Interface Server

public interface Server

A Server element represents the entire Catalina servlet container. Its attributes represent the characteristics of the servlet container as a whole. A Server may contain one or more Services, and the top level set of naming resources.

Normally, an implementation of this interface will also implement Lifecycle, such that when the start() and stop() methods are called, all of the defined Services are also started or stopped.

In between, the implementation must open a server socket on the port number specified by the port property. When a connection is accepted, the first line is read and compared with the specified shutdown command. If the command matches, shutdown of the server is initiated.

NOTE - The concrete implementation of this class should register the (singleton) instance with the ServerFactory class in its constructor(s).

Version: $Revision: 467222 $ $Date: 2006-10-24 05:17:11 +0200 (Tue, 24 Oct 2006) $

Author: Craig R. McClanahan

Method Summary
voidaddService(Service service)
Add a new Service to the set of defined Services.
voidawait()
Wait until a proper shutdown command is received, then return.
ServicefindService(String name)
Return the specified Service (if it exists); otherwise return null.
Service[]findServices()
Return the set of Services defined within this Server.
NamingResourcesgetGlobalNamingResources()
Return the global naming resources.
StringgetInfo()
Return descriptive information about this Server implementation and the corresponding version number, in the format <description>/<version>.
intgetPort()
Return the port number we listen to for shutdown commands.
StringgetShutdown()
Return the shutdown command string we are waiting for.
voidinitialize()
Invoke a pre-startup initialization.
voidremoveService(Service service)
Remove the specified Service from the set associated from this Server.
voidsetGlobalNamingResources(NamingResources globalNamingResources)
Set the global naming resources.
voidsetPort(int port)
Set the port number we listen to for shutdown commands.
voidsetShutdown(String shutdown)
Set the shutdown command we are waiting for.

Method Detail

addService

public void addService(Service service)
Add a new Service to the set of defined Services.

Parameters: service The Service to be added

await

public void await()
Wait until a proper shutdown command is received, then return.

findService

public Service findService(String name)
Return the specified Service (if it exists); otherwise return null.

Parameters: name Name of the Service to be returned

findServices

public Service[] findServices()
Return the set of Services defined within this Server.

getGlobalNamingResources

public NamingResources getGlobalNamingResources()
Return the global naming resources.

getInfo

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

getPort

public int getPort()
Return the port number we listen to for shutdown commands.

getShutdown

public String getShutdown()
Return the shutdown command string we are waiting for.

initialize

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

Throws: LifecycleException If this server was already initialized.

removeService

public void removeService(Service service)
Remove the specified Service from the set associated from this Server.

Parameters: service The Service to be removed

setGlobalNamingResources

public void setGlobalNamingResources(NamingResources globalNamingResources)
Set the global naming resources.

Parameters: globalNamingResources The new global naming resources

setPort

public void setPort(int port)
Set the port number we listen to for shutdown commands.

Parameters: port The new port number

setShutdown

public void setShutdown(String shutdown)
Set the shutdown command we are waiting for.

Parameters: shutdown The new shutdown command

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