Skip to content

MWE2 based plain Java application

lunkpeter edited this page Jan 4, 2016 · 5 revisions

MWE2-based plain Java application

Model transformation chains can be defined using a specialized description language. This approach has a number of benefits compared to the regular approaches:

  • The sequence of model transformation steps can be easily specified and maintained.
  • Nontrivial side-effect relations between transformation steps can be handled.
  • The execution of event-driven transformations can be explicitly controlled.
  • Because of the specialized language, the description code base is short and easily expandable.

Generic modeling workflows can be easily described via using the Xtext Modeling Workflow Engine. It enables the creation of components with various attributes, and it executes them in order. More, exact information about the Xtext MWE 2 can be found here.

Implementing Transformation chains using MWE 2 workflows

The VIATRA transformation framework supports the definition of model transformation steps using MWE2 workflows.

EMDW-MC workflow

the following figure shows the high level architecture of the EMDW-MC workflow.

  • The initial UML model is transformed into an XtUML model instance by an event driven transformation step.
  • CPP model instance is created by an event-driven and a batch transformation (Including the rALF action code snippets) (Event driven --> maintains component structure, batch --> creates sub-components) .
  • C++ code snippets are created based on the CPP model structure and action codes.
  • final project structure and auxiliary resources are created.

high level toolchain architecture

(Blue = Event-driven transformation, Red = Batch transformation)

Plain Java App usage and constraints

The plain Java app is a Java console application capable of executing the EMDW-MC workflow on a specified input model. It is contained in an executable .jar file that is available for download in this folder. The application has the following input parameters:

Parameter Mandatory
Source UML model direct location Yes
Output folder location Yes
MWE2 workflow file location Optional

As it can be seen on the table above, the application has three main input parameters. The first two are the exact location of the source UML model and the output directory (The generated C++ code will be copied here). The application allows the insertion of a custom MWE2 workflow file. Its location can be specified via using the third parameter. If the MWE2 workflow is not specified, the application will use the one contained in the executable jar file.

An example for accessing the EMDW-MC MWE2-based Java application:

java -jar com.incquerylabs.emdw.toolchain.mwe2integration.plainjava-1.0.0-SNAPSHOT.jar "D:/user/eatf.uml" "D:/user/target"

The running application:

running example

Usage constraints and pitfalls

Usage constraints

  • Always use full location path strings while specifying the input model and output folder. Incorrect location string definition can cause major errors and lead to cryptic error messages. (missing resource factories, etc...)

error example

  • Use forward slashes in location strings

Pitfalls during development

  • Building a plain java application that utilizes EMDW features. details here
  • Pathing implementation
  • During the execution of the EMDW workflow, a number of external resources are needed, which can be accessed via specified location constants.
  • In an Eclipse plugin-in based environment, location strings can include both forward and backward slashes.
  • If the resources need to be extracted from a jar file, only forward slashes can be used in location strings.
  • A Jar file manager has been implemented that is responsible for normalizing these location strings.
  • Incorrect external resource resolution can lead to incorrect output models, or non-intuitive errors.
Clone this wiki locally