1. Hamza Ed-douibi, Javier Luis Cánovas
Izquierdo, Abel Gómez, Massimo Tisi, Jordi
Cabot
EMF-REST: Generation of RESTful
APIs from Models
1
ACM SAC 2016 - Pisa, Italy.
07/04/2016
2. EMF-REST: Generation of RESTful APIs
from Models
2
The Model-driven engineering paradigm emphasizes the use of
models to raise the level of abstraction and to (semi)automate the
development of software.
Abstraction
Automation
MDE
Standar-
dization
The Eclipse Modeling Framework (EMF) is the foundation for
modeling and data integration at Eclipse. (Models are described using
the Ecore language)
3. EMF-REST: Generation of RESTful APIs
from Models
3
Addressable resources (URI)
Representation-oriented (JSON,XML)
Statelessness
Uniform and Constrained Interface
Representational State Transfer (REST) is an architectural style
that specifies constraints such as:
6. EMF-REST approach
EMF-REST generates RESTful Web APIs out of EMF
models.
The generated API provides a direct mapping to
access data models following the REST principles :
– Addressable resources (URI)
– Representation-oriented (JSON,XML)
– Statelessness
– Uniform and Constrained Interface (HTTP verbs :
GET, POST,…)
The generated application supports validation and
security.
The generated RESTful Web API relies on well-known
libraries and standards.
6
11. Mapping EMF with REST: Uniform and
Constrained Interface & Statelessness
EMF
EMF-REST
11
PUT https :// example .com/rest/IFMLModel/AddMovie/
interactionFlowElements/AddMovieWindow/
viewElements /AddMovieForm
{"form":{
name :"toto"
}
}
addMovieFormObj . setName (" toto ");
//addMovieFormObj is of type Form
12. Extra features
Validation
– Use of OCL annotations to enable validation each time the API is called
Security
– Encryption: All the communications with the server are using HTTPS
– Authentication: Only authenticated users are allowed to access the API
– Authorization: Use of a Role-based mechanism to assign permissions for
each operation.
– Use of model annotations to support authentication and authorization
12
13. Architecture of EMF-REST generated application
13
EMF
JAX-RS
EJB/CDI
JAXB OCL JPA
JavaScript API
Browser
REST Client
Validation SecurityContent management
Web ClientWeb Application
15. Conclusion & future work
EMF-REST generates truly RESTful APIs for EMF
models by mapping data models with REST
principles.
EMF-REST complements the existing (Java-based) API
generation facilities EMF already provides and
extends them to the Web.
Future work:
– Storage configuration
– Configuration of the generated API
– Definition of how model elements should be
serialized.
15
16. Thank you!
16
• Visit us at:
http://som-
research.uoc.edu/tools/emf-rest/
• Hamza Ed-douibi:
hed-douibi@uoc.edu
•Javier Cánovas:
jcanovasi@uoc.edu
•Jordi Cabot:
jordi.cabot@icrea.cat