|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--solar.service.BaseServiceManager
A base implementation of service manager.
Field Summary | |
protected serp.util.Options |
_config
Configurations used for all the services. |
protected static org.apache.log4j.Logger |
_log
Logging facility. |
protected java.util.Hashtable |
_mapping
Mapping of service names to class names. |
protected java.util.Hashtable |
_serviceObjects
A repository of application-specific service objects. |
protected java.util.Hashtable |
_services
A repository of service instances. |
static java.lang.String |
CLASSNAME_SUFFIX
A service property determining its implementing class name. |
static java.lang.String |
SERVICE_PREFIX
A prefix for service properties configuration file. |
Constructor Summary | |
protected |
BaseServiceManager()
|
Method Summary | |
Service |
getService(java.lang.String name)
Return an instance of specified service. |
serp.util.Options |
getServiceConfig(java.lang.String name)
Return the configuration of a specified service. |
private Service |
getServiceInstance(java.lang.String name)
Retrieves an instance of a service without triggering late initialization. |
java.lang.Object |
getServiceObject(java.lang.String name)
Get an application-specific service object. |
boolean |
hasRegistered(java.lang.String name)
Determines whether a service is registered. |
void |
init(serp.util.Options opts)
Init the service manager with configurations of all services. |
private void |
initMapping()
Creates a mapping between service names and class names. |
private void |
initServices()
Performs early initialization of all needed services. |
void |
setServiceObject(java.lang.String name,
java.lang.Object obj)
Set application-specific service object. |
void |
stopService(java.lang.String name)
Stop a specified service. |
void |
stopServices()
Stop all services. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String SERVICE_PREFIX
public static final java.lang.String CLASSNAME_SUFFIX
protected static org.apache.log4j.Logger _log
protected serp.util.Options _config
protected java.util.Hashtable _mapping
protected java.util.Hashtable _services
protected java.util.Hashtable _serviceObjects
Constructor Detail |
protected BaseServiceManager()
Method Detail |
public void init(serp.util.Options opts) throws ServiceException
ServiceManager
init
in interface ServiceManager
ServiceException
public boolean hasRegistered(java.lang.String name)
ServiceManager
hasRegistered
in interface ServiceManager
public Service getService(java.lang.String name) throws ServiceException
ServiceManager
getService
in interface ServiceManager
ServiceException
public serp.util.Options getServiceConfig(java.lang.String name) throws ServiceException
ServiceManager
getServiceConfig
in interface ServiceManager
ServiceException
public void setServiceObject(java.lang.String name, java.lang.Object obj)
ServiceManager
setServiceObject
in interface ServiceManager
public java.lang.Object getServiceObject(java.lang.String name)
ServiceManager
getServiceObject
in interface ServiceManager
public void stopService(java.lang.String name)
ServiceManager
stopService
in interface ServiceManager
public void stopServices()
ServiceManager
stopServices
in interface ServiceManager
private void initMapping()
service.MyService.classname=com.mycompany.MyServiceImpl service.MyOtherService.classname=com.mycompany.MyOtherServiceImpl
private void initServices() throws ServiceException
ServiceException
private Service getServiceInstance(java.lang.String name) throws ServiceException
ServiceException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |