avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From J Aaron Farr <jaaronf...@yahoo.com>
Subject [Fortress] Single Role, Multiple Components
Date Tue, 04 Mar 2003 19:23:34 GMT
Hello again.

Having trouble with FortressServiceManager/Selector again.

Okay, in my roles file I have this:

<role name="com.company.component.RoleInterface">
   
 <component shorthand="componentOne"
            class="com.company.component.ImplOne"
    handler="org.apache.avalon.fortress.impl.handler.FactoryComponentHandler"/>
   
 <component shorthand="componentTwo"
            class="com.company.component.ImplTwo"
    
handler="org.apache.avalon.fortress.impl.handler.FactoryComponentHandler"/>

</role>

First off, is this valid?  It sure appears to be.  So now we turn to the
container's configuration file:

  <componentOne id="one">
     <config>stuff</config>
  </componentOne>

  <componentTwo id="two">
     <config>stuff</config>
  </componentTwo>

Now, if I use the service manager to lookup the role
"com.company.component.RoleInterface" or RoleInterface.ROLE, I should get a
ServiceSelector, correct?  In other words:

  Object o = m_serviceManager.lookup(RoleInterface.ROLE);

the object 'o' should be a ServiceSelector since I have two different
components of the same role.  Instead, I'm getting 'o' as a proxy for the
"ImplOne" object.  So in order for me to get an "ImplTwo" object, I have to do
something like this:

   Object o = m_serviceManager.lookup(RoleInterface.ROLE+"/componentTwo");

Is this the way it's supposed to work?  I'm fairly certain that the first
example should return a ServiceSelector since I have two components defined for
the same Role.  Perhaps I misunderstand the "contracts" of the ServiceManager,
so if anyone has some insight, I'd appriciate it.

Thanks!
jaaron

__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/

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


Mime
View raw message