International Journal of Computer Science & Information Technology (IJCSIT) Vol 3, No 4, August 2011
MDA-BASED ATL TRANSFORMATION TO
GENERATE MVC 2 WEB MODELS
M'hamed Rahmouni1 and Samir Mbarki1
1Departement of Computer Science, Faculty of Science, Ibn Tofail University, BP 133,
Morocco
md.rahmouni@yahoo.fr
mbarkisamir@hotmail.com
ABSTRACT
Development and maintenance of Web application is still a complex and error-prone process. We need
integrated techniques and tool support for automated generation of Web systems and a ready prescription
for easy maintenance. The MDA approach proposes an architecture taking into account the development
and maintenance of large and complex software. In this paper, we apply MDA approach for generating
PSM from UML design to MVC 2Web implementation. That is why we have developed two meta-models
handling UML class diagrams and MVC 2 Web applications, then we have to set up transformation rules.
These last are expressed in ATL language. To specify the transformation rules (especially CRUD
methods) we used a UML profiles. To clearly illustrate the result generated by this transformation, we
converted the XMI file generated in an EMF (Eclipse Modeling Framework) model.
KEYWORDS
MDA, Meta-models, Transformation rules, ATL, MVC 2 Web, UML Profiles
1. INTRODUCTION
Nowadays, it is well recognized that model transformation is at the heart of model driven
architecture (MDA) approaches and represents as a consequence one of the most important
operation in MDA. The goal of this transformation is to come to a technical solution on a
chosen platform from independent business models of any platform [1]. Indeed, the MDA is a
new discipline of software engineering that has emerged to ensure the development of
productive models [2][3]. MDA brings an important change in the conception of applications
taking in account the durability of savoir-faire and of gains of productivity, and taking profits of
platforms advantages without suffering of secondary effects[4][5]. Hence, a considerable
number of tools supporting the MDA has been developed. On the other hand, many
implementations of the MVC 2 pattern, in the field of Web applications, have been carried out.
At this level, we cite the following frameworks: Struts [6], Spring MVC [7], php.MVC [8],
Zend [9], PureMVC [10]. Among these frameworks, Struts has attained maturity and so has
gained the confidence of developers.
This paper presents a tool that transforms a class diagram, which contains CRUD operations, to
a model target (especially struts). The result of this transformation is an XMI file that will be
subsequently used as a model to generate the source code of a MVC2 Web application. This
tool allows to retrieve, delete, update and create the different objects of the information system.
The emphasis is placed on the associations between classes. The process of transformation
which consists in producing the XMI file is realized using the ATL language (Atlas
Transformation Language) [11][12][13].
The remainder of this paper is organized as follows: Section 2 introduces MDA architecture,
languages of metamodeling and transformation. Section 3 is devoted to the UML meta-model
DOI : 10.5121/ijcsit.2011.3405 57
International Journal of Computer Science & Information Technology (IJCSIT) Vol 3, No 4, August 2011
and MVC 2 Web meta-model. Section 4 presents the specification of CRUD operations by
UML profiles. Section 5 describes the process of development, implementation and execution
of transformation rules. Section 6 is dedicated to the related work. Finally, section 7 concludes
the work and gives hints about future work.
2. MODEL-DRIVEN ARCHITECTURE (MDA):
The architecture of MDA is divided into four layers. In the first layer, there are the standard
UML (Unified Modeling Language), MOF (Meta-Object Facility) and CWM (Common
Warehouse Meta-model). In the next layer, there is the standard XMI (XML Metadata
Interchange) which facilitates the exchange of models and their storage. The third layer contains
the services that manage events, security and transactions. The final layer provides frameworks
adaptable to different types of applications (Finance, Telecom, Transportation, Medical, etc..)
[2][3].
The key principle of MDA is the use of models at different phases of application development.
Specifically, MDA supports the development of requirements model (CIM), analysis and design
(PIM) and code (PSM). The major objective of MDA is to develop perennial models,
independent of the technical details of implementation to enable the automatic generation of the
entire application code and obtain a significant gain in productivity. In the remainder of this
section, we present the main artifacts of the engineering of models, languages expressing the
meta-models and the transformation of models: MOF (Meta Object Facility) has been adopted
by the OMG in 1997. The MOF specification defines an abstract language and a framework for
the specification, construction and management of the generic meta-models. In addition, MOF
defines a platform for the implementation of models described by the meta-models [14].
ECORE is a meta-modeling language that is part of EMF (Eclipse Modeling Framework) and is
the result of ETP project efforts (Eclipse Tools Project). EMF is a modeling framework and
code generation to support the creation of tools and model driven applications. ECORE defines
key elements as: EnamedElement, eClassifier, ETypedElement, EPackage, eClass, EDataType,
EAttribute, eReference, EOperation.
The model transformation plays a role in the model driven engineering. To this end, several
studies have been conducted to define transformation languages effectively and to ensure
traceability between the different types of MDA models. ATL (Atlas Transformation Language)
is a model transformation language developed in the framework of the ATLAS project [12].
ATL is developed by the team of Jean Bézivin at LINA in Nantes. It is part of the Eclipse M2M
(Model-to-Model).
conforms to
transformation
MOF
MMa
ATL
MMb
mma2mmb.atl
Ma
Mb
Figure 1. Operational framework of ATL.
58
International Journal of Computer Science & Information Technology (IJCSIT) Vol 3, No 4, August 2011
3. UML AND MVC 2 WEB META-MODELS:
According to the diagram shown in Figure 1, we present in this section the different meta-
classes that constitute the PIM and PSM meta-models. Figure 2 illustrates the source meta-
model that is a simplified representation of a UML class diagram. UMLPackage corresponds to
the concept of UML package, this meta-class is related to the Classifier meta-class. This
represents both the concept of UML class and the concept of data type. The Property meta-class
expresses the concept of properties of an UML class or references to other classes (uni and
bidirectional associations). Figure 3 corresponds to the PSM meta-model. In this meta-model,
we show more interest in the tier controller. The ActionMapping meta-class contains the
information deployment for a particular Action class. The ActionForm meta-class is a Bean
encapsulating the parameters of a form from the view part. The execute() method of Action
class performs its processing and then calls the findforward() method on the mapping object .
The return value is an object of an ActionForward type. The Action meta-class represents the
concept of secondary controller. The Action classes contain the specific processing of the
application. Consequently, they must be related to business classes. The complete target meta-
model is detailed in [15].
Figure 2.UML meta-model source.
Figure 3.Struts meta-model.
59
International Journal of Computer Science & Information Technology (IJCSIT) Vol 3, No 4, August 2011
4. SPECIFYING CRUD OPERATIONS BY UML PROFILES:
When the UML can not represent a system or application in a practical way, a UML profile can
provide extra features to do [16][17]. A UML profile is an adaptation of UML to a particular
area [2][18]. It consists of stereotypes, constraints and values marked [19]. A stereotype defines
a subclass of one or more elements of the UML meta-model. This subclass has the same
structure as its basic elements, but the stereotype specifies constraints and additional properties.
In the next section we will specify the operations Create, Retrieve, Update and Delete (CRUD)
by UML profiles to predict and specify the outcome of the ATL transformation. The operating
algorithm of these operations is based on the principle and architecture of MVC2 Web: Struts
[6]. Figure 4 describes this principle.
Controller
Figure 4. MVC 2 Web Architecture
4.1. RetrieveCi Operation
The aim of the RetrieveCi operation is to display all Ci entities registered in the database already
created. This operation is described as follows:
Figure 5. Specifying RetrieveCi operation
4.2. The CreateCi Operation
This operation aims at the creation or addition of a new Ci entity in the database. It is described
below.
60
International Journal of Computer Science & Information Technology (IJCSIT) Vol 3, No 4, August 2011
Figure 6. Specifying the CreateCi operation.
2.3. UpdateCi Operation
The Ci entity data recorded in the database may be incorrect or false, to correct or change it, we
apply the UpdateCi operation detailed as follows by the UML profiles:
Figure 7. Specifying CreateCi operation.
<
>
Error
Figure 7. Specifying the CreateCi operation
2.4. DeleteCi Operation
The data recorded in the database and which are useless, must be removed. The DeleteCi
operation was designed for this role:
61
International Journal of Computer Science & Information Technology (IJCSIT) Vol 3, No 4, August 2011
Figure 8. Specifying DeleteCi operation
The specification of other CRUD operations that correspond to Cj and Ck classes will be the
same way as that of the Ci class.
5. IMPLEMENTATION AND EXECUTION OF TRANSFORMATION RULES
In this section, we present the transformation rules allowing to generate a MVC 2 web model
from UML class diagram specified by UML profiles and the implementation of these rules then
its results after the execution.
In this article we consider only the operations CRUD that Create, Retrieve, Update and Delete,
each generates an element of an ActionForm type. The Retrieve operation relating the root class
does not generate an ActionForm. The "Create" and "Delete" operations that already performed
in [20].
Before proceeding to the execution of the transformation rules, we first created ECORE models
corresponding to our two source and target meta-models. In second step, we have implemented
the rules of ATL transformation language. The result of XMI file, generated by this
transformation, is converted to an EMF model. To validate our transformation rules, we applied
more tests. The validation of these rules is also based on the specification of CRUD operations
shown above. As an illustration, we consider the UML diagram composed by the classes Ci, Cj
and Ck. We get the following XMI model. The target model contains all CRUD operations that:
Create, Retrieve, Update and Delete. For the "Retrieve" operation, the Ci root class has no
ActionForm. For the "Delete" operation, the input attribute of the "DeleteCiAction" action tag is
"/RetrieveCi.jsp" because it is deleting a line from the list of its properties.
Figure 9. Source Model UML
62
International Journal of Computer Science & Information Technology (IJCSIT) Vol 3, No 4, August 2011
5.1. Rule That Generates the JSP Pages
Figure 10. Rule That Generates the JSP Pages
Figure 11. The Generated result:
Package of JSP pages
Figure 12. Equivalent result in EMF:
Package of JSP Pages
63
International Journal of Computer Science & Information Technology (IJCSIT) Vol 3, No 4, August 2011
5.2. Rule that Generates the Action Classes
Figure 13. Rule that Generates the Action Classes
64