|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
T
- type of service managed by this lifecycle providerpublic interface ServiceLifecycleProvider<T>
Manages the state and availability of a service through a Dependency-
Injection pattern.
A ServiceLifecycleProvider defines the service dependencies as a List of
ServiceDependencyDescriptors, which provide a unique String key, dependency
class, and dependency filter string.
When all of the dependencies are available, the service lifecycle will be
started with a call to the start
method. This should create
the service and make it available through the getService
method.
Once the service is started, if a dependency is changed or removed,
dependencyChanged
will be called with the new dependency.
Once a ServiceLifecycleProvider is initialized, it may define new
dependencies or remove dependencies added in this way, but the original
dependencies cannot change. When dependencies are added and removed after
initialization, a property change event should be fired.
Nested Class Summary | |
---|---|
static class |
ServiceLifecycleProvider.Validator
The Validator is used validate a dependencyId and dependency against a list of DependencyDescriptors. |
Field Summary | |
---|---|
static String |
PROP_DEPENDENCY_ADDED
Property change name for adding a dependency after initializing. |
static String |
PROP_DEPENDENCY_REMOVED
Property change name for removing a dependency after initializing. |
Method Summary | |
---|---|
void |
dependencyChanged(String dependencyId,
Object dependency,
Map<String,Object> dependencies)
Called after the service is started and a dependency is changed or removed. |
List<DependencyDescriptor> |
getDependencyDescriptors()
Returns a list describing the service dependencies required by this lifecycle provider. |
Properties |
getRegistrationProperties()
Returns the properties to be used when register the service managed by this lifecycle provider. |
T |
getService()
Returns the service managed by this lifecycle provider. |
String[] |
getServiceClassNames()
Returns the names of the interfaces this service implements and makes available. |
void |
start(Map<String,Object> dependencyMap)
Called the first time all dependencies are available. |
void |
stop()
|
Methods inherited from interface org.robokind.api.common.property.PropertyChangeSource |
---|
addPropertyChangeListener, addPropertyChangeListener, removePropertyChangeListener, removePropertyChangeListener |
Field Detail |
---|
static final String PROP_DEPENDENCY_ADDED
static final String PROP_DEPENDENCY_REMOVED
Method Detail |
---|
void start(Map<String,Object> dependencyMap)
dependencyMap
- dependencies needed to start the service lifecyclevoid stop()
void dependencyChanged(String dependencyId, Object dependency, Map<String,Object> dependencies)
dependencyId
- dependency id defined in the
DependencyDescriptor
dependency
- the new dependency, or null if the dependency is no
longer available.T getService()
List<DependencyDescriptor> getDependencyDescriptors()
Properties getRegistrationProperties()
String[] getServiceClassNames()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |