Adding annex to components

From AadlWiki

Jump to: navigation, search

Sometimes, you want to add annex into your plugin. Some users plug their annex into the Annex Registry in OSATE while other users want to define annex using raw text. This following documentation explains how to add annex to components using the AADL meta-model.

The following project might help: https://github.com/osate/examples/tree/master/plugins/org.osate.pluginsample

In particular in file https://github.com/osate/examples/blob/master/plugins/org.osate.pluginsample/src/org/osate/pluginsample/actions/DoCheckModel.java

You can add an AnnexSubclause to your component by using : AnnexSubclause as = ccl.createOwnedAnnexSubclause(); Then, by default, the object will be an AnnexSubclauseImpl instance. This object lets you define the content of the annex using setAnnexContent and getAnnexContent. You have to define the name of the annex using the setName() method. Otherwise, you will experience issues when using annex-related methods.

Annex are typically registered in the AnnexRegistry of OSATE that contains all information for parsing/unparsing/etc. However, we propose a workaround for people wanting to define annex using text-only. To do so, OSATE implements the following behavior:

  1. OSATE tries to find an appropriate unparser in the registry
  2. If no unparser is found, it looks if the annex is an instance of the default class (AnnexSubclauseImpl)
  3. If it is the default class (AnnexSubclauseImpl), it looks if the text is defined/set and if some text are included, it put it in the model. For that, the AnnexSubclauseImpl has to define the name and the content using setName and setAnnexContent() methods.


Potential issue

In case the Aadl2FactoryImpl class does not create the AnnexSubclause object, you can check if the appropriate code is here. In fact, the code that is required to create the AnnexSubclause is mostly generated and could be overwritten by new code generation functions. Check the following commit that contains all the required changes.

https://github.com/osate/osate2-core/commit/251ed6076a68b8fc721634e8428bfa92edbf4992

Personal tools