Module development structure

A Module is a set of Java, XML and resource files preferably organized in an Eclipse project, before being packaged in a compressed archive (.jmdac). This file can be deployed in user projects and executed in Modelio.

Maven development structure

A Maven Archetype for module developement project is available in the modelio public repository.

          http://repository.modelio.org

          <groupId>org.modelio</groupId>
          <artifactId>modelio-module-archetype</artifactId>
          <version>2.2.1.01</version>

The structure is presented in Illustration 1: Maven Module structure. It is basically an Eclipse Maven project with a conf directory containing all the elements that are specific to the Modelio module and should be packaged with it. The driving files are :

  1. pom.xml: is a Maven build file used to compile and package the module into a jmdac file;
  2. src/main/conf/module.xml: contains all the declarations of Modelio module objects such as the module, profiles, stereotypes, tag and note types, commands and module parameters. Must be valid according to the mdac_module.xsd XSD shema.
  3. src/main/conf/module*.properties which contains the mandatory resources required by the module. It contains mainly the pretty names and the descriptions of the module and module elements (commands, annotations, etc). As a standard Java property file, one file per language is supported.

Beside these files, some directories require comments : * src/main/conf/res: contains the resources of the module elements (icons, etc)


Illustration 1: Maven Module structure

Ant development structure

The template of a module development project can be retrieved here.

When uncompressed, the structure is presented Illustration 2: Ant Module structure. It is basically an Eclipse Java project with a Modelio directory that contains all the elements that are specific to Modelio module and should be packaged with it. The driving files are :

  1. TemplateModuleProject.xml: is an ant build file used to compile and package the module into an jmdac file;
  2. module.xml: contains all the declarations of Modelio module object such as the module, profiles, stereotypes, tag and note types, commands and module parameters. Must be valid according to the mdac_module.xsd XSD shema.
  3. module*.properties which contains the mandatory resources required by the module. It contains mainly the pretty names and the descriptions of the module and module elements (commands, annotations, etc). One file per language supported.

Beside these files, some directories require comments :

  • resources/lib: Beside the jar file of the module being developed it contains all jar files required by the module that should be packaged into the jmdac file.
  • resources/res: contains the resources of the module elements (icons, etc)
  • peerlib: contains the jar of the external modules whose peer is used by the current module. More on peer in section 4.3.6
  • mdac: contains jmdac file after being produced by the ant package task.


Illustration 2: Ant Module structure

Migration of an Ant development structure to Maven development structure

We now recommend using Maven to compile and package Module development projects. This section describes how to migrate an Ant Module development project to Maven Module development project.

  • Create a new Maven project development using the Modelio Module Archetype available in modelio public repository.
    • Use the same name and version as defined in the Ant project.

  • Copy all files from the old Ant project to the new Maven project.
    • src directory to src/main/java directory.
    • module.xml & module*.properties to src/main/conf directory.
    • resource directory to src/main/conf/res directory.

  • Copy java resource(resource file directly include in source path) to src/main/resources/*/ directory
    • /source/i18n/messages*.properties to src/main/resources/i18n** directory.

  • In module.xml file , replace the values of the module properties name and version by ${project.artifactId} and ${project.version}

    <module name="${project.artifactId}"
            version="${project.version}.8021"
            binaryversion="2.2.01.8021"
            licenseRequired="false"
            class="org.modelio.***">
    

module_strcture.png (14.5 KB) admin admin, 05 March 2012 17:35

maven_module_structure.png (12.6 KB) Antonin Abhervé, 01 June 2012 10:29

Also available in: PDF HTML TXT