Why make donate
google analytics

ObjectModel

authors : Arnaud Thimel
Florian Desbois
Jean Couteau
contact : eugene-devel@list.nuiton.org or eugene-users@list.nuiton.org
revision : 1079
date : 2011-06-28 11:15:23 +0200 (Tue, 28 Jun 2011)
Note

This document does not take into account modifications made on EUGene 2.0 version

TODO : revoir cette documentation

Introduction

ObjectModelGenerator generator is aimed to read and analyse object models and generate code from them. In UML, an object model is represented by a class diagram. This object models vision being wildly spread, it is ObjectModelGenerator's basis (please note that this is not mandatory).

Let start from the principle that we got a model (class diagram) created from an XMI (XML Metadata Interchange format modeling tool.

Code generation is made into three steps :

XMI model purification

Most of the modelign tools describe their models using XMI, but XMI is too verbose to be easily understood.

Eugene uses XSLT transformation allowing to get a purified XML describing the model and keeping the main information.

This intermediate model insure EUGene's stability and durability as it is always based on its own models and not external models (XMI) that changes too much from a version to another.

If we want to support a new XMI version, for example, we just need to create the appropriate transformation stylesheet.

Amongst the extracted information, we can name :

From the following diagram :

We got the following ObjectModel :

Memory model

Once XMI has been changed into an understandable XML, the model is loaded into memory so that it is generated.

The instanciated model is based on the following class diagram (meta-model) :

Available interfaces for the generators are the following :

ObjectModelGenerator :

Templates application

Each template is itself a generator inheriting from ObjectModelGenerator. All the parts of this generator can be overloaded allowing a strong personalisation of the generators. ObjectModelGenerator's aim is to navigate through the model and on each key element of the model (model, classes, interfaces, classifier, ...) call the appropriate methods. By default, the methods described in the generator are empty, so no code is generated. The templates are aimed to overload those methods and describe the code that will be generated.

The templates can be of all kind because they can generate a different file by model, by interface, by class or even by classifier (common stub to classes and interfaces). Moreover, they can generate every kind of code what so ever : Java, XML, text, C++, ...

Maven JRst ReStructuredText