Expresso 5-6

com.jcorporate.expresso.kernel.management
Class ComponentFactory

java.lang.Object
  extended bycom.jcorporate.expresso.kernel.management.ComponentFactory

public class ComponentFactory
extends Object

This class provides several helper functions to help instantiate a particular component or runtime.

Version:
$Revision: 1.7 $ on $Date: 2004/11/17 20:48:17 $
Author:
Michael Rimov

Field Summary
protected static ComponentFactory instance
          The actual singleton instance
 
Constructor Summary
protected ComponentFactory()
          Default constructor
 
Method Summary
 void configureComponent(ComponentConfig config, ExpressoComponent ec)
          Configures a single component.
 ExpressoComponent constructComponent(ComponentContainer parent, ComponentConfig config)
          Constructs a Component.
 ComponentContainer constructComponentContainer()
          Constructs a blank component container and provides an eventual single point to change to allow people to swap different implementations of their component containers.
 ComponentConfig constructDefaultConfig(ExpressoComponent component)
          This class provides the ability to instantiated a blank component initialized only with the default values provided by the component's metadata.
 RootContainerInterface constructRootContainer()
          Constructs a blank root container that has not been initialized yet, but has metadata fully loaded
static ComponentFactory getInstance()
          Retrieve an instance of the component factory.
 void initComponent(ExpressoComponent ec)
          Initialize the component provided if the component implements the ComponentLifecycle interface
 void startComponent(ExpressoComponent ec)
          Starts a component if it implements the Startable interface.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instance

protected static final ComponentFactory instance
The actual singleton instance

Constructor Detail

ComponentFactory

protected ComponentFactory()
Default constructor

Method Detail

getInstance

public static final ComponentFactory getInstance()
Retrieve an instance of the component factory. This provides the ability to eventually substitute other component factories.

Returns:
an instantiated Component factory

startComponent

public void startComponent(ExpressoComponent ec)
Starts a component if it implements the Startable interface.

Parameters:
ec - the component to 'start'.

constructDefaultConfig

public ComponentConfig constructDefaultConfig(ExpressoComponent component)
                                       throws ConfigurationException
This class provides the ability to instantiated a blank component initialized only with the default values provided by the component's metadata. The component itself must be fully initialized first. (but not necessarily configured).

Parameters:
component - the component to retrieve a blank configuration for.
Returns:
a filled out ComponentConfig instance for this component
Throws:
ConfigurationException - upon error.

constructComponentContainer

public ComponentContainer constructComponentContainer()
Constructs a blank component container and provides an eventual single point to change to allow people to swap different implementations of their component containers.

Returns:
an instantiated ComponentContainer.

constructRootContainer

public RootContainerInterface constructRootContainer()
                                              throws ConfigurationException
Constructs a blank root container that has not been initialized yet, but has metadata fully loaded

Returns:
an instantiated RootContainerInterface
Throws:
ConfigurationException - upon error

constructComponent

public ExpressoComponent constructComponent(ComponentContainer parent,
                                            ComponentConfig config)
                                     throws ConfigurationException
Constructs a Component. This method constructs the object, checks for proper type, calls initialization if provided and loads/sets metadata if provided. This function does not configure a component. [Other than setName() which is part fot he metadata process]

Parameters:
parent - the ComponentContainer that is the parent of this component
config - The component configuration for the object
Returns:
a fully initialized (but not configured) ExpressoComponent
Throws:
ConfigurationException - upon error

initComponent

public void initComponent(ExpressoComponent ec)
Initialize the component provided if the component implements the ComponentLifecycle interface

Parameters:
ec - The ExpressoComponent

configureComponent

public void configureComponent(ComponentConfig config,
                               ExpressoComponent ec)
                        throws ConfigurationException
Configures a single component. (Does NOT configure sub-components)

Parameters:
config - the ComponentConfig for this component
ec - the Component to configure
Throws:
ConfigurationException - upon error.

Expresso 5-6

Please see www.jcorporate.com for information about new Expresso releases.