|
||||||||||
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.SingleServiceListener<T>
T
- type of service to listen forpublic class SingleServiceListener<T>
Listens to the OSGi Service Registry for a single service, and provides service registration hooks.
Field Summary | |
---|---|
static String |
PROP_SERVICE_MODIFIED
Property change event name for the service being modified |
static String |
PROP_SERVICE_REMOVED
Property change event name for the service becoming unavailabe |
static String |
PROP_SERVICE_TRACKED
Property change event name for the service becoming available |
Constructor Summary | |
---|---|
SingleServiceListener(Class<T> clazz,
org.osgi.framework.BundleContext context,
String serviceFilter)
Creates a new SingleServiceListener. |
Method Summary | |
---|---|
void |
dispose()
Releases the service, stops listening to the Serivce Registry, and removes all PropertyChangeListeners. |
String |
getFilterString()
Returns the optional OSGi filter string, null if not set. |
T |
getService()
Returns the service being tracked, null if no service is found. |
Class<T> |
getServiceClass()
Returns the class of the service |
org.osgi.framework.ServiceReference |
getServiceReference()
Returns a reference to the service being tracked. |
void |
releaseService()
Releases the service, decrementing the usage count for the ServiceReference being tracked. |
void |
serviceChanged(org.osgi.framework.ServiceEvent se)
|
boolean |
start()
Starts listening for the desired services. |
void |
stop()
Releases the service and stops listening. |
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_SERVICE_TRACKED
public static final String PROP_SERVICE_MODIFIED
public static final String PROP_SERVICE_REMOVED
Constructor Detail |
---|
public SingleServiceListener(Class<T> clazz, org.osgi.framework.BundleContext context, String serviceFilter)
clazz
- class of the servicecontext
- BundleContext for accessing the Service RegistryserviceFilter
- optional OSGi filter String to match
NullPointerException
- if clazz or context are nullMethod Detail |
---|
public org.osgi.framework.ServiceReference getServiceReference()
public Class<T> getServiceClass()
public String getFilterString()
public T getService()
public void releaseService()
public boolean start()
public void stop()
public void dispose()
public void serviceChanged(org.osgi.framework.ServiceEvent se)
serviceChanged
in interface org.osgi.framework.ServiceListener
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |