aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Developing your own templates and subtask with XDoclet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Developing your own templates and subtask with XDoclet" Watch "Developing your own templates and subtask with XDoclet" New topic
Author

Developing your own templates and subtask with XDoclet

Rick Hightower
Author
Ranch Hand

Joined: Feb 20, 2002
Posts: 350
Developing your own templates and subtask with XDoclet
XDoclet tutorial: Creating your own templates and subtask

This tutorial shows J2EE developers how to use XDoclet to write their own custom templates and subtask. It steps you through three examples. Unlike the last tutorial on XDoclet this tutorial does not focus on using existing templates that ship with XDoclet. Instead in this tutorial, you will create your own custom templates and a XDoclet subtask.
The first example is a very simple example to show how to use XDoclet. The second example shows how to create an Axis Web Service deployment descriptor (WSDD) with just the templating constructs, and how to run this with Ant. The third example show developers how to create their own custom subtask, and refactors the template fore the WSDD with best practices in mind. By the end of this tutorial you will be able to write your own custom XDoclet templates and subtasks. And you will understand when to pass something as an attribute of a subtask and when to put the parameter as a XJavaDoc tag in your source.

----------------------------------

This tutorial shows J2EE developers how to use XDoclet to write their own custom templates and subtask. It steps you through three examples.
The first example is a very simple example to show how to use XDoclet. The second example shows how to create an Axis Web Service deployment descriptor with just the templating constructs, and how to run this with Ant. The third example show developers how to create their own custom subtask, and refactors the template with best practices in mind. By the end of this tutorial you will be able to write your own custom templates and subtasks. And you will understand when to pass something as an attribute of a subtask and when to put the parameter as a XJavaDoc tag in your source.
XDoclet enables simplified continuous integration and refactoring with component-oriented development using attribute-oriented programming. XDoclet allows you to radically reduce development time, by generating deployment descriptors and support code, allowing you to focus on application logic code. Not only can you use the plethora of templates that ship with XDoclet, but you can create your own. In addition you can create a subtask to pass in custom configuration parameters that you do not want to show up in the source files.
XDoclet facilitates automated deployment descriptor generation. XDoclet, a code generation utility, allows you to tack on metadata to language features like classes, methods, and fields using what looks like JavaDoc tags. Then it uses that extra metadata to generate related files like deployment descriptor and source code. This concept has been coined attribute-oriented programming (not to be confused with aspect-oriented programming, the other AOP).
XDoclet generates these related files by parsing your source files similar to the way the JavaDoc engine parses your source to create JavaDoc documentation. In fact, earlier versions of XDoclet relied on JavaDoc. XDoclet, like JavaDoc, not only has access to these extra metadata that you tacked on in the form of JavaDoc tags to your code, but also access to the structure of your source, that is, packages, classes, methods, and fields. It then applies this hierarchy tree of data to templates. It uses all of this and templates that you can define to generate what would otherwise be monotonous support files.
XDoclet ships an Ant task that enables you to create web.xml files, ejb-jar.xml files, and much more. In this tutorial, you will use XDoclet to generate a Web application deployment descriptor with the webdoclet Ant task. In addition you will generate EJB support files. Note that XDoclet Ant tasks do not ship with the standard distribution of Ant. You will need to download the XDoclet Ant tasks from http://xdoclet.sourceforge.net.
So you may wonder: "Why should I care? I am an excellent Java/J2EE Web developer and I have never needed XDoclet". Or you may say: "I already use XDoclet, why do I need to write my own templates?" As I stated before, you don't know what you are missing. Once you start use XDoclet, you will not stop. Once you start writing your own templates you will never repeat yourself again. If you are writing dry, mundane code, then you could probably use XDoclet instead. Allow XDoclet to generate the monotonous stuff, and stick to writing the good stuff. Computers were invented to do monotonous stuff to free humans to do creative things. XDoclet frees developers from monotonous code. XDoclet is the missing piece in your J2EE and Web service development process. It will speed your development. You must master how to use XDoclet templates.
XDoclet tutorial: Creating your own templates and subtask
Please let me know what you think of this tutorial....
[ July 02, 2003: Message edited by: Rick Hightower ]

Rick Hightower is CTO of Mammatus which focuses on Cloud Computing, EC2, etc. Rick is invovled in Java CDI and Java EE as well. linkedin,twitter,blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Developing your own templates and subtask with XDoclet