|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.osgi.util.tracker.ServiceTracker
nl.lxtreme.ols.util.osgi.WhiteboardHelper<T>
public class WhiteboardHelper<T>
Provides a helper class for easy implementation of the whiteboard pattern as used in OSGi.
Nested Class Summary | |
---|---|
static interface |
WhiteboardHelper.Visitor<T>
To be implemented by the class that wants to obtain a reference to a certain service. |
Field Summary |
---|
Fields inherited from class org.osgi.util.tracker.ServiceTracker |
---|
context, filter |
Constructor Summary | |
---|---|
WhiteboardHelper(org.osgi.framework.BundleContext aContext,
Class<T> aServiceClass)
Creates a new WhiteboardHelper instance. |
|
WhiteboardHelper(org.osgi.framework.BundleContext aContext,
org.osgi.framework.Filter aFilter)
Creates a new WhiteboardHelper instance. |
Method Summary | |
---|---|
void |
accept(WhiteboardHelper.Visitor<? super T> aVisitor)
Called to invoke the given WhiteboardHelper.Visitor for each found service. |
void |
acceptFirst(WhiteboardHelper.Visitor<? super T> aVisitor)
Called to invoke the given WhiteboardHelper.Visitor for the first found service. |
T |
getService()
|
Methods inherited from class org.osgi.util.tracker.ServiceTracker |
---|
addingService, close, getService, getServiceReference, getServiceReferences, getServices, getTrackingCount, modifiedService, open, open, remove, removedService, size, waitForService |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public WhiteboardHelper(org.osgi.framework.BundleContext aContext, Class<T> aServiceClass)
aContext
- the bundle context to use;aServiceClass
- the class of the service we should track, cannot be
null
.public WhiteboardHelper(org.osgi.framework.BundleContext aContext, org.osgi.framework.Filter aFilter)
aContext
- the bundle context to use;aFilter
- the filter to use while filtering on the services, cannot be
null
;Method Detail |
---|
public final void accept(WhiteboardHelper.Visitor<? super T> aVisitor)
WhiteboardHelper.Visitor
for each found service.
aVisitor
- the visitor to call for each found service, cannot be
null
.
IllegalArgumentException
- in case the given visitor was null
.public final void acceptFirst(WhiteboardHelper.Visitor<? super T> aVisitor)
WhiteboardHelper.Visitor
for the first found service.
aVisitor
- the visitor to call for the first found service, cannot be
null
.
IllegalArgumentException
- in case the given visitor was null
.public T getService()
getService
in class org.osgi.util.tracker.ServiceTracker
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |