org.apache.felix.ipojo
Class HandlerManager

java.lang.Object
  extended by org.apache.felix.ipojo.InstanceManager
      extended by org.apache.felix.ipojo.HandlerManager
All Implemented Interfaces:
ComponentInstance, InstanceStateListener

public class HandlerManager
extends InstanceManager

The handler manager manages an handler instance.

Author:
Felix Project Team

Field Summary
 
Fields inherited from class org.apache.felix.ipojo.InstanceManager
m_className, m_handlers, m_listeners, m_name, m_state
 
Fields inherited from interface org.apache.felix.ipojo.ComponentInstance
DISPOSED, INVALID, STOPPED, VALID
 
Constructor Summary
HandlerManager(ComponentFactory factory, org.osgi.framework.BundleContext context, HandlerManager[] handlers)
          Constructor.
 
Method Summary
 void dispose()
          Dispose the instance.
 Handler getHandler()
          Get the contained handler object.
 void init(ComponentInstance instance, org.apache.felix.ipojo.metadata.Element metadata, java.util.Dictionary configuration)
          Create and initialize the handler object.
protected  void kill()
          Kill the current instance.
 void start()
          Start the instance manager.
 void stateChanged(ComponentInstance instance, int newState)
          State Change listener callback.
 void stop()
          Stop the instance manager.
 
Methods inherited from class org.apache.felix.ipojo.InstanceManager
addInstanceStateListener, configure, createPojoObject, getClassName, getClazz, getContext, getFactory, getFieldValue, getFieldValue, getGlobalContext, getHandler, getInstanceDescription, getInstanceName, getLocalServiceContext, getPojoObject, getPojoObjects, getRegistredFields, getRegistredHandlers, getRegistredMethods, getState, isStarted, onEntry, onError, onExit, onGet, onSet, reconfigure, register, register, register, removeInstanceStateListener, setState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HandlerManager

public HandlerManager(ComponentFactory factory,
                      org.osgi.framework.BundleContext context,
                      HandlerManager[] handlers)
Constructor.

Parameters:
factory - : handler factory
context - : bundle context
handlers - : handler array
Method Detail

getHandler

public Handler getHandler()
Get the contained handler object. If not already created it creates the object.

Returns:
the handler object.

init

public void init(ComponentInstance instance,
                 org.apache.felix.ipojo.metadata.Element metadata,
                 java.util.Dictionary configuration)
          throws ConfigurationException
Create and initialize the handler object.

Parameters:
instance - : component instance on which the handler will be attached.
metadata - : component metadata.
configuration - : instance configuration.
Throws:
ConfigurationException - if the handler configuration failed.

start

public void start()
Start the instance manager.

Specified by:
start in interface ComponentInstance
Overrides:
start in class InstanceManager

stop

public void stop()
Stop the instance manager.

Specified by:
stop in interface ComponentInstance
Overrides:
stop in class InstanceManager

dispose

public void dispose()
Dispose the instance.

Specified by:
dispose in interface ComponentInstance
Overrides:
dispose in class InstanceManager
See Also:
ComponentInstance.dispose()

kill

protected void kill()
Kill the current instance. Only the factory of this instance can call this method.


stateChanged

public void stateChanged(ComponentInstance instance,
                         int newState)
State Change listener callback. This method is notified at each time a plugged handler becomes invalid.

Specified by:
stateChanged in interface InstanceStateListener
Overrides:
stateChanged in class InstanceManager
Parameters:
instance - : changing instance
newState - : new state
See Also:
InstanceStateListener.stateChanged(org.apache.felix.ipojo.ComponentInstance, int)