org.apache.felix.ipojo.composite
Class FactoryProxy

java.lang.Object
  extended by org.apache.felix.ipojo.composite.FactoryProxy
All Implemented Interfaces:
Factory

public class FactoryProxy
extends Object
implements Factory

Bridge representing a Factory inside a composition.

Author:
Felix Project Team

Field Summary
 
Fields inherited from interface org.apache.felix.ipojo.Factory
INVALID, VALID
 
Constructor Summary
FactoryProxy(Factory fact, ServiceContext svcContext)
          Constructor.
 
Method Summary
 void addFactoryStateListener(FactoryStateListener listener)
          Add a factory listener.
 ComponentInstance createComponentInstance(Dictionary configuration)
          Create an instance manager (i.e.
 ComponentInstance createComponentInstance(Dictionary configuration, ServiceContext serviceContext)
          Create an instance manager (i.e.
 BundleContext getBundleContext()
          Gets the bundle context of the factory.
 String getClassName()
          Returns the class name of the component type.
 ComponentTypeDescription getComponentDescription()
          Gets the component type description.
 Element getDescription()
          Get the component type information containing provided service, configuration properties ...
 List getMissingHandlers()
          Gets the list of missing handlers.
 String getName()
          Return the factory name.
 List getRequiredHandlers()
          Get the list of required handlers.
 int getState()
          Returns the state of the factory.
 String getVersion()
          Gets the version of the component type.
 boolean isAcceptable(Dictionary conf)
          Check if the given configuration is acceptable as a configuration of a component instance.
 void reconfigure(Dictionary conf)
          Reconfigure an instance already created.
 void removeFactoryStateListener(FactoryStateListener listener)
          Remove a service listener.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FactoryProxy

public FactoryProxy(Factory fact,
                    ServiceContext svcContext)
Constructor.

Parameters:
fact - : the targeted factory.
svcContext - : the service context to target.
Method Detail

createComponentInstance

public ComponentInstance createComponentInstance(Dictionary configuration)
                                          throws UnacceptableConfiguration,
                                                 MissingHandlerException,
                                                 ConfigurationException
Create an instance manager (i.e. component type instance).

Specified by:
createComponentInstance in interface Factory
Parameters:
configuration - : the configuration properties for this component.
Returns:
the created instance manager.
Throws:
UnacceptableConfiguration - : when a given configuration is not valid.
MissingHandlerException - : occurs when the creation failed due to a missing handler (the factory should be invalid)
ConfigurationException - : occurs when the creation failed due to a configuration issue
See Also:
Factory.createComponentInstance(java.util.Dictionary)

createComponentInstance

public ComponentInstance createComponentInstance(Dictionary configuration,
                                                 ServiceContext serviceContext)
                                          throws UnacceptableConfiguration,
                                                 MissingHandlerException,
                                                 ConfigurationException
Create an instance manager (i.e. component type instance). This has these service interaction in the scope given in argument.

Specified by:
createComponentInstance in interface Factory
Parameters:
configuration - : the configuration properties for this component.
serviceContext - : the service context of the component.
Returns:
the created instance manager.
Throws:
UnacceptableConfiguration - : when the given configuration is not valid.
MissingHandlerException - : when at least one handler is missing.
ConfigurationException - : when an issue occurs during the oconfiguration of the instance.
See Also:
Factory.createComponentInstance(java.util.Dictionary, org.apache.felix.ipojo.ServiceContext)

getDescription

public Element getDescription()
Get the component type information containing provided service, configuration properties ...

Specified by:
getDescription in interface Factory
Returns:
the component type information.
See Also:
Factory.getDescription()

getName

public String getName()
Return the factory name.

Specified by:
getName in interface Factory
Returns:
the name of the factory.
See Also:
Factory.getName()

isAcceptable

public boolean isAcceptable(Dictionary conf)
Check if the given configuration is acceptable as a configuration of a component instance.

Specified by:
isAcceptable in interface Factory
Parameters:
conf - : the configuration to test
Returns:
true if the configuration is acceptable
See Also:
Factory.isAcceptable(java.util.Dictionary)

reconfigure

public void reconfigure(Dictionary conf)
                 throws UnacceptableConfiguration,
                        MissingHandlerException
Reconfigure an instance already created. This configuration need to have the name property to identify the instance.

Specified by:
reconfigure in interface Factory
Parameters:
conf - : the configuration to reconfigure the instance.
Throws:
UnacceptableConfiguration - : if the given configuration is not consistent for the targeted instance.
MissingHandlerException - : when at least one handler is missing
See Also:
Factory.reconfigure(java.util.Dictionary)

addFactoryStateListener

public void addFactoryStateListener(FactoryStateListener listener)
Add a factory listener.

Specified by:
addFactoryStateListener in interface Factory
Parameters:
listener - : the listener to add.
See Also:
Factory.addFactoryStateListener(org.apache.felix.ipojo.FactoryStateListener)

getMissingHandlers

public List getMissingHandlers()
Description copied from interface: Factory
Gets the list of missing handlers. The handlers are given under the form namespace:name

Specified by:
getMissingHandlers in interface Factory
Returns:
the list containing the name of missing handlers

getRequiredHandlers

public List getRequiredHandlers()
Description copied from interface: Factory
Get the list of required handlers. The handlers are given under the form namespace:name

Specified by:
getRequiredHandlers in interface Factory
Returns:
the list containing the name of required handlers

removeFactoryStateListener

public void removeFactoryStateListener(FactoryStateListener listener)
Remove a service listener.

Specified by:
removeFactoryStateListener in interface Factory
Parameters:
listener - : the listener to remove
See Also:
Factory.removeFactoryStateListener(org.apache.felix.ipojo.FactoryStateListener)

getComponentDescription

public ComponentTypeDescription getComponentDescription()
Description copied from interface: Factory
Gets the component type description.

Specified by:
getComponentDescription in interface Factory
Returns:
the component type description object

getClassName

public String getClassName()
Description copied from interface: Factory
Returns the class name of the component type. For factories which does not contains a class, return "composite"

Specified by:
getClassName in interface Factory
Returns:
the class name of the component type or "composite"

getState

public int getState()
Description copied from interface: Factory
Returns the state of the factory.

Specified by:
getState in interface Factory
Returns:
the state of the factory

getBundleContext

public BundleContext getBundleContext()
Description copied from interface: Factory
Gets the bundle context of the factory.

Specified by:
getBundleContext in interface Factory
Returns:
the bundle context of the factory.

getVersion

public String getVersion()
Description copied from interface: Factory
Gets the version of the component type.

Specified by:
getVersion in interface Factory
Returns:
the component type version or null if not specified.


Copyright © 2011 Apache Software Foundation. All Rights Reserved.