an open-source choreography language for developing correct adaptive distributed systems from a global viewpoint.
AIOCJ is an open-source choreography programming language for developing adaptive systems. Choreography languages describe in a single view the global interaction among all entities (roles) in a system. Systems specified in AIOCJ benefit from this approach and are also deadlock-free by construction. Moreover, AIOCJ choreographies adapt. Through scopes the developer can specify which fragments of the interaction can change with respect to applicable rules, provided by a compliant repository. Rules are specified as AIOCJ choreographies and after the adaptation the system remains deadlock-free. AIOCJ choreographies can also make use of functions provided by external services (e.g., as done here).
AIOCJ provides a projection function. AIOCJ choreographies are projected into a set of separate programs that enact the specified interaction and can be distributed. Rules are projected into a distributable standalone repository.
AIOCJ Presentation Paper: Dalla Preda, M., Giallorenzo, S., Lanese, I., Mauro, J., & Gabbrielli, M. (2014). AIOCJ: A choreographic framework for safe adaptive distributed applications . In Software Language Engineering (pp. 161-170). Springer International Publishing.
Foundational Theory: Dalla Preda, M., Gabbrielli, M., Giallorenzo, S., Lanese, I., & Mauro, J. (2015, June). Dynamic Choreographies. In Coordination Models and Languages (pp. 67-82). Springer International Publishing.
Comprehensive Journal Paper: Dalla Preda, M., Giallorenzo, S., Lanese, I., Mauro, J., & Gabbrielli, M. Dynamic Choreographies: Theory and Implementation. Accepted at Logical Methods in Computer Science.
AIOCJ Tutorial: Giallorenzo, S., Lanese, I., Mauro, J., & Gabbrielli, M. Programming Adaptive Microservice Applications: an AIOCJ Tutorial. Behavioural Types: from Theory to Tools.
Let us write a first example of an adaptable choreography written in AIOCJ. u1 sends the message "Hello" to u2. The rule applies, as its matches with the property N.scope_name of the scope, and the result of the execution will display the message "Hello World!" to u2.
For further details, please check out the AIOCJ Syntax.
On the previous example, we add iteration of adaptation and conditions on environmental variables in rules (prefixed by E) to better explain how to write several rules and check for their applicability at runtime. As in the previous example, u1 sends the message "Hello World" to u2. The whole choreography is enclosed by a while, controlled by u1.
msg@u1 = "Bonjour le Monde"
The last code block in the choreography (Lines 12-15) uses the parallel operator to show the msg to u2 and to ask for continuation to u1 at the same time. In AIOCJ, brackets define sub-choreographies. In this case, we employ this feature to define that the code at Lines 12-15 executes only after u1 sent to u2 the msg (Line 11). Without the brackets, the instruction at Line 14 would execute in parallel wrt the scope.
We define two rules (respectively Lines 1-8 and 10-17). They both satisfy the condition of the non-functional property scope_name of the scope. However, they differ on the condition of the environmental variable E.lang. Environment can change at runtime.
The current implementation of AIOCJ equips a program called environment that simulates the presence of an environment that can be queried for environmental variables. Such program is part of the adaptation middleware. Environmental variables can be set (at runtime) by interacting with the shell in which the service running. Back to our example, if we set a new environmental variable lang to the value it, the first rule applies. Likewise, if the set lang to fr, the second rule applies.
Itemis also offers a repository of Eclipse releases with Xtext already installed.
In Eclipse, click command link Help > Install New Software.... Deselect check box Group items by category and copy in the combo box Work With the site address http://www.cs.unibo.it/projects/jolie/aiocj/. The feature AIOC Language Plugin Feature should be visible in the frame of available software.
Check the box relative to the plugin. Click Next for requirement collection. Next again to confirm the install details. Select the radio button for accepting the License Agreement terms and click on Finish.
Eclipse will now install AIOCJ-ecl. At the end of the installation Eclipse will reboot and the plugin will be installed.
From now on, we will refer the launched Eclipse instance as AIOCJ-ecl.
provided in the paper "AIOCJ: A Choreographic Framework for Safe Adaptive Distributed Applications"
Tutorial choreographies provided in the book chapter "Programming Adaptive Microservice Systems: an AIOCJ Tutorial"
Once selected one example, let us project the AIOC first.
the projection creates a folder named "epp_aioc" in the project. In case Eclipse does not show it, refresh the view in the package explorer. Alternatively, you can open the project folder following its path with a file manager.
Similarly to AIOC projection, rule(s) projection requires the creation of a new file.
project via "Jolie Endpoint Projection" button . The process creates a new folder named "epp_rules" containing the projected files.
To ease testing the projected choreography locally, the projection creates several batch files that open a shell for each component of the choreography. The main batch script choreography_launcher.sh takes care of launching all other batch scripts in the proper order, i.e., the adaptation manager, the environment, the external services, the adaptation server, and the roles of the choreography. The script can be launched from a shell with the command bash choreography_launcher.sh. We give a brief description of the sub-scripts launched by the main script to ease customisation and help to understand the structure of AIOCJ programs.
in the folder epp_aioc, the script aioc_launcher.sh starts the starter role of the choreography. Then it waits for an input of the user to proceed with the execution of the roles of the choreography. Pressing [Enter] launches the last role, which begins the execution of the choreography.
AIOCJ is released under the GNU Lesser General Public License v2.1 and its sources are available on Github.