org.apache.felix.scr.impl.manager
Class DependencyManager

java.lang.Object
  extended by org.apache.felix.scr.impl.manager.DependencyManager
All Implemented Interfaces:
EventListener, Reference, ServiceListener

public class DependencyManager
extends Object
implements ServiceListener, Reference

The DependencyManager manages the references to services declared by a single <reference>


Method Summary
 String getBindMethodName()
          Returns the name of the method called if a service is being bound to the Component or null if no such method is configued.
 String getName()
          Returns the name of the service reference.
 String getServiceName()
          Returns the name of the service used by this Reference.
 ServiceReference[] getServiceReferences()
          Returns an array of references to the services bound to this Reference or null if no services are currently bound.
 String getTarget()
          Returns the target filter of this dependency as a string or null if this dependency has no target filter set.
 String getUnbindMethodName()
          Returns the name of the method called if a service is being unbound from the Component or null if no such method is configued.
 String getUpdatedMethodName()
          Returns the name of the method called if a bound service updates its service registration properties or null if no such method is configued.
 boolean hasGetPermission()
          Returns true if the component providing bundle has permission to get the service described by this reference.
 boolean isMultiple()
          Returns whether this reference is multiple.
 boolean isOptional()
          Returns whether this reference is optional.
 boolean isSatisfied()
          Returns true if this dependency manager is satisfied, that is if eithern the dependency is optional or the number of services registered in the framework and available to this dependency manager is not zero.
 boolean isStatic()
          Returns true if the reference is defined with static policy.
 void serviceChanged(ServiceEvent event)
          Called when a registered service changes state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

serviceChanged

public void serviceChanged(ServiceEvent event)
Called when a registered service changes state. In the case of service modification the service is assumed to be removed and added again.

Specified by:
serviceChanged in interface ServiceListener
Parameters:
event - The ServiceEvent object.

getServiceName

public String getServiceName()
Description copied from interface: Reference
Returns the name of the service used by this Reference. This method provides access to the interface attribute of the reference element.

Specified by:
getServiceName in interface Reference

getServiceReferences

public ServiceReference[] getServiceReferences()
Description copied from interface: Reference
Returns an array of references to the services bound to this Reference or null if no services are currently bound.

Specified by:
getServiceReferences in interface Reference

isOptional

public boolean isOptional()
Description copied from interface: Reference
Returns whether this reference is optional. This method provides access to the lower bound of the cardinality attribute of the reference element. In other words, this method returns true if the cardinality is 0..1 or 0..n.

Specified by:
isOptional in interface Reference

isMultiple

public boolean isMultiple()
Description copied from interface: Reference
Returns whether this reference is multiple. This method provides access to the upper bound of the cardinality attribute of the reference element. In other words, this method returns true if the cardinality is 0..n or 1..n.

Specified by:
isMultiple in interface Reference

isStatic

public boolean isStatic()
Description copied from interface: Reference
Returns true if the reference is defined with static policy. This method provides access to the policy element of the reference element. true is returned if the policy is defined as static.

Specified by:
isStatic in interface Reference

getBindMethodName

public String getBindMethodName()
Description copied from interface: Reference
Returns the name of the method called if a service is being bound to the Component or null if no such method is configued. This method provides access to the bind attribute of the reference element.

Specified by:
getBindMethodName in interface Reference

getUnbindMethodName

public String getUnbindMethodName()
Description copied from interface: Reference
Returns the name of the method called if a service is being unbound from the Component or null if no such method is configued. This method provides access to the unbind attribute of the reference element.

Specified by:
getUnbindMethodName in interface Reference

getUpdatedMethodName

public String getUpdatedMethodName()
Description copied from interface: Reference
Returns the name of the method called if a bound service updates its service registration properties or null if no such method is configued. This method provides access to the updated attribute of the reference element.

For a component declared in a Declarative Services 1.0 and 1.1 descriptor, this method always returns null.

Specified by:
getUpdatedMethodName in interface Reference

getName

public String getName()
Returns the name of the service reference.

Specified by:
getName in interface Reference

isSatisfied

public boolean isSatisfied()
Returns true if this dependency manager is satisfied, that is if eithern the dependency is optional or the number of services registered in the framework and available to this dependency manager is not zero.

Specified by:
isSatisfied in interface Reference

hasGetPermission

public boolean hasGetPermission()
Returns true if the component providing bundle has permission to get the service described by this reference.


getTarget

public String getTarget()
Returns the target filter of this dependency as a string or null if this dependency has no target filter set.

Specified by:
getTarget in interface Reference
Returns:
The target filter of this dependency or null if none is set.


Copyright © 2011 Apache Software Foundation. All Rights Reserved.