db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Greg Monroe" <Greg.Mon...@DukeCE.com>
Subject RE: Proposal: Supporting local and add-on Generator "Override" jars
Date Fri, 04 Aug 2006 18:21:54 GMT

> Thomas Fischer said:
> I like the idea, however, I do not see that the 
> implementation is trivial even in ant (but maybe 
> you can enlighten me there). There are two ways to
> support templates, the first is to look in the 
> classpath, the second one is to give a single 
> directory. Both ways are handled internally 
> by velocity.
> How do you want to modify this behaviour?
Hmm, I'd forgotten about the non-classpath variation.
Supporting that variation probably can't be done. But
I'm not sure it's needed if there's a way to use the
classpath to override any or all templates in the
distro-jar. This is the preferred/distributed method 
after all.

That said, here's the state of my thinking/testing 
after including your "allow non-jar-ed template files
scenario. I was originally just thinking just jar 
files, but having editable local templates would be 
great for developing stuff.

First, there'll be one new optional build property, 


If set, this should point to a valid directory in your
project. E.g. ${torque.output.dir}/local-mods. 

Any file in this directory endings in "-override.jar" 
will be added to the classpath used by Torque tasks.  
Also, if there is a "templates" directory, this will 
be added as a directory entry (e.g. classes type entry).  
These are all added prior to the distribution jar files
so the ClassLoader/ResourceLoader will find stuff here 

So, if you want local (or contributed) modification to
any of the generator classes or templates, just create
the directories with your jars or template files and 
set the new property. Then regenerate stuff.

Below is the Ant "magic" to make this happen. FWIW, I've 
learned enough about Maven 1.0 now to duplicate it
in the that script. So that's not a problem.

Thoughts about doing this in Maven 2.0? (But it's not
"officially" support it yet.. so is this a new release
condition for the folks working on this?)


    Ant complains if fileset directories don't exist,
    so make sure that the torque.override.dir point
    to a valid directory.  

    Not Set Default: $torque.lib.dir value
<condition property="valid.override.directory" 
  <isset property="torque.override.dir" /> 
<condition property="valid.override.directory" 
      <isset property="torque.override.dir" /> 

<path id="torque-classpath">

<!-- Add in override directory stuff -->
  <pathelement location="${valid.override.directory}/templates"/>
  <fileset dir="${valid.override.directory}">
    <include name="*override.jar"/>

<!-- Normal distro classpath info -->
  <fileset dir="${torque.lib.dir}">
    <include name="**/commons-collections-3.1.jar"/>
    <include name="**/commons-lang-2.1.jar"/>
    <include name="**/log4j-1.2.8.jar"/>
    <include name="**/${torque.jar}"/>
    <include name="**/velocity-1.3.1.jar"/>
    <include name="**/village-2.0.jar"/>
    <include name="**/xercesImpl-2.6.2.jar"/>
    <include name="**/xml-apis-2.0.2.jar"/>
    <include name="**/*.jar"/>

Duke CE Privacy Statement
Please be advised that this e-mail and any files transmitted with it are confidential communication
or may otherwise be privileged or confidential and are intended solely for the individual
or entity to whom they are addressed.  If you are not the intended recipient you may not rely
on the contents of this email or any attachments, and we ask that you  please not read, copy
or retransmit this communication, but reply to the sender and destroy the email, its contents,
and all copies thereof immediately.  Any unauthorized dissemination, distribution or copying
of this communication is strictly prohibited.

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

View raw message