|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ServiceContext
A service context is the facade of a service registry.
It gives the access to a service broker. All service
interactions should use a service context to garanty
the service isolation.
This class is a subset of BundleContext
methods.
(methods implying interactions with the service registry).
So, refer to this class for further information.
BundleContext
Method Summary | |
---|---|
void |
addServiceListener(ServiceListener listener)
Adds a service listener. |
void |
addServiceListener(ServiceListener listener,
String filter)
Adds a service listener. |
ServiceReference[] |
getAllServiceReferences(String clazz,
String filter)
Gets the service references matching with the given query. |
Object |
getService(ServiceReference reference)
Gets a service object. |
ServiceReference |
getServiceReference(String clazz)
Gets a service reference for the given interface. |
ServiceReference[] |
getServiceReferences(String clazz,
String filter)
Gets service reference list for the given query. |
ServiceRegistration |
registerService(String[] clazzes,
Object service,
Dictionary properties)
Registers a service inside this service context. |
ServiceRegistration |
registerService(String clazz,
Object service,
Dictionary properties)
Registers a service inside this service context. |
void |
removeServiceListener(ServiceListener listener)
Removes a service listener. |
boolean |
ungetService(ServiceReference reference)
Ungets the service reference. |
Methods inherited from interface org.osgi.framework.BundleContext |
---|
addBundleListener, addFrameworkListener, createFilter, getBundle, getBundle, getBundles, getDataFile, getProperty, installBundle, installBundle, removeBundleListener, removeFrameworkListener |
Method Detail |
---|
void addServiceListener(ServiceListener listener, String filter) throws InvalidSyntaxException
addServiceListener
in interface BundleContext
listener
- the service listener to add.filter
- the LDAP filter
InvalidSyntaxException
- if the LDAP filter is malformedBundleContext.addServiceListener(org.osgi.framework.ServiceListener, java.lang.String)
void addServiceListener(ServiceListener listener)
addServiceListener
in interface BundleContext
listener
- the service listener to add.BundleContext.addServiceListener(org.osgi.framework.ServiceListener)
ServiceReference[] getAllServiceReferences(String clazz, String filter) throws InvalidSyntaxException
getAllServiceReferences
in interface BundleContext
clazz
- the required interfacefilter
- a LDAP filter
null
if no providers are available.
InvalidSyntaxException
- if the LDAP filter is malformedBundleContext.getAllServiceReferences(java.lang.String, java.lang.String)
Object getService(ServiceReference reference)
getService
in interface BundleContext
reference
- the required service reference
BundleContext.getService(org.osgi.framework.ServiceReference)
ServiceReference getServiceReference(String clazz)
getServiceReference
in interface BundleContext
clazz
- the required interface name
null
if no providers are availableBundleContext.getServiceReference(java.lang.String)
ServiceReference[] getServiceReferences(String clazz, String filter) throws InvalidSyntaxException
getServiceReferences
in interface BundleContext
clazz
- : the name of the required service interfacefilter
- : LDAP filter to apply on service provider
null
if no available providers
InvalidSyntaxException
- if the LDAP filter is malformedBundleContext.getServiceReferences(java.lang.String, java.lang.String)
ServiceRegistration registerService(String[] clazzes, Object service, Dictionary properties)
registerService
in interface BundleContext
clazzes
- the interfaces provided by the service.service
- the service object.properties
- service properties to publish
registerService(java.lang.String[], java.lang.Object, java.util.Dictionary)
ServiceRegistration registerService(String clazz, Object service, Dictionary properties)
registerService
in interface BundleContext
clazz
- the interface provided by the service.service
- the service object.properties
- service properties to publish.
BundleContext.registerService(java.lang.String, java.lang.Object, java.util.Dictionary)
void removeServiceListener(ServiceListener listener)
removeServiceListener
in interface BundleContext
listener
- the listener to removeBundleContext.removeServiceListener(org.osgi.framework.ServiceListener)
boolean ungetService(ServiceReference reference)
ungetService
in interface BundleContext
reference
- the reference to unget
true
if you are the last user of the reference.BundleContext.ungetService(org.osgi.framework.ServiceReference)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |