Skip to content

Repository files navigation

SimplePDL: A Simple Process Definition Language

This project implements a simple Process Definition Language (PDL) using Model-Driven Engineering (MDE) techniques with the Eclipse Modeling Framework (EMF). It uses Ecore for metamodeling and Acceleo for code generation from SimplePDL models.

GitHub Repository: github.com/tomdieu/simplePDL

Technologies Used

  • Eclipse Modeling Framework (EMF)
    • Ecore: For defining the SimplePDL metamodel (model/simplePDL.ecore).
  • Acceleo: For defining model-to-text transformations (code generation) (src/simplePDL/main/generate.mtl).
  • Java: For the Acceleo generator launcher (src/simplePDL/main/Generate.java).
  • Ant: For automating the generation process (tasks/).
  • XMI: For persisting model instances (instances/).

Project Structure

  • model/: Contains the SimplePDL metamodel (simplePDL.ecore) and related files.
  • src/: Contains the Acceleo generation templates (generate.mtl) and the Java launcher (Generate.java).
  • instances/: Contains example model instances conforming to the SimplePDL metamodel (e.g., MakingCoffe.xmi, WritingAReport.xmi).
  • tasks/: Contains Ant build scripts (generate.xml, generateTarget.xml) to automate the code generation process.
  • output/: The default directory where generated files (e.g., .dot, .html) are placed based on current examples.
  • META-INF/: Contains the OSGi bundle manifest (MANIFEST.MF), indicating this is structured as an Eclipse plugin.
  • bin/: Compiled Java classes and Acceleo templates.

Prerequisites

  • Java Development Kit (JDK): Version 17 or later (as specified in META-INF/MANIFEST.MF).
  • Eclipse IDE: An Eclipse installation with the Eclipse Modeling Tools (including EMF and Acceleo) is recommended.
  • Ant: Required if you want to run the generation using the provided Ant scripts.

How to Use

  1. Explore the Metamodel: Open model/simplePDL.ecore in your Eclipse IDE (with EMF tooling installed) to understand the structure and concepts of the Simple Process Definition Language.

  2. Examine Instances: Look at the .xmi files in the instances/ directory to see examples of SimplePDL models. You can create your own .xmi files based on the simplePDL.ecore metamodel using an EMF-based editor.

  3. Run Code Generation:

    • Using Ant (Recommended within Eclipse):
      • Modify the tasks/generateTarget.xml file if necessary. By default, it points to ${basedir}/model/file.xmi which might need changing.
      • Set the MODEL property to the path of your input .xmi model instance (e.g., value="${basedir}/instances/MakingCoffe.xmi").
      • Set the TARGET property to your desired output directory (e.g., value="${basedir}/output"). The default in the file is ${basedir}/src-gen.
      • Right-click on tasks/generateTarget.xml in Eclipse and choose "Run As" > "Ant Build".
    • Using Java Application:
      • The src/simplePDL/main/Generate.java class includes a main method allowing standalone execution.
      • You can configure a Java Application launch configuration in Eclipse.
      • Provide the absolute path to the model file (.xmi) as the first argument and the absolute path to the target output directory as the second argument.
      • Ensure the classpath is correctly set up to include all necessary EMF and Acceleo libraries (refer to tasks/generate.xml for a list of required JARs/plugins).
  4. Check Output: The generated files (likely .dot and .html based on the output/ folder contents) will appear in the specified target directory.

Creating a New Acceleo Generation File (Using Eclipse Wizard)

If you want to create a new Acceleo generation file (.mtl) from scratch within Eclipse:

  1. Open the Wizard: Go to File > New > Other....
  2. Select Acceleo Module: Expand the Acceleo Model To Text category and select Acceleo Module File. Click Next.
  3. Fill the Details (referencing the provided image):
    • Parent Folder: Browse and select the source folder where you want to create the file (e.g., /simplePDL/src/simplePDL/main).
    • Module Name: Enter a name for your module (e.g., generate). This will be the base name of your .mtl file.
    • Metamodel URIs: This is crucial. Click the + button. In the dialog that appears, enter the namespace URI of your metamodel. For this project, it is http://www.example.org/simplePDL (found in model/simplePDL.ecore). Click OK. The error message "The list of metamodel URIs... is empty" should disappear.
    • Template Name: Enter a name for the initial template function that will be created inside the module (e.g., generateElement).
    • Type: Ensure Template is selected.
    • Generate documentation: Check this if you want basic documentation comments generated.
    • Generate file: Check this if you want the template to be wrapped in a [file(...)] block, which directs Acceleo to generate a separate file. This is common for the main template.
    • Main template: Check this if this template should be the main entry point for generation (annotated with @main).
    • Initialize Contents: Check this to generate basic boilerplate code within the template.
  4. Finish: Click Finish. A new .mtl file will be created in the specified parent folder with the initial content based on your selections.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages