pyrasun.eio.services
Class AbstractEmberService

java.lang.Object
  extended bypyrasun.eio.services.AbstractEmberService
All Implemented Interfaces:
EmberService
Direct Known Subclasses:
ByteArrayClientService, ByteArrayServerService, ObjectClientService, ObjectServerService, TelnetService

public abstract class AbstractEmberService
extends java.lang.Object
implements EmberService

Abstract implementation of an Ember Service - makes life slightly easier.


Field Summary
 
Fields inherited from interface pyrasun.eio.services.EmberService
RUNNING, STOPPED
 
Constructor Summary
AbstractEmberService()
           
AbstractEmberService(java.lang.String name, boolean isStoppable, boolean failureOK)
           
 
Method Summary
 boolean failureOK()
          If true, a failure of this service should not be considered fatal.
 EmberServiceController getController()
          Returns the context of the larger container which controls this service.
 java.lang.String getName()
          Return the name of the service
 int getState()
          Return the current state of the service
 boolean isStoppable()
          If true, this service can be stopped and restarted.
 void setController(EmberServiceController context)
          Defines the context of the larger container which controls this service.
abstract  void start()
          Start the service.
abstract  void stop()
          Stop the service.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractEmberService

public AbstractEmberService()

AbstractEmberService

public AbstractEmberService(java.lang.String name,
                            boolean isStoppable,
                            boolean failureOK)
Method Detail

setController

public void setController(EmberServiceController context)
Defines the context of the larger container which controls this service.

Specified by:
setController in interface EmberService

getController

public EmberServiceController getController()
Returns the context of the larger container which controls this service.

Specified by:
getController in interface EmberService

start

public abstract void start()
                    throws EmberServiceException
Start the service.

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

stop

public abstract void stop()
                   throws EmberServiceException
Stop the service.

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

getState

public int getState()
Return the current state of the service

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

getName

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

Specified by:
getName in interface EmberService
Returns:
the name of the service

failureOK

public boolean failureOK()
If true, a failure of this service should not be considered fatal.

Specified by:
failureOK in interface EmberService

isStoppable

public boolean isStoppable()
If true, this service can be stopped and restarted. If false, this service is permanenet and cannot be stopped.

Specified by:
isStoppable in interface EmberService


Pyrasun EmberIO