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

public Interface ServiceSelector


A ServiceSelector selects Objects based on a supplied policy. The contract is that all the Objects implement the same role.
Author
Avalon Development Team
Version
$Id: ServiceSelector.java 506231 2007-02-12 02:36:54Z crossley $
See Also
org.apache.avalon.framework.service.Serviceable, org.apache.avalon.framework.service.ServiceSelector

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

True if the component is available, False if it not.
isSelectable
(Object
a Object containing the selection criteria
policy
)

Check to see if a Object exists relative to the supplied policy.

public void
release(Object
The Object we are releasing, may also be a null reference
object
)

Return the Object when you are finished with it.

public Object

Returns:

an Object value
select
(Object
A criteria against which a Object is selected.
policy
)

Select the Object associated with the given policy.

Method Detail

isSelectableback to summary
public boolean isSelectable(Object policy)

Check to see if a Object exists relative to the supplied policy.

Parameters
policy:Object

a Object containing the selection criteria

Returns:boolean

True if the component is available, False if it not.

releaseback to summary
public void release(Object object)

Return the Object when you are finished with it. This allows the ServiceSelector to handle the End-Of-Life Lifecycle events associated with the Object. Please note, that no Exception should be thrown at this point. This is to allow easy use of the ServiceSelector system without having to trap Exceptions on a release.

Parameters
object:Object

The Object we are releasing, may also be a null reference

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

Select the Object associated with the given policy. For instance, If the ServiceSelector has a Generator stored and referenced by a URL, the following call could be used:

try
{
    Generator input;
    input = (Generator)selector.select( new URL("foo://demo/url") );
}
catch (...)
{
    ...
}
Parameters
policy:Object

A criteria against which a Object is selected.

Returns:Object

an Object value

Exceptions
ServiceException:
If the requested Object cannot be supplied