OData-generator is an Eclipse plugin to generate OData services from UML models. From an initial UML model, the tool generates an OData service for a MySQL database conforming to the model definition, including the transformation of OData requests to SQL queries. The tool relies on an OData pivot metamodel, which is used to represent and generate OData services.
The plugin provides a contextual menu to obtain a OData model from a UML model. Given the obtained OData model instance, the plugin includes a menu to generate:
- The metadata document conforming to the OData specification.
- The DDL of the database.
- A Maven-based project containing the implementation of the OData service based on Apache Olingo and JOOQ.
- Java EE distribution of Eclipse IDE (it can be found here).
- A MySQL database (tested in MySQL 5.7)
- Open Eclipse IDE
- Click on Help / Install New Software...
- Click on Add... and fill in the form as indicated (the update site is https://opendata-for-all.github.io/odata-generator/update/) then click on OK.
- Select OData generator then click on Next (uncheck Group items by category if the list is empty).
- Follow the the rest of the steps (license, etc...) and reboot Eclipse.
Using the plugin
- Create a Java Project or use an existing project in your workspace (you can import our project called som.odata.generator.example located under the folder examples.
- Import your UML model (a sample model called products.uml in located under the folder examples/sample/).
- Right-click on your UML model and select OData/Generate OData model from UML. This will generate an OData model under the folder src-gen of your project (Check products.edm, the generated model from products.uml).
- Right-click on the generated OData model and select:
- OData/Generate Metadata to generate the corresponding metadata document (check metadata.xml, the generated metadata document from products.edm).
- OData/Generate database schema to generate the DDL of the database (check schema.sql, the generated DDL* from products.edm).
- OData/Generate OData service to generate a Maven project called odata.demo in your workspace containing the implementation of your OData service. Note that you have te refresh your workspace in order to see all the generated files (check the generated odata.demo from products.edm).
Deploy the generated service
- In your database, create a schema called odata and run the generated DDL.
- Add some data to you database (you can use our sample script insert.sql for products.eer).
- In the generated project, update the configuration file called config.properties located under the folder src/main/resources following your database configuration (i.e., host, username, password).
- Build and run the project in Tomcat server using:
- Right-click on the project and select *Run as/Maven install" which will generate a WAR archive for the project
- Right-click on the project and select Run on Server then follow the instructions to run the Web app in your Tomcat server.
Some URL examples for the generated service using the default configuration:
- Service document:
- Metadata document:
- List of products:
- List of suppliers:
- List of the products of supplier 1:
- List of the products of products ordered by name:
- List of the products with the price less or equals to 4:
http://localhost:8080/ODataDemo/DemoService.svc/Products?$filter=Price le 4.00
Who is behind this project?
Hamza, Javier and Jordi are currently members of SOM, a research team of IN3-UOC in Barcelona, Spain.