Simple template to introduce XDoclet First template: XDoclet architecture Case study: Create Web Service Deployment Descriptor 1st try Case study: Create Web Service Deployment Descriptor 2nd try Summary and resources Use XDoclet to generate Web service support files ibm.com/developerWorks Presented by developerWorks, your source for great tutorials Section 1. About this tutorial What is XDoclet? You can skip this page if you already use XDoclet or already read the first XDoclet tutorial. 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. 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 XDoclet subtasks. 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.

Download pdf Use XDoclet to Generate Web Service Support Files