db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Manske, Michael" <Michael.Man...@dat.de>
Subject RE: Using Torque's project-schema.xml to generate other files
Date Thu, 12 Feb 2004 11:02:52 GMT
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



> -----Original Message-----
> From: Brent Atkins [mailto:Brent.Atkins@Pro-Sys.biz]
> Sent: Wednesday, February 11, 2004 9:33 PM
> To: Apache Torque Users List
> Subject: RE: Using Torque's project-schema.xml to generate other files
> 
> 
> Hey Siegfried,
> 
> Thanks for your answer.
> 
> You mentioned that there is a Templates directory.  I never 
> had seem it before, but your post made
> me look at it a bit closer and I saw that torque-gen.jar has 
> the templates.  The standard Torque.jar
> however doesn't have the templates...
> 
> This really where my confusion started.
> 
> 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?
> 
> Any ideas?
> 
> You are right about setting up maven to generate Torque's 
> docs in xdoc format for inclusion into
> your Maven site.  In case you were curious, the properties to 
> set (in project.properties) are...
> 
> # Settings to generate torque docs in xdoc format
> # and place in xdoc directory for inclusion in
> # Maven site:generate goal
> 
> torque.doc.format = anakia
> torque.doc.dir = xdocs/database
> 
> Then all you have to do is create a xdocs/navigation.xml with 
> code like this...
> 
> <?xml version="1.0" encoding="ISO-8859-1" ?>
> <project name="ProjectName" href="www.foobar.com">
>   <title>Project Name</title>
>   <body>
> 
> // You can do it as a top bar link
>     <links>
>       <item name="Torque Docs" href="database/project-schema.html" />
>     </links>
> 
> // Or put it in the side menu if you'd like with
>     <menu name="Torque">
>       <item name="Torque Docs" href="database/project-schema.html" />
>     </menu>
>   </body>
> </project>
> 
> Just run [maven torque:doc] and [maven site:generate] and you 
> are good to go.
> 
> Since I already have the normal documentation setup, I'm more 
> excited about setting up templates
> where web developers can see documentation about the Struts 
> implementation.   Which, I would
> imagine, will require a new velocity template.

---------------------------------------------------------------------
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