1) Fix for issue 335:Managix does not delete transaction log directory
2) Minor change in toString method for AsterixInstance.
3) Fixed validation script validate_ssh.sh 


git-svn-id: https://asterixdb.googlecode.com/svn/branches/asterix_lsm_stabilization@1735 eaa15691-b419-025a-1212-ee371bd00084
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 7612ca2..0d50bbf 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
@@ -304,6 +304,26 @@
         }
         patternList.addAll(createRemoveAsterixLogDirPattern(instance).getPattern());
         patternList.addAll(createRemoveAsterixRootMetadata(instance).getPattern());
+        patternList.addAll(createRemoveAsterixTxnLogs(instance).getPattern());
+        Patterns patterns = new Patterns(patternList);
+        return patterns;
+    }
+
+    private Patterns createRemoveAsterixTxnLogs(AsterixInstance instance) throws Exception {
+        List<Pattern> patternList = new ArrayList<Pattern>();
+        Cluster cluster = instance.getCluster();
+        Nodeid nodeid = null;
+        String pargs = null;
+        Event event = null;
+        for (Node node : cluster.getNode()) {
+            String iodevices = node.getIodevices() == null ? cluster.getIodevices() : node.getIodevices();
+            String primaryIODevice = iodevices.split(",")[0].trim();
+            pargs = primaryIODevice + File.separator + InstallerUtil.TXN_LOG_DIR;
+            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;
     }
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 9f8b28d..9a2d43d 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
@@ -25,159 +25,158 @@
 
 public class AsterixInstance implements Serializable {
 
-	private static final long serialVersionUID = 2874439550187520449L;
+    private static final long serialVersionUID = 2874439550187520449L;
 
-	public enum State {
-		ACTIVE, INACTIVE, UNUSABLE
-	}
+    public enum State {
+        ACTIVE,
+        INACTIVE,
+        UNUSABLE
+    }
 
-	private final Cluster cluster;
-	private final String name;
-	private final Date createdTimestamp;
-	private Date stateChangeTimestamp;
-	private Date modifiedTimestamp;
-	private Properties configuration;
-	private State state;
-	private final String metadataNodeId;
-	private final String asterixVersion;
-	private final List<BackupInfo> backupInfo;
-	private final String webInterfaceUrl;
-	private AsterixRuntimeState runtimeState;
-	private State previousState;
+    private final Cluster cluster;
+    private final String name;
+    private final Date createdTimestamp;
+    private Date stateChangeTimestamp;
+    private Date modifiedTimestamp;
+    private Properties configuration;
+    private State state;
+    private final String metadataNodeId;
+    private final String asterixVersion;
+    private final List<BackupInfo> backupInfo;
+    private final String webInterfaceUrl;
+    private AsterixRuntimeState runtimeState;
+    private State previousState;
 
-	public AsterixInstance(String name, Cluster cluster,
-			Properties configuration, String metadataNodeId,
-			String asterixVersion) {
-		this.name = name;
-		this.cluster = cluster;
-		this.configuration = configuration;
-		this.metadataNodeId = metadataNodeId;
-		this.state = State.ACTIVE;
-		this.previousState = State.UNUSABLE;
-		this.asterixVersion = asterixVersion;
-		this.createdTimestamp = new Date();
-		this.backupInfo = new ArrayList<BackupInfo>();
-		this.webInterfaceUrl = "http://"
-				+ cluster.getMasterNode().getClusterIp() + ":" + 19001;
-	}
+    public AsterixInstance(String name, Cluster cluster, Properties configuration, String metadataNodeId,
+            String asterixVersion) {
+        this.name = name;
+        this.cluster = cluster;
+        this.configuration = configuration;
+        this.metadataNodeId = metadataNodeId;
+        this.state = State.ACTIVE;
+        this.previousState = State.UNUSABLE;
+        this.asterixVersion = asterixVersion;
+        this.createdTimestamp = new Date();
+        this.backupInfo = new ArrayList<BackupInfo>();
+        this.webInterfaceUrl = "http://" + cluster.getMasterNode().getClientIp() + ":" + 19001;
+    }
 
-	public Date getModifiedTimestamp() {
-		return stateChangeTimestamp;
-	}
+    public Date getModifiedTimestamp() {
+        return stateChangeTimestamp;
+    }
 
-	public Properties getConfiguration() {
-		return configuration;
-	}
+    public Properties getConfiguration() {
+        return configuration;
+    }
 
-	public void setConfiguration(Properties properties) {
-		this.configuration = properties;
-	}
+    public void setConfiguration(Properties properties) {
+        this.configuration = properties;
+    }
 
-	public State getState() {
-		return state;
-	}
+    public State getState() {
+        return state;
+    }
 
-	public void setState(State state) {
-		this.previousState = this.state;
-		this.state = state;
-	}
+    public void setState(State state) {
+        this.previousState = this.state;
+        this.state = state;
+    }
 
-	public Cluster getCluster() {
-		return cluster;
-	}
+    public Cluster getCluster() {
+        return cluster;
+    }
 
-	public String getName() {
-		return name;
-	}
+    public String getName() {
+        return name;
+    }
 
-	public Date getCreatedTimestamp() {
-		return createdTimestamp;
-	}
+    public Date getCreatedTimestamp() {
+        return createdTimestamp;
+    }
 
-	public Date getStateChangeTimestamp() {
-		return stateChangeTimestamp;
-	}
+    public Date getStateChangeTimestamp() {
+        return stateChangeTimestamp;
+    }
 
-	public void setStateChangeTimestamp(Date stateChangeTimestamp) {
-		this.stateChangeTimestamp = stateChangeTimestamp;
-	}
+    public void setStateChangeTimestamp(Date stateChangeTimestamp) {
+        this.stateChangeTimestamp = stateChangeTimestamp;
+    }
 
-	public void setModifiedTimestamp(Date modifiedTimestamp) {
-		this.modifiedTimestamp = modifiedTimestamp;
-	}
+    public void setModifiedTimestamp(Date modifiedTimestamp) {
+        this.modifiedTimestamp = modifiedTimestamp;
+    }
 
-	public String getMetadataNodeId() {
-		return metadataNodeId;
-	}
+    public String getMetadataNodeId() {
+        return metadataNodeId;
+    }
 
-	public String getAsterixVersion() {
-		return asterixVersion;
-	}
+    public String getAsterixVersion() {
+        return asterixVersion;
+    }
 
-	public String getDescription(boolean detailed) {
-		StringBuffer buffer = new StringBuffer();
-		buffer.append("Name:" + name + "\n");
-		buffer.append("Created:" + createdTimestamp + "\n");
-		buffer.append("Web-Url:" + webInterfaceUrl + "\n");
-		buffer.append("State:" + state);
-		if (!state.equals(State.UNUSABLE) && stateChangeTimestamp != null) {
-			buffer.append(" (" + stateChangeTimestamp + ")" + "\n");
-		} else {
-			buffer.append("\n");
-		}
-		if (modifiedTimestamp != null) {
-			buffer.append("Last modified timestamp:" + modifiedTimestamp + "\n");
-		}
+    public String getDescription(boolean detailed) {
+        StringBuffer buffer = new StringBuffer();
+        buffer.append("Name:" + name + "\n");
+        buffer.append("Created:" + createdTimestamp + "\n");
+        buffer.append("Web-Url:" + webInterfaceUrl + "\n");
+        buffer.append("State:" + state);
+        if (!state.equals(State.UNUSABLE) && stateChangeTimestamp != null) {
+            buffer.append(" (" + stateChangeTimestamp + ")" + "\n");
+        } else {
+            buffer.append("\n");
+        }
+        if (modifiedTimestamp != null) {
+            buffer.append("Last modified timestamp:" + modifiedTimestamp + "\n");
+        }
 
-		if (runtimeState.getSummary() != null
-				&& runtimeState.getSummary().length() > 0) {
-			buffer.append("\nWARNING!:" + runtimeState.getSummary() + "\n");
-		}
-		if (detailed) {
-			addDetailedInformation(buffer);
-		}
-		return buffer.toString();
-	}
+        if (runtimeState.getSummary() != null && runtimeState.getSummary().length() > 0) {
+            buffer.append("\nWARNING!:" + runtimeState.getSummary() + "\n");
+        }
+        if (detailed) {
+            addDetailedInformation(buffer);
+        }
+        return buffer.toString();
+    }
 
-	public List<BackupInfo> getBackupInfo() {
-		return backupInfo;
-	}
+    public List<BackupInfo> getBackupInfo() {
+        return backupInfo;
+    }
 
-	public String getWebInterfaceUrl() {
-		return webInterfaceUrl;
-	}
+    public String getWebInterfaceUrl() {
+        return webInterfaceUrl;
+    }
 
-	public AsterixRuntimeState getAsterixRuntimeState() {
-		return runtimeState;
-	}
+    public AsterixRuntimeState getAsterixRuntimeState() {
+        return runtimeState;
+    }
 
-	public void setAsterixRuntimeStates(AsterixRuntimeState runtimeState) {
-		this.runtimeState = runtimeState;
-	}
+    public void setAsterixRuntimeStates(AsterixRuntimeState runtimeState) {
+        this.runtimeState = runtimeState;
+    }
 
-	private void addDetailedInformation(StringBuffer buffer) {
-		buffer.append("Master node:" + cluster.getMasterNode().getId() + ":"
-				+ cluster.getMasterNode().getClusterIp() + "\n");
-		for (Node node : cluster.getNode()) {
-			buffer.append(node.getId() + ":" + node.getClusterIp() + "\n");
-		}
+    private void addDetailedInformation(StringBuffer buffer) {
+        buffer.append("Master node:" + cluster.getMasterNode().getId() + ":" + cluster.getMasterNode().getClusterIp()
+                + "\n");
+        for (Node node : cluster.getNode()) {
+            buffer.append(node.getId() + ":" + node.getClusterIp() + "\n");
+        }
 
-		if (backupInfo != null && backupInfo.size() > 0) {
-			for (BackupInfo info : backupInfo) {
-				buffer.append(info + "\n");
-			}
-		}
-		buffer.append("\n");
-		buffer.append("Asterix version:" + asterixVersion + "\n");
-		buffer.append("Metadata Node:" + metadataNodeId + "\n");
-		buffer.append("Processes" + "\n");
-		for (ProcessInfo pInfo : runtimeState.getProcesses()) {
-			buffer.append(pInfo + "\n");
-		}
+        if (backupInfo != null && backupInfo.size() > 0) {
+            for (BackupInfo info : backupInfo) {
+                buffer.append(info + "\n");
+            }
+        }
+        buffer.append("\n");
+        buffer.append("Asterix version:" + asterixVersion + "\n");
+        buffer.append("Metadata Node:" + metadataNodeId + "\n");
+        buffer.append("Processes" + "\n");
+        for (ProcessInfo pInfo : runtimeState.getProcesses()) {
+            buffer.append(pInfo + "\n");
+        }
 
-	}
+    }
 
-	public State getPreviousState() {
-		return previousState;
-	}
+    public State getPreviousState() {
+        return previousState;
+    }
 }
diff --git a/asterix-installer/src/main/resources/scripts/validate_ssh.sh b/asterix-installer/src/main/resources/scripts/validate_ssh.sh
index f6dfed9..de6d79c 100755
--- a/asterix-installer/src/main/resources/scripts/validate_ssh.sh
+++ b/asterix-installer/src/main/resources/scripts/validate_ssh.sh
@@ -1,7 +1,7 @@
 USERNAME=$1
 shift 1
 numargs=$#
-for ((i=1 ; i <= numargs ; i=i+2))
+for ((i=1 ; i <= numargs ; i=i+1))
 do
  host=$1
  ssh -l $USERNAME -oNumberOfPasswordPrompts=0 $host "echo $host"