db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brent Atkins" <Brent.Atk...@Pro-Sys.biz>
Subject RE: Using Torque's project-schema.xml to generate other files
Date Thu, 12 Feb 2004 14:56:49 GMT
Thanks Michael!

My confusion came from the way my project was originally setup.  I had been using torque.jar
when my
project was built using ant, but whenever I downloaded the latest torque.jar it didn't have
the
templates included so I presumed that it wasn't in the torque.jar that my project had been
using.

Thanks to your advice (about torque.jar no longer having the generator included) I took a
look at
the actual torque.jar that my project had been using (a novel idea, I know) and you were absolutely
right.  I hadn't known that ya'll had moved the generator code to a separate jar (though in
retrospect it does seem obvious); so when I couldn't find it in the current torque.jar I was
very
confused.

Anyhoo, your answer has given me a place to start fiddling around with it to see what I can
do.
Thanks again!

-----Original Message-----
From: Manske, Michael [mailto:Michael.Manske@dat.de]
Sent: Thursday, February 12, 2004 6:03 AM
To: 'Apache Torque Users List'
Subject: RE: Using Torque's project-schema.xml to generate other files


Hello Brent,

> I can understand how Torque-gen.jar could create the source
> from the schema and the templates, but
> there is apparently some other mechanism for making those
> files in Torque.jar.  Which makes me
> question my understanding how Torque-gen.jar actually works.
> So I guess a good question is, what is
> different and should I care?
I'm a little bit confused by your question.
torque-gen.jar has nothing to to with creation of torque.jar.
torque.jar is the runtime which is used only by your generated object model
classes. The runtime is the same for all object models you might have.
torque-gen.jar contains some tasks, which basically all do the same: reading
data and calling velocity to do something with these data, e.g.
TorqueDataModelTask: reading and parsing schema.xml, then generate om
classes via om-templates in /templates/om.
The templates are required only for generation, so the runtime (torque.jar)
doesn't include the templates and/or the generation tasks. Btw. this is a
main difference to earlier versions of torque, where torque.jar contained
both generator and runtime...

As for your question how to generate/change sources for your struts
implementation using schema.xml and torque's standard generation tasks, you
have to options:
1. look at /templates/om/control.vm - maybe you could just include parse
statements for
your own templates there
2. create your own "templates/struts/" directory, create a control.vm there
(look at /templates/om/control.vm), call torque's "torque-data-model" ant
task from maven with an overwritten "${torque.template.om}" parameter
pointing to your own /templates/struts/control.vm.

When using the second mechanism you wouldn't have to change torques standard
templates...

Michael



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


Mime
View raw message