org.exolab.core.service
Class Service

java.lang.Object
  extended by org.exolab.core.service.Service
All Implemented Interfaces:
java.io.Serializable, Serviceable
Direct Known Subclasses:
BasicService, RmiRegistryService

public abstract class Service
extends java.lang.Object
implements Serviceable

Service is an implementation of the Servicable interface that provides default implementations for the start() and stop() methods.

Version:
$Revision: 1.2 $ $Date: 2003/06/09 06:28:41 $
Author:
Jim Alateras
See Also:
Serviceable, Serialized Form

Constructor Summary
protected Service()
          The default constructor for the Service does nothing.
protected Service(java.lang.String name)
          Instantiates a service with the specified name
 
Method Summary
 java.lang.String getName()
          Return the name of the service.
 ServiceState getState()
          Return the current state of the service.
 void restart()
          Convenience method for restarting the service.
protected  void setState(ServiceState state)
          Set the state of the service
 void start()
          Start the service.
 void stop()
          Stop the service.
 java.lang.String toString()
          Return the state of the object as a string
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Service

protected Service()
The default constructor for the Service does nothing.


Service

protected Service(java.lang.String name)
Instantiates a service with the specified name

Parameters:
name - the unique name of the service
Method Detail

start

public void start()
           throws ServiceException
Start the service.

Specified by:
start in interface Serviceable
Throws:
ServiceException - if the service fails to start, or is already running

stop

public void stop()
          throws ServiceException
Stop the service.

Specified by:
stop in interface Serviceable
Throws:
ServiceException - if the service fails to stop, or is already stopped

restart

public void restart()
             throws ServiceException
Convenience method for restarting the service. This operation can be called regardless the current state of the service.

Specified by:
restart in interface Serviceable
Throws:
ServiceException - if the service fails to restart

getState

public ServiceState getState()
Return the current state of the service.

Specified by:
getState in interface Serviceable
Returns:
the current state of the service

getName

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

Specified by:
getName in interface Serviceable
Returns:
the service name

toString

public java.lang.String toString()
Return the state of the object as a string

Overrides:
toString in class java.lang.Object
Returns:
a string form of the object state

setState

protected void setState(ServiceState state)
Set the state of the service

Parameters:
state - the service state


Copyright © 1999-2012 The Exolab Group. All Rights Reserved.