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()
           
 String getClassName()
           
 ComponentTypeDescription getComponentDescription()
           
 Element getDescription()
          Get the component type information containing provided service, configuration properties ...
 List getMissingHandlers()
           
 String getName()
          Return the factory name.
 List getRequiredHandlers()
           
 int getState()
           
 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()
Specified by:
getMissingHandlers in interface Factory

getRequiredHandlers

public List getRequiredHandlers()
Specified by:
getRequiredHandlers in interface Factory

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()
Specified by:
getComponentDescription in interface Factory

getClassName

public String getClassName()
Specified by:
getClassName in interface Factory

getState

public int getState()
Specified by:
getState in interface Factory

getBundleContext

public BundleContext getBundleContext()
Specified by:
getBundleContext in interface Factory


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