org.apache.felix.dm
Interface Dependency

All Known Subinterfaces:
BundleDependency, ConfigurationDependency, ResourceDependency, ServiceDependency, TemporalServiceDependency
All Known Implementing Classes:
BundleDependencyImpl, ConfigurationDependencyImpl, DependencyBase, ResourceDependencyImpl, ServiceDependencyImpl, TemporalServiceDependencyImpl, ToggleServiceDependency

public interface Dependency

Generic dependency for a component. A dependency can be required or not. A dependency will be activated by the component it belongs to. The component will call the start(Service service) and stop(Service service) methods. After it has been started, a dependency must callback the associated component's dependencyAvailable() and dependencyUnavailable() methods. State changes of the dependency itself may only be made as long as the dependency is not 'active', meaning it is associated with a running component.

Author:
Felix Project Team

Method Summary
 Dependency createCopy()
          Creates a copy of this dependency, cloning all declared state, but not the runtime state.
 Object getAutoConfigInstance()
          Returns the instance that is injected.
 String getAutoConfigName()
          Returns the name of the member in the class of the component instance to inject into.
 Class getAutoConfigType()
          Returns the type of the instance that is injected.
 Dictionary getProperties()
           
 void invokeAdded(DependencyService service)
          Invoke the "added" callback on a required dependency.
 void invokeRemoved(DependencyService service)
          Invoke the "removed" callback on a required dependency.
 boolean isAutoConfig()
          Returns true>code> if auto configuration is enabled for this dependency.
 boolean isAvailable()
          Returns true if the dependency is available.
 boolean isInstanceBound()
          As soon as the instance is created, keep it around, even if this dependency goes away.
 boolean isPropagated()
           
 boolean isRequired()
          Returns true if this a required dependency.
 

Method Detail

isRequired

boolean isRequired()
Returns true if this a required dependency. Required dependencies are dependencies that must be available before the component can be activated.

Returns:
true if the dependency is required

isAvailable

boolean isAvailable()
Returns true if the dependency is available.

Returns:
true if the dependency is available

isInstanceBound

boolean isInstanceBound()
As soon as the instance is created, keep it around, even if this dependency goes away.

Returns:
true if the dependency is instance bound

isAutoConfig

boolean isAutoConfig()
Returns true>code> if auto configuration is enabled for this dependency. Auto configuration means that a dependency is injected in the component instance when it's available, and if it's unavailable, a "null object" will be inserted instead.

Returns:
true if auto configuration is enabled for this dependency

getAutoConfigType

Class getAutoConfigType()
Returns the type of the instance that is injected.

Returns:
the type of the instance that is injected

getAutoConfigInstance

Object getAutoConfigInstance()
Returns the instance that is injected.

Returns:
the instance that is injected

getAutoConfigName

String getAutoConfigName()
Returns the name of the member in the class of the component instance to inject into. If you specify this, not all members of the right type will be injected, only the member whose name matches.

Returns:

invokeAdded

void invokeAdded(DependencyService service)
Invoke the "added" callback on a required dependency.

Parameters:
service -

invokeRemoved

void invokeRemoved(DependencyService service)
Invoke the "removed" callback on a required dependency.

Parameters:
service -

isPropagated

boolean isPropagated()

getProperties

Dictionary getProperties()

createCopy

Dependency createCopy()
Creates a copy of this dependency, cloning all declared state, but not the runtime state.



Copyright © 2013 The Apache Software Foundation. All Rights Reserved.