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: 
    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:
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:  
    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.