ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Todd" <ct...@alabanza.com>
Subject FW: task for spliiting source code file
Date Mon, 11 Sep 2000 23:17:47 GMT
Doh!  I should have checked my email before replying, as it appears Rickard
answered his own question.  See the cross-post below.

Sincerest regards,
Chris Todd
Software Engineer
Alabanza Corporation

<posted a few minutes ago on jboss-dev>

I've updated my Ant installation, and tried the EJB generation on the
jbosstest module beans. Worked fine (once I had debugged the doclet
output).

So, now there are only a couple of manually written EJB's (*Bean.java).
THe build first runs the EJB doclet which generates all the other files,
after which they and the manually coded files are compiled and jar'ed.

Very very convenient! :-))) This will make it trivial to create and
update beans (e.g. add a method to the bean, mark it as remote, rebuild,
done: the remote interface now has the method in it), and because of the
Ant integration the entire process is very stream-lined. As I said
before, the only thing left to do is to generate ejb-jar.xml as well,
and that should not be a problem I think.

/Rickard

--
Rickard Öberg

Email: rickard@telkel.com

</posted a few minutes ago on jboss-dev>

-----Original Message-----
From: Chris Todd [mailto:ctodd@alabanza.com]
Sent: Monday, September 11, 2000 7:15 PM
To: ant-user@jakarta.apache.org
Subject: RE: task for spliiting source code file


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 question?).

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
properly)
* 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
http://www.dreambean.com/download/rickard/bank.zip. AccountBean.java 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
latest
one does, this approach has huge potential. Simply create your bean
code,
run the doclet prior to compilation in the build script, and then
compile
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
bit.

Any comments?

regards,
  Rickard
--
Rickard Öberg

Email: rickard@telkel.com

</originally posted to jboss-dev earlier today>

-----Original Message-----
From: Eliot Stock [mailto:eliot.stock@practiv.com]
Sent: Monday, September 11, 2000 6:05 PM
To: ant-user@jakarta.apache.org
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?

Cheers,

Eliot Stock
Practiv NZ


Mime
View raw message