Should be fixed in CVS... But see below.
J Aaron Farr wrote:
Hello again.
[Bug Alert] I think there's more to this than my typos:
Okay, Shash pointed some out to me some problems, but I think I've fixed them
all and I'm still having issues:
New "SwingContainer.xconf":
<fortress-example>
<translator id="translator2" logger="translator">
<dictionary>
<translation key="hello-world">
<value language="Deutsch">Hallo Welt</value>
<value language="English">Hello World</value>
<value language="Français">Bonjour la monde</value>
<value language="Indonesia">Apa kabar Dunia</value>
<value language="Espanõl">Hola Mundo</value>
<value language="Italiano">Ciao Mondo</value>
</translation>
</dictionary>
</translator>
<translator id="translator1" logger="translator">
<dictionary>
<translation key="hello-world">
<value language="Deutsch">Hallo Welt</value>
<value language="English">Hello World :)</value>
<value language="Français">Bonjour la monde</value>
<value language="Indonesia">Apa kabar Dunia</value>
<value language="Espanõl">Hola Mundo</value>
<value language="Italiano">Ciao Mondo</value>
</translation>
</dictionary>
</translator>
</fortress-example>
New bit of code in SwingContainer.java (replaces line 98):
---------------------------------------------------------------------------------
Object o = m_serviceManager.lookup(
org.apache.avalon.fortress.examples.components.Translator.ROLE);
if (o instanceof ServiceSelector)
{
m_translator = (Translator) ((ServiceSelector)o).select("translator1");
}
else
{
m_translator = (Translator)o;
}
---------------------------------------------------------------------------------
Ok, I made some fixes and changes to the lookup semantics. I brought it
back in line with what I wanted to begin with. The purpose of Fortress
is to provide a smooth migration from ECM, and allow you to incorporate
components that could not be incorporated any longer.
It also allows you to simplify your components so that if you do not
need more than one data source component mapped, you do not need to
code for it.
Each code snippet below will work:
//-------------------------------------------------------------
// Returns the default Translator every time.
m_translator = (Translator) m_serviceManager.lookup( Translator.ROLE );
//-------------------------------------------------------------
// Returns the selector to get your Translator
ServiceSelector selector =
(ServiceSelector)m_serviceManager.lookup(
Translator.ROLE + "Selector" );
m_translator = (Translator) m_serviceManager.select("translator1");
//-------------------------------------------------------------
// Returns the specified translater directly
m_translator = (Translator) m_serviceManager.lookup(
Translator.ROLE + "/translator1" );
//-------------------------------------------------------------
This is more in line with the documented "best practices" in
"Developing with Avalon" and the Framework site. It also has
predictable contracts which are essential to program with.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]