public class DependencyTrackerImpl
extends java.lang.Object
Constructor and Description |
---|
DependencyTrackerImpl(org.osgi.framework.BundleContext bundleContext,
org.apache.ace.agent.impl.DependencyTrackerImpl.LifecycleCallback callback)
Creates a new
DependencyTrackerImpl instance. |
Modifier and Type | Method and Description |
---|---|
void |
addDependency(java.lang.Class<?> iface,
java.lang.String extraFilter,
org.apache.ace.agent.impl.DependencyTrackerImpl.DependencyCallback callback)
Adds a dependency to track.
|
org.osgi.framework.BundleContext |
getBundleContext() |
void |
startTracking()
Starts tracking all dependencies, if all dependencies are satisfied,
LifecycleCallback#componentStarted(BundleContext) will be called. |
void |
stopTracking()
Stops tracking of dependencies.
|
void |
update()
Called for each change in the dependency set.
|
public DependencyTrackerImpl(org.osgi.framework.BundleContext bundleContext, org.apache.ace.agent.impl.DependencyTrackerImpl.LifecycleCallback callback)
DependencyTrackerImpl
instance.bundleContext
- the bundle context;callback
- the component callback.public void addDependency(java.lang.Class<?> iface, java.lang.String extraFilter, org.apache.ace.agent.impl.DependencyTrackerImpl.DependencyCallback callback) throws java.lang.Exception
iface
- the interface of the dependency to track;extraFilter
- an optional filter for the tracked dependency;callback
- the callback to call when the dependency comes (un)available.java.lang.Exception
public org.osgi.framework.BundleContext getBundleContext()
public void startTracking() throws java.lang.Exception
LifecycleCallback#componentStarted(BundleContext)
will be called. For each satisfied dependency,
DependencyCallback#updated(Object)
is called.java.lang.IllegalStateException
- in case this tracker is already started.java.lang.Exception
public void stopTracking()
DependencyCallback#updated(Object)
is called
with a null
value.java.lang.IllegalStateException
- in case this tracker is already started.public void update()
LifecycleCallback#componentStopped(BundleContext)
if needed, and
LifecycleCallback#componentStarted(BundleContext)
when all dependencies are met.