Chapter 3. Calling Kermeta internal code from a standalone Java program

This tutorial aims to show how to directly call the richFoo and they operations without going through the @main operations. (usefull for example for fine grain UI integration with aspectized code). This is a variant of the tutorial Chapter 2, Calling Kermeta main operations from a standalone Java program but instead of relying on the generated runner classes, the user directly call the kermeta classes and operations. Then, depending on the origin of the classes, these classes can then be used either with a pure EMF point of view (ie. only using the EMF generated code) or might be manipulated as Kermeta (ie. using the aspect). This requires some understanding of the architecture of the generated code.

TODO explain and illustrate

3.1. Presentation/key points

This tutorial will detail the following points:

  1. Create a new Kermeta project

  2. Declare some classes and some operations

  3. Generate a basic jar file from the Kermeta project (using a simplified pom.xml)

  4. Create a new Java project that depends or embedds the jar of the kermeta project

  5. In the java code, call the initialization of the kermeta code

    create some object from Kermeta classes and call operation on it it.

  6. In the Kermeta project, add an ecore model with some operation

    By aspect, add some behavior to the operation.

  7. In the java code, in pure EMF style, load a model conforming to this ecore.

    Call kermeta aspect operation by using exclusively the EMF api.

  8. Execute the java program as a standalone application