|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl
public class ServiceRegistrationImpl
A registered service.
The framework returns a ServiceRegistration object when a
BundleContext.registerService
method is successful. This 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 for the service or to unregister the service.
If the ServiceRegistration is garbage collected the framework may remove the service. This implies that if a bundle wants to keep its service registered, it should keep the ServiceRegistration object referenced.
| Method Summary | |
|---|---|
int |
compareTo(java.lang.Object object)
Compares this ServiceRegistrationImpl with the specified
ServiceRegistrationImpl for order. |
org.eclipse.osgi.internal.serviceregistry.ServiceProperties |
getProperties()
Return the properties object. |
ServiceReference |
getReference()
Returns a ServiceReferenceImpl object for this registration. |
void |
setProperties(java.util.Dictionary props)
Update the properties associated with this service. |
java.lang.String |
toString()
Return a String representation of this object. |
void |
unregister()
Unregister the service. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Method Detail |
|---|
public void setProperties(java.util.Dictionary props)
The key "objectClass" cannot be modified by this method. It's value is set when the service is registered.
The following steps are followed to modify a service's properties:
ServiceEvent of type ServiceEvent.MODIFIED
is synchronously sent.
setProperties in interface ServiceRegistrationprops - The properties for this service.
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 has already been unregistered.
java.lang.IllegalArgumentException - If the properties
parameter contains case variants of the same key name.public void unregister()
ServiceReferenceImpl objects for this registration
can no longer be used to interact with the service.
The following steps are followed to unregister a service:
ServiceReferenceImpls for the service may no longer be used
to get a service object for the service.
ServiceEvent of type ServiceEvent.UNREGISTERING
is synchronously sent so that bundles using this service
may release their use of the service.
ServiceFactory,
the ServiceFactory.ungetService method
is called to release the service object for the bundle.
unregister in interface ServiceRegistrationjava.lang.IllegalStateException - If
this ServiceRegistration has already been unregistered.BundleContextImpl.ungetService(org.osgi.framework.ServiceReference)public ServiceReference getReference()
ServiceReferenceImpl object for this registration.
The ServiceReferenceImpl object may be shared with other bundles.
getReference in interface ServiceRegistrationServiceReferenceImpl object.
java.lang.IllegalStateException - If
this ServiceRegistration has already been unregistered.public org.eclipse.osgi.internal.serviceregistry.ServiceProperties getProperties()
public java.lang.String toString()
toString in class java.lang.Objectpublic int compareTo(java.lang.Object object)
ServiceRegistrationImpl with the specified
ServiceRegistrationImpl for order.
This does a reverse comparison so that the highest item is sorted to the left. We keep ServiceRegistationImpls in sorted lists such that the highest ranked service is at element 0 for quick retrieval.
compareTo in interface java.lang.Comparableobject - The ServiceRegistrationImpl to be compared.
ServiceRegistrationImpl is greater than, equal to, or
less than the specified ServiceRegistrationImpl.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||