ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Todd" <>
Subject RE: task for spliiting source code file
Date Mon, 11 Sep 2000 23:14:58 GMT
This is a smidgeon off topic, but you mentioned auto-generating EJB code,
and i thought the following post to the jBoss-dev list seemed relevant, both
to what you are proposing, as well as ant (see the original post regarding
using doclets from ant...would anyone care to give Rickard an answer to his

Sincerest regards,
Chris Todd
Software Engineer
Alabanza Corporation

<originally posted to jboss-dev earlier today>

I was inspired by the latest JavaWorld article on code generation by
using javadoc Doclets, and decided to try it out.

I created a "simple" doclet that could read an EJB bean file and
generate the following:
* Remote interface (one can tag remote methods in bean. Only tagged
methods appear in remote interface)
* Home interface (one can tag create methods in bean. One can also
define finders in class-comments, e.g. "@ejb-finder Collection
findLargeAccounts(int balance)")
* If Entity CMP -> Data object class generated which holds CMP fields
* If Entity CMP -> Primary key consisting of all fields marked as
pk-fields (yes, hashCode and equals are automatically implemented
* If Entity CMP -> Generate EJB 2.0-ish layer, i.e. allow bean to have
abstract get/set methods and generate EJB 1.1-CMP bean on top. The layer
also keeps track of dirty flag, and allows bulk accessor setting from
data object

Kinda cool. There is a generated example available at is
the *only*
hand-written code (it extends from a generic dummy Entity-impl. It is
trivial; ignore), and everything else is generated on the fly.

The version of Ant I had did not support doclets properly, but if the
one does, this approach has huge potential. Simply create your bean
run the doclet prior to compilation in the build script, and then
it all. Presto. Nice and clean. It might even be possible to generate
ejb-jar.xml automatically! Talk about productivity booster!

I will submit the EJB doclet itself for public use once I've touched it
up a

Any comments?

Rickard Öberg


</originally posted to jboss-dev earlier today>

-----Original Message-----
From: Eliot Stock []
Sent: Monday, September 11, 2000 6:05 PM
Subject: task for spliiting source code file

I'm doing code generation for EJBs using XSL Transformations. The output of
my transform is five monolithic pieces of Java source code, each with about
60 class definitions in them.

I need a task to go through these files and split them into individual class
source files. I've just written one, but it doesn't generate a directory
tree that maps to the package hierarchy, it just throws all the source into
one directory. I realize now I need that directory tree.

Has anyone done this?


Eliot Stock
Practiv NZ

View raw message