org.apache.felix.ipojo.handlers.configuration
Class ConfigurationHandler

java.lang.Object
  extended by org.apache.felix.ipojo.Handler
      extended by org.apache.felix.ipojo.PrimitiveHandler
          extended by org.apache.felix.ipojo.handlers.configuration.ConfigurationHandler
All Implemented Interfaces:
FieldInterceptor, MethodInterceptor, org.osgi.service.cm.ManagedService

public class ConfigurationHandler
extends PrimitiveHandler
implements org.osgi.service.cm.ManagedService

Handler managing the Configuration Admin.

Author:
Felix Project Team

Field Summary
 
Fields inherited from class org.apache.felix.ipojo.PrimitiveHandler
HANDLER_TYPE
 
Fields inherited from class org.apache.felix.ipojo.Handler
HANDLER_LEVEL_PROPERTY, HANDLER_NAME_PROPERTY, HANDLER_NAMESPACE_PROPERTY, HANDLER_TYPE_PROPERTY, m_instance, m_isValid
 
Constructor Summary
ConfigurationHandler()
           
 
Method Summary
protected  void addProperty(Property prop)
          Add the given property metadata to the property metadata list.
 void configure(org.apache.felix.ipojo.metadata.Element metadata, java.util.Dictionary configuration)
          Configure the handler.
protected  boolean containsProperty(java.lang.String name)
          Check if the list contains the property.
 void initializeComponentFactory(ComponentTypeDescription desc, org.apache.felix.ipojo.metadata.Element metadata)
          Initialize the component type.
 void onCreation(java.lang.Object instance)
          Handler createInstance method.
 void reconfigure(java.util.Dictionary configuration)
          Reconfigure the component instance.
 void start()
          Start method.
 void stop()
          Stop method.
 void updated(java.util.Dictionary conf)
          Managed Service method.
 
Methods inherited from class org.apache.felix.ipojo.PrimitiveHandler
attach, getFactory, getHandler, getInstanceManager, getLogger, getMetadata, getPojoMetadata, onEntry, onError, onExit, onFinally, onGet, onSet, setFactory
 
Methods inherited from class org.apache.felix.ipojo.Handler
error, error, getDescription, getHandlerManager, getValidity, info, isValid, setValidity, stateChanged, warn, warn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConfigurationHandler

public ConfigurationHandler()
Method Detail

initializeComponentFactory

public void initializeComponentFactory(ComponentTypeDescription desc,
                                       org.apache.felix.ipojo.metadata.Element metadata)
                                throws ConfigurationException
Initialize the component type.

Overrides:
initializeComponentFactory in class Handler
Parameters:
desc - : component type description to populate.
metadata - : component type metadata.
Throws:
ConfigurationException - : metadata are incorrect.
See Also:
Handler.initializeComponentFactory(org.apache.felix.ipojo.architecture.ComponentTypeDescription, org.apache.felix.ipojo.metadata.Element)

configure

public void configure(org.apache.felix.ipojo.metadata.Element metadata,
                      java.util.Dictionary configuration)
               throws ConfigurationException
Configure the handler.

Specified by:
configure in class Handler
Parameters:
metadata - : the metadata of the component
configuration - : the instance configuration
Throws:
ConfigurationException - : one property metadata is not correct
See Also:
org.apache.felix.ipojo.Handler#configure(org.apache.felix.ipojo.InstanceManager, org.apache.felix.ipojo.metadata.Element)

stop

public void stop()
Stop method. This method is synchronized to avoid the configuration admin pushing a configuration during the un-registration. Do nothing.

Specified by:
stop in class Handler
See Also:
Handler.stop()

start

public void start()
Start method. This method is synchronized to avoid the config admin pushing a configuration before ending the method. Propagate properties if the propagation is activated.

Specified by:
start in class Handler
See Also:
Handler.start()

addProperty

protected void addProperty(Property prop)
Add the given property metadata to the property metadata list.

Parameters:
prop - : property metadata to add

containsProperty

protected boolean containsProperty(java.lang.String name)
Check if the list contains the property.

Parameters:
name - : name of the property
Returns:
true if the property exist in the list

reconfigure

public void reconfigure(java.util.Dictionary configuration)
Reconfigure the component instance. Check if the new configuration modify the current configuration.

Overrides:
reconfigure in class Handler
Parameters:
configuration - : the new configuration
See Also:
Handler.reconfigure(java.util.Dictionary)

onCreation

public void onCreation(java.lang.Object instance)
Handler createInstance method. This method is override to allow delayed callback invocation.

Overrides:
onCreation in class PrimitiveHandler
Parameters:
instance - : the created object
See Also:
org.apache.felix.ipojo.Handler#onCreation(java.lang.Object)

updated

public void updated(java.util.Dictionary conf)
             throws org.osgi.service.cm.ConfigurationException
Managed Service method. This method is called when the instance is reconfigured by the ConfigurationAdmin. When called, it must hold the monitor lock.

Specified by:
updated in interface org.osgi.service.cm.ManagedService
Parameters:
conf - : pushed configuration.
Throws:
org.osgi.service.cm.ConfigurationException - the reconfiguration failed.
See Also:
ManagedService.updated(java.util.Dictionary)