db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Fischer <fisc...@seitenbau.net>
Subject RE: Torque as avalon service and use of the DataSourceSelector service
Date Tue, 17 Oct 2006 09:51:10 GMT

I have to admit that I have never used avalon nor do I know the reasoning
for separating the TorqueInstance class from the Torque class, so this may
be of limited or no value to you.

Internally, most (if not all)Torque classes use the Torque.java object to
access their configuration. The Torque object has a reference to a
TorqueInstance object which is _INTERNALLY_ used by the Torque.java object
to access the configuration.

So you cannot get around a static configuration of Torque in the current
version, as far as I can see. I do not see a way to use TorqueInstance
instead of the static Torque object. This has  its reason that Torque is
intended to be a standalone component, and the avalon part is just an

Of course you can provide your own implementation of TorqueInstance
instance by using the Torque.setTorqueInstance method, and thus override
the getDataSourceFactory() part.

I cannot see anything against using an own factory, but then I'm no avalon
user and do not see the evil in this :-)

Hope this helps. If I have been writing nonsense, perhaps Thomas V can
correct me, he is using avalon himself.

   Thomas F

Stefano Bagnara <apache@bago.org> schrieb am 14.10.2006 19:21:03:

> Hi all,
> we integrated Torque in Apache James trunk for our IMAP storage needs.
> James is currently Avalon based and works on Avalon.
> I saw there is an Avalon component for James but I saw it does not
> depend on the DataSourceSelector component that we currently use to
> access the db.
> I thought we could write our own torque avalon service depending on
> datasourceselector but I'm not sure we can do this.
> I see Torque need a static configuration of the class used as the
> datasource factory while using DataSourceSelector the datasource is
> obtained via dependency injection or service lookup.
> Maybe we should switch from Torque static usage to TorqueInstance?
> Pardon my ignorance on Torque: Using TorqueInstance is it possible to
> override its getDataSource to ask the datasource to the
> I see that generated "om" contains static "Torque.method" calls: how do
> this integrate with the TorqueInstance usage/configuration?
> Is this possible? Otherwise I think I have to use publish the datasource
> selector via JNDI and to use the JNDI factory or to put the
> datasourceselector in a static field and then access it via a custom
> factory but I don't like this solutions (static fields/singleton are bad
> in then avalon world) so I'm investigating other options first.
> Thank you for any suggestion!
> Stefano
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org

To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org

View raw message