=Paper=
{{Paper
|id=Vol-1563/paper4
|storemode=property
|title=Building MDE Cloud Services with Distil
|pdfUrl=https://ceur-ws.org/Vol-1563/paper4.pdf
|volume=Vol-1563
|authors=Carlos Carrascal Manzanares,Jesus Sanchez Cuadrado,Juan De Lara
|dblpUrl=https://dblp.org/rec/conf/models/ManzanaresCL15
}}
==Building MDE Cloud Services with Distil==
Building MDE cloud services with D ISTIL
Carlos Carrascal Manzanares, Jesús Sánchez Cuadrado, Juan de Lara
Modelling and Software Engineering Research Group
http://www.miso.es
Computer Science Department
Universidad Autónoma de Madrid (Spain)
Car.Carrascal@estudiante.uam.es, {Jesus.Sanchez.Cuadrado, Juan.deLara}@uam.es
Abstract—Model-Driven Engineering (MDE) techniques, like Language), permits the specification of the structure of the
transformations, queries, and code generators, were devised for repository for storing the MDE artifacts, the basic services
local, single-CPU architectures. However, the increasing complex- required for them (like upload, download or search), as well
ity of the systems to be built and their high demands in terms of
computation, memory and storage, requires more scalable and as more advanced user-defined services, their (parallel or
flexible MDE techniques, likely using services and the cloud. sequential) composition, and their triggering conditions.
Nonetheless, the cost of developing MDE solutions on the cloud D ISTIL is accompanied with a set of code generators able
is high without proper automation mechanisms. to synthesize the repository structure and persitence services,
In order to alleviate this situation, we present D ISTIL, a
domain-specific language to describe MDE services, which is
to generate support for basic (REST) services for the defined
able to generate (NoSQL-based) respositories for the artefacts of artifacts and skeletons for the user-defined services, and an
interest, and skeletons for (single or composite) services, ready HTML web client interface for them. D ISTIL uses by default
to be deployed in Heroku. We illustrate the approach through MongoDB [5] for the persistence, and the Spark Java frame-
the construction of a repository and a set of cloud-based services work1 as the support for the REST services. The generated
for bentō reusable transformation components.
Index Terms—Model-Driven Engineering, Domain-Specific
elements are included in a project ready to be deployed in
Languages, Service-Oriented Programming, REST services, the Heroku cloud platform [11]. This way, using D ISTIL,
Cloud Computing, Code Generation the developer is freed from the technical details of the many
technologies involved, and typically he only needs to provide
I. I NTRODUCTION the functionality (in Java) for the user-defined services. For
The development of a Model-Driven Engineering (MDE) this purpose, the D ISTIL development environment (an Eclipse
solution involves dealing with artifacts of different kinds and plugin) has a smooth integration with the Java IDE. We
their relationships. The most common approach is to store illustrate the approach by defining a set of cloud services
artifacts using local folders and projects, for instance, using for reusable model transformation components developed with
the infrastructure of the Eclipse plataform. In this approach, bentō [17].
computations also occur in the local machine. This has several The rest of the paper is organized as follows. Section II
shortcomings, such as limited reuse opportunities, scalability introduces a running example that will be used in Section III to
problems and reduced flexibility. explain the main concepts of the D ISTIL language. Section IV
Instead, advanced solutions, aiming to tackle the challenges describes its tool support, Section V compares with related
of scalability and flexibility raised by today’s complex sys- research, and Section VI finishes with the conclusions and
tems [14], require scalable database storage, with retrieval plans for future work.
strategies of different nature, ranging from simple, tag-based
searchs to complex queries [21], and the scalable execution of II. RUNNING EXAMPLE
model management operations such as model transformations,
or code generation. We first start by proposing a motivating scenario, which we
In this setting, cloud computing is an appealing approach to then solve using D ISTIL.
build advanced solutions, with scalability up-front [8]. While Assume we would like to build a repository for reusable,
there are many service providers, the entry level to develop a generic transformation components built with bentō [17]. In
cloud-based service is high, specially for research prototypes. bentō, a basic reusable transformation component includes one
Thus, proposals to facilitate the development of cloud-based or more concepts and a transformation template (a regular ATL
MDE tools are needed to increase its adoption, both within the transformation). A concept is similar to a meta-model, but it
MDE community but notably by other software engineering describes the minimal structural requirements that a concrete
communities. meta-model must fulfil for the reusable transformation to
In this work we present our first results towards addressing become applicable to it. When the component is used, the
this issue. Our approach is based on a domain-specific lan- concept needs to be bound to a concrete meta-model, and then
guage intended to facilitate the specification of MDE services.
The language, named D ISTIL (for MDE service SpecificaTIon 1 http://sparkjava.com/
Fig. 1: D ISTIL meta-model excerpt.
the bentō engine rewrites the transformation template, so that structure, and hence a MongoDB collection is created for
it gets adapted for the particular meta-model. every artifact. An Artifact is described by an extension, a
In practice, a component developer is interested in upload- format, a set of basic services to be generated, and a set of
ing components, and checking their correctness, for example attributes. Attributes may be of primitive type (class Primitive),
performing a static type-checking of the transformation [18] or references to Entities (class Reference) or to other Artifacts (class
obtaining some metrics about the transformation and the found ArtifactID). In MongoDB, each stored artifact (each document)
errors. A reuser might be interested in retrieving components receives a String identifier. Therefore, while in the D ISTIL
using two main search strategies: (1) finding components via specification ArtifactID models a reference to another artifact, in
tag search, and (2) retrieving components whose concept(s) the generated code, the navigation is done through such string
matches a given concrete meta-model. This process could be identifiers. Entities are similar to Artifacts, but are used to factor
integrated in the IDE or accessible via a web interface. Thus, out commonalities of Artifacts, and hence they do not generate
the repository should be accessible via a REST API to enable a separate collection in the database. The required attribute in
different user interfaces. Primitive attributes is used to indicate whether such attribute
In previous works [19] we described the packaging mecha- will be required in the requests to the generated upload and
nism of bentō components. It includes a manifest file describing update services.
the artefacts of the component, one or more .ecore files imple- For each Artifact D ISTIL provides complete support for basic
menting the component concepts and an ATL transformation services: upload, download, update, read, readAll, search and
template. These elements are packaged into a zip file to ease delete (see the ServiceEnum enumerate type). However, new
distribution. user-defined services can be described through subclasses of
Service. On the one hand, SimpleServices receive Artifacts or
III. D ISTIL : AN MDE SERVICE SPECIFICATION LANGUAGE Entities as input and output. While services can be called on
The D ISTIL language permits describing both the Artifacts demand, it is also possible to specify when they should auto-
and the Services of interest. An excerpt of its meta-model is matically be executed, for example when some basic service
shown in Fig. 1. is invoked for an Artifact. On the other hand, MultiServices are
By default, D ISTIL uses MongoDB as the underlying used to compose (in sequence or parallel) several (composed or
database system, and hence the Root class contains the URI simple) services. The language includes validations checking
of the database (but providing a value is not mandatory). A the compatibility of the outputs/inputs of services. For inputs
D ISTIL specification is made of two parts. On the one hand, and outputs it is possible to specify required values for some of
a description of the structure of the artifacts of interest (using their attributes. As we will see in next section, D ISTIL creates
classes Artifact and Entity) and their associated basic services. both REST APIs and HTML front-ends for the specified
On the other hand, a declaration of the inputs and outputs of services (both basic and user-defined).
extra user-defined services (subclasses of Service). Listing 1 shows the D ISTIL specification for the running
An Artifact is an element to be stored in the repository. Its example. The listing declares an Artifact for storing bentō
definition triggers the creation of the corresponding database components in lines 1–8. The Artifact declares in line 2
the extension (.bentoz), format (zip), and requires all basic The listing declares a multi-service Analyse (lines 31–34),
services. There are several built-in formats, and for some which runs in sequence the simple services TypeCheck and
of them automated injectors and extractors can be made Metrics when a bentō component is uploaded or updated. Both
available (e.g., for zip we automatically generate packing and services receive the bentō component as input. TypeCheck (line
unpacking facilities). Then, in lines 4–7 defines the structure 37) is a simple service, whose goal is to statically analyse
of a component, which has the input and output concepts, the the transformation [18] and outputs a model reporting the
ATL transformations it encapsulates, and the tags. We use the problems found. Metrics (lines 40-43) is a service calculating
id prefix to indicate a reference to another artifact (e.g., in some transformation and error metrics, which also takes as
lines 4-7). The primitive attributes (tags in this case) are used input the output of the TypeCheck service.
to enable the search service. Notably, for string attributes our Please note that we declare constraints on the properties of
implementation of this service is able to look for synomyms, the allowed input and outputs of these services. This way, we
as it uses Wordnet [15], a lexical database for the English declare that the output artifact of TypeCheck has type.uri equal
language. to “http://prob.ecore”. In this case, this indicates the meta-model
The listing also declares artefacts for storing the the model is an instance of. Finally, SemanticSearch is a service
ATL transformation (ATLTrafo, lines 10–15) and the meta- that does not define a trigger, and hence has to be invoked on
models/concepts (MetaModel, lines 17–22). It also declares an demand. Its input is a meta-model and its output is a collection
Artifact for models (Model, lines 24–28), because it is used by of bentō components whose concepts are structurally close to
other user-defined services. such meta-model. As we will see in next section, the D ISTIL
1 Artifact Bento [
description of user-defined services enables the generation of
2 extension .bentoz format ZIP services : all supporting Java code, which the designer needs to fill with the
3 ] { appropriate behaviour (calculation of metrics, type checking,
4 id many inputConcepts : MetaModel
5 id many outputConcepts : MetaModel
etc).
6 id many atl : ATLTrafo
7 many tags : String IV. A RCHITECTURE AND T OOL S UPPORT
8 }
9
A. Architecture
10 Artifact ATLTrafo [ We have built a code generator that, given a D ISTIL
11 extension .atl format TEXT
12 services : upload, delete, download, search specification, synthesizes the needed repository structure, the
13 ] { full implementation of the basic services, the skeleton of
14 nameATL : String user-defined services, and prepares the generated code in a
15 }
16
project ready to be deployed on Heroku. The latter includes the
17 Artifact MetaModel [ needed dependencies, a pom.xml file for compiling the code
18 extension .ecore format XMI using Maven (https://maven.apache.org/), and some configu-
19 services : upload, delete, download, search
20 ] {
ration files for the execution in Heroku. The generated code
21 uri : String uses the Spark framework as the support for the generated
22 } REST services, and MongoDB for the storage. However, the
23
24 Artifact Model [ generated code facilitates changing the database engine.
25 format XMI services : all
26 ] { DISTIL development environment
27 nameModel : String
28 id type : MetaModel DISTIL
Client
spec.
29 } Heroku application
30
MDE
31 MultiService Analyse { expert 1 REST
(Spark)
32 when : Bento [upload, update]
33 services : TypeCheck, Metrics 2 3 Artifact repo.
(MongoDB)
34 } HTML
35 (Freemarker)
36 Service TypeCheck { User
37 output: Model [with type.uri="http://prob.ecore"]
38 } Fig. 2: Architecture of the solution and process for creating
39 cloud-based MDE services with D ISTIL
40 Service Metrics {
41 input: Model [with type.uri="http://prob.ecore"]
42 output: Model [with type.uri="http://mtr.ecore"] Fig. 2 depicts the process to create cloud-based MDE ser-
43 } vices with D ISTIL, as well as the solution general architecture.
44
45 Service SemanticSearch {
In a first step, the MDE expert interacts with the D ISTIL IDE.
46 input : MetaModel As we have seen, he should build a D ISTIL specification.
47 output : many Bento The IDE generates Java code (label 2), and the engineer has
48 }
typically to fill some functionality holes for the user-defined
Listing 1: D ISTIL specification for the running example services. The details of the IDE and its ability to integrate
D ISTIL programs with Java will be explained in the next (label 1 in the figure) has been developed using Xtext [3], and
subsection. Then, the IDE (label 3) can package the different enables the following features:
artifacts to be uploaded into Heroku. By default, the generated 1) Hyperlinking the Artifact and Service names with the
services contain the REST services for the basic and user generated Java classes. The Java classes contain “holes”
defined services, an HTML frontend (for which Freemarker where the user can provide extra functionality for the
is used) and a MongoDB database. This way, the generated services, which are marked as “TO-DOs”.
services can be used by humans, or be integrated into client 2) The D ISTIL editor gives warnings if any of such “TO-
applications. The REST services manage the different artifacts DOs” for any declared Artifact or Service remains. One
using the JSON format. such warning is shown in the Figure (label 2), and we
The generated code from a D ISTIL specification extends a provide a quickfix with an hyperlink to the corresponding
manually created service kernel. The scheme of the generated Java file (label 3).
code is shown in Fig. 3. For each Artifact (e.g., ATLTrafo), In the package explorer view of the Figure (label 4), we
the generator synthesizes a Java package (atltrafoServices), can see that the D ISTIL IDE has created services for every
which contain both necessary classes to create the REST Artifact and Service defined, following the scheme explained in
API (package atltrafoServices.basic and class ATLTrafoJson), and previous section.
an automatically generated HTML web client (package atl- Fig. 5 shows how by hovering over the Artifact name, the
trafoServices.htmlCover and class CustomATLTrafoHtml), and for the
engineer is offered the possibility to navigate to the Java
persistency (class ATLTrafo.java). Then, one class for each user- classes which might need to be extended by hand. The code
defined service is also generated (in package service, not shown generator respects the manually written code in the Java files,
in the figure). This generation scheme facilitates the extension so that it does not get overwritten.
of the generated code with new features. For example, it is easy
to add features to the HTML client by modifying the methods
in class CustomATLTrafoHML. To give an idea of the size of our
framework, the kernel has over 1200 Lines of Code (LOC)
in 32 Java classes. The automatically generated Java code for
the example amounts to 2100 LOC in 47 Java classes, and the
code generator has over 3100 LOC in 22 xtend files.
persistence abstractServices.basic abstractServices.htmlCover Distil
kernel
MongoDB T<
«interface» Persistent
BasicAbstract HtmlInterface
Persistent Json View
atlTrafoServices T -> ATLTrafo
generated
CustomATL
code Fig. 5: Hyperlinking D ISTIL specifications and generated Java
ATLTrafo ATLTrafoJson
TrafoHtml code
nameATL: String
postUpload(…) runService()
constructSearchForm() Fig. 6 shows the search facility of the generated web
constructUploadForm()
basic htmlCover
HtmlATLTrafoJson
interface, running after it has been deployed in Heroku. It can
BasicATLTrafoCodes
BasicATLTrafoParam
HtmlATLTrafoLinks be noted that the interface permits search using synonyms.
HtmlATLTrafoSpark
BasicATLTrafoSpark
HtmlATLTrafoView The running example, is available at https://miso-distil-bento.
herokuapp.com/.
Fig. 3: Structure of the generated code
V. R ELATED WORK
Typically, given a D ISTIL program, the engineer would need One of the earliest work dealing with the servitization of
to fill some functionality “holes” in the generated classes. Next model operation is ModelBus [20]. This was a tool integra-
subsection describes our tool support to make this process tion technology which built upon web wervices, following a
smooth. SOA approach. ModelBus featured a model repository and
facilitates the orchestration of modeling services. However,
B. The D ISTIL development environment it lacked dedicated languages to describe both the repository
We have built an Eclipse plugin aiming at providing a tight structure or the service integration.
and seamless integration of D ISTIL with the generated Java With the advent of cloud technology, in [4] the authors
code. The tool is freely available at http://miso.es/tools/distil. introduced the notion of Modeling as a Service (MaaS) as
html. a way to provide MDE services from the cloud, analysing
One of the tool design goals is to facilitate the completion of the applications of such idea. Approaches to realize this
the generated code for the user-defined services using Java. A idea have emerged over the years. Some of them focus on
screenshot of the tool is shown in Fig. 4. The language editor the extensible definition of repositories for MDE artifacts.
Fig. 4: The D ISTIL development environment.
In this category, ReMoDD [10] is based on general-purpose generation and deployment.
content management systems, like Drupal. On the other hand, Other approaches focus on providing specific MDE services.
others like MORSE [12], have an explicit meta-model to For example, AToMPM [6] offers a complete cloud-based
adapt to the specific artifact to be stored. MORSE is able to modelling environment, while Hypersonic [1] is a cloud-based
store models and meta-models and provides version control. tool to perform model analysis. However, these approaches
Another related approach is MDEForge [2], which is perhaps are specific for a certain task (modelling, analysis), while we
the closest to our approach (http://mdeforge.org). MDEForge provide a DSL to specify MDE cloud services.
is an extensible, generic respository to store MDE artifacts, Service oriented programming languages, like Jolie [16]
and provide services for them. MDEForge is extensible, as it provide primitives to define and orchestrate services. Instead,
allows adding new kinds of artifacts and services. However, we opted by a high-level DSL, and a code generation approach.
while the previous approaches provide at most a meta-model However, in the future we aim to extend D ISTIL with more
to customize the storage part, we provide a DSL and rich tool sophisticated service orchestration primitives.
support for both storage and service definition, including code
In [7], an approach called EMF-REST to expose an EMF
R EFERENCES
[1] V. Acretoaie and H. Störrle. Hypersonic - model analysis as a
service. In Joint Proceedings of MODELS 2014 Poster Session and the
ACM Student Research Competition, volume 1258 of CEUR Workshop
Proceedings, pages 1–5. CEUR-WS.org, 2014.
[2] F. Basciani, J. D. Rocco, D. D. Ruscio, A. D. Salle, L. Iovino, and
A. Pierantonio. MDEForge: an extensible web-based modeling platform.
In CloudMDE, satellite event of MoDELS, volume 1242 of CEUR
Workshop Proceedings, pages 66–75. CEUR-WS.org, 2014.
[3] L. Bettini. Implementing Domain-Specific Languages with Xtext and
Xtend. Packt Publishing, 2013. See also https://eclipse.org/Xtext/.
[4] H. Brunelière, J. Cabot, and F. Jouault. Combining Model-Driven
Engineering and Cloud Computing. In MDA4ServiceCloud, satellite
event of ECMFA, June 2010.
[5] K. Chodorow. MongoDB: The Definitive Guide. O’Reilly Media, 2013.
See also https://www.mongodb.org/.
[6] J. Corley and E. Syriani. A cloud architecture for an extensible multi-
paradigm modeling environment. In Joint Proceedings of MODELS 2014
Poster Session and the ACM Student Research Competition, volume
1258 of CEUR Workshop Proceedings, pages 6–10, 2014.
Fig. 6: The generated web interface for the defined Heroku [7] H. Ed-Douibi, J. L. C. Izquierdo, A. Gómez, M. Tisi, and J. Cabot.
cloud services. EMF-REST: Generation of RESTful APIs from Models. arXiv preprint
arXiv:1504.03498, 2015.
[8] T. Erl, R. Puttini, and Z. Mahmood. Cloud Computing: Concepts,
model as a REST API is presented. This allows basic model Technology & Architecture. Prentice Hall, 2013.
management operations to be performed remotely. Our notion [9] N. Ferry, H. Song, A. Rossini, F. Chauvel, and A. Solberg. CloudMF:
of artifact is coarser grained, and thus we do not automatically Applying MDE to Tame the Complexity of Managing Multi-Cloud Ap-
plications. In R. Bilof, editor, UCC 2014: 7th IEEE/ACM International
generate access facilities to individual elements. Instead, ser- Conference on Utility and Cloud Computing, pages 269–277. IEEE
vices generated by EMF-REST could be manually integrated Comp. Soc., 2014.
into D ISTIL generated code. [10] R. France, J. Bieman, and B. H. C. Cheng. Repository for model driven
development (ReMoDD). In Proceedings of the 2006 International
Our approach to describe services is somehow similar to Conference on Models in Software Engineering, MoDELS’06, pages
Apache Ant (http://ant.apache.org/). In [13], Ant was extended 311–317, Berlin, Heidelberg, 2006. Springer-Verlag.
with model management tasks for e.g., model validation, [11] A. Hanjura. Heroku Cloud Application Development. Packt Publishing,
2014. See also http://heroku.com.
transformation or merging. However, these are not executed [12] T. Holmes, U. Zdun, and S. Dustdar. Automating the management and
in the cloud, but locally. versioning of service models at runtime to support service monitoring.
Hence, altogether, the contribution of this work is a DSL In 16th IEEE International Enterprise Distributed Object Computing
Conference, EDOC 2012, pages 211–218. IEEE Computer Society,
to describe both the structure of the MDE repository and the 2012.
associated services, supported by a generative framework. [13] D. Kolovos, R. Paige, and F. Polack. A framework for composing
modular and interoperable model management tasks. In In Model-Driven
VI. C ONCLUSIONS AND FUTURE WORK Tool and Process Integration Workshop, pages 79–90, 2008.
This paper has presented D ISTIL, a domain-specific lan- [14] D. Kolovos, L. Rose, N. Matragkas, R. Paige, E. Guerra, J. S. Cuadrado,
J. De Lara, I. Ráth, D. Varró, M. Tisi, and J. Cabot. A research roadmap
guage for specifying MDE services, to be deployed in the towards achieving scalability in model driven engineering. In BigMDE,
cloud. The language permits generating No-SQL based persi- satellite event of STAF, pages 2:1–2:10, New York, NY, USA, 2013.
tence services for the artifacts of interest, as well as skeletons ACM.
[15] G. A. Miller. Wordnet: A lexical database for english. Communications
for user-defined services. The tool is tightly integrated with of the ACM, 38(11):39–41, 1995.
the Java IDE, to facilitate the addition of functionality to the [16] F. Montesi, C. Guidi, and G. Zavattaro. Service-oriented programming
service skeletons, and generates ready-to-deploy projects for with jolie. In Web Services Foundations, pages 81–107. Springer, 2014.
[17] J. Sánchez Cuadrado, E. Guerra, and J. de Lara. A component model for
Heroku. model transformations. IEEE Trans. on Soft. Eng., 40(11):1042–1060,
In the future, we would like to provide support for other 2014.
cloud systems, in addition to Heroku, and enable the definition [18] J. Sánchez Cuadrado, E. Guerra, and J. de Lara. Uncovering errors
in ATL model transformations using static analysis and constraint
of policies for scaling, like those of CloudMF [9]. We are solving. In 25th IEEE International Symposium on Software Reliability
also improving tool support, extending D ISTIL with more Engineering, ISSRE 2014, pages 34–44. IEEE, 2014.
sophisticated support for service definition and composition [19] J. Sánchez Cuadrado, E. Guerra, and J. de Lara. Reusable model
transformation components with bentō. In Proceedings of ICMT’15,
(like exception handling, compensation actions, transactions) LNCS, 2015. Springer.
and using it for more advanced case studies. [20] P. Sriplakich, X. Blanc, and M. Gervais. Collaborative software engi-
neering on large-scale models: requirements and experience in modelbus.
ACKNOWLEDGEMENTS In Proceedings of the 2008 ACM Symposium on Applied Computing
Work supported by the Spanish Ministry of Economy and (SAC), pages 674–681. ACM, 2008.
[21] G. Szárnyas, B. Izsó, I. Ráth, D. Harmath, G. Bergmann, and D. Varró.
Competitivity (TIN2011-24139, TIN2014-52129-R), the EU Incquery-d: A distributed incremental model query framework in the
commission (FP7-ICT-2013-10, #611125) and the Community cloud. In MODELS, volume 8767 of LNCS, pages 653–669. Springer,
of Madrid (S2013/ICE-3006) 2014.