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, BundleContext context, HandlerManager[] handlers)
          Creates a handler manager.
 
Method Summary
 void dispose()
          Disposes the instance.
 Handler getHandler()
          Gets the contained handler object.
 void init(ComponentInstance instance, Element metadata, Dictionary configuration)
          Creates and initializes the handler object.
protected  void kill()
          Kills the current instance.
 void start()
          Starts the instance manager.
 void stateChanged(ComponentInstance instance, int newState)
          State Change listener callback.
 void stop()
          Stops the instance manager.
 
Methods inherited from class org.apache.felix.ipojo.InstanceManager
addInstanceStateListener, configure, createPojoObject, deletePojoObject, 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,
                      BundleContext context,
                      HandlerManager[] handlers)
Creates a handler manager.

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

getHandler

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

Returns:
the handler object.

init

public void init(ComponentInstance instance,
                 Element metadata,
                 Dictionary configuration)
          throws ConfigurationException
Creates and initializes the handler object.

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

start

public void start()
Starts the instance manager.

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

stop

public void stop()
Stops the instance manager.

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

dispose

public void dispose()
Disposes the instance.

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

kill

protected void kill()
Kills 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 - the changing instance
newState - the new state
See Also:
InstanceStateListener.stateChanged(org.apache.felix.ipojo.ComponentInstance, int)


Copyright © 2006-2011 Apache Software Foundation. All Rights Reserved.