org.apache.felix.ipojo.handlers.providedservice

## Class ProvidedServiceHandler

- java.lang.Object
- - org.apache.felix.ipojo.Handler
  - - org.apache.felix.ipojo.PrimitiveHandler
    - - org.apache.felix.ipojo.handlers.providedservice.ProvidedServiceHandler

All Implemented Interfaces:
  ConstructorInjector, FieldInterceptor, MethodInterceptor

    public class ProvidedServiceHandler
    extends PrimitiveHandler

Composite Provided Service Handler. This handler manage the service providing for a composition.

Author:
  Felix Project Team

### Field Summary

### 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
`ProvidedServiceHandler()`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `addProperties(java.util.Dictionary dict)` Adds properties to all provided services.
`void` `configure(org.apache.felix.ipojo.metadata.Element componentMetadata, java.util.Dictionary configuration)` Configure the handler.
`HandlerDescription` `getDescription()` Build the provided service description.
`ProvidedService[]` `getProvidedServices()` Get the array of provided service.
`void` `initializeComponentFactory(ComponentTypeDescription desc, org.apache.felix.ipojo.metadata.Element metadata)` Initialize the component type.
`java.lang.Object` `onGet(java.lang.Object pojo, java.lang.String fieldName, java.lang.Object value)` Getter Callback Method.
`void` `onSet(java.lang.Object pojo, java.lang.String fieldName, java.lang.Object value)` Setter Callback Method.
`void` `reconfigure(java.util.Dictionary dict)` Reconfigure provided service.
`void` `removeProperties(java.util.Dictionary dict)` Remove properties form all provided services.
`void` `start()` Start the provided service handler.
`void` `stateChanged(int state)` Register the services if the new state is VALID.
`void` `stop()` Stop the provided service handler.

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

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

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

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

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

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

### Constructor Detail

#### ProvidedServiceHandler

    public ProvidedServiceHandler()

### Method Detail

#### getProvidedServices

    public ProvidedService[] getProvidedServices()

Get the array of provided service.

Returns:
  the list of the provided service.

#### 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` - : the metadata are not correct.
See Also:
  `Handler.configure(org.apache.felix.ipojo.metadata.Element, java.util.Dictionary)`

#### stop

    public void stop()

Stop the provided service handler.

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

#### start

    public void start()

Start the provided service handler.

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

#### onSet

    public void onSet(java.lang.Object pojo,
                      java.lang.String fieldName,
                      java.lang.Object value)

Setter Callback Method. Check if the modified field is a property to update the value.

Specified by:
  `onSet` in interface `FieldInterceptor`
Overrides:
  `onSet` in class `PrimitiveHandler`
Parameters:
  `pojo` - : the pojo object on which the field is accessed
  `fieldName` - : field name
  `value` - : new value
See Also:
  `FieldInterceptor.onSet(Object, String, Object)`

#### onGet

    public java.lang.Object onGet(java.lang.Object pojo,
                                  java.lang.String fieldName,
                                  java.lang.Object value)

Getter Callback Method. Check if the field is a property to push the stored value.

Specified by:
  `onGet` in interface `FieldInterceptor`
Overrides:
  `onGet` in class `PrimitiveHandler`
Parameters:
  `pojo` - : the pojo object on which the field is accessed
  `fieldName` - : field name
  `value` - : value pushed by the previous handler
Returns:
  the stored value or the previous value.
See Also:
  `FieldInterceptor.onGet(Object, String, Object)`

#### stateChanged

    public void stateChanged(int state)

Register the services if the new state is VALID. Un-register the services if the new state is UNRESOLVED.

Overrides:
  `stateChanged` in class `Handler`
Parameters:
  `state` - : the new instance state.
See Also:
  `Handler.stateChanged(int)`

#### addProperties

    public void addProperties(java.util.Dictionary dict)

Adds properties to all provided services.

Parameters:
  `dict` - : dictionary of properties to add

#### removeProperties

    public void removeProperties(java.util.Dictionary dict)

Remove properties form all provided services.

Parameters:
  `dict` - : dictionary of properties to delete.

#### getDescription

    public HandlerDescription getDescription()

Build the provided service description.

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

#### reconfigure

    public void reconfigure(java.util.Dictionary dict)

Reconfigure provided service.

Overrides:
  `reconfigure` in class `Handler`
Parameters:
  `dict` - : the new instance configuration.
See Also:
  `Handler.reconfigure(java.util.Dictionary)`

#### initializeComponentFactory

    public void initializeComponentFactory(ComponentTypeDescription desc,
                                           org.apache.felix.ipojo.metadata.Element metadata)
                                    throws ConfigurationException

Initialize the component type.

Overrides:
  `initializeComponentFactory` in class `Handler`
Parameters:
  `desc` - : component type description to populate.
  `metadata` - : component type metadata.
Throws:
  `ConfigurationException` - : occurs when the POJO does not implement any interfaces.
See Also:
  `Handler.initializeComponentFactory(org.apache.felix.ipojo.architecture.ComponentTypeDescription, org.apache.felix.ipojo.metadata.Element)`