Friday, April 3, 2009

oAW WorkflowComponent for EMF-Compare in no time

EMF-Compare is a really cool framework to identify differences between EMF based models in no time. Together with two collegues I am currently writing an article to show the main facts and how the results could be used in a MDSD-approach. In our first step we created a class to trigger the Match- and DiffService to have a Diff-Model as a result. After having that, we wanted to use the generator-framework openArchitectureWare to generate a more readable report of the differences. For that reason we used the serialized diffmodel as input for the generator. After playing around with that, we saw that it is annoying to have two different steps. One for the creating the diffmodel and one for generating the report.
The first thing you might think of when you have this use case is creating an ant-script. In our case we wanted to integrate the creating of the diffmodel in the generator-workflow. For that reason we implemented an custom workflow-component.
I was wondering how fast an easy it could be to do that. You only have to extend the Class AbstractEmfWorkflowComponent and fill the method invoke(WorkflowContext ctx, ProgressMonitor monitor,Issues issues). By doing that you could reuse the already done configurations from the workflow. For example the loading of the necessary metamodels and so on .

In our special case we wanted to have special parameters. To do that you only have to have getters and setters for that stuff. After implementing the method checkConfiguration(Issues issues) it was possible to check it the necessary parameters have been passed to the Component.

The next thing that was really cool is that we do not have to persist the diffmodel any more. We only have to pass the result to the modelslot of the Workflow. By doing that the diffmodel could be used by following Components within the Workflow.

As you can see from the screenshot of the Workflow the new Component is now well integrated and no extra step is necessary.