MDRAnt "How To"
- Author:
- Petr Hrebejk, NetBeans / Sun
Microsystems
- History:
-
Available in the CVS
How to build
Building should be easy. Just
run ant in %nbroot%/extras/mdrant directory.
Notice that you have to checkout the mdr module from CVS and build it first. And
you also have to checkout the openide module. (The build script needs it
for building the openide-lookup.jar, which contains the Lookup library and the
ErrorManager).
How to use
For example of usage. Please see the sample.xml
file. This file
contains a demo script which:
- Instantiates the MOF package
- Loads UML 1.4 metamodel into this package
- Just for fun it generates the XMI file from the same package and
it also generates the DTD for this file. (This step is useless of course
and is included only to demonstrate how to export XMI files and how to
produce DTD's.
- Creates sources of the JMI interfaces for the UML metamodel
- Crates class files for the JMI interafaces
- Compiles the JMI interfaces. (Again doing both creating the class files
and compiling the interfaces is redundant)
Notice that you will need to customize various paths to files in the build
script and that the UML 1.4 XMI file is downloadable from the
Metamodel catalog.
It should be easy for everyone who is familiar with ant to guess how the
MDR ANT task works. However here is a simple documentation.
mdr
is the main mdr task. It serves as a wrapper for mdr subtasks.
You need to specify the storage file of the repository using the storageFile
attribute.
This task can contain various subtasks. List of subtasks follows. The names
of subtasks should be selfexplanatory for attributes of the tasks plase
consult the sample.xml
file.
Each subtask runs in it's own transaction which is rolled back when exception
is thrown from the subtask execution.
instantiate
Instantiates either the default MOF package. Or
given MOF package in given extent when extent
and
package
attributes are used.
readXMI
Imports given XMI file into given extent.
writeXMI
Exports whole content of an extent into
given XMI file
writeDTD
Creates DTD for XMI for given extent
mapJava
Maps given extent into java interfaces according
to the JMI standard
mapClass
Same as mapJava
but produces
already compiled classes instead of source.
printExtentNames
Simpli print's out names of extents
in the repository.
ToDo list
- Add verbosity attribute into MdrTask to control the number of messages
printed into console when the task is running.
- Add header (optionaly) headerFile attribute into MapJava task.
- Create task and build script for Martin Matula's UML2MOF convertor
- Write a generic subtask which will allow users to run their own
programs on the repository.
- Wite more detailed documentation