public class WrapperComponentSelector
extends java.lang.Object
ServiceSelector
implementation that can wrap around a legacy
ComponentSelector
object effectively adapting a ComponentSelector
interface to a ServiceSelector
interface.Modifier and Type | Field and Description |
---|---|
private java.lang.String |
m_key
The role that this selector was aquired via.
|
private ServiceSelector |
m_selector
The Selector we are wrapping.
|
Constructor and Description |
---|
WrapperComponentSelector(java.lang.String key,
ServiceSelector selector)
This constructor is a constructor for a WrapperComponentSelector.
|
Modifier and Type | Method and Description |
---|---|
(package private) ServiceSelector |
getWrappedSelector()
The
WrapperComponentManager wraps ServiceSelectors in
WrapperServiceSelectors when they are looked up. |
boolean |
hasComponent(java.lang.Object policy)
Check to see if a
Component exists relative to the supplied policy. |
void |
release(Component object)
Return the
Object when you are finished with it. |
Component |
select(java.lang.Object policy)
Select a Component based on a policy.
|
private final ServiceSelector m_selector
private final java.lang.String m_key
public WrapperComponentSelector(java.lang.String key, ServiceSelector selector)
key
- the key used to aquire this selectorselector
- the selector to wrappublic Component select(java.lang.Object policy) throws ComponentException
policy
- the policyComponentException
- if unable to select servicepublic boolean hasComponent(java.lang.Object policy)
Component
exists relative to the supplied policy.policy
- a Object
containing the selection criteriapublic void release(Component 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.object
- The Object
we are releasing.ServiceSelector getWrappedSelector()
WrapperComponentManager
wraps ServiceSelectors in
WrapperServiceSelectors when they are looked up. This method
makes it possible to release the original component selector.ServiceSelector
being wrapped.