Top Description Fields Constructors Methods
org.apache.avalon.framework.component

public Class DefaultComponentManager

extends Object
implements ComponentManager
Class Inheritance
All Implemented Interfaces
org.apache.avalon.framework.component.ComponentManager
Imports
java.util.HashMap, .Iterator, .Map

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 org.apache.avalon.framework.service.DefaultServiceManager instead.

Author
Avalon Development Team
Version
$Id: DefaultComponentManager.java 506231 2007-02-12 02:36:54Z crossley $

Field Summary

Modifier and TypeField and Description
private final HashMap<K, V>
private final ComponentManager
private boolean

Constructor Summary

AccessConstructor and Description
public
DefaultComponentManager()

Construct ComponentManager with no parent.

public
DefaultComponentManager(final ComponentManager
the ComponentManagers parent
parent
)

Construct ComponentManager with specified parent.

Method Summary

Modifier and TypeMethod and Description
protected final void
checkWriteable()

Check if this component m_manager is writeable.

protected final Map<K, V>

Returns:

the component map
getComponentMap
()

Helper method for subclasses to retrieve component map.

protected final ComponentManager

Returns:

the parent ComponentManager
getParent
()

Helper method for subclasses to retrieve parent.

public boolean

Returns:

true if the component m_manager has a component with that key
hasComponent
(final String
key of the component you are lokking for
key
)

Implements org.apache.avalon.framework.component.ComponentManager.hasComponent.

Returns true if the component m_manager is managing a component with the specified key, false otherwise.
public Component

Returns:

the Component
lookup
(final String
the key
key
)

Implements org.apache.avalon.framework.component.ComponentManager.lookup.

Retrieve Component by key from ComponentManager.
public void
makeReadOnly()

Make this component m_manager read only.

public void
put(final String
the components key
key
,
final Component
the component
component
)

Place Component into ComponentManager.

public void
release(final Component
the component
component
)

Implements org.apache.avalon.framework.component.ComponentManager.release.

Release component.
public String

Returns:

the description of ComponentManager
toString
()

Overrides java.lang.Object.toString.

Build a human readable representation of ComponentManager.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

m_componentsback to summary
private final HashMap<K, V> m_components
m_parentback to summary
private final ComponentManager m_parent
m_readOnlyback to summary
private boolean m_readOnly

Constructor Detail

DefaultComponentManagerback to summary
public DefaultComponentManager()

Construct ComponentManager with no parent.

DefaultComponentManagerback to summary
public DefaultComponentManager(final ComponentManager parent)

Construct ComponentManager with specified parent.

Parameters
parent:ComponentManager

the ComponentManagers parent

Method Detail

checkWriteableback to summary
protected final void checkWriteable() throws IllegalStateException

Check if this component m_manager is writeable.

Exceptions
IllegalStateException:
if this component m_manager is read-only
getComponentMapback to summary
protected final Map<K, V> getComponentMap()

Helper method for subclasses to retrieve component map.

Returns:Map<K, V>

the component map

getParentback to summary
protected final ComponentManager getParent()

Helper method for subclasses to retrieve parent.

Returns:ComponentManager

the parent ComponentManager

hasComponentback to summary
public boolean hasComponent(final String key)

Implements org.apache.avalon.framework.component.ComponentManager.hasComponent.

Returns true if the component m_manager is managing a component with the specified key, false otherwise.

Parameters
key:String

key of the component you are lokking for

Returns:boolean

true if the component m_manager has a component with that key

lookupback to summary
public Component lookup(final String key) throws ComponentException

Implements org.apache.avalon.framework.component.ComponentManager.lookup.

Retrieve Component by key from ComponentManager.

Parameters
key:String

the key

Returns:Component

the Component

Exceptions
ComponentException:
if an error occurs
makeReadOnlyback to summary
public void makeReadOnly()

Make this component m_manager read only.

putback to summary
public void put(final String key, final Component component)

Place Component into ComponentManager.

Parameters
key:String

the components key

component:Component

the component

releaseback to summary
public void release(final Component component)

Implements org.apache.avalon.framework.component.ComponentManager.release.

Release component.

Parameters
component:Component

the component

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Build a human readable representation of ComponentManager.

Returns:String

the description of ComponentManager