Generating Descriptors

DNA uses the MetaClass toolkit to generate metadata descriptors. The developer should thus familiarize themselves with the MetaClass toolkit. The DNA tools extends the base MetaClass toolkit so that specific dna tags are recognized, validated, populated with default values and types resolved. The following ant snippet can be used to generate DNA metadata descriptors.

NOTE: There is one limitation when using the MetaClass generator. The source code must have fully-qualified imports. The MetaClass tool may not be able to resolve names of classes if they are not fully qualified. This is particularly important when specifying type fields of dependency and service tags.

<!-- define the custom task -->
<taskdef name="metaclassGen"
    classname="org.codehaus.metaclass.tools.tasks.GenerateClassDescriptorsTask">
    <classpath>
        <pathelement location="metaclass-tools-1.0.jar"/>
        <pathelement location="qdox-1.3.jar"/>
    </classpath>
</taskdef>

<metaclassGen destDir="target/classes">
    <interceptor
        name="org.codehaus.dna.tools.metaclass.DNAAttributeInterceptor">
        <classpath>
            <pathelement location="dna-tools-1.1.jar"/>
        </classpath>
    </interceptor>
    <fileset dir="src/java">
        <include name="**/*.java"/>
    </fileset>
</metaclassGen>