Process an XMI input model with Jamda
Note: This task is not part of the Ant distribution.
Jamda must be installed separately. Define the task to Ant using a taskdef
such as:.
<property name="jamda.home" location="... Jamda installation directory ..."/> ... <taskdef name="jamda" classname="com.ashridgetech.jamda.config.Jamda"> <classpath> <fileset dir="${jamda.home}/lib" includes="*.jar"/> </classpath> </taskdef>
The Jamda transformer configuration must be set up with the nested elements described below. The transformers will be run in the order in which they occur in the configuration.
Depending on the input XMIfile, it may be necessary to convert the XMI format to one usable by Jamda using an XSLT transformation. This step is shown in the Examples below.
Attribute | Description | Required |
inputfile | the source XMI file | Yes |
outputfile | the file where the record of the transformations is written. Used to determine whether
the Jamda output is up to date with respect to the inputfile . Defaults to jamda.out
in the project's basedir. |
No |
stylesheet | the XSLT file used to transform inputfile into the XMI format
accepted by Jamda before it is loaded. Jamda currently includes MDtoNSUML.xsl (in the xsl directory)
to transform MagicDraw XMI into Jamda XMI.
Defaults to no XSLT transformation |
No |
log4jProperties | the Log4J properties file used to configure Log4J before the transformation is run. Defaults to a standard Log4J configuration with INFO level logged to the console | No |
The elementTransformer nested element is used to specify a transformer that applies an element transformer to the elements that have one of a set of stereotypes.
Attribute | Description | Required |
classname | The name of the element transformer class. Must implement the ElementTransformer interface. |
Yes |
classpath | Classpath where classname can be found |
Yes, unless the class is available on the classpath used to run Ant |
stereotypes | The name(s) of the stereotypes of the elements to which the element transformer is applied | Yes |
The codegen nested element is used to specify the standard code generator, to be applied to elements that have one of a set of stereotypes.
Attribute | Description | Required |
dir | The top-level directory to which the code is generated. Will be created if it does not exist | Yes |
stereotypes | The name(s) of the stereotypes of the elements to which the code generator is applied | Yes |
Transformer is used to specify a non-standard transformer.
Attribute | Description | Required |
classname | The name of the model transformer class. Must implement the ModelTransformer interface. |
Yes |
classpath | Classpath where classname can be found |
Yes, unless the class is available on the classpath used to run Ant |
<!-- Check whether the Jamda output file has a later date than the UMLmodel --> <target name="_checkJamda"> <uptodate property="jamda.upToDate" srcfile="mymodel.xmi" targetfile="jamda.out"/> </target> <target name="prepare" depends="_checkJamda" unless="jamda.upToDate" description="Transform the MagicDraw UML model to a model usable by Jamda"> <mkdir dir="xmi"/> <style style="xsl/MDtoNSUML.xsl" in="mymodel.xmi" out="xmi/NSUML.xmi" processor="trax" taskname="MDtoNSUML"/> </target> <target name="jamda" depends="prepare" description="Run the Jamda transformation"> <jamda inputFile="xmi/NSUML.xmi" outputFile="jamda.out"> <elementTransformer stereotypes="coreBusinessObject" className="com.ashridgetech.jamda.ejb.transform.ValueObjectCreator"/> <codeGen stereotypes="valueObject descObject updateObject" dir="gensrc.dir"/> </jamda> </target>
Copyright © 2003 Ashridge Technologies Ltd. All rights Reserved.