Berin Loritsch <[EMAIL PROTECTED]> writes:
Hi,
>As to accessing the components via static accessors, you might
>want to take advantage of the Factory pattern to aleviate some
>of the issues:
>public final TorqueComponentFactory
>{
> private static TorqueComponent m_component;
> public static TorqueComponent getTorque()
> {
> synchronized( TorqueComponent.class )
> {
> if (null == m_component)
> {
> ComponentManager manager = ECMFactory.getECM();
> m_component = (TorqueComponent)
> manager.lookup(TorqueComponent.class.getName());
> }
> }
> return m_component;
> }
>}
It's already worse that this, the actual Torque implementation is in a
Singleton which is handed out to TorqueComponent. So we can have more
than just one TorqueComponent, however they all refer to the same
TorqueSingleton implementation through facade accessors. No, I'm not
proud on this, but we want to keep the static facade for at least one
more release because Torque standalone users are using this.
The problem is, that some parts of user code (Turbine in this case),
simply does Torque.<do something> without knowing that Torque has been
loaded by an Avalon Container.
>You will have to add the proper try/catch block, but it will ensure you
>get the TorqueComponent even with delayed initialization.
The idea is good and actually we do a similar thing in the Torque
facade and the TorqueComponent but we must support Users which use
Torque without Avalon, so we can't go this way (yet).
Regards
Henning
--
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen INTERMETA GmbH
[EMAIL PROTECTED] +49 9131 50 654 0 http://www.intermeta.de/
Java, perl, Solaris, Linux, xSP Consulting, Web Services
freelance consultant -- Jakarta Turbine Development -- hero for hire
--- Quote of the week: "It is pointless to tell people anything when
you know that they won't process the message." --- Jonathan Revusky
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]