MOLA Tool Architecture
MOLA
Tool is designed as a freeware
tool for supporting research and development in the MDA and MDSD areas.
Currently the second version of MOLA Tool (MOLA2 Tool) is
under development. The development of first version MOLA Tool (MOLA1 Tool)
has been completed. The bootstrapping idea is used for the development
of MOLA2 Tool - MOLA itself is used to develop the MOLA2 Tool.
Accordingly to bootstrapping methodology
the development of MOLA2 Tool is divided into two stages.
First stage -
development of initial MOLA2 Tool version, MOLA2i Tool.
MOLA2i Tool is built on the basis of existing Graphical Editors for
MOLA1 Tool. All components of MOLA2i Tool use metamodel-based in-memory
repository built by University of Latvia, IMCS. Lx
transformation languages
also built by IMCS are used for MOLA compilation, namely, MOLA is being
compiled to L0 language. The L0 compiler generates C++/Java code which is
compiled then to an executable (which runs on a repository containing
the respective source and target metamodels). MOLA2i Tool implements a
subset of MOLA language (MOLA2 initial). The main purpose of MOLA2i
Tool is to create executable transformations for a second stage of
development. MOLA2i Tool can be used, of course, for other purposes
too. The main components of MOLA2i Tool are:
- Graphical editor for
metamodel and MOLA diagrams built on the basis of Generic Modeling Framework,
a commercial metamodel based modeling environment developed by
University of Latvia, IMCS together with the Exigen company.
- Model
transformation compilers: MOLA
compiler creates L3 language program model, L3 compiler creates
L0 code and L0 compiler
creates C++/Java code.
- C++/Java compiler which
compiles C++/Java code to executable.
- MOLA repository -
metamodel-based in-memory repository developed by University of Latvia,
IMCS
Second stage
- development of the final MOLA2 Tool version, MOLA2 Tool. MOLA2
Tool uses the same repository and compilation schema as the initial
version, but it is built using a methodology being developed by IMCS - the Transformation-based
Tool Framework (TTF), more precisely, the METAclipse framework. The distinction from MOLA2i Tool
is in functionality and architecture of the graphical editor of MOLA.
MOLA2 Tool implements full MOLA language (MOLA2
final). The main components of MOLA2 Tool are:
- Graphical editor for
metamodel and MOLA diagrams built on the basis of METAclipse presentation engine, a plug-in of the metamodel based development platform Eclipse.
- Model transformations
which implement the functionality of the graphical editor. They are
developed using the MOLA2i Tool.
- Metamodel
import/export
features which can fetch a metamodel from various modeling
environments.
- Model
transformation compilers: MOLA
compiler creates L3 language program model, L3 compiler creates
L0 code and L0 compiler
creates C++/Java code.
- C++/Java compilers which
compile C++/Java code to executable
- MOLA repository -
metamodel-based in-memory repository developed by University of Latvia,
IMCS.
MOLA runtime environment consists
of the metamodel-based in-memory repository and the transformation
executable. The repository must contain the respective metamodel (which
also can be built by the MOLA2 Tool). MOLA runtime can be used as a
standalone transformation application, but its main usage is as a
plugin for various modeling environments (tools). Support of JGralab and EMF model repositories is added in the latest version of MOLA2 Tool.
This section provides a more detailed view to MOLA Tool architecture.
The MOLA2i Tool has been developed in the first
stage of development. The first stage of development uses the already
existing components of MOLA1 Tool. The main component is the Graphical editor for metamodel and MOLA diagrams built on the basis of Generic Modeling Framework,
a commercial metamodel based modeling environment developed by
University of Latvia, IMCS together with the Exigen company. The
Graphical editor uses a metamodel-based in-memory repository
where the MOLA Diagrams and the transformation metamodel are stored.
MOLA diagrams and transformation metamodel are models specified by the
MOLA metamodel which is also stored in the repository. In fact, a
repository always contains a metamodel and a model specified by this
metamodel. The reuse of existing components ends here.
The previous version - the MOLA1 Tool used a simple MOLA
compiler to create an internal representation of MOLA program in a
repository where it was executed by the MOLA Virtual Machine - actually
a MOLA interpreter. The MOLA2i Tool, as well as the final version
- MOLA2 Tool obtained in the second development stage, use a true
compiler. A set of compilers is used to obtain an executable of MOLA,
using Lx languages for intermediate representation. The MOLA2i
structure and MOLA program compilation schema are shown in Figure 1.This
section provides a detailed view to MOLA Tool architecture.
Figure 1. MOLA2i Tool structure and MOLA
compilation schema
MOLA is compiled to L3 language. Then L3 is compiled to L0 (in fact all
steps L3 to L2 to L1 to L0 are used) language. Then L0 is translated to
C++ or Java code and finally compiled to an executable. Since L3 compiler is
designed to work with an L3 model (L3 program in the form of a model),
Lx metamodel must also be in the repository along with MOLA metamodel. MOLA compiler
performs MOLA program syntax check, creates an L3 model and converts
the transformation metamodel (Class model) to a "real" domain metamodel
(to be used for specifying domain models in a repository). L3 compiler creates an L0 model from the obtained L3 model. Then L3 compiler converts the created L0 model to an L0 file. L0 compiler
creates C++/Java code (currently Borland C++ Builder project for C++ version). A C++/Java
compiler is used to obtain an executable file (typically dll/jar) from C++/Java
code.
The MOLA2i Tool is used to create transformations for the second stage of development.
The compilation schema of MOLA2 Tool remains the
same as in the case of MOLA2i Tool, but it will be a single step action
from the end user point of view. The main distinction is a new
Graphical Editor. MOLA2 Tool is built using the Transformation-based Tool Framework (TTF) methodology, more precisely - the METAclipse framework. Figure 2 shows the structure of MOLA2 Tool, in fact, it is a schema of the METAclipse framework.
Figure 2. MOLA2 Tool structure - TTF schema
MOLA2 Tool is built on the basis of the METAclipse framework - the plug-in of open source metamodel based
development platform Eclipse. There are three main
components:
- Repository
- the same metamodel-based in-memory repository where the MOLA
metamodel (and an appropriate model - MOLA program), the Lx metamodel
(and an appropriate model - L3 or L0 program) are stored. The
presentation metamodel and mappings to it are also added. The
presentation metamodel describes all graphical items which can be
displayed by the presentation engine.
- Presentation Engine -
displays a presentation model stored in the repository - a diagram
(MOLA diagram or Class diagram), project tree and property dialog - and
reacts on user activities. If the user clicks on a diagram element,
chooses menu item or takes another activity, the presentation engine
notices the action and passes control to the transformation engine. The
main components of the presentation engine are:
- Diagram Engine - built based on Graphical Editing Framework (GEF) and several components of Graphical Modeling Framework (GMF) runtime, open source plug-ins of the Eclipse platform. It displays diagrams.
- Tree Engine - the extension of Common Navigator Eclipse view. It displays the project tree.
- Property Engine - the extension of Tabbed Properties Eclipse view. It displays property dialogs.
- Transformation Engine -
contains transformation library which implements the functionality of
MOLA2 Tool. When the control is gained from presentation engine, the
transformation engine runs the appropriate transformation. The
transformation reads from repository the action performed by user and
reacts to it accordingly. When the transformation has finished its job,
the control is returned to the presentation engine. The presentation
engine displays changes made in the presentation model by the
transformation. The transformation library of MOLA2 Tool is
mostly written in MOLA and compiled with MOLA2i Tool (bootstrapping
principle).
MOLA transformations
could be used as plug-ins in various modelling environments (RSA,
Enterprise Architect, etc ...). The schema of such plugin is shown in Figure 3.
Figure 3. MOLA transformation as modeling
enviroment plug-in
The plugin consists of
a MOLA transformation executable and a repository containing the
appropriate domain metamodel. Data - a model specified by the metamodel
- are imported from the native repository of a modelling environment,
then the transformation is executed and data is exported back to the
native repository.