How to extend AADL model management in Osate

From AadlWiki

Jump to: navigation, search

Contents

Presentation

When working with models, several issues come into play. Models often exist into different versions and the transformation from a one to another is not always an easy operation. The edition of a model by more than one person at the same time also lead to issues like conflicts if the sharing of the model is not well established.

The visualization of models is an important feature too. Going further than the simple display of model files in an explorer could be a great contribution for a modeling tool.

Sphinx is a technology allowing all of these.

The plug-in org.osate.aadl2.ide lays the foundation for use some Sphinx features into Osate. Moreover, this contribution will allow the use of Osate into a tool based on Sphinx. Its mechanisms integration will be interesting for the development of advanced modeling tools that manage both AADL and other metamodels.

This page will present examples of using this plug-in. It will also present the Sphinx technology and its integration into Osate.

Example of utilization

This part shows some examples of using the org.osate.aadl2.ide plug-in.

Note that for using this plug-in, the target platform sphinx-adopter-4.2.target contained in the org.osate.build.target need to be set. Sphinx can also be directly installed with its update-site.

Model Explorer

In a modeling tool using a tree view navigator to display the project and its contents, it can be interesting to display all or part of the model tree in the explorer. With Sphinx, it is possible to achieve this by contributing to an explorer view that extend the Common Navigator.

The following snapshot is an example of such a contribution:

Image:Aadl tree view example.png

The previous image shows a model tree view as child of the model file which is not done by default.

Sphinx is using a shared editing domain to edit multiple models. Thus, several editors, common navigator views and the property view can contribute to the edition of the same model in memory. However, there is no sharing allowed with Xtext resources, they are not compatible with Transactional editing domain yet and so neither with Sphinx. Modifications made in the Xtext editor will need to be saved to update common navigator views (or any views or editors using Sphinx).

The following sections present a way to contribute to a Common Navigator using complementary mechanisms of Sphinx, which offer even more opportunities, particularly in terms of filtering.

Navigator content declaration

To contribute to a navigator view, we first need to declare a navigator content using the org.eclipse.ui.navigator.navigatorContent extension point. This can be done in any plug-in (for example a plug-in named org.osate.aadl2.ide.ui) with org.osate.aadl2 and org.osate.aadl2.ide plug-ins as dependencies.

This is full example (that can be used directly) of a navigator content declaration calling some Sphinx's classes for the content and label providers. We also defined trigger points and possible children to filter element we want to see in the content.

<extension point="org.eclipse.ui.navigator.navigatorContent">
 <navigatorContent id="org.osate.aadl2.ide.ui.navigatorContent"
                   name="AADL2 Contents"
                   contentProvider="org.eclipse.sphinx.emf.explorer.BasicExplorerContentProvider"
                   labelProvider="org.eclipse.sphinx.emf.explorer.BasicExplorerLabelProvider">
   <triggerPoints>
     <and>
       <instanceof value="org.eclipse.core.resources.IFile" />
       <test property="org.eclipse.sphinx.emf.isInScope"
             value="true" />
       <test property="org.eclipse.sphinx.emf.metaModelIdMatches"
             value="org\.osate\.aadl2\.metamodel\.descriptor" />
     </and>
   </triggerPoints>
   <possibleChildren>
     <and>
       <instanceof value="org.eclipse.emf.ecore.EObject" />
       <test property="org.eclipse.sphinx.emf.classNameMatches"
             value="org\.osate\.aadl2\.model\..*" />
     </and>
   </possibleChildren>
 </navigatorContent>
</extension>

Sphinx viewer declaration

Sphinx provides a common navigator view named Model Explorer as example. Using the org.eclipse.ui.navigator.viewer, we declare a viewer linked to the previous navigator content in the same plugin.xml file.

<extension point="org.eclipse.ui.navigator.viewer">
 <viewerContentBinding viewerId="org.eclipse.sphinx.examples.explorer.views.modelExplorer">
   <includes>
     <contentExtension pattern="org.osate.aadl2.ide.ui.navigatorContent" />
   </includes>
 </viewerContentBinding>
</extension>

It is also possible to use the Eclipse's Project Explorer by giving the value org.eclipse.ui.navigator.ProjectExplorer to the viewerId property.

Model Editing Enhancements

The Sphinx tutorial also shows how to customize the model's tree view like adding new children or transient nodes, or removing nodes.

Sphinx

Sphinx is an integrated modeling tool platform that eases the creation of integrated modeling tool environments supporting individual or multiple modeling languages (which can be UML-based or native DSLs) and has a particular focus on industrial strength and interoperability. It offers advanced mechanisms on top of EMF to handle huge models, to support several meta-model versions, to share models in memory between several editors, etc.

Sphinx provides:

  • services for managing the life-cycle and editing domains of model instances that need to be centrally provided and shared in the workspace of Sphinx-based modeling tool applications ;
  • common runtime-level enhancements such as description of meta-models, description of shared model instances including their scopes, meta-model compatibility services, as well as a couple of performance optimizations and utilities ;
  • extended runtime-level services for validating models or model fragments with validation results visualization ;
  • extensions enabling model-based compare/merge operations to be carried out on shared model instances ;
  • common logic for creating explorer views, form editors, and graphical editors operating on shared model instances.

Meta-model Descriptor

In EMF, each model is contained in one resource and the kind of model is identified by the extension of the filename. One objective of Sphinx is to explicitly describe each meta-model. In deed, identifying the meta-model of a model by the extension of the filename does not allow fine management, such as support for various versions of the meta-model. Sphinx offers a mechanism to explicitly describe the meta-models in use, and in particular each version of these meta-models to ensure model transformations from one version to another one.

A meta-model descriptor is the basis in using Sphinx and must be defined to use its services. This concept allows a link between a file (more precisely its content type) and the model contained into it.

Content types

To describe a meta-model, we fist need to define a content type. Two content types have been added to the org.osate.aadl2 project through two org.eclipse.core.contenttype.contentTypes extension points. The content type org.osate.aadl2.aadlFiles is defined for files with the .aadl and .aadl2 extensions and org.osate.aadl2.aaxlFiles is defined for files with the .aaxl and .aaxl2 extensions. Besides meta-model descriptors, content types describe AADL files content by abstracting file extensions (this could be especially useful for .aaxl files which represent AADL models or AADL instance models).

Content types are also used by Sphinx to optimize loading of model files.

Meta-model descriptor definition

The description of a meta-model is done by a class that implements org.eclipse.sphinx.emf.metamodel.IMetaModelDescriptor. It is possible to directly extend the abstract class org.eclipse.sphinx.emf.metamodel.AbstractMetaModelDescriptor provided by Sphinx. A meta-model descriptor shall be declared with the extension point org.eclipse.sphinx.emf.metaModelDescriptors.

Two meta-model descriptors have been defined inside the new org.osate.aadl2.ide plug-in. These meta-model descriptors contain an ID, the namespace of the AADL meta-model together with the sub package Instance (in the case of .aaxl files) and a getter that returns the content type identifier (org.osate.aadl2.aadlFiles or org.osate.aadl2.aaxlFiles.)

In the current implementation, only the version 2.0 of AADL is supported.

External links

Personal tools