org.apache.avalon.framework.service
Interface ServiceSelector
- All Known Implementing Classes:
- DefaultServiceSelector
- public interface ServiceSelector
A ServiceSelector
selects Object
s based on a
supplied policy. The contract is that all the Object
s implement the
same role.
- Version:
- 1.0
- Author:
- Berin Loritsch, Stephen McConnell
- See Also:
Serviceable
,
ServiceSelector
Method Summary |
boolean |
isSelectable(java.lang.Object policy)
Check to see if a Object exists relative to the supplied policy. |
void |
release(java.lang.Object object)
Return the Object when you are finished with it. |
java.lang.Object |
select(java.lang.Object policy)
Select the Object associated with the given policy.
|
select
public java.lang.Object select(java.lang.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, I would use the
following call:
try
{
Generator input;
input = (Generator)selector.select( new URL("foo://demo/url") );
}
catch (...)
{
...
}
- Parameters:
policy
- A criteria against which a Object
is selected.- Returns:
- an
Object
value - Throws:
ComponentException
- If the requested Object
cannot be supplied
isSelectable
public boolean isSelectable(java.lang.Object policy)
- Check to see if a
Object
exists relative to the supplied policy.
- Parameters:
policy
- a Object
containing the selection criteria- Returns:
- True if the component is available, False if it not.
release
public void release(java.lang.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
- The Object
we are releasing.
Copyright © 2001 Apache Jakarta Project. All Rights Reserved.