Interface ServiceSelector
-
public interface ServiceSelectorAServiceSelectorselectsObjects based on a supplied policy. The contract is that all theObjects implement the same role.- Version:
- $Id: ServiceSelector.java 30977 2004-07-30 03:57:54 -0500 (Fri, 30 Jul 2004) niclas $
- Author:
- Avalon Development Team
- See Also:
Serviceable,ServiceSelector
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanisSelectable(java.lang.Object policy)Check to see if aObjectexists relative to the supplied policy.voidrelease(java.lang.Object object)Return theObjectwhen you are finished with it.java.lang.Objectselect(java.lang.Object policy)Select theObjectassociated with the given policy.
-
-
-
Method Detail
-
select
java.lang.Object select(java.lang.Object policy) throws ServiceExceptionSelect theObjectassociated with the given policy. For instance, If theServiceSelectorhas aGeneratorstored 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- A criteria against which aObjectis selected.- Returns:
- an
Objectvalue - Throws:
ServiceException- If the requestedObjectcannot be supplied
-
isSelectable
boolean isSelectable(java.lang.Object policy)
Check to see if aObjectexists relative to the supplied policy.- Parameters:
policy- aObjectcontaining the selection criteria- Returns:
- True if the component is available, False if it not.
-
release
void release(java.lang.Object object)
Return theObjectwhen you are finished with it. This allows theServiceSelectorto handle the End-Of-Life Lifecycle events associated with theObject. 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- TheObjectwe are releasing, may also be anullreference
-
-