|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--com.cafesoft.core.service.AbstractLifecycleService
An abstract implementation of the LifecycleService interface. This case serves as a base class for all implementing LifecycleService classes.
| 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 List |
listenerList
List of Lifecycle listeners. |
protected Logger |
logger
The Logger object associated with the ServiceConfig's ServiceContext. |
protected ServiceConfig |
serviceConfig
The ServiceConfig object that configures this Service |
protected boolean |
started
Boolean flag to indicate if the service has been started. |
| Fields inherited from interface com.cafesoft.core.lifecycle.Lifecycle |
START_EVENT, STOP_EVENT |
| Constructor Summary | |
AbstractLifecycleService()
Create a new AbstractLifecycleService. |
|
| Method Summary | |
void |
addLifecycleListener(LifecycleListener listener)
Add a LifecycleEvent listener to this component. |
void |
destroy()
Destroy the Service. |
protected void |
fireEvent(LifecycleEvent event)
Fire a lifecycle event to all registered listeners |
ServiceConfig |
getServiceConfig()
Get the ServiceConfig. |
void |
initialize(ServiceConfig config)
Initialize the Service. |
boolean |
isStarted()
Determine if the implementing Lifecycle object has been started. |
void |
removeLifecycleListener(LifecycleListener listener)
Remove a LifecycleEvent listener from this component. |
boolean |
setDebug(boolean enable)
Enable or disable debugging. |
abstract void |
start()
Prepare for the beginning of active use of the public methods of this component. |
abstract void |
stop()
Gracefully terminate the active use of the public methods of this component. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected ServiceConfig serviceConfig
protected Logger logger
protected boolean started
protected boolean initialized
protected List listenerList
protected boolean debug
| Constructor Detail |
public AbstractLifecycleService()
Just a reminder this is an abstract class, cannot be instantiated.
| Method Detail |
public void initialize(ServiceConfig config)
throws ServiceException
initialize in interface Serviceconfig - the ServiceConfig
ServiceException - if an error initializing the Servicepublic ServiceConfig getServiceConfig()
getServiceConfig in interface Servicepublic void destroy()
destroy in interface Servicepublic boolean setDebug(boolean enable)
setDebug in interface Debuggableenable - if true, enable debugging, else disable debugging.
public abstract void start()
throws LifecycleException
start in interface LifecycleIllegalStateException - if this component has already been
started
LifecycleException - if this component detects a fatal error
that prevents this component from being used
public abstract void stop()
throws LifecycleException
stop in interface LifecycleIllegalStateException - if this component has not been started
LifecycleException - if this component detects a fatal error
that needs to be reportedpublic boolean isStarted()
isStarted in interface Lifecyclepublic void addLifecycleListener(LifecycleListener listener)
addLifecycleListener in interface Lifecyclelistener - the listener to addpublic void removeLifecycleListener(LifecycleListener listener)
removeLifecycleListener in interface Lifecyclelistener - the listener to removeprotected void fireEvent(LifecycleEvent event)
event - the event to send to the listeners
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||