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

public Class DefaultServiceManager

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

This class is a static implementation of a ServiceManager. Allow ineritance and extension so you can generate a tree of ServiceManager each defining Object scope.
Author
Avalon Development Team
Version
$Id: DefaultServiceManager.java 506231 2007-02-12 02:36:54Z crossley $

Field Summary

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

Constructor Summary

AccessConstructor and Description
public
DefaultServiceManager()

Construct ServiceManager with no parent.

public
DefaultServiceManager(final ServiceManager
this ServiceManager's parent
parent
)

Construct ServiceManager with specified parent.

Method Summary

Modifier and TypeMethod and Description
protected final void
checkWriteable()

Checks if this ServiceManager is writeable.

protected final Map<K, V>

Returns:

the object map
getObjectMap
()

Helper method for subclasses to retrieve object map.

protected final ServiceManager

Returns:

the parent ServiceManager
getParent
()

Helper method for subclasses to retrieve parent.

public boolean

Returns:

True if the object exists, False if it does not.
hasService
(final String
a string identifying the key to check.
key
)

Implements org.apache.avalon.framework.service.ServiceManager.hasService.

Check to see if a Object exists for a key.
public Object

Returns:

the Object
lookup
(final String
the key
key
)

Implements org.apache.avalon.framework.service.ServiceManager.lookup.

Retrieve Object by key from ServiceManager.
public void
makeReadOnly()

Makes this ServiceManager read-only.

public void
put(final String
the object's key
key
,
final Object
an Object value
object
)

Place Object into ServiceManager.

public void
release(Object
The Object to release.
object
)

Implements org.apache.avalon.framework.service.ServiceManager.release.

Release the Object.
public String

Returns:

the description of this ServiceManager
toString
()

Overrides java.lang.Object.toString.

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

Field Detail

m_objectsback to summary
private final HashMap<K, V> m_objects
m_parentback to summary
private final ServiceManager m_parent
m_readOnlyback to summary
private boolean m_readOnly

Constructor Detail

DefaultServiceManagerback to summary
public DefaultServiceManager()

Construct ServiceManager with no parent.

DefaultServiceManagerback to summary
public DefaultServiceManager(final ServiceManager parent)

Construct ServiceManager with specified parent.

Parameters
parent:ServiceManager

this ServiceManager's parent

Method Detail

checkWriteableback to summary
protected final void checkWriteable() throws IllegalStateException

Checks if this ServiceManager is writeable.

Exceptions
IllegalStateException:
if this ServiceManager is read-only
getObjectMapback to summary
protected final Map<K, V> getObjectMap()

Helper method for subclasses to retrieve object map.

Returns:Map<K, V>

the object map

getParentback to summary
protected final ServiceManager getParent()

Helper method for subclasses to retrieve parent.

Returns:ServiceManager

the parent ServiceManager

hasServiceback to summary
public boolean hasService(final String key)

Implements org.apache.avalon.framework.service.ServiceManager.hasService.

Check to see if a Object exists for a key.

Parameters
key:String

a string identifying the key to check.

Returns:boolean

True if the object exists, False if it does not.

lookupback to summary
public Object lookup(final String key) throws ServiceException

Implements org.apache.avalon.framework.service.ServiceManager.lookup.

Retrieve Object by key from ServiceManager.

Parameters
key:String

the key

Returns:Object

the Object

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

Makes this ServiceManager read-only.

putback to summary
public void put(final String key, final Object object)

Place Object into ServiceManager.

Parameters
key:String

the object's key

object:Object

an Object value

releaseback to summary
public void release(Object object)

Implements org.apache.avalon.framework.service.ServiceManager.release.

Release the Object.

Parameters
object:Object

The Object to release.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Build a human readable representation of this ServiceManager.

Returns:String

the description of this ServiceManager