You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Neeme Praks <ne...@inpoc.com> on 2001/12/27 19:13:32 UTC

componentmanager and looking up different implementations of the same role

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

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?

(I'm in the middle of another round of refactoring the i18n stuff :-))

Rgds,
Neeme


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: componentmanager and looking up different implementations of the same role

Posted by Berin Loritsch <bl...@apache.org>.
Neeme Praks wrote:

>>-----Original Message-----
>>From: Berin Loritsch [mailto:bloritsch@apache.org]
>>Sent: Thursday, December 27, 2001 8:41 PM
>>
>>If you are using the ExcaliburComponentManager, then no.  It is taken care
>>of by the configuration file.  For example:
>>
>><resources>
>>   <xml name="foo" file="/over/there.xml"/>
>>   <file name="bar" rootdir="/over/here"/>
>>   <file name="baz" rootdir="/over/hill"/>
>>   <xml name="blah" file="/over/dale.xml"/>
>></resources>
>>
>>(with the proper entries in RoleManager) will allow you to get
>>the resources
>>with the hint matching the name in the configuration file.
>>
> 
> Hmm, looks promising. Is there somewhere some more documentation about this
> (I haven't found yet :-()?
> If not, then can you present the whole configuration file for this? Together
> with rolemanager entries, etc...?


Look at "Developing with Avalon" and Chapter 3 "Implementing the Dream".  It
is described pretty well there.






-- 

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


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: componentmanager and looking up different implementations of the same role

Posted by Neeme Praks <ne...@apache.org>.
> -----Original Message-----
> From: Berin Loritsch [mailto:bloritsch@apache.org]
> Sent: Thursday, December 27, 2001 8:41 PM
>
> If you are using the ExcaliburComponentManager, then no.  It is taken care
> of by the configuration file.  For example:
>
> <resources>
>    <xml name="foo" file="/over/there.xml"/>
>    <file name="bar" rootdir="/over/here"/>
>    <file name="baz" rootdir="/over/hill"/>
>    <xml name="blah" file="/over/dale.xml"/>
> </resources>
>
> (with the proper entries in RoleManager) will allow you to get
> the resources
> with the hint matching the name in the configuration file.

Hmm, looks promising. Is there somewhere some more documentation about this
(I haven't found yet :-()?
If not, then can you present the whole configuration file for this? Together
with rolemanager entries, etc...?

Neeme


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: componentmanager and looking up different implementations of the same role

Posted by Berin Loritsch <bl...@apache.org>.
Neeme Praks wrote:

>>-----Original Message-----
>>From: Berin Loritsch [mailto:bloritsch@apache.org]
>>Sent: Thursday, December 27, 2001 8:24 PM
>>
>>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).
>>
> 
> This means that I need to write my own selector for that?


If you are using the ExcaliburComponentManager, then no.  It is taken care
of by the configuration file.  For example:

<resources>
   <xml name="foo" file="/over/there.xml"/>
   <file name="bar" rootdir="/over/here"/>
   <file name="baz" rootdir="/over/hill"/>
   <xml name="blah" file="/over/dale.xml"/>
</resources>

(with the proper entries in RoleManager) will allow you to get the resources
with the hint matching the name in the configuration file.




-- 

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


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: componentmanager and looking up different implementations of the same role

Posted by Neeme Praks <ne...@apache.org>.
> -----Original Message-----
> From: Berin Loritsch [mailto:bloritsch@apache.org]
> Sent: Thursday, December 27, 2001 8:24 PM
> 
> 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).

This means that I need to write my own selector for that?

Neeme

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: componentmanager and looking up different implementations of the same role

Posted by Berin Loritsch <bl...@apache.org>.
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:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>