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

public Class DefaultServiceSelector

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

This is the default implementation of the ServiceSelector
Author
Avalon Development Team
Version
$Id: DefaultServiceSelector.java 506231 2007-02-12 02:36:54Z crossley $

Field Summary

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

Constructor Summary

AccessConstructor and Description
public
DefaultServiceSelector()

Create a DefaultServiceSelector with a default empty role.

public
DefaultServiceSelector(String
The role for this selector.
role
)

Create a DefaultServiceSelector with a role for debug purposes.

Method Summary

Modifier and TypeMethod and Description
protected final void
checkWriteable()

Checks if this service selector is writeable.

protected final Map<K, V>

Returns:

the object map
getObjectMap
()

Helper method for subclasses to retrieve object map.

public boolean

Returns:

true if the Object exists
isSelectable
(final Object
the hint to retrieve Object
hint
)

Implements org.apache.avalon.framework.service.ServiceSelector.isSelectable.

Returns whether a Object exists or not
public void
makeReadOnly()

Makes this service selector read-only.

public void
put(final Object
the hint to be used to retrieve the Object later
hint
,
final Object
the Object to hold
object
)

Populate the ServiceSelector.

public void
release(final Object
the Object to release
object
)

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

Release object.
public Object

Returns:

the Object
select
(Object
the hint to retrieve Object
hint
)

Implements org.apache.avalon.framework.service.ServiceSelector.select.

Select the desired object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

m_objectsback to summary
private final HashMap<K, V> m_objects
m_readOnlyback to summary
private boolean m_readOnly
m_roleback to summary
private final String m_role

Constructor Detail

DefaultServiceSelectorback to summary
public DefaultServiceSelector()

Create a DefaultServiceSelector with a default empty role.

DefaultServiceSelectorback to summary
public DefaultServiceSelector(String role)

Create a DefaultServiceSelector with a role for debug purposes.

Parameters
role:String

The role for this selector.

Exceptions
NullPointerException:
if the role is null.

Method Detail

checkWriteableback to summary
protected final void checkWriteable() throws IllegalStateException

Checks if this service selector is writeable.

Exceptions
IllegalStateException:
if this service selector 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

isSelectableback to summary
public boolean isSelectable(final Object hint)

Implements org.apache.avalon.framework.service.ServiceSelector.isSelectable.

Returns whether a Object exists or not

Parameters
hint:Object

the hint to retrieve Object

Returns:boolean

true if the Object exists

makeReadOnlyback to summary
public void makeReadOnly()

Makes this service selector read-only.

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

Populate the ServiceSelector.

Parameters
hint:Object

the hint to be used to retrieve the Object later

object:Object

the Object to hold

releaseback to summary
public void release(final Object object)

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

Release object.

Parameters
object:Object

the Object to release

selectback to summary
public Object select(Object hint) throws ServiceException

Implements org.apache.avalon.framework.service.ServiceSelector.select.

Select the desired object.

Parameters
hint:Object

the hint to retrieve Object

Returns:Object

the Object

Exceptions
ServiceException:
if an error occurs