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 HashMapprivate final org.apache.avalon.framework.service.ServiceManagerprivate boolean -
Constructor Summary
ConstructorsConstructorDescriptionConstructServiceManagerwith no parent.DefaultServiceManager(org.apache.avalon.framework.service.ServiceManager parent) ConstructServiceManagerwith specified parent. -
Method Summary
Modifier and TypeMethodDescriptionprotected final voidChecks if thisServiceManageris writeable.protected final MapHelper method for subclasses to retrieve object map.protected final org.apache.avalon.framework.service.ServiceManagerHelper method for subclasses to retrieve parent.booleanhasService(String key) Check to see if aObjectexists for a key.RetrieveObjectby key fromServiceManager.voidMakes thisServiceManagerread-only.voidPlaceObjectintoServiceManager.voidRelease 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()ConstructServiceManagerwith no parent. -
DefaultServiceManager
public DefaultServiceManager(org.apache.avalon.framework.service.ServiceManager parent) ConstructServiceManagerwith specified parent.- Parameters:
parent- thisServiceManager's parent
-
-
Method Details
-
lookup
RetrieveObjectby key fromServiceManager.- Specified by:
lookupin 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 aObjectexists for a key.- Specified by:
hasServicein 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
-
toString
-
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 thisServiceManagerread-only. -
checkWriteable
Checks if thisServiceManageris writeable.- Throws:
IllegalStateException- if thisServiceManageris read-only
-
release
Release theObject.- Specified by:
releasein interfaceorg.apache.avalon.framework.service.ServiceManager- Parameters:
object- TheObjectto release.
-