org.apache.avalon.framework.service.ServiceSelectorpublic class WrapperServiceSelector
extends java.lang.Object
implements org.apache.avalon.framework.service.ServiceSelector
ServiceSelector implementation that can wrap around a legacy
ComponentSelector object effectively adapting a ComponentSelector
interface to a ServiceSelector interface.
This class implements the Component interface because it is used in
environments which expect all components to implement Component.
| Modifier and Type | Field | Description |
|---|---|---|
private java.lang.String |
m_key |
The role that this selector was aquired via.
|
private org.apache.avalon.framework.component.ComponentSelector |
m_selector |
The Selector we are wrapping.
|
| Constructor | Description |
|---|---|
WrapperServiceSelector(java.lang.String key,
org.apache.avalon.framework.component.ComponentSelector selector) |
This constructor is a constructor for a ComponentServiceManager
|
| Modifier and Type | Method | Description |
|---|---|---|
(package private) org.apache.avalon.framework.component.ComponentSelector |
getWrappedSelector() |
The
WrapperServiceManager wraps ComponentSelectors in
WrapperServiceSelectors when they are looked up. |
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 a service based on a policy.
|
private final org.apache.avalon.framework.component.ComponentSelector m_selector
private final java.lang.String m_key
public WrapperServiceSelector(java.lang.String key,
org.apache.avalon.framework.component.ComponentSelector selector)
key - the key used to aquire this selectorselector - the selector to wrappublic java.lang.Object select(java.lang.Object policy)
throws org.apache.avalon.framework.service.ServiceException
select in interface org.apache.avalon.framework.service.ServiceSelectorpolicy - the policyorg.apache.avalon.framework.service.ServiceException - if unable to select servicepublic boolean isSelectable(java.lang.Object policy)
Object exists relative to the supplied policy.isSelectable in interface org.apache.avalon.framework.service.ServiceSelectorpolicy - a Object containing the selection criteriapublic void release(java.lang.Object object)
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.release in interface org.apache.avalon.framework.service.ServiceSelectorobject - The Object we are releasing.org.apache.avalon.framework.component.ComponentSelector getWrappedSelector()
WrapperServiceManager wraps ComponentSelectors in
WrapperServiceSelectors when they are looked up. This method
makes it possible to release the original component selector.ComponentSelector being wrapped.