most important changes:

gskc [2002-03-26 00:05:16]
most important changes:
  - Realizations in start, middle tasks use demo/Input for graphical
  user interaction
  - TaskPanel and ReplPanel don't create a new JPanel object for every
  entry in the JList .. however, the system is still soooooo damned
  slow :(
Filename
Makefile
demo/NPortal.java
proc/DefaultLog.java
proc/Processor.java
test/svr1/tpSingle.xml
test/svr1/workflows/svr1/middle/Realization.class
test/svr1/workflows/svr1/middle/Realization.java
test/svr1/workflows/svr1/start/Realization.class
test/svr1/workflows/svr1/start/Realization.java
diff --git a/Makefile b/Makefile
index 9e7cb6a..da465f0 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 JCC=javac

 all:
-	$(JCC) *java net/*java proc/*java util/*java xml/*java proc/nrl/*java demo/*java
+	$(JCC) -g *java net/*java proc/*java util/*java xml/*java proc/nrl/*java demo/*java

 clean:
 	rm -f *class net/*class proc/*class util/*class xml/*class proc/nrl/*class demo/*class
diff --git a/demo/NPortal.java b/demo/NPortal.java
index b98863b..70bbd21 100644
--- a/demo/NPortal.java
+++ b/demo/NPortal.java
@@ -139,6 +139,95 @@ public final class NPortal {

     return (_procScrollPane);
   }
+
+  // CELL-RENDERER //////////////////////////////////////////////////
+  final static class CellRenderer extends JPanel implements ListCellRenderer {
+    final JLabel _labelTask = new JLabel();
+    final JLabel _labelProc;
+    final JLabel _labelState = new JLabel();
+    final JLabel _labelProgress = new JLabel();
+    final JPanel _panelProgress = new JPanel();
+    final Font headerFont = new Font("Verdana", Font.BOLD, 18);
+    final Font regularFont = new Font("Verdana", Font.PLAIN, 12);
+    static int count = 0;
+    CellRenderer(boolean taskInfo) {
+      if (taskInfo) {
+        _labelProc = null;
+        setLayout(new GridLayout(1, 3, 5, 5));
+        add(_labelTask); add(_labelState); add(_panelProgress);
+        _panelProgress.add(_labelProgress);
+      } else {
+        _labelProc = new JLabel();
+        setLayout(new GridLayout(1, 4, 5, 5));
+        add(_labelTask); add(_labelProc); add(_labelState); add(_panelProgress);
+        _panelProgress.add(_labelProgress);
+      }
+      setBackground(Color.gray);
+      setOpaque(true);
+    }
+    public Component getListCellRendererComponent(JList list,
+        Object value, int index, boolean isSelected, boolean cellHasFocus) {
+      if (value.toString().equals("HEADER")) {
+        _labelTask.setFont(headerFont);
+        _labelState.setFont(headerFont);
+        _labelProgress.setFont(headerFont);
+
+        _labelTask.setText(_labelProc==null ? "Task name" : "Replicating");
+        _labelState.setText("State");
+        _labelProgress.setText("Progress");
+        _panelProgress.setBackground(Color.gray);
+
+        if (_labelProc != null) {
+          _labelProc.setFont(headerFont);
+          _labelProc.setText("Processor");
+        }
+
+      } else if (value instanceof DisplayItem) {
+        DisplayItem di = (DisplayItem) value;
+        _labelTask.setFont(regularFont);
+        _labelState.setFont(regularFont);
+        _labelProgress.setFont(regularFont);
+
+        _labelTask.setText(di._taskName);
+        _labelProgress.setText("");
+
+        if (_labelProc == null) {
+          // running|finished|killed|resultDisposed
+          if (di.isActive()) {
+            _panelProgress.setBackground(Color.green);
+            _labelState.setText("executing");
+          } else if (di.isExited()) {
+            _panelProgress.setBackground(Color.black);
+            _labelState.setText("completed");
+          } else if (di.isKilled()) {
+            _panelProgress.setBackground(Color.orange);
+            _labelState.setText("results disposed");
+          } else if (di.isToKill()) {
+            _panelProgress.setBackground(Color.red);
+            _labelState.setText("dispose result");
+          }
+        } else {
+          // replicating|replicated|procDown|timedOut
+          _labelProc.setFont(regularFont);
+          _labelProc.setText(di._procName);
+          if (di.isReplActive()) {
+            _panelProgress.setBackground(Color.green);
+            _labelState.setText("replicating");
+          } else if (di.isReplExited()) {
+            _panelProgress.setBackground(Color.black);
+            _labelState.setText("completed");
+          } else if (di.isReplProcDown()) {
+            _panelProgress.setBackground(Color.red);
+            _labelState.setText("processor down");
+          } else if (di.isReplTimedOut()) {
+            _panelProgress.setBackground(Color.orange);
+            _labelState.setText("timed-out");
+          }
+        }
+      }
+      return this;
+    }
+  }

   // TASK-INFO DISPLAY //////////////////////////////////////////////
   final JPanel _taskPanel;
@@ -151,43 +240,7 @@ public final class NPortal {
    *
    */
   private JScrollPane initTaskPanel() {
-    _taskList.setCellRenderer(new ListCellRenderer() {
-      public Component getListCellRendererComponent(JList list,
-          Object value, int index, boolean isSelected, boolean cellHasFocus) {
-        JPanel panel = new JPanel(new GridLayout(1, 3, 5, 5));
-        if (value.toString().equals("HEADER")) {
-          JLabel label = null;
-          Font font = new Font("Verdana", Font.BOLD, 18);
-          panel.add(label = new JLabel("Task name"));
-          label.setFont(font);
-          panel.add(label = new JLabel("State"));
-          label.setFont(font);
-          panel.add(label = new JLabel("Progress"));
-          label.setFont(font);
-        } else if (value instanceof DisplayItem) {
-          DisplayItem di = (DisplayItem) value;
-          JPanel p = new JPanel();
-          JLabel l = new JLabel();
-          panel.add(new JLabel(di._taskName));
-          panel.add(l); // running|finished|killed|resultDisposed
-          panel.add(p);
-          if (di.isActive()) {
-            p.setBackground(Color.green);
-            l.setText("executing");
-          } else if (di.isExited()) {
-            p.setBackground(Color.black);
-            l.setText("completed");
-          } else if (di.isKilled()) {
-            p.setBackground(Color.orange);
-            l.setText("results disposed");
-          } else if (di.isToKill()) {
-            p.setBackground(Color.red);
-            l.setText("dispose result");
-          }
-        }
-        return panel;
-      }
-    });
+    _taskList.setCellRenderer(new CellRenderer(true));
     _taskListModel.addElement("HEADER");

     _taskPanel.setLayout(new BorderLayout());
@@ -207,46 +260,7 @@ public final class NPortal {
    * initialise the replicating-info display panel
    */
   private JScrollPane initReplPanel() {
-    _replList.setCellRenderer(new ListCellRenderer() {
-      public Component getListCellRendererComponent(JList list,
-          Object value, int index, boolean isSelected, boolean cellHasFocus) {
-        JPanel panel = new JPanel(new GridLayout(1, 4, 5, 5));
-        if (value.toString().equals("HEADER")) {
-          JLabel label = null;
-          Font font = new Font("Verdana", Font.BOLD, 18);
-          panel.add(label = new JLabel("Replicating"));
-          label.setFont(font);
-          panel.add(label = new JLabel("Processor"));
-          label.setFont(font);
-          panel.add(label = new JLabel("State"));
-          label.setFont(font);
-          panel.add(label = new JLabel("Progress"));
-          label.setFont(font);
-        } else if (value instanceof DisplayItem) {
-          DisplayItem di = (DisplayItem) value;
-          JPanel p = new JPanel();
-          JLabel l = new JLabel("started");
-          panel.add(new JLabel(di._taskName));
-          panel.add(new JLabel(di._procName));
-          panel.add(l); // replicating|replicated|procDown|timedOut
-          panel.add(p);
-          if (di.isReplActive()) {
-            p.setBackground(Color.green);
-            l.setText("replicating");
-          } else if (di.isReplExited()) {
-            p.setBackground(Color.black);
-            l.setText("completed");
-          } else if (di.isReplProcDown()) {
-            p.setBackground(Color.red);
-            l.setText("processor down");
-          } else if (di.isReplTimedOut()) {
-            p.setBackground(Color.orange);
-            l.setText("timed-out");
-          }
-        }
-        return panel;
-      }
-    });
+    _replList.setCellRenderer(new CellRenderer(false));
     _replListModel.addElement("HEADER");

     _replPanel.setLayout(new BorderLayout());
diff --git a/proc/DefaultLog.java b/proc/DefaultLog.java
index 385a850..0fcde75 100644
--- a/proc/DefaultLog.java
+++ b/proc/DefaultLog.java
@@ -16,21 +16,39 @@ public class DefaultLog implements Log {
      * NRLProcessData = v.data2();
      * You can get the taskname from that
      */
-    public void executeTaskLocal(Version v) { }
-    public void completedTaskLocal(Version v) { }
-    public void stopTaskLocal(Version v) { }
-    public void ignoreResultsOfStoppedTask(Version v) { }
+    public void executeTaskLocal(Version v) {
+      System.out.println("psl.survivor.proc.DefaultLog :: executeTaskLocal" + " = " + v);
+    }
+    public void completedTaskLocal(Version v) {
+      System.out.println("psl.survivor.proc.DefaultLog :: completedTaskLocal" + " = " + v);
+    }
+    public void stopTaskLocal(Version v) {
+      System.out.println("psl.survivor.proc.DefaultLog :: stopTaskLocal" + " = " + v);
+    }
+    public void ignoreResultsOfStoppedTask(Version v) {
+      System.out.println("psl.survivor.proc.DefaultLog :: ignoreResultsOfStoppedTask" + " = " + v);
+    }

     // task replication
     /*
      * TaskProcessorHandle = v.data();
      * You can get the task processor's name from that.
      */
-    public void replicatingTask(Version v, Version finalVer) { }
-    public void doneReplicatingTask(Version v) { }
-    public void processorDown(Version v) { }
-    public void taskTimeOut(Version v) { }
+    public void replicatingTask(Version v, Version finalVer) {
+      System.out.println("psl.survivor.proc.DefaultLog :: replicatingTask" + " = " + v);
+    }
+    public void doneReplicatingTask(Version v) {
+      System.out.println("psl.survivor.proc.DefaultLog :: doneReplicatingTask" + " = " + v);
+    }
+    public void processorDown(Version v) {
+      System.out.println("psl.survivor.proc.DefaultLog :: processorDown" + " = " + v);
+    }
+    public void taskTimeOut(Version v) {
+      System.out.println("psl.survivor.proc.DefaultLog :: taskTimeOut" + " = " + v);
+    }

     // processor capabilities
-    public void addedCapability(Object o) { }
+    public void addedCapability(Object o) {
+      System.out.println("psl.survivor.proc.DefaultLog :: addedCapability" + " = " + o);
+    }
 }
diff --git a/proc/Processor.java b/proc/Processor.java
index 6269735..cc1e48d 100644
--- a/proc/Processor.java
+++ b/proc/Processor.java
@@ -3,7 +3,7 @@ package psl.survivor.proc;
 import java.util.Set;
 import java.util.Date;
 import java.util.Vector;
-import java.util.HashSet;
+import java.util.TreeSet;
 import java.util.ArrayList;

 import java.net.InetAddress;
@@ -82,7 +82,7 @@ public abstract class Processor implements Runnable {
     public Processor(String name, int tcpPort, String rmiName,
 		     String wfDefPath, Log l) {
 	_log = l;
-	_stoppedTasks = new HashSet();
+	_stoppedTasks = new TreeSet();
 	_versionCache = new VersionCache();
 	_taskQueue = new Vector();
 	_replicatorQueue = new Vector();
diff --git a/test/svr1/tpSingle.xml b/test/svr1/tpSingle.xml
index 862df5c..ce2d11b 100644
--- a/test/svr1/tpSingle.xml
+++ b/test/svr1/tpSingle.xml
@@ -1,5 +1,3 @@
-<TaskProcessor name="tp1" RMIName="tp1" TCPPort="8008" WorkflowDefinitionPath="test/svr1" proctype="psl.survivor.proc.nrl.NRLProcessor">
+<TaskProcessor name="tpSingle" RMIName="tpSingle" TCPPort="9008" WorkflowDefinitionPath="test/svr1" proctype="psl.survivor.proc.nrl.NRLProcessor">
 <Capability name="start" value="true"/>
-<Capability name="middle" value="true"/>
-<Capability name="end" value="true"/>
 </TaskProcessor>
diff --git a/test/svr1/workflows/svr1/middle/Realization.class b/test/svr1/workflows/svr1/middle/Realization.class
index f71fe6c..b147853 100644
Binary files a/test/svr1/workflows/svr1/middle/Realization.class and b/test/svr1/workflows/svr1/middle/Realization.class differ
diff --git a/test/svr1/workflows/svr1/middle/Realization.java b/test/svr1/workflows/svr1/middle/Realization.java
index 40c65b5..1e86023 100644
--- a/test/svr1/workflows/svr1/middle/Realization.java
+++ b/test/svr1/workflows/svr1/middle/Realization.java
@@ -39,7 +39,7 @@ public class Realization extends AbstractRealization{
 	  Thread.sleep(2000);
       } catch (Exception e) {;}

-      System.out.println(psl.survivor.proc.nrl.NRLProcessor.getObject("key"));
+      psl.survivor.demo.Input.display("" + psl.survivor.proc.nrl.NRLProcessor.getObject("key"));

       taskMgr().endTask(null);
     }
diff --git a/test/svr1/workflows/svr1/start/Realization.class b/test/svr1/workflows/svr1/start/Realization.class
index be0dfb6..fab38d1 100644
Binary files a/test/svr1/workflows/svr1/start/Realization.class and b/test/svr1/workflows/svr1/start/Realization.class differ
diff --git a/test/svr1/workflows/svr1/start/Realization.java b/test/svr1/workflows/svr1/start/Realization.java
index 057efea..bfaa289 100644
--- a/test/svr1/workflows/svr1/start/Realization.java
+++ b/test/svr1/workflows/svr1/start/Realization.java
@@ -40,7 +40,7 @@ public class Realization extends AbstractRealization{
       } catch (Exception e) {
       }

-      psl.survivor.proc.nrl.NRLProcessor.setObject("key", "value");
+      psl.survivor.proc.nrl.NRLProcessor.setObject("key", psl.survivor.demo.Input.getInput("say what?"));

       System.out.println("DONE");
       taskMgr().endTask(null);