AndroMDA is configured through a single XML file. This page documents the attributes and element that make up that configuration. Lets first take a look at the contents of a typical configuration file (and then after that we'll go into more detail describing each element and attributes that belong that element).
Each configuration file must adhere to this XML Schema .
This example configuration, tells AndroMDA to load
model(s) from jar:file:/path/to/my/model1.zuml!/model.xmi
and jar:file:/path/to/my/model2.zuml!/model.xmi
and generate code using the spring, hibernate, webservice, java and bpm4struts cartridges. Notice
how we configure each cartridge through the
<namespace>
elements.
<andromda> <properties> <propertyname="modelValidation">true</property> <propertyname="cartridgeFilter">${filter}</property> </properties> <server> <host>localhost</host> <port>4446</port> </server> <repositories> <repositoryname="netBeansMDR"> <models> <model> <uri>jar:file:/path/to/my/model.zuml!/modelUri1.xmi</uri> <moduleSearchLocations> <locationpatterns="*.xml.zip,*.xmi">/path/to/modules</location> </moduleSearchLocations> </model> <model> <uri>file:/path/to/my/model2Uri1.xmi</uri> <uri>file:/path/to/my/model2Uri2.xmi</uri> <transformations> <transformationoutput="path/to/some/directory/transformed-model.xmi"><uri>file:transformation1.xsl</uri></transformation> <transformation><uri>file:transformation2.xsl</uri></transformation> </transformations> </model> </models> </repository> </repositories> <mappingsSearchLocations> <locationpatterns="*.xml">/path/to/mappings</location> </mappingsSearchLocations> <namespaces> <namespacename="default"> <properties> <propertyname="languageMappingsUri">Java</property> <propertyname="wrapperMappingsUri">JavaWrapper</property> <propertyname="sqlMappingsUri">${sql.mappings}</property> <propertyname="jdbcMappingsUri">JDBC</property> <propertyname="maxSqlNameLength">30</property> <propertyname="foreignKeySuffix">_FK</property> <propertyname="ejbJndiNamePrefix">${application.id}</property> </properties> </namespace> <namespacename="spring"> <properties> <propertyname="dataSource">${dataSource}</property> <propertyname="hibernateDialect">${hibernate.db.dialect}</property> <propertyname="hibernateShowSql">${hibernate.db.showSql}</property> <propertyname="hibernateUseQueryCache">false</property> <propertyname="hibernateQueryUseNamedParameters">true</property> <propertyname="hibernateCacheProvider">net.sf.hibernate.cache.EhCacheProvider</property> <propertyname="hibernateInheritanceStrategy">${hibernate.inheritance.strategy}</property> <propertyname="hibernateQueryCacheFactory">net.sf.hibernate.cache.StandardQueryCacheFactory</property> <propertyname="springTypesPackage">${application.package}</property> <propertyname="daos">${maven.andromda.core.generated.dir}</property> <propertyname="dao-impls">${maven.andromda.core.manual.dir}</property> <propertyname="spring-configuration">${maven.andromda.core.generated.dir}</property> <propertyname="services">${maven.andromda.core.generated.dir}</property> <propertyname="service-impls">${maven.andromda.core.manual.dir}</property><!-- to remove any dependency on EJB, comment the following property --><propertyname="session-ejbs">${maven.andromda.core.generated.dir}</property><!-- uncomment to enable EJB security --><!-- <securityRealm>${application.id}</securityRealm> --></properties> </namespace> <namespacename="hibernate"> <properties> <propertyname="hibernateTypeMappingsUri">Hibernate</property> <propertyname="hibernateInheritanceStrategy">${hibernate.inheritance.strategy}</property> <propertyname="defaultHibernateGeneratorClass">${hibernate.generatorClass}</property> <propertyname="hibernateDefaultCascade">none</property> <propertyname="entities">${maven.andromda.core.generated.dir}</property> <propertyname="entity-impls">${maven.andromda.core.manual.dir}</property> <propertyname="entity-mappings">${maven.andromda.core.generated.dir}</property> <propertyname="user-types">${maven.andromda.core.generated.dir}</property> <propertyname="customTypesPackage">${application.package}</property> <propertyname="compositionDefinesEagerLoading">true</property> </properties> </namespace> <namespacename="webservice"> <properties> <propertyname="schemaTypeMappingsUri">AxisWSDLMappings</property> <propertyname="languageMappingsUri">AxisJavaMappings</property> <propertyname="defaultProvider">RPC</property> <propertyname="applicationName">${application.id}</property> <propertyname="wsdlSoapAddress">${wsdl.soap.address}</property> <propertyname="wsdls">${maven.andromda.webservice.generated.dir}/wsdl</property> <propertyname="rpcClassNamePattern">{0}.{1}WSDelegator</property> <propertyname="axis-configuration">${maven.andromda.webservice.generated.dir}/axis</property> </properties> </namespace> <namespacename="java"> <properties> <propertyname="languageMappingsUri">AxisJavaMappings</property> <propertyname="useArraysForMultiplicitiesOfTypeMany">true</property> <propertyname="enumerations">${maven.andromda.common.generated.dir}</property> <propertyname="exceptions">${maven.andromda.common.generated.dir}</property> <propertyname="value-objects">${maven.andromda.common.generated.dir}</property> </properties> </namespace> <namespacename="bpm4struts"> <properties> <propertyname="forms">${maven.andromda.web.generated.dir}</property> <propertyname="pages">${maven.andromda.web.generated.dir}</property> <propertyname="actions">${maven.andromda.web.generated.dir}</property> <propertyname="controllers">${maven.andromda.web.generated.dir}</property> <propertyname="controller-impls">${maven.andromda.web.manual.java.dir}</property> <propertyname="decorators">${maven.andromda.web.manual.java.dir}</property> <propertyname="messages">${maven.andromda.web.generated.dir}/WEB-INF/classes</property> <propertyname="configuration">${maven.andromda.web.generated.dir}/WEB-INF</property> <propertyname="security">false</property> <propertyname="securityRealm">other</property> <propertyname="serviceAccessorPattern">${application.package}.ServiceLocator.instance().get{1}()</property> <propertyname="manageableServiceAccessorPattern">${application.package}.ManageableServiceLocator.instance().get{1}()</property> </properties> </namespace> </namespaces> </andromda>
The andromda element is the root of the configuration file.
The properties element allows you to set properties that gobally configure AndroMDA. Here's an example of how the <properties> element is structured.
<andromda> <properties> <propertyname="modelValidation">true</property> <propertyname="cartridgeFilter">${filter}</property> </properties> ... </andromda>
Here we list the available global properties and what affect they have on the AndroMDA generation process.
Property | Description | Required |
modelValidation | Specifies whether or not models loaded by AndroMDA will be validated. By default models WILL be validated, however sometimes its nice to turn off validation for performance reasons (i.e. you have very large model(s) being processed). |
No, defaults to
true .
|
xmlValidation | Specifies whether or not XML resources loaded by AndroMDA will be validated (such as XML plugin descriptors). Sometimes underlying XML parsers don't support XML Schema validation and in that case, we want to be able to turn it off. |
No, defaults to
true .
|
outputEncoding | Sets the encoding for all resulting model processing output. | No, defaults to the platform default encoding. |
failOnModelValidationErrors | Specifies whether or not model processing should fail when ANY model validation errors are present. |
No, defaults to true .
|
cartridgeFilter |
A comma seperated list of cartridge names (i.e. namespaces) that
should be processed by AndroMDA. If this is not defined, then
ANY discovered cartridges will be processed.
This is useful when you want to restrict the cartridges that will
process the model, in order to speed up the development cycle.
You can also prefix the list of cartridges using the tilde '~' character, that way the cartridges that are *not* listed will be processed (negation). |
No |
loggingConfigurationUri | Specifies the location of an external logging configuration file. This is useful if you want to override the default logging behavior of AndroMDA. | No |
The optional <server> element provides information about the AndroMDA server. The AndroMDA server can be used to initialize AndroMDA and to provide the pre-loading of models. What this means is that initialization, model loading, and model validation does not occur each time you run AndroMDA, but only when your model changes (significantly lowering total model processing time).
<andromda> ... <server> <host>localhost</host> <port>4446</port> <loadInterval>1000</loadInterval> <maximumFailedLoadAttempts>10</maximumFailedLoadAttempts> </server> ... </andromda>
The contents of the required <host> element defines the host of the AndroMDA server instance. This is used by the server's client to connect to the host on which the server instance is running.
<server> <host>localhost</host> ... </server>
The contents of the required <port> element defines the port of the AndroMDA server instance. This is used by the server to indicate what port the server will run on and and the server's client to know on what port it needs to connect.
<server> <host>localhost</host> <port>4446</port> </server>
The contents of this optional element defines the interval (in milliseconds) at which the model should be re-loaded into AndroMDA's repository (loading only occurs if model is out-of-date). By default this value is set to 1000 (or 1 second).
<server> ... <port>4446</port> <loadInterval>1000</loadInterval> </server>
The contents of this optional element defines the maximum number of failed model loading attempts that may occur before a failure is reported by AndroMDA. By default this value is set to 10.
<server> ... <loadInterval>1000</loadInterval> <maximumFailedLoadAttempts>10</maximumFailedLoadAttempts> </server>
<repositories> aggregates all repository elements and is used to to tell AndroMDA what repository(s) to use when processing a model. Here's an example of what the <repositories> element might contain.
<andromda> ... <repositories> <repositoryname="netBeansMDR"> <models> <modellastModifiedCheck="true"> <uri>file:/path/to/models/model1.xmi</uri> <moduleSearchLocations> <locationpatterns="*.xmi, *.xml.zip">/path/to/modules</location> <location>/path/to/more/modules</location> </moduleSearchLocations> <modelPackages> <modelPackageprocess="false">org::andromda::metafacades::uml</modelPackage> <modelPackage>org::andromda::cartridges::test</modelPackage> </modelPackages> </model> <model><uri>file:/path/to/models/model2.xmi</uri></model> </models> <repository> <repositoryname="EMF"> ... </repository> ... </repositories> ... </andromda>
The required <repository/>
element is used to tell AndroMDA what repository to use when processing one or
more models.
<repositories> <repositoryname="netBeansMDR"> ... </repository> ... </repositories>
Attribute | Description | Required |
name | This is the name of an available repository, repositories are namespace components discovered and made available by placing them on the classpath. | Yes |
The <models> element that is used to provide the information necessary for AndroMDA to process one or more model(s). Here's an example of what the <models> element might contain.
... <models> <modellastModifiedCheck="true"> <uri>file:/path/to/models/model1.xmi</uri> <moduleSearchLocations> <locationpatterns="*.xmi, *.xml.zip">/path/to/modules</location> <location>/path/to/more/modules</location> </moduleSearchLocations> <modelPackages> <modelPackageprocess="false">org::andromda::metafacades::uml</modelPackage> <modelPackage>org::andromda::cartridges::test</modelPackage> </modelPackages> </model> <model><uri>file:/path/to/models/model2.xmi</uri></model> </models> ...
The required <model/>
element is used to tell AndroMDA what model it needs to process
<models> <model> ... </model> </models>
Attribute | Description | Required |
lastModifiedCheck | This turns on or off the ability to check the last modified date on files in order to determine whether or not they need to be re-rendered or not. The value of this attribute can be "true" or "false". By default, it is false, meaning that AndroMDA will run regardless of what the last modifed date may be. When set to true, this helps to accelerate the build because AndroMDA will not re-process models that have not changed. |
No, defaults to false .
|
The contents of the required uri element is used to define the URI of one or more files that make up the model.
<model> <uri>file:/path/to/models/model1Uri1.xmi</uri> <uri>file:/path/to/models/model1Uri2.xmi</uri> ... </model>
The <transformations> in an optional element of the model aggregating the XSL transformations that will be applied to the model before model processing begins (they are applied in the order in which they are listed). Here's an example of what the <transformations> element might contain.
<andromda> ... <model> ... <transformations> <transformationoutput="path/to/some/directory/transformed-model.xmi"><uri>file:transformation1.xsl</uri></transformation> <transformation><uri>file:transformation2.xsl</uri></transformation> </transformations> ... </model> ... </andromda>
Attribute | Description | Required |
output | The location to which the result of the output will be written. This is useful for debugging purposes, or if you need to "fix" your model with a transformation. | No |
The contents of the required uri element is used to define the location of the transformation.
<transformation> <uri>file:/path/to/transformations/transformation2.xsl</uri> </transformation>
The moduleSearchLocations element defines the locations of one or more external modules or profiles (i.e. HREFs) that a model may reference.
<model> ... <moduleSearchLocations> <locationpatterns="*.xmi, *.xml.zip">/path/to/modules</location> <location>/other/path/to/modules</location> </moduleSearchLocations> </model>
Groups the nested modelPackage elements that define which packages should and should not be processed by AndroMDA within the given model.
<model> ... <modelPackagesprocessAll="false"> <modelPackageprocess="true">some::package::to::process</location> </modelPackages> ... </model>
Attribute | Description | Required |
processAll |
Specifies whether or not to process/generate from all packages
in the model, used in combination with the
<modelPackage>
element.
|
No, defaults to
true .
|
Attribute | Description | Required |
process | True or false depending on whether or not the package should be processed. |
No. Defaults to
true .
|
Groups the nested constraint elements that define which validation constraints should and should not be enforced by AndroMDA within the given model. This is useful when you want to turn on/off different constraints.
<model> ... <constraintsenforceAll="true"> <constraintenforce="false">some::package::to::ignore::constraints::SomeClass::some constraint name</constraint> </constraints> ... </model>
Attribute | Description | Required |
enforceAll |
Specifies whether or not to enforce constraints within
the model, used in combination with the
<constraint>
element.
|
No, defaults to
true .
|
Attribute | Description | Required |
enforce | True or false depending on whether or not the constraint should be enforced. |
No. Defaults to true .
|
The
<andromda>
element takes an optional <mappingsSearchLocations>
element in order
to define the location of AndroMDA mapping files. This allows us to use the logical
names for the
location of mapping files (instead of the complete path).
Please Note: The logical name is the value of the name attribute within an the actual mappings file on the <mappings/> element.
<andromda> ... <mappingsSearchLoations> <locationpatterns="*.xml">/path/to/mappings</location> </mappingsSearchLocations> ... </andromda>
We want to define the location of the mapping files so that we can
reference the logical name of mapping, files therefore we create a
<mappingsSearchLocations>
element pointing to
the locations that contain our AndroMDA mapping files.
Note that now we are able to use logical names such as JDBC
and HypersonicSql
instead of the complete paths.
<andromda> <model><uri>jar:file:/path/to/my/model.zuml!/model.xmi</uri><model> <mappingsSearchLocations> <locationpatterns="*.xml">/path/to/mappings</location> <location>/path/to/more/mappings</location> </mappingsSearchLocations> ... <namespacename="hibernate"> <propertyname="jdbcMappingsUri">JDBC</property> <propertyname="sqlMappingsUri">HypersonicSql</property> ... </namespace> ... </andromda>
The
<andromda>
element takes a nested <namespaces>
element in order to customize
the properties of one or more namespaces (i.e. plugins).
<andromda> ... <namespaces> ... </namespaces> ... </andromda>
The <namespace>
element is used to do two things:
<namespaces> <namespacename="webservice"> <properties> <propertyname="schemaTypeMappingsUri">AxisWSDLMappings</property> <propertyname="languageMappingsUri">AxisJavaMappings</property> <propertyname="defaultProvider">RPC</property> <propertyname="applicationName">${application.id}</property> <propertyname="wsdlSoapAddress">${wsdl.soap.address}</property> <propertyname="wsdls">${maven.andromda.webservice.generated.dir}/wsdl</property> <propertyname="rpcClassNamePattern">{0}.{1}WSDelegator</property> <propertyname="axis-configuration">${maven.andromda.webservice.generated.dir}/axis</property> </properties> </namespace> ... </namespace>
A special default namespace exists which is different than a regular namespace, properties that you place in this namespace are available to *ALL* namespace components. For example: you'd want to define a property in this namespace when you want a property to apply to all cartridges.
<namespaces> <namespacename="default"> <properties> <propertyname="languageMappingsUri">Java</property> <propertyname="wrapperMappingsUri">JavaWrapper</property> <propertyname="sqlMappingsUri">${sql.mappings}</property> <propertyname="jdbcMappingsUri">JDBC</property> <propertyname="maxSqlNameLength">30</property> <propertyname="foreignKeySuffix">_FK</property> <propertyname="ejbJndiNamePrefix">${application.id}</property> </properties> </namespace> ... </namespaces>
The properties is used to group the properties that configure the options within a namespace/plugin.
<namespacename="webservice"> <properties> ... </properties> </namespace>
The optional propertiy is used to configure an option within a namespace/plugin. For example this property here sets the schemaTypeMappingsUri with a value of 'AxisWSDLMappings'.
<properties> ... <propertyname="schemaTypeMappingsUri">AxisWSDLMappings</property> ... </properties>
Attribute | Description | Required |
name | The name of the property to configure | Yes |
ignore | A flag indicating whether or not the property should be ignored. | No, unless for some reason you want AndroMDA to ignore the fact that the property isn't defined. This is useful in cases where a property might be marked as required for a namespace, however in your case its not needed. |