org.apache.felix.dm.runtime
Class ToggleServiceDependency

java.lang.Object
  extended by org.apache.felix.dm.runtime.ToggleServiceDependency
All Implemented Interfaces:
Dependency, DependencyActivation

public class ToggleServiceDependency
extends Object
implements Dependency, DependencyActivation

This is a custom DependencyManager Dependency, allowing to take control of when the dependency is available or not. It's used in the context of the LifecycleController class, in order to activate/deactivate a Component on demand.


Constructor Summary
ToggleServiceDependency()
           
ToggleServiceDependency(boolean isAvailable)
           
 
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.
  getAutoConfigType()
          Returns the type of the instance that is injected.
 Dictionary getProperties()
           
 void invoke(DependencyService dependencyService, String name)
           
 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.
 void setAvailable(boolean isAvailable)
           
 void start(DependencyService service)
           
 void stop(DependencyService service)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ToggleServiceDependency

public ToggleServiceDependency()

ToggleServiceDependency

public ToggleServiceDependency(boolean isAvailable)
Method Detail

setAvailable

public void setAvailable(boolean isAvailable)

createCopy

public Dependency createCopy()
Description copied from interface: Dependency
Creates a copy of this dependency, cloning all declared state, but not the runtime state.

Specified by:
createCopy in interface Dependency

getAutoConfigInstance

public Object getAutoConfigInstance()
Description copied from interface: Dependency
Returns the instance that is injected.

Specified by:
getAutoConfigInstance in interface Dependency
Returns:
the instance that is injected

getAutoConfigName

public String getAutoConfigName()
Description copied from interface: Dependency
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.

Specified by:
getAutoConfigName in interface Dependency
Returns:

getAutoConfigType

public  getAutoConfigType()
Description copied from interface: Dependency
Returns the type of the instance that is injected.

Specified by:
getAutoConfigType in interface Dependency
Returns:
the type of the instance that is injected

getProperties

public Dictionary getProperties()
Specified by:
getProperties in interface Dependency

invokeAdded

public void invokeAdded(DependencyService service)
Description copied from interface: Dependency
Invoke the "added" callback on a required dependency.

Specified by:
invokeAdded in interface Dependency

invokeRemoved

public void invokeRemoved(DependencyService service)
Description copied from interface: Dependency
Invoke the "removed" callback on a required dependency.

Specified by:
invokeRemoved in interface Dependency

invoke

public void invoke(DependencyService dependencyService,
                   String name)

isAutoConfig

public boolean isAutoConfig()
Description copied from interface: Dependency
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.

Specified by:
isAutoConfig in interface Dependency
Returns:
true if auto configuration is enabled for this dependency

isAvailable

public boolean isAvailable()
Description copied from interface: Dependency
Returns true if the dependency is available.

Specified by:
isAvailable in interface Dependency
Returns:
true if the dependency is available

isInstanceBound

public boolean isInstanceBound()
Description copied from interface: Dependency
As soon as the instance is created, keep it around, even if this dependency goes away.

Specified by:
isInstanceBound in interface Dependency
Returns:
true if the dependency is instance bound

isPropagated

public boolean isPropagated()
Specified by:
isPropagated in interface Dependency

isRequired

public boolean isRequired()
Description copied from interface: Dependency
Returns true if this a required dependency. Required dependencies are dependencies that must be available before the component can be activated.

Specified by:
isRequired in interface Dependency
Returns:
true if the dependency is required

start

public void start(DependencyService service)
Specified by:
start in interface DependencyActivation

stop

public void stop(DependencyService service)
Specified by:
stop in interface DependencyActivation


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