Hi

I spent half of yesterday creating a XDoclet template to generate Castor's
mapping.xml.

Features:
- 90% compatible with Castor Doclet
- does not introspec attibutes, so "what you declare is what you get". This
is useful if you have a field that you do not want to persist, or just it's
a temporary field, or you have denormalised your db but still want OO in
your design

Unfortunately, I do not have the time to document the tags. I have made it
compatible with Castor Doclet, and added a few additional tags from the
mapping.dtd.

Here are the files if it's useful to any of you. Steps to compile:
- cvs the xdoclet source
- create core/resources/xdoclet/castor and place *.j files in there
- create core/src/xdoclet/castor and place *.java files in there
- compile xdoclet

Put the lib in your ant path. This is a sample of the ant task:

<target name="castor-mapping">

    <taskdef name="ejbdoclet" classname="xdoclet.castor.CastorDocletTask"
classpath="${lib.dir}/ant/xdoclet.jar;${lib.exclude.compile.jboss.client.dir
}/jboss-j2ee.jar;${lib.include.log4j.dir}/log4j.jar"/>

    <mkdir dir="${temp.dir}" />

    <ejbdoclet sourcepath="${java.dir}"
                     destdir="${temp.dir}"
                     classpathref="xdoclet-classpath"
                     excludedtags="@version,@author"
                     mergedir="${etc.dir}/or-mapping">

                <fileset dir="${java.dir}">
                   <include name="**/*Vo.java" />
                </fileset>

        <castorMappingXml destdir="${etc.dir}/or-mapping"/>
    </ejbdoclet>
    <delete dir="${temp.dir}" />
</target>

Regards
Keith C

CastorDocletTask.java

CastorMappingXmlSubTask.java

mapping_xml.j

mapping-body.j

Reply via email to