• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Unique Uses of XDoclet

 
Sheriff
Posts: 6450
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I asked a similar question of Ernest Friedman-Hill when he did a promo for his "Jess in Action" title...
You guys have been involved with XDoclet for awhile now and are seeing it begin to spread more and more throughout the community. What are some unique uses of XDoclet that you maybe didn't forsee... something that made you step back and just go "wow!"? What are some potential uses for it that you'd like to see someone take a stab at, but maybe hasn't happened yet?
 
Author
Posts: 367
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One of the neatest ideas I heard of was someone doing a tag that evaluated it's body in another template language. (It may have been linked through BSF to allow just about any scripting language) Rather than having to write complex generation logic in Java, exposed as template tags, you could write the functionality in a high level scripting language.
Very cool...
 
author
Posts: 422
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by norman richards:
One of the neatest ideas I heard of was someone doing a tag that evaluated it's body in another template language. (It may have been linked through BSF to allow just about any scripting language) Rather than having to write complex generation logic in Java, exposed as template tags, you could write the functionality in a high level scripting language.


Dang it! You took my answer!
On a related note, though, Erik Hatcher wrote a special tag handler that lets you write your XDoclet templates in Velocity. Actually, it's still XDt on the outside, but the chewy center is Velocity. That's one of the coolest tricks I've seen.
My all-time favorite use of XDoclet is still generating MockObjects.
 
Craig Walls
author
Posts: 422
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I thought about this some more and came up with another way XDoclet is being used that is really cool:
Middlegen is a tool that examines a database schema and generates code from it. The generated code comes in the form of entity beans, JDO-persisted POJOs, and Struts code.
Now, Middlegen itself doesn't use XDoclet, but the code it generates is tagged with XDoclet tags, ready to generate even more code.
In a similar way, another tool called AndroMDA generates code from UML models (represented in XMI). The code AndroMDA generates also is tagged for additional XDoclet code generation.
So, these two fascinating tools do not use XDoclet themselves, but generate code that is bound for additional code generation using XDoclet. (Blows your mind, doesn't it?)
What's even more interesting: I said that Middlegen doesn't use XDoclet itself...but that could change (sort of). At the core of XDoclet 2 is a more general purpose code generation engine called Generama (I really don't like this name, BTW). Generama is the glue between metadata and code templates. Basically, it takes metadata as input and uses templates (Velocity or Jelly) to generate code.
In the case of XDoclet 2, the metadata provider is based on QDox, which is a doclet parser. But, what if you swapped out the QDox metadata provider for a database schema parsing metadata provider? Hmmm...that sounds a little bit like Middlegen, doesn't it? I foresee a Middlegen 2 which is based on Generama. This is very likely to happen, because one of the lead Middlegen developers is Aslak Helles´┐Ży, who also happens to also be leading the Generama/XDoclet 2 charge.
And what about AndroMDA 2? Why not write an XMI metadata provider for Generama? Voila! You now have a new AndroMDA based on Generama.
 
Ranch Hand
Posts: 1646
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Craig Walls:
I thought about this some more and came up with another way XDoclet is being used that is really cool...


Damn. I think I just peed my pants.
I've always been a huge fan of generating code. On my first J2EE project, once I had built a few session beans (this was 1999 -- we opted not to use entity beans), the OR mappings (TopLink), and a service layer above it all, I wrote a bunch of Perl code to generate all of it from a very simple object description file. The file simply contained types and names and the rest was all generated.
Every time I've used code generation it's been an uphill battle with management. "Won't that take longer? We don't want to maintain three complex (100 line each) Perl scripts. What if we switch OR mapping tools?" Ugh. However, once the tools were built and I was creating new objects in a few minutes, the questions stopped.
Anyway, I think it's even cooler to see so many Free projects using each other to build bigger and better tools. Brilliant!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic