The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Wombat::Server - server class

SYNOPSIS

  my $wombat = Wombat::Server();
  $wombat->setHome('/usr/local/wombat');
  $wombat->setConfigFile('conf/server.xml');

  $wombat->start();
  $wombat->await();
  $wombat->stop();

DESCRIPTION

This class implements a Wombat server. It uses server.xml to configure a container hierarchy and provides methods for starting and stopping the server. It is meant to be used in both standalone and embedded mode, so it does not take care of standard daemon things, like processing command line arguments or setting up signal handlers. Those are the responsibilities of the surrounding environment (eg a control script or mod_perl <Perl> section).

CONSTRUCTOR

new()

Create and return an instance, initializing fields to default values.

ACCESSOR METHODS

getConfigFile()

Return the location of the configuration file for this Server. Defaults to server.xml in the conf subdirectory of getHome().

setConfigFile($configFile)

Set the location of the configuration file for this Server. If the specified location is relative, then it will be absolutized using getHome().

Parameters:
$configFile

the location of the configuration file relative to the server's home directory

getHome()

Return the home directory for this Server.

setHome($home)

Set the home directory for this Server.

Parameters:

$home

the server home directory, specified absolutely

Throws:

Servlet::Util::IllegalArgumentException

if the specified directory is not specified absolutely

PUBLIC METHODS

await()

Direct all defined Services to begin listening for requests. Depending on Connector implementations, this method may return immediately (for Connectors that execute asynchrously, eg Apache) or may block (eg Http Connector).

addService($service)

Add a new Service to the set of defined Services.

Parameters:

$service

the Wombat::Core::Service to add

getServices()

Return an array containing all defined Services.

removeService($service)

Remove a Service from the set of defined Services.

Parameters:

$service

the Wombat::Core::Service to remove

LIFECYCLE METHODS

start()

Prepare for active use of this component. This method should be called before any of the public methods of the component are utilized.

Throws:

Wombat::LifecycleException

if the component has already been started

Wombat::XmlException

if a problem occurs while parsing a config file

Wombat::ConfigException

if a validity error is detected in a config file

Servlet::Util::IOException

if an input or output error occurs

stop()

Gracefully terminate active use of this component. Once this method has been called, no public methods of the component should be utilized.

Throws:

Wombat::LifecycleException

if the component is not started

SEE ALSO

AUTHOR

Brian Moseley, bcm@maz.org