|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.tenduke.services.ServiceManager
public class ServiceManager
Class that is responsible of loading classes that implement Service interface.
Services are loaded by dynamically creating instances of configured classes that implement Service interface.
Processing is controlled by a sequence of configured values in main (Configuration), where the key
names start with lifecycle.servicemanager.service.classname.
The sequence is defined by appending a series of integers after the key prefix. Indices start at 1 and must be a continuous series of positive integers. Processing will break on first disruption of series of positive integers.
Configuration parameters used by ServiceManager are:
| Key name | Description | Default value |
|---|---|---|
| lifecycle.servicemanager.service.classname.* |
Fully qualified class name of a service that must loaded when beginning application lifecycle (at process startup). Positive integer starting from 1 must be appended (substituting the wildcard character '*' appearing in this documentation) to each key that defines a service to be managed by ServiceManager. When there are several services, the positive integers appended to the key names must form a continuous series. Example configuration:
|
N/A
|
| Constructor Summary | |
|---|---|
protected |
ServiceManager()
Protected default constructor. |
|
ServiceManager(ServiceContext serviceContext)
Creates a new instance of ServiceManager. |
| Method Summary | |
|---|---|
Service |
getServiceByName(java.lang.String name)
Gets handle to a service by Service's serviceName. |
ServiceContext |
getServiceContext()
Accessing the context information available to clients of the service manager. |
protected java.util.Map<java.lang.String,Service> |
getServices()
Getter for the collection of services. |
protected java.lang.Object |
getServicesLockObject()
Getter for the object used to synchronize access to the services collection. |
void |
initializeLoadedService(Service service)
Initializing service that has been initialized by service manager service loading. |
void |
initializeServiceManager()
This method should be called right after service manager instantiation. |
void |
removeServices()
Stops and clears the loaded services from internal data structure. |
void |
startServices()
Starts all loaded service. |
void |
stopServices()
Stops all started service. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected ServiceManager()
public ServiceManager(ServiceContext serviceContext)
serviceContext - A ServiceContext instance that makes
context information available for the dynamically loadable service implementations.| Method Detail |
|---|
public Service getServiceByName(java.lang.String name)
name - The service name to look up a service by.
public ServiceContext getServiceContext()
protected java.util.Map<java.lang.String,Service> getServices()
protected java.lang.Object getServicesLockObject()
public void initializeLoadedService(Service service)
service - The service to initialize.public void initializeServiceManager()
public void removeServices()
public void startServices()
Starts all loaded service. The start sequence is determined by:
Services are started in the order defined in the list.
public void stopServices()
Stops all started service. The stop sequence is determined by:
Services are stopped in reverse startup order.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||