org.apache.avalon.excalibur.component
Class DefaultComponentManager

java.lang.Object
  |
  +--org.apache.avalon.framework.logger.AbstractLoggable
        |
        +--org.apache.avalon.excalibur.component.DefaultComponentManager
All Implemented Interfaces:
ComponentManager, Configurable, Contextualizable, Disposable, Loggable

public class DefaultComponentManager
extends AbstractLoggable
implements ComponentManager, Configurable, Contextualizable, Disposable

Default component manager for Avalon's components.

Version:
CVS $Revision: 1.4 $ $Date: 2001/05/08 15:32:36 $
Author:
Berin Loritsch, Paul Russell

Constructor Summary
DefaultComponentManager()
          Create the ComponentManager
 
Method Summary
 void addComponent(java.lang.String role, java.lang.Class component, Configuration configuration)
          Add a new component to the manager.
 void addComponentInstance(java.lang.String role, java.lang.Object instance)
          Add a static instance of a component to the manager.
 void configure(Configuration configuration)
          Configure the ComponentManager.
 void contextualize(Context context)
          Set up the Component's Context.
 void dispose()
          Properly dispose of the Child handlers.
 Component lookup(java.lang.String role)
          Return an instance of a component based on a Role.
 void release(Component component)
          Release a Component.
 void setRoleManager(RoleManager roles)
          Configure the RoleManager
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLoggable
getLogger, setLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultComponentManager

public DefaultComponentManager()
Create the ComponentManager
Method Detail

contextualize

public void contextualize(Context context)
Set up the Component's Context.
Specified by:
contextualize in interface Contextualizable

dispose

public void dispose()
Properly dispose of the Child handlers.
Specified by:
dispose in interface Disposable

lookup

public Component lookup(java.lang.String role)
                 throws ComponentException
Return an instance of a component based on a Role. The Role is usually the Interface's Fully Qualified Name(FQN)--unless there are multiple Components for the same Role. In that case, the Role's FQN is appended with "Selector", and we return a ComponentSelector.
Specified by:
lookup in interface ComponentManager
Following copied from interface: org.apache.avalon.framework.component.ComponentManager
Parameters:
name - The role name of the Component to retrieve.
Throws:
ComponentNotFoundException - If the given role is not associated with a Component.
ComponentNotAccessibleException - If a Component instance cannot be created.

configure

public void configure(Configuration configuration)
               throws ConfigurationException
Configure the ComponentManager.
Specified by:
configure in interface Configurable
Following copied from interface: org.apache.avalon.framework.configuration.Configurable
Parameters:
configuration - the class configurations.

setRoleManager

public void setRoleManager(RoleManager roles)
Configure the RoleManager

release

public void release(Component component)
Release a Component. This implementation makes sure it has a handle on the propper ComponentHandler, and let's the ComponentHandler take care of the actual work.
Specified by:
release in interface ComponentManager
Following copied from interface: org.apache.avalon.framework.component.ComponentManager
Parameters:
component - The Component we are releasing.

addComponent

public void addComponent(java.lang.String role,
                         java.lang.Class component,
                         Configuration configuration)
                  throws ComponentException
Add a new component to the manager.
Parameters:
role - the role name for the new component.
component - the class of this component.
Configuration - the configuration for this component.

addComponentInstance

public void addComponentInstance(java.lang.String role,
                                 java.lang.Object instance)
Add a static instance of a component to the manager.
Parameters:
role - the role name for the component.
instance - the instance of the component.


Copyright © 2001 Apache Jakarta Project. All Rights Reserved.