Behavior Annex Updates Standard, plugin, and usage inside RAMSES Etienne Borde etienne.borde@telecom-paristech.fr
Behaviour Annex Errata The aadl subcommittee wiki has been updated with the new errata discussed in Toulouse in January 2012. 100% of the 12 errata have been closed: an accepted solution was proposed for each of them. A revised version of the Behavior Annex, in which these solutions are implemented, has been uploaded on the aadl subcommittee wiki. The wiki traces the issues, and rationales for modifications of the standard; thus it is possible to retrieve the reasons for these modifications. https://wiki.sei.cmu.edu/sae-aadlsubcommittee/index.php/errata_from_the_behavior_a nnex page 1 11/28/2012
News about the BA plugin for OSATE News about the Behavior Annex plugin developed at Telecom ParisTech: Update site is available, seehttp://penelope.enst.fr/aadl/wiki for more information Syntax coloring and hyperlinking were added in the BA clauses (explanations hereafter) Continuous integration of our plugins with OSATE, using RAMSES to launch the OSATE and the BA plugin with a command line interfacehttps://circe.enst.fr/hudson/ page 2 11/28/2012
OSATE - Syntax highlighting and hyperlinking How to implement syntax coloring and hyperlinking in an Annex plugin that is not based on Xtext? OSATE provides 2 new extension points: <ext ensi on poi nt =" or g. osat e. annexsuppor t. hi ghl i ght er " > <ext ensi on poi nt =" or g. osat e. annexsuppor t. t ext posi t i onr esol ver " > page 3 11/28/2012
OSATE - Syntax highlighting <ext ensi on poi nt =" or g. osat e. annexsuppor t. hi ghl i ght er " > Requires imlementing interface AnnexHighlighter, defining two methods: 1. publ i c voi d hi ghl i ght AnnexLi br ar y( AnnexLi br ar y l i br ar y, AnnexHi ghl i ght er Posi t i onaccept or accept or ) and 2. publ i c voi d hi ghl i ght AnnexSubcl ause( AnnexSubcl ause subcl ause, AnnexHi ghl i ght er Posi t i onaccept or accept or ). Basically, the idea is to use the following method, defined in AnnexHi ghl i ght er Posi t i onaccept or : publ i c voi d addposi t i on( i nt offset, i nt l engt h, St r i ng i d) When calling addposition, offset is the position (wrt the beginning of the file) of the first character to highlight, length is the number of characters to highlight, and id is a predefined type of highlighting (comment, number, keyword, etc ). See AnnexHighlighterPositionAceptor for the complete list of valid Id page 4 11/28/2012
OSATE BA Plugin - Syntax highlighting See plugin.xml file to have the configuration of extension point: <ext ensi on poi nt ="or g. osat e. annexsuppor t. hi ghl i ght er "> In the BA, we only have Annex Subclauses thus we implement: publ i c voi d hi ghl i ght AnnexSubcl ause( AnnexSubcl ause subcl ause, AnnexHi ghl i ght er Posi t i onaccept or accept or ). Our implementation is straight forward: when parsing the BA, the position of strings to highlight (offset, length, and id) are stored in a list, attribute of the BehaviorAnnex class. When our implementation of highlightannexsubclause is called, subclause is of class BehaviorAnnex. Our code go through this list of elements to highlight, retreive their offset, lenght and id, call: accept or. addposi t i on( offset, l engt h, i d) ; Where offset, length and id have been retreived from the list of elements to highlight. page 5 11/28/2012
OSATE HyperLinking <ext ensi on poi nt =" or g. osat e. annexsuppor t. t ext posi t i onr esol ver " > Requires imlementing interface AnnexTextPositionResolver, defining two methods: 1. publ i c voi d Text Posi t i oni nf o r esol veel ement At ( EObj ect annexroot, i nt of f set ) and 2. publ i c voi d Text Posi t i oni nf o r esol vecr ossref er encedel ement At ( EObj ect annexroot, i nt offset) Offset is the position of the mouse, in the text, when one moves the mouse and pushes the «ctrl» key at the same time. The constructor of TextPositionInfo is: Text Posi t i oni nf o( EObj ect model Obj ect, i nt of f set, i nt l engt h) Basically, the idea is to create a TextPositionInfo, modelobject being the object the hyperlinking should «jump to» when one clicks on the hyperlink (resulting from «ctrl+click»); offset and length being the position wher the hyperlink is created as a result of a «ctrl+mouse over the text». page 6 11/28/2012
OSATE BA Plugin HyperLinking See plugin.xml file to have the configuration of extension point: <ext ensi on poi nt =" or g. osat e. annexsuppor t. t ext posi t i onr esol ver»> Let s consider the implementation of: publ i c voi d Text Posi t i oni nf o r esol veel ement At ( EObj ect annexroot, i nt offset1) Our implementation is not straight forward but we try to describe it here: when parsing the BA, the Position (offset/length) of each BA element is stored in an attribute of Element (Element is a class from the AADL metamodel) when parsing the BA, a map of <Position, Element> stores the destination (Element) of an hypelink put at a significant Position in the text (offset1 being between [offset, offset+length], position of an Element that references another one). when resolveelementat is called, we create a TextPositionInfo: Text Posi t i oni nf o ( EObj ect model Obj ect, i nt of f set 2, i nt l engt h) where modelobject corresponds to the Element from the map, and offset2/length is retreived from the position of the Element at offset1. page 7 11/28/2012
Current limitations We need to improve this implementation, since: Syntax highlighting is turned off when the BA subclause is not syntactically correct (parsing fails); Hyperlinking is turned off when BA subclause is not syntactically correct or when naming resolution of a BA elements fails page 8 11/28/2012
Demo page 9 11/28/2012
subpr ogr am Next _Val ue pr ot ot ypes out put _t ype: dat a; f eat ur es first: r equi r es dat a access I nt eger _16; last: r equi r es dat a access I nt eger _16; buf f er : r equi r es dat a access Ar r aydat atype; out put : r equi r es dat a access out put _t ype; annex behavi or _speci f i cat i on { * * states s: initial f i nal st at e; t r ansi t i ons t : s - []- > s { out put : = buf f er [ f i r st ] ; if( f i r st <l ast ) first := first+1 end if };**}; end Next _Val ue; Behavior Annex in RAMSES code generation In a generic AADL runtime, we define: Is interpreted by the BA plugin as an array of one Dimension, of infinite size. Should be standardized in Data_Model? dat a Ar r aydat atype pr oper t i es Dat a_model : : Dat a_repr esent at i on => Ar r ay; Dat a_model : : Base_Type => ( cl assi f i er ( I nt eger _16) ) ; Dat a_model : : Di mensi on =>( 0) ; end Ar r aydat atype; page 10 11/28/2012
Instantiation in a particular context When instantiated in a particular context, we generate: subpr ogr am Next _Val ue_p_t3_p_i n ext ends Next _Val ue ( out put _t ype => dat a Int) f eat ur es buf f er : r ef i ned to r equi r es dat a access Buf f er Ar r aytype_t3_p_i n; end Next _Val ue_p_t3_p_i n; dat a Buf f er Ar r aytype_t3_p_i n pr oper t i es Dat a_model : : Di mensi on => ( 56) ; end Buf f er Ar r aytype_t3_p_i n; page 11 11/28/2012
Continuous Integration with OSATE Continuous integration on Hudson and Maven: Download and build OSATE sources every night Download and build the BA plugin sources every night Execute some Junit tests (launching osate+ba as command line) Let s have a look at the website https://circe.enst.fr/hudson/ Could be interesting to plug with the validation framework of Alexey Khoroshilov. What would be the best way to proceed? page 12 11/28/2012
Conclusion Identified errata have all been implemented in the revised version of the Behavior Annex. They need to be checked and updated. The Behavior Annex Plugin has been significantly improved, and is used by two (declared) external partners (INRIA and Ellidiss). The Behavior Annex is being used for code generation in RAMSES, taking advantage of prototype and refinement capabilities of AADL (more to come for next meeting) page 13 11/28/2012