Class WrapperComponentSelector
- java.lang.Object
-
- org.apache.avalon.framework.component.WrapperComponentSelector
-
- All Implemented Interfaces:
org.apache.avalon.framework.component.Component,org.apache.avalon.framework.component.ComponentSelector
public class WrapperComponentSelector extends java.lang.Object implements org.apache.avalon.framework.component.ComponentSelectorThis is aServiceSelectorimplementation that can wrap around a legacyComponentSelectorobject effectively adapting aComponentSelectorinterface to aServiceSelectorinterface.- Since:
- 4.1.4
- Version:
- $Id: WrapperComponentSelector.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.service.ServiceSelectorm_selectorThe Selector we are wrapping.
-
Constructor Summary
Constructors Constructor Description WrapperComponentSelector(java.lang.String key, org.apache.avalon.framework.service.ServiceSelector selector)This constructor is a constructor for a WrapperComponentSelector.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) org.apache.avalon.framework.service.ServiceSelectorgetWrappedSelector()TheWrapperComponentManagerwraps ServiceSelectors in WrapperServiceSelectors when they are looked up.booleanhasComponent(java.lang.Object policy)Check to see if aComponentexists relative to the supplied policy.voidrelease(org.apache.avalon.framework.component.Component object)Return theObjectwhen you are finished with it.org.apache.avalon.framework.component.Componentselect(java.lang.Object policy)Select a Component based on a policy.
-
-
-
Constructor Detail
-
WrapperComponentSelector
public WrapperComponentSelector(java.lang.String key, org.apache.avalon.framework.service.ServiceSelector selector)This constructor is a constructor for a WrapperComponentSelector.- Parameters:
key- the key used to aquire this selectorselector- the selector to wrap
-
-
Method Detail
-
select
public org.apache.avalon.framework.component.Component select(java.lang.Object policy) throws org.apache.avalon.framework.component.ComponentExceptionSelect a Component based on a policy.- Specified by:
selectin interfaceorg.apache.avalon.framework.component.ComponentSelector- Parameters:
policy- the policy- Returns:
- the Component
- Throws:
org.apache.avalon.framework.component.ComponentException- if unable to select service
-
hasComponent
public boolean hasComponent(java.lang.Object policy)
Check to see if aComponentexists relative to the supplied policy.- Specified by:
hasComponentin interfaceorg.apache.avalon.framework.component.ComponentSelector- Parameters:
policy- aObjectcontaining the selection criteria- Returns:
- True if the component is available, False if it not.
-
release
public void release(org.apache.avalon.framework.component.Component 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.component.ComponentSelector- Parameters:
object- TheObjectwe are releasing.
-
getWrappedSelector
org.apache.avalon.framework.service.ServiceSelector getWrappedSelector()
TheWrapperComponentManagerwraps ServiceSelectors in WrapperServiceSelectors when they are looked up. This method makes it possible to release the original component selector.- Returns:
- The
ServiceSelectorbeing wrapped.
-
-