|
||||||||||
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.osgi.lifecycle.ServiceDependenciesTracker
public class ServiceDependenciesTracker
Monitors the OSGi Service Registry for a set of service dependencies. Fires property change events when all of the dependencies are available, and as the dependencies change. Used with DynamicServiceLauncher and ServiceLifecycleProvider to create services with OSGi-driven lifecycles.
Field Summary | |
---|---|
static String |
PROP_ALL_DEPENDENCIES_AVAILABLE
Property change event name for all dependencies being available. |
static String |
PROP_DEPENDENCY_AVAILABLE
Property change event name for a dependency becoming available. |
static String |
PROP_DEPENDENCY_CHANGED
Property change event name for a dependency changing. |
static String |
PROP_DEPENDENCY_UNAVAILABLE
Property change event name for a dependency becoming unavailable. |
Constructor Summary | |
---|---|
ServiceDependenciesTracker(org.osgi.framework.BundleContext context)
Creates an empty ServiceDependenciesTracker with the given BundleContext. |
Method Summary | |
---|---|
boolean |
addDependencyDescription(Class clazz,
String dependencyName,
String filterString,
DependencyDescriptor.DependencyType type)
Adds the description to the list of dependency to listen for. |
boolean |
addDependencyDescription(DependencyDescriptor descriptor)
Adds the description to the list of dependency to listen for. |
boolean |
dependenciesSatisfied()
Returns true if all dependencies are available. |
void |
dispose()
|
Map<String,Object> |
getAvailableDependencies()
Returns a map of dependency Ids dependencies. |
Object |
getDependency(String dependencyId)
Returns the dependency matching the given id, null if unavailable. |
Map<String,Object> |
getRequiredDependencies()
Returns a map of dependency Ids and required dependencies. |
boolean |
isRunning()
|
boolean |
removeDependencyTracker(String name)
|
void |
start()
Start tracking dependencies. |
void |
stop()
Stop tracking dependencies. |
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 |
Field Detail |
---|
public static final String PROP_DEPENDENCY_AVAILABLE
public static final String PROP_DEPENDENCY_CHANGED
public static final String PROP_DEPENDENCY_UNAVAILABLE
public static final String PROP_ALL_DEPENDENCIES_AVAILABLE
Constructor Detail |
---|
public ServiceDependenciesTracker(org.osgi.framework.BundleContext context)
context
- Method Detail |
---|
public boolean dependenciesSatisfied()
public Map<String,Object> getAvailableDependencies()
public Map<String,Object> getRequiredDependencies()
public Object getDependency(String dependencyId)
dependencyId
- local id used with a ServiceLifecycleProvider
public boolean addDependencyDescription(DependencyDescriptor descriptor)
descriptor
- dependency description to listen for
IllegalStateException
- if the tracker has already been started
IllegalArgumentException
- if the given dependencyId already existspublic boolean addDependencyDescription(Class clazz, String dependencyName, String filterString, DependencyDescriptor.DependencyType type)
clazz
- dependency classdependencyName
- local dependency id to be used with a
ServiceLifecycleProviderfilterString
- optional OSGi filter String for the dependency
IllegalStateException
- if the tracker has already been started
IllegalArgumentException
- if the given dependencyId already existspublic boolean removeDependencyTracker(String name)
public void start()
public boolean isRunning()
public void stop()
public void dispose()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |