Class DefaultServiceManager
java.lang.Object
org.apache.avalon.framework.service.DefaultServiceManager
- All Implemented Interfaces:
org.apache.avalon.framework.service.ServiceManager
public class DefaultServiceManager
extends Object
implements org.apache.avalon.framework.service.ServiceManager
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.- Version:
- $Id: DefaultServiceManager.java 30977 2004-07-30 03:57:54 -0500 (Fri, 30 Jul 2004) niclas $
- Author:
- Avalon Development Team
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final HashMap
private final org.apache.avalon.framework.service.ServiceManager
private boolean
-
Constructor Summary
ConstructorsConstructorDescriptionConstructServiceManager
with no parent.DefaultServiceManager
(org.apache.avalon.framework.service.ServiceManager parent) ConstructServiceManager
with specified parent. -
Method Summary
Modifier and TypeMethodDescriptionprotected final void
Checks if thisServiceManager
is writeable.protected final Map
Helper method for subclasses to retrieve object map.protected final org.apache.avalon.framework.service.ServiceManager
Helper method for subclasses to retrieve parent.boolean
hasService
(String key) Check to see if aObject
exists for a key.RetrieveObject
by key fromServiceManager
.void
Makes thisServiceManager
read-only.void
PlaceObject
intoServiceManager
.void
Release theObject
.toString()
Build a human readable representation of thisServiceManager
.
-
Field Details
-
m_objects
-
m_parent
private final org.apache.avalon.framework.service.ServiceManager m_parent -
m_readOnly
private boolean m_readOnly
-
-
Constructor Details
-
DefaultServiceManager
public DefaultServiceManager()ConstructServiceManager
with no parent. -
DefaultServiceManager
public DefaultServiceManager(org.apache.avalon.framework.service.ServiceManager parent) ConstructServiceManager
with specified parent.- Parameters:
parent
- thisServiceManager
's parent
-
-
Method Details
-
lookup
RetrieveObject
by key fromServiceManager
.- Specified by:
lookup
in interfaceorg.apache.avalon.framework.service.ServiceManager
- Parameters:
key
- the key- Returns:
- the
Object
- Throws:
org.apache.avalon.framework.service.ServiceException
- if an error occurs
-
hasService
Check to see if aObject
exists for a key.- Specified by:
hasService
in interfaceorg.apache.avalon.framework.service.ServiceManager
- Parameters:
key
- a string identifying the key to check.- Returns:
- True if the object exists, False if it does not.
-
put
PlaceObject
intoServiceManager
.- Parameters:
key
- the object's keyobject
- anObject
value
-
toString
Build a human readable representation of thisServiceManager
. -
getParent
protected final org.apache.avalon.framework.service.ServiceManager getParent()Helper method for subclasses to retrieve parent.- Returns:
- the parent
ServiceManager
-
getObjectMap
Helper method for subclasses to retrieve object map.- Returns:
- the object map
-
makeReadOnly
public void makeReadOnly()Makes thisServiceManager
read-only. -
checkWriteable
Checks if thisServiceManager
is writeable.- Throws:
IllegalStateException
- if thisServiceManager
is read-only
-
release
Release theObject
.- Specified by:
release
in interfaceorg.apache.avalon.framework.service.ServiceManager
- Parameters:
object
- TheObject
to release.
-