Switch RAMCloud to Stanford release version

- Switch RAMCloud source code to 1.0 release + patches
- WARN: RAMCloud binary is going to be built to obj.master instead of obj.blueprint-java
- Fix JNI code to follow TableEnumerator related API change
- Build JNI library inside ONOS directory
- Remove non-source code artifact related to BluePrint
- Output ZooKeeper log to onos-logs

Change-Id: Id6fbf9418d6b3ce2e560bbf24b405c4ccc80a8e6
diff --git a/ramcloud-build-scripts/MakefragPrivateTop b/ramcloud-build-scripts/MakefragPrivateTop
new file mode 100644
index 0000000..726dbba
--- /dev/null
+++ b/ramcloud-build-scripts/MakefragPrivateTop
@@ -0,0 +1,7 @@
+# rewrite to match your environment
+ZOOKEEPER_LIB := /usr/lib/x86_64-linux-gnu/libzookeeper_mt.a
+ZOOKEEPER_DIR := ~/zookeeper-3.4.5
+
+# FIXME remove if RAMCloud source is fixed
+EXTRACXXFLAGS := -Wno-error=unused-result -Wno-error=maybe-uninitialized
+
diff --git a/ramcloud-build-scripts/build_jni_so.sh b/ramcloud-build-scripts/build_jni_so.sh
new file mode 100755
index 0000000..0ee12c4
--- /dev/null
+++ b/ramcloud-build-scripts/build_jni_so.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+JAVA_HOME=${JAVA_HOME:-/usr/lib/jvm/java-7-oracle}
+ONOS_HOME=${ONOS_HOME:-~/ONOS}
+RAMCLOUD_HOME=${RAMCLOUD_HOME:-~/ramcloud}
+RAMCLOUD_BRANCH=${RAMCLOUD_BRANCH:-master}
+
+if [ ! -d ${ONOS_HOME}/target/classes ]; then
+  mvn -f ${ONOS_HOME}/pom.xml
+fi
+
+javah -cp ${ONOS_HOME}/target/classes -o ${ONOS_HOME}/src/main/cpp/edu_stanford_ramcloud_JRamCloud.h edu.stanford.ramcloud.JRamCloud
+
+g++ -g -Wall -O3 -shared -fPIC -std=c++0x -I${JAVA_HOME}/include/ -I${JAVA_HOME}/include/linux -I${RAMCLOUD_HOME}/src/ -I${RAMCLOUD_HOME}/obj.${RAMCLOUD_BRANCH}/ -I${RAMCLOUD_HOME}/logcabin/ -I${RAMCLOUD_HOME}/gtest/include/ -L${RAMCLOUD_HOME}/obj.${RAMCLOUD_BRANCH} -o ${ONOS_HOME}/lib/libedu_stanford_ramcloud_JRamCloud.so ${ONOS_HOME}/src/main/cpp/edu_stanford_ramcloud_JRamCloud.cc -lramcloud
+
+#ln -sf `pwd`/libedu_stanford_ramcloud_JRamCloud.so ${RAMCLOUD_HOME}/obj.${RAMCLOUD_BRANCH}
+
diff --git a/ramcloud-build-scripts/logcabin.patch b/ramcloud-build-scripts/logcabin.patch
new file mode 100644
index 0000000..d13ed32
--- /dev/null
+++ b/ramcloud-build-scripts/logcabin.patch
@@ -0,0 +1,12 @@
+diff --git a/Server/RaftLog.cc b/Server/RaftLog.cc
+index 5705cd3..e571251 100644
+--- a/Server/RaftLog.cc
++++ b/Server/RaftLog.cc
+@@ -16,6 +16,7 @@
+ #include <algorithm>
+ #include <fcntl.h>
+ #include <sys/stat.h>
++#include <unistd.h>
+ 
+ #include "build/Protocol/Raft.pb.h"
+ #include "Core/Debug.h"
diff --git a/ramcloud-build-scripts/ramcloud.patch b/ramcloud-build-scripts/ramcloud.patch
new file mode 100644
index 0000000..5869a01
--- /dev/null
+++ b/ramcloud-build-scripts/ramcloud.patch
@@ -0,0 +1,28 @@
+diff --git a/GNUmakefile b/GNUmakefile
+index e4c9a07..199fac1 100644
+--- a/GNUmakefile
++++ b/GNUmakefile
+@@ -23,8 +23,8 @@ OBJDIR	:= obj$(OBJSUFFIX)
+ 
+ TOP	:= $(shell echo $${PWD-`pwd`})
+ GTEST_DIR ?= $(TOP)/gtest
+-ZOOKEEPER_LIB := /usr/local/lib/libzookeeper_mt.a
+-ZOOKEEPER_DIR := /usr/local/zookeeper-3.4.5
++ZOOKEEPER_LIB ?= /usr/local/lib/libzookeeper_mt.a
++ZOOKEEPER_DIR ?= /usr/local/zookeeper-3.4.5
+ 
+ ifeq ($(DEBUG),yes)
+ BASECFLAGS := -g
+diff --git a/src/MasterService.cc b/src/MasterService.cc
+index 93cfb5d..02876c7 100644
+--- a/src/MasterService.cc
++++ b/src/MasterService.cc
+@@ -613,7 +613,7 @@ MasterService::multiWrite(const WireFormat::MultiOp::Request* reqHdr,
+             reqOffset, currentReq->valueLength);
+         reqOffset += currentReq->valueLength;
+ 
+-        if (stringKey == NULL || value == NULL) {
++        if (stringKey == NULL) {
+             respHdr->common.status = STATUS_REQUEST_FORMAT_ERROR;
+             break;
+         }