org.apache.felix.ipojo
Class HandlerManagerFactory

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

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.RequiredHandler
 
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
INVALID, VALID
 
Constructor Summary
HandlerManagerFactory(BundleContext context, Element metadata)
          Creates a handler factory.
 
Method Summary
 ComponentInstance createInstance(Dictionary configuration, IPojoContext context, HandlerManager[] handlers)
          Creates an instance.
 ComponentTypeDescription getComponentTypeDescription()
          Gets the component type description of the current factory.
 String getHandlerName()
          Gets the name associated with this handler factory.
 String getNamespace()
          Gets the namespace associated with this handler factory.
 List getRequiredHandlerList()
          Computes required handlers.
 int getStartLevel()
          Gets the start level of the handler objects created by this factory.
 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, getFactoryName, getPojoMetadata, getResource, getVersion, 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, 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, getDescription, getMissingHandlers, getName, getRequiredHandlers, getState, getVersion, isAcceptable, reconfigure, removeFactoryStateListener
 

Constructor Detail

HandlerManagerFactory

public HandlerManagerFactory(BundleContext context,
                             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 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 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 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()

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(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 List 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.


Copyright © 2011 Apache Software Foundation. All Rights Reserved.