Class WrapperServiceSelector
java.lang.Object
org.apache.avalon.framework.service.WrapperServiceSelector
- All Implemented Interfaces:
org.apache.avalon.framework.service.ServiceSelector
public class WrapperServiceSelector
extends Object
implements org.apache.avalon.framework.service.ServiceSelector
This is a
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.
- Since:
- 4.1.4
- Version:
- $Id: WrapperServiceSelector.java 30977 2004-07-30 03:57:54 -0500 (Fri, 30 Jul 2004) niclas $
- Author:
- Avalon Development Team
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final String
The role that this selector was aquired via.private final org.apache.avalon.framework.component.ComponentSelector
The Selector we are wrapping. -
Constructor Summary
ConstructorsConstructorDescriptionWrapperServiceSelector
(String key, org.apache.avalon.framework.component.ComponentSelector selector) This constructor is a constructor for a ComponentServiceManager -
Method Summary
Modifier and TypeMethodDescription(package private) org.apache.avalon.framework.component.ComponentSelector
TheWrapperServiceManager
wraps ComponentSelectors in WrapperServiceSelectors when they are looked up.boolean
isSelectable
(Object policy) Check to see if aObject
exists relative to the supplied policy.void
Return theObject
when you are finished with it.Select a service based on a policy.
-
Field Details
-
m_selector
private final org.apache.avalon.framework.component.ComponentSelector m_selectorThe Selector we are wrapping. -
m_key
The role that this selector was aquired via.
-
-
Constructor Details
-
WrapperServiceSelector
public WrapperServiceSelector(String key, org.apache.avalon.framework.component.ComponentSelector selector) This constructor is a constructor for a ComponentServiceManager- Parameters:
key
- the key used to aquire this selectorselector
- the selector to wrap
-
-
Method Details
-
select
Select a service based on a policy.- Specified by:
select
in interfaceorg.apache.avalon.framework.service.ServiceSelector
- Parameters:
policy
- the policy- Returns:
- the service
- Throws:
org.apache.avalon.framework.service.ServiceException
- if unable to select service
-
isSelectable
Check to see if aObject
exists relative to the supplied policy.- Specified by:
isSelectable
in interfaceorg.apache.avalon.framework.service.ServiceSelector
- Parameters:
policy
- aObject
containing the selection criteria- Returns:
- True if the component is available, False if it not.
-
release
Return theObject
when you are finished with it. This allows theServiceSelector
to 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.- Specified by:
release
in interfaceorg.apache.avalon.framework.service.ServiceSelector
- Parameters:
object
- TheObject
we are releasing.
-
getWrappedSelector
org.apache.avalon.framework.component.ComponentSelector getWrappedSelector()TheWrapperServiceManager
wraps ComponentSelectors in WrapperServiceSelectors when they are looked up. This method makes it possible to release the original component selector.- Returns:
- The
ComponentSelector
being wrapped.
-