Never mind, I see you did the equivalent.
You may have already done this, but you define the component/service roles/classes/shorthands in the roles-config file, and then define actual services (and config) in the system-xonfig file. Have you done both?
Something of the nature:
<translator1 id="translator1" ...../>
<translator2 id="translator2" ...../>
<translator1 id="translator1-a" ..../>
<translatro1 id="translator1-b" ..../>
Shash
From: "Shash Chatterjee" <[EMAIL PROTECTED]> Reply-To: "Avalon framework users" <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Subject: Re: Using ServiceSelector in Fortress Date: Tue, 04 Feb 2003 11:58:15 -0600Jaaron,Sorry to keep asking for so much on this one, but I still need a little moreNo problem, the learning curve for me was the price to pay to use an awesome tool. In addition, you are writing a doc. for newbies, so that's a great plus!
help.
In my original example we were modifying the SwingContainer class. So if I nowHere's what you can do:
have two translators in the .xconf file with only the id different
("translator1" and "translator2") then I should be able to change this line:
m_translator =
(org.apache.avalon.fortress.examples.components.Translator)m_serviceManager.lookup(
org.apache.avalon.fortress.examples.components.Translator.ROLE );
To something like these two lines:
ServiceSelector selector = (ServiceSelector) m_serviceManager.lookup(
org.apache.avalon.fortress.examples.components.Translator.ROLE);
m_translator = (org.apache.avalon.fortress.examples.components.Translator)
sel.select("translator1");
That should work, shouldn't it? Instead I get:
org.apache.avalon.fortress.InitializationException: Cannot set up impl. Startup
lifecycle failure
...
Caused by: org.apache.avalon.framework.service.ServiceException: Component does
not exist
(Key='org.apache.avalon.fortress.examples.components.Translator/transl
ator1')
So apparently I'm still messing something up with the Selector. Any thoughts?
Object o = m_serviceManager.lookup(org.apache.avalon.fortress.examples.components.Translator.ROLE);
if (o instanceof ServiceSelector) {
m_translator = ((ServiceSelector)o).select("translator1");
} else {
m_translator = (Translator)o;
}
Shash
_________________________________________________________________
STOP MORE SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
_________________________________________________________________
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. http://join.msn.com/?page=features/virus
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]