com.cafesoft.core.service
Class AbstractService

java.lang.Object
  |
  +--com.cafesoft.core.service.AbstractService
All Implemented Interfaces:
Debuggable, Service
Direct Known Subclasses:
StandardServiceAdapter

public abstract class AbstractService
extends Object
implements Service

Provides basic implementation of a service.

Since:
7/29/2002
See Also:
Service

Field Summary
protected  boolean debug
          A flag that controls logging of DEBUG-level messages.
protected  boolean initialized
          Boolean flag to indicate that the service has been initialized.
protected  Logger logger
          The Logger object associated with the ServiceConfig's ServiceContext.
protected  ServiceConfig serviceConfig
          The ServiceConfig object that configures this Service
 
Constructor Summary
AbstractService()
          Create a new AbstractService.
 
Method Summary
 void destroy()
          Destroy the Service.
 ServiceConfig getServiceConfig()
          Get the ServiceConfig.
 void initialize(ServiceConfig config)
          Initialize the Service.
 boolean setDebug(boolean enable)
          Enable or disable debugging.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serviceConfig

protected ServiceConfig serviceConfig
The ServiceConfig object that configures this Service


logger

protected Logger logger
The Logger object associated with the ServiceConfig's ServiceContext.


initialized

protected boolean initialized
Boolean flag to indicate that the service has been initialized.


debug

protected boolean debug
A flag that controls logging of DEBUG-level messages.

Constructor Detail

AbstractService

public AbstractService()
Create a new AbstractService.

Just a reminder this is an abstract class, cannot be instantiated.

Method Detail

initialize

public void initialize(ServiceConfig config)
                throws ServiceException
Initialize the Service.

Specified by:
initialize in interface Service
Parameters:
config - the ServiceConfig
Throws:
ServiceException - if an error initializing the Service

getServiceConfig

public ServiceConfig getServiceConfig()
Get the ServiceConfig.

Specified by:
getServiceConfig in interface Service
Returns:
the ServiceConfig

destroy

public void destroy()
Destroy the Service. (This method removes references to serviceConfig and logger, so subclasses should invoke it).

Specified by:
destroy in interface Service

setDebug

public boolean setDebug(boolean enable)
Enable or disable debugging.

Specified by:
setDebug in interface Debuggable
Parameters:
enable - if true, enable debugging, else disable debugging.
Returns:
the previous value of the debug flag, which is useful for restoring the debug state if temporarily changed.


Generated on 5:16:42 PM May 12, 2008, © 1996-2005 Cafésoft LLC. All rights reserved.