AndroMDA Namespace

AndroMDA namespace components are described through a single XML descriptor, the namespace.xml file. You'll find this file in a cartridge, translation-library or metafacades jar (basically any component that can reside with a namespace) located in the /META-INF/andromda directory of that jar.

In order for a namespace component to be "discovered" by AndroMDA, it MUST be registered within this descriptor.

There are several purposes of the namespace descriptor:

  1. Allowing discovery of the namespace by AndroMDA when placed on the classpath
  2. Providing registration all components for the namespace
  3. Defining any properties that are used to configure the namespace

Each namespace descriptor must adhere to this XML Schema.

Take a look at how a typlical namespace descriptor is structured in the example below. You'll notice from this example that both the cartridge and metafacades components are defined for the webservice namespace. What this means, is that when AndroMDA "discovers" this namespace, it will know that it needs to register both a cartridge and a set of metafacades under the namespace of webservice (the descriptors for both the cartridge and metafacades will be need to be present in the webservice cartridge jar in order for these to be correctly registered).

You'll also notice that we have plenty of properties defined in this example as well. AndroMDA uses these properties in two ways:

  • The core uses these properties internally (the name of the property, whether or not its required, and its default value)
  • The namespace documentation is generated from these properties (see the BPM4Struts namespace documentation for an example).

Properties are grouped logically according to propertyGroup elements, each with a required name defining what the group of properties configures, and an optional documentation element that describes in more detail what this group of properties does. Each property defines the name of a property that can be configured through a namespace element in the AndroMDA Configuration. Properties defined here are referenced within the namespace component descriptors (in for example: the META-INF/andromda/cartridge.xml and META-INF/andromda/metafacades.xml).

Each property element defines the following aspects about a given property:

  • The name of the property.
  • Whether or not the property is required (the required attribute will determine whether or not AndroMDA will warn you if you do not have the property defined for the specific namespace in your AndroMDA Configuration).
  • The default of the property (if a default should be present).
  • The optional documentation of the property (this is a description of what exactly the property configures within the namespace).

Because of the fact the documentation element is of type xs:anyType you can embed any other xml elements within it.

Namespace Descriptor Example

<namespace name="webservice">
    <components>
        <component name="cartridge">
            <path>META-INF/andromda/cartridge.xml</path>
        </component>
        <component name="metafacades">
            <path>META-INF/andromda/metafacades.xml</path>
        </component>
    </components>
    <properties>
        <propertyGroup name="Outlets">
            <documentation>
                Defines the locations to which output is generated.
            </documentation>
            <property name="wsdls">
                <documentation>
                    Specifies the directory to which generated WSDL's will be placed.
                </documentation>
            </property>
            <property name="java-types">
                <documentation>
                    The directory to which any non implementation Java files will be generated.
                </documentation>
            </property>
            <property name="axis-configuration">
                <documentation>
                    The directory to which any AXIS specific configuration files
                    are generated (such as the WSDD files, etc).
                </documentation>
            </property>
            <property name="axis-tests" required="false">
                <documentation>
                    The directory to which AXIS specific test classes are generated.
                </documentation>
            </property>
            <property name="axis-test-impls" required="false">
                <documentation>
                    The directory to which the AXIS specific test implementation classes are generated.
                </documentation>
            </property>
            <property name="wss4j-configuration" required="false">
                <documentation>
                    The directory to which any <a href="http://ws.apache.org/ws-fx/wss4j/index.html">WSS4J</a>
                    specific configuration files are generated.
                </documentation>
            </property>
        </propertyGroup>
        <propertyGroup name="Other">
            <property name="namespacePrefix">
                <default>impl</default>
                <documentation>
                    Defines the prefix to give to the default namespace.
                </documentation>
            </property>
            <property name="qualifiedNameLocalPartPattern">
                <default>{0}</default>
                <documentation>
                    The pattern to use when a qualified name local part is created.
                    <em>{0}</em> represents the name of the classifier (i.e.
                    <em>WS{0}</em> would give all your types and services a prefix
                    of <em>WS</em>).
                </documentation>
            </property>
            <property name="namespacePattern">
                <default>http://{0}</default>
                <documentation>
                    The pattern to use when a namespace is created.
                    <em>{0}</em> represents the package name of the classifier (i.e.
                    <em>ws.{0}</em> would prefix all your type and service
                    namespaces with <em>ws.</em>).
                </documentation>
            </property>
            ...
        </propertyGroup>
        ...
    </properties>
</namespace>