A P P E N D I X C
Appendix
C
17. Appendix
C
Introduction to XDoclet
Have you ever thought that creating and maintaining the Home and Remote interface, the
deployment descriptors, Value Objects etc. is a pain. Also did Rickard Oeberg, architect of
JBoss 2, and created EJBDoclet that was renamed afterwards to XDoclet because it does
generated EJB files but also web, JMX etc files.
XDoclet, as the name implies, is a special JavaDoc doclet implementation and reads
JavaDoc comments and uses this and class information to generated other Java source code,
deployment descriptors and other files. The basic idea behind is that all the redundant
information in these additional classes are generated to speed up project development and
shorten testing because you don't have to worry about Java classes out of sync or wrong
references in or between deployment descriptors. Finally and maybe the most important fact
is that all the information are in one, central Java class. No jumping around to figure out
the JNDI name, the datasource name, resource name etc. and also only one file is added to a
version control tool like CVS because all the other files are generated every time necessary.
XDoclet is heavily incorporate into ANT build system (see Appendix B) and therefore you
must run XDoclet as an ANT task. To use XDoclet you have to:
Create a Taskdef in the ANT build file before you can use XDoclet
Write the XDoclet task, specify the task attributes and the file set (list of Java classes
inspected by XDoclet)
Write the XDoclet subtask and specify its attributes
Finally a list of advanced features of XDoclet:
Able to merge in pieces of code, XML snippets etc. at specific merge points
Able to change the layout files XDoclet uses to generate the files and use them
without changing XDoclet
A GUI tool to write XDoclet definitions (XDocletGUI)
Page 134 of 140
footer
Our partners:
PHP: Hypertext Preprocessor Cheap Web Hosting
JSP Web Hosting
Ontario Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Java Hosting
Cheapest Hosting
Visionwebhosting.net Business web hosting division of Vision Web Hosting Inc.. All rights reserved