renaming installer configuration files 2) other cosmetic changes

git-svn-id: https://asterixdb.googlecode.com/svn/branches/asterix_stabilization_ioc@1359 eaa15691-b419-025a-1212-ee371bd00084
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
index ae72490..2179d5a 100755
--- a/asterix-events/src/main/resources/events/node_info/node_info.sh
+++ b/asterix-events/src/main/resources/events/node_info/node_info.sh
@@ -1,4 +1,2 @@
 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
+echo "java_version=$JAVA_VERSION" 1>&2
diff --git a/asterix-installer/pom.xml b/asterix-installer/pom.xml
index 28ad995..fa5666a 100644
--- a/asterix-installer/pom.xml
+++ b/asterix-installer/pom.xml
@@ -6,9 +6,7 @@
           <groupId>edu.uci.ics.asterix</groupId>
           <version>0.0.4-SNAPSHOT</version>
   </parent>
-  <groupId>edu.uci.ics.asterix</groupId>
   <artifactId>asterix-installer</artifactId>
-  <version>0.0.4-SNAPSHOT</version>
 
   <properties>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
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 854ee8e..55e172b 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
@@ -26,6 +26,7 @@
 import edu.uci.ics.asterix.event.schema.cluster.Cluster;
 import edu.uci.ics.asterix.event.schema.cluster.Env;
 import edu.uci.ics.asterix.event.schema.cluster.Property;
+import edu.uci.ics.asterix.event.schema.cluster.WorkingDir;
 import edu.uci.ics.asterix.event.schema.pattern.Patterns;
 import edu.uci.ics.asterix.installer.driver.InstallerDriver;
 import edu.uci.ics.asterix.installer.driver.InstallerUtil;
@@ -37,78 +38,97 @@
 
 public class CreateCommand extends AbstractCommand {
 
-    private String asterixInstanceName;
-    private Cluster cluster;
+	private String asterixInstanceName;
+	private Cluster cluster;
 
-    @Override
-    protected void execCommand() throws Exception {
-        InstallerDriver.initConfig();
-        ValidateCommand validateCommand = new ValidateCommand();
-        boolean valid = validateCommand.validateCluster(((CreateConfig) config).clusterPath);
-        if (!valid) {
-            throw new Exception("Cannot create an Asterix instance.");
-        }
-        asterixInstanceName = ((CreateConfig) config).name;
-        InstallerUtil.validateAsterixInstanceNotExists(asterixInstanceName);
-        CreateConfig createConfig = (CreateConfig) config;
-        JAXBContext ctx = JAXBContext.newInstance(Cluster.class);
-        Unmarshaller unmarshaller = ctx.createUnmarshaller();
-        cluster = (Cluster) unmarshaller.unmarshal(new File(createConfig.clusterPath));
-        AsterixInstance asterixInstance = InstallerUtil.createAsterixInstance(asterixInstanceName, cluster);
-        InstallerUtil.evaluateConflictWithOtherInstances(asterixInstance);
-        InstallerUtil.createAsterixZip(asterixInstance, true);
-        List<Property> clusterProperties = new ArrayList<Property>();
-        clusterProperties.add(new Property("ASTERIX_HOME", cluster.getWorkingDir().getDir() + File.separator
-                + "asterix"));
-        clusterProperties.add(new Property("JAVA_OPTS", "-Xmx" + cluster.getRam()));
-        clusterProperties.add(new Property("CLUSTER_NET_IP", cluster.getMasterNode().getClusterIp()));
-        clusterProperties.add(new Property("CLIENT_NET_IP", cluster.getMasterNode().getIp()));
-        clusterProperties.add(new Property("LOG_DIR", cluster.getLogdir()));
-        clusterProperties.add(new Property("JAVA_HOME", cluster.getJavaHome()));
-        cluster.setEnv(new Env(clusterProperties));
+	@Override
+	protected void execCommand() throws Exception {
+		InstallerDriver.initConfig();
+		ValidateCommand validateCommand = new ValidateCommand();
+		boolean valid = validateCommand
+				.validateCluster(((CreateConfig) config).clusterPath);
+		if (!valid) {
+			throw new Exception("Cannot create an Asterix instance.");
+		}
+		asterixInstanceName = ((CreateConfig) config).name;
+		InstallerUtil.validateAsterixInstanceNotExists(asterixInstanceName);
+		CreateConfig createConfig = (CreateConfig) config;
+		JAXBContext ctx = JAXBContext.newInstance(Cluster.class);
+		Unmarshaller unmarshaller = ctx.createUnmarshaller();
+		cluster = (Cluster) unmarshaller.unmarshal(new File(
+				createConfig.clusterPath));
+		cluster.setWorkingDir(new WorkingDir(cluster.getWorkingDir().getDir()
+				+ File.separator + asterixInstanceName, cluster.getWorkingDir()
+				.isNFS()));
+		cluster.setLogdir(cluster.getLogdir() + File.separator
+				+ asterixInstanceName);
+		AsterixInstance asterixInstance = InstallerUtil.createAsterixInstance(
+				asterixInstanceName, cluster);
+		InstallerUtil.evaluateConflictWithOtherInstances(asterixInstance);
+		InstallerUtil.createAsterixZip(asterixInstance, true);
+		List<Property> clusterProperties = new ArrayList<Property>();
+		clusterProperties.add(new Property("ASTERIX_HOME", cluster
+				.getWorkingDir().getDir() + File.separator + "asterix"));
+		clusterProperties.add(new Property("JAVA_OPTS", "-Xmx"
+				+ cluster.getRam()));
+		clusterProperties.add(new Property("CLUSTER_NET_IP", cluster
+				.getMasterNode().getClusterIp()));
+		clusterProperties.add(new Property("CLIENT_NET_IP", cluster
+				.getMasterNode().getIp()));
+		clusterProperties.add(new Property("LOG_DIR", cluster.getLogdir()));
+		clusterProperties.add(new Property("JAVA_HOME", cluster.getJavaHome()));
+		clusterProperties.add(new Property("WORKING_DIR", cluster
+				.getWorkingDir().getDir()));
+		cluster.setEnv(new Env(clusterProperties));
 
-        PatternCreator pc = new PatternCreator();
-        Patterns patterns = pc.getStartAsterixPattern(asterixInstanceName, cluster);
-        InstallerUtil.getEventrixClient(cluster).submit(patterns);
+		PatternCreator pc = new PatternCreator();
+		Patterns patterns = pc.getStartAsterixPattern(asterixInstanceName,
+				cluster);
+		InstallerUtil.getEventrixClient(cluster).submit(patterns);
 
-        AsterixRuntimeState runtimeState = VerificationUtil.getAsterixRuntimeState(asterixInstance);
-        VerificationUtil.updateInstanceWithRuntimeDescription(asterixInstance, runtimeState, true);
-        ServiceProvider.INSTANCE.getLookupService().writeAsterixInstance(asterixInstance);
-        InstallerUtil.deleteDirectory(InstallerDriver.getManagixHome() + File.separator + InstallerDriver.ASTERIX_DIR
-                + File.separator + asterixInstanceName);
-        LOGGER.info(asterixInstance.getDescription(false));
+		AsterixRuntimeState runtimeState = VerificationUtil
+				.getAsterixRuntimeState(asterixInstance);
+		VerificationUtil.updateInstanceWithRuntimeDescription(asterixInstance,
+				runtimeState, true);
+		ServiceProvider.INSTANCE.getLookupService().writeAsterixInstance(
+				asterixInstance);
+		InstallerUtil.deleteDirectory(InstallerDriver.getManagixHome()
+				+ File.separator + InstallerDriver.ASTERIX_DIR + File.separator
+				+ asterixInstanceName);
+		LOGGER.info(asterixInstance.getDescription(false));
+	}
 
-    }
+	@Override
+	protected CommandConfig getCommandConfig() {
+		return new CreateConfig();
+	}
 
-    @Override
-    protected CommandConfig getCommandConfig() {
-        return new CreateConfig();
-    }
+	public Cluster getCluster() {
+		return cluster;
+	}
 
-    public Cluster getCluster() {
-        return cluster;
-    }
+	public String getAsterixInstanceName() {
+		return asterixInstanceName;
+	}
 
-    public String getAsterixInstanceName() {
-        return asterixInstanceName;
-    }
+	@Override
+	protected String getUsageDescription() {
+		return "\nCreates an ASTERIX instance with a specified name."
+				+ "\n\nPost creation, the instance is in ACTIVE state, indicating its "
+				+ "\navailability for executing statements/queries."
+				+ "\n\nUsage arguments/options:"
+				+ "\n-n Name of the ASTERIX instance."
+				+ "\n-c Path to the cluster configuration file";
+	}
 
-    @Override
-    protected String getUsageDescription() {
-        return "\nCreates an ASTERIX instance with a specified name."
-                + "\n\nPost creation, the instance is in ACTIVE state, signifying its "
-                + "\navailability for executing statements/queries." + "\n\nUsage arguments/options:"
-                + "\n-n Name of the ASTERIX instance." + "\n-c Path to the cluster configuration file"
-                + "\n-a Path to the ASTERIX configuration file";
-    }
 }
 
 class CreateConfig extends AbstractCommandConfig {
 
-    @Option(name = "-n", required = true, usage = "Name of Asterix Instance")
-    public String name;
+	@Option(name = "-n", required = true, usage = "Name of Asterix Instance")
+	public String name;
 
-    @Option(name = "-c", required = true, usage = "Path to cluster configuration")
-    public String clusterPath;
+	@Option(name = "-c", required = true, usage = "Path to cluster configuration")
+	public String clusterPath;
 
 }
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 e97fe3f..a2788b4 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
@@ -26,34 +26,41 @@
 
 public class DeleteCommand extends AbstractCommand {
 
-    @Override
-    protected void execCommand() throws Exception {
-        InstallerDriver.initConfig();
-        String asterixInstanceName = ((DeleteConfig) config).name;
-        AsterixInstance instance = InstallerUtil.validateAsterixInstanceExists(asterixInstanceName, State.INACTIVE);
-        PatternCreator pc = new PatternCreator();
-        Patterns patterns = pc.createDeleteInstancePattern(instance);
-        InstallerUtil.getEventrixClient(instance.getCluster()).submit(patterns);
-        ServiceProvider.INSTANCE.getLookupService().removeAsterixInstance(asterixInstanceName);
-        LOGGER.info(" Asterix instance: " + asterixInstanceName + " deleted");
-    }
+	@Override
+	protected void execCommand() throws Exception {
+		InstallerDriver.initConfig();
+		String asterixInstanceName = ((DeleteConfig) config).name;
+		AsterixInstance instance = InstallerUtil.validateAsterixInstanceExists(
+				asterixInstanceName, State.INACTIVE);
+		PatternCreator pc = new PatternCreator();
+		Patterns patterns = pc.createDeleteInstancePattern(instance);
+		InstallerUtil.getEventrixClient(instance.getCluster()).submit(patterns);
 
-    @Override
-    protected CommandConfig getCommandConfig() {
-        return new DeleteConfig();
-    }
+		patterns = pc.createRemoveAsterixWorkingDirPattern(instance);
+		InstallerUtil.getEventrixClient(instance.getCluster()).submit(patterns);
+		ServiceProvider.INSTANCE.getLookupService().removeAsterixInstance(
+				asterixInstanceName);
+		LOGGER.info("Deleted Asterix instance: " + asterixInstanceName);
+	}
 
-    @Override
-    protected String getUsageDescription() {
-        return "\nPermanently deletes an ASTERIX instance." + "\n" + "The instance must be in the INACTIVE state."
-                + "\n\nAvailable arguments/options" + "\n-n name of the ASTERIX instance.";
-    }
+	@Override
+	protected CommandConfig getCommandConfig() {
+		return new DeleteConfig();
+	}
+
+	@Override
+	protected String getUsageDescription() {
+		return "\nPermanently deletes an ASTERIX instance." + "\n"
+				+ "The instance must be in the INACTIVE state."
+				+ "\n\nAvailable arguments/options"
+				+ "\n-n name of the ASTERIX instance.";
+	}
 
 }
 
 class DeleteConfig extends AbstractCommandConfig {
 
-    @Option(name = "-n", required = true, usage = "Name of Asterix Instance")
-    public String name;
+	@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/DescribeCommand.java b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/DescribeCommand.java
index 63dcc30..bec82d5 100644
--- a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/DescribeCommand.java
+++ b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/DescribeCommand.java
@@ -29,63 +29,77 @@
 
 public class DescribeCommand extends AbstractCommand {
 
-    @Override
-    protected void execCommand() throws Exception {
-        InstallerDriver.initConfig();
-        String asterixInstanceName = ((DescribeConfig) config).name;
-        boolean adminView = ((DescribeConfig) config).admin;
-        if (asterixInstanceName != null) {
-            InstallerUtil.validateAsterixInstanceExists(asterixInstanceName, State.INACTIVE, State.ACTIVE,
-                    State.UNUSABLE);
-            AsterixInstance instance = ServiceProvider.INSTANCE.getLookupService().getAsterixInstance(
-                    asterixInstanceName);
-            if (instance != null) {
-                AsterixRuntimeState state = VerificationUtil.getAsterixRuntimeState(instance);
-                boolean expectedRunning = instance.getState().equals(State.UNUSABLE) ? instance.getPreviousState()
-                        .equals(State.ACTIVE) : !instance.getState().equals(State.INACTIVE);
-                VerificationUtil.updateInstanceWithRuntimeDescription(instance, state, expectedRunning);
-                ServiceProvider.INSTANCE.getLookupService().updateAsterixInstance(instance);
-                LOGGER.info(instance.getDescription(adminView));
-            } else {
-                throw new InstallerException("Asterix instance by the name " + asterixInstanceName + " does not exist.");
-            }
-        } else {
-            List<AsterixInstance> asterixInstances = ServiceProvider.INSTANCE.getLookupService().getAsterixInstances();
-            if (asterixInstances.size() > 0) {
-                for (AsterixInstance instance : asterixInstances) {
-                    AsterixRuntimeState state = VerificationUtil.getAsterixRuntimeState(instance);
-                    boolean expectedRunning = instance.getState().equals(State.UNUSABLE) ? instance.getPreviousState()
-                            .equals(State.ACTIVE) : !instance.getState().equals(State.INACTIVE);
-                    VerificationUtil.updateInstanceWithRuntimeDescription(instance, state, expectedRunning);
-                    ServiceProvider.INSTANCE.getLookupService().updateAsterixInstance(instance);
-                    LOGGER.info(instance.getDescription(adminView));
-                }
-            } else {
-                LOGGER.info("No Asterix instances found!");
-            }
+	@Override
+	protected void execCommand() throws Exception {
+		InstallerDriver.initConfig();
+		String asterixInstanceName = ((DescribeConfig) config).name;
+		boolean adminView = ((DescribeConfig) config).admin;
+		if (asterixInstanceName != null) {
+			InstallerUtil.validateAsterixInstanceExists(asterixInstanceName,
+					State.INACTIVE, State.ACTIVE, State.UNUSABLE);
+			AsterixInstance instance = ServiceProvider.INSTANCE
+					.getLookupService().getAsterixInstance(asterixInstanceName);
+			if (instance != null) {
+				AsterixRuntimeState state = VerificationUtil
+						.getAsterixRuntimeState(instance);
+				boolean expectedRunning = instance.getState().equals(
+						State.UNUSABLE) ? instance.getPreviousState().equals(
+						State.ACTIVE) : !instance.getState().equals(
+						State.INACTIVE);
+				VerificationUtil.updateInstanceWithRuntimeDescription(instance,
+						state, expectedRunning);
+				ServiceProvider.INSTANCE.getLookupService()
+						.updateAsterixInstance(instance);
+				LOGGER.info(instance.getDescription(adminView));
+			} else {
+				throw new InstallerException("Asterix instance by the name "
+						+ asterixInstanceName + " does not exist.");
+			}
+		} else {
+			List<AsterixInstance> asterixInstances = ServiceProvider.INSTANCE
+					.getLookupService().getAsterixInstances();
+			if (asterixInstances.size() > 0) {
+				for (AsterixInstance instance : asterixInstances) {
+					AsterixRuntimeState state = VerificationUtil
+							.getAsterixRuntimeState(instance);
+					boolean expectedRunning = instance.getState().equals(
+							State.UNUSABLE) ? instance.getPreviousState()
+							.equals(State.ACTIVE) : !instance.getState()
+							.equals(State.INACTIVE);
+					VerificationUtil.updateInstanceWithRuntimeDescription(
+							instance, state, expectedRunning);
+					ServiceProvider.INSTANCE.getLookupService()
+							.updateAsterixInstance(instance);
+					LOGGER.info(instance.getDescription(adminView));
+				}
+			} else {
+				LOGGER.info("No Asterix instances found!");
+			}
 
-        }
-    }
+		}
+	}
 
-    @Override
-    protected CommandConfig getCommandConfig() {
-        return new DescribeConfig();
-    }
+	@Override
+	protected CommandConfig getCommandConfig() {
+		return new DescribeConfig();
+	}
 
-    @Override
-    protected String getUsageDescription() {
-        return "\nProvides information about an ASTERIX instance." + "\n\nUsage arguments/options:-"
-                + "\n[-n] Name of the ASTERIX instance." + "\n[-admin] Provides a detailed description";
-    }
+	@Override
+	protected String getUsageDescription() {
+		return "\nProvides information about an ASTERIX instance."
+				+ "\n\nUsage arguments/options:-"
+				+ "\n[-n]       Name of the ASTERIX instance."
+				+ "\n[-admin]   Provides a detailed description";
+	}
 
 }
 
 class DescribeConfig extends AbstractCommandConfig {
 
-    @Option(name = "-n", required = false, usage = "Name of Asterix Instance")
-    public String name;
+	@Option(name = "-n", required = false, usage = "Name of Asterix Instance")
+	public String name;
 
-    @Option(name = "-admin", required = false, usage = "Detailed description")
-    public boolean admin;
+	@Option(name = "-admin", required = false, usage = "Detailed description")
+	public boolean admin;
 
 }
diff --git a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/ICommand.java b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/ICommand.java
index 5d6d9ac..d27fee9 100644
--- a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/ICommand.java
+++ b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/ICommand.java
@@ -16,9 +16,19 @@
 
 public interface ICommand {
 
-	public enum CommandType {
-		CREATE, DELETE, START, STOP, BACKUP, RESTORE, DESCRIBE, ALTER, VALIDATE, CONFIGURE, SHUTDOWN
-	}
+    public enum CommandType {
+        CREATE,
+        DELETE,
+        START,
+        STOP,
+        BACKUP,
+        RESTORE,
+        DESCRIBE,
+        ALTER,
+        VALIDATE,
+        CONFIGURE,
+        SHUTDOWN
+    }
 
-	public void execute(String args[]) throws Exception;
+    public void execute(String args[]) throws Exception;
 }
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 958ce6c..49629a4 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
@@ -55,7 +55,7 @@
     protected String getUsageDescription() {
         return "\nRestores an ASTERIX instance's data from a previously taken backup snapshot."
                 + "\n\nAvailable arguments/options" + "\n-n name of the ASTERIX instance"
-                + "\n-b id of the backed up snapshot ";
+                + "\n-b id of the backup snapshot ";
     }
 
 }
diff --git a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/ValidateCommand.java b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/ValidateCommand.java
index 9638ac6..dcdbe18 100644
--- a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/ValidateCommand.java
+++ b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/ValidateCommand.java
@@ -29,214 +29,247 @@
 import edu.uci.ics.asterix.event.schema.cluster.Cluster;
 import edu.uci.ics.asterix.event.schema.cluster.MasterNode;
 import edu.uci.ics.asterix.event.schema.cluster.Node;
+import edu.uci.ics.asterix.event.schema.pattern.Patterns;
 import edu.uci.ics.asterix.installer.driver.InstallerDriver;
+import edu.uci.ics.asterix.installer.driver.InstallerUtil;
+import edu.uci.ics.asterix.installer.events.PatternCreator;
 import edu.uci.ics.asterix.installer.schema.conf.Configuration;
 import edu.uci.ics.asterix.installer.schema.conf.Zookeeper;
 
 public class ValidateCommand extends AbstractCommand {
 
-    private static final String OK = " [" + "\u2713" + "]";
-    private static final String ERROR = " [" + "x" + "]";
-    private static final String WARNING = " [" + "!" + "]";
+	private static final String OK = " [" + "\u2713" + "]";
+	private static final String ERROR = " [" + "x" + "]";
+	private static final String WARNING = " [" + "!" + "]";
 
-    @Override
-    protected void execCommand() throws Exception {
-        ValidateConfig vConfig = (ValidateConfig) config;
-        logValidationResult("Enviornment", validateEnvironment());
-        if (((ValidateConfig) config).cluster != null) {
-            logValidationResult("Cluster configuration", validateCluster(vConfig.cluster));
-        } else {
-            logValidationResult("Installer Configuration", validateConfiguration());
-        }
-    }
+	@Override
+	protected void execCommand() throws Exception {
+		ValidateConfig vConfig = (ValidateConfig) config;
+		logValidationResult("Enviornment", validateEnvironment());
+		if (((ValidateConfig) config).cluster != null) {
+			logValidationResult("Cluster configuration",
+					validateCluster(vConfig.cluster));
+		} else {
+			logValidationResult("Installer Configuration",
+					validateConfiguration());
+		}
+	}
 
-    private void logValidationResult(String prefix, boolean isValid) {
-        if (!isValid) {
-            LOGGER.fatal(prefix + ERROR);
-        } else {
-            LOGGER.info(prefix + OK);
-        }
-    }
+	private void logValidationResult(String prefix, boolean isValid) {
+		if (!isValid) {
+			LOGGER.fatal(prefix + ERROR);
+		} else {
+			LOGGER.info(prefix + OK);
+		}
+	}
 
-    @Override
-    protected CommandConfig getCommandConfig() {
-        return new ValidateConfig();
-    }
+	@Override
+	protected CommandConfig getCommandConfig() {
+		return new ValidateConfig();
+	}
 
-    @Override
-    protected String getUsageDescription() {
-        return "\nValidate the installer's configuration or a cluster configuration" + "\nUsage"
-                + "\nFor validating the installer configuration" + "\n use $ managix validate"
-                + "\n\nFor validating a cluster configuration"
-                + "\n$ use managix validate -c <path to the cluster configuration file>";
-    }
+	@Override
+	protected String getUsageDescription() {
+		return "\nValidate the installer's configuration or a cluster configuration"
+				+ "\nUsage"
+				+ "\nFor validating the installer configuration"
+				+ "\n use $ managix validate"
+				+ "\n\nFor validating a cluster configuration"
+				+ "\n$ use managix validate -c <path to the cluster configuration file>";
+	}
 
-    public boolean validateEnvironment() throws Exception {
-        boolean valid = true;
-        String managixHome = System.getenv(InstallerDriver.ENV_MANAGIX_HOME);
-        if (managixHome == null) {
-            valid = false;
-            LOGGER.fatal(InstallerDriver.ENV_MANAGIX_HOME + " not set " + ERROR);
-        } else {
-            File home = new File(managixHome);
-            if (!home.exists()) {
-                valid = false;
-                LOGGER.fatal(InstallerDriver.ENV_MANAGIX_HOME + ": " + home.getAbsolutePath() + " does not exist!"
-                        + ERROR);
-            }
-        }
-        return valid;
+	public boolean validateEnvironment() throws Exception {
+		boolean valid = true;
+		String managixHome = System.getenv(InstallerDriver.ENV_MANAGIX_HOME);
+		if (managixHome == null) {
+			valid = false;
+			LOGGER.fatal(InstallerDriver.ENV_MANAGIX_HOME + " not set " + ERROR);
+		} else {
+			File home = new File(managixHome);
+			if (!home.exists()) {
+				valid = false;
+				LOGGER.fatal(InstallerDriver.ENV_MANAGIX_HOME + ": "
+						+ home.getAbsolutePath() + " does not exist!" + ERROR);
+			}
+		}
+		return valid;
 
-    }
+	}
 
-    public boolean validateCluster(String clusterPath) throws Exception {
-        boolean valid = true;
-        File f = new File(clusterPath);
-        if (!f.exists() || !f.isFile()) {
-            LOGGER.error(" Invalid path " + f.getAbsolutePath() + ERROR);
-            valid = false;
-        } else {
-            JAXBContext ctx = JAXBContext.newInstance(Cluster.class);
-            Unmarshaller unmarshaller = ctx.createUnmarshaller();
-            Cluster cluster = (Cluster) unmarshaller.unmarshal(new File(clusterPath));
-            validateClusterProperties(cluster);
+	public boolean validateCluster(String clusterPath) throws Exception {
+		boolean valid = true;
+		Cluster cluster = null;
+		File f = new File(clusterPath);
+		if (!f.exists() || !f.isFile()) {
+			LOGGER.error(" Invalid path " + f.getAbsolutePath() + ERROR);
+			valid = false;
+		} else {
+			JAXBContext ctx = JAXBContext.newInstance(Cluster.class);
+			Unmarshaller unmarshaller = ctx.createUnmarshaller();
+			cluster = (Cluster) unmarshaller.unmarshal(new File(clusterPath));
+			validateClusterProperties(cluster);
 
-            Set<String> servers = new HashSet<String>();
-            Set<String> serverIds = new HashSet<String>();
-            servers.add(cluster.getMasterNode().getIp());
-            serverIds.add(cluster.getMasterNode().getId());
+			Set<String> servers = new HashSet<String>();
+			Set<String> serverIds = new HashSet<String>();
+			servers.add(cluster.getMasterNode().getIp());
+			serverIds.add(cluster.getMasterNode().getId());
 
-            MasterNode masterNode = cluster.getMasterNode();
-            Node master = new Node(masterNode.getId(), masterNode.getIp(), masterNode.getRam(),
-                    masterNode.getJavaHome(), masterNode.getLogdir(), null, masterNode.getDebug());
+			MasterNode masterNode = cluster.getMasterNode();
+			Node master = new Node(masterNode.getId(), masterNode.getIp(),
+					masterNode.getRam(), masterNode.getJavaHome(),
+					masterNode.getLogdir(), null, masterNode.getDebug());
 
-            valid = valid & validateNodeConfiguration(master, cluster);
+			valid = valid & validateNodeConfiguration(master, cluster);
 
-            for (Node node : cluster.getNode()) {
-                servers.add(node.getIp());
-                if (serverIds.contains(node.getId())) {
-                    valid = false;
-                    LOGGER.error("Duplicate node id :" + node.getId() + ERROR);
-                } else {
-                    valid = valid & validateNodeConfiguration(node, cluster);
-                }
-            }
-        }
-        return valid;
-    }
+			for (Node node : cluster.getNode()) {
+				servers.add(node.getIp());
+				if (serverIds.contains(node.getId())) {
+					valid = false;
+					LOGGER.error("Duplicate node id :" + node.getId() + ERROR);
+				} else {
+					valid = valid & validateNodeConfiguration(node, cluster);
+				}
+			}
+		}
 
-    private void validateClusterProperties(Cluster cluster) {
-        List<String> tempDirs = new ArrayList<String>();
-        if (cluster.getLogdir() != null && checkTemporaryPath(cluster.getLogdir())) {
-            tempDirs.add("Log directory: " + cluster.getLogdir());
-        }
-        if (cluster.getStore() != null && checkTemporaryPath(cluster.getStore())) {
-            tempDirs.add("Store directory: " + cluster.getStore());
-        }
+		if (valid) {
+			checkJavaVersion(cluster);
+		}
+		return valid;
+	}
 
-        if (tempDirs.size() > 0) {
-            StringBuffer msg = new StringBuffer();
-            msg.append("The following paths are subject to be cleaned up by OS");
-            for (String tempDir : tempDirs) {
-                msg.append("\n" + tempDir + WARNING);
-            }
-            LOGGER.warn(msg);
-        }
+	private void checkJavaVersion(Cluster cluster) throws Exception {
+		PatternCreator pc = new PatternCreator();
+		Patterns patterns = pc.getClusterInfoPattern(cluster);
+		InstallerUtil.getEventrixClient(cluster).submit(patterns);
+	}
 
-    }
+	private void validateClusterProperties(Cluster cluster) {
+		List<String> tempDirs = new ArrayList<String>();
+		if (cluster.getLogdir() != null
+				&& checkTemporaryPath(cluster.getLogdir())) {
+			tempDirs.add("Log directory: " + cluster.getLogdir());
+		}
+		if (cluster.getStore() != null
+				&& checkTemporaryPath(cluster.getStore())) {
+			tempDirs.add("Store directory: " + cluster.getStore());
+		}
 
-    private boolean validateNodeConfiguration(Node node, Cluster cluster) {
-        boolean valid = true;
-        valid = checkNodeReachability(node.getIp());
-        if (node.getJavaHome() == null || node.getJavaHome().length() == 0) {
-            if (cluster.getJavaHome() == null || cluster.getJavaHome().length() == 0) {
-                valid = false;
-                LOGGER.fatal("java_home not defined at cluster/node level for node: " + node.getId() + ERROR);
-            }
-        }
+		if (tempDirs.size() > 0) {
+			StringBuffer msg = new StringBuffer();
+			msg.append("The following paths are subject to be cleaned up by OS");
+			for (String tempDir : tempDirs) {
+				msg.append("\n" + tempDir + WARNING);
+			}
+			LOGGER.warn(msg);
+		}
 
-        if (node.getLogdir() == null || node.getLogdir().length() == 0) {
-            if (cluster.getLogdir() == null || cluster.getLogdir().length() == 0) {
-                valid = false;
-                LOGGER.fatal("log_dir not defined at cluster/node level for node: " + node.getId() + ERROR);
-            }
-        }
+	}
 
-        if (node.getStore() == null || cluster.getStore().length() == 0) {
-            if (cluster.getMasterNode().getId().equals(node.getId())
-                    && (cluster.getStore() == null || cluster.getStore().length() == 0)) {
-                valid = false;
-                LOGGER.fatal("store not defined at cluster/node level for node: " + node.getId() + ERROR);
-            }
-        }
+	private boolean validateNodeConfiguration(Node node, Cluster cluster) {
+		boolean valid = true;
+		valid = checkNodeReachability(node.getIp());
+		if (node.getJavaHome() == null || node.getJavaHome().length() == 0) {
+			if (cluster.getJavaHome() == null
+					|| cluster.getJavaHome().length() == 0) {
+				valid = false;
+				LOGGER.fatal("java_home not defined at cluster/node level for node: "
+						+ node.getId() + ERROR);
+			}
+		}
 
-        if (node.getRam() == null || node.getRam().length() == 0) {
-            if (cluster.getRam() == null || cluster.getRam().length() == 0) {
-                valid = false;
-                LOGGER.fatal("ram not defined at cluster/node level for node: " + node.getId() + ERROR);
-            }
-        }
-        return valid;
-    }
+		if (node.getLogdir() == null || node.getLogdir().length() == 0) {
+			if (cluster.getLogdir() == null
+					|| cluster.getLogdir().length() == 0) {
+				valid = false;
+				LOGGER.fatal("log_dir not defined at cluster/node level for node: "
+						+ node.getId() + ERROR);
+			}
+		}
 
-    private boolean checkTemporaryPath(String logdir) {
-        return logdir.startsWith("/tmp/");
+		if (node.getStore() == null || cluster.getStore().length() == 0) {
+			if (cluster.getMasterNode().getId().equals(node.getId())
+					&& (cluster.getStore() == null || cluster.getStore()
+							.length() == 0)) {
+				valid = false;
+				LOGGER.fatal("store not defined at cluster/node level for node: "
+						+ node.getId() + ERROR);
+			}
+		}
 
-    }
+		if (node.getRam() == null || node.getRam().length() == 0) {
+			if (cluster.getRam() == null || cluster.getRam().length() == 0) {
+				valid = false;
+				LOGGER.fatal("ram not defined at cluster/node level for node: "
+						+ node.getId() + ERROR);
+			}
+		}
+		return valid;
+	}
 
-    public boolean validateConfiguration() throws Exception {
-        String managixHome = System.getenv(InstallerDriver.ENV_MANAGIX_HOME);
-        File configFile = new File(managixHome + File.separator + InstallerDriver.MANAGIX_CONF_XML);
-        JAXBContext configCtx = JAXBContext.newInstance(Configuration.class);
-        Unmarshaller unmarshaller = configCtx.createUnmarshaller();
-        Configuration conf = (Configuration) unmarshaller.unmarshal(configFile);
-        return validateZookeeperConfiguration(conf);
-    }
+	private boolean checkTemporaryPath(String logdir) {
+		return logdir.startsWith("/tmp/");
 
-    private boolean validateZookeeperConfiguration(Configuration conf) throws Exception {
-        boolean valid = true;
-        Zookeeper zk = conf.getZookeeper();
+	}
 
-        if (zk.getHomeDir() == null || zk.getHomeDir().length() == 0) {
-            valid = false;
-            LOGGER.fatal("Zookeeper home dir not configured" + ERROR);
-        } else if (checkTemporaryPath(zk.getHomeDir())) {
-            LOGGER.warn("Zookeeper home dir is subject to be cleaned up by OS" + WARNING);
-        }
+	public boolean validateConfiguration() throws Exception {
+		String managixHome = System.getenv(InstallerDriver.ENV_MANAGIX_HOME);
+		File configFile = new File(managixHome + File.separator
+				+ InstallerDriver.MANAGIX_CONF_XML);
+		JAXBContext configCtx = JAXBContext.newInstance(Configuration.class);
+		Unmarshaller unmarshaller = configCtx.createUnmarshaller();
+		Configuration conf = (Configuration) unmarshaller.unmarshal(configFile);
+		return validateZookeeperConfiguration(conf);
+	}
 
-        if (zk.getServers().getServer().isEmpty()) {
-            valid = false;
-            LOGGER.fatal("Zookeeper servers not configured" + ERROR);
-        }
+	private boolean validateZookeeperConfiguration(Configuration conf)
+			throws Exception {
+		boolean valid = true;
+		Zookeeper zk = conf.getZookeeper();
 
-        boolean validEnsemble = true;
-        for (String server : zk.getServers().getServer()) {
-            validEnsemble = validEnsemble && checkNodeReachability(server);
-        }
+		if (zk.getHomeDir() == null || zk.getHomeDir().length() == 0) {
+			valid = false;
+			LOGGER.fatal("Zookeeper home dir not configured" + ERROR);
+		} else if (checkTemporaryPath(zk.getHomeDir())) {
+			LOGGER.warn("Zookeeper home dir is subject to be cleaned up by OS"
+					+ WARNING);
+		}
 
-        return valid;
-    }
+		if (zk.getServers().getServer().isEmpty()) {
+			valid = false;
+			LOGGER.fatal("Zookeeper servers not configured" + ERROR);
+		}
 
-    private boolean checkNodeReachability(String server) {
-        boolean reachable = true;
-        try {
-            InetAddress address = InetAddress.getByName(server);
-            if (!address.isReachable(1000)) {
-                LOGGER.fatal("\n" + "Server: " + server + " unreachable" + ERROR);
-                reachable = false;
-            }
-        } catch (Exception e) {
-            reachable = false;
-            LOGGER.fatal("\n" + "Server: " + server + " Invalid address" + ERROR);
-        }
-        return reachable;
-    }
+		boolean validEnsemble = true;
+		for (String server : zk.getServers().getServer()) {
+			validEnsemble = validEnsemble && checkNodeReachability(server);
+		}
+
+		return valid;
+	}
+
+	private boolean checkNodeReachability(String server) {
+		boolean reachable = true;
+		try {
+			InetAddress address = InetAddress.getByName(server);
+			if (!address.isReachable(1000)) {
+				LOGGER.fatal("\n" + "Server: " + server + " unreachable"
+						+ ERROR);
+				reachable = false;
+			}
+		} catch (Exception e) {
+			reachable = false;
+			LOGGER.fatal("\n" + "Server: " + server + " Invalid address"
+					+ ERROR);
+		}
+		return reachable;
+	}
 
 }
 
 class ValidateConfig extends AbstractCommandConfig {
 
-    @Option(name = "-c", required = false, usage = "Path to the cluster configuration xml")
-    public String cluster;
+	@Option(name = "-c", required = false, usage = "Path to the cluster configuration xml")
+	public String cluster;
 
 }
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 bd8568f..321fd1a 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
@@ -24,7 +24,6 @@
 import org.apache.log4j.Logger;
 
 import edu.uci.ics.asterix.installer.command.CommandHandler;
-import edu.uci.ics.asterix.installer.command.ICommand.CommandType;
 import edu.uci.ics.asterix.installer.schema.conf.Configuration;
 import edu.uci.ics.asterix.installer.service.ILookupService;
 import edu.uci.ics.asterix.installer.service.ServiceProvider;
@@ -39,8 +38,8 @@
     public static final String EVENTS_DIR = "events";
 
     private static final Logger LOGGER = Logger.getLogger(InstallerDriver.class.getName());
-    public static final String ENV_MANAGIX_HOME = "INSTALLER_HOME";
-    public static final String MANAGIX_CONF_XML = "conf" + File.separator + "installer-conf.xml";
+    public static final String ENV_MANAGIX_HOME = "MANAGIX_HOME";
+    public static final String MANAGIX_CONF_XML = "conf" + File.separator + "managix-conf.xml";
 
     private static Configuration conf;
     private static String managixHome;
@@ -110,7 +109,7 @@
             LOGGER.error("Unknown command");
             printUsage();
         } catch (Exception e) {
-            LOGGER.error(e);
+            LOGGER.error(e.getMessage());
         }
     }
 
@@ -128,6 +127,10 @@
         buffer.append("configure" + ":" + " Auto-generate configuration for local psedu-distributed Asterix instance"
                 + "\n");
         buffer.append("shutdown " + ":" + " Shutdown the installer service" + "\n");
+        buffer.append("validate " + ":" + " Validates the installer/cluster configuration" + "\n");
+        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 1007c01..24b531a 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
@@ -81,12 +81,58 @@
 
     }
 
+    public static void addLibraryToAsterixZip(AsterixInstance asterixInstance, String dataverseName,
+            String libraryName, String libraryPath) throws IOException {
+        File instanceDir = new File(InstallerDriver.getAsterixDir() + File.separator + asterixInstance.getName());
+        if (!instanceDir.exists()) {
+            instanceDir.mkdirs();
+        }
+        String asterixZipName = InstallerDriver.getAsterixZip().substring(
+                InstallerDriver.getAsterixZip().lastIndexOf(File.separator) + 1);
+
+        String sourceZip = instanceDir.getAbsolutePath() + File.separator + asterixZipName;
+        unzip(sourceZip, instanceDir.getAbsolutePath());
+        File libraryPathInZip = new File(instanceDir.getAbsolutePath() + File.separator + "external" + File.separator
+                + "library" + dataverseName + File.separator + "to-add" + File.separator + libraryName);
+        libraryPathInZip.mkdirs();
+        Runtime.getRuntime().exec("cp" + " " + libraryPath + " " + libraryPathInZip.getAbsolutePath());
+        Runtime.getRuntime().exec("rm " + sourceZip);
+        String destZip = InstallerDriver.getAsterixDir() + File.separator + asterixInstance.getName() + File.separator
+                + asterixZipName;
+        zipDir(instanceDir, new File(destZip));
+        Runtime.getRuntime().exec("mv" + " " + destZip + " " + sourceZip);
+    }
+
     private static Node getMetadataNode(Cluster cluster) {
         Random random = new Random();
         int nNodes = cluster.getNode().size();
         return cluster.getNode().get(random.nextInt(nNodes));
     }
 
+    public static String getNodeDirectories(String asterixInstanceName, Node node, Cluster cluster) {
+        String storeDataSubDir = asterixInstanceName + File.separator + "data" + File.separator;
+        String storeLibrarySubDir = asterixInstanceName + File.separator + "library" + File.separator;
+        String[] storeDirs = null;
+        StringBuffer nodeDataStore = new StringBuffer();
+        String storeDirValue = node.getStore();
+        if (storeDirValue == null) {
+            storeDirValue = cluster.getStore();
+            if (storeDirValue == null) {
+                throw new IllegalStateException(" Store not defined for node " + node.getId());
+            }
+            storeDataSubDir = node.getId() + File.separator + storeDataSubDir;
+            storeLibrarySubDir = node.getId() + File.separator + storeLibrarySubDir;
+        }
+
+        storeDirs = storeDirValue.split(",");
+        for (String ns : storeDirs) {
+            nodeDataStore.append(ns + File.separator + storeDataSubDir.trim());
+            nodeDataStore.append(",");
+        }
+        nodeDataStore.deleteCharAt(nodeDataStore.length() - 1);
+        return nodeDataStore.toString();
+    }
+
     private static void writeAsterixConfigurationFile(AsterixInstance asterixInstance, boolean newData)
             throws IOException {
         String asterixInstanceName = asterixInstance.getName();
@@ -98,30 +144,8 @@
         conf.append("NewUniverse=" + newData + "\n");
 
         for (Node node : cluster.getNode()) {
-            StringBuffer nodeDataStore = new StringBuffer();
-            if (node.getStore() != null) {
-                String[] nodeStores = node.getStore().split(",");
-                for (String ns : nodeStores) {
-                    nodeDataStore.append(ns + File.separator + asterixInstanceName + File.separator);
-                    nodeDataStore.append(",");
-                }
-                nodeDataStore.deleteCharAt(nodeDataStore.length() - 1);
-            } else {
-                if (cluster.getStore() != null) {
-                    String[] nodeStores = cluster.getStore().split(",");
-                    for (String ns : nodeStores) {
-                        nodeDataStore.append(ns + File.separator + node.getId() + File.separator + asterixInstanceName
-                                + File.separator);
-                        nodeDataStore.append(",");
-                    }
-                    nodeDataStore.deleteCharAt(nodeDataStore.length() - 1);
-                }
-            }
-            if (nodeDataStore.length() == 0) {
-                throw new IllegalStateException(" Store not defined for node " + node.getId());
-            }
-            conf.append(asterixInstanceName + "_" + node.getId() + ".stores" + "=" + nodeDataStore + "\n");
-
+            String nodeDir = getNodeDirectories(asterixInstance.getName(), node, cluster);
+            conf.append(asterixInstanceName + "_" + node.getId() + ".stores" + "=" + nodeDir + "\n");
         }
         Properties asterixConfProp = asterixInstance.getConfiguration();
         String outputDir = asterixConfProp.getProperty("output_dir");
@@ -251,7 +275,7 @@
             throws Exception {
         AsterixInstance instance = ServiceProvider.INSTANCE.getLookupService().getAsterixInstance(name);
         if (instance == null) {
-            throw new InstallerException(" Asterix instance by name " + name + " does not exist.");
+            throw new InstallerException("Asterix instance by name " + name + " does not exist.");
         }
         boolean valid = false;
         for (State state : permissibleStates) {
@@ -261,7 +285,7 @@
             }
         }
         if (!valid) {
-            throw new InstallerException(" Asterix instance by the name " + name + " is in " + instance.getState()
+            throw new InstallerException("Asterix instance by the name " + name + " is in " + instance.getState()
                     + " state ");
         }
         return instance;
@@ -270,7 +294,7 @@
     public static void validateAsterixInstanceNotExists(String name) throws Exception {
         AsterixInstance instance = ServiceProvider.INSTANCE.getLookupService().getAsterixInstance(name);
         if (instance != null) {
-            throw new InstallerException(" Asterix instance by name " + name + " already exists.");
+            throw new InstallerException("Asterix instance by name " + name + " already exists.");
         }
     }
 
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 16b86df..4699402 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
@@ -40,19 +40,18 @@
         switch (eventType) {
             case FILE_TRANSFER:
                 if (trimmedOutput.length() > 0) {
-                    if (!output.contains("Permission denied") || output.contains("does not exist")
-                            || output.contains("File exist")) {
-                        ignore = true;
-                    } else {
+                    if (output.contains("Permission denied") || output.contains("cannot find or open")) {
                         ignore = false;
+                        break;
                     }
                 }
                 break;
 
             case BACKUP:
+            case RESTORE:
                 if (trimmedOutput.length() > 0) {
                     if (trimmedOutput.contains("AccessControlException")) {
-                        errorMessage.append("Insufficient permissions on HDFS back up directory");
+                        errorMessage.append("Insufficient permissions on back up directory");
                         ignore = false;
                     }
                     if (output.contains("does not exist") || output.contains("File exist")
@@ -64,42 +63,19 @@
                 }
                 break;
 
-            case RESTORE:
-                if (trimmedOutput.length() > 0) {
-                    if (trimmedOutput.contains("AccessControlException")) {
-                        errorMessage.append("Insufficient permissions on HDFS back up directory");
-                        ignore = false;
-                    }
-                    if (output.contains("does not exist") || output.contains("File exist")
-                            || output.contains("No such file or directory")) {
-                        ignore = true;
-                    } else {
-                        ignore = false;
-                    }
-                }
-                break;
-
-            case ASTERIX_DEPLOY:
-                if (trimmedOutput.length() > 0) {
-                    if (trimmedOutput.contains("Exception")) {
-                        ignore = false;
-                        errorMessage.append("Error in deploying Asterix: " + output);
-                        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) {
+                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")) {
+                } else if (!javaVersion.contains("1.7")) {
                     errorMessage.append("Asterix requires Java 1.7.x. Incompatible version found on  "
-                            + event.getNodeid().getValue().getAbsvalue());
+                            + event.getNodeid().getValue().getAbsvalue() + "\n");
                     ignore = false;
                 }
                 break;
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 1217c0b..46b909c 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
@@ -16,7 +16,9 @@
 
 import java.io.File;
 import java.util.ArrayList;
+import java.util.HashSet;
 import java.util.List;
+import java.util.Set;
 
 import edu.uci.ics.asterix.event.driver.EventDriver;
 import edu.uci.ics.asterix.event.schema.cluster.Cluster;
@@ -266,18 +268,43 @@
         List<Pattern> patternList = new ArrayList<Pattern>();
         patternList.addAll(createRemoveAsterixStoragePattern(instance).getPattern());
         if (instance.getBackupInfo() != null && instance.getBackupInfo().size() > 0) {
-            patternList.addAll(createRemoveHDFSBackupPattern(instance).getPattern());
+            List<BackupInfo> backups = instance.getBackupInfo();
+            Set<String> removedBackupDirsHDFS = new HashSet<String>();
+            Set<String> removedBackupDirsLocal = new HashSet<String>();
+
+            String backupDir;
+            for (BackupInfo binfo : backups) {
+                backupDir = binfo.getBackupConf().getBackupDir();
+                switch (binfo.getBackupType()) {
+                    case HDFS:
+                        if (removedBackupDirsHDFS.contains(backups)) {
+                            continue;
+                        }
+                        patternList.addAll(createRemoveHDFSBackupPattern(instance, backupDir).getPattern());
+                        removedBackupDirsHDFS.add(backupDir);
+                        break;
+
+                    case LOCAL:
+                        if (removedBackupDirsLocal.contains(backups)) {
+                            continue;
+                        }
+                        patternList.addAll(createRemoveLocalBackupPattern(instance, backupDir).getPattern());
+                        removedBackupDirsLocal.add(backupDir);
+                        break;
+                }
+
+            }
         }
+        patternList.addAll(createRemoveAsterixLogDirPattern(instance).getPattern());
         Patterns patterns = new Patterns(patternList);
         return patterns;
     }
 
-    private Patterns createRemoveHDFSBackupPattern(AsterixInstance instance) throws Exception {
+    private Patterns createRemoveHDFSBackupPattern(AsterixInstance instance, String hdfsBackupDir) throws Exception {
         List<Pattern> patternList = new ArrayList<Pattern>();
         Cluster cluster = instance.getCluster();
         String hdfsUrl = InstallerDriver.getConfiguration().getBackup().getHdfs().getUrl();
         String hadoopVersion = InstallerDriver.getConfiguration().getBackup().getHdfs().getVersion();
-        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()));
@@ -289,6 +316,66 @@
         return patterns;
     }
 
+    private Patterns createRemoveLocalBackupPattern(AsterixInstance instance, String localBackupDir) throws Exception {
+        List<Pattern> patternList = new ArrayList<Pattern>();
+        Cluster cluster = instance.getCluster();
+
+        String pathToDelete = localBackupDir + File.separator + instance.getName();
+        String pargs = pathToDelete;
+        List<String> removedBackupDirs = new ArrayList<String>();
+        for (Node node : cluster.getNode()) {
+            if (removedBackupDirs.contains(node.getIp())) {
+                continue;
+            }
+            Nodeid nodeid = new Nodeid(new Value(null, node.getId()));
+            Event event = new Event("file_delete", nodeid, pargs);
+            patternList.add(new Pattern(null, 1, null, event));
+            removedBackupDirs.add(node.getIp());
+        }
+
+        Patterns patterns = new Patterns(patternList);
+        return patterns;
+    }
+
+    public Patterns createRemoveAsterixWorkingDirPattern(AsterixInstance instance) throws Exception {
+        List<Pattern> patternList = new ArrayList<Pattern>();
+        Cluster cluster = instance.getCluster();
+        String workingDir = cluster.getWorkingDir().getDir();
+        String pargs = workingDir;
+        Nodeid nodeid = new Nodeid(new Value(null, cluster.getMasterNode().getId()));
+        Event event = new Event("file_delete", nodeid, pargs);
+        patternList.add(new Pattern(null, 1, null, event));
+
+        if (!cluster.getWorkingDir().isNFS()) {
+            for (Node node : cluster.getNode()) {
+                nodeid = new Nodeid(new Value(null, node.getId()));
+                event = new Event("file_delete", nodeid, pargs);
+                patternList.add(new Pattern(null, 1, null, event));
+            }
+        }
+        Patterns patterns = new Patterns(patternList);
+        return patterns;
+    }
+
+    private Patterns createRemoveAsterixLogDirPattern(AsterixInstance instance) throws Exception {
+        List<Pattern> patternList = new ArrayList<Pattern>();
+        Cluster cluster = instance.getCluster();
+        String pargs = instance.getCluster().getLogdir();
+        Nodeid nodeid = new Nodeid(new Value(null, cluster.getMasterNode().getId()));
+        Event event = new Event("file_delete", nodeid, pargs);
+        patternList.add(new Pattern(null, 1, null, event));
+
+        if (!cluster.getWorkingDir().isNFS()) {
+            for (Node node : cluster.getNode()) {
+                nodeid = new Nodeid(new Value(null, node.getId()));
+                event = new Event("file_delete", nodeid, pargs);
+                patternList.add(new Pattern(null, 1, null, event));
+            }
+        }
+        Patterns patterns = new Patterns(patternList);
+        return patterns;
+    }
+
     private Patterns createRemoveAsterixStoragePattern(AsterixInstance instance) throws Exception {
         List<Pattern> patternList = new ArrayList<Pattern>();
         Cluster cluster = instance.getCluster();
@@ -320,8 +407,8 @@
         String username = cluster.getUsername() != null ? cluster.getUsername() : System.getProperty("user.name");
         String asterixZipName = InstallerDriver.getAsterixZip().substring(
                 InstallerDriver.getAsterixZip().lastIndexOf(File.separator) + 1);
-        String fileToTransfer = InstallerDriver.getAsterixDir() + File.separator + instanceName + File.separator
-                + asterixZipName;
+        String fileToTransfer = new File(InstallerDriver.getAsterixDir() + File.separator + instanceName
+                + File.separator + asterixZipName).getAbsolutePath();
         String pargs = username + " " + fileToTransfer + " " + destinationIp + " " + destDir + " " + "unpack";
         Event event = new Event("file_transfer", nodeid, pargs);
         return new Pattern(null, 1, null, event);
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 b0a7501..d3ba758 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
@@ -18,7 +18,6 @@
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
-import java.util.Map.Entry;
 import java.util.Properties;
 
 import edu.uci.ics.asterix.event.schema.cluster.Cluster;
@@ -161,7 +160,6 @@
             buffer.append(node.getId() + ":" + node.getIp() + "\n");
         }
 
-        buffer.append("\n");
         if (backupInfo != null && backupInfo.size() > 0) {
             for (BackupInfo info : backupInfo) {
                 buffer.append(info + "\n");
@@ -169,10 +167,6 @@
         }
         buffer.append("\n");
         buffer.append("Asterix version:" + asterixVersion + "\n");
-        buffer.append("Asterix Configuration" + "\n");
-        for (Entry<Object, Object> entry : configuration.entrySet()) {
-            buffer.append(entry.getKey() + " = " + entry.getValue() + "\n");
-        }
         buffer.append("Metadata Node:" + metadataNodeId + "\n");
         buffer.append("Processes" + "\n");
         for (ProcessInfo pInfo : runtimeState.getProcesses()) {
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 8ab6adc..b605889 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
@@ -21,12 +21,12 @@
         NODE_FAILURE,
         CC_START,
         CC_FAILURE,
-        ASTERIX_DEPLOY,
         BACKUP,
         RESTORE,
         FILE_DELETE,
         HDFS_DELETE,
         FILE_TRANSFER,
+        FILE_CREATE,
         DIRECTORY_TRANSFER,
         NODE_INFO
     }
diff --git a/asterix-installer/src/main/resources/clusters/local/local.xml b/asterix-installer/src/main/resources/clusters/local/local.xml
index 827b3fa..1413999 100644
--- a/asterix-installer/src/main/resources/clusters/local/local.xml
+++ b/asterix-installer/src/main/resources/clusters/local/local.xml
@@ -17,8 +17,4 @@
      <id>node1</id>
      <ip>127.0.0.1</ip>
   </node>
-  <node>
-     <id>node2</id>
-     <ip>127.0.0.1</ip>
-  </node>
 </cluster>
diff --git a/asterix-installer/src/main/resources/conf/installer-conf.xml b/asterix-installer/src/main/resources/conf/managix-conf.xml
similarity index 100%
rename from asterix-installer/src/main/resources/conf/installer-conf.xml
rename to asterix-installer/src/main/resources/conf/managix-conf.xml
diff --git a/asterix-installer/src/main/resources/scripts/managix b/asterix-installer/src/main/resources/scripts/managix
index 11810ef..cd0794e 100755
--- a/asterix-installer/src/main/resources/scripts/managix
+++ b/asterix-installer/src/main/resources/scripts/managix
@@ -1,20 +1,20 @@
-if [ -z $INSTALLER_HOME ] 
+if [ -z $MANAGIX_HOME ] 
  then
-   echo "INSTALLER_HOME is not defined"
+   echo "MANAGIX_HOME is not defined"
    exit 1
 fi
 
 VERSION=0.0.4-SNAPSHOT
 
-for jar in `ls $INSTALLER_HOME/lib/*.jar`
+for jar in `ls $MANAGIX_HOME/lib/*.jar`
   do 
-  if [ -z $INSTALLER_CLASSPATH ] 
+  if [ -z $MANAGIX_CLASSPATH ] 
   then 
-    INSTALLER_CLASSPATH=$jar 
+    MANAGIX_CLASSPATH=$jar 
   else
-    INSTALLER_CLASSPATH=$INSTALLER_CLASSPATH:$jar 
+    MANAGIX_CLASSPATH=$MANAGIX_CLASSPATH:$jar 
   fi
 done
 
-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 $@
+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 $@
diff --git a/asterix-installer/src/main/resources/zookeeper/zk.init b/asterix-installer/src/main/resources/zookeeper/zk.init
index 7aa7c10..937d8b3 100755
--- a/asterix-installer/src/main/resources/zookeeper/zk.init
+++ b/asterix-installer/src/main/resources/zookeeper/zk.init
@@ -1,6 +1,6 @@
 ZK_HOME=$1
 shift 1
-cd $INSTALLER_HOME/.installer/zookeeper
+cd $MANAGIX_HOME/.installer/zookeeper
 tar cf zk.pkg.tar *
 zk_server_id=1
 for zk_host in  $@