SourceForge.net Logo
useitGenerator
simple uml2 generator
Home  >  

Overview

UseitGenerator is a lightweight generator for eclipse uml2 models. It is base on the velocity template engine. It has a simple generation process. You build up a generation Model, and link the generation model to the uml2 models.

So it is possible to reuse the generation model.buildingModel

This is the ecore Model of the builder, as you see, the concrete model resources are encapsulated  by ecore objects, they wrap the resources so they can be easily replaced by another.

There are two kinds of resource containers, one for the building model, and an other for the models.









Prequisite

You need Eclipse 3.2 Calisto to use this plug in. You also need the following additional plugins :

uml2 : can be installed by the main update site

nice to have : a velocity template editor
i prefer
i also like the topcased suite very much

Instructions

In the <windows><show view>dialog you select from the category modelproject the <main model> view. This is the main view to work with.  main model view

In the Project manager you will plug in the building models. You can add a generator model by select <new child><Project Resource> in the context menu of the Projectmanager, and point the filename property to your building model.

You need to create a building model first, this is done by select the UseitGeneratorModel in the section Example EMF Model Creation Wizard.

After linking the build model to your projectmananger, you are able to define your buildmodel, by creating elements as you need, and setup the build environment.

The properties of the elements can be set in the property editor, actions for the elements, like build, open close etc. can be found in the tool bar of the view or in the context menu.

The build environment

build enviorment

a loaded projectThe build enviorment is the container for all model related resources and project settings like the basic generation target container, and the velocity environment settings, macro and lib path.It contains model resources in the Resource container. You can create a new ModelResource and link them to your domain model  (your UML2 model). 

In the SelectionModel you can link uml2 packages from your opened ModelResource. A build model is linked to one of these selections.

In the Template Container you can create template objects and link them to your velocity templates.

the build Model

buildmodelThe buildmodel describes the way the templates get build. A buildmodel can contain other builder. You can let the builder execute it's child build models or not, or if the files should be overwritten in the process if they exist.

A build model is linked to a selection, from witch the builder get the uml2 models.It also can contains n ModelRoles. The Modelroles describes how the provided models by the builder are handled and processed thou the templates.

A modelrole can be linked with a template, but don't have to, they can be also container for other modelroles. The modelroles linked to a template will be build. The role defines the target element scope, the provided model gets expanded to this element type (eg. <Class> , for each class in the selection( it' a package or many), the template get build). expandable Types are

and the expanding can be reclusive. And you can exclude elements from the expanding by define filters, and link them to the modelrole.

As the modelrole is linked to the templates it contains also the infos how and where the generated file get stored. You can select a feature of the expanded element as additional filename part (eg. you expand a model to classes, and take the feature 'name' to generate a java file "<classname>DAO.java" for each class in the model).

The idear behind the model role, are that there are aspects of the programm, there are "roles" for model objects, like factories or panels, in the application. So the templates are lightweight, they are not very generic. I use this generator not to have a generic template witch can render all aspects of the provided context. An application is build from a hole bunch of objects related to each other, so the model roles are classes of aspects(like GUI or POJO), the generator  creates this aspect for each expanded context.

the velocity context

The context provided to the template engine for the model expansion :

The context provided to the template engine for the class expansion :