Heiko Kern has written a great set of information on how to process MetaEdit+ models with oAW (the openArchitectureWare model transformation tools for Eclipse). The integration he's built is a great example of how easy it is to integrate MetaEdit+ with other tools:
- You can export models or metamodels from MetaEdit+ as XML. The format is an extension of the open Graph eXchange Language standard, GXL, supported by over 40 tools.
- You can quickly write a little generator to output your models in whatever XML or other text format you want.
- MetaEdit+ can call other tools from its generators, e.g. for build integration.
- Other tools can call MetaEdit+ with command-line parameters to specify a series of actions to run.
- Other tools can call MetaEdit+ through its WebServices / SOAP API, to create/read/update/delete any data in models, and for control integration, e.g. to animate models for model-level debugging.
- You can import models or metamodels as XML.
- You can import text in any format and convert it to models via reverse engineering generators.
At last year's OOPSLA DSM workshop, Heiko had an article about his MetaEdit+ / Eclipse integration. We had a good discussion about it, in particular about his reasons for building it. His paper gave the impression that he wanted to use oAW rather than MetaEdit+'s own MERL generator language, because he needed some specific features in oAW. It turned out though that he hadn't actually used MERL, and didn't realise that MERL and oAW's XPand are actually very similar in terms of approach and functionality.
MERL tends to be a little more succint: here is the MERL generator to output simple Java classes for a UML Class Diagram, as in Heiko's example:
subreport '_translators' run
foreach .Class [UML]
{ filename id '.java' write
'public class ' id ' {' $cr2
do :Attributes
{ ' ' :Visibility ' ' :Data type; ' ' :Name ';' $cr2
' public void set' :Name%irstUpper '(' :Data type; ' ' :Name ') {' $cr
' this.' :Name ' = ' :Name ';' $cr
' }' $cr2
' public ' :Data type; ' get' :Name%irstUpper '() {' $cr
' return this.' :Name ';' $cr
' }' $cr2
}
'}'
close
}
Heiko's oAW XPand code is 65% longer. Even ignoring the extra loop over all Class Diagrams that Heiko needs (MetaEdit+ offers that automatically in the UI or via the forAll:run: command-line parameter), oAW is still over 20% longer. The actual difference isn't that important: I'm sure both could be made shorter for this example, but the current code is typical of what is generally written. My point is that there's no real saving to be had by using XPand instead of MERL. If your models are in MetaEdit+, use MERL; if they're in Eclipse, use oAW. Having integration is great, but if you can avoid using it then that's even better.