org.apache.felix.ipojo.handlers.dependency

## Class DependencyHandler

- java.lang.Object
- - org.apache.felix.ipojo.Handler
  - - org.apache.felix.ipojo.PrimitiveHandler
    - - org.apache.felix.ipojo.handlers.dependency.DependencyHandler

All Implemented Interfaces:
  ConstructorInjector, FieldInterceptor, MethodInterceptor, DependencyStateListener

    public class DependencyHandler
    extends PrimitiveHandler
    implements DependencyStateListener

The dependency handler manages a list of service dependencies.

Author:
  Felix Project Team

### Field Summary

Fields
`static java.lang.String` `DYNAMIC_PROXY` Proxy type value: dynamic-proxy.
`static java.lang.String` `PROXY_DISABLED` Proxy settings value: disabled.
`static java.lang.String` `PROXY_ENABLED` Proxy settings value: enabled.
`static java.lang.String` `PROXY_SETTINGS_PROPERTY` Proxy settings property.
`static java.lang.String` `PROXY_TYPE_PROPERTY` Proxy type property.
`static java.lang.String` `SMART_PROXY` Proxy type value: smart.

### Fields inherited from class org.apache.felix.ipojo.PrimitiveHandler

`HANDLER_TYPE`

### Fields inherited from class org.apache.felix.ipojo.Handler

`HANDLER_LEVEL_PROPERTY, HANDLER_NAME_PROPERTY, HANDLER_NAMESPACE_PROPERTY, HANDLER_TYPE_PROPERTY, m_instance, m_isValid`

### Constructor Summary

Constructors
Constructor and Description
`DependencyHandler()`

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`protected void` `checkContext()` Check the validity of the dependencies.
`void` `configure(org.apache.felix.ipojo.metadata.Element componentMetadata, java.util.Dictionary configuration)` Configure the handler.
`protected DependencyCallback` `createDependencyHandler(Dependency dep, java.lang.String method, int type)`
`Dependency[]` `getDependencies()` Get the list of managed dependency.
`static java.lang.String` `getDependencyIdentifier(Dependency dep)` Builds a description of this dependency to help the user to identify it.
`HandlerDescription` `getDescription()` Get the dependency handler description.
`void` `invalidate(DependencyModel dep)` Invalidate method.
`void` `onCreation(java.lang.Object instance)` Handler createInstance method.
`void` `reconfigure(java.util.Dictionary configuration)` The instance is reconfigured.
`void` `start()` Handler start method.
`void` `stateChanged(int state)` This method is called when the component state changed.
`void` `stop()` Handler stop method.
`void` `validate(DependencyModel dep)` Validate method.

### Methods inherited from class org.apache.felix.ipojo.PrimitiveHandler

`attach, getConstructorParameter, getConstructorParameterType, getFactory, getHandler, getInstanceManager, getLogger, getPojoMetadata, onEntry, onError, onExit, onFinally, onGet, onSet, setFactory`

### Methods inherited from class org.apache.felix.ipojo.Handler

`debug, error, error, getHandlerManager, getValidity, info, initializeComponentFactory, isValid, setValidity, warn, warn`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### PROXY_SETTINGS_PROPERTY

    public static final java.lang.String PROXY_SETTINGS_PROPERTY

Proxy settings property.

See Also:
  Constant Field Values

#### PROXY_TYPE_PROPERTY

    public static final java.lang.String PROXY_TYPE_PROPERTY

Proxy type property.

See Also:
  Constant Field Values

#### SMART_PROXY

    public static final java.lang.String SMART_PROXY

Proxy type value: smart.

See Also:
  Constant Field Values

#### DYNAMIC_PROXY

    public static final java.lang.String DYNAMIC_PROXY

Proxy type value: dynamic-proxy.

See Also:
  Constant Field Values

#### PROXY_ENABLED

    public static final java.lang.String PROXY_ENABLED

Proxy settings value: enabled.

See Also:
  Constant Field Values

#### PROXY_DISABLED

    public static final java.lang.String PROXY_DISABLED

Proxy settings value: disabled.

See Also:
  Constant Field Values

### Constructor Detail

#### DependencyHandler

    public DependencyHandler()

### Method Detail

#### getDependencyIdentifier

    public static java.lang.String getDependencyIdentifier(Dependency dep)

Builds a description of this dependency to help the user to identify it. IT's not related to the Dependency Description, it's just a string containing dependency information to spot it easily in the code.

Parameters:
  `dep` - the dependency
Returns:
  the identifier containing (if defined) the id, the specification, the field and the callback.
Since:
  1.10.1

#### getDependencies

    public Dependency[] getDependencies()

Get the list of managed dependency.

Returns:
  the dependency list

#### validate

    public void validate(DependencyModel dep)

Validate method. This method is invoked by an AbstractServiceDependency when this dependency becomes RESOLVED.

Specified by:
  `validate` in interface `DependencyStateListener`
Parameters:
  `dep` - : the dependency becoming RESOLVED.
See Also:
  `DependencyStateListener.validate(org.apache.felix.ipojo.util.DependencyModel)`

#### invalidate

    public void invalidate(DependencyModel dep)

Invalidate method. This method is invoked by an AbstractServiceDependency when this dependency becomes UNRESOLVED or BROKEN.

Specified by:
  `invalidate` in interface `DependencyStateListener`
Parameters:
  `dep` - : the dependency becoming UNRESOLVED or BROKEN.
See Also:
  `DependencyStateListener.invalidate(org.apache.felix.ipojo.util.DependencyModel)`

#### checkContext

    protected void checkContext()

Check the validity of the dependencies.

#### configure

    public void configure(org.apache.felix.ipojo.metadata.Element componentMetadata,
                          java.util.Dictionary configuration)
                   throws ConfigurationException

Configure the handler.

Specified by:
  `configure` in class `Handler`
Parameters:
  `componentMetadata` - : the component type metadata
  `configuration` - : the instance configuration
Throws:
  `ConfigurationException` - : one dependency metadata is not correct.
See Also:
  `Handler.configure(org.apache.felix.ipojo.metadata.Element, java.util.Dictionary)`

#### createDependencyHandler

    protected DependencyCallback createDependencyHandler(Dependency dep,
                                                         java.lang.String method,
                                                         int type)

#### start

    public void start()

Handler start method.

Specified by:
  `start` in class `Handler`
See Also:
  `Handler.start()`

#### stop

    public void stop()

Handler stop method.

Specified by:
  `stop` in class `Handler`
See Also:
  `Handler.stop()`

#### onCreation

    public void onCreation(java.lang.Object instance)

Handler createInstance method. This method is override to allow delayed callback invocation.

Overrides:
  `onCreation` in class `PrimitiveHandler`
Parameters:
  `instance` - : the created object
See Also:
  `PrimitiveHandler.onCreation(Object)`

#### getDescription

    public HandlerDescription getDescription()

Get the dependency handler description.

Overrides:
  `getDescription` in class `Handler`
Returns:
  the dependency handler description.
See Also:
  `Handler.getDescription()`

#### reconfigure

    public void reconfigure(java.util.Dictionary configuration)

The instance is reconfigured.

Overrides:
  `reconfigure` in class `Handler`
Parameters:
  `configuration` - the new instance configuration.

#### stateChanged

    public void stateChanged(int state)

Description copied from class: `Handler`
This method is called when the component state changed. By default, this method does nothing.

Overrides:
  `stateChanged` in class `Handler`
Parameters:
  `state` - the new instance state `ComponentInstance`