Java Implementation

Supported Java Version

  • Oracle Java Platform, Standard Edition 6

Other Java platform SDKs may be applicable but are currently untested.

Dependencies

Required Dependencies

Optional Dependencies (building without these is possible, but some features will be missing)

Important

The Java implementation of RSB depends on RSB‘s language independent network protocol specification. This specification is maintained in the RSB protocol sub-project. This project and its transitive dependencies should already be installed on your system if you followed the C++ installation guidelines . If the C++ implementation of RSB is already installed, you can skip the section Installation of Dependencies on Debian-based Systems and proceed to the Installation of RSBJava section.

Installation of Dependencies on Debian-based Systems

$ sudo apt-get install libprotobuf-java protobuf-compiler build-essential cmake

Installation of Dependencies on MacOS using Homebrew

For installing RSB and its dependencies from source on Darwin, we recommend to use Homebrew, an easy-to-use package manager for MacOS.

$ brew install cmake protobuf

Installation of the Spread Toolkit

To install Spread, source archives are available after registration for download at http://www.spread.org/download/spread-src-4.1.0.tar.gz. Installation of Spread is straightforward on MacOS and Linux as it has no external dependencies and comes with a standard configuration script.

Note

In the following sections, PREFIX specifies the target directory of the installation.

$ tar xzf spread-src-4.1.0.tar.gz
$ cd spread-src-4.1.0
$ ./configure --prefix=PREFIX
$ make
$ make install

Installation of RSC and RSBProtocol

  1. Obtain the source code:

    RSC

    “0.13” branch of https://code.cor-lab.org/git/rsc.git

    RSB Protocol

    “0.13” branch of https://code.cor-lab.org/git/rsb.git.protocol

  2. Build and install RSC Library

    $ cd rsc
    $ mkdir -p build && cd build
    $ cmake -DCMAKE_INSTALL_PREFIX=PREFIX ..
    $ make install
    
  3. Install RSB Protocol Definitions

    $ cd rsb.git.protocol
    $ mkdir -p build && cd build
    $ cmake -DCMAKE_INSTALL_PREFIX=PREFIX ..
    $ make install
    

    Note

    These protocol definitions are shared across programming languages.

Installation of RSBJava

  1. Checkout RSB and its immediate dependencies from “0.13” branch of https://code.cor-lab.org/git/rsb.git.java.
  2. Run mvnprep.sh which resides inside the repository root folder
$ cd rsb.git.java
$ ./mvnprep.sh
  1. Invoke mvn supplying build properties on the command-line

    The following properties are used to configure the build:

    Maven Property Meaning Example
    pbuf.protoc Location of protocol buffer compiler (protoc or protoc.exe) /usr/bin/protoc
    pbuf.protopath Location of RSB protocol IDL files (see TODO) /vol/cit/share/rsbprotocol
    spread.daemon Location of Spread daemon executable /vol/cit/sbin/spread

    All properties can be supplied on the mvn command-line using the -DNAME=VALUE syntax.

    An exemplary mvn clean package command, which builds the RSB jar library, may look as follows:

    $ mvn clean package                               \
          -Dpbuf.protoc=/usr/bin/protoc               \
          -Dpbuf.protopath=/vol/cit/share/rsbprotocol \
          -Dspread.daemon=/vol/cit/sbin/spread
    
  2. Installation of Java archive

    To install RSB jars into the your user’s maven repository (i.e. ~/.m2), use this command:

    $ mvn clean install                               \
          -Dpbuf.protoc=/usr/bin/protoc               \
          -Dpbuf.protopath=/vol/cit/share/rsbprotocol \
          -Dspread.daemon=/vol/cit/sbin/spread
    

Testing the Maven Installation

The Java implementation of RSB comes with a set of unit tests, which you may use to check the compiled code. Executing the test suite is straightforward. To do so, the following mvn target needs to be invoked (please note that a Spread daemon is automatically started by the mvn script):

$ mvn test                                        \
      -Dpbuf.protoc=/opt/local/bin/protoc         \
      -Dpbuf.protopath=/vol/cit/share/RSBProtocol \
      -Dspread.daemon=/vol/cit/sbin/spread

You should see a console output similar to the following (shortened excerpt):

$ mvn test                                        \
      -Dpbuf.protoc=/opt/local/bin/protoc         \
      -Dpbuf.protopath=/vol/cit/share/RSBProtocol \
      -Dspread.daemon=/vol/cit/sbin/spread

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building RSB 0.11-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
.
..
...


Results :

Tests run: 175, Failures: 0, Errors: 0, Skipped: 0

[INFO]
[INFO] --- jacoco-maven-plugin:0.6.3.201306030806:report (post-unit-test) @ rsb ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 27.010s
[INFO] Finished at: Wed Jan 29 19:59:08 CET 2014
[INFO] Final Memory: 25M/193M
[INFO] ------------------------------------------------------------------------
     [exec] Result: 143

If no failed test cases are reported, the Java implementation of RSB is likely to work correctly on your machine.