Advanced functionalities

author : Florian Desbois, Jean Couteau
contact : or
revision : $Revision$
date : $Date$

This chapter concerns EUGene advanced functionalities, i.e. how to extend EUGene to adapt it to another model than the ObjectModel or how to extend the ObjectModel using extensions.

EUGene can be extended on the four basic notions :

  • Writer : file to file conversion

  • ModelReader : file to model conversion

  • Transformer : model to model conversion (see Templates )

  • Generator : model to file conversion (see Templates )

The Extensions also allow to enrich EUGene basic model : ObjectModel.


EUGene manage by default the following input formats :

  • xmi : standard file for UML modeling language. Versions 1.2 and 2.1 are supported by EUGene

  • zargo : ArgoUML file (xmi 1.2)

  • zuml : TopCased file (xmi 2.1 voir 3.0)

  • objectmodel : xmi simplified version to generate ObjectModel

  • statemodel : xmi simplified version to generate StateModel

A writer is defined by :

  • a model type (objectmodel, statemodel)

  • an input protocol

  • an output protocol

  • resources to process

  • the task execution logic

The writers can be chained (the output protocol becomes the input protocol of the following Writer) and this in a hierarchical way (we have to keep an order on the tasks to execute...).

For example, if we have a zargo file input and we want java files, the following steps are necessary :

  • extract xmi file from zargo archive

  • xmi transformation to an objectmodel file

  • templates application and java file generation from objectmodel

Each of those steps uses a writer :

  • zargo2xmi (input: zargo, output: xmi)

  • xmi2objectmodel (input: xmi, output: objectmodel)

  • objectmodel2java (input: objectmodel, output: file (java or other))

To use Writers' execution engine, we need to save its resources to process. It will find the right Writers to call amongst those available and will launch the tasks (Writer) in the correct order.

If, for example, we give him an objectmodel file, it will only call the last writer (objectmodel2java).


Ref ModelReader

The ModeLReader allows to load a Model from files. It's used by EUGene's execution to read some input files and fill the corresponding model. The two ModelReader available are :

It is possible to manage other input file formats and manipulate them using a new ModelReader that you will need to create inheriting from the basis ModelReader. It is also possible to manage another type of Model and to create a ModelReader that will fill it in.

The maven plugin allows to specify which reader to use. For more informations consult the maven goals configuration.


EUGene mainly manipulates ObjectModel. This model gives 90% of the necessary functionalities to numerous output files generation whatever the programming language might be. Meanwhile some specificities of those languages might block the usage of ObjectModel and lead the developer to create a new model finally really close to the existing ObjectModel.

The idea is so to extend the ObjectModel by extensions not to interfere with its main goal : provide classes representing UML norm.

The root ObjectModel allows the recovery of an extension with a unique reference. If the extension does not exists, it will be automatically created. You have to use the ObjectModel interface to do so:

<O> O getExtension(String reference, Class<O> extensionClass)
                throws ClassCastException, IllegalArgumentException;

You just have to attach any class to the model to ba able to manipulate it as an extension. The aim being to recover it at any step of the generation process (reader, transformer, generator).

For Java, three extensions have been created :

It is possible to describe tag values you can use on your models. See TagValueDefinitionProvider

It is possible to describe stereotypes you can use on your models. See StereotypeDefinitionProvider