Developing the GMF model to add a new mediator in WSO2 Integration Studio-Part 1

Praveen Nadarajah
5 min readApr 16, 2019

A mediator can be added to WSO2 EI Tooling by configuring the following GMF models

  1. esb.ecore
  2. esb.genmodel
  3. esb.gmfgraph
  4. esb.gmftool
  5. esb.gmfmap
  6. esb.gmfgen

This article is a step by step guide to developing the GMF model to add a new mediator in WSO2 EI Tooling.

It is always advisable to take an already developed mediator as a reference(log mediator/property mediator) and start to develop your own mediator. Also, it is recommended to save all the changes instantly to avoid issues.

Let’s have a look at the Log Mediator.

Following screenshot depicts Log mediator ecore model.

We can see the properties view consists of the attributes configured in the ecore model.

Now let's see how to add a simple Calculator mediator to WSO2 EI Tooling. We have to start developing the GMF model. Note that we have to model all six sub-models of the GMF model(ecore, genmodel, gmfgraph, gmftool, gmfmap and gmfgen).

Let’s start developing the sub-models one by one.

ecore model

  1. Go to the plugin “org.wso2.developerstudio.eclipse.gmf.esb” in the project explorer. Double click on it. Select model → esb.ecore

2. Double click on “esb.ecore”. Select platform → esb.

3. Right click on the “esb” element(Only child element of the root) and create a new EClass by selecting New Child → EClass.

4. Right click on the newly created EClass and click on “Show Properties View”. We will get properties view to update properties for newly created EClass.

5. Set the name for EClass by adding “CalculatorMediator” for “Name” property.

6. We need to set “ESuper Types”. Click on the button in the value section of ESuper Types.

7. Select “Mediator → EsbElement” and click on “Add” button. Click “OK”.

Now we need to add attributes to the Calculator mediator.

8. We are going to add input connector for the mediator first. Right click on CalculatorMediator and select New Child → EReference

9. Set “inputConnector” for the Name property.

10. Set Containment property to “true”

11. We need to set EType for inputConnector. For this, we need to create EType first. Right click on the CalculatorMediator and select New Sibling → EClass.

12. Name newly created EClass as “CalcualtorMediatorInputConnector” and set InputConnector → EsbConnector for ESuper Types property.

13. Now we need to set CalcualtorMediatorInputConnector EClass as the “EType” of inputConnector reference. Click on the inputConnector reference of CalculatorMediator. Go to properties view and set CalcualtorMediatorInputConnector as the EType.

14. Then we are going to add output connector for the mediator. Right click on CalculatorMediator and select New Child → EReference

15. Set “outputConnector” for the Name property.

16. Set Containment property to “true”

17. We need to set EType for outputConnector. For this, we need to create EType first. Right click on the CalculatorMediator and select New Sibling → EClass.

18. Name newly created EClass as “CalcualtorMediatorOutputConnector” and set OutputConnector → EsbConnector for ESuper Types property.

19. Now we need to set CalcualtorMediatorOutputConnector EClass as the “EType” of outputConnector reference. Click on the outputConnector reference of CalculatorMediator. Go to properties view and set CalcualtorMediatorOutputConnector as the EType.

20. Save the file. Now, We have modeled the minimum structure for Calculator mediator to start with.

This ends the modeling of esb.ecore.

There is a complete reference/sample for GMF at

https://wiki.eclipse.org/Graphical_Modeling_Framework/Tutorial/Part_1 and more parts are covered at https://wiki.eclipse.org/Graphical_Modeling_Framework/Tutorial/Part_2 and https://wiki.eclipse.org/Graphical_Modeling_Framework/Tutorial/Part_3

The above reference/sample will give a complete idea about how GMF works and its functionalities.

References

--

--