JION (JavaSpaces Implemetation for Opportunistic Networks) is a JavaSpaces implementation we have developed in our laboratory. JION is a coordination middleware that acts a critical level between D-MANETs and application levels. So all of services offered by D-MANETs will be moved from multiple instances into a centralized offering. This central provision of services makes the developers independent from D-MANETs challenges. Consequently, they could be able to develop their applications in less time and in a somehow standard way.
JavaSpaces, coordination middleware, peer-to-peer computing, D-MANETs, opportunistic networking
Main author: Abdulkader BENCHI
Before you start using JION, the DoDWAN platform is required to be installed and configured on hosts. For installing DoDWAN, please refer here.
Copyright © 2011-2012 IRISA, Université Européenne de Bretagne. JION is a free software, so you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or any later version.
Once you have downloaded and installed JION, you can start testing it using the console provided in the source code. Please notice that the console is located under JION/console directory.
If you are not familiar with JavaSpaces, then the JavaSpaces Service Specification from Apache River News is a useful guide. But, if you feel like you do not have time to read every thing in that specification and JavaSpaces sounded so much familiar to you, then we suggest you to give the following example some thought.
Step 1: Import the required Packages
import casa.JION.entry.Entry; import casa.JION.space.JavaSpace;
Step 2: Launch the Space on the local host
JavaSpace space=new JavaSpace();
Step 3: Writing an Entry on the space
// Instantiating an entry Entry entry= new Entry(); // Add the fields you need to use // Here we've added two fields, board and topic entry.addFileds("board","sports"); entry.addFileds("topic","football"); // Write the entry into the space space.write(entry, null, Lease.FOREVER);
Step 4: Reading or Taking an entry from the space using a Template
// Create a template Entry template=new Entry(); // Add the fields you need to identify the kind of entry you are looking for // Here we've added two fields, board and topic entry.addFileds("board","sport*"); entry.addFileds("topic","football|tennis|basketball"); // Read a matching entry from the space space.read(template, null, Long.MAX_VALUE); // or Take a matching entry from the space space.take(template, null, Long.MAX_VALUE);
Step 5: Notifying a client with a Event that has occurred
// Create a template Entry template=new Entry(); // Add the fields you need to identify the kind of entry you are interested in // Here we've added two fields, board and topic entry.addFileds("topic","football|tennis|basketball"); // Register a notify request space.notify(template, null, listener, Lease.FOREVER, null);
JION offers you with an interactive tools, called Console. This console provides you with the most commonly commands. In fact, we have tested the previous tutorial in real conditions using this console. The console’s source code is available at JION/console directory.
You can check the scenario shown in the following figure: there are four devices, named here A, B, C and D. All of these hosts are pre-configured with JION. And now, the following steps describe how to run the scenario using the Console:
Step 1: Launch the console on A, B, C and D
java -cp JIONv1.jar casa.JION.console.TCPConsole
Step 2: Access to the console on A, B, C and D
// The port number could be changed using the configuration file telnet localhost 8700
Congratulation! you can now use it. The following examples demonstrate how to use some of the console commands:
To see the full list of console’s commands on any device, type:
To write an entry with two fields “board=sports, topic=football” and TTL=999999 ms on the host A, type:
js write -e board=sports,topic=football -d 999999
To find all entries stored in the local space on the host A, type:
To read an entry from the board=sports under the topic=sport and wait 999999ms for this operation until you have the answer on the device B, type:
js read -tmpl board=sports,topic=football -t 999999
To take the previous entry on the device C, type:
js take -tmpl board=sports,topic=football -t 999999
To register a notify request for all the changes in the board=sports for 999999ms on the device D, type:
js notify -tmpl board=sports -t 999999
Building an effective JION application requires you to read JION APIs. The documentations and API specification for JION are included in the source code, and can also be accessed online here.