Skip to main content

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.

Jump to: navigation, search

Difference between revisions of "Papyrus/UserGuide/ModelExecution/ActiveObjectController"

(Using the component)
Line 67: Line 67:
  
 
If the target object was not waiting for this signal, a message like the following one will be displayed in the console:
 
If the target object was not waiting for this signal, a message like the following one will be displayed in the console:
 
[[File:fUMLConsoleWarning_losting_signals.png]]
 
 
== Observing system reactions ==
 
When you send a signal to the selected object, if the object was waiting for this signal, which will result in a reaction observable on a diagram.
 
 
[[File:classifierBehavior_edge.png]]
 
 
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.
 
  
 
[[File:fUMLConsoleWarning_losting_signals.png]]
 
[[File:fUMLConsoleWarning_losting_signals.png]]

Revision as of 09:49, 24 November 2014

Documentation under construction...

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. The controller UI looks as follows:

EmptyControllerView.png

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.

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.

Model explorer behavior.png

Once an instance of ActiveObjectController is created, its classifier behavior is started. The behavior is depicted in the activity diagram below. It waits for the reception of Register signals. When a signal is received, operation Register is called on the ControllerUI, using the object received with the signal as an argument for the operation call. The effect of this call is that the argument object is added to the Objects list of the UI. User can then select an object from the UI, and stimulate it with signals.

RegisterActivity.png

Model example

Let us illustrate the usage of this library with a simple model example. 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. It consists in two active classes, with classifier behavior.

ClassDiagram.png

[To be clarified] 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.

As illustrated in the model explorer screenshot bellow, the behaviors associated with those classes are specified by activities.

ModelStructure.png

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.

Import Library.png

There are a lot of libraries in this window, so you can filter by name to get it easily.

LibrariesToImportWizard.png

Registering active objects

To observe the reaction of an active object, you need to register it in the controller. This can be done by calling StartActiveObjectController activity (available in the model library under package Utils), as illustrated in the figure bellow. This activity returns an instance of the controller, which can be used as the target of a SendSignalAction for signal Register. Use the object you want to register as an argument for the SendSignalAction. [To be clarified: Where should this behavior be specified? is it a separate activity or a classifier behavior of something?].

How to register classifierBehavior.png

Starting an execution

To start the execution, define a launch configuration for activity [To be clarified: Which one??], as explained here [[1]]. Please note that this library works only with the PSCS - multithread execution engine. Make sure that this engine is selected in the Papyrus/Moka preferences before launching the configuration (cf. [[2]] for explanations on the selection of an execution engine).

Using the component

When the execution is started, the controller view is awaken. As depicted in the figure below, the objects list shows the registered active objects. When you select one of them, the list of ports is updated (to show ports available on the selected object) as well as the list of signals it can receive.

AwakeController.png

The list of signals only displays signals for which a reception is explicitly defined (either receptions on the object, or receptions on provided interfaces of the selected port). If you don't want to restrict the list (i.e., display all the signals availble in the scope of this model), just disable the checkbox “Hide signals without explicit receptions”. If the selected signal has no attribute, just press the Send button to send the selected signal to the selected object.

Hiding signals.png

If a signal has attributes, arguments have to be specified. This can be done using the arguments table (only for primitive types). The editor will check if specified arguments are valid.

WRONGTableEdition.png

If everything is ok, the controller allows you to send the signal.

SendButton.png

If the target object was not waiting for this signal, a message like the following one will be displayed in the console:

FUMLConsoleWarning losting signals.png

Back to the top