Thank you. And:

1) All components must have the attribute id="unique.name" which is used
if
the component is looked up via a Selector (in Fortress you can use a
selector
or the more direct "ROLE/hint" idiom). If the configuration element
does not
have the "id" attribute, then the container assumes that information
is not
for any components.


when you said " looked up via a Selector", did you mean that the ServiceManager does it automatically? that is, I dont need to care about if it is a manager or a selector is looking up a service 'component'?

for example, I have the below roles file and xconf file

<?xml version="1.0"?>
<role-list>
<role name="Runner" <component shorthand="DefaultRunner"
class="DefaultRunner"
/>
<component shorthand="AnotherRunner"
class="AnotherRunner"
/>
</role> </role-list>



<my-system> <AnotherRunner id="Another"/> <DefaultRunner id="Default"/> </my-system>

now I need a Runner implementaion, I did this

myServiceManager.lookup(Runner.ROLE);(Runner.ROLE="Runner"):

it returns me an AnotherRunner, but what if I need a DefaultRunner? what shall I do then?

you know in ECM ,we wrote the roles file this way:


<role
name="Runner"
shorthand="runner"
default-class="org.apache.avalon.excalibur.component.ExcaliburComponentSelector">


   <hint shorthand="anotherRunner" class="AnotherRunner"/>
   <hint shorthand="defaultRunner" class="DefaultRunner"/>
 </role>

when I did this: mySelector=(ExcaliburComponentSelector)myECM.lookup(Runner.ROLE); it returned me an ExcaliburComponentSelector,and I can then get,for example, an AnotherRunner instance like this:

AnotherRunner runner=(AnotherRunner)mySelector.select("anotherRunner");

can you tell me how to achieve this in fortress?

And, where can I find complete roles file and xconf file examples? I guess they are of great use for a beginner like me

Thanks
Mike

_________________________________________________________________
与联机的朋友进行交流,请使用 MSN Messenger: http://messenger.msn.com/cn



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



Reply via email to