Class DefaultComponentManager

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

public class DefaultComponentManager extends Object implements org.apache.avalon.framework.component.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.

Deprecated: Use DefaultServiceManager instead.

Version:
$Id: DefaultComponentManager.java 30977 2004-07-30 03:57:54 -0500 (Fri, 30 Jul 2004) niclas $
Author:
Avalon Development Team
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final HashMap
     
    private final org.apache.avalon.framework.component.ComponentManager
     
    private boolean
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Construct ComponentManager with no parent.
    DefaultComponentManager(org.apache.avalon.framework.component.ComponentManager parent)
    Construct ComponentManager with specified parent.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected final void
    Check if this component m_manager is writeable.
    protected final Map
    Helper method for subclasses to retrieve component map.
    protected final org.apache.avalon.framework.component.ComponentManager
    Helper method for subclasses to retrieve parent.
    boolean
    Returns true if the component m_manager is managing a component with the specified key, false otherwise.
    org.apache.avalon.framework.component.Component
    Retrieve Component by key from ComponentManager.
    void
    Make this component m_manager read only.
    void
    put(String key, org.apache.avalon.framework.component.Component component)
    Place Component into ComponentManager.
    void
    release(org.apache.avalon.framework.component.Component component)
    Release component.
    Build a human readable representation of ComponentManager.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • m_components

      private final HashMap m_components
    • m_parent

      private final org.apache.avalon.framework.component.ComponentManager m_parent
    • m_readOnly

      private boolean m_readOnly
  • Constructor Details

    • DefaultComponentManager

      public DefaultComponentManager()
      Construct ComponentManager with no parent.
    • DefaultComponentManager

      public DefaultComponentManager(org.apache.avalon.framework.component.ComponentManager parent)
      Construct ComponentManager with specified parent.
      Parameters:
      parent - the ComponentManagers parent
  • Method Details

    • lookup

      public org.apache.avalon.framework.component.Component lookup(String key) throws org.apache.avalon.framework.component.ComponentException
      Retrieve Component by key from ComponentManager.
      Specified by:
      lookup in interface org.apache.avalon.framework.component.ComponentManager
      Parameters:
      key - the key
      Returns:
      the Component
      Throws:
      org.apache.avalon.framework.component.ComponentException - if an error occurs
    • hasComponent

      public boolean hasComponent(String key)
      Returns true if the component m_manager is managing a component with the specified key, false otherwise.
      Specified by:
      hasComponent in interface org.apache.avalon.framework.component.ComponentManager
      Parameters:
      key - key of the component you are lokking for
      Returns:
      true if the component m_manager has a component with that key
    • put

      public void put(String key, org.apache.avalon.framework.component.Component component)
      Place Component into ComponentManager.
      Parameters:
      key - the components key
      component - the component
    • release

      public void release(org.apache.avalon.framework.component.Component component)
      Release component.
      Specified by:
      release in interface org.apache.avalon.framework.component.ComponentManager
      Parameters:
      component - the component
    • toString

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

      protected final org.apache.avalon.framework.component.ComponentManager getParent()
      Helper method for subclasses to retrieve parent.
      Returns:
      the parent ComponentManager
    • getComponentMap

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

      public void makeReadOnly()
      Make this component m_manager read only.
    • checkWriteable

      protected final void checkWriteable() throws IllegalStateException
      Check if this component m_manager is writeable.
      Throws:
      IllegalStateException - if this component m_manager is read-only