The Event Coordination Notation (ECNO) is a notation to coordinate the
behaviour among related model elements that are defined in structural diagrams such as class diagrams.
The ECNO allows the definition of events and provides means for defining how different
related model events need to join or participate in the execution of these events: an
interaction.
The local behaviour of each element defines, in which events an element could participate,
which parameters are contributed, and which action is executed once an interaction is
established and executed.
In the ECNO protoype that is available below, there is an ECNO runtime engine, and there
is an extension of Petri nets (ECNO nets) that allow to define the local behaviour of
elements. And there is a code generator that allows to generated the code for the local
behaviour of ECNO nets. Moreover, there is an example deployed with this prototype.
|
Version 0.2.0 of the ECNO is based on Eclipse Indigo (3.7) and the
Eclipse Modeling Framework (EMF).
If you do not have installed eclipse Indigo on your platform yet, you will
find the instructions to do that here.
Once you have installed Eclipse, you can use Eclipse's update mechanism to install ECNO
from its update site: http://www2.imm.dtu.dk/~eki/projects/ECNO/version-0.2.0/site/. To this end,
start Eclipse; then, select "Help->Install New Software...". In the "Install" dialog,
press "Add..." and enter the URL http://www2.imm.dtu.dk/~eki/projects/ECNO/version-0.2.0/site/ and
add some name like "ECNO". Then press "OK". Then you should find the following
features in the overview for selection:
- ECNO EMF Model Intergration (0.2.0)
- ECNO Engine (0.2.0)
- ECNO Nets (0.2.0)
- ECNO Nets standalone gernerator (0.2.0)
- ePNK (for ECNO) (0.9.3)
Select all of these features and follow through the "Install" diaglog;
remember that you need to check the box "Contact all update sites during install ...";
and remember that you must accept the license at some point in order to proceed.
After the successful installation, it is recommended to restart the Eclipse workbench.
|
Version 0.2.0 of ECNO is based on Eclipse Indigo (3.7) and, concerning ECNO nets, on
the ePNK (version 0.9.3)
Version 0.2.0 of ECNO has the focus on the architecture and programming
framework, and transactional execution of the interactions. Most importantly, this
prototype allows integrating ECNO with other object oriented technologies; in particular
it comes with an adapter and code generator that works together with the Eclipse
Modeling Framework (EMF).
The main features of the ECNO engine version 0.2.0 are:
- ECNO notation:
- Definition of event types with parameters
- Collective parameters for events
- Inheritance on event types
- Coordination annotations with qualifier "ONE" and "ALL"
- Elements may have different coordination sets for the same event type
- GUI properties indicated for which elements and event types GUI elements
should be created
- ECNO nets for modelling the local behaviour of elements
- ECNO framework:
- Engine that calculates and executes valid interactions.
- Programming interface for adapters to different object oriented technologies
- Code generator for local behaviour and adapters on top of EMF models
- Transactional execution of transactions
- Controller and notification mechanism, which automatically keeps possible
interactions up to date (in particular the ones shown on the GUI)
Features that are planned for future versions
- ECNO notation:
- Priorities on different choices of an element
- Inhertiance of element behaviour
- ECNO framework:
- Persistence mechanism that integrates with EMF and Hibernate
|
Different versions of the vending machine example are available for version 0.2.0
of the ECNO from the following zip file at http://www2.imm.dtu.dk/~eki/projects/ECNO/version-0.2.0/download/ECNO-examples-0.2.0.zip.
In order to install these examples, download the zip file from the above zip file to you computer. In your Eclipse workspace, select
"File->Import...->Existing Projects into Workspace" and press "Next". In the now
open "Import" dialog, select "Select archive file" and "Browse" your workspace
for the zip file you have downloaded. Select it and then select the
three projects from that file and finish the installation.
Then, you will find three different projects in you workspace. Each of them is a self-contained
project modelling a vending machine (see papers for more discussion), but in different settings and with some
variations. In all of them, ECNO nets will be used for modelling the local behaviour
of (some) elements. You will find these nets in files with extension .pnml (which indicates
their file format). These nets can viewed and edited with the ePNK. The ePNK editor opens
when double clicking on the resp. file in eclipse's resource browser or package explorer. This editor, however, is a tree editor only
(since it can contain more than one net, which can contain several pages). In order
to open the graphical representation, you need to open the tree elements until
the tree editor shows a Page object. Double clicking on such a Page objects will
open the graphical editor. Note that the graphical editor is tightly integrated with
the tree editor, and after you make any changes in the graphical editor, you must
save the file from the tree editor (which also shows the dirty flag). For more
information on how to use the ePNK for editing nets, have a look into Chapter 3 (Users' Guide) of
the
ePNK Manual.
Now, we discuss the three examples (all of them are based on the vending maching
example from here
with some conceptual changes and technical twists):
- Project
dk.dtu.imm.se.ecno.pn.example-project uses a simple programmed
object oriented model of the vending machine example. This "model" can be found in
class VendingMachineModel . Also the instance of this model is programmed
manually in class VendingMachineInstance . Only the behaviour of elements
are generated fully automatically from the ECNO nets (the generated code is
deployed with the example so that you do not need to generated it in the first place).
These ECNO nets can be found in the PNML file VendingMachineBehaviourModels.pnml
in folder "petrinets". You can open and view the ECNO nets as discussed above.
If you want to generate the code for one of the nets, right click on the net in
the tree editor of the ePNK and then select "ECNO"->"Generete Code". Note that the
package name to which the code is generated is derived from the name of the net.
For starting the Engine, you can right click on the java file VendingMachineInstance.java
and select "Run as"->"Java Application" — as usual in the Eclipse JDK. Then a GUI
with the activated events on the GUI elements will pop up, and you can interact with it.
- Project
test.ecno.model.inheritance uses the same example again —
with a minor conceptual
change: the events coffee and tea are now derived from the
event drink . This way, the controller does not even need to know about the
specific drinks anymore. The major difference in this project is that all the code is
generated fully automatically — and ECNO works together with EMF models!
The object oriented code is generated from an ecore model
of the vending machine. This model is contained in VendingMachine.ecore ;
the file VendingMachine.ecorediag contains the graphical diagram and the
file VendingMachine.genmodel the usual EMF gen-model, that defines some
configuration information. From this, all the code in package example.emf.vendingmachine
and its subpackages was generated fully automatically by EMF.
Again, the ECNO models for the elements' local behaviour are contained in the PNML file
VendingMachineBehaviourModels.pnml . The ECNO nets are almost the same as in
the first project; the major technical difference is that the code snippets in the conditions and
actions of ECNO nets follow the EMF paradigm now. In this setting,
the code is not directly generated from these
ECNO nets any more (don't try to do that in this example). The diagram
VendingMachineCoordination.ecno_diagram (the actual model is contained in the file
with extension ecno)
is the coordination diagram for the vending machine, which also relates the ECNO element types to
the classes of the EMF model. Similar to the EMF gen model, the ECNO code generation is configured in
a genfile, which is called VendingMachineCoordination.ecnogen ; here, the
packages to which the code should be generated is defined, the names for the package
adapter and some other generated classes are defined, and some other configuration information
is provided. When VendingMachineCoordination.ecnogen is opened, the code
for the complete application can be generated by a single right click, and then
selecting "ECNO" -> "Generate ECNO Package Code". This will generate all the behaviour models,
some code for events (the events with parameters), and some adapter and model classes.
The last model in this project is actually an instance of the vending machine:
VendingMachineInstance.xmi . This is a so-called dynamic instance of
the model in VendingMachine.ecore and says how the objects are
actually connected and configured (in this example, there are two coffee brewers).
Also this file has an associated configuration or gen model, which is called
VendingMachineInstance.ecnogen . From which the code for class
VendingMachineInstance.java in package example.ecno.vendingmachine.instances
is generated.
Note that every java class in this project is generated fully automatically —
either by EMF from the ecore model, or by ECNO from the ECNO nets, or from the instance.
The ECNO Engine can be started from VendingMachineInstance.java as a Java
Application.
- Project
test.ecno.model.concurrency is very similar to test.ecno.model.inheritance .
The only difference is that several manual changes have been made so that some changes on
the model are done concurrently from different threads. A coin is added, when there is only
one available coin left, a second slot to which the coins can be inserted is dynamically
added and removed again, and some drinks are ordered automatically, when the user does
not select one (fast enough). The first two changes are done independently from the
ECNO Engine, but under transaction control. The last action, is actually using the
ECNO controller mechanism, for registering with the controller and keeping up to date
with possible interactions (dispendsing a drink). All this manual code is shown in package
example.ecno.vendingmachine.instances.concurrency ; the rest of the code
is identical to the second project above.
The Java Application can, again, be started from VendingMachineInstance.java .
|