org.knopflerfish.framework.ServiceReferenceImpl Class Reference

Inheritance diagram for org.knopflerfish.framework.ServiceReferenceImpl:

org.osgi.framework.ServiceReference

List of all members.


Detailed Description

Implementation of the ServiceReference object.

See also:
org.osgi.framework.ServiceReference
Author:
Jan Stein

Definition at line 49 of file ServiceReferenceImpl.java.


Public Member Functions

Object getProperty (String key)
 Get the value of a service's property.
String[] getPropertyKeys ()
 Get the list of key names for the service's properties.
Bundle getBundle ()
 Return the bundle which registered the service.
boolean equals (Object o)
 Test if ServiceReferences points to same service.
int hashCode ()
 Return a hashcode for the service.
Bundle[] getUsingBundles ()
 Return the bundles that are using the service wrapped by this ServiceReference, i.e., whose usage count for this service is greater than zero.
boolean isAssignableTo (Bundle bundle, String className)
 Tests if the bundle that registered the service referenced by this ServiceReference and the specified bundle use the same source for the package of the specified class name.

Package Functions

 ServiceReferenceImpl (ServiceRegistrationImpl reg)
 Construct a ServiceReference based on given ServiceRegistration.
Object getService (final BundleImpl bundle)
 Get the service object.
boolean ungetService (BundleImpl bundle, boolean checkRefCounter)
 Unget the service object.
PropertiesDictionary getProperties ()
 Get all properties registered with this service.
Object cloneObject (Object val)
 Clone object.

Constructor & Destructor Documentation

org.knopflerfish.framework.ServiceReferenceImpl.ServiceReferenceImpl ( ServiceRegistrationImpl  reg  )  [package]

Construct a ServiceReference based on given ServiceRegistration.

Parameters:
reg ServiceRegistration pointed to be this reference.

Definition at line 63 of file ServiceReferenceImpl.java.


Member Function Documentation

Object org.knopflerfish.framework.ServiceReferenceImpl.getProperty ( String  key  ) 

Get the value of a service's property.

See also:
org.osgi.framework.ServiceReference.getProperty

Implements org.osgi.framework.ServiceReference.

Definition at line 76 of file ServiceReferenceImpl.java.

References org.knopflerfish.framework.ServiceReferenceImpl.cloneObject(), org.knopflerfish.framework.PropertiesDictionary.get(), and org.knopflerfish.framework.ServiceRegistrationImpl.properties.

Referenced by org.knopflerfish.framework.ServiceListenerState.getMatchingListeners(), and org.knopflerfish.framework.Listeners.serviceChanged().

String [] org.knopflerfish.framework.ServiceReferenceImpl.getPropertyKeys (  ) 

Get the list of key names for the service's properties.

See also:
org.osgi.framework.ServiceReference.getPropertyKeys

Implements org.osgi.framework.ServiceReference.

Definition at line 92 of file ServiceReferenceImpl.java.

References org.knopflerfish.framework.PropertiesDictionary.keyArray(), and org.knopflerfish.framework.ServiceRegistrationImpl.properties.

Bundle org.knopflerfish.framework.ServiceReferenceImpl.getBundle (  ) 

Return the bundle which registered the service.

See also:
org.osgi.framework.ServiceReference.getBundle

Implements org.osgi.framework.ServiceReference.

Definition at line 104 of file ServiceReferenceImpl.java.

References org.knopflerfish.framework.ServiceRegistrationImpl.bundle.

boolean org.knopflerfish.framework.ServiceReferenceImpl.equals ( Object  o  ) 

Test if ServiceReferences points to same service.

See also:
org.osgi.framework.ServiceReference

Definition at line 114 of file ServiceReferenceImpl.java.

int org.knopflerfish.framework.ServiceReferenceImpl.hashCode (  ) 

Return a hashcode for the service.

See also:
org.osgi.framework.ServiceReference

Definition at line 127 of file ServiceReferenceImpl.java.

Bundle [] org.knopflerfish.framework.ServiceReferenceImpl.getUsingBundles (  ) 

Return the bundles that are using the service wrapped by this ServiceReference, i.e., whose usage count for this service is greater than zero.

Returns:
array of bundles whose usage count for the service wrapped by this ServiceReference is greater than zero, or null if no bundles currently are using this service
Since:
1.1

Implements org.osgi.framework.ServiceReference.

Definition at line 146 of file ServiceReferenceImpl.java.

References org.knopflerfish.framework.ServiceRegistrationImpl.dependents, org.knopflerfish.framework.ServiceRegistrationImpl.properties, and org.knopflerfish.framework.ServiceRegistrationImpl.reference.

Object org.knopflerfish.framework.ServiceReferenceImpl.getService ( final BundleImpl  bundle  )  [package]

Get the service object.

Parameters:
bundle requester of service.
Returns:
Service requested or null in case of failure.

Definition at line 168 of file ServiceReferenceImpl.java.

References org.knopflerfish.framework.ServiceRegistrationImpl.available, org.knopflerfish.framework.ServiceRegistrationImpl.bundle, org.knopflerfish.framework.PermissionOps.callGetService(), org.knopflerfish.framework.PermissionOps.checkGetServicePerms(), org.knopflerfish.framework.ServiceRegistrationImpl.dependents, org.knopflerfish.framework.BundleImpl.framework, org.knopflerfish.framework.Listeners.frameworkError(), org.knopflerfish.framework.PropertiesDictionary.get(), org.knopflerfish.framework.BundleImpl.getClassLoader(), org.knopflerfish.framework.Framework.listeners, org.knopflerfish.framework.BundleClassLoader.loadClass(), org.knopflerfish.framework.Framework.perm, org.knopflerfish.framework.ServiceRegistrationImpl.properties, org.knopflerfish.framework.ServiceRegistrationImpl.service, and org.knopflerfish.framework.ServiceRegistrationImpl.serviceInstances.

boolean org.knopflerfish.framework.ServiceReferenceImpl.ungetService ( BundleImpl  bundle,
boolean  checkRefCounter 
) [package]

Unget the service object.

Parameters:
bundle Bundle who wants remove service.
checkRefCounter If true decrement refence counter and remove service if we reach zero. If false remove service without checking refence counter.
Returns:
True if service was remove or false if only refence counter was decremented.

Definition at line 227 of file ServiceReferenceImpl.java.

References org.knopflerfish.framework.ServiceRegistrationImpl.bundle, org.knopflerfish.framework.ServiceRegistrationImpl.dependents, org.knopflerfish.framework.BundleImpl.framework, org.knopflerfish.framework.Listeners.frameworkError(), org.knopflerfish.framework.Framework.listeners, org.knopflerfish.framework.ServiceRegistrationImpl.properties, org.knopflerfish.framework.ServiceRegistrationImpl.reference, org.knopflerfish.framework.ServiceRegistrationImpl.service, and org.knopflerfish.framework.ServiceRegistrationImpl.serviceInstances.

PropertiesDictionary org.knopflerfish.framework.ServiceReferenceImpl.getProperties (  )  [package]

Get all properties registered with this service.

Returns:
Dictionary containing properties or null if service has been removed.

Definition at line 259 of file ServiceReferenceImpl.java.

References org.knopflerfish.framework.ServiceRegistrationImpl.properties.

Referenced by org.knopflerfish.framework.ServiceListenerState.getMatchingListeners().

Object org.knopflerfish.framework.ServiceReferenceImpl.cloneObject ( Object  val  )  [package]

Clone object.

Handles all service property types and does this recursivly.

Parameters:
bundle Object to clone.
Returns:
Cloned object.

Definition at line 274 of file ServiceReferenceImpl.java.

Referenced by org.knopflerfish.framework.ServiceReferenceImpl.getProperty().

boolean org.knopflerfish.framework.ServiceReferenceImpl.isAssignableTo ( Bundle  bundle,
String  className 
)

Tests if the bundle that registered the service referenced by this ServiceReference and the specified bundle use the same source for the package of the specified class name.

This method performs the following checks:

  1. Get the package name from the specified class name.
  2. For the bundle that registered the service referenced by this ServiceReference (registrant bundle); find the source for the package. If no source is found then return true if the registrant bundle is equal to the specified bundle; otherwise return false.
  3. If the package source of the registrant bundle is equal to the package source of the specified bundle then return true; otherwise return false.

Parameters:
bundle The Bundle object to check.
className The class name to check.
Returns:
true if the bundle which registered the service referenced by this ServiceReference and the specified bundle use the same source for the package of the specified class name. Otherwise false is returned.
Since:
1.3

Implements org.osgi.framework.ServiceReference.

Definition at line 309 of file ServiceReferenceImpl.java.

References org.knopflerfish.framework.BundleImpl.bpkgs, org.knopflerfish.framework.ServiceRegistrationImpl.bundle, org.knopflerfish.framework.BundleImpl.framework, org.knopflerfish.framework.Packages.getPkg(), org.knopflerfish.framework.BundlePackages.getProviderBundlePackages(), org.knopflerfish.framework.Framework.packages, and org.knopflerfish.framework.Pkg.providers.

Referenced by org.knopflerfish.framework.Listeners.serviceChanged().


The documentation for this class was generated from the following file:
Generated on Mon Jan 11 21:19:19 2010 for OpenMobileIS by  doxygen 1.5.4