org.apache.felix.ipojo.handlers.providedservice
Class ProvidedServiceHandler

java.lang.Object
  extended by org.apache.felix.ipojo.Handler
      extended by org.apache.felix.ipojo.PrimitiveHandler
          extended by org.apache.felix.ipojo.handlers.providedservice.ProvidedServiceHandler
All Implemented Interfaces:
ConstructorInjector, FieldInterceptor, MethodInterceptor

public class ProvidedServiceHandler
extends PrimitiveHandler

Composite Provided Service Handler. This handler manage the service providing for a composition.

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
ProvidedServiceHandler()
           
 
Method Summary
 void addProperties(Dictionary dict)
          Adds properties to all provided services.
 void configure(Element componentMetadata, Dictionary configuration)
          Configure the handler.
 HandlerDescription getDescription()
          Build the provided service description.
 ProvidedService[] getProvidedServices()
          Get the array of provided service.
 void initializeComponentFactory(ComponentTypeDescription desc, Element metadata)
          Initialize the component type.
 Object onGet(Object pojo, String fieldName, Object value)
          Getter Callback Method.
 void onSet(Object pojo, String fieldName, Object value)
          Setter Callback Method.
 void reconfigure(Dictionary dict)
          Reconfigure provided service.
 void removeProperties(Dictionary dict)
          Remove properties form all provided services.
 void start()
          Start the provided service handler.
 void stateChanged(int state)
          Register the services if the new state is VALID.
 void stop()
          Stop the provided service handler.
 
Methods inherited from class org.apache.felix.ipojo.PrimitiveHandler
attach, getConstructorParameter, getConstructorParameterType, getFactory, getHandler, getInstanceManager, getLogger, getPojoMetadata, onCreation, onEntry, onError, onExit, onFinally, setFactory
 
Methods inherited from class org.apache.felix.ipojo.Handler
debug, error, error, getHandlerManager, getValidity, info, isValid, setValidity, warn, warn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProvidedServiceHandler

public ProvidedServiceHandler()
Method Detail

getProvidedServices

public ProvidedService[] getProvidedServices()
Get the array of provided service.

Returns:
the list of the provided service.

configure

public void configure(Element componentMetadata,
                      Dictionary configuration)
               throws ConfigurationException
Configure the handler.

Specified by:
configure in class Handler
Parameters:
componentMetadata - : the component type metadata
configuration - : the instance configuration
Throws:
ConfigurationException - : the metadata are not correct.
See Also:
org.apache.felix.ipojo.Handler#configure(org.apache.felix.ipojo.InstanceManager, org.apache.felix.ipojo.metadata.Element, java.util.Dictionary)

stop

public void stop()
Stop the provided service handler.

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

start

public void start()
Start the provided service handler.

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

onSet

public void onSet(Object pojo,
                  String fieldName,
                  Object value)
Setter Callback Method. Check if the modified field is a property to update the value.

Specified by:
onSet in interface FieldInterceptor
Overrides:
onSet in class PrimitiveHandler
Parameters:
pojo - : the pojo object on which the field is accessed
fieldName - : field name
value - : new value
See Also:
org.apache.felix.ipojo.Handler#onSet(Object, java.lang.String, java.lang.Object)

onGet

public Object onGet(Object pojo,
                    String fieldName,
                    Object value)
Getter Callback Method. Check if the field is a property to push the stored value.

Specified by:
onGet in interface FieldInterceptor
Overrides:
onGet in class PrimitiveHandler
Parameters:
pojo - : the pojo object on which the field is accessed
fieldName - : field name
value - : value pushed by the previous handler
Returns:
the stored value or the previous value.
See Also:
org.apache.felix.ipojo.Handler#onGet(Object, java.lang.String, java.lang.Object)

stateChanged

public void stateChanged(int state)
Register the services if the new state is VALID. Unregister the services if the new state is UNRESOLVED.

Overrides:
stateChanged in class Handler
Parameters:
state - : the new instance state.
See Also:
Handler.stateChanged(int)

addProperties

public void addProperties(Dictionary dict)
Adds properties to all provided services.

Parameters:
dict - : dictionary of properties to add

removeProperties

public void removeProperties(Dictionary dict)
Remove properties form all provided services.

Parameters:
dict - : dictionary of properties to delete.

getDescription

public HandlerDescription getDescription()
Build the provided service description.

Overrides:
getDescription in class Handler
Returns:
the handler description.
See Also:
Handler.getDescription()

reconfigure

public void reconfigure(Dictionary dict)
Reconfigure provided service.

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

initializeComponentFactory

public void initializeComponentFactory(ComponentTypeDescription desc,
                                       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 - : occurs when the POJO does not implement any interfaces.
See Also:
Handler.initializeComponentFactory(org.apache.felix.ipojo.architecture.ComponentTypeDescription, org.apache.felix.ipojo.metadata.Element)


Copyright © 2011 Apache Software Foundation. All Rights Reserved.