AndroMDA Configuration

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.

Example

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 xmlns="http://andromda.org/core/configuration">
    <properties>
        <property name="modelValidation">true</property>
        <property name="cartridgeFilter">${filter}</property>
    </properties>
    <server>
        <host>localhost</host>
        <port>4446</port>
    </server>
    <repositories>
        <repository name="netBeansMDR">
            <models>
                <model>
                    <uri>jar:file:/path/to/my/model.zuml!/modelUri1.xmi</uri>
                    <moduleSearchLocations>
                        <location patterns="*.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>
                        <transformation output="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>
        <location patterns="*.xml">/path/to/mappings</location>
    </mappingsSearchLocations>
    <namespaces>
        <namespace name="default">
            <properties>
                <property name="languageMappingsUri">Java</property>
                <property name="wrapperMappingsUri">JavaWrapper</property>
                <property name="sqlMappingsUri">${sql.mappings}</property>
                <property name="jdbcMappingsUri">JDBC</property>
                <property name="maxSqlNameLength">30</property>
                <property name="foreignKeySuffix">_FK</property>
                <property name="ejbJndiNamePrefix">${application.id}</property>
            </properties>
        </namespace>
        <namespace name="spring">
            <properties>
                <property name="dataSource">${dataSource}</property>
                <property name="hibernateDialect">${hibernate.db.dialect}</property>
                <property name="hibernateShowSql">${hibernate.db.showSql}</property>
                <property name="hibernateUseQueryCache">false</property>
                <property name="hibernateQueryUseNamedParameters">true</property>
                <property name="hibernateCacheProvider">net.sf.hibernate.cache.EhCacheProvider</property>
                <property name="hibernateInheritanceStrategy">${hibernate.inheritance.strategy}</property>
                <property name="hibernateQueryCacheFactory">net.sf.hibernate.cache.StandardQueryCacheFactory</property>
                <property name="springTypesPackage">${application.package}</property>
                <property name="daos">${maven.andromda.core.generated.dir}</property>
                <property name="dao-impls">${maven.andromda.core.manual.dir}</property>
                <property name="spring-configuration">${maven.andromda.core.generated.dir}</property>
                <property name="services">${maven.andromda.core.generated.dir}</property>
                <property name="service-impls">${maven.andromda.core.manual.dir}</property>
                <!-- to remove any dependency on EJB, comment the following property -->
                <property name="session-ejbs">${maven.andromda.core.generated.dir}</property>
                <!-- uncomment to enable EJB security -->
                <!-- <securityRealm>${application.id}</securityRealm> -->
            </properties>
        </namespace>
        <namespace name="hibernate">
            <properties>
                <property name="hibernateTypeMappingsUri">Hibernate</property>
                <property name="hibernateInheritanceStrategy">${hibernate.inheritance.strategy}</property>
                <property name="defaultHibernateGeneratorClass">${hibernate.generatorClass}</property>
                <property name="hibernateDefaultCascade">none</property>
                <property name="entities">${maven.andromda.core.generated.dir}</property>
                <property name="entity-impls">${maven.andromda.core.manual.dir}</property>
                <property name="entity-mappings">${maven.andromda.core.generated.dir}</property>
                <property name="user-types">${maven.andromda.core.generated.dir}</property>
                <property name="customTypesPackage">${application.package}</property>
                <property name="compositionDefinesEagerLoading">true</property>
            </properties>
        </namespace>
        <namespace name="webservice">
            <properties>
                <property name="schemaTypeMappingsUri">AxisWSDLMappings</property>
                <property name="languageMappingsUri">AxisJavaMappings</property>
                <property name="defaultProvider">RPC</property>
                <property name="applicationName">${application.id}</property>
                <property name="wsdlSoapAddress">${wsdl.soap.address}</property>
                <property name="wsdls">${maven.andromda.webservice.generated.dir}/wsdl</property>
                <property name="rpcClassNamePattern">{0}.{1}WSDelegator</property>
                <property name="axis-configuration">${maven.andromda.webservice.generated.dir}/axis</property>
            </properties>
        </namespace>
        <namespace name="java">
            <properties>
                <property name="languageMappingsUri">AxisJavaMappings</property>
                <property name="useArraysForMultiplicitiesOfTypeMany">true</property>
                <property name="enumerations">${maven.andromda.common.generated.dir}</property>
                <property name="exceptions">${maven.andromda.common.generated.dir}</property>
                <property name="value-objects">${maven.andromda.common.generated.dir}</property>
            </properties>
        </namespace>
        <namespace name="bpm4struts">
            <properties>
                <property name="forms">${maven.andromda.web.generated.dir}</property>
                <property name="pages">${maven.andromda.web.generated.dir}</property>
                <property name="actions">${maven.andromda.web.generated.dir}</property>
                <property name="controllers">${maven.andromda.web.generated.dir}</property>
                <property name="controller-impls">${maven.andromda.web.manual.java.dir}</property>
                <property name="decorators">${maven.andromda.web.manual.java.dir}</property>
                <property name="messages">${maven.andromda.web.generated.dir}/WEB-INF/classes</property>
                <property name="configuration">${maven.andromda.web.generated.dir}/WEB-INF</property>
                <property name="security">false</property>
                <property name="securityRealm">other</property>
                <property name="serviceAccessorPattern">${application.package}.ServiceLocator.instance().get{1}()</property>
                <property name="manageableServiceAccessorPattern">${application.package}.ManageableServiceLocator.instance().get{1}()</property>
            </properties>
        </namespace>
    </namespaces>
</andromda>
                

<andromda xmlns="http://andromda.org/core/configuration">

The andromda element is the root of the configuration file.

<properties>

The properties element allows you to set properties that gobally configure AndroMDA. Here's an example of how the <properties> element is structured.

<andromda xmlns="http://andromda.org/core/configuration">
    <properties>
        <property name="modelValidation">true</property>
        <property name="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.
failOnValidationErrors Specifies whether or not model processing should fail when ANY model validation errors are present. No, defaults to true.
cartridgeFilter A comma separated 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

<server>

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 xmlns="http://andromda.org/core/configuration">
    ...
    <server>
        <host>localhost</host>
        <port>4446</port>
        <loadInterval>1000</loadInterval>
        <maximumFailedLoadAttempts>10</maximumFailedLoadAttempts>
    </server>
    ...
</andromda>
                    

<host>

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>
                        

<port>

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>
                        

<loadInterval>

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>
                        

<maximumFailedLoadAttempts>

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>

<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 xmlns="http://andromda.org/core/configuration">
    ...
    <repositories>
        <repository name="netBeansMDR">
            <models>
                <model lastModifiedCheck="true">
                    <uri>file:/path/to/models/model1.xmi</uri>
                    <moduleSearchLocations>
                        <location patterns="*.xmi, *.xml.zip">/path/to/modules</location>
                        <location>/path/to/more/modules</location>
                    </moduleSearchLocations>
                    <modelPackages>
                        <modelPackage process="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>
        <repository name="EMF">
            ...
        </repository>
        ...
    </repositories>
    ...
</andromda>
                    

<repository>

The required <repository/> element is used to tell AndroMDA what repository to use when processing one or more models.

<repositories>
    <repository name="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

<models>

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>
        <model lastModifiedCheck="true">
            <uri>file:/path/to/models/model1.xmi</uri>
            <moduleSearchLocations>
                <location patterns="*.xmi, *.xml.zip">/path/to/modules</location>
                <location>/path/to/more/modules</location>
            </moduleSearchLocations>
            <modelPackages>
                <modelPackage process="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>
    ...

                    

Model

<model>

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.

Models

<uri>

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>
                        

Transformations

<transformations>

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 xmlns="http://andromda.org/core/configuration">
    ...
    <model>
        ...
        <transformations>
            <transformation output="path/to/some/directory/transformed-model.xmi"><uri>file:transformation1.xsl</uri></transformation>
            <transformation><uri>file:transformation2.xsl</uri></transformation>
       </transformations>
        ...
    </model>
    ...
</andromda>
                    

Transformation

<transformation>

The <transformation/> is a required element used to tell AndroMDA to apply an XSL transformation to the model(s) before modeling processing occurs. Note, that as many transformations can be specified as you like, the transformations will be applied in the order that they are specified in your andromda.xml. Also note that any imports are assumed to be relative to the transformation itself.

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

Uri

<uri>

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>
                            

ModuleSearchLocations

<moduleSearchLocations>

The moduleSearchLocations element defines the locations of one or more external modules or profiles (i.e. HREFs) that a model may reference.

<model>
    ...
    <moduleSearchLocations>
        <location patterns="*.xmi, *.xml.zip">/path/to/modules</location>
        <location>/other/path/to/modules</location>
    </moduleSearchLocations>
</model>
                        

ModelPackages

<modelPackages>

Groups the nested modelPackage elements that define which packages should and should not be processed by AndroMDA within the given model.

<model>
    ...
    <modelPackages processAll="false">
        <modelPackage process="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.

ModelPackage

<modelPackage>

The optional <modelPackage> is used in conjunction with the processAll attribute of the <modelPackages> element. By default all packages are processed. Therefore it is recommended to turn off the packages which should be not processed. In other words, if you don't want to generate code from a certain package of a model, then you can create a modelPackage for that package, set the process attribute to false, and any model elements in that package will not be processed.

Note that you can use wild card matching within the modelPackage element. For example:

<modelPackages>
...
<modelPackage process="false">my::package::bar::*</modelPackage>
<modelPackage process="false">my::package::bar**</modelPackage>
...
</modelPackages>
                    
Attribute Description Required
process True or false depending on whether or not the package should be processed. No. Defaults to true.

Example

The below example demonstrates the correct use of the <modelPackage> element:

<modelPackages>
  ...
    <modelPackage>my::package::foo</modelPackage>
    <modelPackage process="false">my::package::bar</modelPackage>
  ...
</modelPackages>

The above is equivalent to:

<modelPackages>
  ...
    <modelPackage process="false">my::package::bar</modelPackage>
  ...
</modelPackages>
                        

Constraints

<constraints>

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>
    ...
    <constraints enforceAll="true">
        <constraint enforce="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.

Constraint

<constraint>

The optional <constraint> is used in conjunction with the enforceAll attribute of the <constraints> element. By default all constraints are enforced (unless model validation is completely turned off). Therefore it is recommended to turn off the constraints which should be not enforced. In other words, if you don't want to enforce a constraint applied to a certain context element, then you can create a constraint element for that context element and constraint name, and set the enforce attribute to false, and any constraint(s) matching that name will not be enforced.

Note that you can use wild card matching within the constraint element. For example:

<constraints>
    ...
    <constraint enforce="false">my::package::bar::SomeClass::*</constraint>                                
    <constraint enforce="false">my::package::bar**</constraint>
    <constraint enforce="false">my::package::bar::SomeClass::a constraint**</constraint>
    ...
</constraints>                                
                        
Attribute Description Required
enforce True or false depending on whether or not the constraint should be enforced. No. Defaults to true.

Example

The below example demonstrates the correct use of the <constraint> element:

<constraints>
    ...
    <constraint>my::package::foo</constraint>
    <constraint enforce="false">my::package::bar**</constraint>
    ...
</constraints>

The above is equivalent to:

<constraints enforceAll="false">
    ...
    <constraint enforce="true">my::package::foo</constraint>
    ...
</constraints>
                    

MappingsSearchLocations

<mappingsSearchLocations>

The <andromda xmlns="http://andromda.org/core/configuration"> 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 xmlns="http://andromda.org/core/configuration">
    ...
    <mappingsSearchLoations>
        <location patterns="*.xml">/path/to/mappings</location>
    </mappingsSearchLocations>
    ...
</andromda>
                

Example

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 xmlns="http://andromda.org/core/configuration">
    <model><uri>jar:file:/path/to/my/model.zuml!/model.xmi</uri><model>
    <mappingsSearchLocations>
        <location patterns="*.xml">/path/to/mappings</location>
        <location>/path/to/more/mappings</location>
    </mappingsSearchLocations>
    ...
    <namespace name="hibernate">
        <property name="jdbcMappingsUri">JDBC</property>
        <property name="sqlMappingsUri">HypersonicSql</property>
        ...
    </namespace>
    ...
</andromda>
                

Namespaces

<namespaces>

The <andromda xmlns="http://andromda.org/core/configuration"> element takes a nested <namespaces> element in order to customize the properties of one or more namespaces (i.e. plugins).

<andromda xmlns="http://andromda.org/core/configuration">
   ...
    <namespaces>
       ...
    </namespaces>
    ...
</andromda>
                            

Namespace

<namespace>

The <namespace> element is used to do two things:

  1. Activate a cartridge (if a cartridge resides within the given namespace)
  2. Customize the properties of a plugin (cartridge, translation-library, etc). These properties can be used to define the location to which generated files are written, what mapping files to use for different language typee (i.e. JavaMappings.xml, DotNetMappings.xml, etc.), and any other aspect that a property might be used to configure.

This example here activates the webservice cartridge, and configures it:

<namespaces>
    <namespace name="webservice">
        <properties>
            <property name="schemaTypeMappingsUri">AxisWSDLMappings</property>
            <property name="languageMappingsUri">AxisJavaMappings</property>
            <property name="defaultProvider">RPC</property>
            <property name="applicationName">${application.id}</property>
            <property name="wsdlSoapAddress">${wsdl.soap.address}</property>
            <property name="wsdls">${maven.andromda.webservice.generated.dir}/wsdl</property>
            <property name="rpcClassNamePattern">{0}.{1}WSDelegator</property>
            <property name="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>
    <namespace name="default">
        <properties>
            <property name="languageMappingsUri">Java</property>
            <property name="wrapperMappingsUri">JavaWrapper</property>
            <property name="sqlMappingsUri">${sql.mappings}</property>
            <property name="jdbcMappingsUri">JDBC</property>
            <property name="maxSqlNameLength">30</property>
            <property name="foreignKeySuffix">_FK</property>
            <property name="ejbJndiNamePrefix">${application.id}</property>
        </properties>
    </namespace>
    ...
</namespaces>

                    

Properties

<properties>

The properties is used to group the properties that configure the options within a namespace/plugin.

<namespace name="webservice">
    <properties>
        ...
    </properties>
</namespace>
                    

Property

<property>

The optional property is used to configure an option within a namespace/plugin. For example this property here sets the schemaTypeMappingsUri with a value of 'AxisWSDLMappings'.

<properties>
    ...
    <property name="schemaTypeMappingsUri">AxisWSDLMappings</property>
    ...
</properties>
                    

Attributes

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.