Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

EMF-REST: Generation of RESTful APIs from Models


Published on

Move your models to the cloud. Access them via an automatically generated REST API

Published in: Software
  • Be the first to comment

  • Be the first to like this

EMF-REST: Generation of RESTful APIs from Models

  1. 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
  2. 2. EMF-REST: Generation of RESTful APIs from Models 2  The MDE 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
  3. 3. EMF-REST: Generation of RESTful APIs from Models The Eclipse Modeling Framework (EMF)  EMF is the foundation for modeling and data integration at Eclipse.  EMF allows creating models (by using the Ecore language) and their instances.  EMF can generate efficient, correct, and easily customizable java implementation code  Is surrounded by a huge ecosystem of tools and frameworks (ATL, Accelio, Sirius,…) 3
  4. 4. EMF-REST: Generation of RESTful APIs from Models 4 Addressable resources Representation-oriented Statelessness Uniform and Constrained Interface Representational State Transfer (REST) is an architectural style that specifies constraints such as:
  5. 5. Java Environment XMI EMF-REST proposal 5 JAVA + Web Environment JAVASCRIPT + REST API EMF-REST
  6. 6. EMF-REST proposal 6 Collaboration Scalability Portability
  7. 7. EMF-REST features 7 REST API JSON Serialization XML Serialization Validation Security
  8. 8. Running Example 8 IFML (Interaction Flow Modeling Language) model: A form from a movie manager
  9. 9. Mapping EMF with REST •platform:/resource/project/AddMovie.xmi •platform:/resource/project/AddMovie.xmi#title •platform:/resource/project/AddMovie.xmi#//.../@viewComponentsParts.0 EMF • • • EMF-REST 9 Addressable resources
  10. 10. Mapping EMF with REST XML JSON 10 Representation-Oriented <form> <name>AddMovieForm</name> <viewComponentParts> <simpleField> <uri> viewComponentsParts/picture</uri> </simpleField> <simpleField> <uri> viewComponentsParts/title</uri> </simpleField> ... </viewComponentParts> <viewElementEvents> <onSubmitEvent> <uri> viewElementEvents/add</uri> </onSubmitEvent> </viewElementEvents> </form> { "form":{ "name":"addMovieForm", "viewComponentParts":{ "simpleField":[ { "uri":"https://.../ viewComponentsParts/picture" }, { "uri":"https://.../ viewComponentsParts/title" } ,…] }, "viewElementEvents":{ "onsubmitevent":{ "uri":"https://.../ viewelementevents/add" } } } }
  11. 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. 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. 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
  14. 14. EMF-REST generation process 14
  15. 15. Conculsion & future work  EMF-REST generates truly RESTful APIs for EMF models.  EMF-REST complements the existing (Java-based) API generation facilities EMF already provides and extends them to the Web.  Future work: – Storage configuration (currently only file-based in supported) – Configuration of the generated API – Definition of how model elements should be serialized. 15
  16. 16. Thank you! 16 • Visit us at: http://som- • Hamza Ed-douibi: •Javier Cánovas: •Jordi Cabot: