org.apache.avalon.framework.component
Class DefaultComponentManager

java.lang.Object
  |
  +--org.apache.avalon.framework.component.DefaultComponentManager
All Implemented Interfaces:
ComponentManager

public class DefaultComponentManager
extends java.lang.Object
implements ComponentManager

This class is a static implementation of a ComponentManager. Allow ineritance and extension so you can generate a tree of ComponentManager each defining Component scope.

Author:
Federico Barbieri, Peter Donald

Constructor Summary
DefaultComponentManager()
          Construct ComponentManager with no parent.
DefaultComponentManager(ComponentManager parent)
          Construct ComponentManager with specified parent.
 
Method Summary
protected  void checkWriteable()
           
protected  java.util.Map getComponentMap()
          Helper method for subclasses to retrieve component map.
protected  ComponentManager getParent()
          Helper method for subclasses to retrieve parent.
 boolean hasComponent(java.lang.String role)
          Check to see if a Component exists for a role.
 Component lookup(java.lang.String role)
          Retrieve Component by role from ComponentManager.
 void makeReadOnly()
           
 void put(java.lang.String role, Component component)
          Place Component into ComponentManager.
 void release(Component component)
          Release component.
 java.lang.String toString()
          Build a human readable representation of ComponentManager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultComponentManager

public DefaultComponentManager()
Construct ComponentManager with no parent.

DefaultComponentManager

public DefaultComponentManager(ComponentManager parent)
Construct ComponentManager with specified parent.
Parameters:
parent - the ComponentManagers parent
Method Detail

lookup

public Component lookup(java.lang.String role)
                 throws ComponentException
Retrieve Component by role from ComponentManager.
Specified by:
lookup in interface ComponentManager
Parameters:
role - the role
Returns:
the Component
Throws:
ComponentException - if an error occurs

hasComponent

public boolean hasComponent(java.lang.String role)
Description copied from interface: ComponentManager
Check to see if a Component exists for a role.
Specified by:
hasComponent in interface ComponentManager
Following copied from interface: org.apache.avalon.framework.component.ComponentManager
Parameters:
role - a string identifying the role to check.
Returns:
True if the component exists, False if it does not.

put

public void put(java.lang.String role,
                Component component)
Place Component into ComponentManager.
Parameters:
role - the components role
component - the component

release

public void release(Component component)
Release component.
Specified by:
release in interface ComponentManager
Parameters:
component - the component

toString

public java.lang.String toString()
Build a human readable representation of ComponentManager.
Overrides:
toString in class java.lang.Object
Returns:
the description of ComponentManager

getParent

protected final ComponentManager getParent()
Helper method for subclasses to retrieve parent.
Returns:
the parent ComponentManager

getComponentMap

protected final java.util.Map getComponentMap()
Helper method for subclasses to retrieve component map.
Returns:
the component map

makeReadOnly

public void makeReadOnly()

checkWriteable

protected final void checkWriteable()
                             throws java.lang.IllegalStateException


"Copyright © 2001 Apache Jakarta Project. All Rights Reserved."