|
OSGi™ Service Platform Release 2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A registered service.
The Framework returns a ServiceRegistration object when a BundleContext.registerService method is successful. The ServiceRegistration object is for the private use of the registering bundle and should not be shared with other bundles.
The ServiceRegistration object may be used to update the properties of the service or to unregister the service.
BundleContext.registerService(java.lang.String[], java.lang.Object, java.util.Dictionary)
Method Summary | |
ServiceReference |
getReference()
Returns a ServiceReference object for a service being registered. |
void |
setProperties(java.util.Dictionary properties)
Updates the properties associated with a service. |
void |
unregister()
Unregisters a service. |
Method Detail |
public ServiceReference getReference()
The ServiceReference object may be shared with other bundles.
java.lang.IllegalStateException
- If this ServiceRegistration object
has already been unregistered.public void setProperties(java.util.Dictionary properties)
The Constants.OBJECTCLASS
and Constants.SERVICE_ID
keys cannot be
modified by this method. These values are set by the Framework when the service is
registered in the OSGi environment.
The following steps are required to modify service properties:
ServiceEvent.MODIFIED
is synchronously sent.
properties
- The properties for this service.
See Constants
for a list of standard service property keys.
Changes should not be made to this object after calling this method.
To update the service's properties this method should be called again.
java.lang.IllegalStateException
- If this ServiceRegistration object has already
been unregistered.
java.lang.IllegalArgumentException
- If properties contains case
variants of the same key name.public void unregister()
The following steps are required to unregister a service:
ServiceEvent.UNREGISTERING
is synchronously
sent so that bundles using this service can release their use of it.
ServiceFactory
object, the
ServiceFactory.ungetService method is called to release the service object for the bundle.
java.lang.IllegalStateException
- If this ServiceRegistration object has already been unregistered.BundleContext.ungetService(org.osgi.framework.ServiceReference)
,
ServiceFactory.ungetService(org.osgi.framework.Bundle, org.osgi.framework.ServiceRegistration, java.lang.Object)
|
OSGi™ Service Platform Release 2 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |