|
|||||||||
| Home >> All >> org >> eclipse >> osgi >> framework >> internal >> [ core overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.eclipse.osgi.framework.internal.core
Class ServiceReferenceImpl

java.lang.Objectorg.eclipse.osgi.framework.internal.core.ServiceReferenceImpl
- All Implemented Interfaces:
- java.lang.Comparable, org.osgi.framework.ServiceReference
- public class ServiceReferenceImpl
- extends java.lang.Object
- implements org.osgi.framework.ServiceReference, java.lang.Comparable
- extends java.lang.Object
A reference to a service. The framework returns ServiceReference objects from the BundleContext.getServiceReference 55 and BundleContext.getServiceReferences 55 methods.
A ServiceReference may be shared between bundles and can be used to examine the properties of the service and to get the service object (See BundleContext.getService 55 ).
A registered service may have multiple, distinct ServiceReference
objects which refer to it.
However these ServiceReference objects will have
the same hashCode and the equals method
will return true when compared.
| Field Summary | |
protected ServiceRegistrationImpl |
registration
Registered Service object. |
| Constructor Summary | |
protected |
ServiceReferenceImpl(ServiceRegistrationImpl registration)
Construct a reference. |
| Method Summary | |
int |
compareTo(java.lang.Object object)
Compares two service objects and returns an indication as to which is higher ranked based on service ranking and service_ID. |
boolean |
equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this one. |
org.osgi.framework.Bundle |
getBundle()
Return the bundle which registered the service. |
protected java.lang.String[] |
getClasses()
Return the classes under which the referenced service was registered. |
protected long |
getId()
Return the serviceid of the ServiceRegistration. |
java.lang.Object |
getProperty(java.lang.String key)
Get the value of a service's property. |
java.lang.String[] |
getPropertyKeys()
Get the list of key names for the service's properties. |
protected int |
getRanking()
Return the serviceranking of the ServiceRegistration. |
org.osgi.framework.Bundle[] |
getUsingBundles()
Return the list of bundles which are using the service. |
int |
hashCode()
Returns a hash code value for the object. |
java.lang.String |
toString()
Return a string representation of this reference. |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
registration
protected ServiceRegistrationImpl registration
- Registered Service object.
| Constructor Detail |
ServiceReferenceImpl
protected ServiceReferenceImpl(ServiceRegistrationImpl registration)
- Construct a reference.
| Method Detail |
getProperty
public java.lang.Object getProperty(java.lang.String key)
- Get the value of a service's property.
This method will continue to return property values after the service has been unregistered. This is so that references to unregistered service can be interrogated. (For example: ServiceReference objects stored in the log.)
- Specified by:
getPropertyin interfaceorg.osgi.framework.ServiceReference
getPropertyKeys
public java.lang.String[] getPropertyKeys()
- Get the list of key names for the service's properties.
This method will continue to return the keys after the service has been unregistered. This is so that references to unregistered service can be interrogated. (For example: ServiceReference objects stored in the log.)
- Specified by:
getPropertyKeysin interfaceorg.osgi.framework.ServiceReference
getBundle
public org.osgi.framework.Bundle getBundle()
- Return the bundle which registered the service.
This method will always return
nullwhen the service has been unregistered. This can be used to determine if the service has been unregistered.- Specified by:
getBundlein interfaceorg.osgi.framework.ServiceReference
getUsingBundles
public org.osgi.framework.Bundle[] getUsingBundles()
- Return the list of bundles which are using the service.
This method will always return
nullwhen the service has been unregistered.- Specified by:
getUsingBundlesin interfaceorg.osgi.framework.ServiceReference
getClasses
protected java.lang.String[] getClasses()
- Return the classes under which the referenced service was registered.
getId
protected long getId()
- Return the serviceid of the ServiceRegistration.
getRanking
protected int getRanking()
- Return the serviceranking of the ServiceRegistration.
hashCode
public int hashCode()
- Returns a hash code value for the object.
equals
public boolean equals(java.lang.Object obj)
- Indicates whether some other object is "equal to" this one.
toString
public java.lang.String toString()
- Return a string representation of this reference.
compareTo
public int compareTo(java.lang.Object object)
- Compares two service objects and returns an indication as to which is higher ranked
based on service ranking and service_ID.
The service with the higher service ranking (as specified in its service.ranking property)
is defined to be higher ranked.
If there is a tie in ranking, the service with the lowest
service ID (as specified in its service.id property); that is,
the service that was registered first is returned.
This is the same algorithm used by BundleContext.getServiceReference.
- Specified by:
compareToin interfacejava.lang.Comparable
|
|||||||||
| Home >> All >> org >> eclipse >> osgi >> framework >> internal >> [ core overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.eclipse.osgi.framework.internal.core.ServiceReferenceImpl