Skip to content
Timur Sağlam edited this page Mar 10, 2020 · 35 revisions

The Ecorification of Java code was originally developed as a part of a bachelor's thesis. The thesis is accessible at KITopen.

Ecorification of Java Code

This project is a proof of concept for the automatic integration of Ecore functionality into Java code. The resulting code can be used exactly as before, but it also uses the modeling infrastructure and implements all interfaces for Ecore-based tooling. To achieve this, the original Java code will be interlaced with the generated model code of an Ecore metamodel that was automatically extracted from the original Java code (see 0. Concept). For the extraction of Ecore metamodels from Java code, an automated approach was developed (see the EcoreMetamodelExtraction project and its wiki).

IMPORTANT: This first implementation is prototypical and is opposed to the Ecore metamodel extraction currently limited to the ecorification of few selected features.

Ecorification Process

The Ecorification process currently consists of the following steps:

  • Extracting an Ecore metamodel from the project (see EcoreMetamodelExtraction) and retrieving the output project.
  • Generating a GenModel for the Ecore metamodel using it to generate the model code (see 1.).
  • Renaming the original Ecore factories and generating custom factories in their original place (see 2.).
  • Preparing the Origin Code: Creating default constructor stubs and exposing non-public classes (see 3.).
  • Generating the wrapper classes and adding the necessary Xtend dependencies (see 4.)
  • Adapting the Ecore code to use the original Java types instead of the Ecore types (see 5.).
  • Editing the realization and specialization relations of the original classes (see 6.).
  • Encapsulating the fields of the original classes before removing them and their access methods from the origin classes to replace them by their Ecore counterparts (see 7.).

These steps are visualized in the following diagram:

Diagram of the Ecorification Workflow