merging from asterix_installer_ioc_udfs to bring in the functionality of taking backup on local fs

git-svn-id: https://asterixdb.googlecode.com/svn/branches/asterix_stabilization_ioc_installer@1335 eaa15691-b419-025a-1212-ee371bd00084
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..177ada5 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;
@@ -54,6 +55,9 @@
         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);
@@ -65,6 +69,7 @@
         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();
@@ -77,7 +82,6 @@
         InstallerUtil.deleteDirectory(InstallerDriver.getManagixHome() + File.separator + InstallerDriver.ASTERIX_DIR
                 + File.separator + asterixInstanceName);
         LOGGER.info(asterixInstance.getDescription(false));
-
     }
 
     @Override
@@ -101,6 +105,7 @@
                 + "\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 {
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..d32284a 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
@@ -35,7 +35,7 @@
         Patterns patterns = pc.createDeleteInstancePattern(instance);
         InstallerUtil.getEventrixClient(instance.getCluster()).submit(patterns);
         ServiceProvider.INSTANCE.getLookupService().removeAsterixInstance(asterixInstanceName);
-        LOGGER.info(" Asterix instance: " + asterixInstanceName + " deleted");
+        LOGGER.info("Deleted Asterix instance: " + asterixInstanceName);
     }
 
     @Override
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/driver/InstallerDriver.java b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/driver/InstallerDriver.java
index bd8568f..6cfa355 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,7 +38,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 = "INSTALLER_HOME";
+    public static final String ENV_MANAGIX_HOME = "MANAGIX_HOME";
     public static final String MANAGIX_CONF_XML = "conf" + File.separator + "installer-conf.xml";
 
     private static Configuration conf;
@@ -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..3fa42bd 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,29 +63,6 @@
                 }
                 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 {
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..0f51225 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,44 @@
         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(createRemoveAsterixWorkingDirPattern(instance).getPattern());
+        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 +317,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;
+    }
+
+    private 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 +408,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/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 $@