Skip to content

Metabolomics Fiehn Lab

Sections
Personal tools
You are here: Home » Members » Gert Wohlgemuth » java » xdoclet - create a Module

xdoclet - create a Module

Document Actions
this is about the layout of a xdoclet module
after I was creating my own Tasks, SubTasks and TagHandler I had to put them together in a module.

Layout of a module file

doclet-<name>-module.jar
|___________META-INF
|                   |________xdoclet.xml
|
|___________classes like in every jar file + our templates!


How to create the xdoclet.xml file

a xdoclet.xml file looks something like this

<?xml version="1.0" encoding="UTF-8"?>

<!--
<!DOCTYPE xdoclet-module PUBLIC "-//XDoclet Team//DTD XDoclet Module 1.0//EN" "http://xdoclet.sourceforge.net/dtd/xdoclet-module_1_0.dtd">
-->

<xdoclet-module>
    <!--
    edu.ucdavis.genomics.metabolomics.binbase.bdi.xdoclet.tag.CounterTagHandler
    edu.ucdavis.genomics.metabolomics.binbase.bdi.xdoclet.task.swt.SWTTask
    edu.ucdavis.genomics.metabolomics.binbase.bdi.xdoclet.task.swt.LabelProviderSubTask
    -->

    <taghandler
        namespace="Counter"
        class="edu.ucdavis.genomics.metabolomics.binbase.bdi.xdoclet.tag.CounterTagHandler"
    />

    <subtask
        name="labelprovider"
        implementation-class="edu.ucdavis.genomics.metabolomics.binbase.bdi.xdoclet.task.swt.LabelProviderSubTask"
        parent-task-class="edu.ucdavis.genomics.metabolomics.binbase.bdi.xdoclet.task.swt.SWTTask"
    />
</xdoclet-module>

we have to possibilities,
  • write it by hand, are we talking about codegeneration?
  • let it generate by xdoclet, thats what I'm talking about!
ok so to generate it you need to have the xdoclet-xml.xdt file, from the xdoclet src distribution. And the xdoclet binaerys in your classpath.

And this is the fragment what you need to generate your xdoclet.xml file

        <taskdef name="xdoclet" classname="xdoclet.DocletTask" classpathref="xdoclet.class.path" />
        <xdoclet destdir="build/META-INF">

            <fileset dir="src">
                <include name="**/*TagHandler.java" />
                <include name="**/*Task.java" />
            </fileset>

            <template templateFile="templates/xdoclet-xml.xdt" destinationFile="xdoclet.xml" />
        </xdoclet>

So now we have to create a jar file containning

  • META-INF/xdoclet.xml -> is already at the right place!
  • META-INF/xdoclet-xml.xdt I really have no Idea why, I just read it somewhere
  • our classes
  • our templates! don't forgett them!

And the correct fragment

<target name="jar" depends="compile" description="jar the compiled classes">
    <copy todir="build/META-INF/" file="templates/xdoclet-xml.xdt">
    </copy>

    <copy todir="build">
        <fileset dir="src">
            <include name="**/*.xdt" />
        </fileset>
    </copy>
    <jar jarfile="xdoclet-bdi-module.jar">
        <fileset dir="build">
            <include name="**/*.*" />
        </fileset>
    </jar>
</target>

and you are done!

now just copy your module somewhere in your classpath and use it like every other module. xdoclet integrates it for you!
Created by zwluxx
Last modified 2005-10-10 12:43 AM
 

Powered by Plone

This site conforms to the following standards: