Part of the SPA 2015 Distributed Databases session. Start here if you'd like to do the workshop in Java. This project will set you up with all the boring code that talks to a node via its REST API. At the moment this code can only talk to one node, it's your job to make it work with multiple, distributed nodes.
Build with Maven. You can create an executable jar
containing all dependencies with the assembly:single
target, for example:
mvn clean compile assembly:single
First start up at least one node node with:
diy-dist-db-node 8080
(Use different ports for different nodes.)
Run the exectuable jar with:
java -jar target/diy-dist-db-1.0-SNAPSHOT-jar-with-dependencies.jar
There's two ways of approaching this:
-
Stick with this one project, and write your code in
src/main/java/com/github/seeemilyplay/diydistdb/Main.java
. -
Run
maven install
and use this code as a library in another project. Perhaps you want to write Clojure code for example.
All code is in the src/main/java/com/github/seeemilyplay/diydistdb
directory. There are three classes:
Thing.java
: A POJO representing the Things stored in the db.Node.java
: A wrapper around the node's REST API that deals with the HTTP calls for you.Main.java
: A Main method that demonstrates how to use the other classes, and has placeholders for where to put your own code.