JWT Transformations

From Eclipsepedia

Jump to: navigation, search


Introducing JWT Transformations


  • Transformation : an import or an export.
  • Import: A process producing a JWT workflow out of an input.
  • Export: A process producing an output out of a JWT workflow.



Use Cases

Here are a few use cases of transformations :

  • migration : export JWT workflows to use them elsewhere

How to use it




Transformations Gallery





This transformation uses XSLT.


See the JWT2XPDL documentation for extensive specifications.


jPDL is jBoss jBPM's XML-based executable workflow language.

This transformation uses XSLT.



  • Use XSLT
    • cons: DOM/SAX not so fun to use
    • pros: full Java, maybe easier to use

Here are some mappings:

  • InitialNode -> start-state
  • (automatic) Action (without role) -> node
    • Application -> action (same a Bonita hook)
  • (human) Action (with role) -> task
  • role -> swimlane



We have two different transformations:


These transformations use ATL.




This transformation uses ATL.

ECM Sync Demo

Export transformations to Document Management Systems, namely to Nuxeo or Alfresco. These transformations use the ECM synchronization JWT plugin in order to demonstrate how it can be used.

For developers

Core concepts


As of the 1.3.0 release, two extension points are available :

  • org.eclipse.jwt.transformations.transformations, which allows to define a new implementation processing input in order to produce output.
  • org.eclipse.jwt.transformations.iodefinitions, which allows to define types of input/output, and widgets to allow the user to choose these input/output. For instance, org.eclipse.jwt.transformations.iodefinitions.default.export.output.local is an iodefinition bundled with the transformation-base plugin, that allows the user to pick a local file

The latest plugin.xml is available online here : [1]. If you installed JWT in your Eclipse instance, formated documentation is available in the "Plug-ins" view, when selecting the "org.eclipse.jwt.transformations.baseTransformation" plugin, then "Extension points", then "Show extension point description".

When the plugin is started


When a transformation is called




How do I add a transformation to JWT?

Of course, it requires org.eclipse.jwt.transformation.base plug-in.

First, choose the input and output that your transformation will handle. Existing IODefinitions can be listed in Eclipse: just open the Plug-ins view, double-click org.eclipse.jwt.transformation.base, then click "Extension points", then select the "org.eclipse.jwt.transformations.iodefinitions" extension point and click "Find references". This will provide you with pointers to existing IODefinitions and their implementation. If no existing IODefinition suits your needs, you can always declare yours (see next section). The Java types corresponding to these IODefinitions, along with their (optional) parameters should be documented in the implementing class. TODO : list all implementations available by default here.

Second, implement a class that extends AbstractTransformation. The core method to implement is "void transform(Object input, Object output)" : it will allow you to perform the actual transformation, with the input and output chosen by the user as parameters (whose type depends on the IODefinition).

Finally, create an extension for the extension point "org.eclipse.jwt.transformations.transformations" that defines a name for your transformation and the class that implements the transformation (extending TransformationService), along with the iodefinitions you chose and more other optional fields. See #Core concepts for more information about extension points.

How do I add an IODefinition to JWT?

It also requires org.eclipse.jwt.transformation.base plug-in.

First, implement a class that extends AbstractIODefinition. The core method to implement is "IOHandle createIOControl(Composite parent, ContentChangeListener pageListener, IStructuredSelection currentSelection);". If you want to access a parameter loaded from an IODefinition reference, use "getParameter(String name)". The code of AbstractIODefinition and its interface, IODefinition is fully documented.

Then, create an extension for the extension point "org.eclipse.jwt.transformations.iodefinitions" that defines a label, the class that implements the transformation and the supported parameters.

XSLT Based Transformation



ATL Based Transformation


  • an ATL based transformation plugin requires the org.eclipse.m2m.atl.engine plugin, or the more recent org.eclipse.m2m.atl.engine.emfvm plugin.



 * This sample is shared under WTFPL
 * http://sam.zoy.org/wtfpl/
package org.eclipse.jwt.transformations.bpmn;
import java.net.URL;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.emf.common.util.URI;
import org.eclipse.m2m.atl.drivers.emf4atl.ASMEMFModel;
import org.eclipse.m2m.atl.engine.AtlEMFModelHandler;
import org.eclipse.m2m.atl.engine.AtlLauncher;
import org.eclipse.m2m.atl.engine.AtlModelHandler;
 * Should implement a template method pattern...
class ATLTransformation {
	private static ATLTransformation instance = null;
	private AtlEMFModelHandler modelHandler;
	private URI XML_ModelResource;
	private URI JWT_ModelResource;
	private URI BPMN_ModelResource;
	private URL JWT2BPMN_TransfoResource;
	private URL BPMN2JWT_TransfoResource;
	private ASMEMFModel xmlMetamodel;
	private ASMEMFModel jwtMetamodel;
	private ASMEMFModel bpmnMetamodel;
	private URL JWT2BPMN_Pool_TransfoResource;
	private URL JWT2BPMN_Sub_TransfoResource;
	static public ATLTransformation getInstance() {
		if (instance == null)
			instance = new ATLTransformation();
		return instance;
	private void createResources() {
		modelHandler = (AtlEMFModelHandler) AtlModelHandler
		JWT2BPMN_TransfoResource = ATLTransformation.class.getResource("resources/JWT2BPMN.asm");
		JWT2BPMN_Pool_TransfoResource = ATLTransformation.class.getResource("resources/Jwt2BpmnAllInPool.asm");
		JWT2BPMN_Sub_TransfoResource = ATLTransformation.class.getResource("resources/Jwt2BpmnAllInSub.asm");
		BPMN2JWT_TransfoResource = ATLTransformation.class.getResource("resources/BPMN2JWT.asm");
		xmlMetamodel = (ASMEMFModel) modelHandler.loadModel(
				"XML", modelHandler.getMof(), XML_ModelResource);
		jwtMetamodel = (ASMEMFModel) modelHandler.loadModel(
				"jwt", modelHandler.getMof(), JWT_ModelResource);
		bpmnMetamodel = (ASMEMFModel) modelHandler.loadModel(
				"bpmn", modelHandler.getMof(), BPMN_ModelResource);
		models.put("XML", xmlMetamodel);
		models.put("jwt", jwtMetamodel);
		models.put("bpmn", bpmnMetamodel);
	public void jwt2bpmn(String inFilePath, String outFilePath) {
		try {
			// get/create models
			// load models
			models.put("IN", jwtInputModel);
			models.put("OUT", bpmnOutputModel);
			// launch
					Collections.EMPTY_MAP, models, Collections.EMPTY_MAP,
					Collections.EMPTY_LIST, Collections.EMPTY_MAP);
			modelHandler.saveModel(bpmnOutputModel, outFilePath, false);
		} catch (Exception e) {
	public void bpmn2jwt(String inFilePath, String outFilePath) {
		try {
			// get/create models
			// load models
			models.put("IN", bpmnInputModel);
			models.put("OUT", jwtOutputModel);		
			// launch
					Collections.EMPTY_MAP, models, Collections.EMPTY_MAP,
					Collections.EMPTY_LIST, Collections.EMPTY_MAP);
			modelHandler.saveModel(jwtOutputModel, outFilePath, false);
		} catch (Exception e) {
		for (Object model : models.values())


  • Add metamodel description to ATL
