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"
(→Content of the library) |
(→Content of the library) |
||
Line 7: | Line 7: | ||
The library contains two classes: ActiveObjectController and ConrollerUI. ActiveObjectController is an active class which enables particular objects (instantiated during the execution of a model) to register with the controller. ControllerUI represents the UI of the controller. | The library contains two classes: ActiveObjectController and ConrollerUI. ActiveObjectController is an active class which enables particular objects (instantiated during the execution of a model) to register with the controller. ControllerUI represents the UI of the controller. | ||
− | In order to enable registration of objects with the controller, the library introduces signal “Register”, which has an untyped property called object. The argument corresponding to this property can be any active object. | + | In order to enable registration of objects with the controller, the library introduces signal “Register”, which has an untyped property called object. The argument corresponding to this property can be any active object that needs to be observed. |
[[File:library_structure.png]] | [[File:library_structure.png]] | ||
− | + | Please note that the controller must be explicitly started by the application model. This can be done using the StartActiveObjectController activity, availlable in the Utils package. This activity creates an instance of the controller and starts the UI. | |
[[File:model_explorer_behavior.png]] | [[File:model_explorer_behavior.png]] |
Revision as of 07:10, 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 and ConrollerUI. ActiveObjectController is an active class which enables particular objects (instantiated during the execution of a model) to register with the controller. ControllerUI represents the UI of the controller.
In order to enable registration of objects with the controller, the library introduces signal “Register”, which has an untyped property called object. The argument corresponding to this property can be any active object that needs to be observed.
Please note that the controller must be explicitly started by the application model. This can be done using the StartActiveObjectController activity, availlable in the Utils package. This activity 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.