XDoclet is the real workhorse of this project. It is used to generate
the following artifacts:
<ejbdoclet destdir="${build.dir}/ejb/gen"
addedtags="@xdoclet-generated at ${TODAY}"
ejbspec="1.1"
force="${xdoclet.force}"
mergedir="metadata/ejb">
<fileset dir="src/ejb"/>
<remoteinterface/>
<homeinterface/>
<utilobject/>
<jboss validatexml="true" destdir="${build.dir}/${site}"/>
<deploymentdescriptor validatexml="true"/>
</ejbdoclet>
Because the JNDI lookups are site-specific, the jboss.xml deployment descriptor is generated to a site-specific output directory, where the rest of the artifacts go to a common location for all sites. On a related note, the JNDI lookups are generated in a site-specific manner, using a jndi-name attribute on the @ejb.bean tag on SearchSessionBean in this manner:
/**The interesting note here is that XDoclet expands Ant properties when the tags are processed, allowing for some interesting configuration possibilities.
* @ejb.bean type="Stateless"
* jndi-name="${site}/org.example.antbook.session.SearchSession"
* @ejb.util generate="physical"
*/
public class SearchSessionBean implements SessionBean {
// ...
}
<webdoclet destdir="${build.dir}/web/WEB-INF"
force="${xdoclet.force}"
mergedir="metadata/web">
<fileset dir="src/web"/>
<configParam name="cactusOn" value="${enable.cactus}"/>
<deploymentdescriptor validatexml="true"
destdir="${build.dir}/${site}"
distributable="false"
/>
<jsptaglib validatexml="true"
shortName="antbook"
filename="antbook.tld"
/>
<strutsconfigxml validatexml="true" version="1.1"/>
<strutsvalidationxml omitdtd="true"/>
</webdoclet>
Of note here:<XDtConfig:ifConfigParamEquals paramName="cactusOn" value="true">Using configuration parameters allows for flexible control in the generation results. For example, this feature can be used to control a web application's authentication mechanism such that it can be easily switched from BASIC to FORM authentication.
.
.
.
</XDtConfig:ifConfigParamEquals>
/**
* @jsp.tag name="label" bodycontent="empty"
*/
public class LabelTag extends TagSupport {
.
.
.
/**
* @jsp.attribute required="true"
*/
public void setKey(String key) {
this.key = key;
}
}
/**
* Logs duration of each request.
*
* @web:filter name="TimingFilter"
* @web:filter-mapping url-pattern="/*" servlet-name="TimingFilter"
*/
public class TimingFilter implements Filter {
.
.
.
}
<xdoclet destdir="${build.dir}"
excludedtags="@version,@author"
force="${xdoclet.force}">
<fileset dir="${struts.src.dir}"
includes="**/${form.name}.java"
/>
<template templateFile="src/FormKeys.xdt"
ofType="org.apache.struts.validator.ValidatorForm"
acceptAbstractClasses="false"
prefixWithPackageStructure="false"
destinationFile="{0}.properties"
/>
<template templateFile="src/StrutsForm_jsp.xdt"
ofType="org.apache.struts.validator.ValidatorForm"
acceptAbstractClasses="false"
prefixWithPackageStructure="false"
destinationFile="{0}.jsp"
/>
</xdoclet>
Its simpler than it looks. Only non-abstract subclasses of the the
Struts ValidatorForm are processed (change this to ActionForm if you are
not using Validator). The output is generated at the top level of the
${build.dir} (prefixWithPackageStructure="false" indicates to ignore the
package hierarchy of the classes processes, otherwise the output would be
in package structure layout)./**In order to generate the to-do list from this project, run the "todo" Ant target from the main build file. The results will be placed in ${build.dir}/todo (typically that is build/todo).
* @todo Revisit this code
*/