org.apache.felix.ipojo
Class HandlerFactory

java.lang.Object
  extended by org.apache.felix.ipojo.IPojoFactory
      extended by org.apache.felix.ipojo.ComponentFactory
          extended by org.apache.felix.ipojo.HandlerFactory
All Implemented Interfaces:
Factory, TrackerCustomizer, org.osgi.service.cm.ManagedServiceFactory

public class HandlerFactory
extends ComponentFactory
implements Factory

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.RequiredHandler
 
Field Summary
static java.lang.String IPOJO_NAMESPACE
          iPOJO Default Namespace.
 
Fields inherited from class org.apache.felix.ipojo.ComponentFactory
m_tracker
 
Fields inherited from class org.apache.felix.ipojo.IPojoFactory
m_componentDesc, m_componentInstances, m_componentMetadata, m_context, m_factoryName, m_instancesName, m_isPublic, m_listeners, m_logger, m_requiredHandlers, m_sr, m_state
 
Fields inherited from interface org.apache.felix.ipojo.Factory
INVALID, VALID
 
Constructor Summary
HandlerFactory(org.osgi.framework.BundleContext context, org.apache.felix.ipojo.metadata.Element metadata)
          Create a composite factory.
 
Method Summary
 ComponentInstance createInstance(java.util.Dictionary configuration, IPojoContext context, HandlerManager[] handlers)
          Create an instance.
 ComponentTypeDescription getComponentTypeDescription()
           
 java.lang.String getHandlerName()
           
 java.lang.String getNamespace()
           
protected  java.util.Properties getProperties()
          Compute factory service properties.
 int getStartLevel()
           
 java.lang.String getType()
           
 void stopping()
          Stop the factory.
 
Methods inherited from class org.apache.felix.ipojo.ComponentFactory
addedService, addingService, check, defineClass, getClassName, getFactoryName, getPojoMetadata, getRequiredHandlerList, getResource, loadClass, modifiedService, removedService, starting
 
Methods inherited from class org.apache.felix.ipojo.IPojoFactory
addFactoryStateListener, checkAcceptability, computeDescription, computeFactoryState, createComponentInstance, createComponentInstance, deleted, disposed, generateName, getBundleContext, getComponentDescription, getDescription, getHandler, getLogger, getMissingHandlers, getName, getRequiredHandlers, getState, isAcceptable, match, reconfigure, removeFactoryStateListener, 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, getDescription, getMissingHandlers, getName, getRequiredHandlers, getState, isAcceptable, reconfigure, removeFactoryStateListener
 

Field Detail

IPOJO_NAMESPACE

public static final java.lang.String IPOJO_NAMESPACE
iPOJO Default Namespace.

See Also:
Constant Field Values
Constructor Detail

HandlerFactory

public HandlerFactory(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

getNamespace

public java.lang.String getNamespace()

getHandlerName

public java.lang.String getHandlerName()

getType

public java.lang.String getType()

getStartLevel

public int getStartLevel()

getComponentTypeDescription

public ComponentTypeDescription getComponentTypeDescription()
Overrides:
getComponentTypeDescription in class ComponentFactory

stopping

public void stopping()
Stop the factory. This method does not disposed created instances. These instances will be disposed by the instance managers.

Overrides:
stopping in class ComponentFactory

getProperties

protected java.util.Properties getProperties()
Compute factory service properties. This method add three mandatory handler factory properties (name, namespace and type)

Returns:
the properties.
See Also:
org.apache.felix.ipojo.ComponentFactory#getProperties()

createInstance

public ComponentInstance createInstance(java.util.Dictionary configuration,
                                        IPojoContext context,
                                        HandlerManager[] handlers)
                                 throws ConfigurationException
Create an instance. The given configuration needs to contain the 'name' property.

Overrides:
createInstance in class ComponentFactory
Parameters:
configuration - : configuration of the created instance.
context - : the service context to push for this instance.
handlers - : handler array to used.
Returns:
the created component instance. not consistent with the component type of this factory.
Throws:
ConfigurationException - : when the instance configuration failed.
See Also:
Factory.createComponentInstance(java.util.Dictionary)