org.apache.felix.ipojo

## Class HandlerManagerFactory

- java.lang.Object
- - org.apache.felix.ipojo.IPojoFactory
  - - org.apache.felix.ipojo.ComponentFactory
    - - org.apache.felix.ipojo.HandlerManagerFactory

All Implemented Interfaces:
  Factory, HandlerFactory, TrackerCustomizer

    public class HandlerManagerFactory
    extends ComponentFactory
    implements HandlerFactory

Implementation of the handler factory interface. This factory is able to create handler manager. A handler manager is an iPOJO instance containing a handler object.

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 inherited from class org.apache.felix.ipojo.ComponentFactory

`HANDLER_AUTO_PRIMITIVE, m_tracker`

### 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.HandlerFactory

`IPOJO_NAMESPACE`

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

`FACTORY_VERSION_PROPERTY, INSTANCE_NAME_PROPERTY, INVALID, VALID`

### Constructor Summary

Constructors
Constructor and Description
`HandlerManagerFactory(org.osgi.framework.BundleContext context, org.apache.felix.ipojo.metadata.Element metadata)` Creates a handler factory.

### Method Summary

All Methods Instance Methods Concrete Methods
`ComponentInstance` `createInstance(java.util.Dictionary configuration, IPojoContext context, HandlerManager[] handlers)` Creates an instance.
`ComponentTypeDescription` `getComponentTypeDescription()` Gets the component type description of the current factory.
`java.lang.String` `getFactoryName()` Computes the factory name.
`java.lang.String` `getHandlerName()` Gets the name associated with this handler factory.
`java.lang.String` `getNamespace()` Gets the namespace associated with this handler factory.
`java.util.List<IPojoFactory.RequiredHandler>` `getRequiredHandlerList()` Computes required handlers.
`int` `getStartLevel()` Gets the start level of the handler objects created by this factory.
`java.lang.String` `getType()` Gets the type of the handler factory.
`void` `stopping()` Stops the factory.

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

`addedService, addingService, check, defineClass, getBundleClassLoader, getClassName, getPojoMetadata, getVersion, loadClass, modifiedService, removedService, setUseFactoryClassloader, starting`

### 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, reconfigure, 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.Factory

`addFactoryStateListener, createComponentInstance, createComponentInstance, getBundleContext, getClassName, getComponentDescription, getComponentMetadata, getDescription, getInstances, getInstancesNames, getMissingHandlers, getName, getRequiredHandlers, getState, getVersion, isAcceptable, reconfigure, removeFactoryStateListener`

### Constructor Detail

#### HandlerManagerFactory

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

Creates a handler factory.

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

### Method Detail

#### getNamespace

    public java.lang.String getNamespace()

Description copied from interface: `HandlerFactory`
Gets the namespace associated with this handler factory.

Specified by:
  `getNamespace` in interface `HandlerFactory`
Returns:
  the namespace used by this handler

#### getHandlerName

    public java.lang.String getHandlerName()

Description copied from interface: `HandlerFactory`
Gets the name associated with this handler factory.

Specified by:
  `getHandlerName` in interface `HandlerFactory`
Returns:
  the name used by this handler

#### getType

    public java.lang.String getType()

Description copied from interface: `HandlerFactory`
Gets the type of the handler factory. The handler can only be plugged on instance container with the same type. Basically, types are `primitive` and `composite`.

Specified by:
  `getType` in interface `HandlerFactory`
Returns:
  the type of the handler

#### getStartLevel

    public int getStartLevel()

Description copied from interface: `HandlerFactory`
Gets the start level of the handler objects created by this factory. Handlers with a low start level are configured and started before handlers with an higher start level. Moreover, these handlers are stopped and disposed after.

Specified by:
  `getStartLevel` in interface `HandlerFactory`
Returns:
  the handler's start level

#### getComponentTypeDescription

    public ComponentTypeDescription getComponentTypeDescription()

Description copied from class: `ComponentFactory`
Gets the component type description of the current factory.

Overrides:
  `getComponentTypeDescription` in class `ComponentFactory`
Returns:
  the description of the component type attached to this factory.
See Also:
  `IPojoFactory.getComponentTypeDescription()`

#### getFactoryName

    public java.lang.String getFactoryName()

Description copied from class: `ComponentFactory`
Computes the factory name. The factory name is computed from the 'name' and 'classname' attributes. This method does not manipulate any non-immutable fields, so does not need to be synchronized.

Overrides:
  `getFactoryName` in class `ComponentFactory`
Returns:
  the factory name.

#### stopping

    public void stopping()

Stops the factory. This method does not disposed created instances. These instances will be disposed by the instance managers. This method is called with the lock.

Overrides:
  `stopping` in class `ComponentFactory`

#### createInstance

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

Creates an instance. The given configuration needs to contain the 'name' property. This method is called when holding the lock.

Overrides:
  `createInstance` in class `ComponentFactory`
Parameters:
  `configuration` - the configuration of the created instance.
  `context` - the service context to push for this instance.
  `handlers` - the handler array to attach to the instance.
Returns:
  the created `HandlerManager`.
Throws:
  `ConfigurationException` - if the instance configuration failed.
See Also:
  `Factory.createComponentInstance(java.util.Dictionary)`

#### getRequiredHandlerList

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

Computes required handlers. This method does not manipulate any non-immutable fields, so does not need to be synchronized. This method is overridden to avoid using the same detection rules than 'primitive' components. Indeed, architecture is disable by default, and a handler is never immediate.

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