|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.robokind.api.common.property.PropertyChangeNotifier
org.robokind.api.common.lifecycle.AbstractLifecycleProvider<I,T>
I - Interface or Base Class of the service managed by this lifecycleT - actual type of the service managedpublic abstract class AbstractLifecycleProvider<I,T extends I>
Abstract implementation of ServiceLifecycleProvider. Automatically validates dependencies against the descriptors provided at creation.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface org.robokind.api.common.lifecycle.ServiceLifecycleProvider |
|---|
ServiceLifecycleProvider.Validator |
| Field Summary | |
|---|---|
protected Properties |
myRegistrationProperties
OSGi registration properties |
protected T |
myService
Instance of the service being managed |
protected String[] |
myServiceClassNames
Names of the classes provided by this service. |
| Fields inherited from interface org.robokind.api.common.lifecycle.ServiceLifecycleProvider |
|---|
PROP_DEPENDENCY_ADDED, PROP_DEPENDENCY_REMOVED |
| Constructor Summary | |
|---|---|
AbstractLifecycleProvider(List<DependencyDescriptor> deps)
Creates a new AbstractLifecycleProvider with the given DependencyDescriptors. |
|
| Method Summary | |
|---|---|
protected boolean |
addRuntimeDependency(DependencyDescriptor desc)
Adds a dependency after the lifecycle is initialized. |
protected abstract T |
create(Map<String,Object> dependencies)
Called when all dependencies are available. |
void |
dependencyChanged(String dependencyName,
Object dependency,
Map<String,Object> dependencies)
Validates the arguments before calling handleChange. |
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. |
protected abstract Class<I> |
getServiceClass()
Returns the Class of the service managed by this lifecycle provider. |
String[] |
getServiceClassNames()
Returns the names of the interfaces this service implements and makes available. |
protected abstract void |
handleChange(String name,
Object dependency,
Map<String,Object> availableDependencies)
Called from dependencyChanged with validated values. |
boolean |
isSatisfied()
|
protected boolean |
removeRuntimeDependency(String depName)
Removes a dependency after the lifecycle is initialized. |
void |
start(Map<String,Object> dependencies)
Called the first time all dependencies are available. |
void |
stop()
|
| Methods inherited from class org.robokind.api.common.property.PropertyChangeNotifier |
|---|
addPropertyChangeListener, addPropertyChangeListener, clearAllListeners, clearListeners, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getPropertyChangeListeners, getPropertyChangeListeners, hasListeners, removePropertyChangeListener, removePropertyChangeListener |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.robokind.api.common.property.PropertyChangeSource |
|---|
addPropertyChangeListener, addPropertyChangeListener, removePropertyChangeListener, removePropertyChangeListener |
| Field Detail |
|---|
protected T extends I myService
protected Properties myRegistrationProperties
protected String[] myServiceClassNames
| Constructor Detail |
|---|
public AbstractLifecycleProvider(List<DependencyDescriptor> deps)
deps - descriptors of the dependencies for this lifecycle| Method Detail |
|---|
public void start(Map<String,Object> dependencies)
ServiceLifecycleProvider
start in interface ServiceLifecycleProvider<I>dependencies - dependencies needed to start the service lifecyclepublic void stop()
stop in interface ServiceLifecycleProvider<I>protected abstract T create(Map<String,Object> dependencies)
dependencies - validated map of the lifecycle's dependencies
public T getService()
ServiceLifecycleProvider
getService in interface ServiceLifecycleProvider<I>public Properties getRegistrationProperties()
ServiceLifecycleProvider
getRegistrationProperties in interface ServiceLifecycleProvider<I>public List<DependencyDescriptor> getDependencyDescriptors()
ServiceLifecycleProvider
getDependencyDescriptors in interface ServiceLifecycleProvider<I>public boolean isSatisfied()
public void dependencyChanged(String dependencyName,
Object dependency,
Map<String,Object> dependencies)
handleChange.
If the service is null and the dependencies are satisfied, a service is
created and handleChange is not called.
dependencyChanged in interface ServiceLifecycleProvider<I>dependencyName - name of the dependency changeddependency - new dependencydependencies - all available dependencies
protected abstract void handleChange(String name,
Object dependency,
Map<String,Object> availableDependencies)
dependencyChanged with validated values.
name - name of the dependency changeddependency - new dependency value, null if it was removedavailableDependencies - a map of all available dependencies and
their namesprotected abstract Class<I> getServiceClass()
public String[] getServiceClassNames()
ServiceLifecycleProvider
getServiceClassNames in interface ServiceLifecycleProvider<I>protected boolean addRuntimeDependency(DependencyDescriptor desc)
desc - dependency to add
protected boolean removeRuntimeDependency(String depName)
desc - dependency to remove
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||