Model Driven Generation of MVC2 Web Applications From Models To Code
Model Driven Generation of MVC2 Web Applications From Models To Code
AbstractComputer systems engineering is based, subjected to. The models have always been used in computer
increasingly, on models. These models permit to describe the science as a basis for reflection. However, they have often
systems under development and their environment at different been relegated to the rank of simple documentation. Model-
abstraction levels. These abstractions allow us to conceive driven engineering aims to place models at the heart of the
applications independently of target platforms. For a long development process to make them the main elements
time, models have only constituted a help for human users, through which applications are generated. Taking model
allow to manually develop the final code of computer change into account and automatically generating systems by
applications. The Model-Driven Engineering approach (MDE) generation from these models seems to be a promising
consists of programming at the level of models, represented as
outcome to meet changing constraints.
an instance of a meta-model, and using them for generating the
end code of applications. The MDA (Model-Driven At the heart of model-engineering are placed the model
Architecture) is a typical model-driven engineering approach transformations. They realize the automation of essential
to application design. MDA is based on the UML standard to stages of software production: refinement and models
define models and on the meta-modeling environment (MOF) composition, reverse engineering, code generation and
[1] for model-level programming and code generation. The documentation, etc. These transformations are intended to be
code generation operation is the subject of this paper. Thus, in used repeatedly by development teams, for example in
this work, we explain the code generation of MVC2 Web software workshops. Therefore, it is crucial that they be
application by using the M2M transformation (ATL
validated and tested so that the developer can have full
transformation language) then the M2T transformation. To
implement this latter we use the Acceleo generator which is a
confidence in them.
generator language. In the M2T transformation, we use the The presented work is the continuation of the work
PSM model of Struts2 already generated by M2M presented in [39]. This work allows generate automatically a
transformation as an input model of Acceleo generator. This MVC2 web application that is a source code of an
transformation is validated by a case study. The main goal of application based on Struts2 framework [1]. To realize this
this paper is to achieve the end-to-end code generation. operation of code generation, we used ACCELEO [37] as a
code generation language. To achieve this code generation,
Keywords- MDA; PSM; Code Generation; Acceleo; Struts;
ATL transformation; MVC2 architecture
we begin by implementing the different templates
corresponding to each meta-class which is an element of the
I. INTRODUCTION PSM model already generated in [39]. After establishing the
different templates (Action classes and Jsp pages), we
In recent years, development of Internet, distributed, validate the automatic code generation with a case study.
embedded or self-managed applications has considerably
complicated the development of computer systems. These The remaining part of this paper is structured as follows:
are used in increasingly varied and constrained environments section 2 explains the process and methodology of this work.
(mobile terminals, cars, robots) and in increasingly critical Section 3 is devoted to the architecture of UML and Struts2
contexts (aerospace, medical, military, nuclear). In addition, meta-models. Section 4 is devoted to the transformation rules
during their lifetime, software is subject to constant evolution implementation. Section 5 is dedicated to the transformation
to satisfy user needs and adapt to new platforms. Academic rules execution and the result of execution process. Section 6
and industrial world are thus led to rethink the software presents the Model-to-Text transformation implementation.
production processes in order to adapt them to these new The Model-to-Text transformation result is dedicated to the
stakes. section 7. Section 8 presents the evaluation of this work.
Section 9 discusses the main related work, while section 10
A pragmatic vision to adapt to these changes is to allow wraps up the conclusions and future works.
the software production in automatic way in order to take
into account the inevitable evolutions which these are
the different meta-models (CIM, PIM and PSM). CIM model - name: String
DataType
to each PIM and PSM meta-model then the different Ecore Class
+property
Property
class Struts2Mo...
ModelPackage
+controller
- name: String
Property
+property
+controller 1 - name: String
+pojo *
+pojo 1..* 1
POJO
+pojos +pojo
+views - name: String
0..*
View Package
+actionproxy
- name: String
+controller +actionproxy
ControllerPackage
ActionProxy
+views 1..* 1
- name: String +controller - name: String
JspPages 1 +actioninvocation
+actioninvocations
- name: String +acionmapper ActionInv ocation
*
+interceptors Interceptor
1 - name: String
+interceptor-ref
1..*
1
The GenerateStruts2 package presents the
different generated classes (Bean and Action classes).
The org.eclipse.acceleo.ecore2java.files package
2
contains the main template explained in figure 8.
3
Represents the main template named
genStruts2.mtl.
Represents the main template named genStruts2.mtl.
4
Represents the template of Jsp pages.
4
3
Figure 12. Template of Create JSP page. Figure 14. Template of Update JSP page.
3) Update class
This class is the result of a M2T transformation by using e
ACCELEO generation language. The Update Action Class
allows modify or update an employee, a city or a department.
In this case, we present the UpdateDepartmentAction that
permits to update the information of a given Department. The
figure 19 shown below presents this class.
The subject of the work [34] is to generate the MVC 2 web method for considering other frameworks like: PHP, Zend and
model from the combination of UML class diagram and the DotNet.
UML activity diagram. The work presented in [35] is the
continuation of [34], the objective of this work is to generate REFERENCES
the code from the MVC2 web model already generated in [34] [1] Strsus2 homepage (2017). Retrieved June 4, 2017 from http:
by using the JET2 generator. //www.struts.apache.org/2.x/.
[2] Hibernate homepage. Retrieved July 4, 2017 from http: //hibernate.org/.
In [38], the authors arrived to generate the MVC2 web [3] Spring homepage (2017). Retrieved June 22, 2017 from http:
model, but in this case, from the combination of UML class //projects.spring.io/spring-framework/.
diagram and UML sequence diagram. This work is considering [4] Arnaud Cogolugnes, Thierry Templier, Julien Dubois , & Jean-Philippe
as an end-to-end code generation by using JET2 generator and Retaill (2nd Ed.) . Spring par la Pratique. 2009, Eyrolles.
based in the MDA approach. [5] GertiKappel, Birgit Prll, Siegfried Reich, & Werner Retschizegger.
Web Engineering. 2006, John Wiley.
The objective of the work presented in [36] is to generate
[6] Blanc, X., MDA en action : Ingnierie logicielle guide par les
the N-tiers PSM model by integrating Struts2, Spring IoC and
modles . Eyrolles, 2005.
Hibernate DAO frameworks. The different transformation rules
[7] Kleppe, A., Warmer, J., & Bast, W., MDA Explained: The Model
of this work are defined by ATL language. Driven Architecture: Practice and Promise. 2003, Addison-Wesley
The objective of the paper [37] is to generate the Struts2 Professional.
PSM model and to validate the ATL transformation rules [8] Stefano Ceri, Piero Fraternali, Aldo Bongio, Marco Brambilla, Sara
Comai, & Maristella Matera. Designing Data-Intensive Web
presented in this work which was not possible in [33]-[34]- Applications. 2003, Morgan Kaufman.
[35]-[36]-[38]. This paper describes a new validation method
[9] Jaime Gmez, & Cristina Cachero. OO-H: Extending UML to Model
of ATL transformation rules and the test of this method by a Web Interfaces. Information Modeling for Internet Applications. 2002.
case study. IGI Publishing.
[10] Pedro Valderas, Joan Fons, & Vicente Pelechano. From Web
Thus, we can say that the main contributions of our Requirements to Navigational Design A Transformational Approach.
approach compared to others are: the use of ACCELEO Proceedings of the 5th Int. Conference of Web Engineering (ICWE05),
generator to generate the code of Struts2 framework which was 2005, LNCS 3579.
not possible in the case of [34]-[35]-[38]. This work is realized [11] Koch, N., Transformations Techniques in the Model-Driven
for the first time in this paper. Development Process of UWE. Proceeding of the 2nd Workshopsh of
Model-Driven Web Engineering (MDWE06). 2006, Palo Alto.
X. CONCLUSION AND FUTURE WORK [12] Santiago Meli, & Jaime Gomez. The WebSA Approach: Applying
Model Driven Engineering to Web Applications. Journal of Web
Model-driven architecture (MDA) is a software Engineering, Vol.5, No.2, 2006.
development approach proposed and supported by the OMG [13] Object Management Group (OMG). Model Driven Architecture.
foundation. This is a particular variant of model-driven Document update/2012-06-27, Retrieved June 12, 2017 from
engineering (MDE). A typical example of MDA approach is http://www.omg.org/mda/.
the automatic generation of source code from UML modeling, [14] OMG. (2017, June). Unified Modeling Language. Available at :
which involves combining: The UML standard, the modeling http://www.uml.org/
tool that implements it and the UML generation templates. The [15] Meta Object Facility (MOF), version 2.0, Retrieved June 20, 2017 from
passage from the PSM to the code generation is the logical http://www.omg.org/spec/MOF/2.0/PDF/.
continuation of this treatment. It can be realized by generators [16] XML Metadata Interchange (XMI), version 2.1.1. Retrieved June 28,
such as these in order to produce any type of technological 2017 from http://www.omg.org/spec/XMI/.
targets. [17] Object Management Group (OMG) (2017). UML 2 Object Constraint
Language (OCL). Retrieved June 30, 2017 from
In this paper, we generate a MVC2 web code from Struts2 http://www.omg.org/cgibin/doc?ptc/2005-06-06.
model already generated by applying an ATL transformation. [18] Pan Yuqing, & Wang Jiuli. Design And Implementation of Accounting
This is the M2M transformation. After that, we implement the E-Business Platform for Source Documents. Proceeding in the
International Conference on Computer Application and System
model-to-text transformation based on the MDA approach in Modeling (ICCASM 2010). 2010, DOI:
view to obtain the code of this application from the generated 10.1109/ICCASM.2010.5622916.
model. Thereby, this transformation is started by the M2M [19] Spring AOP homepage. Retrieved June 8, 2017 from
transformation to obtain the PSM Struts2 model. The http://static.springsource.org/spring/docs/2.5.x/reference /aop.html.
generated PSM model is an EMF model. This latter is used, in [20] Praveen Gupta, & Govil, Prof. M.C., Spring Web MVC Framework for
the M2T transformation, as an input model of Acceleo rapid open source J2EE application development: a case study.
generator to produce automatically the necessary target International Journal of Engineering Science and Technology, Vol.2,
No.6, 2010, pp.1684-1689.
application code. Finally, the code generation result was
[21] Praveen Gupta, & Govil, Prof. M.C., MVC Design Pattern for the multi
demonstrated and exemplified by a case study. framework distributed applications using XML, spring and struts
Furthermore, we plan to generate an e-commerce web code framework. International Journal on Computer Science and
Engineering, Vol.2, No.4, 2010, pp.1047-1051.
from a PSM model result of the integration of struts2, Spring
[22] MENET, L., Formalisation dune Approche dIngnierie Dirige par
IoC and Hibernate DAO. In other hand, we can extend this les Modles Applique au Domaine de la Gestion des Donnes de
Rfrence. PhD thesis, Universit de Paris VIII, Laboratoire
2017 by the author(s); licensee Empirical Research Press Ltd. United Kingdom. This is an open access article
distributed under the terms and conditions of the Creative Commons by Attribution (CC-BY) license.
(http://creativecommons.org/licenses/by/4.0/).