[Swift-commit] r5823 - in trunk/src/org/griphyn/vdl/karajan/monitor: . items monitors monitors/ansi monitors/ansi/tui monitors/swing processors

hategan at ci.uchicago.edu hategan at ci.uchicago.edu
Sat Jul 7 19:35:53 CDT 2012


Author: hategan
Date: 2012-07-07 19:35:40 -0500 (Sat, 07 Jul 2012)
New Revision: 5823

Added:
   trunk/src/org/griphyn/vdl/karajan/monitor/items/SummaryItem.java
   trunk/src/org/griphyn/vdl/karajan/monitor/monitors/TimelineController.java
   trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/SafeTimerTask.java
   trunk/src/org/griphyn/vdl/karajan/monitor/processors/AbstractMessageProcessor.java
   trunk/src/org/griphyn/vdl/karajan/monitor/processors/AbstractSwiftProcessor.java
   trunk/src/org/griphyn/vdl/karajan/monitor/processors/AppEndProcessor.java
   trunk/src/org/griphyn/vdl/karajan/monitor/processors/AppStartProcessor.java
   trunk/src/org/griphyn/vdl/karajan/monitor/processors/ForeachItEndProcessor.java
   trunk/src/org/griphyn/vdl/karajan/monitor/processors/ForeachItStartProcessor.java
   trunk/src/org/griphyn/vdl/karajan/monitor/processors/ProcedureEndProcessor.java
   trunk/src/org/griphyn/vdl/karajan/monitor/processors/ProcedureStartProcessor.java
   trunk/src/org/griphyn/vdl/karajan/monitor/processors/SummaryProcessor.java
   trunk/src/org/griphyn/vdl/karajan/monitor/processors/SwiftProcessorDispatcher.java
Removed:
   trunk/src/org/griphyn/vdl/karajan/monitor/processors/AppProcessor.java
   trunk/src/org/griphyn/vdl/karajan/monitor/processors/ProcedureProcessor.java
   trunk/src/org/griphyn/vdl/karajan/monitor/processors/TraceProcessor.java
Modified:
   trunk/src/org/griphyn/vdl/karajan/monitor/MonitorAppender.java
   trunk/src/org/griphyn/vdl/karajan/monitor/RadixTree.java
   trunk/src/org/griphyn/vdl/karajan/monitor/StateUpdater.java
   trunk/src/org/griphyn/vdl/karajan/monitor/StatefulItemClassSet.java
   trunk/src/org/griphyn/vdl/karajan/monitor/SystemState.java
   trunk/src/org/griphyn/vdl/karajan/monitor/items/AbstractStatefulItem.java
   trunk/src/org/griphyn/vdl/karajan/monitor/monitors/AbstractMonitor.java
   trunk/src/org/griphyn/vdl/karajan/monitor/monitors/Monitor.java
   trunk/src/org/griphyn/vdl/karajan/monitor/monitors/MonitorFactory.java
   trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/AbstractANSIDisplay.java
   trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/BensModel.java
   trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/GlobalProgress.java
   trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/GlobalTimer.java
   trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/LocalANSIDisplay.java
   trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/STable.java
   trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/SchedulerInfoPane.java
   trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/SummaryPane.java
   trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/TaskStatsPane.java
   trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/tui/ANSI.java
   trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/tui/ANSIContext.java
   trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/tui/Container.java
   trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/tui/Table.java
   trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/tui/TableColumn.java
   trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/tui/VScrollbar.java
   trunk/src/org/griphyn/vdl/karajan/monitor/monitors/swing/ApplicationTable.java
   trunk/src/org/griphyn/vdl/karajan/monitor/monitors/swing/FilteringTaskTable.java
   trunk/src/org/griphyn/vdl/karajan/monitor/monitors/swing/SimpleTableClassRenderer.java
   trunk/src/org/griphyn/vdl/karajan/monitor/monitors/swing/SwingMonitor.java
   trunk/src/org/griphyn/vdl/karajan/monitor/processors/AppThreadProcessor.java
   trunk/src/org/griphyn/vdl/karajan/monitor/processors/ExecutionContextProcessor.java
   trunk/src/org/griphyn/vdl/karajan/monitor/processors/JobProcessor.java
   trunk/src/org/griphyn/vdl/karajan/monitor/processors/LogMessageProcessor.java
   trunk/src/org/griphyn/vdl/karajan/monitor/processors/SchedulerInfoProcessor.java
   trunk/src/org/griphyn/vdl/karajan/monitor/processors/TaskProcessor.java
Log:
updated TUI

Modified: trunk/src/org/griphyn/vdl/karajan/monitor/MonitorAppender.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/monitor/MonitorAppender.java	2012-07-08 00:33:44 UTC (rev 5822)
+++ trunk/src/org/griphyn/vdl/karajan/monitor/MonitorAppender.java	2012-07-08 00:35:40 UTC (rev 5823)
@@ -20,22 +20,33 @@
  */
 package org.griphyn.vdl.karajan.monitor;
 
+import java.util.HashMap;
+import java.util.Map;
+
 import org.apache.log4j.Appender;
 import org.apache.log4j.Layout;
+import org.apache.log4j.Level;
 import org.apache.log4j.Logger;
+import org.apache.log4j.Priority;
 import org.apache.log4j.spi.ErrorHandler;
 import org.apache.log4j.spi.Filter;
 import org.apache.log4j.spi.LoggingEvent;
 import org.griphyn.vdl.karajan.monitor.monitors.Monitor;
 import org.griphyn.vdl.karajan.monitor.monitors.MonitorFactory;
-import org.griphyn.vdl.karajan.monitor.processors.AppProcessor;
+import org.griphyn.vdl.karajan.monitor.processors.AbstractSwiftProcessor;
+import org.griphyn.vdl.karajan.monitor.processors.AppEndProcessor;
+import org.griphyn.vdl.karajan.monitor.processors.AppStartProcessor;
 import org.griphyn.vdl.karajan.monitor.processors.AppThreadProcessor;
 import org.griphyn.vdl.karajan.monitor.processors.ExecutionContextProcessor;
+import org.griphyn.vdl.karajan.monitor.processors.ForeachItEndProcessor;
+import org.griphyn.vdl.karajan.monitor.processors.ForeachItStartProcessor;
 import org.griphyn.vdl.karajan.monitor.processors.JobProcessor;
-import org.griphyn.vdl.karajan.monitor.processors.ProcedureProcessor;
+import org.griphyn.vdl.karajan.monitor.processors.ProcedureEndProcessor;
+import org.griphyn.vdl.karajan.monitor.processors.ProcedureStartProcessor;
 import org.griphyn.vdl.karajan.monitor.processors.SchedulerInfoProcessor;
+import org.griphyn.vdl.karajan.monitor.processors.SummaryProcessor;
+import org.griphyn.vdl.karajan.monitor.processors.SwiftProcessorDispatcher;
 import org.griphyn.vdl.karajan.monitor.processors.TaskProcessor;
-import org.griphyn.vdl.karajan.monitor.processors.TraceProcessor;
 
 public class MonitorAppender implements Appender {
     public static final Logger logger = Logger.getLogger(MonitorAppender.class);
@@ -43,13 +54,17 @@
 	private SystemState state;
 	private StateUpdater updater;
 	private Monitor monitor;
+	
+	public MonitorAppender(String projectName) {
+	    this(projectName, "ANSI");
+	}
 
-	public MonitorAppender(String projectName) {
+	public MonitorAppender(String projectName, String monitorType) {
 		state = new SystemState(projectName);
 		updater = new StateUpdater(state);
         addProcessors(updater);
 		try {
-			monitor = MonitorFactory.newInstance("ANSI");
+			monitor = MonitorFactory.newInstance(monitorType);
             monitor.setState(state);
 		}
 		catch (Exception e) {
@@ -62,17 +77,41 @@
 	}
     
     private void addProcessors(StateUpdater updater) {
-    	updater.addProcessor(new AppProcessor());
+        updater.addProcessor(new SummaryProcessor());
     	updater.addProcessor(new TaskProcessor());
     	updater.addProcessor(new JobProcessor());
-    	updater.addProcessor(new AppThreadProcessor());
     	updater.addProcessor(new SchedulerInfoProcessor());
-    	updater.addProcessor(new ProcedureProcessor());
     	updater.addProcessor(new ExecutionContextProcessor());
-    	updater.addProcessor(new TraceProcessor());
+    	
+    	addSwiftProcessors(updater, 
+    	    new AppStartProcessor(),
+    	    new AppEndProcessor(),
+    	    new AppThreadProcessor(),
+    	    new ProcedureStartProcessor(),
+    	    new ProcedureEndProcessor(),
+    	    new ForeachItStartProcessor(),
+    	    new ForeachItEndProcessor());
     }
 
-	public void addFilter(Filter newFilter) {
+	private void addSwiftProcessors(StateUpdater updater, AbstractSwiftProcessor... ps) {
+	    Map<Priority, SwiftProcessorDispatcher> m = new HashMap<Priority, SwiftProcessorDispatcher>();
+	    
+	    for (AbstractSwiftProcessor p : ps) {
+	        Level l = p.getSupportedLevel();
+	        SwiftProcessorDispatcher d = m.get(l);
+	        if (d == null) {
+	            d = new SwiftProcessorDispatcher(l);
+	            m.put(l, d);
+	        }
+	        d.add(p);
+	    }
+	    
+	    for (SwiftProcessorDispatcher d : m.values()) {
+	        updater.addProcessor(d);
+	    }
+    }
+
+    public void addFilter(Filter newFilter) {
 	}
 
 	public void clearFilters() {
@@ -84,7 +123,7 @@
 
 	public void doAppend(LoggingEvent event) {
         try {
-        	updater.logEvent(event.getLevel(), event.getLocationInformation().getClassName(),
+        	updater.logEvent(event.getLevel(), event.getLogger().getName(),
         			event.getMessage(), event.getThrowableInformation());
         }
         catch (Exception e) {
@@ -120,4 +159,8 @@
 
 	public void setName(String name) {
 	}
+	
+	public Monitor getMonitor() {
+	    return monitor;
+	}
 }

Modified: trunk/src/org/griphyn/vdl/karajan/monitor/RadixTree.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/monitor/RadixTree.java	2012-07-08 00:33:44 UTC (rev 5822)
+++ trunk/src/org/griphyn/vdl/karajan/monitor/RadixTree.java	2012-07-08 00:35:40 UTC (rev 5823)
@@ -21,19 +21,18 @@
 package org.griphyn.vdl.karajan.monitor;
 
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 
-public class RadixTree {
-	private Node root;
+public class RadixTree<T> {
+	private Node<T> root;
 	private int size;
 
 	public RadixTree() {
-		root = new Node(null, null);
+		root = new Node<T>(null, null);
 	}
 
-	public Object put(String key, Object value) {
+	public T put(String key, T value) {
 	    if (key == null) {
 	        throw new IllegalArgumentException("Key is null");
 	    }
@@ -43,11 +42,11 @@
 		return add(root, key, 0, value);
 	}
 	
-	public Object remove(String key) {
+	public T remove(String key) {
 		return remove(root, key, 0);
 	}
 	
-	public Object get(String key) {
+	public T get(String key) {
 		return get(root, key, 0);
 	}
 	
@@ -55,11 +54,9 @@
 		return find(root, key, 0);
 	}
 
-	private Object add(Node n, String key, int pos, Object value) {
+	private T add(Node<T> n, String key, int pos, T value) {
 		if (n.nodes != null) {
-			Iterator i = n.nodes.iterator();
-			while (i.hasNext()) {
-				Node sn = (Node) i.next();
+		    for (Node<T> sn : n.nodes) {
 				String sk = sn.key;
 				if (key.charAt(pos) == sk.charAt(0)) {
 					int j = 1;
@@ -68,7 +65,7 @@
 					}
 					if (j == sk.length()) {
 						if (j + pos == key.length()) {
-							Object old = sn.value;
+							T old = sn.value;
 							sn.value = value;
 							return old;
 						}
@@ -81,11 +78,11 @@
 						String left = sk.substring(j);
 						String right = key.substring(pos + j);
 						sn.key = common;
-						Node ln = new Node(left, sn.value);
+						Node<T> ln = new Node<T>(left, sn.value);
 						ln.nodes = sn.nodes;
 						sn.nodes = null;
 						sn.value = null;
-						Node rn = new Node(right, value);
+						Node<T> rn = new Node<T>(right, value);
 						sn.addNode(ln);
 						sn.addNode(rn);
 						size++;
@@ -94,16 +91,14 @@
 				}
 			}
 		}
-		n.addNode(new Node(key.substring(pos), value));
+		n.addNode(new Node<T>(key.substring(pos), value));
 		size++;
 		return null;
 	}
 	
-	private Object remove(Node n, String key, int pos) {
+	private T remove(Node<T> n, String key, int pos) {
 		if (n.nodes != null) {
-			Iterator i = n.nodes.iterator();
-			while (i.hasNext()) {
-				Node sn = (Node) i.next();
+		    for (Node<T> sn : n.nodes) {
 				String sk = sn.key;
 				if (key.charAt(pos) == sk.charAt(0)) {
 					int j = 1;
@@ -111,7 +106,7 @@
 						j++;
 					}
 					if (j == sk.length()) {
-						Object old;
+						T old;
 						if (j + pos == key.length()) {
 							old = sn.value;
 							size--;
@@ -135,11 +130,9 @@
 		return null;
 	}
 	
-	private Object get(Node n, String key, int pos) {
+	private T get(Node<T> n, String key, int pos) {
 		if (n.nodes != null) {
-			Iterator i = n.nodes.iterator();
-			while (i.hasNext()) {
-				Node sn = (Node) i.next();
+		    for (Node<T> sn : n.nodes) {
 				String sk = sn.key;
 				if (key.charAt(pos) == sk.charAt(0)) {
 					int j = 1;
@@ -163,11 +156,9 @@
 		return null;
 	}
 	
-	private String find(Node n, String key, int pos) {
+	private String find(Node<T> n, String key, int pos) {
 		if (n.nodes != null) {
-			Iterator i = n.nodes.iterator();
-			while (i.hasNext()) {
-				Node sn = (Node) i.next();
+		    for (Node<T> sn : n.nodes) {
 				String sk = sn.key;
 				if (key.charAt(pos) == sk.charAt(0)) {
 					int j = 1;
@@ -195,21 +186,20 @@
 		return size;
 	}
 	
-	public List getAll() {
-		ArrayList l = new ArrayList();
+	public List<T> getAll() {
+		ArrayList<T> l = new ArrayList<T>();
 		traverse(l, root);
 		return l;
 	}
 	
-	private void traverse(List l, Node n) {
+	private void traverse(List<T> l, Node<T> n) {
 		if (n.value != null) {
 			l.add(n.value);
 		}
-		List nodes = n.nodes;
+		List<Node<T>> nodes = n.nodes;
 		if (nodes != null) {
-			Iterator i = nodes.iterator();
-			while (i.hasNext()) {
-				traverse(l, (Node) i.next());
+		    for (Node<T> sn : nodes) {
+				traverse(l, sn);
 			}
 		}
 	}
@@ -220,28 +210,28 @@
 		return sb.toString();
 	}
 	
-	private void toString(StringBuffer sb, Node n) {
+	private void toString(StringBuffer sb, Node<T> n) {
 		n.toString(sb);
 	}
 
-	private class Node {
+	private class Node<S> {
 		private String key;
-		private Object value;
-		private List nodes;
+		private S value;
+		private List<Node<S>> nodes;
 
-		public Node(String key, Object value) {
+		public Node(String key, S value) {
 			this.key = key;
 			this.value = value;
 		}
 
-		public void addNode(Node n) {
+		public void addNode(Node<S> n) {
 			if (nodes == null) {
-				nodes = new LinkedList();
+				nodes = new LinkedList<Node<S>>();
 			}
 			nodes.add(n);
 		}
 		
-		public void removeNode(Node n) {
+		public void removeNode(Node<S> n) {
 			nodes.remove(n);
 			if (nodes.size() == 0) {
 				nodes = null;
@@ -280,7 +270,7 @@
 	}
 	
 	public static void main(String[] args) {
-		RadixTree rt = new RadixTree();
+		RadixTree<String> rt = new RadixTree<String>();
 		p(rt);
 		rt.put("the dog", "0");
 		p(rt);

Modified: trunk/src/org/griphyn/vdl/karajan/monitor/StateUpdater.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/monitor/StateUpdater.java	2012-07-08 00:33:44 UTC (rev 5822)
+++ trunk/src/org/griphyn/vdl/karajan/monitor/StateUpdater.java	2012-07-08 00:35:40 UTC (rev 5823)
@@ -26,49 +26,55 @@
 import java.util.List;
 import java.util.Map;
 
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.apache.log4j.Priority;
 import org.griphyn.vdl.karajan.monitor.processors.LogMessageProcessor;
 
 public class StateUpdater {
+    public static final Logger logger = Logger.getLogger(StateUpdater.class);
+    
 	private SystemState state;
-    private Map categories;
-    
+    private Map<Level, Map<String, List<LogMessageProcessor>>> levels;
+        
     public StateUpdater(SystemState state) {
         this.state = state;
-        this.categories = new HashMap();
+        this.levels = new HashMap<Level, Map<String, List<LogMessageProcessor>>>();
     }
     
     public void addProcessor(LogMessageProcessor processor) {
-        Object category = processor.getSupportedCategory();
-        Map sources;
-        synchronized(categories) {
-            sources = (Map) categories.get(category);
+        Level level = processor.getSupportedLevel();    
+        Map<String, List<LogMessageProcessor>> sources;
+        
+        synchronized(levels) {
+            sources = levels.get(level);
             if (sources == null) {
-                sources = new HashMap();
-                categories.put(category, sources);
+                sources = new HashMap<String, List<LogMessageProcessor>>();
+                levels.put(level, sources);
             }
         }
         synchronized(sources) {
-        	List l = (List) sources.get(processor.getSupportedSource());
+        	List<LogMessageProcessor> l = sources.get(processor.getSupportedSourceName());
         	if (l == null) {
-        		l = new LinkedList();
-        		sources.put(processor.getSupportedSource(), l);
+        		l = new LinkedList<LogMessageProcessor>();
+        		sources.put(processor.getSupportedSourceName(), l);
         	}
             l.add(processor);
         }
     }
     
     public void logEvent(Object category, String source, Object message, Object details) {
-    	Map sources = (Map) categories.get(category);
+    	Map<String, List<LogMessageProcessor>> sources = levels.get(category);
         if (sources == null) {
-            return; 
+            return;
         }
-        List l = (List) sources.get(source);
+        List<LogMessageProcessor> l = sources.get(source);
         if (l == null) {
         	return;
         }
-        Iterator i = l.iterator();
+        Iterator<LogMessageProcessor> i = l.iterator();
         while (i.hasNext()) {
-        	LogMessageProcessor processor = (LogMessageProcessor) i.next();
+        	LogMessageProcessor processor = i.next();
         	processor.processMessage(state, message, details);
         }
     }

Modified: trunk/src/org/griphyn/vdl/karajan/monitor/StatefulItemClassSet.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/monitor/StatefulItemClassSet.java	2012-07-08 00:33:44 UTC (rev 5822)
+++ trunk/src/org/griphyn/vdl/karajan/monitor/StatefulItemClassSet.java	2012-07-08 00:35:40 UTC (rev 5823)
@@ -20,21 +20,19 @@
  */
 package org.griphyn.vdl.karajan.monitor;
 
-import java.util.Iterator;
 import java.util.List;
 
 import org.griphyn.vdl.karajan.monitor.items.StatefulItem;
 
-public class StatefulItemClassSet {
-	private RadixTree map;
-	private Iterator i;
+public class StatefulItemClassSet<T extends StatefulItem> {
+	private RadixTree<T> map;
 	private int crt;
 	
 	public StatefulItemClassSet() {
-		map = new RadixTree();
+		map = new RadixTree<T>();
 	}
 
-	public synchronized void add(StatefulItem item) {
+	public synchronized void add(T item) {
 		map.put(item.getID(), item);
 		crt = Integer.MAX_VALUE;
 	}
@@ -45,7 +43,7 @@
 	}
 	
 	public synchronized StatefulItem getByID(String id) {
-		return (StatefulItem) map.get(id);
+		return map.get(id);
 	}
 	
 	public synchronized StatefulItem findWithPrefix(String prefix) {
@@ -54,7 +52,7 @@
 			return null;
 		}
 		else {
-			return (StatefulItem) map.get(key);
+			return map.get(key);
 		}
 	}
 	
@@ -62,7 +60,7 @@
 		return map.size();
 	}
 	
-	public synchronized List getAll() {
+	public synchronized List<T> getAll() {
 		return map.getAll();
 	}
 }

Modified: trunk/src/org/griphyn/vdl/karajan/monitor/SystemState.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/monitor/SystemState.java	2012-07-08 00:33:44 UTC (rev 5822)
+++ trunk/src/org/griphyn/vdl/karajan/monitor/SystemState.java	2012-07-08 00:35:40 UTC (rev 5823)
@@ -22,7 +22,6 @@
 
 import java.util.HashMap;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
 
@@ -31,9 +30,9 @@
 import org.griphyn.vdl.karajan.monitor.items.StatefulItemClass;
 
 public class SystemState {
-	private Map classes;
-    private Set listeners;
-    private Map stats;
+	private Map<StatefulItemClass, StatefulItemClassSet<? extends StatefulItem>> classes;
+    private Set<SystemStateListener> listeners;
+    private Map<String, Stats> stats;
     private int total, completed;
     private long start;
     private VariableStack stack;
@@ -41,9 +40,9 @@
 
 	public SystemState(String projectName) {
 	    this.projectName = projectName;
-		classes = new HashMap();
-        listeners = new HashSet();
-        stats = new HashMap();
+		classes = new HashMap<StatefulItemClass, StatefulItemClassSet<? extends StatefulItem>>();
+        listeners = new HashSet<SystemStateListener>();
+        stats = new HashMap<String, Stats>();
 	}
 
 	public void addItem(StatefulItem item) {
@@ -51,12 +50,13 @@
         notifyListeners(SystemStateListener.ITEM_ADDED, item);
 	}
 
-	public StatefulItemClassSet getItemClassSet(StatefulItemClass cls) {
-        StatefulItemClassSet clset;
+	@SuppressWarnings("unchecked")
+    public <T extends StatefulItem> StatefulItemClassSet<T> getItemClassSet(StatefulItemClass cls) {
+        StatefulItemClassSet<T> clset;
 		synchronized (classes) {
-			clset = (StatefulItemClassSet) classes.get(cls);
+			clset = (StatefulItemClassSet<T>) classes.get(cls);
             if (clset == null) {
-            	clset = new StatefulItemClassSet();
+            	clset = new StatefulItemClassSet<T>();
                 classes.put(cls, clset);
             }
 		}
@@ -85,9 +85,8 @@
 	}
     
     protected void notifyListeners(int updateType, StatefulItem item) {
-    	Iterator i = listeners.iterator();
-        while (i.hasNext()) {
-        	((SystemStateListener) i.next()).itemUpdated(updateType, item);
+        for (SystemStateListener l : listeners) {
+            l.itemUpdated(updateType, item);
         }
     }
     
@@ -101,7 +100,7 @@
 
     public Stats getStats(String key) {
         synchronized(stats) {
-            Stats s = (Stats) stats.get(key);
+            Stats s = stats.get(key);
             if (s == null) {
                 s = new Stats();
                 stats.put(key, s);

Modified: trunk/src/org/griphyn/vdl/karajan/monitor/items/AbstractStatefulItem.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/monitor/items/AbstractStatefulItem.java	2012-07-08 00:33:44 UTC (rev 5822)
+++ trunk/src/org/griphyn/vdl/karajan/monitor/items/AbstractStatefulItem.java	2012-07-08 00:35:40 UTC (rev 5823)
@@ -61,12 +61,12 @@
 	}
 
 	public void removeChild(StatefulItem child) {
-		/*if (children == null) {
+		if (children == null) {
 			throw new IllegalStateException("No such child: " + child);
 		}
 		synchronized (children) {
 			children.remove(child);
-		}*/
+		}
 	}
 
 	public void setParent(StatefulItem parent) {

Added: trunk/src/org/griphyn/vdl/karajan/monitor/items/SummaryItem.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/monitor/items/SummaryItem.java	                        (rev 0)
+++ trunk/src/org/griphyn/vdl/karajan/monitor/items/SummaryItem.java	2012-07-08 00:35:40 UTC (rev 5823)
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2012 University of Chicago
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+/*
+ * Created on Jan 29, 2007
+ */
+package org.griphyn.vdl.karajan.monitor.items;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.griphyn.vdl.karajan.lib.RuntimeStats;
+import org.griphyn.vdl.karajan.lib.RuntimeStats.ProgressTicker;
+import org.griphyn.vdl.karajan.monitor.SystemState;
+
+public class SummaryItem extends AbstractStatefulItem {
+	private Map<String, Integer> counts;
+	private int status;
+	
+	public static final String ID = "SUMMARY";
+	
+	public SummaryItem() {
+		super(ID);
+		counts = new HashMap<String, Integer>();
+	}
+	
+	public StatefulItemClass getItemClass() {
+		return StatefulItemClass.WORKFLOW;
+	}
+
+	public String toString() {
+		return counts.toString();
+	}
+
+	public synchronized int getCount(String key) {
+	    Integer i = counts.get(key);
+	    if (i == 0) {
+	        return 0;
+	    }
+	    else {
+	        return i;
+	    }
+	}
+	
+	public int getCount(String key, SystemState state) {
+	    if (state.getStack() != null) {
+	        ProgressTicker t = RuntimeStats.getTicker(state.getStack());
+	        Integer value = t.getSummary().get(key);
+	        if (value != null) {
+	            return value;
+	        }
+	        else {
+	            return 0;
+	        }
+	    }
+	    else {
+	        return getCount(key);
+	    }
+	}
+	
+	public synchronized Map<String, Integer> getCounts(SystemState state) {
+	    if (state.getStack() != null) {
+            return RuntimeStats.getTicker(state.getStack()).getSummary();
+	    }
+	    else {
+	        return new HashMap<String, Integer>(counts);
+	    }
+	}
+	
+	public synchronized void setCount(String key, int value) {
+	    counts.put(key, value);
+	}
+}

Modified: trunk/src/org/griphyn/vdl/karajan/monitor/monitors/AbstractMonitor.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/monitor/monitors/AbstractMonitor.java	2012-07-08 00:33:44 UTC (rev 5822)
+++ trunk/src/org/griphyn/vdl/karajan/monitor/monitors/AbstractMonitor.java	2012-07-08 00:35:40 UTC (rev 5823)
@@ -38,4 +38,21 @@
 
 	public void itemUpdated(int updateType, StatefulItem item) {
 	}
+
+    @Override
+    public boolean supportsOfflineRendering() {
+        return false;
+    }
+
+    @Override
+    public void setOffline(boolean offline) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public TimelineController getTimelineController() {
+        throw new UnsupportedOperationException();
+    }
+	
+	
 }

Modified: trunk/src/org/griphyn/vdl/karajan/monitor/monitors/Monitor.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/monitor/monitors/Monitor.java	2012-07-08 00:33:44 UTC (rev 5822)
+++ trunk/src/org/griphyn/vdl/karajan/monitor/monitors/Monitor.java	2012-07-08 00:35:40 UTC (rev 5823)
@@ -26,4 +26,10 @@
 	void setState(SystemState state);
 
     void shutdown();
+    
+    boolean supportsOfflineRendering();
+    
+    void setOffline(boolean offline);
+    
+    TimelineController getTimelineController();
 }

Modified: trunk/src/org/griphyn/vdl/karajan/monitor/monitors/MonitorFactory.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/monitor/monitors/MonitorFactory.java	2012-07-08 00:33:44 UTC (rev 5822)
+++ trunk/src/org/griphyn/vdl/karajan/monitor/monitors/MonitorFactory.java	2012-07-08 00:35:40 UTC (rev 5823)
@@ -27,10 +27,10 @@
 import org.griphyn.vdl.karajan.monitor.monitors.swing.SwingMonitor;
 
 public class MonitorFactory {
-	private static Map classes;
+	private static Map<String, Class<? extends Monitor>> classes;
 
 	static {
-		classes = new HashMap();
+		classes = new HashMap<String, Class<? extends Monitor>>();
 		classes.put("text", TextMonitor.class);
 		classes.put("ANSI", ANSIMonitor.class);
 		classes.put("Swing", SwingMonitor.class);
@@ -38,11 +38,11 @@
 
 	public static Monitor newInstance(String type) throws InstantiationException,
 			IllegalAccessException {
-		Class cls = (Class) classes.get(type);
+		Class<? extends Monitor> cls = classes.get(type);
 		if (cls == null) {
 			throw new IllegalArgumentException("Unsupported monitor type (" + type
 					+ "). The supported types are: " + classes.keySet());
 		}
-		return (Monitor) cls.newInstance();
+		return cls.newInstance();
 	}
 }

Added: trunk/src/org/griphyn/vdl/karajan/monitor/monitors/TimelineController.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/monitor/monitors/TimelineController.java	                        (rev 0)
+++ trunk/src/org/griphyn/vdl/karajan/monitor/monitors/TimelineController.java	2012-07-08 00:35:40 UTC (rev 5823)
@@ -0,0 +1,23 @@
+//----------------------------------------------------------------------
+//This code is developed as part of the Java CoG Kit project
+//The terms of the license can be found at http://www.cogkit.org/license
+//This message may not be removed or altered.
+//----------------------------------------------------------------------
+
+/*
+ * Created on Jul 13, 2011
+ */
+package org.griphyn.vdl.karajan.monitor.monitors;
+
+
+public interface TimelineController {
+    void setStartTime(long t);
+    
+    void setEndTime(long t);
+    
+    void addListener(Listener l);
+    
+    public interface Listener {
+        void timeChanged(long t);
+    }
+}

Modified: trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/AbstractANSIDisplay.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/AbstractANSIDisplay.java	2012-07-08 00:33:44 UTC (rev 5822)
+++ trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/AbstractANSIDisplay.java	2012-07-08 00:35:40 UTC (rev 5823)
@@ -26,11 +26,15 @@
 import java.io.PrintStream;
 
 import org.apache.log4j.Logger;
+import org.griphyn.vdl.karajan.monitor.StatefulItemClassSet;
 import org.griphyn.vdl.karajan.monitor.SystemState;
+import org.griphyn.vdl.karajan.monitor.items.ApplicationItem;
 import org.griphyn.vdl.karajan.monitor.items.StatefulItem;
 import org.griphyn.vdl.karajan.monitor.items.StatefulItemClass;
+import org.griphyn.vdl.karajan.monitor.items.TaskItem;
 import org.griphyn.vdl.karajan.monitor.monitors.ansi.tui.ANSI;
 import org.griphyn.vdl.karajan.monitor.monitors.ansi.tui.ANSIContext;
+import org.griphyn.vdl.karajan.monitor.monitors.ansi.tui.CharacterMap;
 import org.griphyn.vdl.karajan.monitor.monitors.ansi.tui.Component;
 import org.griphyn.vdl.karajan.monitor.monitors.ansi.tui.Dialog;
 import org.griphyn.vdl.karajan.monitor.monitors.ansi.tui.Key;
@@ -79,10 +83,14 @@
                     .println("Your terminal does not support ANSI escape codes");
             }
             else {
+                Component cmap = new CharacterMap();
+                cmap.setLocation(10, 20);
                 screen.add(createMainMenu(screen));
                 screen.add(createTitle(screen));
                 screen.add(createMainTabs(screen));
                 screen.add(createProgressBar(screen));
+                
+                //screen.add(cmap);
 
                 apps.focus();
                 screen.redraw();
@@ -181,8 +189,9 @@
         apps = new Tab("3 Apps.");
         apps.setAcceleratorKey(new Key(Key.F3));
         appsTable = new AppTable();
-        appsTable.setModel(new ApplicationTable.Model(state
-            .getItemClassSet(StatefulItemClass.APPLICATION)));
+        StatefulItemClassSet<ApplicationItem> set = state
+            .getItemClassSet(StatefulItemClass.APPLICATION);
+        appsTable.setModel(new ApplicationTable.Model(set));
         appsTable.setColumnWidth(0, 9);
         appsTable.setColumnWidth(1, 16);
         appsTable.setColumnWidth(3, 16);
@@ -195,8 +204,9 @@
         schedulerInfoTab = new Tab("4 Jobs");
         schedulerInfoTab.setAcceleratorKey(new Key(Key.F4));
         tasksTable = new STable();
-        tasksTable.setModel(new JobModel(state
-            .getItemClassSet(StatefulItemClass.TASK)));
+        StatefulItemClassSet<TaskItem> set = state
+            .getItemClassSet(StatefulItemClass.TASK);
+        tasksTable.setModel(new JobModel(set));
         tasksTable.setColumnWidth(0, 16);
         tasksTable.setColumnWidth(2, 16);
         tasksTable.setColumnWidth(3, 12);
@@ -209,8 +219,9 @@
         schedulerInfoTab = new Tab("5 Transfers");
         schedulerInfoTab.setAcceleratorKey(new Key(Key.F5));
         tasksTable = new STable();
-        tasksTable.setModel(new TransferModel(state
-            .getItemClassSet(StatefulItemClass.TASK)));
+        StatefulItemClassSet<TaskItem> set = state
+            .getItemClassSet(StatefulItemClass.TASK);
+        tasksTable.setModel(new TransferModel(set));
         tasksTable.setBgColor(ANSI.CYAN);
         tasksTable.setColumnWidth(2, 21);
         schedulerInfoTab.setContents(tasksTable);
@@ -252,6 +263,11 @@
                 appsTable.dataChanged();
             }
         }
+        else if (cls.equals(StatefulItemClass.TASK)) {
+            if (tasksTable != null) {
+                tasksTable.dataChanged();
+            }
+        }
     }
 
     protected void cleanup() throws IOException {

Modified: trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/BensModel.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/BensModel.java	2012-07-08 00:33:44 UTC (rev 5822)
+++ trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/BensModel.java	2012-07-08 00:35:40 UTC (rev 5823)
@@ -33,11 +33,11 @@
 
 public class BensModel extends AbstractTableModel implements SystemStateListener {
     private SystemState state;
-    private List lines;
+    private List<String> lines;
 
     public BensModel(SystemState state) {
         this.state = state;
-        lines = new ArrayList();
+        lines = new ArrayList<String>();
         try {
             BufferedReader br = new BufferedReader(new FileReader(state.getProjectName() + ".swift"));
             String line = br.readLine();
@@ -53,7 +53,7 @@
         }
     }
 
-    public Class getColumnClass(int columnIndex) {
+    public Class<?> getColumnClass(int columnIndex) {
         return String.class;
     }
 

Modified: trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/GlobalProgress.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/GlobalProgress.java	2012-07-08 00:33:44 UTC (rev 5822)
+++ trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/GlobalProgress.java	2012-07-08 00:35:40 UTC (rev 5823)
@@ -18,7 +18,6 @@
 package org.griphyn.vdl.karajan.monitor.monitors.ansi;
 
 import java.io.IOException;
-import java.util.TimerTask;
 
 import org.griphyn.vdl.karajan.monitor.SystemState;
 import org.griphyn.vdl.karajan.monitor.monitors.ansi.tui.ANSI;
@@ -27,11 +26,13 @@
 
 public class GlobalProgress extends Component {
     private SystemState state;
+    private long start;
 
     public GlobalProgress(SystemState state) {
         this.state = state;
-        GlobalTimer.getTimer().schedule(new TimerTask() {
-            public void run() {
+        this.start = System.currentTimeMillis();
+        GlobalTimer.getTimer().schedule(new SafeTimerTask(getScreen()) {
+            public void runTask() {
                 redraw();
             }
         }, 1000, 1000);
@@ -50,10 +51,10 @@
             sb.append("N/A");
         }
         sb.append("   Elapsed time: ");
-        sb.append(format(System.currentTimeMillis() - state.getStart()));
+        sb.append(format(System.currentTimeMillis() - start));
         sb.append("   Est. time left: ");
         if (total != 0 && crt != 0) {
-            sb.append(et(state.getCompleted(), total, state.getStart()));
+            sb.append(et(state.getCompleted(), total, start));
         }
         else {
             sb.append("N/A");

Modified: trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/GlobalTimer.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/GlobalTimer.java	2012-07-08 00:33:44 UTC (rev 5822)
+++ trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/GlobalTimer.java	2012-07-08 00:35:40 UTC (rev 5823)
@@ -22,10 +22,14 @@
 
 import java.util.Timer;
 
-public class GlobalTimer {
-	private static final Timer timer = new Timer();
+public class GlobalTimer extends Timer {
+	private static final Timer timer = new Timer("TUI Timer", true);
+	
+	public GlobalTimer(String name, boolean isDaemon) {
+        super(name, isDaemon);    
+    }
 
-	public static Timer getTimer() {
+    public static Timer getTimer() {
 		return timer;
 	}
 }

Modified: trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/LocalANSIDisplay.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/LocalANSIDisplay.java	2012-07-08 00:33:44 UTC (rev 5822)
+++ trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/LocalANSIDisplay.java	2012-07-08 00:35:40 UTC (rev 5823)
@@ -26,7 +26,7 @@
 import org.griphyn.vdl.karajan.monitor.monitors.ansi.tui.ANSI;
 
 public class LocalANSIDisplay extends AbstractANSIDisplay {
-    private PrintStream sout, serr;
+    public PrintStream sout, serr;
     private ANSIMonitor m;
     
 	public LocalANSIDisplay(ANSIMonitor m) {

Modified: trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/STable.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/STable.java	2012-07-08 00:33:44 UTC (rev 5822)
+++ trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/STable.java	2012-07-08 00:35:40 UTC (rev 5823)
@@ -20,8 +20,11 @@
  */
 package org.griphyn.vdl.karajan.monitor.monitors.ansi;
 
+import java.util.Date;
 import java.util.Iterator;
 
+import javax.swing.event.TableModelEvent;
+
 import org.globus.cog.abstraction.interfaces.FileTransferSpecification;
 import org.globus.cog.abstraction.interfaces.JobSpecification;
 import org.globus.cog.abstraction.interfaces.Status;
@@ -38,6 +41,7 @@
 import org.griphyn.vdl.karajan.monitor.monitors.ansi.tui.Table;
 import org.griphyn.vdl.karajan.monitor.monitors.ansi.tui.Terminal;
 import org.griphyn.vdl.karajan.monitor.monitors.ansi.tui.TextArea;
+import org.griphyn.vdl.karajan.monitor.monitors.swing.FilteringTaskTable;
 import org.griphyn.vdl.karajan.monitor.monitors.swing.SimpleTableClassRenderer.Model;
 
 public class STable extends Table implements ActionListener {
@@ -226,4 +230,13 @@
             return String.valueOf(o);
         }
     }
+
+    @Override
+    public void tableChanged(TableModelEvent e) {
+        if (getModel() instanceof FilteringTaskTable.Model) {
+            FilteringTaskTable.Model model = (FilteringTaskTable.Model) getModel();
+            model.invalidate();
+        }
+        super.tableChanged(e);
+    }
 }

Added: trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/SafeTimerTask.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/SafeTimerTask.java	                        (rev 0)
+++ trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/SafeTimerTask.java	2012-07-08 00:35:40 UTC (rev 5823)
@@ -0,0 +1,49 @@
+//----------------------------------------------------------------------
+//This code is developed as part of the Java CoG Kit project
+//The terms of the license can be found at http://www.cogkit.org/license
+//This message may not be removed or altered.
+//----------------------------------------------------------------------
+
+/*
+ * Created on May 30, 2012
+ */
+package org.griphyn.vdl.karajan.monitor.monitors.ansi;
+
+import java.io.CharArrayWriter;
+import java.io.PrintWriter;
+import java.util.TimerTask;
+
+import org.apache.log4j.Logger;
+import org.griphyn.vdl.karajan.monitor.monitors.ansi.tui.Dialog;
+import org.griphyn.vdl.karajan.monitor.monitors.ansi.tui.Screen;
+
+public abstract class SafeTimerTask extends TimerTask {
+    public static final Logger logger = Logger.getLogger(SafeTimerTask.class);
+    private Screen screen;
+    
+    public SafeTimerTask() {
+    }
+    
+    public SafeTimerTask(Screen screen) {
+        this.screen = screen;
+    }
+    
+    @Override
+    public final void run() {
+        try {
+            runTask();
+        }
+        catch (Exception e) {
+            if (screen != null) {
+                CharArrayWriter caw = new CharArrayWriter();
+                e.printStackTrace(new PrintWriter(caw));
+                Dialog.displaySimpleDialog(screen, "Error", caw.toString(), new String[] {"Close"});
+            }
+            else {
+                logger.warn("Exception in timer task", e);
+            }
+        }
+    }
+    
+    public abstract void runTask();
+}

Modified: trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/SchedulerInfoPane.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/SchedulerInfoPane.java	2012-07-08 00:33:44 UTC (rev 5822)
+++ trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/SchedulerInfoPane.java	2012-07-08 00:35:40 UTC (rev 5823)
@@ -48,7 +48,7 @@
 	    
 	    f = new Frame() {
             protected void validate() {
-                Component c = (Component) getComponents().get(0);
+                Component c = getComponents().get(0);
                 c.setLocation(1, 1);
                 c.setSize(width - 2, height - 2);
                 super.validate();

Modified: trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/SummaryPane.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/SummaryPane.java	2012-07-08 00:33:44 UTC (rev 5822)
+++ trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/SummaryPane.java	2012-07-08 00:35:40 UTC (rev 5823)
@@ -21,13 +21,13 @@
 import java.util.Map;
 import java.util.TimerTask;
 
-import org.globus.cog.karajan.stack.VariableStack;
-import org.griphyn.vdl.karajan.lib.RuntimeStats;
-import org.griphyn.vdl.karajan.lib.RuntimeStats.ProgressTicker;
 import org.griphyn.vdl.karajan.monitor.SystemState;
+import org.griphyn.vdl.karajan.monitor.items.StatefulItemClass;
+import org.griphyn.vdl.karajan.monitor.items.SummaryItem;
 import org.griphyn.vdl.karajan.monitor.monitors.ansi.tui.ANSI;
 import org.griphyn.vdl.karajan.monitor.monitors.ansi.tui.ANSIContext;
 import org.griphyn.vdl.karajan.monitor.monitors.ansi.tui.Container;
+import org.griphyn.vdl.karajan.monitor.monitors.ansi.tui.Dialog;
 import org.griphyn.vdl.karajan.monitor.monitors.ansi.tui.Label;
 import org.griphyn.vdl.karajan.monitor.monitors.ansi.tui.LevelBars;
 
@@ -52,30 +52,23 @@
             labels[i] = addLabel("0", 25, 2 + i, 8);
         }
 
-        GlobalTimer.getTimer().schedule(new TimerTask() {
-            public void run() {
+        GlobalTimer.getTimer().schedule(new SafeTimerTask(getScreen()) {
+            public void runTask() {
                 update();
             }
         }, 1000, 1000);
     }
 
     private void update() {
-        VariableStack stack = state.getStack();
-        if (stack != null) {
-            ProgressTicker t = RuntimeStats.getTicker(stack);
-            if (t != null) {
-                Map summary = t.getSummary();
+        try {
+            SummaryItem summary = (SummaryItem) state.getItemByID(SummaryItem.ID, StatefulItemClass.WORKFLOW);
+            if (summary != null) {
+                Map<String, Integer> counts = summary.getCounts(state);
                 for (int i = 0; i < STATES.length; i++) {
-                    Object v = summary.get(STATES[i]);
+                    Integer v = counts.get(STATES[i]);
                     if (v != null) {
-                        String sv = String.valueOf(v);
-                        labels[i].setText(sv);
-                        try {
-                            bars.setValue(i, Integer.parseInt(sv));
-                        }
-                        catch (NumberFormatException e) {
-                            bars.setValue(i, 0);
-                        }
+                        labels[i].setText(v.toString());
+                        bars.setValue(i, v);
                     }
                     else {
                         labels[i].setText("0");
@@ -83,8 +76,11 @@
                     }
                 }
             }
+            redraw();
         }
-        redraw();
+        catch (Exception e) {
+            Dialog.displaySimpleDialog(getScreen(), "Error", e.toString(), new String[] {"Close"});
+        }
     }
 
     private Label addLabel(String text, int x, int y, int w) {

Modified: trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/TaskStatsPane.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/TaskStatsPane.java	2012-07-08 00:33:44 UTC (rev 5822)
+++ trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/TaskStatsPane.java	2012-07-08 00:35:40 UTC (rev 5823)
@@ -18,8 +18,6 @@
 package org.griphyn.vdl.karajan.monitor.monitors.ansi;
 
 import java.io.IOException;
-import java.util.Timer;
-import java.util.TimerTask;
 
 import org.griphyn.vdl.karajan.monitor.Stats;
 import org.griphyn.vdl.karajan.monitor.SystemState;
@@ -63,9 +61,9 @@
             cg[i] = addGraph(12 + i * hsz, 6, hsz, vsz);
             pg[i] = addGraph(12 + i * hsz, 6 + vsz, hsz, vsz);
         }
-        GlobalTimer.getTimer().schedule(new TimerTask() {
-            public void run() {
-                update();
+        GlobalTimer.getTimer().schedule(new SafeTimerTask(getScreen()) {
+            public void runTask() {
+                update(); 
             }
         }, 1000, 1000);
     }

Modified: trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/tui/ANSI.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/tui/ANSI.java	2012-07-08 00:33:44 UTC (rev 5822)
+++ trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/tui/ANSI.java	2012-07-08 00:35:40 UTC (rev 5823)
@@ -47,6 +47,8 @@
 	public static final int GCH_LM_CORNER = 118;
 	public static final int GCH_UM_CORNER = 119;
 	public static final int GCH_HASH = 97;
+	
+	public static final int GCH_BULLET = 96;
 
 	public static String moveTo(int x, int y) {
 		return AESC + y + ';' + x + 'H';

Modified: trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/tui/ANSIContext.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/tui/ANSIContext.java	2012-07-08 00:33:44 UTC (rev 5822)
+++ trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/tui/ANSIContext.java	2012-07-08 00:35:40 UTC (rev 5823)
@@ -197,9 +197,10 @@
     }
 
     protected void expect(String what, int wait) throws IOException {
-        if (wait > 0) {
+        while (wait > 0 && is.available() == 0) {
             try {
-                Thread.sleep(wait);
+                Thread.sleep(1);
+                wait--;
             }
             catch (InterruptedException e) {
                 throw new IOException("Interrupted");

Modified: trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/tui/Container.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/tui/Container.java	2012-07-08 00:33:44 UTC (rev 5822)
+++ trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/tui/Container.java	2012-07-08 00:35:40 UTC (rev 5823)
@@ -26,12 +26,12 @@
 import java.util.List;
 
 public class Container extends Component {
-    protected List components;
+    protected List<Component> components;
     protected Component focused, oldFocused;
     private Boolean focusable;
 
     public Container() {
-        components = new ArrayList();
+        components = new ArrayList<Component>();
     }
 
     public void add(Component comp) {
@@ -53,7 +53,7 @@
         focusable = null;
     }
 
-    public List getComponents() {
+    public List<Component> getComponents() {
         return components;
     }
 
@@ -64,9 +64,7 @@
 
     protected void drawTree(ANSIContext context) throws IOException {
         super.drawTree(context);
-        Iterator i = components.iterator();
-        while (i.hasNext()) {
-            Component c = (Component) i.next();
+        for (Component c : components) {
             if (c.isVisible()) {
                 drawChild(c, context);
             }
@@ -82,10 +80,8 @@
         if (isValid()) {
             return;
         }
-        Iterator i = components.iterator();
         boolean focus = false;
-        while (i.hasNext()) {
-            Component c = (Component) i.next();
+        for (Component c : components) {
             if (c.hasFocus() && !hasFocus()) {
                 focus();
             }
@@ -118,9 +114,8 @@
 
     public boolean keyboardEvent(Key key) {
         if (key.modALT() || key.isFunctionKey()) {
-            Iterator i = components.iterator();
-            while (i.hasNext()) {
-                if (((Component) i.next()).keyboardEvent(key)) {
+            for (Component c : components) {
+                if (c.keyboardEvent(key)) {
                     return true;
                 }
             }
@@ -146,10 +141,8 @@
     }
 
     public boolean focusFirst() {
-        Iterator j = components.iterator();
-        while (j.hasNext()) {
-            Component comp = (Component) j.next();
-            if (comp.focusFirst()) {
+        for (Component c : components) {
+            if (c.focusFirst()) {
                 return true;
             }
         }
@@ -163,11 +156,11 @@
         else if (focused.focusNext()) {
             return true;
         }
-        Iterator i = components.iterator();
+        Iterator<Component> i = components.iterator();
         while (i.hasNext()) {
             if (i.next() == focused) {
                 while (i.hasNext()) {
-                    Component comp = (Component) i.next();
+                    Component comp = i.next();
                     if (comp.isFocusable()) {
                         comp.focus();
                         return true;
@@ -184,9 +177,8 @@
         if (f != null) {
             return f.booleanValue();
         }
-        Iterator i = components.iterator();
-        while (i.hasNext()) {
-            if (((Component) i.next()).isFocusable()) {
+        for (Component c : components) {
+            if (c.isFocusable()) {
                 focusable = Boolean.TRUE;
                 return true;
             }

Modified: trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/tui/Table.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/tui/Table.java	2012-07-08 00:33:44 UTC (rev 5822)
+++ trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/tui/Table.java	2012-07-08 00:35:40 UTC (rev 5823)
@@ -31,7 +31,7 @@
 
 public class Table extends Container implements TableModelListener {
 	private TableModel model;
-	private Map colWidths;
+	private Map<Integer, Integer> colWidths;
 	private int presetColWidthsTotal;
 	private int presetColWidthsCount;
 	private int firstRow;
@@ -45,8 +45,10 @@
 	
 	public Table(TableModel model) {
 		this.model = model;
-		colWidths = new HashMap();
+		colWidths = new HashMap<Integer, Integer>();
 		sb = new VScrollbar();
+		sb.setBackgroundChar(ANSI.GCH_V_LINE);
+		sb.setThumbChar(ANSI.GCH_BULLET);
 		cellRenderer = new DefaultTableCellRenderer();
 	}
 
@@ -66,9 +68,9 @@
 	}
 
 	public void setColumnWidth(int index, int width) {
-		Integer old = (Integer) colWidths.put(new Integer(index), new Integer(width));
+		Integer old = colWidths.put(index, width);
 		if (old != null) {
-			presetColWidthsTotal -= old.intValue();
+			presetColWidthsTotal -= old;
 			presetColWidthsCount--;
 		}
 		presetColWidthsTotal += width;
@@ -82,7 +84,7 @@
 			return;
 		}
 		removeAll();
-		sb.setLocation(width - 1, 0);
+		sb.setLocation(width, 0);
 		sb.setSize(1, height);
 		sb.setBgColor(bgColor);
 		sb.setFgColor(fgColor);
@@ -100,7 +102,7 @@
 		float cx = 0;
 		for (int i = 0; i < cc; i++) {
 			boolean last = i == cc - 1;
-			Integer presetColWidth = (Integer) colWidths.get(new Integer(i));
+			Integer presetColWidth = colWidths.get(i);
 			int colWidth;
 			if (presetColWidth == null) {
 				colWidth = (int) ((cx + defaultWidth) - (int) cx);
@@ -169,15 +171,13 @@
 			sb.setTotal(getModel().getRowCount());
 			sb.setCurrent(selectedRow);
 			this.selectedRow = selectedRow;
-			Iterator i = components.iterator();
-			while (i.hasNext()) {
-				Component c = (Component) i.next();
+			for (Component c : components) {
 				if (c instanceof TableColumn) {
 					((TableColumn) c).setSelectedRow(selectedRow);
 				}
 			}
 			if (selectedRow < firstRow) {
-			    firstRow = Math.min(selectedRow - height + 4, 0);
+			    firstRow = Math.max(selectedRow - height + 4, 0);
 			}
 			if (selectedRow > firstRow + height - 4) {
 			    firstRow = selectedRow;

Modified: trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/tui/TableColumn.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/tui/TableColumn.java	2012-07-08 00:33:44 UTC (rev 5822)
+++ trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/tui/TableColumn.java	2012-07-08 00:35:40 UTC (rev 5823)
@@ -43,7 +43,7 @@
     protected void draw(ANSIContext context) throws IOException {
         super.draw(context);
         int fr = table.getFirstRow();
-        for (int i = 0; i < Math.min(model.getRowCount(), height - 2); i++) {
+        for (int i = 0; i < Math.min(model.getRowCount() - fr, height - 2); i++) {
             Component comp = table.getCellRenderer().getComponent(table,
                 model.getValueAt(i + fr, index), i + fr == selectedRow, getParent().hasFocus(),
                 i + fr, index);
@@ -54,7 +54,7 @@
         context.lock();
         try {
             context.bgColor(bgColor);
-            for (int i = Math.min(model.getRowCount() + 1, height - 1); i < height - 1; i++) {
+            for (int i = Math.min(model.getRowCount() - fr + 1, height - 1); i < height - 1; i++) {
                 context.moveTo(sx, sy + i + 1);
                 context.spaces(width);
             }

Modified: trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/tui/VScrollbar.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/tui/VScrollbar.java	2012-07-08 00:33:44 UTC (rev 5822)
+++ trunk/src/org/griphyn/vdl/karajan/monitor/monitors/ansi/tui/VScrollbar.java	2012-07-08 00:35:40 UTC (rev 5823)
@@ -24,6 +24,15 @@
 
 public class VScrollbar extends Component {
 	private int total, current;
+	private int backgroundChar;
+	private int thumbChar;
+	private boolean invertThumbColor;
+	
+	public VScrollbar() {
+	    backgroundChar = ANSI.GCH_HASH;
+	    thumbChar = ' ';
+	    invertThumbColor = true;
+	}
 
 	protected void draw(ANSIContext context) throws IOException {
 		context.bgColor(bgColor);
@@ -31,7 +40,7 @@
 		context.lineArt(true);
 		for (int i = 0; i < height; i++) {
 			context.moveTo(sx, sy + i);
-			context.putChar(ANSI.GCH_HASH);
+			context.putChar(backgroundChar);
 		}
 		int pos = 0;
 		if (total > 1) {
@@ -43,10 +52,12 @@
 			}
 			pos = (height - 1) * current / (total - 1);
 		}
-		context.bgColor(fgColor);
-		context.fgColor(bgColor);
+		if (invertThumbColor) {
+		    context.bgColor(fgColor);
+		    context.fgColor(bgColor);
+		}
 		context.moveTo(sx, sy + pos);
-		context.putChar(' ');
+		context.putChar(thumbChar);
 		context.lineArt(false);
 	}
 
@@ -66,4 +77,27 @@
 		this.total = total;
 	}
 
+    public int getBackgroundChar() {
+        return backgroundChar;
+    }
+
+    public void setBackgroundChar(int backgroundChar) {
+        this.backgroundChar = backgroundChar;
+    }
+
+    public int getThumbChar() {
+        return thumbChar;
+    }
+
+    public void setThumbChar(int thumbChar) {
+        this.thumbChar = thumbChar;
+    }
+
+    public boolean getInvertThumbColor() {
+        return invertThumbColor;
+    }
+
+    public void setInvertThumbColor(boolean invertThumbColor) {
+        this.invertThumbColor = invertThumbColor;
+    }
 }

Modified: trunk/src/org/griphyn/vdl/karajan/monitor/monitors/swing/ApplicationTable.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/monitor/monitors/swing/ApplicationTable.java	2012-07-08 00:33:44 UTC (rev 5822)
+++ trunk/src/org/griphyn/vdl/karajan/monitor/monitors/swing/ApplicationTable.java	2012-07-08 00:35:40 UTC (rev 5823)
@@ -29,14 +29,14 @@
 
 public class ApplicationTable extends SimpleTableClassRenderer {
 
-	public ApplicationTable(String name, StatefulItemClassSet itemClassSet) {
+	public ApplicationTable(String name, StatefulItemClassSet<ApplicationItem> itemClassSet) {
 		super(name, itemClassSet);
 		setTableModel(new Model(itemClassSet));
 	}
 	
 	public static class Model extends SimpleTableClassRenderer.Model {
 		
-		public Model(StatefulItemClassSet items) {
+		public Model(StatefulItemClassSet<ApplicationItem> items) {
 			super(items);
 		}
 

Modified: trunk/src/org/griphyn/vdl/karajan/monitor/monitors/swing/FilteringTaskTable.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/monitor/monitors/swing/FilteringTaskTable.java	2012-07-08 00:33:44 UTC (rev 5822)
+++ trunk/src/org/griphyn/vdl/karajan/monitor/monitors/swing/FilteringTaskTable.java	2012-07-08 00:35:40 UTC (rev 5823)
@@ -21,7 +21,6 @@
 package org.griphyn.vdl.karajan.monitor.monitors.swing;
 
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Timer;
 import java.util.TimerTask;
@@ -43,10 +42,10 @@
 public class FilteringTaskTable extends JScrollPane {
 	private JTable table;
 	private String name;
-	private StatefulItemClassSet items;
+	private StatefulItemClassSet<TaskItem> items;
 	private int taskType;
 
-	public FilteringTaskTable(String name, StatefulItemClassSet itemClassSet, int taskType) {
+	public FilteringTaskTable(String name, StatefulItemClassSet<TaskItem> itemClassSet, int taskType) {
 		super(new JTable());
 		this.table = (JTable) super.getViewport().getView();
 		this.name = name;
@@ -83,11 +82,12 @@
 
 	public static class Model extends AbstractTableModel implements StatefulItemModel {
 		private boolean dirty;
-		private List rows, itl;
-		private StatefulItemClassSet items;
+		private List<Task> rows;
+		private List<TaskItem> itl;
+		private StatefulItemClassSet<TaskItem> items;
 		private int taskType;
 
-		public Model(StatefulItemClassSet items, int taskType) {
+		public Model(StatefulItemClassSet<TaskItem> items, int taskType) {
 			dirty = true;
 			this.items = items;
 			this.taskType = taskType;
@@ -102,19 +102,15 @@
 		}
 
 		private synchronized void update() {
-			if (dirty) {
-				rows = new ArrayList();
-				itl = items.getAll();
-				Iterator i = itl.iterator();
-				while (i.hasNext()) {
-					TaskItem t = (TaskItem) i.next();
-					Task task = t.getTask();
-					if (taskType == -1 || task.getType() == taskType) {
-						rows.add(task);
-					}
+			rows = new ArrayList<Task>();
+			itl = items.getAll();
+			for (TaskItem t : itl) {
+				Task task = t.getTask();
+				if (taskType == -1 || task.getType() == taskType) {
+					rows.add(task);
 				}
-				dirty = false;
 			}
+			dirty = false;
 		}
 
 		public int getRowCount() {
@@ -128,7 +124,7 @@
 		}
 		
 		public StatefulItem getItem(int rowIndex) {
-			return (StatefulItem) itl.get(rowIndex);
+			return itl.get(rowIndex);
 		}
 
 		public void fireTableDataChanged() {
@@ -143,7 +139,7 @@
 
 	public static class JobModel extends Model {
 		
-		public JobModel(StatefulItemClassSet items) {
+		public JobModel(StatefulItemClassSet<TaskItem> items) {
 			super(items, Task.JOB_SUBMISSION);
 		}
 		
@@ -188,7 +184,7 @@
 
 	public static class TransferModel extends Model {
 
-		public TransferModel(StatefulItemClassSet items) {
+		public TransferModel(StatefulItemClassSet<TaskItem> items) {
 			super(items, Task.FILE_TRANSFER);
 			transferUpdateTimer.schedule(new TimerTask() {
 				public void run() {
@@ -197,7 +193,7 @@
 			}, 1000, 1000);
 		}
 
-		public Class getColumnClass(int columnIndex) {
+		public Class<?> getColumnClass(int columnIndex) {
 			if (columnIndex == 3) {
 				return TransferProgress.class;
 			}
@@ -241,7 +237,7 @@
 
 	public class FileopModel extends Model {
 		
-		public FileopModel(StatefulItemClassSet items) {
+		public FileopModel(StatefulItemClassSet<TaskItem> items) {
 			super(items, Task.FILE_OPERATION);
 		}
 

Modified: trunk/src/org/griphyn/vdl/karajan/monitor/monitors/swing/SimpleTableClassRenderer.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/monitor/monitors/swing/SimpleTableClassRenderer.java	2012-07-08 00:33:44 UTC (rev 5822)
+++ trunk/src/org/griphyn/vdl/karajan/monitor/monitors/swing/SimpleTableClassRenderer.java	2012-07-08 00:35:40 UTC (rev 5823)
@@ -31,6 +31,7 @@
 import org.griphyn.vdl.karajan.monitor.common.StatefulItemModel;
 import org.griphyn.vdl.karajan.monitor.items.StatefulItem;
 import org.griphyn.vdl.karajan.monitor.monitors.ansi.GlobalTimer;
+import org.griphyn.vdl.karajan.monitor.monitors.ansi.SafeTimerTask;
 
 public class SimpleTableClassRenderer extends JScrollPane implements ClassRenderer {
     private JTable table;
@@ -74,8 +75,8 @@
         public Model(StatefulItemClassSet items, int updateInterval) {
             this.items = items;
             update();
-            GlobalTimer.getTimer().schedule(ta = new TimerTask() {
-				public void run() {
+            GlobalTimer.getTimer().schedule(ta = new SafeTimerTask() {
+				public void runTask() {
 					update();
 				}}, updateInterval, updateInterval);
         } 

Modified: trunk/src/org/griphyn/vdl/karajan/monitor/monitors/swing/SwingMonitor.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/monitor/monitors/swing/SwingMonitor.java	2012-07-08 00:33:44 UTC (rev 5822)
+++ trunk/src/org/griphyn/vdl/karajan/monitor/monitors/swing/SwingMonitor.java	2012-07-08 00:35:40 UTC (rev 5823)
@@ -28,7 +28,9 @@
 import javax.swing.JFrame;
 import javax.swing.JTabbedPane;
 
+import org.griphyn.vdl.karajan.monitor.StatefulItemClassSet;
 import org.griphyn.vdl.karajan.monitor.SystemState;
+import org.griphyn.vdl.karajan.monitor.items.ApplicationItem;
 import org.griphyn.vdl.karajan.monitor.items.StatefulItem;
 import org.griphyn.vdl.karajan.monitor.items.StatefulItemClass;
 import org.griphyn.vdl.karajan.monitor.monitors.AbstractMonitor;
@@ -65,8 +67,9 @@
 		tablemap.put(StatefulItemClass.WORKFLOW, workflows);
 		tabs.add("Workflows", (Component) workflows);
 		
-		ClassRenderer applications = new ApplicationTable("Applications",
-				getState().getItemClassSet(StatefulItemClass.APPLICATION));
+		StatefulItemClassSet<ApplicationItem> appSet =
+		    getState().getItemClassSet(StatefulItemClass.APPLICATION);
+		ClassRenderer applications = new ApplicationTable("Applications", appSet);
 		tablemap.put(StatefulItemClass.APPLICATION, applications);
 		tabs.add("Applications", (Component) applications);
 		

Added: trunk/src/org/griphyn/vdl/karajan/monitor/processors/AbstractMessageProcessor.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/monitor/processors/AbstractMessageProcessor.java	                        (rev 0)
+++ trunk/src/org/griphyn/vdl/karajan/monitor/processors/AbstractMessageProcessor.java	2012-07-08 00:35:40 UTC (rev 5823)
@@ -0,0 +1,21 @@
+//----------------------------------------------------------------------
+//This code is developed as part of the Java CoG Kit project
+//The terms of the license can be found at http://www.cogkit.org/license
+//This message may not be removed or altered.
+//----------------------------------------------------------------------
+
+/*
+ * Created on May 31, 2012
+ */
+package org.griphyn.vdl.karajan.monitor.processors;
+
+public abstract class AbstractMessageProcessor implements LogMessageProcessor {
+
+    protected abstract Class<?> getSupportedSource();
+    
+    @Override
+    public String getSupportedSourceName() {
+        return getSupportedSource().getName();
+    }
+    
+}

Added: trunk/src/org/griphyn/vdl/karajan/monitor/processors/AbstractSwiftProcessor.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/monitor/processors/AbstractSwiftProcessor.java	                        (rev 0)
+++ trunk/src/org/griphyn/vdl/karajan/monitor/processors/AbstractSwiftProcessor.java	2012-07-08 00:35:40 UTC (rev 5823)
@@ -0,0 +1,29 @@
+//----------------------------------------------------------------------
+//This code is developed as part of the Java CoG Kit project
+//The terms of the license can be found at http://www.cogkit.org/license
+//This message may not be removed or altered.
+//----------------------------------------------------------------------
+
+/*
+ * Created on Jul 7, 2012
+ */
+package org.griphyn.vdl.karajan.monitor.processors;
+
+import org.griphyn.vdl.karajan.monitor.SystemState;
+
+
+public abstract class AbstractSwiftProcessor implements LogMessageProcessor {
+    @Override
+    public final String getSupportedSourceName() {
+        return "swift";
+    }
+
+    public abstract String getMessageHeader();
+
+    @Override
+    public final void processMessage(SystemState state, Object message, Object details) {
+        throw new UnsupportedOperationException();
+    }
+    
+    public abstract void processMessage(SystemState state, SimpleParser p, Object details);
+}

Added: trunk/src/org/griphyn/vdl/karajan/monitor/processors/AppEndProcessor.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/monitor/processors/AppEndProcessor.java	                        (rev 0)
+++ trunk/src/org/griphyn/vdl/karajan/monitor/processors/AppEndProcessor.java	2012-07-08 00:35:40 UTC (rev 5823)
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2012 University of Chicago
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+/*
+ * Created on Jan 29, 2007
+ */
+package org.griphyn.vdl.karajan.monitor.processors;
+
+import org.apache.log4j.Level;
+import org.griphyn.vdl.karajan.monitor.SystemState;
+import org.griphyn.vdl.karajan.monitor.items.StatefulItem;
+import org.griphyn.vdl.karajan.monitor.items.StatefulItemClass;
+
+public class AppEndProcessor extends AbstractSwiftProcessor {
+
+    public Level getSupportedLevel() {
+        return Level.DEBUG;
+    }
+
+    @Override
+    public String getMessageHeader() {
+        return "JOB_END";
+    }
+
+    public void processMessage(SystemState state, SimpleParser p, Object details) {
+        try {
+            p.skip("jobid=");
+            String id = p.word();
+
+            StatefulItem app = state.getItemByID(id,
+                StatefulItemClass.APPLICATION);
+            state.removeItem(app);
+            state.getStats("apps").remove();
+        }
+        catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+}

Deleted: trunk/src/org/griphyn/vdl/karajan/monitor/processors/AppProcessor.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/monitor/processors/AppProcessor.java	2012-07-08 00:33:44 UTC (rev 5822)
+++ trunk/src/org/griphyn/vdl/karajan/monitor/processors/AppProcessor.java	2012-07-08 00:35:40 UTC (rev 5823)
@@ -1,99 +0,0 @@
-/*
- * Copyright 2012 University of Chicago
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-/*
- * Created on Jan 29, 2007
- */
-package org.griphyn.vdl.karajan.monitor.processors;
-
-import java.util.Date;
-
-import org.apache.log4j.Level;
-import org.griphyn.vdl.karajan.monitor.SystemState;
-import org.griphyn.vdl.karajan.monitor.items.ApplicationItem;
-import org.griphyn.vdl.karajan.monitor.items.StatefulItem;
-import org.griphyn.vdl.karajan.monitor.items.StatefulItemClass;
-
-public class AppProcessor implements LogMessageProcessor {
-
-    public Object getSupportedCategory() {
-        return Level.DEBUG;
-    }
-
-    public String getSupportedSource() {
-        return "org.griphyn.vdl.karajan.lib.Log";
-    }
-
-    public void processMessage(SystemState state, Object message, Object details) {
-        SimpleParser p = new SimpleParser(String.valueOf(message));
-        try {
-            String appname;
-            boolean add;
-            if (p.matchAndSkip("JOB_START ")) {
-                add = true;
-            }
-            else if (p.matchAndSkip("JOB_END ")) {
-                add = false;
-            }
-            else {
-                return;
-            }
-            p.matchAndSkip("jobid=");
-            String id = p.word();
-
-            if (add) {
-                p.matchAndSkip("tr=");
-                appname = p.word();
-                String args = "";
-                if (p.matchAndSkip("arguments=[")) {
-                    p.beginToken();
-                    p.markTo("]");
-                    args = p.getToken();
-                }
-                p.skip("host=");
-                String host = p.word();
-                
-                ApplicationItem app = (ApplicationItem) state.getItemByID(id,
-                    StatefulItemClass.APPLICATION);
-                boolean newapp = app == null;
-                if (newapp) {
-                    app = new ApplicationItem(id);
-                }
-                app.setArguments(args);
-                app.setHost(host);
-                app.setName(appname);
-                app.setStartTime(new Date());
-                if (newapp) {
-                    state.addItem(app);
-                }
-                else {
-                    state.itemUpdated(app);
-                }
-                state.getStats("apps").add();
-            }
-            else {
-                StatefulItem app = state.getItemByID(id,
-                    StatefulItemClass.APPLICATION);
-                state.removeItem(app);
-                state.getStats("apps").remove();
-            }
-        }
-        catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
-}

Added: trunk/src/org/griphyn/vdl/karajan/monitor/processors/AppStartProcessor.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/monitor/processors/AppStartProcessor.java	                        (rev 0)
+++ trunk/src/org/griphyn/vdl/karajan/monitor/processors/AppStartProcessor.java	2012-07-08 00:35:40 UTC (rev 5823)
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2012 University of Chicago
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+/*
+ * Created on Jan 29, 2007
+ */
+package org.griphyn.vdl.karajan.monitor.processors;
+
+import java.util.Date;
+
+import org.apache.log4j.Level;
+import org.griphyn.vdl.karajan.monitor.SystemState;
+import org.griphyn.vdl.karajan.monitor.items.ApplicationItem;
+import org.griphyn.vdl.karajan.monitor.items.StatefulItemClass;
+
+public class AppStartProcessor extends AbstractSwiftProcessor {
+
+    public Level getSupportedLevel() {
+        return Level.DEBUG;
+    }
+
+    @Override
+    public String getMessageHeader() {
+        return "JOB_START";
+    }
+
+    public void processMessage(SystemState state, SimpleParser p, Object details) {
+        try {
+            p.skip("jobid=");
+            String id = p.word();
+
+            p.matchAndSkip("tr=");
+            String appname = p.word();
+            String args = "";
+            if (p.matchAndSkip("arguments=[")) {
+                p.beginToken();
+                p.markTo("]");
+                args = p.getToken();
+            }
+            p.skip("host=");
+            String host = p.word();
+            
+            ApplicationItem app = (ApplicationItem) state.getItemByID(id,
+                StatefulItemClass.APPLICATION);
+            boolean newapp = app == null;
+            if (newapp) {
+                app = new ApplicationItem(id);
+            }
+            app.setArguments(args);
+            app.setHost(host);
+            app.setName(appname);
+            app.setStartTime(new Date());
+            if (newapp) {
+                state.addItem(app);
+            }
+            else {
+                state.itemUpdated(app);
+            }
+            state.getStats("apps").add();
+        }
+        catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+}

Modified: trunk/src/org/griphyn/vdl/karajan/monitor/processors/AppThreadProcessor.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/monitor/processors/AppThreadProcessor.java	2012-07-08 00:33:44 UTC (rev 5822)
+++ trunk/src/org/griphyn/vdl/karajan/monitor/processors/AppThreadProcessor.java	2012-07-08 00:35:40 UTC (rev 5823)
@@ -27,41 +27,38 @@
 import org.griphyn.vdl.karajan.monitor.items.StatefulItem;
 import org.griphyn.vdl.karajan.monitor.items.StatefulItemClass;
 
-public class AppThreadProcessor implements LogMessageProcessor {
+public class AppThreadProcessor extends AbstractSwiftProcessor {
 
-	public Object getSupportedCategory() {
+	public Level getSupportedLevel() {
 		return Level.DEBUG;
 	}
 
-	public String getSupportedSource() {
-		return "org.griphyn.vdl.karajan.lib.Log";
+	public String getMessageHeader() {
+		return "THREAD_ASSOCIATION";
 	}
 
-	public void processMessage(SystemState state, Object message, Object details) {
-		SimpleParser p = new SimpleParser(String.valueOf(message));
-		try {
+	public void processMessage(SystemState state, SimpleParser p, Object details) {
+	    try {
 			String appid, threadid, replicationgroup;
-			if (p.matchAndSkip("THREAD_ASSOCIATION ")) {
-			    p.skip("jobid=");
-				appid = p.word();
-				p.skip("thread=");
-				threadid = p.word();
-				p.skip("replicationGroup=");
-				replicationgroup = p.word();
+		    p.skip("jobid=");
+			appid = p.word();
+			p.skip("thread=");
+			threadid = p.word();
+			p.skip("replicationGroup=");
+			replicationgroup = p.word();
 				
-				StatefulItem app = state.getItemByID(appid, StatefulItemClass.APPLICATION);
-				if (app == null) {
-					app = new ApplicationItem(appid);
-					state.addItem(app);
-				}
+			StatefulItem app = state.getItemByID(appid, StatefulItemClass.APPLICATION);
+			if (app == null) {
+				app = new ApplicationItem(appid);
+				state.addItem(app);
+			}
 				
-				StatefulItem thread = state.getItemByID(threadid, StatefulItemClass.BRIDGE);
-				if (thread == null) {
-					thread = new Bridge(threadid);
-					thread.setParent(app);
-					state.addItem(thread);
-					app.addChild(thread);
-				}
+			StatefulItem thread = state.getItemByID(threadid, StatefulItemClass.BRIDGE);
+			if (thread == null) {
+				thread = new Bridge(threadid);
+				thread.setParent(app);
+				state.addItem(thread);
+				app.addChild(thread);
 			}
 		}
 		catch (Exception e) {

Modified: trunk/src/org/griphyn/vdl/karajan/monitor/processors/ExecutionContextProcessor.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/monitor/processors/ExecutionContextProcessor.java	2012-07-08 00:33:44 UTC (rev 5822)
+++ trunk/src/org/griphyn/vdl/karajan/monitor/processors/ExecutionContextProcessor.java	2012-07-08 00:35:40 UTC (rev 5823)
@@ -25,14 +25,14 @@
 import org.griphyn.vdl.karajan.VDL2ExecutionContext;
 import org.griphyn.vdl.karajan.monitor.SystemState;
 
-public class ExecutionContextProcessor implements LogMessageProcessor {
+public class ExecutionContextProcessor extends AbstractMessageProcessor {
 
-	public Object getSupportedCategory() {
+	public Level getSupportedLevel() {
 		return Level.INFO;
 	}
 
-	public String getSupportedSource() {
-		return VDL2ExecutionContext.class.getName();
+	public Class<?> getSupportedSource() {
+		return VDL2ExecutionContext.class;
 	}
 
 	public void processMessage(SystemState state, Object message, Object details) {

Added: trunk/src/org/griphyn/vdl/karajan/monitor/processors/ForeachItEndProcessor.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/monitor/processors/ForeachItEndProcessor.java	                        (rev 0)
+++ trunk/src/org/griphyn/vdl/karajan/monitor/processors/ForeachItEndProcessor.java	2012-07-08 00:35:40 UTC (rev 5823)
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2012 University of Chicago
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+/*
+ * Created on Jan 29, 2007
+ */
+package org.griphyn.vdl.karajan.monitor.processors;
+
+import org.apache.log4j.Level;
+import org.griphyn.vdl.karajan.monitor.SystemState;
+import org.griphyn.vdl.karajan.monitor.items.StatefulItemClass;
+import org.griphyn.vdl.karajan.monitor.items.TraceItem;
+
+public class ForeachItEndProcessor extends AbstractSwiftProcessor {
+
+    public Level getSupportedLevel() {
+        return Level.DEBUG;
+    }
+
+    public String getMessageHeader() {
+        return "FOREACH_IT_END";
+    }
+
+    public void processMessage(SystemState state, SimpleParser p, Object details) {
+        try {
+            p.skip("line=");
+            String line = p.word();
+
+            TraceItem ti = (TraceItem) state.getItemByID(line, StatefulItemClass.TRACE);
+            ti.incEnded();
+            state.itemUpdated(ti);
+        }
+        catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+}

Added: trunk/src/org/griphyn/vdl/karajan/monitor/processors/ForeachItStartProcessor.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/monitor/processors/ForeachItStartProcessor.java	                        (rev 0)
+++ trunk/src/org/griphyn/vdl/karajan/monitor/processors/ForeachItStartProcessor.java	2012-07-08 00:35:40 UTC (rev 5823)
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2012 University of Chicago
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+/*
+ * Created on Jan 29, 2007
+ */
+package org.griphyn.vdl.karajan.monitor.processors;
+
+import org.apache.log4j.Level;
+import org.griphyn.vdl.karajan.monitor.SystemState;
+import org.griphyn.vdl.karajan.monitor.items.StatefulItemClass;
+import org.griphyn.vdl.karajan.monitor.items.TraceItem;
+
+public class ForeachItStartProcessor extends AbstractSwiftProcessor {
+
+    public Level getSupportedLevel() {
+        return Level.DEBUG;
+    }
+
+    public String getMessageHeader() {
+        return "FOREACH_IT_START";
+    }
+
+    public void processMessage(SystemState state, SimpleParser p, Object details) {
+        try {
+            p.skip("line=");
+            String line = p.word();
+
+            TraceItem ti = (TraceItem) state.getItemByID(line, StatefulItemClass.TRACE);
+            if (ti == null) {
+                ti = new TraceItem(line);
+                state.addItem(ti);
+            }
+            ti.incStarted();
+            state.itemUpdated(ti);
+        }
+        catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+}

Modified: trunk/src/org/griphyn/vdl/karajan/monitor/processors/JobProcessor.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/monitor/processors/JobProcessor.java	2012-07-08 00:33:44 UTC (rev 5822)
+++ trunk/src/org/griphyn/vdl/karajan/monitor/processors/JobProcessor.java	2012-07-08 00:35:40 UTC (rev 5823)
@@ -24,7 +24,7 @@
 
 public class JobProcessor extends TaskProcessor {
 
-	public String getSupportedSource() {
-		return Execute.class.getName();
+	public Class<?> getSupportedSource() {
+		return Execute.class;
 	}	
 }

Modified: trunk/src/org/griphyn/vdl/karajan/monitor/processors/LogMessageProcessor.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/monitor/processors/LogMessageProcessor.java	2012-07-08 00:33:44 UTC (rev 5822)
+++ trunk/src/org/griphyn/vdl/karajan/monitor/processors/LogMessageProcessor.java	2012-07-08 00:35:40 UTC (rev 5823)
@@ -20,12 +20,13 @@
  */
 package org.griphyn.vdl.karajan.monitor.processors;
 
+import org.apache.log4j.Level;
 import org.griphyn.vdl.karajan.monitor.SystemState;
 
 public interface LogMessageProcessor {
 	void processMessage(SystemState state, Object message, Object details);
 	
-	String getSupportedSource();
+	String getSupportedSourceName();
 	
-	Object getSupportedCategory();
+	Level getSupportedLevel();
 }

Added: trunk/src/org/griphyn/vdl/karajan/monitor/processors/ProcedureEndProcessor.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/monitor/processors/ProcedureEndProcessor.java	                        (rev 0)
+++ trunk/src/org/griphyn/vdl/karajan/monitor/processors/ProcedureEndProcessor.java	2012-07-08 00:35:40 UTC (rev 5823)
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2012 University of Chicago
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+/*
+ * Created on Jan 29, 2007
+ */
+package org.griphyn.vdl.karajan.monitor.processors;
+
+import org.apache.log4j.Level;
+import org.griphyn.vdl.karajan.monitor.SystemState;
+import org.griphyn.vdl.karajan.monitor.items.StatefulItemClass;
+import org.griphyn.vdl.karajan.monitor.items.TraceItem;
+
+public class ProcedureEndProcessor extends AbstractSwiftProcessor {
+
+	public Level getSupportedLevel() {
+		return Level.DEBUG;
+	}
+
+	public String getMessageHeader() {
+		return "PROCEDURE_END";
+	}
+
+	public void processMessage(SystemState state, SimpleParser p, Object details) {
+		try {
+		    state.incCompleted();
+		    
+		    p.skip("line=");
+            String line = p.word();
+            TraceItem ti = (TraceItem) state.getItemByID(line, StatefulItemClass.TRACE);
+            ti.incEnded();
+            state.itemUpdated(ti);
+		}
+		catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+
+}

Deleted: trunk/src/org/griphyn/vdl/karajan/monitor/processors/ProcedureProcessor.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/monitor/processors/ProcedureProcessor.java	2012-07-08 00:33:44 UTC (rev 5822)
+++ trunk/src/org/griphyn/vdl/karajan/monitor/processors/ProcedureProcessor.java	2012-07-08 00:35:40 UTC (rev 5823)
@@ -1,56 +0,0 @@
-/*
- * Copyright 2012 University of Chicago
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-/*
- * Created on Jan 29, 2007
- */
-package org.griphyn.vdl.karajan.monitor.processors;
-
-import org.apache.log4j.Level;
-import org.griphyn.vdl.karajan.monitor.SystemState;
-import org.griphyn.vdl.karajan.monitor.items.ApplicationItem;
-import org.griphyn.vdl.karajan.monitor.items.Bridge;
-import org.griphyn.vdl.karajan.monitor.items.StatefulItem;
-import org.griphyn.vdl.karajan.monitor.items.StatefulItemClass;
-
-public class ProcedureProcessor implements LogMessageProcessor {
-
-	public Object getSupportedCategory() {
-		return Level.INFO;
-	}
-
-	public String getSupportedSource() {
-		return "org.griphyn.vdl.karajan.lib.Log";
-	}
-
-	public void processMessage(SystemState state, Object message, Object details) {
-		SimpleParser p = new SimpleParser(String.valueOf(message));
-		try {
-			String appid, threadid, replicationgroup;
-			if (p.matchAndSkip("PROCEDURE ")) {
-			    state.incTotal();
-			}
-			else if (p.matchAndSkip("END_SUCCESS ")) {
-			    state.incCompleted();
-			}
-		}
-		catch (Exception e) {
-			e.printStackTrace();
-		}
-	}
-
-}

Added: trunk/src/org/griphyn/vdl/karajan/monitor/processors/ProcedureStartProcessor.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/monitor/processors/ProcedureStartProcessor.java	                        (rev 0)
+++ trunk/src/org/griphyn/vdl/karajan/monitor/processors/ProcedureStartProcessor.java	2012-07-08 00:35:40 UTC (rev 5823)
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2012 University of Chicago
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+/*
+ * Created on Jan 29, 2007
+ */
+package org.griphyn.vdl.karajan.monitor.processors;
+
+import org.apache.log4j.Level;
+import org.griphyn.vdl.karajan.monitor.SystemState;
+import org.griphyn.vdl.karajan.monitor.items.StatefulItemClass;
+import org.griphyn.vdl.karajan.monitor.items.TraceItem;
+
+public class ProcedureStartProcessor extends AbstractSwiftProcessor {
+
+	public Level getSupportedLevel() {
+		return Level.DEBUG;
+	}
+
+	public String getMessageHeader() {
+		return "PROCEDURE";
+	}
+
+	public void processMessage(SystemState state, SimpleParser p, Object details) {
+	    try {
+	        state.incTotal();
+	        
+	        p.skip("line=");
+	        String line = p.word();
+	        TraceItem ti = (TraceItem) state.getItemByID(line, StatefulItemClass.TRACE);
+            if (ti == null) {
+                ti = new TraceItem(line);
+                state.addItem(ti);
+            }
+            ti.incStarted();
+            state.itemUpdated(ti);
+		}
+		catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+
+}

Modified: trunk/src/org/griphyn/vdl/karajan/monitor/processors/SchedulerInfoProcessor.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/monitor/processors/SchedulerInfoProcessor.java	2012-07-08 00:33:44 UTC (rev 5822)
+++ trunk/src/org/griphyn/vdl/karajan/monitor/processors/SchedulerInfoProcessor.java	2012-07-08 00:35:40 UTC (rev 5823)
@@ -24,17 +24,15 @@
 import org.globus.cog.karajan.scheduler.WeightedHostScoreScheduler;
 import org.griphyn.vdl.karajan.monitor.SystemState;
 import org.griphyn.vdl.karajan.monitor.items.HostItem;
-import org.griphyn.vdl.karajan.monitor.items.StatefulItem;
-import org.griphyn.vdl.karajan.monitor.items.StatefulItemClass;
 
-public class SchedulerInfoProcessor implements LogMessageProcessor {
+public class SchedulerInfoProcessor extends AbstractMessageProcessor {
 
-	public Object getSupportedCategory() {
+	public Level getSupportedLevel() {
 		return Level.INFO;
 	}
 
-	public String getSupportedSource() {
-		return WeightedHostScoreScheduler.class.getName();
+	public Class<?> getSupportedSource() {
+		return WeightedHostScoreScheduler.class;
 	}
 
 	public void processMessage(SystemState state, Object message, Object details) {

Added: trunk/src/org/griphyn/vdl/karajan/monitor/processors/SummaryProcessor.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/monitor/processors/SummaryProcessor.java	                        (rev 0)
+++ trunk/src/org/griphyn/vdl/karajan/monitor/processors/SummaryProcessor.java	2012-07-08 00:35:40 UTC (rev 5823)
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2012 University of Chicago
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+/*
+ * Created on Aug 28, 2008
+ */
+package org.griphyn.vdl.karajan.monitor.processors;
+
+import org.apache.log4j.Level;
+import org.griphyn.vdl.karajan.lib.RuntimeStats.ProgressTicker;
+import org.griphyn.vdl.karajan.monitor.SystemState;
+import org.griphyn.vdl.karajan.monitor.items.StatefulItemClass;
+import org.griphyn.vdl.karajan.monitor.items.SummaryItem;
+
+public class SummaryProcessor extends AbstractMessageProcessor {
+
+	public Level getSupportedLevel() {
+		return Level.INFO;
+	}
+
+	public Class<?> getSupportedSource() {
+		return ProgressTicker.class;
+	}
+
+	public void processMessage(SystemState state, Object message, Object details) {
+		String msg = String.valueOf(message);
+		SummaryItem s;
+		synchronized(this) {
+		    s = (SummaryItem) state.getItemByID(SummaryItem.ID, StatefulItemClass.WORKFLOW);
+		    if (s == null) {
+		        s = new SummaryItem();
+		        state.addItem(s);
+		    }
+		}
+		String[] pairs = msg.split("  ");
+		for (String pair : pairs) {
+		    if (pair.equals("")) {
+		        continue;
+		    }
+		    String[] v = pair.split(":");
+		    s.setCount(v[0].trim(), Integer.parseInt(v[1]));
+		}
+		state.itemUpdated(s);
+	}
+}

Added: trunk/src/org/griphyn/vdl/karajan/monitor/processors/SwiftProcessorDispatcher.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/monitor/processors/SwiftProcessorDispatcher.java	                        (rev 0)
+++ trunk/src/org/griphyn/vdl/karajan/monitor/processors/SwiftProcessorDispatcher.java	2012-07-08 00:35:40 UTC (rev 5823)
@@ -0,0 +1,54 @@
+//----------------------------------------------------------------------
+//This code is developed as part of the Java CoG Kit project
+//The terms of the license can be found at http://www.cogkit.org/license
+//This message may not be removed or altered.
+//----------------------------------------------------------------------
+
+/*
+ * Created on Jul 7, 2012
+ */
+package org.griphyn.vdl.karajan.monitor.processors;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.log4j.Level;
+import org.apache.log4j.Priority;
+import org.griphyn.vdl.karajan.monitor.SystemState;
+
+public class SwiftProcessorDispatcher implements LogMessageProcessor {
+    private Level level;
+    private Map<String, AbstractSwiftProcessor> processors;
+    
+    public SwiftProcessorDispatcher(Level level) {
+        this.level = level;
+        processors = new HashMap<String, AbstractSwiftProcessor>();
+    }
+    
+    public void add(AbstractSwiftProcessor p) {
+        processors.put(p.getMessageHeader(), p);
+    }
+
+    @Override
+    public void processMessage(SystemState state, Object message, Object details) {
+        SimpleParser p = new SimpleParser(String.valueOf(message));
+        
+        p.skipWhitespace();
+        String header = p.word();
+        AbstractSwiftProcessor proc = processors.get(header);
+        if (proc != null) {
+            p.skipWhitespace();
+            proc.processMessage(state, p, details);
+        }
+    }
+
+    @Override
+    public String getSupportedSourceName() {
+        return "swift";
+    }
+
+    @Override
+    public Level getSupportedLevel() {
+        return level;
+    }
+}

Modified: trunk/src/org/griphyn/vdl/karajan/monitor/processors/TaskProcessor.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/monitor/processors/TaskProcessor.java	2012-07-08 00:33:44 UTC (rev 5822)
+++ trunk/src/org/griphyn/vdl/karajan/monitor/processors/TaskProcessor.java	2012-07-08 00:35:40 UTC (rev 5823)
@@ -28,14 +28,14 @@
 import org.griphyn.vdl.karajan.monitor.items.StatefulItemClass;
 import org.griphyn.vdl.karajan.monitor.items.TaskItem;
 
-public class TaskProcessor implements LogMessageProcessor {
+public class TaskProcessor extends AbstractMessageProcessor {
 
-    public Object getSupportedCategory() {
+    public Level getSupportedLevel() {
         return Level.DEBUG;
     }
 
-    public String getSupportedSource() {
-        return "org.globus.cog.karajan.workflow.nodes.grid.AbstractGridNode";
+    public Class<?> getSupportedSource() {
+        return org.globus.cog.karajan.workflow.nodes.grid.AbstractGridNode.class;
     }
 
     public void processMessage(SystemState state, Object message, Object details) {
@@ -89,7 +89,7 @@
                             state.removeItem(si);
                         }
                         else {
-                            ((TaskItem) si).setStatus(status);
+                            si.setStatus(status);
                             state.itemUpdated(si);
                         }
                     }

Deleted: trunk/src/org/griphyn/vdl/karajan/monitor/processors/TraceProcessor.java
===================================================================
--- trunk/src/org/griphyn/vdl/karajan/monitor/processors/TraceProcessor.java	2012-07-08 00:33:44 UTC (rev 5822)
+++ trunk/src/org/griphyn/vdl/karajan/monitor/processors/TraceProcessor.java	2012-07-08 00:35:40 UTC (rev 5823)
@@ -1,81 +0,0 @@
-/*
- * Copyright 2012 University of Chicago
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-/*
- * Created on Jan 29, 2007
- */
-package org.griphyn.vdl.karajan.monitor.processors;
-
-import org.apache.log4j.Level;
-import org.griphyn.vdl.karajan.monitor.SystemState;
-import org.griphyn.vdl.karajan.monitor.items.StatefulItemClass;
-import org.griphyn.vdl.karajan.monitor.items.TraceItem;
-
-public class TraceProcessor implements LogMessageProcessor {
-
-    public Object getSupportedCategory() {
-        return Level.INFO;
-    }
-
-    public String getSupportedSource() {
-        return "org.griphyn.vdl.karajan.lib.Log";
-    }
-
-    public void processMessage(SystemState state, Object message, Object details) {
-        SimpleParser p = new SimpleParser(String.valueOf(message));
-        try {
-            String line = null;
-            boolean started = false, ended = false;
-            if (p.matchAndSkip("PROCEDURE line=")) {
-                line = p.word();
-                started = true;
-            }
-            else if (p.matchAndSkip("PROCEDURE_END line=")) {
-                line = p.word();
-                ended = true;
-            }
-            else if (p.matchAndSkip("FOREACH_IT_START line=")) {
-                line = p.word();
-                started = true;
-            }
-            else if (p.matchAndSkip("FOREACH_IT_END line=")) {
-                line = p.word();
-                ended = true;
-            }
-
-            if (line != null) {
-                TraceItem ti = (TraceItem) state.getItemByID(line,
-                    StatefulItemClass.TRACE);
-                if (ti == null) {
-                    ti = new TraceItem(line);
-                    state.addItem(ti);
-                }
-                if (started) {
-                    ti.incStarted();
-                }
-                else if (ended) {
-                    ti.incEnded();
-                }
-                state.itemUpdated(ti);
-            }
-        }
-        catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
-
-}




More information about the Swift-commit mailing list