1) changed default home directory for zookeeper
2) introduced java_home entry for zookeeper server(s).


git-svn-id: https://asterixdb.googlecode.com/svn/branches/asterix_lsm_stabilization@1465 eaa15691-b419-025a-1212-ee371bd00084
diff --git a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/ConfigureCommand.java b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/ConfigureCommand.java
index cad8632..d22e6ce 100644
--- a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/ConfigureCommand.java
+++ b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/ConfigureCommand.java
@@ -30,7 +30,7 @@
         cluster.setStore("storage");
         cluster.setLogdir(workingDir + File.separator + "logs");
         cluster.setJavaHome(System.getenv("JAVA_HOME"));
-        cluster.setJavaOpts("-Xmx1048m");
+        cluster.setJavaOpts("-Xmx1024m");
 
         Marshaller marshaller = ctx.createMarshaller();
         marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
@@ -42,7 +42,11 @@
         Configuration configuration = (Configuration) unmarshaller.unmarshal(new File(installerConfPath));
 
         configuration.getBackup().setBackupDir(workingDir + File.separator + "backup");
-        configuration.getZookeeper().setHomeDir(workingDir + File.separator + "zookeeper");
+        configuration.getZookeeper().setHomeDir(
+                InstallerDriver.getManagixHome() + File.separator + InstallerDriver.MANAGIX_INTERNAL_DIR
+                        + File.separator + "zookeeper_home");
+        configuration.getZookeeper().getServers().setJavaHome(System.getenv("JAVA_HOME"));
+
         marshaller = ctx.createMarshaller();
         marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
         marshaller.marshal(configuration, new FileOutputStream(installerConfPath));
diff --git a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/service/ZooKeeperService.java b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/service/ZooKeeperService.java
index 1bd8772..b87d721 100644
--- a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/service/ZooKeeperService.java
+++ b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/service/ZooKeeperService.java
@@ -98,6 +98,7 @@
         StringBuffer cmdBuffer = new StringBuffer();
         cmdBuffer.append(initScript + " ");
         cmdBuffer.append(conf.getZookeeper().getHomeDir() + " ");
+        cmdBuffer.append(conf.getZookeeper().getServers().getJavaHome() + " ");
         List<String> zkServers = conf.getZookeeper().getServers().getServer();
         for (String zkServer : zkServers) {
             cmdBuffer.append(zkServer + " ");
diff --git a/asterix-installer/src/main/resources/schema/installer-conf.xsd b/asterix-installer/src/main/resources/schema/installer-conf.xsd
index 318e7ce..c21fc5b 100644
--- a/asterix-installer/src/main/resources/schema/installer-conf.xsd
+++ b/asterix-installer/src/main/resources/schema/installer-conf.xsd
@@ -11,6 +11,7 @@
 <xs:element name="version" type="xs:string"/>
 <xs:element name="url" type="xs:string"/>
 <xs:element name="backupDir" type="xs:string"/>
+<xs:element name="java_home" type="xs:string"/>
 
 <!-- definition of complex elements -->
 <xs:element name="hdfs">
@@ -44,6 +45,7 @@
 <xs:element name="servers">
   <xs:complexType>
     <xs:sequence>
+      <xs:element ref="mg:java_home"/>
       <xs:element ref="mg:server" maxOccurs="unbounded"/>
     </xs:sequence>
   </xs:complexType>
diff --git a/asterix-installer/src/main/resources/zookeeper/start_zk.sh b/asterix-installer/src/main/resources/zookeeper/start_zk.sh
index 033e5f8..68ced54 100755
--- a/asterix-installer/src/main/resources/zookeeper/start_zk.sh
+++ b/asterix-installer/src/main/resources/zookeeper/start_zk.sh
@@ -1,8 +1,9 @@
 ZK_HOME=$1
 ZK_ID=$2
+JAVA_HOME=$3
 mkdir $ZK_HOME/data
 echo $2 > $ZK_HOME/data/myid
 CLASSPATH=$ZK_HOME/lib/zookeeper-3.4.5.jar:$ZK_HOME/lib/log4j-1.2.15.jar:$ZK_HOME/lib/slf4j-api-1.6.1.jar:$ZK_HOME/conf:$ZK_HOME/conf/log4j.properties
 ZK_CONF=$ZK_HOME/zk.cfg
 export JAVA_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,address=8400,server=y,suspend=n"
-java $JAVA_OPTS -Dlog4j.configuration="file:$ZK_HOME/conf/log4j.properties" -cp $CLASSPATH org.apache.zookeeper.server.quorum.QuorumPeerMain $ZK_CONF
+$JAVA_HOME/bin/java $JAVA_OPTS -Dlog4j.configuration="file:$ZK_HOME/conf/log4j.properties" -cp $CLASSPATH org.apache.zookeeper.server.quorum.QuorumPeerMain $ZK_CONF
diff --git a/asterix-installer/src/main/resources/zookeeper/zk.init b/asterix-installer/src/main/resources/zookeeper/zk.init
index 937d8b3..8ef6f5f 100755
--- a/asterix-installer/src/main/resources/zookeeper/zk.init
+++ b/asterix-installer/src/main/resources/zookeeper/zk.init
@@ -1,5 +1,6 @@
 ZK_HOME=$1
-shift 1
+SERVER_JAVA_HOME=$2
+shift 2
 cd $MANAGIX_HOME/.installer/zookeeper
 tar cf zk.pkg.tar *
 zk_server_id=1
@@ -8,6 +9,6 @@
   ssh $zk_host "mkdir -p $ZK_HOME"
   scp ./zk.pkg.tar $zk_host:$ZK_HOME/
   ssh $zk_host "cd $ZK_HOME && tar xf $ZK_HOME/zk.pkg.tar && chmod +x $ZK_HOME/bin/start_zk.sh"
-  ssh $zk_host "$ZK_HOME/bin/start_zk.sh $ZK_HOME $zk_server_id" &
+  ssh $zk_host "$ZK_HOME/bin/start_zk.sh $ZK_HOME $zk_server_id $SERVER_JAVA_HOME" &
   zk_server_id=`expr $zk_server_id + 1`	
 done