Shash Chatterjee wrote:
> Berin,
> 
> I could use a little more explanation.  The example for Fortress doesn't
> help at all in this regard, I apologize for asking for so much detail!
> 
> Let's say I am going to implement this format in system.xconf:
> 
> <a-things><a-thing1/><a-thing2/></a-things>
> <b-things><b-thing1/><b-thing2/></b-things>
> 
> I want to use the same selector class for selecting the 2nd-tier components,
> so do I specify that in the roles.xconf file as this (which doesn't work,
> when I tried):
> <roles>
>     <role name="...AThingsSelector">
>         <component shorthand="a-things" class="...MySelector" handler="...">
>         <component shorthand="a-thing1" class="..." handler="..."/>
>         <component shorthand="a-thing2" class="..." handler="..."/>
>     </role>
>     <role name="...BThingsSelector">
>         <component shorthand="b-things" class="...MySelector" handler="...">
>         <component shorthand="b-thing1" class="..." handler="..."/>
>         <component shorthand="b-thing2" class="..." handler="..."/>
>     </role>
> </roles>
> 
> So the questions are:
>     - The role name should have the "Selector" appened so that it matches
> the lookup?

No.  The role name should be the role name.  In your example, it would be
<role name="...Athing"/>
<role name="...Bthing"/>

When you look it up, you use the "Selector" like this:

ServiceSelector selector = (ServiceSelector) manager.lookup( "...AthingSelector" );

Fortress knows that the component needs to have the components as a selector.
This works when there is only one component available or several.

>     - A component with the Selector class should be specified for each role
> (MySelector)?

No.  THe return value as a selector is automatic,

>     - Can the same Selector class name be used for each role that has
> selectable-components?

?? I don't get you here.  A ComponentSelector or a ServiceSelector has all
components that satisfy the same role.  It is a way of choosing which one.

>     - Can that selector class be FortressServiceSelector?

It already is.  Nothing more needs to be done.

>     - I see that there is special handling for "select" and "default" hints
> in AbstractContainer.addComponent(), but where is that specified?

It is automatic.


> If I can then lookup the Selector, I think I am home free from there, I
> could either override DefaultContainer's configure, or have the
> ServiceSelector's configure load up the second-tier, nested components in
> its configure method? Correct?

There is no need for a second-tier.  However, if you want one, you have
to extend DefaultContainer's configure, and just addComponent(....) for
each instance.  It's that easy.  Just make sure the id="" has the name.

> 
> Shash
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> 


-- 

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


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to