taking checkpoint

git-svn-id: https://asterixdb.googlecode.com/svn/branches/asterix_stabilization_ioc_installer@1314 eaa15691-b419-025a-1212-ee371bd00084
diff --git a/asterix-events/src/main/java/edu/uci/ics/asterix/event/management/EventExecutor.java b/asterix-events/src/main/java/edu/uci/ics/asterix/event/management/EventExecutor.java
index 34da06e..04c6333 100644
--- a/asterix-events/src/main/java/edu/uci/ics/asterix/event/management/EventExecutor.java
+++ b/asterix-events/src/main/java/edu/uci/ics/asterix/event/management/EventExecutor.java
@@ -45,7 +45,7 @@
         pargs.add("/bin/bash");
         pargs.add(client.getEventsDir() + File.separator + "scripts" + File.separator + EXECUTE_SCRIPT);
         StringBuffer envBuffer = new StringBuffer(IP_LOCATION + "=" + node.getIp() + " ");
-        if (!node.getId().equals(EventDriver.CLIENT_NODE_ID)) {
+        if (!node.getId().equals(EventDriver.CLIENT_NODE_ID) && cluster.getEnv() != null) {
             for (Property p : cluster.getEnv().getProperty()) {
                 if (p.getKey().equals("JAVA_HOME")) {
                     String val = node.getJavaHome() == null ? p.getValue() : node.getJavaHome();
diff --git a/asterix-events/src/main/resources/events/backup/backup.sh b/asterix-events/src/main/resources/events/backup/backup.sh
index cff37df..e10a4c9 100755
--- a/asterix-events/src/main/resources/events/backup/backup.sh
+++ b/asterix-events/src/main/resources/events/backup/backup.sh
@@ -2,18 +2,34 @@
 ASTERIX_INSTANCE_NAME=$2
 ASTERIX_DATA_DIR=$3
 BACKUP_ID=$4
-HDFS_URL=$5
-HADOOP_VERSION=$6
-HDFS_BACKUP_DIR=$7
-NODE_ID=$8
-
-export HADOOP_HOME=$WORKING_DIR/hadoop-$HADOOP_VERSION
+BACKUP_DIR=$5
+BACKUP_TYPE=$6
+NODE_ID=$7
 
 nodeStores=$(echo $ASTERIX_DATA_DIR | tr "," "\n")
-for nodeStore in $nodeStores
-do
-  NODE_BACKUP_DIR=$HDFS_BACKUP_DIR/$ASTERIX_INSTANCE_NAME/$BACKUP_ID/$NODE_ID/$nodeStore
-  $HADOOP_HOME/bin/hadoop fs -mkdir $HDFS_URL/$NODE_BACKUP_DIR
-  echo "$HADOOP_HOME/bin/hadoop fs -copyFromLocal $nodeStore/$NODE_ID $HDFS_URL/$NODE_BACKUP_DIR" >> ~/backup.log
-  $HADOOP_HOME/bin/hadoop fs -copyFromLocal $nodeStore/$NODE_ID/$ASTERIX_INSTANCE_NAME/* $HDFS_URL/$NODE_BACKUP_DIR/
-done
+
+if [ $BACKUP_TYPE == "hdfs" ];
+then
+  HDFS_URL=$8
+  HADOOP_VERSION=$9
+  export HADOOP_HOME=$WORKING_DIR/hadoop-$HADOOP_VERSION
+  for nodeStore in $nodeStores
+  do
+    MANGLED_DIR_NAME=`echo $nodeStores | tr / _`
+    NODE_BACKUP_DIR=$BACKUP_DIR/$ASTERIX_INSTANCE_NAME/$BACKUP_ID/$NODE_ID/$MANGLED_DIR_NAME
+    echo "$HADOOP_HOME/bin/hadoop fs -copyFromLocal $nodeStore/$NODE_ID/$ASTERIX_INSTANCE_NAME/ $HDFS_URL/$NODE_BACKUP_DIR/" >> ~/backup.log
+    $HADOOP_HOME/bin/hadoop fs -copyFromLocal $nodeStore/$NODE_ID/$ASTERIX_INSTANCE_NAME/ $HDFS_URL/$NODE_BACKUP_DIR/
+  done
+else 
+  for nodeStore in $nodeStores
+  do
+    MANGLED_DIR_NAME=`echo $nodeStores | tr / _`
+    NODE_BACKUP_DIR=$BACKUP_DIR/$ASTERIX_INSTANCE_NAME/$BACKUP_ID/$NODE_ID/$MANGLED_DIR_NAME
+    if [ ! -d $NODE_BACKUP_DIR ];
+    then
+      mkdir -p $NODE_BACKUP_DIR
+    fi
+    echo "cp -r  $nodeStore/$NODE_ID/$ASTERIX_INSTANCE_NAME/* $NODE_BACKUP_DIR/" >> ~/backup.log
+    cp -r  $nodeStore/$NODE_ID/$ASTERIX_INSTANCE_NAME/* $NODE_BACKUP_DIR/
+  done
+fi
diff --git a/asterix-events/src/main/resources/events/events.xml b/asterix-events/src/main/resources/events/events.xml
index 857ee5a..f85e3ea 100644
--- a/asterix-events/src/main/resources/events/events.xml
+++ b/asterix-events/src/main/resources/events/events.xml
@@ -97,4 +97,10 @@
     <args>WorkingDir HadoopVersion HDFSUrl Path_to_Delete</args>
     <daemon>false</daemon>
   </event>
+  <event>
+    <type>node_info</type>
+    <script>node_info/node_info.sh</script>
+    <description>Retrieved environment information for a node</description>
+    <daemon>false</daemon>
+  </event>
 </events>
diff --git a/asterix-events/src/main/resources/events/node_info/node_info.sh b/asterix-events/src/main/resources/events/node_info/node_info.sh
new file mode 100755
index 0000000..ae72490
--- /dev/null
+++ b/asterix-events/src/main/resources/events/node_info/node_info.sh
@@ -0,0 +1,4 @@
+JAVA_VERSION=`java -version 2>&1 |awk 'NR==1{ gsub(/"/,""); print $3 }'`
+HOME_DIR=`echo ~`
+echo JAVA_VERSION=$JAVA_VERSION
+echo HOME_DIR=$HOME_DIR
diff --git a/asterix-events/src/main/resources/events/restore/restore.sh b/asterix-events/src/main/resources/events/restore/restore.sh
index 96f3db4..515efc1 100755
--- a/asterix-events/src/main/resources/events/restore/restore.sh
+++ b/asterix-events/src/main/resources/events/restore/restore.sh
@@ -2,17 +2,19 @@
 ASTERIX_INSTANCE_NAME=$2
 ASTERIX_DATA_DIR=$3
 BACKUP_ID=$4
-HDFS_URL=$5
-HADOOP_VERSION=$6
-HDFS_BACKUP_DIR=$7
-NODE_ID=$8
+BACKUP_DIR=$5
+BACKUP_TYPE=$6
+NODE_ID=$7
+HDFS_URL=$8
+HADOOP_VERSION=$9
 
 export HADOOP_HOME=$WORKING_DIR/hadoop-$HADOOP_VERSION
-
 nodeStores=$(echo $ASTERIX_DATA_DIR | tr "," "\n")
+
 for nodeStore in $nodeStores
 do
-  NODE_BACKUP_DIR=$HDFS_BACKUP_DIR/$ASTERIX_INSTANCE_NAME/$BACKUP_ID/$NODE_ID/$nodeStore
+  MANGLED_BACKUP_DIR=`echo $nodeStore | tr / _`
+  NODE_BACKUP_DIR=$BACKUP_DIR/$ASTERIX_INSTANCE_NAME/$BACKUP_ID/$NODE_ID/$MANGLED_BACKUP_DIR
   DEST_DIR=$nodeStore/$NODE_ID/$ASTERIX_INSTANCE_NAME
   if [ ! -d $DEST_DIR ]
   then 
@@ -20,6 +22,11 @@
   else 
     rm -rf $DEST_DIR/*
   fi
-  echo "$HADOOP_HOME/bin/hadoop fs -copyToLocal $HDFS_URL/$NODE_BACKUP_DIR/  $DEST_DIR/" >> ~/restore.log 
-  $HADOOP_HOME/bin/hadoop fs -copyToLocal $HDFS_URL/$NODE_BACKUP_DIR/*  $DEST_DIR/ 
+ 
+  if [ $BACKUP_TYPE == "hdfs" ];
+  then
+    $HADOOP_HOME/bin/hadoop fs -copyToLocal $HDFS_URL/$NODE_BACKUP_DIR/*  $DEST_DIR/ 
+  else
+    cp  -r $NODE_BACKUP_DIR/*  $DEST_DIR/ 
+  fi
 done
diff --git a/asterix-installer/pom.xml b/asterix-installer/pom.xml
index 22af412..28ad995 100644
--- a/asterix-installer/pom.xml
+++ b/asterix-installer/pom.xml
@@ -36,6 +36,22 @@
                 <goal>generate</goal>
               </goals>
               <configuration>
+                <args>
+                  <arg>-Xsetters</arg>
+                  <arg>-Xvalue-constructor</arg>
+                </args>
+                <plugins>
+                  <plugin>
+                    <groupId>org.jvnet.jaxb2_commons</groupId>
+                    <artifactId>jaxb2-basics</artifactId>
+                    <version>0.6.2</version>
+                  </plugin>
+                  <plugin>
+                    <groupId>org.jvnet.jaxb2_commons</groupId>
+                    <artifactId>jaxb2-value-constructor</artifactId>
+                    <version>3.0</version>
+                  </plugin>
+                </plugins>
                 <schemaDirectory>src/main/resources/schema</schemaDirectory>
                 <schemaIncludes>
                   <include>installer-conf.xsd</include>
@@ -55,6 +71,10 @@
                   <include>cluster.xsd</include>
                 </schemaIncludes>
                 <generatePackage>edu.uci.ics.asterix.installer.schema.cluster</generatePackage>
+                <bindingDirectory>src/main/resources/schema</bindingDirectory>
+                <bindingIncludes>
+                  <bindingInclude>jaxb-bindings.xjb</bindingInclude>
+                </bindingIncludes>
                 <generateDirectory>${project.build.directory}/generated-sources/cluster</generateDirectory>
               </configuration>
             </execution>
diff --git a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/AbstractCommand.java b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/AbstractCommand.java
index 7329929..af7dbb7 100644
--- a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/AbstractCommand.java
+++ b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/AbstractCommand.java
@@ -17,8 +17,6 @@
 import org.apache.log4j.Logger;
 import org.kohsuke.args4j.CmdLineParser;
 
-import edu.uci.ics.asterix.installer.driver.InstallerDriver;
-
 public abstract class AbstractCommand implements ICommand {
 
     protected static final Logger LOGGER = Logger.getLogger(AbstractCommand.class.getName());
@@ -30,12 +28,12 @@
     public void execute(String[] args) throws Exception {
         String[] cmdArgs = new String[args.length - 1];
         System.arraycopy(args, 1, cmdArgs, 0, cmdArgs.length);
-        config = getCommandConfig();
-        CmdLineParser parser = new CmdLineParser(config);
-        parser.parseArgument(cmdArgs);
-        if (config.helpMode()) {
+        if (cmdArgs.length >= 1 && cmdArgs[0].equals("-help")) {
             System.out.println(getUsageDescription());
         } else {
+            config = getCommandConfig();
+            CmdLineParser parser = new CmdLineParser(config);
+            parser.parseArgument(cmdArgs);
             execCommand();
         }
     }
diff --git a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/AlterCommand.java b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/AlterCommand.java
index 8d6f051..e52308e 100644
--- a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/AlterCommand.java
+++ b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/AlterCommand.java
@@ -61,10 +61,10 @@
 
 class AlterConfig extends AbstractCommandConfig {
 
-    @Option(name = "-n", required = false, usage = "Name of Asterix Instance")
+    @Option(name = "-n", required = true, usage = "Name of Asterix Instance")
     public String name;
 
-    @Option(name = "-conf", required = false, usage = "Path to instance configuration")
+    @Option(name = "-conf", required = true, usage = "Path to instance configuration")
     public String confPath;
 
 }
diff --git a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/BackupCommand.java b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/BackupCommand.java
index 7ca400a..cd4cc5c 100644
--- a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/BackupCommand.java
+++ b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/BackupCommand.java
@@ -26,6 +26,7 @@
 import edu.uci.ics.asterix.installer.model.AsterixInstance;
 import edu.uci.ics.asterix.installer.model.AsterixInstance.State;
 import edu.uci.ics.asterix.installer.model.BackupInfo;
+import edu.uci.ics.asterix.installer.schema.conf.Backup;
 import edu.uci.ics.asterix.installer.service.ServiceProvider;
 
 public class BackupCommand extends AbstractCommand {
@@ -37,10 +38,11 @@
         AsterixInstance instance = InstallerUtil.validateAsterixInstanceExists(asterixInstanceName, State.INACTIVE);
         List<BackupInfo> backupInfo = instance.getBackupInfo();
         PatternCreator pc = new PatternCreator();
-        Patterns patterns = pc.getBackUpAsterixPattern(instance, ((BackupConfig) config).localPath);
+        Backup backupConf = InstallerDriver.getConfiguration().getBackup();
+        Patterns patterns = pc.getBackUpAsterixPattern(instance, backupConf);
         InstallerUtil.getEventrixClient(instance.getCluster()).submit(patterns);
         int backupId = backupInfo.size();
-        BackupInfo binfo = new BackupInfo(backupId, new Date());
+        BackupInfo binfo = new BackupInfo(backupId, new Date(), backupConf);
         backupInfo.add(binfo);
         LOGGER.info(asterixInstanceName + " backed up " + binfo);
         ServiceProvider.INSTANCE.getLookupService().updateAsterixInstance(instance);
@@ -67,10 +69,7 @@
 
 class BackupConfig extends AbstractCommandConfig {
 
-    @Option(name = "-n", required = false, usage = "Name of the Asterix instance")
+    @Option(name = "-n", required = true, usage = "Name of the Asterix instance")
     public String name;
 
-    @Option(name = "-local", required = false, usage = "Path on the local file system for backup")
-    public String localPath;
-
 }
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 b1901b5..6b0b53d 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
@@ -39,6 +39,7 @@
         unmarshaller = ctx.createUnmarshaller();
         Configuration configuration = (Configuration) unmarshaller.unmarshal(new File(installerConfPath));
 
+        configuration.getBackup().setBackupDir(workingDir + File.separator + "backup");
         configuration.getZookeeper().setHomeDir(workingDir + File.separator + "zookeeper");
         marshaller = ctx.createMarshaller();
         marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
diff --git a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/CreateCommand.java b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/CreateCommand.java
index e65848d..854ee8e 100644
--- a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/CreateCommand.java
+++ b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/CreateCommand.java
@@ -54,8 +54,7 @@
         JAXBContext ctx = JAXBContext.newInstance(Cluster.class);
         Unmarshaller unmarshaller = ctx.createUnmarshaller();
         cluster = (Cluster) unmarshaller.unmarshal(new File(createConfig.clusterPath));
-        AsterixInstance asterixInstance = InstallerUtil.createAsterixInstance(asterixInstanceName, cluster,
-                ((CreateConfig) config).asterixConf);
+        AsterixInstance asterixInstance = InstallerUtil.createAsterixInstance(asterixInstanceName, cluster);
         InstallerUtil.evaluateConflictWithOtherInstances(asterixInstance);
         InstallerUtil.createAsterixZip(asterixInstance, true);
         List<Property> clusterProperties = new ArrayList<Property>();
@@ -106,13 +105,10 @@
 
 class CreateConfig extends AbstractCommandConfig {
 
-    @Option(name = "-n", required = false, usage = "Name of Asterix Instance")
+    @Option(name = "-n", required = true, usage = "Name of Asterix Instance")
     public String name;
 
-    @Option(name = "-c", required = false, usage = "Path to cluster configuration")
+    @Option(name = "-c", required = true, usage = "Path to cluster configuration")
     public String clusterPath;
 
-    @Option(name = "-a", required = false, usage = "Path to cluster configuration")
-    public String asterixConf;
-
 }
diff --git a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/DeleteCommand.java b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/DeleteCommand.java
index 22ef630..e97fe3f 100644
--- a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/DeleteCommand.java
+++ b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/DeleteCommand.java
@@ -53,7 +53,7 @@
 
 class DeleteConfig extends AbstractCommandConfig {
 
-    @Option(name = "-n", required = false, usage = "Name of Asterix Instance")
+    @Option(name = "-n", required = true, usage = "Name of Asterix Instance")
     public String name;
 
 }
diff --git a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/RestoreCommand.java b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/RestoreCommand.java
index 69d34e0..958ce6c 100644
--- a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/RestoreCommand.java
+++ b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/RestoreCommand.java
@@ -14,6 +14,8 @@
  */
 package edu.uci.ics.asterix.installer.command;
 
+import java.util.List;
+
 import org.kohsuke.args4j.Option;
 
 import edu.uci.ics.asterix.event.schema.pattern.Patterns;
@@ -22,6 +24,7 @@
 import edu.uci.ics.asterix.installer.events.PatternCreator;
 import edu.uci.ics.asterix.installer.model.AsterixInstance;
 import edu.uci.ics.asterix.installer.model.AsterixInstance.State;
+import edu.uci.ics.asterix.installer.model.BackupInfo;
 
 public class RestoreCommand extends AbstractCommand {
 
@@ -31,11 +34,14 @@
         String asterixInstanceName = ((RestoreConfig) config).name;
         AsterixInstance instance = InstallerUtil.validateAsterixInstanceExists(asterixInstanceName, State.INACTIVE);
         int backupId = ((RestoreConfig) config).backupId;
-        if (instance.getBackupInfo().size() <= backupId || backupId < 0) {
+        List<BackupInfo> backupInfoList = instance.getBackupInfo();
+        if (backupInfoList.size() <= backupId || backupId < 0) {
             throw new IllegalStateException("Invalid backup id");
         }
+
+        BackupInfo backupInfo = backupInfoList.get(backupId);
         PatternCreator pc = new PatternCreator();
-        Patterns patterns = pc.getRestoreAsterixPattern(instance, backupId);
+        Patterns patterns = pc.getRestoreAsterixPattern(instance, backupInfo);
         InstallerUtil.getEventrixClient(instance.getCluster()).submit(patterns);
         LOGGER.info("Asterix instance: " + asterixInstanceName + " has been restored from backup");
     }
@@ -56,10 +62,10 @@
 
 class RestoreConfig extends AbstractCommandConfig {
 
-    @Option(name = "-n", required = false, usage = "Name of the Asterix instance")
+    @Option(name = "-n", required = true, usage = "Name of the Asterix instance")
     public String name;
 
-    @Option(name = "-b", required = false, usage = "Id corresponding to the backed up version")
+    @Option(name = "-b", required = true, usage = "Id corresponding to the backed up version")
     public int backupId;
 
 }
\ No newline at end of file
diff --git a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/ShutdownCommand.java b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/ShutdownCommand.java
index 0224876..cbfd5c5 100644
--- a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/ShutdownCommand.java
+++ b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/ShutdownCommand.java
@@ -22,6 +22,7 @@
 
     @Override
     protected void execCommand() throws Exception {
+        InstallerDriver.initConfig();
         ILookupService lookupService = ServiceProvider.INSTANCE.getLookupService();
         lookupService.stopService(InstallerDriver.getConfiguration());
     }
diff --git a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/StartCommand.java b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/StartCommand.java
index 818b8d9..8004e9a 100644
--- a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/StartCommand.java
+++ b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/StartCommand.java
@@ -63,10 +63,9 @@
 
 class StartConfig extends AbstractCommandConfig {
 
-    @Option(name = "-n", required = false, usage = "Name of Asterix Instance")
+    @Option(name = "-n", required = true, usage = "Name of Asterix Instance")
     public String name;
 
-    @Option(name = "-conf", required = false, usage = "Path to instance configuration")
-    public String confPath;
+  
 
 }
diff --git a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/StopCommand.java b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/StopCommand.java
index cab6065..85fcb68 100644
--- a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/StopCommand.java
+++ b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/StopCommand.java
@@ -82,7 +82,7 @@
 
 class StopConfig extends AbstractCommandConfig {
 
-    @Option(name = "-n", required = false, usage = "Name of Asterix Instance")
+    @Option(name = "-n", required = true, usage = "Name of Asterix Instance")
     public String name;
 
 }
diff --git a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/driver/InstallerDriver.java b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/driver/InstallerDriver.java
index b6add8f..bd8568f 100644
--- a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/driver/InstallerDriver.java
+++ b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/driver/InstallerDriver.java
@@ -39,7 +39,7 @@
     public static final String EVENTS_DIR = "events";
 
     private static final Logger LOGGER = Logger.getLogger(InstallerDriver.class.getName());
-    public static final String ENV_MANAGIX_HOME = "MANAGIX_HOME";
+    public static final String ENV_MANAGIX_HOME = "INSTALLER_HOME";
     public static final String MANAGIX_CONF_XML = "conf" + File.separator + "installer-conf.xml";
 
     private static Configuration conf;
@@ -110,7 +110,7 @@
             LOGGER.error("Unknown command");
             printUsage();
         } catch (Exception e) {
-            LOGGER.error(e.getMessage());
+            LOGGER.error(e);
         }
     }
 
@@ -123,10 +123,9 @@
         buffer.append("stop     " + ":" + " Stops an asterix instance that is in ACTIVE state" + "\n");
         buffer.append("backup   " + ":" + " Creates a back up for an existing asterix instance" + "\n");
         buffer.append("restore  " + ":" + " Restores an asterix instance" + "\n");
-        buffer.append("alter    " + ":" + " Alters the configuration for an existing asterix instance" + "\n");
         buffer.append("describe " + ":" + " Describes an existing asterix instance" + "\n");
         buffer.append("validate " + ":" + " Validates the installer/cluster configuration" + "\n");
-        buffer.append("configure" + ":" + " Auto generate configuration for a local psedu-distributed Asterix instance"
+        buffer.append("configure" + ":" + " Auto-generate configuration for local psedu-distributed Asterix instance"
                 + "\n");
         buffer.append("shutdown " + ":" + " Shutdown the installer service" + "\n");
         LOGGER.info(buffer.toString());
diff --git a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/driver/InstallerUtil.java b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/driver/InstallerUtil.java
index cd3ebdb..1007c01 100644
--- a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/driver/InstallerUtil.java
+++ b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/driver/InstallerUtil.java
@@ -51,9 +51,10 @@
 
 public class InstallerUtil {
 
-    public static AsterixInstance createAsterixInstance(String asterixInstanceName, Cluster cluster, String asterixConf)
+    public static AsterixInstance createAsterixInstance(String asterixInstanceName, Cluster cluster)
             throws FileNotFoundException, IOException {
-        Properties asterixConfProp = getAsterixConfiguration(asterixConf);
+        Properties asterixConfProp = new Properties();
+        asterixConfProp.put("output_dir", cluster.getWorkingDir().getDir() + File.separator + "asterix_output");
         Node metadataNode = getMetadataNode(cluster);
         String asterixZipName = InstallerDriver.getAsterixZip().substring(
                 InstallerDriver.getAsterixZip().lastIndexOf(File.separator) + 1);
diff --git a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/error/OutputHandler.java b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/error/OutputHandler.java
index c5ad2a4..16b86df 100644
--- a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/error/OutputHandler.java
+++ b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/error/OutputHandler.java
@@ -14,6 +14,10 @@
  */
 package edu.uci.ics.asterix.installer.error;
 
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.util.Properties;
+
 import edu.uci.ics.asterix.event.management.IOutputHandler;
 import edu.uci.ics.asterix.event.management.OutputAnalysis;
 import edu.uci.ics.asterix.event.schema.pattern.Event;
@@ -51,7 +55,8 @@
                         errorMessage.append("Insufficient permissions on HDFS back up directory");
                         ignore = false;
                     }
-                    if (output.contains("does not exist") || output.contains("File exist")) {
+                    if (output.contains("does not exist") || output.contains("File exist")
+                            || (output.contains("No such file or directory"))) {
                         ignore = true;
                     } else {
                         ignore = false;
@@ -65,7 +70,8 @@
                         errorMessage.append("Insufficient permissions on HDFS back up directory");
                         ignore = false;
                     }
-                    if (output.contains("does not exist") || output.contains("File exist")) {
+                    if (output.contains("does not exist") || output.contains("File exist")
+                            || output.contains("No such file or directory")) {
                         ignore = true;
                     } else {
                         ignore = false;
@@ -81,6 +87,22 @@
                         errorMessage.append("\nStop the instance to initiate a cleanup");
                     }
                 }
+            case NODE_INFO:
+                Properties p = new Properties();
+                try {
+                    p.load(new ByteArrayInputStream(trimmedOutput.getBytes()));
+                } catch (IOException e) {
+                }
+                String javaVersion = (String) p.get("JAVA_VERSION");
+                if (p.get("JAVA_VERSION") == null) {
+                    errorMessage.append("Java not installed on " + event.getNodeid().getValue().getAbsvalue());
+                    ignore = false;
+                } else if (!javaVersion.contains("1.8")) {
+                    errorMessage.append("Asterix requires Java 1.7.x. Incompatible version found on  "
+                            + event.getNodeid().getValue().getAbsvalue());
+                    ignore = false;
+                }
+                break;
         }
         if (ignore) {
             return new OutputAnalysis(true, null);
@@ -88,5 +110,4 @@
             return new OutputAnalysis(false, errorMessage.toString());
         }
     }
-
 }
diff --git a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/events/PatternCreator.java b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/events/PatternCreator.java
index 695a8d6..1217c0b 100644
--- a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/events/PatternCreator.java
+++ b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/events/PatternCreator.java
@@ -17,7 +17,6 @@
 import java.io.File;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.logging.Logger;
 
 import edu.uci.ics.asterix.event.driver.EventDriver;
 import edu.uci.ics.asterix.event.schema.cluster.Cluster;
@@ -32,12 +31,14 @@
 import edu.uci.ics.asterix.installer.driver.InstallerDriver;
 import edu.uci.ics.asterix.installer.error.VerificationUtil;
 import edu.uci.ics.asterix.installer.model.AsterixInstance;
+import edu.uci.ics.asterix.installer.model.BackupInfo;
+import edu.uci.ics.asterix.installer.model.BackupInfo.BackupType;
+import edu.uci.ics.asterix.installer.schema.conf.Backup;
 import edu.uci.ics.asterix.installer.service.ILookupService;
 import edu.uci.ics.asterix.installer.service.ServiceProvider;
 
 public class PatternCreator {
 
-    private static final Logger LOGGER = Logger.getLogger(PatternCreator.class.getName());
     private ILookupService lookupService = ServiceProvider.INSTANCE.getLookupService();
 
     private void addInitialDelay(Pattern p, int delay, String unit) {
@@ -76,6 +77,20 @@
         return patterns;
     }
 
+    public Patterns getClusterInfoPattern(Cluster cluster) throws Exception {
+        List<Pattern> ps = new ArrayList<Pattern>();
+        String pargs = "";
+        List<Node> nodeList = cluster.getNode();
+        nodeList.add(new Node(cluster.getMasterNode().getId(), cluster.getMasterNode().getIp(), null, null, null, null,
+                null));
+        for (Node node : nodeList) {
+            Nodeid nodeid = new Nodeid(new Value(null, node.getId()));
+            Event event = new Event("node_info", nodeid, pargs);
+            ps.add(new Pattern(null, 1, null, event));
+        }
+        return new Patterns(ps);
+    }
+
     public Patterns getStopCommandPattern(StopCommand stopCommand) throws Exception {
         List<Pattern> ps = new ArrayList<Pattern>();
         AsterixInstance asterixInstance = lookupService.getAsterixInstance(stopCommand.getAsterixInstanceName());
@@ -98,12 +113,40 @@
         return patterns;
     }
 
-    public Patterns getBackUpAsterixPattern(AsterixInstance instance, String backupPath) throws Exception {
+    public Patterns getBackUpAsterixPattern(AsterixInstance instance, Backup backupConf) throws Exception {
+        BackupType backupType = BackupInfo.getBackupType(backupConf);
+        Patterns patterns = null;
+        switch (backupType) {
+            case HDFS:
+                patterns = getHDFSBackUpAsterixPattern(instance, backupConf);
+                break;
+            case LOCAL:
+                patterns = getLocalBackUpAsterixPattern(instance, backupConf);
+                break;
+        }
+        return patterns;
+    }
+
+    public Patterns getRestoreAsterixPattern(AsterixInstance instance, BackupInfo backupInfo) throws Exception {
+        BackupType backupType = backupInfo.getBackupType();
+        Patterns patterns = null;
+        switch (backupType) {
+            case HDFS:
+                patterns = getHDFSRestoreAsterixPattern(instance, backupInfo);
+                break;
+            case LOCAL:
+                patterns = getLocalRestoreAsterixPattern(instance, backupInfo);
+                break;
+        }
+        return patterns;
+    }
+
+    private Patterns getHDFSBackUpAsterixPattern(AsterixInstance instance, Backup backupConf) throws Exception {
         Cluster cluster = instance.getCluster();
         String clusterStore = instance.getCluster().getStore();
-        String hdfsUrl = InstallerDriver.getConfiguration().getBackup().getHdfs().getUrl();
-        String hadoopVersion = InstallerDriver.getConfiguration().getBackup().getHdfs().getVersion();
-        String hdfsBackupDir = InstallerDriver.getConfiguration().getBackup().getHdfs().getBackupDir();
+        String hdfsUrl = backupConf.getHdfs().getUrl();
+        String hadoopVersion = backupConf.getHdfs().getVersion();
+        String hdfsBackupDir = backupConf.getBackupDir();
         VerificationUtil.verifyBackupRestoreConfiguration(hdfsUrl, hadoopVersion, hdfsBackupDir);
         String workingDir = cluster.getWorkingDir().getDir();
         String backupId = "" + instance.getBackupInfo().size();
@@ -113,30 +156,71 @@
         for (Node node : cluster.getNode()) {
             Nodeid nodeid = new Nodeid(new Value(null, node.getId()));
             nodeStore = node.getStore() == null ? clusterStore : node.getStore();
-            pargs = workingDir + " " + instance.getName() + " " + nodeStore + " " + backupId + " " + hdfsUrl + " "
-                    + hadoopVersion + " " + hdfsBackupDir + " " + node.getId();
+            pargs = workingDir + " " + instance.getName() + " " + nodeStore + " " + backupId + " " + hdfsBackupDir
+                    + " " + "hdfs" + " " + node.getId() + " " + hdfsUrl + " " + hadoopVersion;
             Event event = new Event("backup", nodeid, pargs);
             patternList.add(new Pattern(null, 1, null, event));
         }
         return new Patterns(patternList);
     }
 
-    public Patterns getRestoreAsterixPattern(AsterixInstance instance, int backupId) throws Exception {
+    private Patterns getLocalBackUpAsterixPattern(AsterixInstance instance, Backup backupConf) throws Exception {
         Cluster cluster = instance.getCluster();
         String clusterStore = instance.getCluster().getStore();
-        String hdfsUrl = InstallerDriver.getConfiguration().getBackup().getHdfs().getUrl();
-        String hadoopVersion = InstallerDriver.getConfiguration().getBackup().getHdfs().getVersion();
-        String hdfsBackupDir = InstallerDriver.getConfiguration().getBackup().getHdfs().getBackupDir();
-        VerificationUtil.verifyBackupRestoreConfiguration(hdfsUrl, hadoopVersion, hdfsBackupDir);
+        String backupDir = backupConf.getBackupDir();
         String workingDir = cluster.getWorkingDir().getDir();
+        String backupId = "" + instance.getBackupInfo().size();
         String nodeStore;
         String pargs;
         List<Pattern> patternList = new ArrayList<Pattern>();
         for (Node node : cluster.getNode()) {
             Nodeid nodeid = new Nodeid(new Value(null, node.getId()));
             nodeStore = node.getStore() == null ? clusterStore : node.getStore();
-            pargs = workingDir + " " + instance.getName() + " " + nodeStore + " " + backupId + " " + hdfsUrl + " "
-                    + hadoopVersion + " " + hdfsBackupDir + " " + node.getId();
+            pargs = workingDir + " " + instance.getName() + " " + nodeStore + " " + backupId + " " + backupDir + " "
+                    + "local" + " " + node.getId();
+            Event event = new Event("backup", nodeid, pargs);
+            patternList.add(new Pattern(null, 1, null, event));
+        }
+        return new Patterns(patternList);
+    }
+
+    public Patterns getHDFSRestoreAsterixPattern(AsterixInstance instance, BackupInfo backupInfo) throws Exception {
+        Cluster cluster = instance.getCluster();
+        String clusterStore = instance.getCluster().getStore();
+        String hdfsUrl = backupInfo.getBackupConf().getHdfs().getUrl();
+        String hadoopVersion = backupInfo.getBackupConf().getHdfs().getVersion();
+        String hdfsBackupDir = backupInfo.getBackupConf().getBackupDir();
+        VerificationUtil.verifyBackupRestoreConfiguration(hdfsUrl, hadoopVersion, hdfsBackupDir);
+        String workingDir = cluster.getWorkingDir().getDir();
+        int backupId = backupInfo.getId();
+        String nodeStore;
+        String pargs;
+        List<Pattern> patternList = new ArrayList<Pattern>();
+        for (Node node : cluster.getNode()) {
+            Nodeid nodeid = new Nodeid(new Value(null, node.getId()));
+            nodeStore = node.getStore() == null ? clusterStore : node.getStore();
+            pargs = workingDir + " " + instance.getName() + " " + nodeStore + " " + backupId + " " + hdfsBackupDir
+                    + " " + "hdfs" + " " + node.getId() + " " + hdfsUrl + " " + hadoopVersion;
+            Event event = new Event("restore", nodeid, pargs);
+            patternList.add(new Pattern(null, 1, null, event));
+        }
+        return new Patterns(patternList);
+    }
+
+    public Patterns getLocalRestoreAsterixPattern(AsterixInstance instance, BackupInfo backupInfo) throws Exception {
+        Cluster cluster = instance.getCluster();
+        String clusterStore = instance.getCluster().getStore();
+        String backupDir = backupInfo.getBackupConf().getBackupDir();
+        String workingDir = cluster.getWorkingDir().getDir();
+        int backupId = backupInfo.getId();
+        String nodeStore;
+        String pargs;
+        List<Pattern> patternList = new ArrayList<Pattern>();
+        for (Node node : cluster.getNode()) {
+            Nodeid nodeid = new Nodeid(new Value(null, node.getId()));
+            nodeStore = node.getStore() == null ? clusterStore : node.getStore();
+            pargs = workingDir + " " + instance.getName() + " " + nodeStore + " " + backupId + " " + backupDir + " "
+                    + "local" + " " + node.getId();
             Event event = new Event("restore", nodeid, pargs);
             patternList.add(new Pattern(null, 1, null, event));
         }
@@ -193,7 +277,7 @@
         Cluster cluster = instance.getCluster();
         String hdfsUrl = InstallerDriver.getConfiguration().getBackup().getHdfs().getUrl();
         String hadoopVersion = InstallerDriver.getConfiguration().getBackup().getHdfs().getVersion();
-        String hdfsBackupDir = InstallerDriver.getConfiguration().getBackup().getHdfs().getBackupDir();
+        String hdfsBackupDir = InstallerDriver.getConfiguration().getBackup().getBackupDir();
         String workingDir = cluster.getWorkingDir().getDir();
         Node launchingNode = cluster.getNode().get(0);
         Nodeid nodeid = new Nodeid(new Value(null, launchingNode.getId()));
diff --git a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/model/AsterixInstance.java b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/model/AsterixInstance.java
index f020b6d..b0a7501 100644
--- a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/model/AsterixInstance.java
+++ b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/model/AsterixInstance.java
@@ -164,7 +164,7 @@
         buffer.append("\n");
         if (backupInfo != null && backupInfo.size() > 0) {
             for (BackupInfo info : backupInfo) {
-                buffer.append("Backup:" + info.getId() + " created at " + info.getDate() + "\n");
+                buffer.append(info + "\n");
             }
         }
         buffer.append("\n");
diff --git a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/model/BackupInfo.java b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/model/BackupInfo.java
index a5d2b36..cea8087 100644
--- a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/model/BackupInfo.java
+++ b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/model/BackupInfo.java
@@ -17,14 +17,24 @@
 import java.io.Serializable;
 import java.util.Date;
 
+import edu.uci.ics.asterix.installer.schema.conf.Backup;
+import edu.uci.ics.asterix.installer.schema.conf.Hdfs;
+
 public class BackupInfo implements Serializable {
-   
+
+    public static enum BackupType {
+        LOCAL,
+        HDFS
+    };
+
     private final int id;
     private final Date date;
+    private final Backup backupConf;
 
-    public BackupInfo(int id, Date date) {
+    public BackupInfo(int id, Date date, Backup backupConf) {
         this.id = id;
         this.date = date;
+        this.backupConf = backupConf;
     }
 
     public int getId() {
@@ -34,10 +44,25 @@
     public Date getDate() {
         return date;
     }
-    
-    @Override
-    public String toString() {
-        return id + "_" + date;
+
+    public Backup getBackupConf() {
+        return backupConf;
     }
 
+    @Override
+    public String toString() {
+        return id + " " + date + " " + "(" + getBackupType() + ")" + " " + "[ " + this.getBackupConf().getBackupDir()
+                + " ]";
+
+    }
+
+    public BackupType getBackupType() {
+        return getBackupType(this.getBackupConf());
+    }
+
+    public static BackupType getBackupType(Backup backupConf) {
+        Hdfs hdfs = backupConf.getHdfs();
+        return (hdfs != null && hdfs.getUrl() != null && hdfs.getUrl().length() > 0) ? BackupType.HDFS
+                : BackupType.LOCAL;
+    }
 }
\ No newline at end of file
diff --git a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/model/EventList.java b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/model/EventList.java
index e7f7264..8ab6adc 100644
--- a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/model/EventList.java
+++ b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/model/EventList.java
@@ -27,6 +27,7 @@
         FILE_DELETE,
         HDFS_DELETE,
         FILE_TRANSFER,
-        DIRECTORY_TRANSFER
+        DIRECTORY_TRANSFER,
+        NODE_INFO
     }
 }
diff --git a/asterix-installer/src/main/resources/schema/installer-conf.xsd b/asterix-installer/src/main/resources/schema/installer-conf.xsd
index 489b024..318e7ce 100644
--- a/asterix-installer/src/main/resources/schema/installer-conf.xsd
+++ b/asterix-installer/src/main/resources/schema/installer-conf.xsd
@@ -18,7 +18,6 @@
     <xs:sequence>
       <xs:element ref="mg:version"/>
       <xs:element ref="mg:url"/>
-      <xs:element ref="mg:backupDir"/>
     </xs:sequence>
   </xs:complexType>
 </xs:element>
@@ -26,7 +25,8 @@
 <xs:element name="backup">
   <xs:complexType>
     <xs:sequence>
-      <xs:element ref="mg:hdfs"/>
+      <xs:element ref="mg:hdfs" minOccurs="0"/> 
+      <xs:element ref="mg:backupDir"/>
     </xs:sequence>
   </xs:complexType>
 </xs:element>
diff --git a/asterix-installer/src/main/resources/schema/jaxb-bindings.xjb b/asterix-installer/src/main/resources/schema/jaxb-bindings.xjb
new file mode 100644
index 0000000..b5982e0
--- /dev/null
+++ b/asterix-installer/src/main/resources/schema/jaxb-bindings.xjb
@@ -0,0 +1,9 @@
+<jxb:bindings version="1.0"
+xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
+xmlns:xs="http://www.w3.org/2001/XMLSchema">
+
+<jxb:globalBindings>
+  <jxb:serializable uid="1"/>
+</jxb:globalBindings>
+
+</jxb:bindings>
diff --git a/asterix-installer/src/main/resources/scripts/managix b/asterix-installer/src/main/resources/scripts/managix
index cd0794e..11810ef 100755
--- a/asterix-installer/src/main/resources/scripts/managix
+++ b/asterix-installer/src/main/resources/scripts/managix
@@ -1,20 +1,20 @@
-if [ -z $MANAGIX_HOME ] 
+if [ -z $INSTALLER_HOME ] 
  then
-   echo "MANAGIX_HOME is not defined"
+   echo "INSTALLER_HOME is not defined"
    exit 1
 fi
 
 VERSION=0.0.4-SNAPSHOT
 
-for jar in `ls $MANAGIX_HOME/lib/*.jar`
+for jar in `ls $INSTALLER_HOME/lib/*.jar`
   do 
-  if [ -z $MANAGIX_CLASSPATH ] 
+  if [ -z $INSTALLER_CLASSPATH ] 
   then 
-    MANAGIX_CLASSPATH=$jar 
+    INSTALLER_CLASSPATH=$jar 
   else
-    MANAGIX_CLASSPATH=$MANAGIX_CLASSPATH:$jar 
+    INSTALLER_CLASSPATH=$INSTALLER_CLASSPATH:$jar 
   fi
 done
 
-MANAGIX_CLASSPATH=$MANAGIX_CLASSPATH:$MANAGIX_HOME/conf/log4j.properties
-java $JAVA_OPTS -Dlog4j.configuration=file:$MANAGIX_HOME/conf/log4j.properties -cp $MANAGIX_CLASSPATH edu.uci.ics.asterix.installer.driver.InstallerDriver $@
+INSTALLER_CLASSPATH=$INSTALLER_CLASSPATH:$INSTALLER_HOME/conf/log4j.properties
+java $JAVA_OPTS -Dlog4j.configuration=file:$INSTALLER_HOME/conf/log4j.properties -cp $INSTALLER_CLASSPATH edu.uci.ics.asterix.installer.driver.InstallerDriver $@