How to create S2A-BPJ integrated solution
From WeizmannWiki
There is great value in integrating parts of the same specification written in different BP implementations into a single running application. We describe here how to create an application that integrates scenarios written in LSC with ones written in BPJ.
- Create an LSC project.
- Add the b-threads' source code to the LSC project under the 'src/bthreads/' directory.
- Play-in your LSCs.
- S2A listens out for BPJ events of type MessageEvent. Therefore BPJ events that participate in the LSC specification have to be of type MessageEvent. To generate MessageEvent, right-click a method in the system model, choose update and select the 'Generate corresponding BPJ event':
The corresponding MessageEvent is generated in the 'src/bthreads/events' package. - Play-out
- Select the S2A-BPJ strategy
- Righc-click the LSC project, chose Project Properties->PlayGo->Play-Out->Strategy and select the il.ac.wis.cs.bpjs2a.BPJCoordinatorStrategyImpl strategy.
- Add the b-threads' priority to the Project Properties->PlayGo->Play-Out->Behaviors->BPJ (PlayGo identifies all b-threads in the LSC project by scanning the project, once the relevant strategy was selected - as described in bullet 1).
- Disabling certain b-threads can be done by removing the check mark from the relevant b-threads in the Project Properties->PlayGo->Play-Out->Behaviors->BPJ.
- Select the S2A-BPJ strategy
- PlayGo generates, to the SystemModelMainGenerated.java file, the activation of all b-threads. If you provide your own main, make sure to add the b-threads activation code, for example:
BThread bt = new TestBThread(); BProgram.bp.add(bt, 1.1); bt.startBThread();