The ModelAnt repository package wraps the features of NetBeans MDR metadata repository and provides Ant interface to it. It originates from the NetBeans MDRAnt project. The tasks in this package are slightly renamed and simplified the original ones. As of the Conventions, the tasks in this package have the common prefix “mdr”.
The repository initialization task <mdr> should be called first. It uses a local directory as a temporary storage for the repository’s files.
In order to load a model in the repository, it is needed to:
- create a MOF extent using the task <mdr.instantiate> with just a name attribute provided to name the extent. For example:
<mdr.instantiate name=”extent-name” />
- load in the MOF extent the meta-model using the <mdr.read.xmi> with the extent name provided and the URI of the file name of the meta-model to load.
- The URI is used when loading the meta-model file trough a class loader, i.e. expected to find it in classpath.
- The file is used when loading the meta-model file from the local file system
<mdr.read.xmi extent=”extent-name” uri=”uml13/01-12-02_Diff_modelant.xml”/>
- instantiate the root MOF package where to load the model, using the <mdr.instantiate> with the extent attribute and the qualified name of the meta-model package that represents the model repository. The name attribute gives the name of the mode-specific repository. For example:
<mdr.instantiate extent=”extent-name” package=”UML”
- load the model in the model-specific repository. For example:
<mdr.read.xmi extent=”repository-name” file=”model-file”/>
NOTE: By convention the meta-model components of ModelAnt provide specific simplified macros