Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "Papyrus/UserGuide/ModelExecution/ActiveObjectController"
(→A generic controller for Active Objects) |
|||
Line 2: | Line 2: | ||
= A generic controller for Active Objects = | = A generic controller for Active Objects = | ||
− | This | + | This model library provides some facilities which allow to stimulate active objects and observe their reactions. It's based on the Moka framework and available in the Eclipse's Debug perspective. |
== Content of the library == | == Content of the library == |
Revision as of 06:57, 24 November 2014
Documentation under construction...
Contents
A generic controller for Active Objects
This model library provides some facilities which allow to stimulate active objects and observe their reactions. It's based on the Moka framework and available in the Eclipse's Debug perspective.
Content of the library
The library contains two classes. ActiveObjectController is an active class which represents the interaction point with the controller. ControllerUI represents the UI of the controller and it’s a property of ActiveObjectController.
To observe active objects behavior, you need to register them first. To do so, the library uses a “Register” signal which has a property. This property could be everything but it should be an active class.
There is a behavior in the library to interact with the controller. It creates an instance of the controller and starts the UI.
Once the instance is created, the classifier behavior of the controller is started. Then, it is reactive to a “Register” signal.
Model example
This tutorial is based on a simple executable model which imports the library. It consists in two active classes, with classifier behavior.
The first active class has the other one as a property and it classifier behavior starts the ActiveObjectController and registers it property. The second one has a reception for a signal and it classifier behavior is waiting for that signal.
The corresponding Papyrus model is available here File:ActiveObjectControllerUserExample.zip. Download it, define a project in your workspace, and then import the model in this project.
The behaviors associated with those classes are specified by activity diagrams.
Importing the library
First of all, to use the library you need to import it. To do so, right click on the root object called model, then go to Import / Import Registered Package / Select ActiveObjectControllerModelLibrary.
There are a lot of libraries in this window, so you can filter by name to get it easily.
Registering active objects
To observe the reaction of an active object, you need to register it in the controller. To do so, in the parent’s classifier behavior you need to send a Register signal with the active object as attribute. Before that, you should start the controller with a CallBehaviorAction that it behavior is on the library.
Starting an execution
To start the execution, just follow the first tutorial on Moka. Cf 2.4.
But for the moment, there is a limit on the using. This framework works only with the PSCS and multithread execution engines, so you should make sure that one of them is selected.
Using the component
When the execution is started, the controller view is awake. Then, the active objects are on the objects list. When you select one of them, you’ll know if it has ports and which signals it could receive.
Moreover, you can show all signals containing in the model and try to use them. To do so, deselect the checkbox with “Hide signals without explicit receptions” label.
If a signal has attributes, you could edit them only if they are primitives (Integer, Boolean, etc…). The editor will shows you if the value that you will have entered is correct.
If everything is ok, the controller allows you to send the signal.
Observing system reactions
When you send a signal to the selected object, there are two types of reaction. The first one is that the object was waiting for this signal, so you could observe it behavior.
The other is that the object was expected another signal, so it will be a warning message into the console that it’ll tell you which kind of signal it was expected.
Then, nothing is going to happen, so you could correct your choice and observe behaviors again.