org.apache.felix.ipojo
Interface Factory

All Known Subinterfaces:
HandlerFactory
All Known Implementing Classes:
ComponentFactory, HandlerManagerFactory, IPojoFactory

public interface Factory

Component Type Factory Service. This service is exposed by a instance manager factory, and allows the dynamic creation of component instance.

Author:
Felix Project Team

Field Summary
static int INVALID
          Factory State.
static int VALID
          Factory State.
 
Method Summary
 void addFactoryStateListener(FactoryStateListener listener)
          Adds a factory state listener on the current factory.
 ComponentInstance createComponentInstance(Dictionary configuration)
          Creates an instance manager (i.e.
 ComponentInstance createComponentInstance(Dictionary configuration, ServiceContext serviceContext)
          Creates an instance manager (i.e.
 BundleContext getBundleContext()
          Gets the bundle context of the factory.
 String getClassName()
          Deprecated.  
 ComponentTypeDescription getComponentDescription()
          Gets the component type description.
 Element getDescription()
          Gets the component type information containing provided service, configuration properties ...
 List getMissingHandlers()
          Gets the list of missing handlers.
 String getName()
          Returns the factory name.
 List getRequiredHandlers()
          Get the list of required handlers.
 int getState()
          Returns the state of the factory.
 boolean isAcceptable(Dictionary conf)
          Checks if the given configuration is acceptable as a configuration of a component instance.
 void reconfigure(Dictionary conf)
          Reconfigures an instance already created.
 void removeFactoryStateListener(FactoryStateListener listener)
          Removes the given factory state listener from the listener list.
 

Field Detail

VALID

static final int VALID
Factory State. A valid factory is a factory where all required handlers are available.

See Also:
Constant Field Values

INVALID

static final int INVALID
Factory State. An invalid factory is a factory where at least one required handler is unavailable. Creating an instance with an invalid factory failed.

See Also:
Constant Field Values
Method Detail

createComponentInstance

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

Parameters:
configuration - the configuration properties for this component.
Returns:
the created instance manager.
Throws:
UnacceptableConfiguration - if the given configuration is not valid.
MissingHandlerException - if an handler is missing.
ConfigurationException - if the instance configuration failed.

createComponentInstance

ComponentInstance createComponentInstance(Dictionary configuration,
                                          ServiceContext serviceContext)
                                          throws UnacceptableConfiguration,
                                                 MissingHandlerException,
                                                 ConfigurationException
Creates an instance manager (i.e. component type instance). The instance is created in the scope given in argument.

Parameters:
configuration - the configuration properties for this component.
serviceContext - the service context of the component.
Returns:
the created instance manager.
Throws:
UnacceptableConfiguration - if the given configuration is not valid.
MissingHandlerException - if an handler is missing.
ConfigurationException - if the instance configuration failed.

getDescription

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

Returns:
the component type information.

getComponentDescription

ComponentTypeDescription getComponentDescription()
Gets the component type description.

Returns:
the component type description object

isAcceptable

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

Parameters:
conf - the configuration to test
Returns:
true if the configuration is acceptable

getName

String getName()
Returns the factory name.

Returns:
the name of the factory.

reconfigure

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

Parameters:
conf - the configuration to reconfigure the instance.
Throws:
UnacceptableConfiguration - if the given configuration is not consistent for the targeted instance.
MissingHandlerException - if an handler is missing.

addFactoryStateListener

void addFactoryStateListener(FactoryStateListener listener)
Adds a factory state listener on the current factory.

Parameters:
listener - the listener to add

removeFactoryStateListener

void removeFactoryStateListener(FactoryStateListener listener)
Removes the given factory state listener from the listener list.

Parameters:
listener - the listener to remove

getMissingHandlers

List getMissingHandlers()
Gets the list of missing handlers. The handlers are given under the form namespace:name

Returns:
the list containing the name of missing handlers

getRequiredHandlers

List getRequiredHandlers()
Get the list of required handlers. The handlers are given under the form namespace:name

Returns:
the list containing the name of required handlers

getClassName

String getClassName()
Deprecated. 

Returns the class name of the component type. For factories which does not contains a class, return "composite"

Returns:
the class name of the component type or "composite"

getState

int getState()
Returns the state of the factory.

Returns:
the state of the factory

getBundleContext

BundleContext getBundleContext()
Gets the bundle context of the factory.

Returns:
the bundle context of the factory.


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