Class WrapperServiceSelector
- java.lang.Object
-
- org.apache.avalon.framework.service.WrapperServiceSelector
-
- All Implemented Interfaces:
org.apache.avalon.framework.service.ServiceSelector
public class WrapperServiceSelector extends java.lang.Object implements org.apache.avalon.framework.service.ServiceSelectorThis is aServiceSelectorimplementation that can wrap around a legacyComponentSelectorobject effectively adapting aComponentSelectorinterface to aServiceSelectorinterface.This class implements the
Componentinterface 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
Fields Modifier and Type Field Description private java.lang.Stringm_keyThe role that this selector was aquired via.private org.apache.avalon.framework.component.ComponentSelectorm_selectorThe Selector we are wrapping.
-
Constructor Summary
Constructors Constructor Description WrapperServiceSelector(java.lang.String key, org.apache.avalon.framework.component.ComponentSelector selector)This constructor is a constructor for a ComponentServiceManager
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) org.apache.avalon.framework.component.ComponentSelectorgetWrappedSelector()TheWrapperServiceManagerwraps ComponentSelectors in WrapperServiceSelectors when they are looked up.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 a service based on a policy.
-
-
-
Constructor Detail
-
WrapperServiceSelector
public WrapperServiceSelector(java.lang.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 Detail
-
select
public java.lang.Object select(java.lang.Object policy) throws org.apache.avalon.framework.service.ServiceExceptionSelect a service based on a policy.- Specified by:
selectin 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
public boolean isSelectable(java.lang.Object policy)
Check to see if aObjectexists relative to the supplied policy.- Specified by:
isSelectablein interfaceorg.apache.avalon.framework.service.ServiceSelector- Parameters:
policy- aObjectcontaining the selection criteria- Returns:
- True if the component is available, False if it not.
-
release
public 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.- Specified by:
releasein interfaceorg.apache.avalon.framework.service.ServiceSelector- Parameters:
object- TheObjectwe are releasing.
-
getWrappedSelector
org.apache.avalon.framework.component.ComponentSelector getWrappedSelector()
TheWrapperServiceManagerwraps ComponentSelectors in WrapperServiceSelectors when they are looked up. This method makes it possible to release the original component selector.- Returns:
- The
ComponentSelectorbeing wrapped.
-
-