|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--com.cafesoft.core.service.StandardServiceManager
StandardServiceManager implements a ServiceManager, which
provides a way to register, lookup, and remove Service implementations.
A Service is uniquely identified within a ServiceManager by it's identifier,
but is also characterized by the interface that it implements.
| Field Summary | |
protected ServiceConfig |
serviceConfig
The ServiceConfig for this ServiceManager (because it's also a Service). |
| Fields inherited from interface com.cafesoft.core.lifecycle.Lifecycle |
START_EVENT, STOP_EVENT |
| Constructor Summary | |
StandardServiceManager()
Create a new StandardServiceManager. |
|
| Method Summary | |
void |
add(Class type,
Service service)
Add a Service to the registry. |
void |
addLifecycleListener(LifecycleListener listener)
Add a LifecycleEvent listener to this component. |
void |
destroy()
Destroy all Objects referenced by this ServiceManager. |
protected void |
finalize()
Cleanup Object references. |
ServiceConfig |
getServiceConfig()
Get the ServiceConfig. |
Service[] |
getServices()
Returns all of the Services in the registry. |
void |
initialize(ServiceConfig config)
Initialize the Service. |
boolean |
isStarted()
Determine if the implementing Lifecycle object has been started. |
Service[] |
lookup(Class type)
Lookup Services from the registry by type. |
Service |
lookup(String id)
Lookup a Service from the registry by unique identifier. |
Service |
lookup(String id,
Class type)
Lookup a Service from the registry by unique identifier and type. |
void |
remove(Service service)
Remove a Service from the registry. |
void |
removeLifecycleListener(LifecycleListener listener)
Remove a LifecycleEvent listener from this component. |
boolean |
setDebug(boolean enable)
Enable or disable debugging. |
void |
setServiceStarter(ServiceStarter serviceStarter)
Set a ServiceStarter. |
void |
setServiceStopper(ServiceStopper serviceStopper)
Set a ServiceStopper. |
void |
start()
Prepare for the beginning of active use of the public methods of this component. |
void |
stop()
Gracefully terminate the active use of the public methods of this component. |
| Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected ServiceConfig serviceConfig
| Constructor Detail |
public StandardServiceManager()
| Method Detail |
protected void finalize()
throws Throwable
finalize in class ObjectThrowable
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 Service
public void add(Class type,
Service service)
throws ServiceException
add in interface ServiceManagertype - the Class that identifies the type of service.service - the Service to be added.
ServiceException - if the service is already
registered.
public void remove(Service service)
throws ServiceException
remove in interface ServiceManagerservice - the Service to be removed.
ServiceException - if the service is not
registered.public Service[] getServices()
getServices in interface ServiceManager
public Service[] lookup(Class type)
throws ServiceException
lookup in interface ServiceManagertype - the Service Class.
ServiceException - if no service with the specified type is
registered.
public Service lookup(String id)
throws ServiceException
lookup in interface ServiceManagerid - the Service identifier.
ServiceException - if no service with the specified identifier is
registered.
public Service lookup(String id,
Class type)
throws ServiceException
lookup in interface ServiceManagerid - the Service identifier.type - the Service type.
ServiceException - if no service with the specified identifier
and type is registered.public void setServiceStarter(ServiceStarter serviceStarter)
setServiceStarter in interface ServiceManagerserviceStarter - the ServiceStarter that will handle startup of
Service instances when this ServiceManager is started, or null if
the default ServiceManager startup behaviour is desired.public void setServiceStopper(ServiceStopper serviceStopper)
setServiceStopper in interface ServiceManagerserviceStopper - the ServiceStopper that will handle stopping of
Service instances when this ServiceManager is stopped, or null if
the default ServiceManager stopping behaviour is desired.public void addLifecycleListener(LifecycleListener listener)
addLifecycleListener in interface Lifecyclelistener - The listener to addpublic void removeLifecycleListener(LifecycleListener listener)
removeLifecycleListener in interface Lifecyclelistener - The listener to remove
public 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 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 destroy()
destroy in interface Servicepublic boolean setDebug(boolean enable)
setDebug in interface Debuggableenable - if true, enable debugging, else disable debugging.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||