You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oodt.apache.org by ma...@apache.org on 2011/09/17 22:22:52 UTC

svn commit: r1172060 - in /oodt/trunk: ./ workflow/src/main/java/org/apache/oodt/cas/workflow/structs/ workflow/src/main/java/org/apache/oodt/cas/workflow/util/ workflow/src/main/resources/ workflow/src/test/org/apache/oodt/cas/workflow/structs/ workfl...

Author: mattmann
Date: Sat Sep 17 20:22:51 2011
New Revision: 1172060

URL: http://svn.apache.org/viewvc?rev=1172060&view=rev
Log:
- fix for OODT-317 Workflow Priority Sorting

Added:
    oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/FILOPrioritySorter.java
    oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/HighestFIFOPrioritySorter.java
    oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/HighestPrioritySorter.java
    oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/Priority.java   (with props)
    oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/PrioritySorter.java
    oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/structs/
    oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/structs/TestFILOPrioritySorter.java
    oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/structs/TestHighestFIFOPrioritySorter.java
    oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/structs/TestHighestPrioritySorter.java
Modified:
    oodt/trunk/CHANGES.txt
    oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/WorkflowInstance.java
    oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/util/DbStructFactory.java
    oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/util/XmlRpcStructFactory.java
    oodt/trunk/workflow/src/main/resources/workflow.sql
    oodt/trunk/workflow/src/testdata/workflow.sql

Modified: oodt/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/oodt/trunk/CHANGES.txt?rev=1172060&r1=1172059&r2=1172060&view=diff
==============================================================================
--- oodt/trunk/CHANGES.txt (original)
+++ oodt/trunk/CHANGES.txt Sat Sep 17 20:22:51 2011
@@ -4,6 +4,8 @@ Apache OODT Change Log
 Release 0.4: Current Development
 --------------------------------------------
 
+* OODT-317 Workflow Priority Sorting (mattmann, bfoster)
+
 * OODT-172 Update CAS Curator Tutorial (thomas via mattmann)
 
 * OODT-316 Add the WorkflowManager Use Case Diagram back into 

Added: oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/FILOPrioritySorter.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/FILOPrioritySorter.java?rev=1172060&view=auto
==============================================================================
--- oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/FILOPrioritySorter.java (added)
+++ oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/FILOPrioritySorter.java Sat Sep 17 20:22:51 2011
@@ -0,0 +1,70 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+package org.apache.oodt.cas.workflow.structs;
+
+//JDK imports
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.logging.Logger;
+
+//OODT imports
+import org.apache.oodt.cas.workflow.engine.WorkflowProcessor;
+
+/**
+ * 
+ * Sorts the {@link List} of {@link WorkflowProcessor} candidates according to
+ * the time in which the {@link WorkflowInstance} that they are processing was
+ * created. The first ones to get processed are the most recently created
+ * instances.
+ * 
+ * @author mattmann
+ * @author bfoster
+ * @version $Revision$
+ * 
+ */
+public class FILOPrioritySorter implements PrioritySorter {
+
+  private static final Logger LOG = Logger.getLogger(FILOPrioritySorter.class
+      .getName());
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see
+   * org.apache.oodt.cas.workflow.structs.PrioritySorter#sort(java.util.List)
+   */
+  @Override
+  public void sort(List<WorkflowProcessor> candidates) {
+    Collections.sort(candidates, new Comparator<WorkflowProcessor>() {
+      /*
+       * (non-Javadoc)
+       * 
+       * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+       */
+      @Override
+      public int compare(WorkflowProcessor o1, WorkflowProcessor o2) {
+        return o1.getWorkflowInstance().getStartDate()
+            .compareTo(o2.getWorkflowInstance().getStartDate());
+      }
+
+    });
+
+  }
+
+}
\ No newline at end of file

Added: oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/HighestFIFOPrioritySorter.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/HighestFIFOPrioritySorter.java?rev=1172060&view=auto
==============================================================================
--- oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/HighestFIFOPrioritySorter.java (added)
+++ oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/HighestFIFOPrioritySorter.java Sat Sep 17 20:22:51 2011
@@ -0,0 +1,99 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+package org.apache.oodt.cas.workflow.structs;
+
+//JDK imports
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+//OODT imports
+import org.apache.oodt.cas.workflow.engine.WorkflowProcessor;
+
+/**
+ * 
+ * Sorts based on highest {@link Priority} for a {@link WorkflowProcessor} using
+ * a particular {@link #boostAmount} provided by a calling party. The
+ * {@link #boostAmount} is computed based on a function that allows
+ * {@link #boostAmount} to grow over time depending on
+ * {@link #secondsBetweenBoosts} and a maximum {@link #boostCap}.
+ * 
+ * @author bfoster
+ * @author mattmann
+ * @version $Revision$
+ * 
+ */
+public class HighestFIFOPrioritySorter implements PrioritySorter {
+
+  private int secondsBetweenBoosts;
+  private double boostAmount;
+  private double boostCap;
+  private static final Logger LOG = Logger
+      .getLogger(HighestFIFOPrioritySorter.class.getName());
+
+  public HighestFIFOPrioritySorter(int secondsBetweenBoosts,
+      double boostAmount, double boostCap) {
+    this.secondsBetweenBoosts = secondsBetweenBoosts;
+    this.boostAmount = boostAmount;
+    this.boostCap = boostCap;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see
+   * org.apache.oodt.cas.workflow.structs.PrioritySorter#sort(java.util.List)
+   */
+  @Override
+  public void sort(List<WorkflowProcessor> candidates) {
+
+    Collections.sort(candidates, new Comparator<WorkflowProcessor>() {
+      public int compare(WorkflowProcessor o1, WorkflowProcessor o2) {
+        return calculatePriority(o2).compareTo(calculatePriority(o1));
+      }
+    });
+  }
+
+  private Double calculatePriority(WorkflowProcessor processorStub) {
+    double aliveTime = 0.0;
+
+    try {
+      aliveTime = (double) (System.currentTimeMillis() - processorStub
+          .getWorkflowInstance().getCreationDate().getTime());
+    } catch (Exception e) {
+      e.printStackTrace();
+      LOG.log(Level.WARNING,
+          "Unable to compute aliveTime for computing FIFO priority: Reason: ["
+              + e.getMessage() + "]");
+      aliveTime = 0.0;
+    }
+
+    double boostPercentage = aliveTime / 1000.0
+        / (double) this.secondsBetweenBoosts;
+    return Math.max(
+        processorStub.getWorkflowInstance().getPriority().getValue(),
+        Math.min(
+            this.boostCap,
+            Double.valueOf(processorStub.getWorkflowInstance().getPriority()
+                .getValue()
+                + (boostPercentage * this.boostAmount))));
+  }
+
+}

Added: oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/HighestPrioritySorter.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/HighestPrioritySorter.java?rev=1172060&view=auto
==============================================================================
--- oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/HighestPrioritySorter.java (added)
+++ oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/HighestPrioritySorter.java Sat Sep 17 20:22:51 2011
@@ -0,0 +1,58 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+package org.apache.oodt.cas.workflow.structs;
+
+//JDK imports
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+//OODT imports
+import org.apache.oodt.cas.workflow.engine.WorkflowProcessor;
+
+/**
+ * 
+ * Sorts strictly based on associated {@link WorkflowProcessor#getPriority()} in
+ * reverse natural order.
+ * 
+ * @author mattmann
+ * @author bfoster
+ * @version $Revision$
+ * 
+ */
+public class HighestPrioritySorter implements PrioritySorter {
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see
+   * org.apache.oodt.cas.workflow.structs.PrioritySorter#sort(java.util.List)
+   */
+  @Override
+  public void sort(List<WorkflowProcessor> candidates) {
+    Collections.sort(candidates, new Comparator<WorkflowProcessor>() {
+
+      @Override
+      public int compare(WorkflowProcessor o1, WorkflowProcessor o2) {
+        return o2.getWorkflowInstance().getPriority()
+            .compareTo(o1.getWorkflowInstance().getPriority());
+      }
+    });
+  }
+
+}

Added: oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/Priority.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/Priority.java?rev=1172060&view=auto
==============================================================================
--- oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/Priority.java (added)
+++ oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/Priority.java Sat Sep 17 20:22:51 2011
@@ -0,0 +1,135 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+package org.apache.oodt.cas.workflow.structs;
+
+/**
+ * 
+ * Priority of a WorkflowProcessor.
+ * 
+ * @author bfoster
+ * @version $Revision$
+ * 
+ */
+public abstract class Priority implements Comparable<Priority> {
+
+  /**
+   * Big the better (that is higher the number higher the priority)
+   * 
+   * @return
+   */
+  public abstract double getValue();
+
+  public abstract String getName();
+
+  public static final Priority LOW = new Priority() {
+    public double getValue() {
+      return 0;
+    }
+
+    public String getName() {
+      return "LOW";
+    }
+  };
+  public static final Priority MEDIUM_LOW = new Priority() {
+    public double getValue() {
+      return 2.5;
+    }
+
+    public String getName() {
+      return "MEDIUM_LOW";
+    }
+  };
+  public static final Priority MEDIUM = new Priority() {
+    public double getValue() {
+      return 5;
+    }
+
+    public String getName() {
+      return "MEDIUM";
+    }
+  };
+  public static final Priority MEDIUM_HIGH = new Priority() {
+    public double getValue() {
+      return 7.5;
+    }
+
+    public String getName() {
+      return "MEDIUM_HIGH";
+    }
+  };
+  public static final Priority HIGH = new Priority() {
+    public double getValue() {
+      return 10;
+    }
+
+    public String getName() {
+      return "HIGH";
+    }
+  };
+
+  public static Priority getDefault() {
+    return MEDIUM;
+  }
+
+  public static Priority getPriority(final double priority) {
+    if (priority == LOW.getValue())
+      return LOW;
+    else if (priority == MEDIUM_LOW.getValue())
+      return MEDIUM_LOW;
+    else if (priority == MEDIUM.getValue())
+      return MEDIUM;
+    else if (priority == MEDIUM_HIGH.getValue())
+      return MEDIUM_HIGH;
+    else if (priority == HIGH.getValue())
+      return HIGH;
+    else
+      return new Priority() {
+        public double getValue() {
+          return priority;
+        }
+
+        public String getName() {
+          return "CUSTOM";
+        }
+      };
+  }
+
+  @Override
+  public int hashCode() {
+    return new Double(this.getValue()).hashCode();
+  }
+
+  @Override
+  public boolean equals(Object obj) {
+    if (obj instanceof Priority)
+      return new Double(this.getValue()).equals(((Priority) obj).getValue());
+    else
+      return false;
+  }
+
+  @Override
+  public int compareTo(Priority priority) {
+    return new Double(this.getValue()).compareTo(priority.getValue());
+  }
+
+  @Override
+  public String toString() {
+    return this.getName() + " : " + Double.toString(this.getValue());
+  }
+
+}

Propchange: oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/Priority.java
------------------------------------------------------------------------------
    svn:executable = *

Added: oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/PrioritySorter.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/PrioritySorter.java?rev=1172060&view=auto
==============================================================================
--- oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/PrioritySorter.java (added)
+++ oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/PrioritySorter.java Sat Sep 17 20:22:51 2011
@@ -0,0 +1,48 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+package org.apache.oodt.cas.workflow.structs;
+
+//JDK imports
+import java.util.List;
+
+//OODT imports
+import org.apache.oodt.cas.workflow.engine.WorkflowProcessor;
+
+/**
+ * 
+ * Interface specifying a method to sort and prioritize
+ * {@link WorkflowProcessor}s.
+ * 
+ * @author bfoster
+ * @author mattmann
+ * @version $Revision$
+ * 
+ */
+public interface PrioritySorter {
+
+  /**
+   * Sorts the {@link List} of {@link WorkflowProcessor}s that are ready to run
+   * in a particular order specified by the sub-class implementing this method.
+   * 
+   * @param candidates
+   *          The {@link List} of {@link WorkflowProcessor}s to sort in priority
+   *          order.
+   */
+  public void sort(List<WorkflowProcessor> candidates);
+
+}

Modified: oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/WorkflowInstance.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/WorkflowInstance.java?rev=1172060&r1=1172059&r2=1172060&view=diff
==============================================================================
--- oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/WorkflowInstance.java (original)
+++ oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/WorkflowInstance.java Sat Sep 17 20:22:51 2011
@@ -15,214 +15,332 @@
  * limitations under the License.
  */
 
-
 package org.apache.oodt.cas.workflow.structs;
 
 //OODT imports
+import java.text.ParseException;
+import java.util.Date;
+
 import org.apache.oodt.cas.metadata.Metadata;
+import org.apache.oodt.commons.util.DateConvert;
 
 /**
- * @author mattmann
- * @version $Revision$
- * 
- * <p>
  * A WorkflowInstance is an instantiation of the abstract description of a
  * Workflow provided by the {@link Workflow} class. WorkflowInstances have
  * status, and in general are data structures intended to be used as a means for
  * monitoring the status of an executing {@link Workflow}.
- * </p>
+ * 
+ * @author mattmann
+ * @author bfoster
+ * @version $Revision$
  * 
  */
 public class WorkflowInstance {
 
-    private Workflow workflow;
-
-    private String id;
-
-    private String status;
-
-    private String currentTaskId;
-
-    private String startDateTimeIsoStr;
-
-    private String endDateTimeIsoStr;
+  private Workflow workflow;
 
-    private String currentTaskStartDateTimeIsoStr;
+  private String id;
 
-    private String currentTaskEndDateTimeIsoStr;
-
-    private Metadata sharedContext;
-
-    /**
-     * Default Constructor.
-     * 
-     */
-    public WorkflowInstance() {
-        sharedContext = new Metadata();
-    }
-
-    /**
-     * @param workflow
-     * @param id
-     * @param status
-     * @param currentTaskId
-     * @param startDateTimeIsoStr
-     * @param endDateTimeIsoStr
-     * @param currentTaskStartDateTimeIsoStr
-     * @param currentTaskEndDateTimeIsoStr
-     * @param sharedContext
-     */
-    public WorkflowInstance(Workflow workflow, String id, String status,
-            String currentTaskId, String startDateTimeIsoStr,
-            String endDateTimeIsoStr, String currentTaskStartDateTimeIsoStr,
-            String currentTaskEndDateTimeIsoStr, Metadata sharedContext) {
-        super();
-        this.workflow = workflow;
-        this.id = id;
-        this.status = status;
-        this.currentTaskId = currentTaskId;
-        this.startDateTimeIsoStr = startDateTimeIsoStr;
-        this.endDateTimeIsoStr = endDateTimeIsoStr;
-        this.currentTaskStartDateTimeIsoStr = currentTaskStartDateTimeIsoStr;
-        this.currentTaskEndDateTimeIsoStr = currentTaskEndDateTimeIsoStr;
-        this.sharedContext = sharedContext;
-    }
-
-    /**
-     * @return the id
-     */
-    public String getId() {
-        return id;
-    }
-
-    /**
-     * @param id
-     *            the id to set
-     */
-    public void setId(String id) {
-        this.id = id;
-    }
-
-    /**
-     * @return the status
-     */
-    public String getStatus() {
-        return status;
-    }
-
-    /**
-     * @param status
-     *            the status to set
-     */
-    public void setStatus(String status) {
-        this.status = status;
-    }
+  private String status;
 
-    /**
-     * @return the workflow
-     */
-    public Workflow getWorkflow() {
-        return workflow;
-    }
-
-    /**
-     * @param workflow
-     *            the workflow to set
-     */
-    public void setWorkflow(Workflow workflow) {
-        this.workflow = workflow;
-    }
-
-    /**
-     * @return the currentTaskId
-     */
-    public String getCurrentTaskId() {
-        return currentTaskId;
-    }
-
-    /**
-     * @param currentTaskId
-     *            the currentTaskId to set
-     */
-    public void setCurrentTaskId(String currentTaskId) {
-        this.currentTaskId = currentTaskId;
-    }
-
-    /**
-     * @return the endDateTimeIsoStr
-     */
-    public String getEndDateTimeIsoStr() {
-        return endDateTimeIsoStr;
-    }
-
-    /**
-     * @param endDateTimeIsoStr
-     *            the endDateTimeIsoStr to set
-     */
-    public void setEndDateTimeIsoStr(String endDateTimeIsoStr) {
-        this.endDateTimeIsoStr = endDateTimeIsoStr;
-    }
-
-    /**
-     * @return the startDateTimeIsoStr
-     */
-    public String getStartDateTimeIsoStr() {
-        return startDateTimeIsoStr;
-    }
-
-    /**
-     * @param startDateTimeIsoStr
-     *            the startDateTimeIsoStr to set
-     */
-    public void setStartDateTimeIsoStr(String startDateTimeIsoStr) {
-        this.startDateTimeIsoStr = startDateTimeIsoStr;
-    }
-
-    /**
-     * @return the currentTaskEndDateTimeIsoStr
-     */
-    public String getCurrentTaskEndDateTimeIsoStr() {
-        return currentTaskEndDateTimeIsoStr;
-    }
-
-    /**
-     * @param currentTaskEndDateTimeIsoStr
-     *            the currentTaskEndDateTimeIsoStr to set
-     */
-    public void setCurrentTaskEndDateTimeIsoStr(
-            String currentTaskEndDateTimeIsoStr) {
-        this.currentTaskEndDateTimeIsoStr = currentTaskEndDateTimeIsoStr;
-    }
-
-    /**
-     * @return the currentTaskStartDateTimeIsoStr
-     */
-    public String getCurrentTaskStartDateTimeIsoStr() {
-        return currentTaskStartDateTimeIsoStr;
-    }
-
-    /**
-     * @param currentTaskStartDateTimeIsoStr
-     *            the currentTaskStartDateTimeIsoStr to set
-     */
-    public void setCurrentTaskStartDateTimeIsoStr(
-            String currentTaskStartDateTimeIsoStr) {
-        this.currentTaskStartDateTimeIsoStr = currentTaskStartDateTimeIsoStr;
-    }
-
-    /**
-     * @return the sharedContext
-     */
-    public Metadata getSharedContext() {
-        return sharedContext;
-    }
+  private String currentTaskId;
 
-    /**
-     * @param sharedContext
-     *            the sharedContext to set
-     */
-    public void setSharedContext(Metadata sharedContext) {
-        this.sharedContext = sharedContext;
+  private Date startDate;
+
+  private Date endDate;
+
+  private Date taskStartDate;
+
+  private Date taskEndDate;
+
+  private Metadata sharedContext;
+
+  private Priority priority;
+
+  /**
+   * Default Constructor.
+   * 
+   */
+  public WorkflowInstance() {
+    this(null, null, null, null, new Date(), null, null, null, new Metadata(),
+        Priority.getDefault());
+  }
+
+  public WorkflowInstance(Workflow workflow, String id, String status,
+      String currentTaskId, Date startDate, Date endDate, Date taskStartDate,
+      Date taskEndDate, Metadata sharedContext, Priority priority) {
+    this.workflow = workflow;
+    this.id = id;
+    this.status = status;
+    this.currentTaskId = currentTaskId;
+    this.startDate = startDate;
+    this.endDate = endDate;
+    this.taskStartDate = taskStartDate;
+    this.taskEndDate = taskEndDate;
+    this.sharedContext = sharedContext;
+    this.priority = priority;
+  }
+
+  /**
+   * @return the id
+   */
+  public String getId() {
+    return id;
+  }
+
+  /**
+   * @param id
+   *          the id to set
+   */
+  public void setId(String id) {
+    this.id = id;
+  }
+
+  /**
+   * @return the status
+   */
+  public String getStatus() {
+    return status;
+  }
+
+  /**
+   * @param status
+   *          the status to set
+   */
+  public void setStatus(String status) {
+    this.status = status;
+  }
+
+  /**
+   * @return the workflow
+   */
+  public Workflow getWorkflow() {
+    return workflow;
+  }
+
+  /**
+   * @param workflow
+   *          the workflow to set
+   */
+  public void setWorkflow(Workflow workflow) {
+    this.workflow = workflow;
+  }
+
+  /**
+   * @return the currentTaskId
+   */
+  public String getCurrentTaskId() {
+    return currentTaskId;
+  }
+
+  /**
+   * @param currentTaskId
+   *          the currentTaskId to set
+   */
+  public void setCurrentTaskId(String currentTaskId) {
+    this.currentTaskId = currentTaskId;
+  }
+
+  /**
+   * @return the sharedContext
+   */
+  public Metadata getSharedContext() {
+    return sharedContext;
+  }
+
+  /**
+   * @param sharedContext
+   *          the sharedContext to set
+   */
+  public void setSharedContext(Metadata sharedContext) {
+    this.sharedContext = sharedContext;
+  }
+
+  /**
+   * @return the priority
+   */
+  public Priority getPriority() {
+    return priority;
+  }
+
+  /**
+   * @param priority
+   *          the priority to set
+   */
+  public void setPriority(Priority priority) {
+    this.priority = priority;
+  }
+
+  /**
+   * Convenience method to format and return the
+   * {@link #currentTaskStartDateTimeIsoStr} as a {@link Date}.
+   * 
+   * @return {@link Date} representation of
+   *         {@link #getCurrentTaskStartDateTimeIsoStr()}.
+   */
+  public Date getCreationDate() {
+    return this.startDate;
+  }
+
+  /**
+   * Convenience method to format and return the
+   * {@link #currentTaskEndDateTimeIsoStr} as a {@link Date}.
+   * 
+   * @return {@link Date} representation of
+   *         {@link #getCurrentTaskEndDateTimeIsoStr()}.
+   */
+  public Date getFinishDate() {
+    return this.endDate;
+  }
+
+  /**
+   * @return the startDate
+   */
+  public Date getStartDate() {
+    return startDate;
+  }
+
+  /**
+   * @param startDate the startDate to set
+   */
+  public void setStartDate(Date startDate) {
+    this.startDate = startDate;
+  }
+
+  /**
+   * @return the endDate
+   */
+  public Date getEndDate() {
+    return endDate;
+  }
+
+  /**
+   * @param endDate the endDate to set
+   */
+  public void setEndDate(Date endDate) {
+    this.endDate = endDate;
+  }
+
+  /**
+   * @return the taskStartDate
+   */
+  public Date getTaskStartDate() {
+    return taskStartDate;
+  }
+
+  /**
+   * @param taskStartDate the taskStartDate to set
+   */
+  public void setTaskStartDate(Date taskStartDate) {
+    this.taskStartDate = taskStartDate;
+  }
+
+  /**
+   * @return the taskEndDate
+   */
+  public Date getTaskEndDate() {
+    return taskEndDate;
+  }
+
+  /**
+   * @param taskEndDate the taskEndDate to set
+   */
+  public void setTaskEndDate(Date taskEndDate) {
+    this.taskEndDate = taskEndDate;
+  }
+
+  /**
+   * @return the endDateTimeIsoStr
+   */
+  @Deprecated
+  public String getEndDateTimeIsoStr() {
+    return this.endDate != null ? 
+        DateConvert.isoFormat(this.endDate):null;
+  }
+
+  /**
+   * @param endDateTimeIsoStr
+   *          the endDateTimeIsoStr to set
+   */
+  @Deprecated
+  public void setEndDateTimeIsoStr(String endDateTimeIsoStr) {
+    try {
+      this.endDate = DateConvert.isoParse(endDateTimeIsoStr);
+    } catch (ParseException e) {
+      e.printStackTrace();
+      // fail silently besides this: it's just a setter
+    }
+  }
+
+  /**
+   * @return the startDateTimeIsoStr
+   */
+  @Deprecated
+  public String getStartDateTimeIsoStr() {
+    return this.startDate != null ? 
+        DateConvert.isoFormat(this.startDate):null;
+  }
+
+  /**
+   * @param startDateTimeIsoStr
+   *          the startDateTimeIsoStr to set
+   */
+  @Deprecated
+  public void setStartDateTimeIsoStr(String startDateTimeIsoStr) {
+    try {
+      this.startDate = DateConvert.isoParse(startDateTimeIsoStr);
+    } catch (ParseException e) {
+      e.printStackTrace();
+      // fail silently besides this: it's just a setter
+    }
+  }
+
+  /**
+   * @return the currentTaskEndDateTimeIsoStr
+   */
+  @Deprecated
+  public String getCurrentTaskEndDateTimeIsoStr() {
+    return this.taskEndDate != null ? 
+        DateConvert.isoFormat(this.taskEndDate):null;
+  }
+
+  /**
+   * @param currentTaskEndDateTimeIsoStr
+   *          the currentTaskEndDateTimeIsoStr to set
+   */
+  @Deprecated
+  public void setCurrentTaskEndDateTimeIsoStr(
+      String currentTaskEndDateTimeIsoStr) {
+    try {
+      this.taskEndDate = DateConvert.isoParse(currentTaskEndDateTimeIsoStr);
+    } catch (ParseException e) {
+      e.printStackTrace();
+      // fail silently besides this: it's just a setter
+    }
+  }
+
+  /**
+   * @return the currentTaskStartDateTimeIsoStr
+   */
+  @Deprecated
+  public String getCurrentTaskStartDateTimeIsoStr() {
+    return this.taskStartDate != null ? 
+        DateConvert.isoFormat(this.taskStartDate):null;
+  }
+
+  /**
+   * @param currentTaskStartDateTimeIsoStr
+   *          the currentTaskStartDateTimeIsoStr to set
+   */
+  @Deprecated
+  public void setCurrentTaskStartDateTimeIsoStr(
+      String currentTaskStartDateTimeIsoStr) {
+    try {
+      this.taskStartDate = DateConvert.isoParse(currentTaskStartDateTimeIsoStr);
+    } catch (ParseException e) {
+      e.printStackTrace();
+      // fail silently besides this: it's just a setter
     }
+  }
 
 }

Modified: oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/util/DbStructFactory.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/util/DbStructFactory.java?rev=1172060&r1=1172059&r2=1172060&view=diff
==============================================================================
--- oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/util/DbStructFactory.java (original)
+++ oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/util/DbStructFactory.java Sat Sep 17 20:22:51 2011
@@ -19,6 +19,7 @@
 package org.apache.oodt.cas.workflow.util;
 
 //OODT imports
+import org.apache.oodt.cas.workflow.structs.Priority;
 import org.apache.oodt.cas.workflow.structs.Workflow;
 import org.apache.oodt.cas.workflow.structs.WorkflowInstance;
 import org.apache.oodt.cas.workflow.structs.WorkflowTask;
@@ -65,6 +66,7 @@ public final class DbStructFactory {
                 .getString("current_task_start_date_time"));
         workflowInst.setCurrentTaskEndDateTimeIsoStr(rs
                 .getString("current_task_end_date_time"));
+        workflowInst.setPriority(Priority.getPriority(rs.getDouble("priority")));
         Workflow workflow = new Workflow();
         workflow.setId(rs.getString("workflow_id"));
         workflowInst.setWorkflow(workflow);

Modified: oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/util/XmlRpcStructFactory.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/util/XmlRpcStructFactory.java?rev=1172060&r1=1172059&r2=1172060&view=diff
==============================================================================
--- oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/util/XmlRpcStructFactory.java (original)
+++ oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/util/XmlRpcStructFactory.java Sat Sep 17 20:22:51 2011
@@ -15,7 +15,6 @@
  * limitations under the License.
  */
 
-
 package org.apache.oodt.cas.workflow.util;
 
 //JDK imports
@@ -27,6 +26,7 @@ import java.util.Vector;
 
 //OODT imports
 import org.apache.oodt.cas.metadata.Metadata;
+import org.apache.oodt.cas.workflow.structs.Priority;
 import org.apache.oodt.cas.workflow.structs.Workflow;
 import org.apache.oodt.cas.workflow.structs.WorkflowConditionConfiguration;
 import org.apache.oodt.cas.workflow.structs.WorkflowInstancePage;
@@ -36,461 +36,469 @@ import org.apache.oodt.cas.workflow.stru
 import org.apache.oodt.cas.workflow.structs.WorkflowInstance;
 
 /**
- * @author mattmann
- * @version $Revision$
  * 
- * <p>
  * A Struct Factory for creating and unpacking Workflow Objects to be sent and
  * received across the XML-RPC wire.
- * </p>
+ * 
+ * @author mattmann
+ * @version $Revision$
  * 
  */
 public final class XmlRpcStructFactory {
 
-    private XmlRpcStructFactory() throws InstantiationException {
-        throw new InstantiationException(
-                "Don't instantiate XmlRpcStructFactories!");
+  private XmlRpcStructFactory() throws InstantiationException {
+    throw new InstantiationException("Don't instantiate XmlRpcStructFactories!");
+  }
+
+  /**
+   * Gets a {@link Hashtable} representation of a {@link WorkflowInstancePage}
+   * that is serializable over the XML-RPC wire.
+   * 
+   * @param page
+   *          The {@link WorkflowInstancePage} to turn into a {@link Hashtable}.
+   * @return A {@link Hashtable} representation of a
+   *         {@link WorkflowInstancePage}.
+   */
+  public static Hashtable getXmlRpcWorkflowInstancePage(
+      WorkflowInstancePage page) {
+    Hashtable pageHash = new Hashtable();
+    pageHash.put("totalPages", String.valueOf(page.getTotalPages()));
+    pageHash.put("pageNum", String.valueOf(page.getPageNum()));
+    pageHash.put("pageSize", String.valueOf(page.getPageSize()));
+    pageHash.put("pageWorkflows",
+        getXmlRpcWorkflowInstances(page.getPageWorkflows()));
+
+    return pageHash;
+
+  }
+
+  /**
+   * Gets a {@link WorkflowInstancePage} off of the XML-RPC wire by converting
+   * the XML-RPC {@link Hashtable} representation of the page into a
+   * {@link WorkflowInstancePage}.
+   * 
+   * @param pageHash
+   *          The XML-RPC {@link Hashtable} representation of this
+   *          {@link WorkflowInstancePage}.
+   * @return The {@link WorkflowInstancePage} that this XML-RPC
+   *         {@link Hashtable} provided represents.
+   */
+  public static WorkflowInstancePage getWorkflowInstancePageFromXmlRpc(
+      Hashtable pageHash) {
+    WorkflowInstancePage page = new WorkflowInstancePage();
+    page.setPageNum(Integer.parseInt((String) pageHash.get("pageNum")));
+    page.setPageSize(Integer.parseInt((String) pageHash.get("pageSize")));
+    page.setTotalPages(Integer.parseInt((String) pageHash.get("totalPages")));
+    page.setPageWorkflows(getWorkflowInstancesFromXmlRpc((Vector) pageHash
+        .get("pageWorkflows")));
+
+    return page;
+
+  }
+
+  /**
+   * <p>
+   * Gets a {@link Hashtable} representation of a {@link WorkflowInstance} to be
+   * sent across the XML-RPC wire.
+   * </p>
+   * 
+   * @param wInst
+   *          The WorkflowInstance to turned into a java.util.Hashtable.
+   * @return A {@link Hashtable} representation of a {@link WorkflowInstance}.
+   */
+  public static Hashtable getXmlRpcWorkflowInstance(WorkflowInstance wInst) {
+    Hashtable workflowInstance = new Hashtable();
+    workflowInstance.put("current_task_id", wInst.getCurrentTaskId());
+    workflowInstance.put("status", wInst.getStatus());
+    workflowInstance.put("id", wInst.getId());
+    workflowInstance.put("workflow", getXmlRpcWorkflow(wInst.getWorkflow()));
+    workflowInstance.put("start_date_time",
+        wInst.getStartDateTimeIsoStr() != null ? wInst.getStartDateTimeIsoStr()
+            : "");
+    workflowInstance.put("end_date_time",
+        wInst.getEndDateTimeIsoStr() != null ? wInst.getEndDateTimeIsoStr()
+            : "");
+    workflowInstance.put(
+        "current_task_start_date_time",
+        wInst.getCurrentTaskStartDateTimeIsoStr() != null ? wInst
+            .getCurrentTaskStartDateTimeIsoStr() : "");
+    workflowInstance.put(
+        "current_task_end_date_time",
+        wInst.getCurrentTaskEndDateTimeIsoStr() != null ? wInst
+            .getCurrentTaskEndDateTimeIsoStr() : "");
+    workflowInstance.put("sharedContext",
+        wInst.getSharedContext() != null ? wInst.getSharedContext()
+            .getHashtable() : new Hashtable());
+    workflowInstance.put("priority", 
+        wInst.getPriority() != null ? 
+            String.valueOf(wInst.getPriority().getValue()):
+              String.valueOf(Priority.getDefault().getValue()));
+    return workflowInstance;
+  }
+
+  public static WorkflowInstance getWorkflowInstanceFromXmlRpc(
+      Hashtable workflowInstance) {
+    WorkflowInstance wInst = new WorkflowInstance();
+    wInst.setCurrentTaskId((String) workflowInstance.get("current_task_id"));
+    wInst.setStatus((String) workflowInstance.get("status"));
+    wInst.setId((String) workflowInstance.get("id"));
+    wInst.setWorkflow(getWorkflowFromXmlRpc((Hashtable) workflowInstance
+        .get("workflow")));
+    wInst.setStartDateTimeIsoStr((String) workflowInstance
+        .get("start_date_time"));
+    wInst.setEndDateTimeIsoStr((String) workflowInstance.get("end_date_time"));
+    wInst.setCurrentTaskStartDateTimeIsoStr((String) workflowInstance
+        .get("current_task_start_date_time"));
+    wInst.setCurrentTaskEndDateTimeIsoStr((String) workflowInstance
+        .get("current_task_end_date_time"));
+    if (workflowInstance.get("sharedContext") != null) {
+      Metadata met = new Metadata();
+      met.addMetadata((Hashtable) workflowInstance.get("sharedContext"));
+      wInst.setSharedContext(met);
+    } else
+      wInst.setSharedContext(new Metadata());
+
+    if (workflowInstance.get("priority") != null) {
+      Priority p = Priority.getPriority(Double
+          .valueOf((String) workflowInstance.get("priority")));
     }
 
-    /**
-     * Gets a {@link Hashtable} representation of a {@link WorkflowInstancePage}
-     * that is serializable over the XML-RPC wire.
-     * 
-     * @param page
-     *            The {@link WorkflowInstancePage} to turn into a
-     *            {@link Hashtable}.
-     * @return A {@link Hashtable} representation of a
-     *         {@link WorkflowInstancePage}.
-     */
-    public static Hashtable getXmlRpcWorkflowInstancePage(
-            WorkflowInstancePage page) {
-        Hashtable pageHash = new Hashtable();
-        pageHash.put("totalPages", String.valueOf(page.getTotalPages()));
-        pageHash.put("pageNum", String.valueOf(page.getPageNum()));
-        pageHash.put("pageSize", String.valueOf(page.getPageSize()));
-        pageHash.put("pageWorkflows", getXmlRpcWorkflowInstances(page
-                .getPageWorkflows()));
-
-        return pageHash;
+    return wInst;
+  }
+
+  /**
+   * Gets a {@link List} of {@link WorkflowInstance}s from their representations
+   * as {@link Hashtable}s in XML-RPC.
+   * 
+   * @param instsVector
+   *          The {@link Vector} of {@link Hashtable} representations of
+   *          {@link WorkflowInstance}s.
+   * @return A {@link List} of {@link WorkflowInstance}s from their
+   *         representations as {@link Hashtable}s in XML-RPC.
+   */
+  public static List getWorkflowInstancesFromXmlRpc(Vector instsVector) {
+    List wInsts = new Vector();
 
+    if (instsVector != null && instsVector.size() > 0) {
+      for (Iterator i = instsVector.iterator(); i.hasNext();) {
+        Hashtable wInstHash = (Hashtable) i.next();
+        WorkflowInstance inst = getWorkflowInstanceFromXmlRpc(wInstHash);
+        wInsts.add(inst);
+      }
     }
 
-    /**
-     * Gets a {@link WorkflowInstancePage} off of the XML-RPC wire by converting
-     * the XML-RPC {@link Hashtable} representation of the page into a
-     * {@link WorkflowInstancePage}.
-     * 
-     * @param pageHash
-     *            The XML-RPC {@link Hashtable} representation of this
-     *            {@link WorkflowInstancePage}.
-     * @return The {@link WorkflowInstancePage} that this XML-RPC
-     *         {@link Hashtable} provided represents.
-     */
-    public static WorkflowInstancePage getWorkflowInstancePageFromXmlRpc(
-            Hashtable pageHash) {
-        WorkflowInstancePage page = new WorkflowInstancePage();
-        page.setPageNum(Integer.parseInt((String) pageHash.get("pageNum")));
-        page.setPageSize(Integer.parseInt((String) pageHash.get("pageSize")));
-        page.setTotalPages(Integer
-                .parseInt((String) pageHash.get("totalPages")));
-        page.setPageWorkflows(getWorkflowInstancesFromXmlRpc((Vector) pageHash
-                .get("pageWorkflows")));
-
-        return page;
+    return wInsts;
+  }
 
+  /**
+   * Gets an XML-RPC serializable {@link Vector} of {@link Hashtable}
+   * representations of {@link WorkflowInstance}s.
+   * 
+   * @param wInsts
+   *          The {@link List} of {@link WorkflowInstance}s to serialize.
+   * @return A XML-RPC serializable {@link Vector} of {@link Hashtable}
+   *         representations of {@link WorkflowInstance}s.
+   */
+  public static Vector getXmlRpcWorkflowInstances(List wInsts) {
+    Vector instsVector = new Vector();
+
+    if (wInsts != null && wInsts.size() > 0) {
+      for (Iterator i = wInsts.iterator(); i.hasNext();) {
+        WorkflowInstance inst = (WorkflowInstance) i.next();
+        instsVector.add(getXmlRpcWorkflowInstance(inst));
+      }
     }
 
-    /**
-     * <p>
-     * Gets a {@link Hashtable} representation of a {@link WorkflowInstance} to
-     * be sent across the XML-RPC wire.
-     * </p>
-     * 
-     * @param wInst
-     *            The WorkflowInstance to turned into a java.util.Hashtable.
-     * @return A {@link Hashtable} representation of a {@link WorkflowInstance}.
-     */
-    public static Hashtable getXmlRpcWorkflowInstance(WorkflowInstance wInst) {
-        Hashtable workflowInstance = new Hashtable();
-        workflowInstance.put("current_task_id", wInst.getCurrentTaskId());
-        workflowInstance.put("status", wInst.getStatus());
-        workflowInstance.put("id", wInst.getId());
-        workflowInstance
-                .put("workflow", getXmlRpcWorkflow(wInst.getWorkflow()));
-        workflowInstance.put("start_date_time",
-                wInst.getStartDateTimeIsoStr() != null ? wInst
-                        .getStartDateTimeIsoStr() : "");
-        workflowInstance.put("end_date_time",
-                wInst.getEndDateTimeIsoStr() != null ? wInst
-                        .getEndDateTimeIsoStr() : "");
-        workflowInstance.put("current_task_start_date_time", wInst
-                .getCurrentTaskStartDateTimeIsoStr() != null ? wInst
-                .getCurrentTaskStartDateTimeIsoStr() : "");
-        workflowInstance.put("current_task_end_date_time", wInst
-                .getCurrentTaskEndDateTimeIsoStr() != null ? wInst
-                .getCurrentTaskEndDateTimeIsoStr() : "");
-        workflowInstance.put("sharedContext",
-                wInst.getSharedContext() != null ? wInst.getSharedContext()
-                        .getHashtable() : new Hashtable());
-        return workflowInstance;
-    }
-
-    public static WorkflowInstance getWorkflowInstanceFromXmlRpc(
-            Hashtable workflowInstance) {
-        WorkflowInstance wInst = new WorkflowInstance();
-        wInst
-                .setCurrentTaskId((String) workflowInstance
-                        .get("current_task_id"));
-        wInst.setStatus((String) workflowInstance.get("status"));
-        wInst.setId((String) workflowInstance.get("id"));
-        wInst.setWorkflow(getWorkflowFromXmlRpc((Hashtable) workflowInstance
-                .get("workflow")));
-        wInst.setStartDateTimeIsoStr((String) workflowInstance
-                .get("start_date_time"));
-        wInst.setEndDateTimeIsoStr((String) workflowInstance
-                .get("end_date_time"));
-        wInst.setCurrentTaskStartDateTimeIsoStr((String) workflowInstance
-                .get("current_task_start_date_time"));
-        wInst.setCurrentTaskEndDateTimeIsoStr((String) workflowInstance
-                .get("current_task_end_date_time"));
-        if (workflowInstance.get("sharedContext") != null) {
-            Metadata met = new Metadata();
-            met.addMetadata((Hashtable) workflowInstance.get("sharedContext"));
-            wInst.setSharedContext(met);
-        } else
-            wInst.setSharedContext(new Metadata());
-
-        return wInst;
-    }
-
-    /**
-     * Gets a {@link List} of {@link WorkflowInstance}s from their
-     * representations as {@link Hashtable}s in XML-RPC.
-     * 
-     * @param instsVector
-     *            The {@link Vector} of {@link Hashtable} representations of
-     *            {@link WorkflowInstance}s.
-     * @return A {@link List} of {@link WorkflowInstance}s from their
-     *         representations as {@link Hashtable}s in XML-RPC.
-     */
-    public static List getWorkflowInstancesFromXmlRpc(Vector instsVector) {
-        List wInsts = new Vector();
+    return instsVector;
+  }
 
-        if (instsVector != null && instsVector.size() > 0) {
-            for (Iterator i = instsVector.iterator(); i.hasNext();) {
-                Hashtable wInstHash = (Hashtable) i.next();
-                WorkflowInstance inst = getWorkflowInstanceFromXmlRpc(wInstHash);
-                wInsts.add(inst);
-            }
-        }
-
-        return wInsts;
-    }
-
-    /**
-     * Gets an XML-RPC serializable {@link Vector} of {@link Hashtable}
-     * representations of {@link WorkflowInstance}s.
-     * 
-     * @param wInsts
-     *            The {@link List} of {@link WorkflowInstance}s to serialize.
-     * @return A XML-RPC serializable {@link Vector} of {@link Hashtable}
-     *         representations of {@link WorkflowInstance}s.
-     */
-    public static Vector getXmlRpcWorkflowInstances(List wInsts) {
-        Vector instsVector = new Vector();
+  /**
+   * <p>
+   * Gets a {@link Hashtable} representation of a {@link Workflow} to be sent
+   * across the XML-RPC wire.
+   * </p>
+   * 
+   * @param w
+   *          The Workflow to be turned into a java.util.Hashtable
+   * @return A {@link Hashtable} representation of a {@link Workflow}.
+   */
+  public static Hashtable getXmlRpcWorkflow(Workflow w) {
+    Hashtable workflow = new Hashtable();
+    workflow.put("id", w.getId());
+    workflow.put("name", w.getName() != null ? w.getName() : "");
+    workflow.put("tasks", getXmlRpcWorkflowTasks(w.getTasks()));
+    workflow.put("conditions", getXmlRpcWorkflowConditions(w.getConditions()));
 
-        if (wInsts != null && wInsts.size() > 0) {
-            for (Iterator i = wInsts.iterator(); i.hasNext();) {
-                WorkflowInstance inst = (WorkflowInstance) i.next();
-                instsVector.add(getXmlRpcWorkflowInstance(inst));
-            }
-        }
-
-        return instsVector;
-    }
-
-    /**
-     * <p>
-     * Gets a {@link Hashtable} representation of a {@link Workflow} to be sent
-     * across the XML-RPC wire.
-     * </p>
-     * 
-     * @param w
-     *            The Workflow to be turned into a java.util.Hashtable
-     * @return A {@link Hashtable} representation of a {@link Workflow}.
-     */
-    public static Hashtable getXmlRpcWorkflow(Workflow w) {
-        Hashtable workflow = new Hashtable();
-        workflow.put("id", w.getId());
-        workflow.put("name", w.getName() != null ? w.getName() : "");
-        workflow.put("tasks", getXmlRpcWorkflowTasks(w.getTasks()));
-        workflow.put("conditions", getXmlRpcWorkflowConditions(w.getConditions()));
-
-        return workflow;
-    }
-
-    /**
-     * <p>
-     * Gets a {@link Workflow} from the XML-RPC {@link Hashtable} version.
-     * </p>
-     * 
-     * @param w
-     *            The Hashtable to obtain a Workflow from.
-     * @return a {@link Workflow} from the XML-RPC {@link Hashtable} version.
-     */
-    public static Workflow getWorkflowFromXmlRpc(Hashtable w) {
-        Workflow workflow = new Workflow();
-        workflow.setName((String) w.get("name"));
-        workflow.setId((String) w.get("id"));
-        workflow.setTasks(getWorkflowTasksFromXmlRpc((Vector) w.get("tasks")));
-        workflow.setConditions(getWorkflowConditionsFromXmlRpc((Vector)w.get("conditions")));
-
-        return workflow;
-    }
-
-    /**
-     * <p>
-     * Gets an XML-RPC version of the {@link WorkflowTask} to send over the
-     * wire.
-     * </p>
-     * 
-     * @param t
-     *            The WorkflowTask to obtain an XML-RPC Hashtable from.
-     * @return an XML-RPC version of the {@link WorkflowTask} to send over the
-     *         wire.
-     */
-    public static Hashtable getXmlRpcWorkflowTask(WorkflowTask t) {
-        Hashtable task = new Hashtable();
-        task.put("class", t.getTaskInstanceClassName());
-        task.put("id", t.getTaskId());
-        task.put("name", t.getTaskName());
-        task.put("order", String.valueOf(t.getOrder()));
-        task.put("conditions", getXmlRpcWorkflowConditions(t.getConditions()));
-        task.put("configuration", getXmlRpcWorkflowTaskConfiguration(t
-                .getTaskConfig()));
-        task.put("requiredMetFields", getXmlRpcWorkflowTaskReqMetFields(t
-                .getRequiredMetFields()));
-        return task;
-    }
-
-    /**
-     * <p>
-     * Gets a {@link Vector} representation of a {@link List} of
-     * {@link WorkflowTask}s to be sent across the XML-RPC wire.
-     * </p>
-     * 
-     * @param tasks
-     *            The {@link List} of {@link WorkflowTask}s.
-     * 
-     * @return A {@link Vector} representation of a {@link List} of
-     *         {@link WorkflowTask}s.
-     */
-    public static Vector getXmlRpcWorkflowTasks(List tasks) {
-        Vector wTasks = new Vector();
+    return workflow;
+  }
 
-        if (tasks == null) {
-            return wTasks;
-        }
-
-        for (Iterator i = tasks.iterator(); i.hasNext();) {
-            WorkflowTask t = (WorkflowTask) i.next();
-            Hashtable task = getXmlRpcWorkflowTask(t);
-            wTasks.add(task);
-        }
-
-        return wTasks;
-    }
-
-    /**
-     * <p>
-     * Gets a {@link WorkflowTask} from an XML-RPC {@link Hashtable} sent over
-     * the wire.
-     * </p>
-     * 
-     * @param task
-     *            The XML-RPC Hashtable version of the WorkflowTask.
-     * @return a {@link WorkflowTask} from an XML-RPC {@link Hashtable} sent
-     *         over the wire.
-     */
-    public static WorkflowTask getWorkflowTaskFromXmlRpc(Hashtable task) {
-        WorkflowTask t = new WorkflowTask();
-        t.setTaskInstanceClassName((String) task.get("class"));
-        t.setTaskId((String) task.get("id"));
-        t.setTaskName((String) task.get("name"));
-        t.setOrder(Integer.valueOf((String) task.get("order")).intValue());
-        t.setTaskConfig(getWorkflowTaskConfigurationFromXmlRpc((Hashtable) task
-                .get("configuration")));
-        t.setConditions(getWorkflowConditionsFromXmlRpc((Vector) task
-                .get("conditions")));
-        t
-                .setRequiredMetFields(getWorkflowTaskReqMetFieldsFromXmlRpc((Vector) task
-                        .get("requiredMetFields")));
-
-        return t;
-    }
-
-    /**
-     * <p>
-     * Gets a {@link List} of {@link WorkflowTask}s from an XML-RPC
-     * {@link Vector}.
-     * </p>
-     * 
-     * @param tsks
-     *            The {@link Vector} of {@link WorkflowTask}s.
-     * @return A {@link List} of {@link WorkflowTask}s from an XML-RPC
-     *         {@link Vector}.
-     */
-    public static List getWorkflowTasksFromXmlRpc(Vector tsks) {
-        List tasks = new Vector();
+  /**
+   * <p>
+   * Gets a {@link Workflow} from the XML-RPC {@link Hashtable} version.
+   * </p>
+   * 
+   * @param w
+   *          The Hashtable to obtain a Workflow from.
+   * @return a {@link Workflow} from the XML-RPC {@link Hashtable} version.
+   */
+  public static Workflow getWorkflowFromXmlRpc(Hashtable w) {
+    Workflow workflow = new Workflow();
+    workflow.setName((String) w.get("name"));
+    workflow.setId((String) w.get("id"));
+    workflow.setTasks(getWorkflowTasksFromXmlRpc((Vector) w.get("tasks")));
+    workflow.setConditions(getWorkflowConditionsFromXmlRpc((Vector) w
+        .get("conditions")));
 
-        for (Iterator i = tsks.iterator(); i.hasNext();) {
-            Hashtable taskHashtable = (Hashtable) i.next();
-            WorkflowTask task = getWorkflowTaskFromXmlRpc(taskHashtable);
-            tasks.add(task);
-
-        }
-        return tasks;
-    }
-
-    /**
-     * <p>
-     * Gets an XML-RPC {@link Hashtable} representation of the
-     * {@link WorkflowCondition} to send over the wire.
-     * </p>
-     * 
-     * @param c
-     *            The WorkflowCondition to turn into an XML-RPC Hashtable.
-     * @return an XML-RPC {@link Hashtable} representation of the
-     *         {@link WorkflowCondition} to send over the wire.
-     */
-    public static Hashtable getXmlRpcWorkflowCondition(WorkflowCondition c) {
-        Hashtable condition = new Hashtable();
-        condition.put("class", c.getConditionInstanceClassName());
-        condition.put("id", c.getConditionId());
-        condition.put("name", c.getConditionName());
-        condition.put("order", String.valueOf(c.getOrder()));
-        condition.put("timeout", String.valueOf(c.getTimeoutSeconds()));
-        condition.put("optional", String.valueOf(c.isOptional()));
-        condition.put("configuration", getXmlRpcWorkflowConditionConfig(c.getCondConfig()));
-        return condition;
-
-    }
-    
-    /**
-     * Bulids an XML-RPC friendly version of a {@link WorkflowConditionConfiguration}.
-     * 
-     * @param conf The {@link WorkflowConditionConfiguration} to transform into an XML-RPC {@link Hashtable}.
-     * @return an XML-RPC friendly version of a {@link WorkflowConditionConfiguration}.
-     */
-    public static Hashtable getXmlRpcWorkflowConditionConfig(WorkflowConditionConfiguration conf){
-        Hashtable confHash = new Hashtable();
-        for(String propName: (Set<String>)(Set<?>)conf.getProperties().keySet()){
-          confHash.put(propName, conf.getProperty(propName));
-        }
-        return confHash;   
-    }
-
-    /**
-     * <p>
-     * Gets a {@link Vector} representation of the {@link List} of
-     * {@link WorkflowCondition}s to be sent across the XML-RPC wire.
-     * </p>
-     * 
-     * @param conditions
-     *            The List of WorkflowConditions to turn into a Vector.
-     * @return A {@link Vector} representation of a {@link List} of
-     *         {@link WorkflowCondition}s.
-     */
-    public static Vector getXmlRpcWorkflowConditions(List conditions) {
-        Vector wConditions = new Vector();
+    return workflow;
+  }
 
-        /*
-         * because conditions are optional, so if they're null, just return an
-         * empty Vector: XML-RPC doesn't support null
-         */
-        if (conditions == null) {
-            return wConditions;
-        }
-
-        for (Iterator i = conditions.iterator(); i.hasNext();) {
-            WorkflowCondition c = (WorkflowCondition) i.next();
-            Hashtable condition = getXmlRpcWorkflowCondition(c);
-            wConditions.add(condition);
-        }
-
-        return wConditions;
-    }
-
-    /**
-     * Gets the required {@link List} of {@link String} met fields for this
-     * {@link WorkflowTask}.
-     * 
-     * @param fields
-     *            The fields required for this task.
-     * @return The {@link List} of {@link String} met fields for this
-     *         {@link WorkflowTask}.
-     */
-    public static List getWorkflowTaskReqMetFieldsFromXmlRpc(Vector fields) {
-        List reqFields = new Vector();
+  /**
+   * <p>
+   * Gets an XML-RPC version of the {@link WorkflowTask} to send over the wire.
+   * </p>
+   * 
+   * @param t
+   *          The WorkflowTask to obtain an XML-RPC Hashtable from.
+   * @return an XML-RPC version of the {@link WorkflowTask} to send over the
+   *         wire.
+   */
+  public static Hashtable getXmlRpcWorkflowTask(WorkflowTask t) {
+    Hashtable task = new Hashtable();
+    task.put("class", t.getTaskInstanceClassName());
+    task.put("id", t.getTaskId());
+    task.put("name", t.getTaskName());
+    task.put("order", String.valueOf(t.getOrder()));
+    task.put("conditions", getXmlRpcWorkflowConditions(t.getConditions()));
+    task.put("configuration",
+        getXmlRpcWorkflowTaskConfiguration(t.getTaskConfig()));
+    task.put("requiredMetFields",
+        getXmlRpcWorkflowTaskReqMetFields(t.getRequiredMetFields()));
+    return task;
+  }
 
-        if (fields == null) {
-            return reqFields;
-        }
-
-        for (Iterator i = fields.iterator(); i.hasNext();) {
-            String reqField = (String) i.next();
-            reqFields.add(reqField);
-        }
-
-        return reqFields;
-    }
-
-    /**
-     * Gets a {@link List} of {@link String}s that are required
-     * {@link Metadata} fields for this {@link WorkflowTask}.
-     * 
-     * @param metFields
-     *            The required {@link Metadata} fields.
-     * @return A {@link List} of {@link String}s that are required for this
-     *         {@link WorkflowTask}.
-     */
-    public static Vector getXmlRpcWorkflowTaskReqMetFields(List metFields) {
-        Vector fields = new Vector();
-        if (metFields == null) {
-            return fields;
-        }
-
-        for (Iterator i = metFields.iterator(); i.hasNext();) {
-            String reqFieldName = (String) i.next();
-            fields.add(reqFieldName);
-        }
-
-        return fields;
-    }
-
-    /**
-     * <p>
-     * Gets a {@link WorkflowCondition} from an XML-RPC {@link Hashtable}.
-     * </p>
-     * 
-     * @param cond
-     *            The Hashtable to turn into a real WorkflowCondition.
-     * @return a {@link WorkflowCondition} from an XML-RPC {@link Hashtable}.
+  /**
+   * <p>
+   * Gets a {@link Vector} representation of a {@link List} of
+   * {@link WorkflowTask}s to be sent across the XML-RPC wire.
+   * </p>
+   * 
+   * @param tasks
+   *          The {@link List} of {@link WorkflowTask}s.
+   * 
+   * @return A {@link Vector} representation of a {@link List} of
+   *         {@link WorkflowTask}s.
+   */
+  public static Vector getXmlRpcWorkflowTasks(List tasks) {
+    Vector wTasks = new Vector();
+
+    if (tasks == null) {
+      return wTasks;
+    }
+
+    for (Iterator i = tasks.iterator(); i.hasNext();) {
+      WorkflowTask t = (WorkflowTask) i.next();
+      Hashtable task = getXmlRpcWorkflowTask(t);
+      wTasks.add(task);
+    }
+
+    return wTasks;
+  }
+
+  /**
+   * <p>
+   * Gets a {@link WorkflowTask} from an XML-RPC {@link Hashtable} sent over the
+   * wire.
+   * </p>
+   * 
+   * @param task
+   *          The XML-RPC Hashtable version of the WorkflowTask.
+   * @return a {@link WorkflowTask} from an XML-RPC {@link Hashtable} sent over
+   *         the wire.
+   */
+  public static WorkflowTask getWorkflowTaskFromXmlRpc(Hashtable task) {
+    WorkflowTask t = new WorkflowTask();
+    t.setTaskInstanceClassName((String) task.get("class"));
+    t.setTaskId((String) task.get("id"));
+    t.setTaskName((String) task.get("name"));
+    t.setOrder(Integer.valueOf((String) task.get("order")).intValue());
+    t.setTaskConfig(getWorkflowTaskConfigurationFromXmlRpc((Hashtable) task
+        .get("configuration")));
+    t.setConditions(getWorkflowConditionsFromXmlRpc((Vector) task
+        .get("conditions")));
+    t.setRequiredMetFields(getWorkflowTaskReqMetFieldsFromXmlRpc((Vector) task
+        .get("requiredMetFields")));
+
+    return t;
+  }
+
+  /**
+   * <p>
+   * Gets a {@link List} of {@link WorkflowTask}s from an XML-RPC {@link Vector}
+   * .
+   * </p>
+   * 
+   * @param tsks
+   *          The {@link Vector} of {@link WorkflowTask}s.
+   * @return A {@link List} of {@link WorkflowTask}s from an XML-RPC
+   *         {@link Vector}.
+   */
+  public static List getWorkflowTasksFromXmlRpc(Vector tsks) {
+    List tasks = new Vector();
+
+    for (Iterator i = tsks.iterator(); i.hasNext();) {
+      Hashtable taskHashtable = (Hashtable) i.next();
+      WorkflowTask task = getWorkflowTaskFromXmlRpc(taskHashtable);
+      tasks.add(task);
+
+    }
+    return tasks;
+  }
+
+  /**
+   * <p>
+   * Gets an XML-RPC {@link Hashtable} representation of the
+   * {@link WorkflowCondition} to send over the wire.
+   * </p>
+   * 
+   * @param c
+   *          The WorkflowCondition to turn into an XML-RPC Hashtable.
+   * @return an XML-RPC {@link Hashtable} representation of the
+   *         {@link WorkflowCondition} to send over the wire.
+   */
+  public static Hashtable getXmlRpcWorkflowCondition(WorkflowCondition c) {
+    Hashtable condition = new Hashtable();
+    condition.put("class", c.getConditionInstanceClassName());
+    condition.put("id", c.getConditionId());
+    condition.put("name", c.getConditionName());
+    condition.put("order", String.valueOf(c.getOrder()));
+    condition.put("timeout", String.valueOf(c.getTimeoutSeconds()));
+    condition.put("optional", String.valueOf(c.isOptional()));
+    condition.put("configuration",
+        getXmlRpcWorkflowConditionConfig(c.getCondConfig()));
+    return condition;
+
+  }
+
+  /**
+   * Bulids an XML-RPC friendly version of a
+   * {@link WorkflowConditionConfiguration}.
+   * 
+   * @param conf
+   *          The {@link WorkflowConditionConfiguration} to transform into an
+   *          XML-RPC {@link Hashtable}.
+   * @return an XML-RPC friendly version of a
+   *         {@link WorkflowConditionConfiguration}.
+   */
+  public static Hashtable getXmlRpcWorkflowConditionConfig(
+      WorkflowConditionConfiguration conf) {
+    Hashtable confHash = new Hashtable();
+    for (String propName : (Set<String>) (Set<?>) conf.getProperties().keySet()) {
+      confHash.put(propName, conf.getProperty(propName));
+    }
+    return confHash;
+  }
+
+  /**
+   * <p>
+   * Gets a {@link Vector} representation of the {@link List} of
+   * {@link WorkflowCondition}s to be sent across the XML-RPC wire.
+   * </p>
+   * 
+   * @param conditions
+   *          The List of WorkflowConditions to turn into a Vector.
+   * @return A {@link Vector} representation of a {@link List} of
+   *         {@link WorkflowCondition}s.
+   */
+  public static Vector getXmlRpcWorkflowConditions(List conditions) {
+    Vector wConditions = new Vector();
+
+    /*
+     * because conditions are optional, so if they're null, just return an empty
+     * Vector: XML-RPC doesn't support null
      */
-    public static WorkflowCondition getWorkflowConditionFromXmlRpc(
-            Hashtable cond) {
-        WorkflowCondition condition = new WorkflowCondition();
-        condition.setConditionInstanceClassName((String) cond.get("class"));
-        condition.setConditionId((String) cond.get("id"));
-        condition.setConditionName((String) cond.get("name"));
-        condition.setOrder(Integer.valueOf((String) cond.get("order"))
-                .intValue());
-        condition.setTimeoutSeconds(Long.valueOf((String)cond.get("timeout")));
-        condition.setOptional(Boolean.valueOf((String)cond.get("optional")));
-        condition.setCondConfig(getWorkflowConditionConfigurationFromXmlRpc((Hashtable)cond.get("configuration")));
-        return condition;
+    if (conditions == null) {
+      return wConditions;
+    }
+
+    for (Iterator i = conditions.iterator(); i.hasNext();) {
+      WorkflowCondition c = (WorkflowCondition) i.next();
+      Hashtable condition = getXmlRpcWorkflowCondition(c);
+      wConditions.add(condition);
     }
 
+    return wConditions;
+  }
+
+  /**
+   * Gets the required {@link List} of {@link String} met fields for this
+   * {@link WorkflowTask}.
+   * 
+   * @param fields
+   *          The fields required for this task.
+   * @return The {@link List} of {@link String} met fields for this
+   *         {@link WorkflowTask}.
+   */
+  public static List getWorkflowTaskReqMetFieldsFromXmlRpc(Vector fields) {
+    List reqFields = new Vector();
+
+    if (fields == null) {
+      return reqFields;
+    }
+
+    for (Iterator i = fields.iterator(); i.hasNext();) {
+      String reqField = (String) i.next();
+      reqFields.add(reqField);
+    }
+
+    return reqFields;
+  }
+
+  /**
+   * Gets a {@link List} of {@link String}s that are required {@link Metadata}
+   * fields for this {@link WorkflowTask}.
+   * 
+   * @param metFields
+   *          The required {@link Metadata} fields.
+   * @return A {@link List} of {@link String}s that are required for this
+   *         {@link WorkflowTask}.
+   */
+  public static Vector getXmlRpcWorkflowTaskReqMetFields(List metFields) {
+    Vector fields = new Vector();
+    if (metFields == null) {
+      return fields;
+    }
+
+    for (Iterator i = metFields.iterator(); i.hasNext();) {
+      String reqFieldName = (String) i.next();
+      fields.add(reqFieldName);
+    }
+
+    return fields;
+  }
+
+  /**
+   * <p>
+   * Gets a {@link WorkflowCondition} from an XML-RPC {@link Hashtable}.
+   * </p>
+   * 
+   * @param cond
+   *          The Hashtable to turn into a real WorkflowCondition.
+   * @return a {@link WorkflowCondition} from an XML-RPC {@link Hashtable}.
+   */
+  public static WorkflowCondition getWorkflowConditionFromXmlRpc(Hashtable cond) {
+    WorkflowCondition condition = new WorkflowCondition();
+    condition.setConditionInstanceClassName((String) cond.get("class"));
+    condition.setConditionId((String) cond.get("id"));
+    condition.setConditionName((String) cond.get("name"));
+    condition.setOrder(Integer.valueOf((String) cond.get("order")).intValue());
+    condition.setTimeoutSeconds(Long.valueOf((String) cond.get("timeout")));
+    condition.setOptional(Boolean.valueOf((String) cond.get("optional")));
+    condition
+        .setCondConfig(getWorkflowConditionConfigurationFromXmlRpc((Hashtable) cond
+            .get("configuration")));
+    return condition;
+  }
+
   /**
    * Unravels a {@link WorkflowConditionConfiguration} from XML-RPC.
    * 
@@ -509,78 +517,75 @@ public final class XmlRpcStructFactory {
     return config;
   }
 
-    /**
-     * <p>
-     * Gets a {@link List} of {@link WorkflowCondition}s from an XML-RPC
-     * {@link Vector}.
-     * </p>
-     * 
-     * @param conds
-     *            The {@link Vector} of {@link WorkflowCondition}s.
-     * @return A {@link List} of {@link WorkflowCondition}s from an XML-RPC
-     *         {@link Vector}.
-     */
-    public static List getWorkflowConditionsFromXmlRpc(Vector conds) {
-        List conditions = new Vector();
+  /**
+   * <p>
+   * Gets a {@link List} of {@link WorkflowCondition}s from an XML-RPC
+   * {@link Vector}.
+   * </p>
+   * 
+   * @param conds
+   *          The {@link Vector} of {@link WorkflowCondition}s.
+   * @return A {@link List} of {@link WorkflowCondition}s from an XML-RPC
+   *         {@link Vector}.
+   */
+  public static List getWorkflowConditionsFromXmlRpc(Vector conds) {
+    List conditions = new Vector();
 
-        for (Iterator i = conds.iterator(); i.hasNext();) {
-            Hashtable cond = (Hashtable) i.next();
-            WorkflowCondition condition = getWorkflowConditionFromXmlRpc(cond);
-            conditions.add(condition);
-        }
-
-        return conditions;
-    }
-
-    /**
-     * <p>
-     * Gets a {@link Hashtable} representation of the passed in
-     * {@link WorkflowTaskConfiguration}'s {@link Properties} to be sent across
-     * the XML-RPC wire.
-     * </p>
-     * 
-     * @param config
-     *            The WorkflowTaskConfiguration to convert to a Hashtable.
-     * @return A {@link Hashtable} representation of the passed in
-     *         {@link WorkflowTaskConfiguration}'s {@link Properties}.
-     */
-    public static Hashtable getXmlRpcWorkflowTaskConfiguration(
-            WorkflowTaskConfiguration config) {
-        Hashtable configuration = new Hashtable();
-
-        for (Iterator i = config.getProperties().keySet().iterator(); i
-                .hasNext();) {
-            String name = (String) i.next();
-            String value = (String) config.getProperties().get(name);
-            configuration.put(name, value);
-        }
-
-        return configuration;
-    }
-
-    /**
-     * <p>
-     * Gets a {@link WorkflowTaskConfiguration} from an XML-RPC
-     * {@link Hashtable}.
-     * 
-     * @param config
-     *            The original Hashtable version of the
-     *            WorkflowTaskConfiguration.
-     * @return A {@link WorkflowTaskConfiguration} from an XML-RPC
-     *         {@link Hashtable}.
-     */
-    public static WorkflowTaskConfiguration getWorkflowTaskConfigurationFromXmlRpc(
-            Hashtable config) {
-        WorkflowTaskConfiguration configuration = new WorkflowTaskConfiguration();
-
-        for (Iterator i = config.keySet().iterator(); i.hasNext();) {
-            String name = (String) i.next();
-            String value = (String) config.get(name);
+    for (Iterator i = conds.iterator(); i.hasNext();) {
+      Hashtable cond = (Hashtable) i.next();
+      WorkflowCondition condition = getWorkflowConditionFromXmlRpc(cond);
+      conditions.add(condition);
+    }
+
+    return conditions;
+  }
 
-            configuration.getProperties().put(name, value);
-        }
+  /**
+   * <p>
+   * Gets a {@link Hashtable} representation of the passed in
+   * {@link WorkflowTaskConfiguration}'s {@link Properties} to be sent across
+   * the XML-RPC wire.
+   * </p>
+   * 
+   * @param config
+   *          The WorkflowTaskConfiguration to convert to a Hashtable.
+   * @return A {@link Hashtable} representation of the passed in
+   *         {@link WorkflowTaskConfiguration}'s {@link Properties}.
+   */
+  public static Hashtable getXmlRpcWorkflowTaskConfiguration(
+      WorkflowTaskConfiguration config) {
+    Hashtable configuration = new Hashtable();
 
-        return configuration;
+    for (Iterator i = config.getProperties().keySet().iterator(); i.hasNext();) {
+      String name = (String) i.next();
+      String value = (String) config.getProperties().get(name);
+      configuration.put(name, value);
     }
 
+    return configuration;
+  }
+
+  /**
+   * <p>
+   * Gets a {@link WorkflowTaskConfiguration} from an XML-RPC {@link Hashtable}.
+   * 
+   * @param config
+   *          The original Hashtable version of the WorkflowTaskConfiguration.
+   * @return A {@link WorkflowTaskConfiguration} from an XML-RPC
+   *         {@link Hashtable}.
+   */
+  public static WorkflowTaskConfiguration getWorkflowTaskConfigurationFromXmlRpc(
+      Hashtable config) {
+    WorkflowTaskConfiguration configuration = new WorkflowTaskConfiguration();
+
+    for (Iterator i = config.keySet().iterator(); i.hasNext();) {
+      String name = (String) i.next();
+      String value = (String) config.get(name);
+
+      configuration.getProperties().put(name, value);
+    }
+
+    return configuration;
+  }
+
 }

Modified: oodt/trunk/workflow/src/main/resources/workflow.sql
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/resources/workflow.sql?rev=1172060&r1=1172059&r2=1172060&view=diff
==============================================================================
--- oodt/trunk/workflow/src/main/resources/workflow.sql (original)
+++ oodt/trunk/workflow/src/main/resources/workflow.sql Sat Sep 17 20:22:51 2011
@@ -43,7 +43,8 @@ current_task_id int NOT NULL,
 start_date_time varchar(255),
 end_date_time varchar(255),
 current_task_start_date_time varchar(255),
-current_task_end_date_time varchar(255));
+current_task_end_date_time varchar(255),
+priority float);
 
 -- use this definition if you would like
 -- to use quoteFields (string versions of
@@ -56,7 +57,8 @@ current_task_id varchar(255) NOT NULL,
 start_date_time varchar(255),
 end_date_time varchar(255),
 current_task_start_date_time varchar(255),
-current_task_end_date_time varchar(255));
+current_task_end_date_time varchar(255),
+priority float);
 
 CREATE TABLE workflow_instance_metadata
 (workflow_instance_id int NOT NULL,

Added: oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/structs/TestFILOPrioritySorter.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/structs/TestFILOPrioritySorter.java?rev=1172060&view=auto
==============================================================================
--- oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/structs/TestFILOPrioritySorter.java (added)
+++ oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/structs/TestFILOPrioritySorter.java Sat Sep 17 20:22:51 2011
@@ -0,0 +1,86 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+package org.apache.oodt.cas.workflow.structs;
+
+//JDK imports
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+import java.util.Vector;
+
+//OODT imports
+import org.apache.oodt.cas.workflow.engine.SequentialProcessor;
+import org.apache.oodt.cas.workflow.engine.WorkflowProcessor;
+
+//Junit imports
+import junit.framework.TestCase;
+
+/**
+ * 
+ * Tests the {@link FILOPrioritySorter}.
+ * 
+ * @author mattmann
+ * @version $Revision$
+ * 
+ */
+public class TestFILOPrioritySorter extends TestCase {
+  
+  private int dateGen;
+  
+  public TestFILOPrioritySorter(){
+    this.dateGen = 0;
+  }
+
+  public void testSort() {
+    FILOPrioritySorter sorter = new FILOPrioritySorter();
+    WorkflowProcessor proc = getProcessor(2.0);
+    WorkflowProcessor proc2 = getProcessor(7.0);
+    WorkflowProcessor proc3 = getProcessor(9.0);
+    List<WorkflowProcessor> candidates = new Vector<WorkflowProcessor>();
+    candidates.add(proc3);
+    candidates.add(proc2);
+    candidates.add(proc);    
+    sorter.sort(candidates);
+    
+    assertNotNull(candidates);
+    assertEquals(3, candidates.size());
+    assertEquals(2.0, candidates.get(0).getWorkflowInstance().getPriority()
+        .getValue());
+    assertEquals(7.0, candidates.get(1).getWorkflowInstance().getPriority()
+        .getValue());
+    assertEquals(9.0, candidates.get(2).getWorkflowInstance().getPriority()
+        .getValue());
+  }
+
+  private WorkflowProcessor getProcessor(double priority) {
+    WorkflowInstance inst = new WorkflowInstance();
+    Date sd = new Date();
+    sd.setTime(sd.getTime()+(this.dateGen*5000));
+    this.dateGen++;
+    inst.setStartDate(sd);
+    inst.setId("winst-"+priority);
+    Workflow workflow = new Workflow();
+    workflow.setTasks(Collections.EMPTY_LIST);
+    inst.setWorkflow(workflow);
+    inst.setPriority(Priority.getPriority(priority));
+    SequentialProcessor processor = new SequentialProcessor(inst, null, null,
+        0L);
+    return processor;
+  }
+
+}

Added: oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/structs/TestHighestFIFOPrioritySorter.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/structs/TestHighestFIFOPrioritySorter.java?rev=1172060&view=auto
==============================================================================
--- oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/structs/TestHighestFIFOPrioritySorter.java (added)
+++ oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/structs/TestHighestFIFOPrioritySorter.java Sat Sep 17 20:22:51 2011
@@ -0,0 +1,81 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+package org.apache.oodt.cas.workflow.structs;
+
+//JDK imports
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+import java.util.Vector;
+
+//OODT imports
+import org.apache.oodt.cas.workflow.engine.SequentialProcessor;
+import org.apache.oodt.cas.workflow.engine.WorkflowProcessor;
+
+//Junit imports
+import junit.framework.TestCase;
+
+/**
+ * 
+ * Tests the {@link HighestPrioritySorter}.
+ * 
+ * @author mattmann
+ * @version $Revision$
+ * 
+ */
+public class TestHighestFIFOPrioritySorter extends TestCase {
+
+  private int dateGen;
+  
+  public TestHighestFIFOPrioritySorter(){
+    this.dateGen = 0;
+  }
+  
+  public void testSort() {
+    HighestFIFOPrioritySorter sorter = new HighestFIFOPrioritySorter(1, 15.0, 25.0);
+    WorkflowProcessor proc = getProcessor(2.0);
+    WorkflowProcessor proc2 = getProcessor(7.0);
+    List<WorkflowProcessor> candidates = new Vector<WorkflowProcessor>();
+    candidates.add(proc);
+    candidates.add(proc2);
+    sorter.sort(candidates);
+    assertNotNull(candidates);
+    assertEquals(2, candidates.size());
+    assertEquals(7.0, candidates.get(0).getWorkflowInstance().getPriority()
+        .getValue());
+    assertEquals(2.0, candidates.get(1).getWorkflowInstance().getPriority()
+        .getValue());
+  }
+
+  private WorkflowProcessor getProcessor(double priority) {
+    WorkflowInstance inst = new WorkflowInstance();
+    Date sd = new Date();
+    sd.setTime(sd.getTime()+(this.dateGen*5000));
+    this.dateGen++;
+    inst.setStartDate(new Date());
+    inst.setId("winst-"+priority);
+    Workflow workflow = new Workflow();
+    workflow.setTasks(Collections.EMPTY_LIST);
+    inst.setWorkflow(workflow);
+    inst.setPriority(Priority.getPriority(priority));
+    SequentialProcessor processor = new SequentialProcessor(inst, null, null,
+        0L);
+    return processor;
+  }
+
+}

Added: oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/structs/TestHighestPrioritySorter.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/structs/TestHighestPrioritySorter.java?rev=1172060&view=auto
==============================================================================
--- oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/structs/TestHighestPrioritySorter.java (added)
+++ oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/structs/TestHighestPrioritySorter.java Sat Sep 17 20:22:51 2011
@@ -0,0 +1,84 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+package org.apache.oodt.cas.workflow.structs;
+
+//JDK imports
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+import java.util.Vector;
+
+//OODT imports
+import org.apache.oodt.cas.workflow.engine.SequentialProcessor;
+import org.apache.oodt.cas.workflow.engine.WorkflowProcessor;
+
+//Junit imports
+import junit.framework.TestCase;
+
+/**
+ * 
+ * Tests the {@link HighestPrioritySorter}.
+ * 
+ * @author mattmann
+ * @version $Revision$
+ * 
+ */
+public class TestHighestPrioritySorter extends TestCase {
+
+  private int dateGen;
+  
+  public TestHighestPrioritySorter(){
+    this.dateGen = 0;
+  }
+  
+  
+  public void testSort() {
+    HighestPrioritySorter sorter = new HighestPrioritySorter();
+    WorkflowProcessor proc = getProcessor(2.0);
+    WorkflowProcessor proc2 = getProcessor(7.0);
+    List<WorkflowProcessor> candidates = new Vector<WorkflowProcessor>();
+    candidates.add(proc);
+    candidates.add(proc2);
+    System.out.println("BEFORE sort: ["+candidates+"]");
+    sorter.sort(candidates);
+    System.out.println("AFTER sort: ["+candidates+"]");
+    assertNotNull(candidates);
+    assertEquals(2, candidates.size());
+    assertEquals(7.0, candidates.get(0).getWorkflowInstance().getPriority()
+        .getValue());
+    assertEquals(2.0, candidates.get(1).getWorkflowInstance().getPriority()
+        .getValue());
+  }
+
+  private WorkflowProcessor getProcessor(double priority) {
+    WorkflowInstance inst = new WorkflowInstance();
+    Date sd = new Date();
+    sd.setTime(sd.getTime()+(this.dateGen*5000));
+    this.dateGen++;
+    inst.setStartDate(new Date());
+    inst.setId("winst-"+priority);
+    Workflow workflow = new Workflow();
+    workflow.setTasks(Collections.EMPTY_LIST);
+    inst.setWorkflow(workflow);
+    inst.setPriority(Priority.getPriority(priority));
+    SequentialProcessor processor = new SequentialProcessor(inst, null, null,
+        0L);
+    return processor;
+  }
+
+}

Modified: oodt/trunk/workflow/src/testdata/workflow.sql
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/testdata/workflow.sql?rev=1172060&r1=1172059&r2=1172060&view=diff
==============================================================================
--- oodt/trunk/workflow/src/testdata/workflow.sql (original)
+++ oodt/trunk/workflow/src/testdata/workflow.sql Sat Sep 17 20:22:51 2011
@@ -42,7 +42,8 @@ current_task_id int NOT NULL,
 start_date_time varchar(255),
 end_date_time varchar(255),
 current_task_start_date_time varchar(255),
-current_task_end_date_time varchar(255));
+current_task_end_date_time varchar(255),
+priority float NOT NULL);
 
 CREATE TABLE workflow_instance_metadata
 (workflow_instance_id int NOT NULL,