ibm.com/developerWorks
Presented by developerWorks, your source for great tutorials
Section 1. About this tutorial
Purpose of this tutorial
This tutorial shows J2EE developers how to use XDoclet to speed development.
XDoclet simplifies continuous integration between components using attribute oriented
programming. It allows you to radically reduce development time by generating
deployment descriptors and support code, allowing you to focus on application logic
code.
If you are a J2EE development veteran, then you realize keeping code in sync with
deployment descriptors can be a drag. Often you may need to reuse components with
other applications or in other environments like other application servers or with other
database systems. You need to keep separate deployment descriptor for each
application/environment combination, even if only one or two lines of the large
deployment descriptor changes, you need to have a deployment descriptor for every
possible configuration. This can really slow down development. At times you may feel
you spend more time syncing deployment descriptors than writing code.
XDoclet facilitates automated deployment descriptor generation. As a code generation
utility, it allows you to tack on metadata to language features like classes, method, 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
manual creation of support files. This tutorial focuses on using existing templates that
ship with XDoclet.
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
Enterprise JavaBeans (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
XDoclet site on Sourceforge.net
.
This tutorial is a hands on approach to learning how to use XDoclet to do J2EE
component development. By the end of this tutorial, you will build several J2EE
Page 2 of 49
Enhance J2EE component reuse with XDoclets
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved