org.objectweb.easybeans.component
Class ComponentManager

java.lang.Object
  extended by org.objectweb.easybeans.component.ComponentManager

public class ComponentManager
extends java.lang.Object

Create and destroy components.

Author:
Florent Benoit

Field Summary
private static java.lang.String COMPONENT_STR
          If Component classname ends with "Component", safely remove it.
private  java.util.List<java.lang.String> componentNames
          Components names that are managed.
private  ComponentRegistry componentRegistry
          Link to the registry of components (key=component name/value=EZB component).
private  Components components
          Components objects.
private  JLog logger
          Logger.
 
Constructor Summary
ComponentManager()
          Build a component manager.
ComponentManager(Components components)
          Build a new component manager with the given set of components.
 
Method Summary
 void addComponent(EZBComponent component)
          Add the given component.
private  void addComponent(java.lang.String componentName, EZBComponent component)
          Add a component.
private  java.lang.String getComponentName(EZBComponent component)
          Gets the name for a given component.
 ComponentRegistry getComponentRegistry()
           
 Components getComponents()
          Gets the set of components.
 void initComponents()
          Init the components by calling init() method.
 void removeComponent(EZBComponent component)
          Remove the given component.
 void setComponents(Components components)
          Sets the components object.
 void startComponents()
          Start the components.
 void stopComponents()
          Stop the components.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COMPONENT_STR

private static final java.lang.String COMPONENT_STR
If Component classname ends with "Component", safely remove it.

See Also:
Constant Field Values

logger

private JLog logger
Logger.


componentNames

private java.util.List<java.lang.String> componentNames
Components names that are managed.


components

private Components components
Components objects. (that were set by configuration).


componentRegistry

private ComponentRegistry componentRegistry
Link to the registry of components (key=component name/value=EZB component).

Constructor Detail

ComponentManager

public ComponentManager()
Build a component manager.


ComponentManager

public ComponentManager(Components components)
Build a new component manager with the given set of components.

Parameters:
components - the given set of components
Method Detail

getComponents

public Components getComponents()
Gets the set of components.

Returns:
the set of components.

setComponents

public void setComponents(Components components)
Sets the components object.

Parameters:
components - the set of components.

addComponent

public void addComponent(EZBComponent component)
                  throws EZBComponentException
Add the given component.

Parameters:
component - the component to register.
Throws:
EZBComponentException - if the component is not added.

removeComponent

public void removeComponent(EZBComponent component)
                     throws EZBComponentException
Remove the given component.

Parameters:
component - the component to unregister.
Throws:
EZBComponentException - if the component is not removed.

getComponentName

private java.lang.String getComponentName(EZBComponent component)
Gets the name for a given component.

Parameters:
component - the component instance.
Returns:
the name of the component.

addComponent

private void addComponent(java.lang.String componentName,
                          EZBComponent component)
                   throws EZBComponentException
Add a component.

Parameters:
componentName - the name of the component to add
component - the component to add.
Throws:
EZBComponentException - if adds fails.

initComponents

public void initComponents()
                    throws EZBComponentException
Init the components by calling init() method.

Throws:
EZBComponentException - if initialization fails

startComponents

public void startComponents()
                     throws EZBComponentException
Start the components.

Throws:
EZBComponentException - if starting is failing

stopComponents

public void stopComponents()
Stop the components.


getComponentRegistry

public ComponentRegistry getComponentRegistry()
Returns:
the component registry used by this manager.