org.apache.felix.ipojo.composite
Class FactoryProxy

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

public class FactoryProxy
extends java.lang.Object
implements org.apache.felix.ipojo.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(org.apache.felix.ipojo.Factory fact, org.apache.felix.ipojo.ServiceContext svcContext)
          Constructor.
 
Method Summary
 void addFactoryStateListener(org.apache.felix.ipojo.FactoryStateListener listener)
          Add a factory listener.
 org.apache.felix.ipojo.ComponentInstance createComponentInstance(java.util.Dictionary configuration)
          Create an instance manager (i.e.
 org.apache.felix.ipojo.ComponentInstance createComponentInstance(java.util.Dictionary configuration, org.apache.felix.ipojo.ServiceContext serviceContext)
          Create an instance manager (i.e.
 org.osgi.framework.BundleContext getBundleContext()
           
 java.lang.String getClassName()
           
 org.apache.felix.ipojo.architecture.ComponentTypeDescription getComponentDescription()
           
 org.apache.felix.ipojo.metadata.Element getDescription()
          Get the component type information containing provided service, configuration properties ...
 java.util.List getMissingHandlers()
           
 java.lang.String getName()
          Return the factory name.
 java.util.List getRequiredHandlers()
           
 int getState()
           
 boolean isAcceptable(java.util.Dictionary conf)
          Check if the given configuration is acceptable as a configuration of a component instance.
 void reconfigure(java.util.Dictionary conf)
          Reconfigure an instance already created.
 void removeFactoryStateListener(org.apache.felix.ipojo.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(org.apache.felix.ipojo.Factory fact,
                    org.apache.felix.ipojo.ServiceContext svcContext)
Constructor.

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

createComponentInstance

public org.apache.felix.ipojo.ComponentInstance createComponentInstance(java.util.Dictionary configuration)
                                                                 throws org.apache.felix.ipojo.UnacceptableConfiguration,
                                                                        org.apache.felix.ipojo.MissingHandlerException,
                                                                        org.apache.felix.ipojo.ConfigurationException
Create an instance manager (i.e. component type instance).

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

createComponentInstance

public org.apache.felix.ipojo.ComponentInstance createComponentInstance(java.util.Dictionary configuration,
                                                                        org.apache.felix.ipojo.ServiceContext serviceContext)
                                                                 throws org.apache.felix.ipojo.UnacceptableConfiguration,
                                                                        org.apache.felix.ipojo.MissingHandlerException,
                                                                        org.apache.felix.ipojo.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 org.apache.felix.ipojo.Factory
Parameters:
configuration - : the configuration properties for this component.
serviceContext - : the service context of the component.
Returns:
the created instance manager.
Throws:
org.apache.felix.ipojo.UnacceptableConfiguration - : when the given configuration is not valid.
org.apache.felix.ipojo.MissingHandlerException - : when at least one handler is missing.
org.apache.felix.ipojo.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 org.apache.felix.ipojo.metadata.Element getDescription()
Get the component type information containing provided service, configuration properties ...

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

getName

public java.lang.String getName()
Return the factory name.

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

isAcceptable

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

Specified by:
isAcceptable in interface org.apache.felix.ipojo.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(java.util.Dictionary conf)
                 throws org.apache.felix.ipojo.UnacceptableConfiguration,
                        org.apache.felix.ipojo.MissingHandlerException
Reconfigure an instance already created. This configuration need to have the name property to identify the instance.

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

addFactoryStateListener

public void addFactoryStateListener(org.apache.felix.ipojo.FactoryStateListener listener)
Add a factory listener.

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

getMissingHandlers

public java.util.List getMissingHandlers()
Specified by:
getMissingHandlers in interface org.apache.felix.ipojo.Factory

getRequiredHandlers

public java.util.List getRequiredHandlers()
Specified by:
getRequiredHandlers in interface org.apache.felix.ipojo.Factory

removeFactoryStateListener

public void removeFactoryStateListener(org.apache.felix.ipojo.FactoryStateListener listener)
Remove a service listener.

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

getComponentDescription

public org.apache.felix.ipojo.architecture.ComponentTypeDescription getComponentDescription()
Specified by:
getComponentDescription in interface org.apache.felix.ipojo.Factory

getClassName

public java.lang.String getClassName()
Specified by:
getClassName in interface org.apache.felix.ipojo.Factory

getState

public int getState()
Specified by:
getState in interface org.apache.felix.ipojo.Factory

getBundleContext

public org.osgi.framework.BundleContext getBundleContext()
Specified by:
getBundleContext in interface org.apache.felix.ipojo.Factory