avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Berin Loritsch <blorit...@apache.org>
Subject Re: componentmanager and looking up different implementations of the same role
Date Thu, 27 Dec 2001 18:24:26 GMT
Neeme Praks wrote:

> I have the following issue: can I ask the componentmanager to lookup a
> component by the "shorthand" name?


No.  That is not it's purpose, nor should it ever be used in that manner.



> I need to have more than one implementation of the same role, and I need to
> somehow look up those different implementations. Any other way to achieve
> that?


ComponentSelector.  ComponentSelector was designed for this purpose.

Per the Developer's docs, if you use a selector, append the "Selector"
designator to the role name:

ComponentSelector selector = (ComponentSelector) manager.lookup( Resource.ROLE + "Selector"
);
Resource resource = selector.select( hint );

The hint can be any object (a Locale object if you wish, or any string).


> 
> (I'm in the middle of another round of refactoring the i18n stuff :-))
> 
> Rgds,
> Neeme
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:avalon-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:avalon-dev-help@jakarta.apache.org>
> 
> .
> 
> 



-- 

"They that give up essential liberty to obtain a little temporary safety
  deserve neither liberty nor safety."
                 - Benjamin Franklin


--
To unsubscribe, e-mail:   <mailto:avalon-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-dev-help@jakarta.apache.org>


Mime
View raw message