org.apache.felix.ipojo.composite

## Class CompositeFactory

- java.lang.Object
- - org.apache.felix.ipojo.IPojoFactory
  - - org.apache.felix.ipojo.ComponentFactory
    - - org.apache.felix.ipojo.composite.CompositeFactory

All Implemented Interfaces:
  Factory, TrackerCustomizer

    public class CompositeFactory
    extends ComponentFactory
    implements TrackerCustomizer

The component factory manages component instance objects. This management consist in creating and managing component instance build with the component factory. This class could export Factory and ManagedServiceFactory services.

Author:
  Felix Project Team

### Nested Class Summary

### Nested classes/interfaces inherited from class org.apache.felix.ipojo.IPojoFactory

`IPojoFactory.DefaultNameGenerator, IPojoFactory.NameGenerator, IPojoFactory.RequiredHandler, IPojoFactory.RetryNameGenerator`

### Field Summary

Fields
`protected Tracker` `m_tracker` Tracker used to track required handler factories.

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

`HANDLER_AUTO_PRIMITIVE`

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

`INSTANCE_NAME, m_componentDesc, m_componentInstances, m_componentMetadata, m_context, m_factoryName, m_isPublic, m_listeners, m_logger, m_requiredHandlers, m_sr, m_state, m_version`

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

`FACTORY_VERSION_PROPERTY, INSTANCE_NAME_PROPERTY, INVALID, VALID`

### Constructor Summary

Constructors
Constructor and Description
`CompositeFactory(org.osgi.framework.BundleContext context, org.apache.felix.ipojo.metadata.Element metadata)` Create a composite factory.

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `check(org.apache.felix.ipojo.metadata.Element metadata)` Check if the metadata are well formed.
`ComponentInstance` `createInstance(java.util.Dictionary configuration, IPojoContext context, HandlerManager[] handlers)` Create an instance from the current factory.
`java.lang.String` `getClassName()`
`java.lang.String` `getFactoryName()`
`java.util.List<IPojoFactory.RequiredHandler>` `getRequiredHandlerList()` Compute required handlers.
`void` `reconfigure(java.util.Dictionary properties)` Reconfigure an existing instance.
`void` `starting()` Start all the instance managers.
`void` `stopping()` Stop all the instance managers.

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

`addedService, addingService, defineClass, getBundleClassLoader, getComponentTypeDescription, getPojoMetadata, getVersion, loadClass, modifiedService, removedService, setUseFactoryClassloader`

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

`addFactoryStateListener, checkAcceptability, computeDescription, computeFactoryState, createComponentInstance, createComponentInstance, deleted, dispose, disposed, getBundleContext, getComponentDescription, getComponentMetadata, getDescription, getHandler, getInstanceByName, getInstances, getInstancesNames, getIPOJOBundleContext, getLogger, getMissingHandlers, getName, getRequiredHandlers, getState, isAcceptable, match, removeFactoryStateListener, restart, start, stop, updated`

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

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

### Methods inherited from interface org.apache.felix.ipojo.util.TrackerCustomizer

`addedService, addingService, modifiedService, removedService`

### Field Detail

#### m_tracker

    protected Tracker m_tracker

Tracker used to track required handler factories.

### Constructor Detail

#### CompositeFactory

    public CompositeFactory(org.osgi.framework.BundleContext context,
                            org.apache.felix.ipojo.metadata.Element metadata)
                     throws ConfigurationException

Create a composite factory.

Parameters:
  `context` - : bundle context
  `metadata` - : metadata of the component to create
Throws:
  `ConfigurationException` - occurs when the element describing the factory is malformed.

### Method Detail

#### check

    public void check(org.apache.felix.ipojo.metadata.Element metadata)
               throws ConfigurationException

Check if the metadata are well formed.

Overrides:
  `check` in class `ComponentFactory`
Parameters:
  `metadata` - : metadata
Throws:
  `ConfigurationException` - occurs when the element describing the factory is malformed.
See Also:
  `ComponentFactory.check(org.apache.felix.ipojo.metadata.Element)`

#### getClassName

    public java.lang.String getClassName()

Specified by:
  `getClassName` in interface `Factory`
Overrides:
  `getClassName` in class `ComponentFactory`

#### getRequiredHandlerList

    public java.util.List<IPojoFactory.RequiredHandler> getRequiredHandlerList()

Compute required handlers.

Overrides:
  `getRequiredHandlerList` in class `ComponentFactory`
Returns:
  the list of required handler.

#### stopping

    public void stopping()

Stop all the instance managers.

Overrides:
  `stopping` in class `ComponentFactory`

#### starting

    public void starting()

Start all the instance managers.

Overrides:
  `starting` in class `ComponentFactory`

#### createInstance

    public ComponentInstance createInstance(java.util.Dictionary configuration,
                                            IPojoContext context,
                                            HandlerManager[] handlers)
                                     throws ConfigurationException

Create an instance from the current factory.

Overrides:
  `createInstance` in class `ComponentFactory`
Parameters:
  `configuration` - : instance configuration
  `context` - : bundle context to inject in the instance manager
  `handlers` - : array of handler object to attached on the instance
Returns:
  the created instance
Throws:
  `ConfigurationException` - either the instance configuration or the instance starting has failed
See Also:
  `ComponentFactory.createInstance(java.util.Dictionary, org.apache.felix.ipojo.IPojoContext, org.apache.felix.ipojo.HandlerManager[])`

#### reconfigure

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

Reconfigure an existing instance.

Specified by:
  `reconfigure` in interface `Factory`
Overrides:
  `reconfigure` in class `IPojoFactory`
Parameters:
  `properties` - : the new configuration to push.
Throws:
  `UnacceptableConfiguration` - : occurs if the new configuration is not consistent with the component type.
  `MissingHandlerException` - : occurs when an handler is unavailable when creating the instance.
See Also:
  `Factory.reconfigure(java.util.Dictionary)`

#### getFactoryName

    public java.lang.String getFactoryName()

Overrides:
  `getFactoryName` in class `ComponentFactory`