OxyGenerator User Guide

Key Concepts

  • Model: A model is a file containing a tree of elements. Each element have a list of attributes. Each model has an associated generator.
  • Generator: A generator is a special model that describes the structure and the meaning of other models. It specifies:
    • the types of elements and their attributes
    • the hierarchical constraints of the elements
    • some custom model constraints
    • some transformation rules
    • There is a meta-generator (xy.generator.2.0) that describes the structure of all the generators including itself.
  • Transformation: It is the process of applying a generator transformation rules on a model in order to get some output models.
  • Code generation: It is a special kind of transformation that creates code models (models associated to the ultimate xy.any genrator) that can be easily converted to files, folders and textual elements.
  • Design: It is a special kind of transformation that creates graphical models (models associated to the ultimate xy.design.source genrator) displayed in the design view.

Creating a Generator

To create a generator, click on the menu “File/New/New Generator…”. You then obtain a model composed of several nodes:

  • The “Input” node below which the generator input data is described.
  • The “Output” node below which the specification of the generator output data is described.

Once finished, the generator must be installed through the menu  “Engine/Install current generator”.. Note that this action copies the generator model to the engine repository (click on the menu “Tools/Options” to locate the repository directory). For example, the generator which name is “ab.cd” will be installed in the “ENGINE_REPOSITORY/ab/cd” directory. Each generator “ComplexType” item can be associated with an icon. Example: The ComplexType named “ef” of the “ab.cd” generator will be associated with the icon “ENGINE_REPOSITORY/ab/cd/ef.gif”.

Creating a Graphical Editor

To create a graphical editor (designer), click on the menu “Tools/New Designer…”. You then obtain a default designer model.  Note that a designer is a special type of generator. Once finished, it must be installed through the menu  “Engine/Install current generator”. The target models will then be viewable and editable through the design view.

Creating a Reverse Engine

To create a reverse engine, click on the menu “Tools/New Reverse Engine…”. Note that a reverse engine is a special type of generator. Once finished, it must be installed through the menu  “Engine/Install current generator”. It will then be possible to reverse-engineer the target nodes.

Creating a Model Migrator

To create a model migrator, click on the menu “Tools/New Migrator…”. Note that a migrator is a special type of generator. Once finished, it must be installed through the menu  “Engine/Install current generator”. It will then be possible to migrate the target models.

Export/Import XML

The menus “File/Export/Export Model To XML…” and “File/Import/Import Model From XML…” allow to export and import models for interoperability with other tools.

The built-in generators

The API

In order to automate the build system, you can opt to use Java API. The following jar files must be included in the classpath:

  • <INSTALL_DIRECTORY>/lib/generatexy.jar
  • <INSTALL_DIRECTORY>/lib/generatexy_lib/*.jar

Java >= 1.6 is required.

Example:

Screencast(s)

    • Video 1: This video shows how to use OxyGenerator to generate code from an XML file

    • Video 2: This video gives an example of model-to-text transformation through the creation of a C++ code generator

    • Video 3: This video shows how to create a custom graphical editor using OxyGenerator