org.osgi.framework.ServiceRegistration Interface Reference

Inheritance diagram for org.osgi.framework.ServiceRegistration:

org.knopflerfish.framework.ServiceRegistrationImpl

List of all members.


Detailed Description

A registered service.

The Framework returns a ServiceRegistration object when a BundleContext.registerService method invocation 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.

Version:
Revision
1.12
See also:
BundleContext.registerService(String[],Object,Dictionary)

Definition at line 39 of file ServiceRegistration.java.


Public Member Functions

ServiceReference getReference ()
 Returns a ServiceReference object for a service being registered.
void setProperties (Dictionary properties)
 Updates the properties associated with a service.
void unregister ()
 Unregisters a service.

Member Function Documentation

ServiceReference org.osgi.framework.ServiceRegistration.getReference (  ) 

Returns a ServiceReference object for a service being registered.

The ServiceReference object may be shared with other bundles.

Exceptions:
java.lang.IllegalStateException If this ServiceRegistration object has already been unregistered.
Returns:
ServiceReference object.

Implemented in org.knopflerfish.framework.ServiceRegistrationImpl.

Referenced by org.knopflerfish.framework.Services.register().

void org.osgi.framework.ServiceRegistration.setProperties ( Dictionary  properties  ) 

Updates the properties associated with a service.

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:

  1. The service's properties are replaced with the provided properties.
  2. A service event of type ServiceEvent#MODIFIED is fired.

Parameters:
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.
Exceptions:
IllegalStateException If this ServiceRegistration object has already been unregistered.
IllegalArgumentException If properties contains case variants of the same key name.

Implemented in org.knopflerfish.framework.ServiceRegistrationImpl.

void org.osgi.framework.ServiceRegistration.unregister (  ) 

Unregisters a service.

Remove a ServiceRegistration object from the Framework service registry. All ServiceReference objects associated with this ServiceRegistration object can no longer be used to interact with the service.

The following steps are required to unregister a service:

  1. The service is removed from the Framework service registry so that it can no longer be used. ServiceReference objects for the service may no longer be used to get a service object for the service.
  2. A service event of type ServiceEvent#UNREGISTERING is fired so that bundles using this service can release their use of it.
  3. For each bundle whose use count for this service is greater than zero:
    The bundle's use count for this service is set to zero.
    If the service was registered with a ServiceFactory object, the ServiceFactory.ungetService method is called to release the service object for the bundle.

Exceptions:
java.lang.IllegalStateException If this ServiceRegistration object has already been unregistered.
See also:
BundleContext.ungetService

ServiceFactory.ungetService

Implemented in org.knopflerfish.framework.ServiceRegistrationImpl.


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