org.apache.stratum.component
Class ComponentLoader

java.lang.Object
  extended byorg.apache.stratum.component.ComponentLoader

public class ComponentLoader
extends java.lang.Object

Loader for Components implementing the lifecyle Interfaces. NOTE: This class is in its infancy and will more than likely change.

Version:
$Id: ComponentLoader.java 264191 2005-08-29 18:07:52Z henning $
Author:
Eric Dobbs , Martin Poeschl

Constructor Summary
ComponentLoader(org.apache.commons.configuration.Configuration configuration)
          Constructor
 
Method Summary
 org.apache.commons.configuration.Configuration getConfiguration()
          Support method for testing the constructor
 java.lang.Object[] load()
           Load all the components listed in the ComponentLoader's configuration.
 java.lang.Object loadComponent(java.lang.String className, java.lang.String configFile, org.apache.commons.configuration.Configuration additionalConfig)
          load the given component, configure it with the given config file, and initialize it.
 void setConfiguration(org.apache.commons.configuration.Configuration configuration)
          Set the configuration for this ComponentLoader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComponentLoader

public ComponentLoader(org.apache.commons.configuration.Configuration configuration)
Constructor

Parameters:
configuration -
Method Detail

setConfiguration

public void setConfiguration(org.apache.commons.configuration.Configuration configuration)
Set the configuration for this ComponentLoader

Parameters:
configuration - Configuration

getConfiguration

public org.apache.commons.configuration.Configuration getConfiguration()
Support method for testing the constructor

Returns:
the configuration

load

public java.lang.Object[] load()

Load all the components listed in the ComponentLoader's configuration. Log any errors, but throw no exceptions if components cannot be loaded.

Configuration notes:
Components are identified in the properties file as follows:
component.name=NAME component.NAME.classname = com.mycompany.components.SomeComponent component.NAME.config = path/to/SomeComponent.properties

Returns:
an array of loaded components

loadComponent

public java.lang.Object loadComponent(java.lang.String className,
                                      java.lang.String configFile,
                                      org.apache.commons.configuration.Configuration additionalConfig)
load the given component, configure it with the given config file, and initialize it.
The component must implement the Initializable and Configurable interfaces.

Parameters:
className - the String class name of the component to load
configFile - the String path name of the component's config file
additionalConfig - TODO: DOCUMENT ME!
Returns:
the loaded component or null if it failed to load
See Also:
Initializable, Configurable


Copyright © 2002-2005 Apache Software Foundation. All Rights Reserved.