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.Deprecated: Use
DefaultServiceManager
instead.- Version:
- CVS $Revision: 1.24 $ $Date: 2003/02/11 15:58:38 $
- Author:
- Avalon Development Team
-
-
Constructor Summary
Constructors Constructor Description DefaultComponentManager()
Construct ComponentManager with no parent.DefaultComponentManager(ComponentManager parent)
Construct ComponentManager with specified parent.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
checkWriteable()
Check if this component m_manager is writeable.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 key)
Returnstrue
if the component m_manager is managing a component with the specified key,false
otherwise.Component
lookup(java.lang.String key)
Retrieve Component by key from ComponentManager.void
makeReadOnly()
Make this component m_manager read only.void
put(java.lang.String key, Component component)
Place Component into ComponentManager.void
release(Component component)
Release component.java.lang.String
toString()
Build a human readable representation of ComponentManager.
-
-
-
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 key) throws ComponentException
Retrieve Component by key from ComponentManager.- Specified by:
lookup
in interfaceComponentManager
- Parameters:
key
- the key- Returns:
- the Component
- Throws:
ComponentException
- if an error occurs
-
hasComponent
public boolean hasComponent(java.lang.String key)
Returnstrue
if the component m_manager is managing a component with the specified key,false
otherwise.- Specified by:
hasComponent
in interfaceComponentManager
- 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(java.lang.String key, Component component)
Place Component into ComponentManager.- Parameters:
key
- the components keycomponent
- the component
-
release
public void release(Component component)
Release component.- Specified by:
release
in interfaceComponentManager
- Parameters:
component
- the component
-
toString
public java.lang.String toString()
Build a human readable representation of ComponentManager.- Overrides:
toString
in classjava.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()
Make this component m_manager read only.
-
checkWriteable
protected final void checkWriteable() throws java.lang.IllegalStateException
Check if this component m_manager is writeable.- Throws:
java.lang.IllegalStateException
- if this component m_manager is read-only
-
-