org.apache.felix.dm.impl
Class ServiceRegistrationImpl

java.lang.Object
  extended by org.apache.felix.dm.impl.ServiceRegistrationImpl
All Implemented Interfaces:
ServiceRegistration

public final class ServiceRegistrationImpl
extends Object
implements ServiceRegistration

A wrapper around a service registration that blocks until the service registration is available.

Author:
Felix Project Team

Field Summary
static ServiceRegistrationImpl ILLEGAL_STATE
           
 
Constructor Summary
ServiceRegistrationImpl()
           
 
Method Summary
 boolean equals(Object obj)
           
 ServiceReference getReference()
          Returns a ServiceReference object for a service being registered.
 int hashCode()
           
 void setProperties(Dictionary dictionary)
          Updates the properties associated with a service.
 String toString()
           
 void unregister()
          Unregisters a service.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ILLEGAL_STATE

public static final ServiceRegistrationImpl ILLEGAL_STATE
Constructor Detail

ServiceRegistrationImpl

public ServiceRegistrationImpl()
Method Detail

getReference

public ServiceReference getReference()
Description copied from interface: ServiceRegistration
Returns a ServiceReference object for a service being registered.

The ServiceReference object may be shared with other bundles.

Specified by:
getReference in interface ServiceRegistration
Returns:
ServiceReference object.

setProperties

public void setProperties(Dictionary dictionary)
Description copied from interface: ServiceRegistration
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.

Specified by:
setProperties in interface ServiceRegistration
Parameters:
dictionary - 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.

unregister

public void unregister()
Description copied from interface: ServiceRegistration
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 once unregistration is complete.

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 obtained.
  2. A service event of type ServiceEvent.UNREGISTERING is fired so that bundles using this service can release their use of the service. Once delivery of the service event is complete, the ServiceReference objects for the service may no longer be used to get a service object for the service.
  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.

Specified by:
unregister in interface ServiceRegistration
See Also:
BundleContext.ungetService(org.osgi.framework.ServiceReference), ServiceFactory.ungetService(org.osgi.framework.Bundle, org.osgi.framework.ServiceRegistration, java.lang.Object)

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2011 Apache Software Foundation. All Rights Reserved.