db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Henning P. Schmiedehausen" <...@intermeta.de>
Subject Torque code split into a Singleton and a Wrapper
Date Sat, 21 Jun 2003 12:02:55 GMT

I just put some highly experimental (but after all, that's what
alpha-dev versions are for, aren't they? ;-) ) code into the HEAD.

If it works out right (and it does for me by using Turbine and
AvalonComponentService), it should solve all the issues with
initialization from the static class. Simply by removing the static
variables. ;-)

I moved the whole class code into a Singleton (TorqueSingleton) and
replaced the method calls themselves with facade wrappers (just like
Turbine Services). Avalon, compared to that, accesses the singleton
directly and skips the Torque wrapper class.

As net result, you should be able to use Torque just as before
(standalone with Torque) or with an environment that loads and inits
Torque for you (Turbine with ComponentService or AvalonComponentService)
and as a "real" Avalon component, where you do

import org.apache.torque.avalon.Torque;
import org.apache.torque.avalon.TorqueComponent;

TorqueComponent tc = (TorqueComponent) manager.lookup(Torque.ROLE);

then you replace all Torque.<foo> method calls with doing


But the static peers should still work, because they access Torque
through the facade and end up in the same Singleton object as the
tc.<foo> method calls.

I did some preliminary testing and it seems to work. But this really
cries for more testing.


P.S.: Martin, I put some comments into the Torque class about the
Stratum deprecation. After we removed that code, can we please make
Torque an all static class by declaring it abstract? Thanks.
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen          INTERMETA GmbH
hps@intermeta.de        +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: "Never argue with an idiot. They drag you down
to their level, then beat you with experience." ---

View raw message