org.apache.felix.ipojo.composite

## Class FactoryProxy

- java.lang.Object
- - org.apache.felix.ipojo.composite.FactoryProxy

All Implemented Interfaces:
  Factory

    public class FactoryProxy
    extends java.lang.Object
    implements Factory

Bridge representing a Factory inside a composition.

Author:
  Felix Project Team

### Field Summary

### Fields inherited from interface org.apache.felix.ipojo.Factory

`FACTORY_VERSION_PROPERTY, INSTANCE_NAME_PROPERTY, INVALID, VALID`

### Constructor Summary

Constructors
Constructor and Description
`FactoryProxy(Factory fact, ServiceContext svcContext)` Constructor.

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `addFactoryStateListener(FactoryStateListener listener)` Add a factory listener.
`ComponentInstance` `createComponentInstance(java.util.Dictionary configuration)` Create an instance manager (i.e.
`ComponentInstance` `createComponentInstance(java.util.Dictionary configuration, ServiceContext serviceContext)` Create an instance manager (i.e.
`org.osgi.framework.BundleContext` `getBundleContext()`
`java.lang.String` `getClassName()`
`ComponentTypeDescription` `getComponentDescription()`
`org.apache.felix.ipojo.metadata.Element` `getComponentMetadata()`
`org.apache.felix.ipojo.metadata.Element` `getDescription()` Get the component type information containing provided service, configuration properties ...
`java.util.List<ComponentInstance>` `getInstances()`
`java.util.List<java.lang.String>` `getInstancesNames()`
`java.util.List` `getMissingHandlers()`
`java.lang.String` `getName()` Return the factory name.
`java.util.List` `getRequiredHandlers()`
`int` `getState()`
`java.lang.String` `getVersion()`
`boolean` `isAcceptable(java.util.Dictionary conf)` Check if the given configuration is acceptable as a configuration of a component instance.
`void` `reconfigure(java.util.Dictionary conf)` Reconfigure an instance already created.
`void` `removeFactoryStateListener(FactoryStateListener listener)` Remove a service listener.

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

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

### Constructor Detail

#### FactoryProxy

    public FactoryProxy(Factory fact,
                        ServiceContext svcContext)

Constructor.

Parameters:
  `fact` - : the targeted factory.
  `svcContext` - : the service context to target.

### Method Detail

#### createComponentInstance

    public ComponentInstance createComponentInstance(java.util.Dictionary configuration)
                                              throws UnacceptableConfiguration,
                                                     MissingHandlerException,
                                                     ConfigurationException

Create an instance manager (i.e. component type instance).

Specified by:
  `createComponentInstance` in interface `Factory`
Parameters:
  `configuration` - : the configuration properties for this component.
Returns:
  the created instance manager.
Throws:
  `UnacceptableConfiguration` - : when a given configuration is not valid.
  `MissingHandlerException` - : occurs when the creation failed due to a missing handler (the factory should be invalid)
  `ConfigurationException` - : occurs when the creation failed due to a configuration issue
See Also:
  `Factory.createComponentInstance(java.util.Dictionary)`

#### createComponentInstance

    public ComponentInstance createComponentInstance(java.util.Dictionary configuration,
                                                     ServiceContext serviceContext)
                                              throws UnacceptableConfiguration,
                                                     MissingHandlerException,
                                                     ConfigurationException

Create an instance manager (i.e. component type instance). This has these service interaction in the scope given in argument.

Specified by:
  `createComponentInstance` in interface `Factory`
Parameters:
  `configuration` - : the configuration properties for this component.
  `serviceContext` - : the service context of the component.
Returns:
  the created instance manager.
Throws:
  `UnacceptableConfiguration` - : when the given configuration is not valid.
  `MissingHandlerException` - : when at least one handler is missing.
  `ConfigurationException` - : when an issue occurs during the oconfiguration of the instance.
See Also:
  `Factory.createComponentInstance(java.util.Dictionary, org.apache.felix.ipojo.ServiceContext)`

#### getDescription

    public org.apache.felix.ipojo.metadata.Element getDescription()

Get the component type information containing provided service, configuration properties ...

Specified by:
  `getDescription` in interface `Factory`
Returns:
  the component type information.
See Also:
  `Factory.getDescription()`

#### getName

    public java.lang.String getName()

Return the factory name.

Specified by:
  `getName` in interface `Factory`
Returns:
  the name of the factory.
See Also:
  `Factory.getName()`

#### isAcceptable

    public boolean isAcceptable(java.util.Dictionary conf)

Check if the given configuration is acceptable as a configuration of a component instance.

Specified by:
  `isAcceptable` in interface `Factory`
Parameters:
  `conf` - : the configuration to test
Returns:
  true if the configuration is acceptable
See Also:
  `Factory.isAcceptable(java.util.Dictionary)`

#### reconfigure

    public void reconfigure(java.util.Dictionary conf)
                     throws UnacceptableConfiguration,
                            MissingHandlerException

Reconfigure an instance already created. This configuration need to have the name property to identify the instance.

Specified by:
  `reconfigure` in interface `Factory`
Parameters:
  `conf` - : the configuration to reconfigure the instance.
Throws:
  `UnacceptableConfiguration` - : if the given configuration is not consistent for the targeted instance.
  `MissingHandlerException` - : when at least one handler is missing
See Also:
  `Factory.reconfigure(java.util.Dictionary)`

#### addFactoryStateListener

    public void addFactoryStateListener(FactoryStateListener listener)

Add a factory listener.

Specified by:
  `addFactoryStateListener` in interface `Factory`
Parameters:
  `listener` - : the listener to add.
See Also:
  `Factory.addFactoryStateListener(org.apache.felix.ipojo.FactoryStateListener)`

#### getMissingHandlers

    public java.util.List getMissingHandlers()

Specified by:
  `getMissingHandlers` in interface `Factory`

#### getRequiredHandlers

    public java.util.List getRequiredHandlers()

Specified by:
  `getRequiredHandlers` in interface `Factory`

#### removeFactoryStateListener

    public void removeFactoryStateListener(FactoryStateListener listener)

Remove a service listener.

Specified by:
  `removeFactoryStateListener` in interface `Factory`
Parameters:
  `listener` - : the listener to remove
See Also:
  `Factory.removeFactoryStateListener(org.apache.felix.ipojo.FactoryStateListener)`

#### getComponentDescription

    public ComponentTypeDescription getComponentDescription()

Specified by:
  `getComponentDescription` in interface `Factory`

#### getClassName

    public java.lang.String getClassName()

Specified by:
  `getClassName` in interface `Factory`

#### getState

    public int getState()

Specified by:
  `getState` in interface `Factory`

#### getBundleContext

    public org.osgi.framework.BundleContext getBundleContext()

Specified by:
  `getBundleContext` in interface `Factory`

#### getVersion

    public java.lang.String getVersion()

Specified by:
  `getVersion` in interface `Factory`

#### getComponentMetadata

    public org.apache.felix.ipojo.metadata.Element getComponentMetadata()

Specified by:
  `getComponentMetadata` in interface `Factory`

#### getInstances

    public java.util.List<ComponentInstance> getInstances()

Specified by:
  `getInstances` in interface `Factory`

#### getInstancesNames

    public java.util.List<java.lang.String> getInstancesNames()

Specified by:
  `getInstancesNames` in interface `Factory`