/oak-crdt

Primary LanguageJavaApache License 2.0Apache-2.0

Conflict handling with Oak Demo

This is the demo code for the presentation Conflict handling with Oak.

Build with Maven 3 and Java 7 (or higher):

mvn clean install

The test cases give a good indication on how the individual conflict handlers are intended to work.

Alternatively there is an interactive Scala shell, which can be used for experimenting with a transient repository including all conflict handlers from this project (Atomic counter, Last writer wins, multi value register and atomic set). To start the shell type:

java -jar target/oak-crdt-*-jar-with-dependencies.jar

The shell is based on the Ammonite REPL and has all Oak dependencies embedded. Some useful predefined bindings can be imported from michid.crdt.Demo:

@ import michid.crdt.Demo._
import michid.crdt.Demo._

The predefined repository instance is then available:

@ repository.getDescriptorKeys
res0: Array[String] = Array(
  "jcr.repository.name",
  "option.versioning.supported",
  ...

The newSession binding provides a convenient shortcut for opening new sessions on that repository:

@ val s = newSession
s: javax.jcr.Session = session-8
@ val r = s.getRootNode
r: javax.jcr.Node = Node[NodeDelegate{tree=/: { jcr:primaryType = rep:root, mv = { ... }, set = { ... }, oak:index = { ... }, jcr:system = { ... }, count = { ... }, ...}}]

See the demo scripts in src/main/resources for further examples.

Links