org.apache.felix.ipojo.context
Class ServiceRegistrationImpl

java.lang.Object
  extended by org.apache.felix.ipojo.context.ServiceRegistrationImpl
All Implemented Interfaces:
org.osgi.framework.ServiceRegistration

public class ServiceRegistrationImpl
extends java.lang.Object
implements org.osgi.framework.ServiceRegistration

Internal service registration implementation. This class is used for in the composition.

Author:
Felix Project Team

Constructor Summary
ServiceRegistrationImpl(ServiceRegistry registry, ComponentInstance instance, java.lang.String[] classes, java.lang.Long serviceId, java.lang.Object svcObj, java.util.Dictionary dict)
          Constructor.
 
Method Summary
protected  java.util.Dictionary getProperties()
          Gets the published properties.
protected  java.lang.Object getProperty(java.lang.String key)
          Look for a property in the service properties.
protected  java.lang.String[] getPropertyKeys()
          Get the property keys.
 org.osgi.framework.ServiceReference getReference()
          Get the service reference attached with this service registration.
protected  java.lang.Object getService()
          Get the service object.
protected  boolean isValid()
          Check if the service registration still valid.
 void setProperties(java.util.Dictionary dict)
          Add properties to a service registration.
 void ungetService(ComponentInstance instance, java.lang.Object srvObj)
          Unget a service.
 void unregister()
          Unregister the service.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServiceRegistrationImpl

public ServiceRegistrationImpl(ServiceRegistry registry,
                               ComponentInstance instance,
                               java.lang.String[] classes,
                               java.lang.Long serviceId,
                               java.lang.Object svcObj,
                               java.util.Dictionary dict)
Constructor.

Parameters:
registry - : the service registry
instance - : component instance
classes - : published interfaces array
serviceId - : the unique service id
svcObj - : the service object or the service factory object
dict - : service properties
Method Detail

isValid

protected boolean isValid()
Check if the service registration still valid.

Returns:
true if the service registration is valid.

getReference

public org.osgi.framework.ServiceReference getReference()
Get the service reference attached with this service registration.

Specified by:
getReference in interface org.osgi.framework.ServiceRegistration
Returns:
the service reference
See Also:
ServiceRegistration.getReference()

setProperties

public void setProperties(java.util.Dictionary dict)
Add properties to a service registration.

Specified by:
setProperties in interface org.osgi.framework.ServiceRegistration
Parameters:
dict - : the properties to add
See Also:
ServiceRegistration.setProperties(java.util.Dictionary)

unregister

public void unregister()
Unregister the service.

Specified by:
unregister in interface org.osgi.framework.ServiceRegistration
See Also:
ServiceRegistration.unregister()

getProperty

protected java.lang.Object getProperty(java.lang.String key)
Look for a property in the service properties.

Parameters:
key - : property key
Returns:
the object associated with the key or null if the key is not present.

getPropertyKeys

protected java.lang.String[] getPropertyKeys()
Get the property keys.

Returns:
the property keys list.

getProperties

protected java.util.Dictionary getProperties()
Gets the published properties.

Returns:
the dictionary containing each published properties.

getService

protected java.lang.Object getService()
Get the service object.

Returns:
the service object. Call the service factory if needed.

ungetService

public void ungetService(ComponentInstance instance,
                         java.lang.Object srvObj)
Unget a service.

Parameters:
instance - : component instance using the service.
srvObj - : the unget service object.