Model-Based Systems Engineering (MBSE) is one of the most important approaches to managing complexity. Using models as central artifacts also implies that they have to be integrated with other development artifacts. It also means that the tools being used to create and manage systems engineering models should be integrated with other tools.
Some kinds of such integrations require transformations of different kinds of models.
Within the Eclipse framework, the Xtend project provides good support for model-to-model and model-to-text transformations. On the tooling side, Cameo is one of the widely-used tools for creating and managing SysML models.
For accessing the SysML model, Cameo and MagicDraw provide a rich API. The API is Java-based. And since Xtend is fully integrated with Java, we can easily write Cameo integrations and extensions with Xtend.
MagicDraw comes with detailed explanations and demos of customization projects built with Eclipse.
However, when we tried using the API with Cameo, we had to do a couple of additional steps. For some of them, hints needed to perform them successfully were spread over several support forum entries.
Using the basic documentation, you have Cameo installed, but MagicDraw is started. Since the installed license is valid only for Cameo, the tools request another valid license for MagicDraw.
Solution: Manually add the brand_api.jar to the MagicDraw project, which is contained in the IDE integration package provided by NoMagic.
In order to get a full SysML version running, we needed to add further plugins to the classpath:
Instead of Java, we can use Xtend code to create, modify, or process the SysML model. Here is some simple code to create a SysML block in a package blocks:
Xtend is part of the Eclipse ecosystem and freely available. The benefits of Xtend are explained in my talk at EclipseCon 2017.
We are now able to create a plugin, as described in the MagicDraw documentation. Since we are using Xtend, we have to add the Xtend jars to our project:
and to the Cameo-specific plugin.xml:
Now we only have to create a jar of our project, using the Eclipse export functionality:
Make sure that you include the xtend-gen directory in the export as well:
And that's it! Now we are actually ready to run Camo with our Xtend-based extension in the Eclipse IDE.
You want to learn more about model transformations?