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 2012/09/04 03:03:30 UTC

svn commit: r1380415 - in /oodt/trunk: ./ workflow/src/main/java/org/apache/oodt/cas/workflow/engine/ workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/ workflow/src/main/java/org/apache/oodt/cas/workflow/structs/ workflow/src/main/j...

Author: mattmann
Date: Tue Sep  4 01:03:29 2012
New Revision: 1380415

URL: http://svn.apache.org/viewvc?rev=1380415&view=rev
Log:
- fix for OODT-490: Refactor WorkflowProcessor to push all of its state information into Workflow Instance

Added:
    oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/WorkflowProcessorHelper.java
      - copied, changed from r1372912, oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/util/WorkflowUtils.java
Removed:
    oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/util/WorkflowUtils.java
Modified:
    oodt/trunk/CHANGES.txt
    oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/TaskQuerier.java
    oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/TaskRunner.java
    oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/ConditionProcessor.java
    oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/ParallelProcessor.java
    oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/SequentialProcessor.java
    oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/TaskProcessor.java
    oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/WorkflowProcessor.java
    oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/WorkflowProcessorBuilder.java
    oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/WorkflowProcessorQueue.java
    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/structs/WorkflowTask.java
    oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/engine/MetSetterTaskQuerier.java
    oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/engine/QuerierAndRunnerUtils.java
    oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/engine/TestTaskQuerier.java
    oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/engine/TestThreadPoolWorkflowEngine.java
    oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/structs/TestWorkflowInstance.java

Modified: oodt/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/oodt/trunk/CHANGES.txt?rev=1380415&r1=1380414&r2=1380415&view=diff
==============================================================================
--- oodt/trunk/CHANGES.txt (original)
+++ oodt/trunk/CHANGES.txt Tue Sep  4 01:03:29 2012
@@ -4,6 +4,9 @@ Apache OODT Change Log
 Release 0.5
 --------------------------------------------
 
+* OODT-490: Refactor WorkflowProcessor to push all of its state information 
+  into Workflow Instance (mattmann)
+
 * OODT-432: Add FileSize to know metadata fields set by CAS-Crawler 
   (bfoster via mattmann)
 

Modified: oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/TaskQuerier.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/TaskQuerier.java?rev=1380415&r1=1380414&r2=1380415&view=diff
==============================================================================
--- oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/TaskQuerier.java (original)
+++ oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/TaskQuerier.java Tue Sep  4 01:03:29 2012
@@ -101,12 +101,11 @@ public class TaskQuerier implements Runn
       for (WorkflowProcessor processor : processors) {
         // OK now get its lifecycle
         WorkflowLifecycle lifecycle = getLifecycleForProcessor(processor);
-        if (!(processor.getState().getCategory().getName().equals("done") || processor
-            .getState().getCategory().getName().equals("holding"))) {
+        if (!(processor.getWorkflowInstance().getState().getCategory().getName().equals("done") || processor
+            .getWorkflowInstance().getState().getCategory().getName().equals("holding"))) {
           for (TaskProcessor tp : processor.getRunnableWorkflowProcessors()) {
             WorkflowState state = lifecycle.createState("Executing", "running",
                 "Added to Runnable queue");
-            tp.setState(state);
             tp.getWorkflowInstance().setState(state);
             if (this.repo != null) {
               try {
@@ -119,7 +118,7 @@ public class TaskQuerier implements Runn
               }
             }
             LOG.log(Level.INFO,
-                "Added processor with priority: [" + tp.getPriority() + "]");
+                "Added processor with priority: [" + tp.getWorkflowInstance().getPriority() + "]");
             processorsToRun.add(tp);
           }
 

Modified: oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/TaskRunner.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/TaskRunner.java?rev=1380415&r1=1380414&r2=1380415&view=diff
==============================================================================
--- oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/TaskRunner.java (original)
+++ oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/TaskRunner.java Tue Sep  4 01:03:29 2012
@@ -88,7 +88,7 @@ public class TaskRunner implements Runna
 
       try {
         if (nextTaskProcessor != null && runner.hasOpenSlots(nextTask)) {
-          runner.execute(nextTask, nextTaskProcessor.getDynamicMetadata());
+          runner.execute(nextTask, nextTaskProcessor.getWorkflowInstance().getSharedContext());
         }
       } catch (Exception e) {
         e.printStackTrace();
@@ -135,7 +135,7 @@ public class TaskRunner implements Runna
   }
 
   private void flagProcessorAsFailed(TaskProcessor nextTaskProcessor, String msg) {
-    nextTaskProcessor.setState(nextTaskProcessor
+    nextTaskProcessor.getWorkflowInstance().setState(nextTaskProcessor
         .getLifecycleManager()
         .getDefaultLifecycle()
         .createState("Failure", "done",

Modified: oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/ConditionProcessor.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/ConditionProcessor.java?rev=1380415&r1=1380414&r2=1380415&view=diff
==============================================================================
--- oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/ConditionProcessor.java (original)
+++ oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/ConditionProcessor.java Tue Sep  4 01:03:29 2012
@@ -19,35 +19,45 @@ package org.apache.oodt.cas.workflow.eng
 //OODT import
 import org.apache.oodt.cas.workflow.lifecycle.WorkflowLifecycleManager;
 import org.apache.oodt.cas.workflow.structs.Priority;
+import org.apache.oodt.cas.workflow.structs.WorkflowInstance;
 
 /**
  * 
+ * WorkflowProcessor which handles Workflow Pre/Post Conditions.
+ * 
  * @author bfoster
+ * @author mattmann
  * @version $Revision$
  * 
- * <p>
- * WorkflowProcessor which handles Workflow Pre/Post Conditions
- * </p>.
  */
 public class ConditionProcessor extends TaskProcessor {
 
-	public ConditionProcessor(WorkflowLifecycleManager lifecycleManager) {
-		super(lifecycleManager);
-		this.setConditionProcessor(true);
-	}
-	
-	public void setPriority(Priority priority) {
-		super.setPriority(Priority.getPriority(priority.getValue() - 0.1));
-	}
-	
-	@Override
-	public void setPreConditions(WorkflowProcessor preConditions) {
-		//not allowed
-	}
-	
-	@Override
-	public void setPostConditions(WorkflowProcessor postConditions) {
-		//not allowed
-	}
-	
+  public ConditionProcessor(WorkflowLifecycleManager lifecycleManager) {
+    super(lifecycleManager);
+  }
+
+  @Override
+  public void setPreConditions(WorkflowProcessor preConditions) {
+    // not allowed
+  }
+
+  @Override
+  public void setPostConditions(WorkflowProcessor postConditions) {
+    // not allowed
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see
+   * org.apache.oodt.cas.workflow.engine.processor.TaskProcessor#setWorkflowInstance
+   * (org.apache.oodt.cas.workflow.structs.WorkflowInstance)
+   */
+  @Override
+  public void setWorkflowInstance(WorkflowInstance instance) {
+    instance.setPriority(Priority
+        .getPriority(instance.getPriority().getValue() - 0.1));
+    super.setWorkflowInstance(instance);
+  }
+
 }

Modified: oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/ParallelProcessor.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/ParallelProcessor.java?rev=1380415&r1=1380414&r2=1380415&view=diff
==============================================================================
--- oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/ParallelProcessor.java (original)
+++ oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/ParallelProcessor.java Tue Sep  4 01:03:29 2012
@@ -21,7 +21,6 @@ import java.util.List;
 
 //OODT imports
 import org.apache.oodt.cas.workflow.lifecycle.WorkflowLifecycleManager;
-import org.apache.oodt.cas.workflow.util.WorkflowUtils;
 
 /**
  * 
@@ -33,8 +32,8 @@ import org.apache.oodt.cas.workflow.util
  * 
  */
 public class ParallelProcessor extends WorkflowProcessor {
-  
-  public ParallelProcessor(){
+
+  public ParallelProcessor() {
     this(null);
   }
 
@@ -46,9 +45,17 @@ public class ParallelProcessor extends W
     return this.getSubProcessors();
   }
 
-  public void handleSubProcessorMetadata(WorkflowProcessor workflowProcessor) {
-    this.setDynamicMetadata(mergeMetadata(this.getDynamicMetadata(),
-        workflowProcessor.getPassThroughDynamicMetadata()));
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.apache.oodt.cas.workflow.engine.processor.WorkflowProcessor#
+   * handleSubProcessorMetadata
+   * (org.apache.oodt.cas.workflow.engine.processor.WorkflowProcessor)
+   */
+  @Override
+  protected void handleSubProcessorMetadata(WorkflowProcessor workflowProcessor) {
+    // TODO Auto-generated method stub
+
   }
 
 }

Modified: oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/SequentialProcessor.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/SequentialProcessor.java?rev=1380415&r1=1380414&r2=1380415&view=diff
==============================================================================
--- oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/SequentialProcessor.java (original)
+++ oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/SequentialProcessor.java Tue Sep  4 01:03:29 2012
@@ -32,12 +32,12 @@ import org.apache.oodt.cas.workflow.life
  * @version $Revision$
  */
 public class SequentialProcessor extends WorkflowProcessor {
-  
-  public SequentialProcessor(){
+
+  public SequentialProcessor() {
     this(null);
   }
-  
-  public SequentialProcessor(WorkflowLifecycleManager lifecycleManager){
+
+  public SequentialProcessor(WorkflowLifecycleManager lifecycleManager) {
     super(lifecycleManager);
   }
 
@@ -52,16 +52,13 @@ public class SequentialProcessor extends
 
   @Override
   public void handleSubProcessorMetadata(WorkflowProcessor workflowProcessor) {
-    this.setDynamicMetadata(workflowProcessor.getPassThroughDynamicMetadata());
-    WorkflowProcessor nextWP = this.getNext();
-    if (nextWP != null)
-      nextWP.setDynamicMetadataRecur(workflowProcessor
-          .getPassThroughDynamicMetadata());
+    // do nothing
   }
 
   private WorkflowProcessor getNext() {
     for (WorkflowProcessor wp : this.getSubProcessors())
-      if (!wp.getState().getCategory().getName().equals("done"))
+      if (!wp.getWorkflowInstance().getState().getCategory().getName()
+          .equals("done"))
         return wp;
     return null;
   }

Modified: oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/TaskProcessor.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/TaskProcessor.java?rev=1380415&r1=1380414&r2=1380415&view=diff
==============================================================================
--- oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/TaskProcessor.java (original)
+++ oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/TaskProcessor.java Tue Sep  4 01:03:29 2012
@@ -25,6 +25,7 @@ import java.util.Vector;
 //OODT imports
 import org.apache.oodt.cas.workflow.lifecycle.WorkflowLifecycleManager;
 import org.apache.oodt.cas.workflow.structs.Priority;
+import org.apache.oodt.cas.workflow.structs.WorkflowInstance;
 import org.apache.oodt.cas.workflow.structs.WorkflowTaskInstance;
 
 /**
@@ -40,8 +41,8 @@ public class TaskProcessor extends Workf
 
   private Class<? extends WorkflowTaskInstance> instanceClass;
   private String jobId;
-  
-  public TaskProcessor(){
+
+  public TaskProcessor() {
     this(null);
   }
 
@@ -67,17 +68,19 @@ public class TaskProcessor extends Workf
   }
 
   @Override
-  public void setPriority(Priority priority) {
-    super.setPriority(Priority.getPriority(priority.getValue() + 0.1));
+  public void setWorkflowInstance(WorkflowInstance instance) {
+    instance.setPriority(Priority
+        .getPriority(instance.getPriority().getValue() + 0.1));
+    super.setWorkflowInstance(instance);
   }
 
   @Override
   public List<TaskProcessor> getRunnableWorkflowProcessors() {
     List<TaskProcessor> tps = super.getRunnableWorkflowProcessors();
     if (tps.size() == 0) {
-      if (this.getState().getName().equals("Blocked")) {
-        String requiredBlockTimeElapseString = this.getStaticMetadata()
-            .getMetadata("BlockTimeElapse");
+      if (this.getWorkflowInstance().getState().getName().equals("Blocked")) {
+        String requiredBlockTimeElapseString = this.getWorkflowInstance()
+            .getCurrentTask().getTaskConfig().getProperty("BlockTimeElapse");
         int requiredBlockTimeElapse = 2;
         if (requiredBlockTimeElapseString != null) {
           try {
@@ -87,14 +90,16 @@ public class TaskProcessor extends Workf
           }
         }
         Calendar calendar = Calendar.getInstance();
-        calendar.setTime(this.getState().getStartTime());
+        calendar.setTime(this.getWorkflowInstance().getState().getStartTime());
         long elapsedTime = ((System.currentTimeMillis() - calendar
             .getTimeInMillis()) / 1000) / 60;
         if (elapsedTime >= requiredBlockTimeElapse)
           tps.add(this);
-      } else if (this.getState().getName().equals("Queued")
+      } else if (this.getWorkflowInstance().getState().getName()
+          .equals("Queued")
           && this.passedPreConditions()
-          || this.getState().getName().equals("PreConditionSuccess")) {
+          || this.getWorkflowInstance().getState().getName()
+              .equals("PreConditionSuccess")) {
         tps.add(this);
       }
     }

Modified: oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/WorkflowProcessor.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/WorkflowProcessor.java?rev=1380415&r1=1380414&r2=1380415&view=diff
==============================================================================
--- oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/WorkflowProcessor.java (original)
+++ oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/WorkflowProcessor.java Tue Sep  4 01:03:29 2012
@@ -17,21 +17,14 @@
 package org.apache.oodt.cas.workflow.engine.processor;
 
 //JDK imports
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Vector;
-import java.util.Map.Entry;
-import java.util.logging.Level;
 import java.util.logging.Logger;
 
 //OODT imports
-import org.apache.oodt.cas.metadata.Metadata;
 import org.apache.oodt.cas.workflow.engine.ChangeType;
 import org.apache.oodt.cas.workflow.lifecycle.WorkflowLifecycleManager;
 import org.apache.oodt.cas.workflow.lifecycle.WorkflowState;
-import org.apache.oodt.cas.workflow.structs.Priority;
 import org.apache.oodt.cas.workflow.structs.WorkflowInstance;
 
 /**
@@ -51,62 +44,29 @@ import org.apache.oodt.cas.workflow.stru
 public abstract class WorkflowProcessor implements WorkflowProcessorListener,
     Comparable<WorkflowProcessor> {
 
-  public static final String LOCAL_KEYS = "WorkflowProcessor/Local/Keys";
-
   private static final Logger LOG = Logger.getLogger(WorkflowProcessor.class
       .getName());
 
   private WorkflowInstance workflowInstance;
-  private String executionType;
-  private List<String> excusedSubProcessorIds;
-  private WorkflowState state;
-  private List<WorkflowProcessor> subProcessors;
-  private List<WorkflowProcessorListener> listeners;
   private WorkflowProcessor preConditions;
   private WorkflowProcessor postConditions;
-  private ProcessorDateTimeInfo ProcessorDateTimeInfo;
-  private Priority priority;
-  private int minReqSuccessfulSubProcessors;
-  private Metadata staticMetadata;
-  private Metadata dynamicMetadata;
-  private boolean isConditionProcessor;
-  private int timesBlocked;
+  private List<String> excusedSubProcessorIds; //FIXME: read this in PackagedRepo: flow through instance
+  private List<WorkflowProcessor> subProcessors;
+  private List<WorkflowProcessorListener> listeners;
+  private int minReqSuccessfulSubProcessors; //FIXME: read this in PackagedRepo: flow through instance
   protected WorkflowLifecycleManager lifecycleManager;
+  protected WorkflowProcessorHelper helper;
 
   public WorkflowProcessor(WorkflowLifecycleManager lifecycleManager) {
     this.subProcessors = new Vector<WorkflowProcessor>();
     this.listeners = new Vector<WorkflowProcessorListener>();
-    this.ProcessorDateTimeInfo = new ProcessorDateTimeInfo();
-    this.staticMetadata = new Metadata();
-    this.dynamicMetadata = new Metadata();
     this.excusedSubProcessorIds = new Vector<String>();
     this.minReqSuccessfulSubProcessors = -1;
-    this.isConditionProcessor = false;
-    this.timesBlocked = 0;
     this.workflowInstance = new WorkflowInstance();
     this.lifecycleManager = lifecycleManager;
-    this.priority = Priority.getDefault();
+    this.helper = new WorkflowProcessorHelper(lifecycleManager);
   }
 
-  /**
-   * Cleans the dynamic and static Metadata for this WorkflowProcessor as
-   * defined by the {@link #LOCAL_KEYS} parameter. All keys and values belonging
-   * to that group will be removed from the processor met.
-   * 
-   * @return A cleansed version of the static and dynamic metadata, merged, and
-   *         with {@link #LOCAL_KEYS} removed.
-   */
-  public Metadata getPassThroughDynamicMetadata() {
-    Metadata passThroughMet = new Metadata(this.dynamicMetadata);
-    passThroughMet.removeMetadata(LOCAL_KEYS);
-    if (this.dynamicMetadata.getAllMetadata(LOCAL_KEYS) != null)
-      for (String key : this.dynamicMetadata.getAllMetadata(LOCAL_KEYS))
-        passThroughMet.removeMetadata(key);
-    if (this.staticMetadata.getAllMetadata(LOCAL_KEYS) != null)
-      for (String key : this.staticMetadata.getAllMetadata(LOCAL_KEYS))
-        passThroughMet.removeMetadata(key);
-    return passThroughMet;
-  }
 
   /**
    * @return the workflowInstance
@@ -124,21 +84,6 @@ public abstract class WorkflowProcessor 
   }
 
   /**
-   * @return the executionType
-   */
-  public String getExecutionType() {
-    return executionType;
-  }
-
-  /**
-   * @param executionType
-   *          the executionType to set
-   */
-  public void setExecutionType(String executionType) {
-    this.executionType = executionType;
-  }
-
-  /**
    * @return the excusedSubProcessorIds
    */
   public List<String> getExcusedSubProcessorIds() {
@@ -154,21 +99,6 @@ public abstract class WorkflowProcessor 
   }
 
   /**
-   * @return the state
-   */
-  public WorkflowState getState() {
-    return state;
-  }
-
-  /**
-   * @param state
-   *          the state to set
-   */
-  public void setState(WorkflowState state) {
-    this.state = state;
-  }
-
-  /**
    * @return the subProcessors
    */
   public List<WorkflowProcessor> getSubProcessors() {
@@ -199,67 +129,6 @@ public abstract class WorkflowProcessor 
   }
 
   /**
-   * @return the preConditions
-   */
-  public WorkflowProcessor getPreConditions() {
-    return preConditions;
-  }
-
-  /**
-   * @param preConditions
-   *          the preConditions to set
-   */
-  public void setPreConditions(WorkflowProcessor preConditions) {
-    this.preConditions = preConditions;
-  }
-
-  /**
-   * @return the postConditions
-   */
-  public WorkflowProcessor getPostConditions() {
-    return postConditions;
-  }
-
-  /**
-   * @param postConditions
-   *          the postConditions to set
-   */
-  public void setPostConditions(WorkflowProcessor postConditions) {
-    this.postConditions = postConditions;
-  }
-
-  /**
-   * @return the processorDateTimeInfo
-   */
-  public ProcessorDateTimeInfo getProcessorDateTimeInfo() {
-    return ProcessorDateTimeInfo;
-  }
-
-  /**
-   * @param processorDateTimeInfo
-   *          the processorDateTimeInfo to set
-   */
-  public void setProcessorDateTimeInfo(
-      ProcessorDateTimeInfo processorDateTimeInfo) {
-    ProcessorDateTimeInfo = processorDateTimeInfo;
-  }
-
-  /**
-   * @return the priority
-   */
-  public Priority getPriority() {
-    return priority;
-  }
-
-  /**
-   * @param priority
-   *          the priority to set
-   */
-  public void setPriority(Priority priority) {
-    this.priority = priority;
-  }
-
-  /**
    * @return the minReqSuccessfulSubProcessors
    */
   public int getMinReqSuccessfulSubProcessors() {
@@ -273,83 +142,53 @@ public abstract class WorkflowProcessor 
   public void setMinReqSuccessfulSubProcessors(int minReqSuccessfulSubProcessors) {
     this.minReqSuccessfulSubProcessors = minReqSuccessfulSubProcessors;
   }
-
+  
   /**
-   * @return the staticMetadata
+   * @return the lifecycleManager
    */
-  public Metadata getStaticMetadata() {
-    return staticMetadata;
+  public WorkflowLifecycleManager getLifecycleManager() {
+    return lifecycleManager;
   }
 
   /**
-   * @param staticMetadata
-   *          the staticMetadata to set
+   * @param lifecycleManager the lifecycleManager to set
    */
-  public void setStaticMetadata(Metadata staticMetadata) {
-    this.staticMetadata = staticMetadata;
-  }
+  public void setLifecycleManager(WorkflowLifecycleManager lifecycleManager) {
+    this.lifecycleManager = lifecycleManager;
+  }  
+  
 
   /**
-   * @return the dynamicMetadata
+   * @return the preConditions
    */
-  public Metadata getDynamicMetadata() {
-    return dynamicMetadata;
+  public WorkflowProcessor getPreConditions() {
+    return preConditions;
   }
 
-  /**
-   * @param dynamicMetadata
-   *          the dynamicMetadata to set
-   */
-  public void setDynamicMetadata(Metadata dynamicMetadata) {
-    this.dynamicMetadata = dynamicMetadata;
-  }
 
   /**
-   * @return the isConditionProcessor
+   * @param preConditions the preConditions to set
    */
-  public boolean isConditionProcessor() {
-    return isConditionProcessor;
+  public void setPreConditions(WorkflowProcessor preConditions) {
+    this.preConditions = preConditions;
   }
 
-  /**
-   * @param isConditionProcessor
-   *          the isConditionProcessor to set
-   */
-  public void setConditionProcessor(boolean isConditionProcessor) {
-    this.isConditionProcessor = isConditionProcessor;
-  }
 
   /**
-   * @return the timesBlocked
+   * @return the postConditions
    */
-  public int getTimesBlocked() {
-    return timesBlocked;
+  public WorkflowProcessor getPostConditions() {
+    return postConditions;
   }
 
-  /**
-   * @param timesBlocked
-   *          the timesBlocked to set
-   */
-  public void setTimesBlocked(int timesBlocked) {
-    this.timesBlocked = timesBlocked;
-  }
-  
-  /**
-   * @return the lifecycleManager
-   */
-  public WorkflowLifecycleManager getLifecycleManager() {
-    return lifecycleManager;
-  }
 
   /**
-   * @param lifecycleManager the lifecycleManager to set
+   * @param postConditions the postConditions to set
    */
-  public void setLifecycleManager(WorkflowLifecycleManager lifecycleManager) {
-    this.lifecycleManager = lifecycleManager;
+  public void setPostConditions(WorkflowProcessor postConditions) {
+    this.postConditions = postConditions;
   }  
 
-
-
   /*
    * (non-Javadoc)
    * 
@@ -357,7 +196,8 @@ public abstract class WorkflowProcessor 
    */
   @Override
   public int compareTo(WorkflowProcessor workflowProcessor) {
-    return this.priority.compareTo(workflowProcessor.priority);
+    return this.getWorkflowInstance().getPriority().
+       compareTo(workflowProcessor.getWorkflowInstance().getPriority());
   }
 
   /*
@@ -406,7 +246,8 @@ public abstract class WorkflowProcessor 
 
   protected boolean passedPreConditions() {
     if (this.getPreConditions() != null) {
-      return this.getPreConditions().getState().getName().equals("Success");
+      return this.getPreConditions().getWorkflowInstance().
+         getState().getName().equals("Success");
     } else {
       return true;
     }
@@ -414,39 +255,13 @@ public abstract class WorkflowProcessor 
 
   protected boolean passedPostConditions() {
     if (this.getPostConditions() != null) {
-      return this.getPostConditions().getState().getName().equals("Success");
+      return this.getPostConditions().getWorkflowInstance().
+         getState().getName().equals("Success");
     } else {
       return true;
     }
   }
 
-  protected boolean containsCategory(
-      List<WorkflowProcessor> workflowProcessors, String categoryName) {
-    for (WorkflowProcessor workflowProcessor : workflowProcessors)
-      if (workflowProcessor.getState().getCategory().getName()
-          .equals(categoryName))
-        return true;
-    return false;
-  }
-  
-  protected Metadata mergeMetadata(Metadata m1, Metadata m2) {
-    HashMap<String, LinkedHashSet<String>> merge = new HashMap<String, LinkedHashSet<String>>();
-    List<Metadata> metadatas = Arrays.asList(m1, m2);
-    for (Metadata m : metadatas) {
-      for (String key : m.getAllKeys()) {
-        LinkedHashSet<String> values = merge.get(key);
-        if (values == null)
-          values = new LinkedHashSet<String>();
-        values.addAll(m.getAllMetadata(key));
-        merge.put(key, values);
-      }
-    }
-    Metadata m = new Metadata();
-    for (Entry<String, LinkedHashSet<String>> entry : merge.entrySet())
-      m.addMetadata(entry.getKey(), new Vector<String>(entry.getValue()));
-    return m;
-  }
-
   /**
    * First checks to see if any of this Processor's {@link #subProcessors} have
    * arrived in a state within the done category. If so the method determines if
@@ -463,8 +278,8 @@ public abstract class WorkflowProcessor 
    * @return A {@link WorkflowState}, according to the method description.
    */
   protected WorkflowState isDone() {
-    if (containsCategory(this.getSubProcessors(), "done")) {
-      List<WorkflowProcessor> failedSubProcessors = getWorkflowProcessorsByState(
+    if (this.helper.containsCategory(this.getSubProcessors(), "done")) {
+      List<WorkflowProcessor> failedSubProcessors = this.helper.getWorkflowProcessorsByState(
           this.getSubProcessors(), "Failure");
       if (this.minReqSuccessfulSubProcessors != -1
           && failedSubProcessors.size() > (this.getSubProcessors().size() - this.minReqSuccessfulSubProcessors))
@@ -480,7 +295,7 @@ public abstract class WorkflowProcessor 
                   + "] failed.");
         }
       }
-      if (allProcessorsSameCategory(this.getSubProcessors(), "done"))
+      if (this.helper.allProcessorsSameCategory(this.getSubProcessors(), "done"))
         return lifecycleManager.getDefaultLifecycle().createState(
             "ResultsSuccess",
             "results",
@@ -494,95 +309,6 @@ public abstract class WorkflowProcessor 
             + workflowInstance.getId() + "] are " + "not complete");
   }
 
-  /**
-   * Recursively set a WorkflowProcessor and its sub-processor's dynamic
-   * Metadata, along with the associated metadata of the processor (and
-   * sub-processor)'s pre- and post- conditions.
-   * 
-   * @param dynamicMetadata
-   *          The dynamic {@link Metadata} to propogate.
-   */
-  protected synchronized void setDynamicMetadataRecur(Metadata dynamicMetadata) {
-    if (dynamicMetadata != null) {
-      for (WorkflowProcessor subProcessor : this.getSubProcessors())
-        subProcessor.setDynamicMetadataRecur(dynamicMetadata);
-      if (this.getPreConditions() != null)
-        this.getPreConditions().setDynamicMetadataRecur(dynamicMetadata);
-      if (this.getPostConditions() != null)
-        this.getPostConditions().setDynamicMetadataRecur(dynamicMetadata);
-      this.setDynamicMetadata(dynamicMetadata);
-    } else {
-      LOG.log(Level.WARNING,
-          "Attempt to set null dynamic metadata for workflow instance: id: ["
-              + workflowInstance.getId() + "]");
-    }
-  }
-
-  /**
-   * Verifies that all provided WorkflowProcessors are in a state belonging to
-   * the given categoryName.
-   * 
-   * @param workflowProcessors
-   *          The {@link List} of WorkflowProcessors to inspect.
-   * @param categoryName
-   *          The name of the WorkflowState's category to check against.
-   * @return True if they are all in the same category, false otherwise.
-   */
-  protected boolean allProcessorsSameCategory(
-      List<WorkflowProcessor> workflowProcessors, String categoryName) {
-    for (WorkflowProcessor workflowProcessor : workflowProcessors)
-      if (!workflowProcessor.getState().getCategory().getName()
-          .equals(categoryName))
-        return false;
-    return true;
-  }
-
-  /**
-   * Sub-selects all WorkflowProcessors provided by the provided state
-   * identified by stateName.
-   * 
-   * @param workflowProcessors
-   *          The {@link List} of WorkflowProcessors to subset.
-   * 
-   * @param stateName
-   *          The name of the state to subset by.
-   * @return A subset version of the provided {@link List} of
-   *         WorkflowProcessors.
-   */
-  protected List<WorkflowProcessor> getWorkflowProcessorsByState(
-      List<WorkflowProcessor> workflowProcessors, String stateName) {
-    List<WorkflowProcessor> returnProcessors = new Vector<WorkflowProcessor>();
-    for (WorkflowProcessor workflowProcessor : workflowProcessors) {
-      if (workflowProcessor.getState().equals(stateName)) {
-        returnProcessors.add(workflowProcessor);
-      }
-    }
-    return returnProcessors;
-  }
-
-  /**
-   * Sub-selects all WorkflowProcessors provided by the provided category
-   * identified by categoryName.
-   * 
-   * @param workflowProcessors
-   *          The {@link List} of WorkflowProcessors to subset.
-   * 
-   * @param categoryName
-   *          The name of the category to subset by.
-   * @return A subset version of the provided {@link List} of
-   *         WorkflowProcessors.
-   */
-  protected List<WorkflowProcessor> getWorkflowProcessorsByCategory(
-      List<WorkflowProcessor> workflowProcessors, String categoryName) {
-    List<WorkflowProcessor> returnProcessors = new Vector<WorkflowProcessor>();
-    for (WorkflowProcessor workflowProcessor : workflowProcessors) {
-      if (workflowProcessor.getState().getCategory().getName()
-          .equals(categoryName)) {
-        returnProcessors.add(workflowProcessor);
-      }
-    }
-    return returnProcessors;
-  }
 
   /**
    * This is the core method of the WorkflowProcessor class in the new Wengine
@@ -603,6 +329,4 @@ public abstract class WorkflowProcessor 
   protected abstract void handleSubProcessorMetadata(
       WorkflowProcessor workflowProcessor);
 
-  // FIXME: grab the rest of this class from the wengine-branch
-  // and drop it in and start working through the errors.
 }

Modified: oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/WorkflowProcessorBuilder.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/WorkflowProcessorBuilder.java?rev=1380415&r1=1380414&r2=1380415&view=diff
==============================================================================
--- oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/WorkflowProcessorBuilder.java (original)
+++ oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/WorkflowProcessorBuilder.java Tue Sep  4 01:03:29 2012
@@ -82,7 +82,7 @@ public class WorkflowProcessorBuilder {
     WorkflowProcessor wp = clazz.newInstance();
     if(this.id != null) wp.getWorkflowInstance().setId(id);
     if(this.lifecycleManager != null) wp.setLifecycleManager(lifecycleManager);
-    if(this.priority != -1) wp.setPriority(Priority.getPriority(priority));
+    if(this.priority != -1) wp.getWorkflowInstance().setPriority(Priority.getPriority(priority));
     if(this.subProcessors != null) wp.setSubProcessors(subProcessors);
     return wp;
   }

Copied: oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/WorkflowProcessorHelper.java (from r1372912, oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/util/WorkflowUtils.java)
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/WorkflowProcessorHelper.java?p2=oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/WorkflowProcessorHelper.java&p1=oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/util/WorkflowUtils.java&r1=1372912&r2=1380415&rev=1380415&view=diff
==============================================================================
--- oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/util/WorkflowUtils.java (original)
+++ oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/WorkflowProcessorHelper.java Tue Sep  4 01:03:29 2012
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.oodt.cas.workflow.util;
+package org.apache.oodt.cas.workflow.engine.processor;
 
 //OODT imports
 import org.apache.oodt.commons.exec.ExecHelper;
@@ -24,21 +24,14 @@ import org.apache.oodt.cas.workflow.stru
 import org.apache.oodt.cas.workflow.structs.WorkflowCondition;
 import org.apache.oodt.cas.workflow.structs.ParentChildWorkflow;
 import org.apache.oodt.cas.workflow.structs.WorkflowTaskInstance;
-import org.apache.oodt.cas.workflow.engine.processor.TaskProcessor;
-import org.apache.oodt.cas.workflow.engine.processor.WorkflowProcessor;
 import org.apache.oodt.cas.workflow.lifecycle.WorkflowLifecycle;
 import org.apache.oodt.cas.workflow.lifecycle.WorkflowLifecycleManager;
-import org.apache.oodt.cas.workflow.lifecycle.WorkflowState;
 
 //JDK imports
 import java.net.InetAddress;
-import java.util.Arrays;
-import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Vector;
-import java.util.HashMap;
-import java.util.Map.Entry;
 
 //APACHE imports
 import org.apache.commons.lang.StringUtils;
@@ -52,11 +45,11 @@ import org.apache.commons.lang.StringUti
  * @version $Revision$
  * 
  */
-public class WorkflowUtils {
+public class WorkflowProcessorHelper {
 
   private WorkflowLifecycleManager lifecycle;
 
-  public WorkflowUtils(WorkflowLifecycleManager lifecycle) {
+  public WorkflowProcessorHelper(WorkflowLifecycleManager lifecycle) {
     this.lifecycle = lifecycle;
   }
 
@@ -73,11 +66,14 @@ public class WorkflowUtils {
                         .getId()
                     + "', name = '"
                     + skeleton.getWorkflowInstance().getParentChildWorkflow()
-                        .getName() + "', ") + "execution = '"
-            + skeleton.getExecutionType() + "', state = '"
-            + skeleton.getState().getName() + "']");// , properties
-                                                    // =
-                                                    // " + processor.getStaticMetadata().asHashtable() + "]");
+                        .getName() + "', ")
+            + "execution = '"
+            + skeleton.getWorkflowInstance().getParentChildWorkflow()
+                .getGraph().getExecutionType() + "', state = '"
+            + skeleton.getWorkflowInstance().getState().getName() + "']");// ,
+                                                                          // properties
+    // =
+    // " + processor.getStaticMetadata().asHashtable() + "]");
     if (skeleton.getPreConditions() != null)
       stringModel.append(indent + "{PreCond:" + indent + "   "
           + toString(skeleton.getPreConditions(), indent + "      ") + "}");
@@ -99,45 +95,45 @@ public class WorkflowUtils {
         + "']\n");
     stringModel.append("   - instance = '"
         + skeleton.getWorkflowInstance().getId() + "'\n");
-    stringModel.append("   - execution = '" + skeleton.getExecutionType()
-        + "'\n");
-    stringModel.append("   - timesBlocked = '" + skeleton.getTimesBlocked()
-        + "'\n");
+    stringModel.append("   - execution = '"
+        + skeleton.getWorkflowInstance().getParentChildWorkflow().getGraph()
+            .getExecutionType() + "'\n");
+    stringModel.append("   - timesBlocked = '"
+        + skeleton.getWorkflowInstance().getTimesBlocked() + "'\n");
     stringModel.append("   - dates: \n");
     stringModel.append("        CreationDate = '"
-        + skeleton.getProcessorDateTimeInfo().getCreationDate() + "'\n");
-    stringModel.append("        ReadyDate = '"
-        + skeleton.getProcessorDateTimeInfo().getReadyDate() + "'\n");
-    stringModel.append("        ExecutionDate = '"
-        + skeleton.getProcessorDateTimeInfo().getExecutionDate() + "'\n");
+        + skeleton.getWorkflowInstance().getStartDate() + "'\n");
     stringModel.append("        CompletionDate = '"
-        + skeleton.getProcessorDateTimeInfo().getCompletionDate() + "'\n");
+        + skeleton.getWorkflowInstance().getEndDate() + "'\n");
     stringModel.append("   - state: \n");
-    stringModel.append("        name = '" + skeleton.getState().getName()
-        + "'\n");
+    stringModel.append("        name = '"
+        + skeleton.getWorkflowInstance().getState().getName() + "'\n");
     stringModel.append("        startTime = '"
-        + skeleton.getState().getStartTime() + "'\n");
-    stringModel.append("        message = '" + skeleton.getState().getMessage()
-        + "'\n");
-    stringModel.append("   - priority = '" + skeleton.getPriority() + "'\n");
+        + skeleton.getWorkflowInstance().getState().getStartTime() + "'\n");
+    stringModel.append("        message = '"
+        + skeleton.getWorkflowInstance().getState().getMessage() + "'\n");
+    stringModel.append("   - priority = '"
+        + skeleton.getWorkflowInstance().getPriority() + "'\n");
     stringModel
         .append("   - execusedSubProcessors = '"
             + StringUtils.join(skeleton.getExcusedSubProcessorIds().iterator(),
                 ",") + "'\n");
     stringModel.append("   - static metadata = \n");
-    for (String key : skeleton.getStaticMetadata().getAllKeys())
+    for (String key : skeleton.getWorkflowInstance().getSharedContext()
+        .getAllKeys())
       stringModel.append("      + "
           + key
           + " -> '"
-          + StringUtils.join(skeleton.getStaticMetadata().getAllMetadata(key),
-              ",") + "'\n");
+          + StringUtils.join(skeleton.getWorkflowInstance().getSharedContext()
+              .getAllMetadata(key), ",") + "'\n");
     stringModel.append("   - dynamic metadata = \n");
-    for (String key : skeleton.getDynamicMetadata().getAllKeys())
+    for (String key : skeleton.getWorkflowInstance().getSharedContext()
+        .getAllKeys())
       stringModel.append("      + "
           + key
           + " -> '"
-          + StringUtils.join(skeleton.getDynamicMetadata().getAllMetadata(key),
-              ",") + "'\n");
+          + StringUtils.join(skeleton.getWorkflowInstance().getSharedContext()
+              .getAllMetadata(key), ",") + "'\n");
     return stringModel.toString();
   }
 
@@ -167,26 +163,24 @@ public class WorkflowUtils {
       throws Exception {
     WorkflowProcessor wp = modelToProcessorMap.get(
         model.getGraph().getExecutionType()).newInstance();
-    WorkflowLifecycle wLifecycle = lifecycle.getLifecycleForWorkflow(model) != null ? lifecycle
-        .getLifecycleForWorkflow(model) : lifecycle.getDefaultLifecycle();
+    WorkflowLifecycle wLifecycle = getLifecycle(model);
     // FIXME: I'm not sure what these excused processor Ids are. I didn't seem
     // need them in the PackagedWorkflowRepository, so not sure what they do.
     // wp.setExcusedSubProcessorIds(model.getGraph().getExcusedSubProcessorIds());
     wp.getWorkflowInstance().setId(instanceId);
-    wp.setConditionProcessor(isCondition);
-    wp.setExecutionType(model.getGraph().getExecutionType());
     if (model.getPreConditions() != null)
       wp.setPreConditions(buildProcessor(instanceId, model,
           modelToProcessorMap, true));
     if (model.getPostConditions() != null)
       wp.setPostConditions(buildProcessor(instanceId, model,
           modelToProcessorMap, false));
-    wp.setPriority(Priority.getDefault());
+    wp.getWorkflowInstance().setPriority(Priority.getDefault());
     wp.setMinReqSuccessfulSubProcessors(Integer.parseInt(model.getGraph()
         .getMinReqSuccessfulSubProcessors()));
-    wp.setStaticMetadata(new Metadata());
-    wp.setState(wLifecycle.createState("Loaded", wLifecycle
-        .getStageForWorkflow("Loaded").getName(), ""));
+    wp.getWorkflowInstance().setSharedContext(new Metadata());
+    wp.getWorkflowInstance().setState(
+        wLifecycle.createState("Loaded",
+            wLifecycle.getStageForWorkflow("Loaded").getName(), ""));
     if (wp instanceof TaskProcessor)
       ((TaskProcessor) wp)
           .setInstanceClass((Class<? extends WorkflowTaskInstance>) Class
@@ -252,9 +246,75 @@ public class WorkflowUtils {
     return null;
   }
 
-  public List<WorkflowProcessor> getTasks(WorkflowProcessor skeleton) {
+  /**
+   * Verifies that all provided WorkflowProcessors are in a state belonging to
+   * the given categoryName.
+   * 
+   * @param workflowProcessors
+   *          The {@link List} of WorkflowProcessors to inspect.
+   * @param categoryName
+   *          The name of the WorkflowState's category to check against.
+   * @return True if they are all in the same category, false otherwise.
+   */
+  public boolean allProcessorsSameCategory(
+      List<WorkflowProcessor> workflowProcessors, String categoryName) {
+    for (WorkflowProcessor workflowProcessor : workflowProcessors)
+      if (!workflowProcessor.getWorkflowInstance().getState().getCategory()
+          .getName().equals(categoryName))
+        return false;
+    return true;
+  }
+
+  /**
+   * Sub-selects all WorkflowProcessors provided by the provided state
+   * identified by stateName.
+   * 
+   * @param workflowProcessors
+   *          The {@link List} of WorkflowProcessors to subset.
+   * 
+   * @param stateName
+   *          The name of the state to subset by.
+   * @return A subset version of the provided {@link List} of
+   *         WorkflowProcessors.
+   */
+  public List<WorkflowProcessor> getWorkflowProcessorsByState(
+      List<WorkflowProcessor> workflowProcessors, String stateName) {
+    List<WorkflowProcessor> returnProcessors = new Vector<WorkflowProcessor>();
+    for (WorkflowProcessor workflowProcessor : workflowProcessors) {
+      if (workflowProcessor.getWorkflowInstance().getState().equals(stateName)) {
+        returnProcessors.add(workflowProcessor);
+      }
+    }
+    return returnProcessors;
+  }
+
+  /**
+   * Sub-selects all WorkflowProcessors provided by the provided category
+   * identified by categoryName.
+   * 
+   * @param workflowProcessors
+   *          The {@link List} of WorkflowProcessors to subset.
+   * 
+   * @param categoryName
+   *          The name of the category to subset by.
+   * @return A subset version of the provided {@link List} of
+   *         WorkflowProcessors.
+   */
+  public List<WorkflowProcessor> getWorkflowProcessorsByCategory(
+      List<WorkflowProcessor> workflowProcessors, String categoryName) {
+    List<WorkflowProcessor> returnProcessors = new Vector<WorkflowProcessor>();
+    for (WorkflowProcessor workflowProcessor : workflowProcessors) {
+      if (workflowProcessor.getWorkflowInstance().getState().getCategory()
+          .getName().equals(categoryName)) {
+        returnProcessors.add(workflowProcessor);
+      }
+    }
+    return returnProcessors;
+  }
+
+  public List<WorkflowProcessor> toTasks(WorkflowProcessor processor) {
     List<WorkflowProcessor> options = new Vector<WorkflowProcessor>();
-    options.add(skeleton);
+    options.add(processor);
     List<WorkflowProcessor> tasks = new Vector<WorkflowProcessor>();
     while (!options.isEmpty()) {
       WorkflowProcessor currentOption = options.remove(0);
@@ -272,54 +332,13 @@ public class WorkflowUtils {
     return tasks;
   }
 
-  public void validateWorkflowProcessor(WorkflowProcessor wp) {
-    if (wp instanceof TaskProcessor) {
-      WorkflowState state = wp.getState();
-      WorkflowLifecycle lc = this.lifecycle.getLifecycleForWorkflow(wp
-          .getWorkflowInstance().getWorkflow());
-      if (lc == null)
-        lc = this.lifecycle.getDefaultLifecycle();
-      if ((state.getName().equals("WaitingOnResources") && state.getPrevState()
-          .getName().equals("Executing"))
-          || state.getName().equals("Executing"))
-        wp.setState(lc.createState("Queued", "waiting",
-            "Marked back to queued state because of system failure"));
-      else
-        wp.setState(state);
-    } else {
-      if (wp.getPreConditions() != null)
-        validateWorkflowProcessor(wp.getPreConditions());
-      for (WorkflowProcessor child : wp.getSubProcessors())
-        validateWorkflowProcessor(child);
-      if (wp.getPostConditions() != null)
-        validateWorkflowProcessor(wp.getPostConditions());
-    }
-  }
-
-  public List<Metadata> getDynamicMetadata(
-      List<WorkflowProcessor> workflowProcessors) {
-    List<Metadata> metadatas = new Vector<Metadata>();
+  public boolean containsCategory(List<WorkflowProcessor> workflowProcessors,
+      String categoryName) {
     for (WorkflowProcessor workflowProcessor : workflowProcessors)
-      metadatas.add(workflowProcessor.getDynamicMetadata());
-    return metadatas;
-  }
-
-  public Metadata mergeMetadata(Metadata m1, Metadata m2) {
-    HashMap<String, LinkedHashSet<String>> merge = new HashMap<String, LinkedHashSet<String>>();
-    List<Metadata> metadatas = Arrays.asList(m1, m2);
-    for (Metadata m : metadatas) {
-      for (String key : m.getAllKeys()) {
-        LinkedHashSet<String> values = merge.get(key);
-        if (values == null)
-          values = new LinkedHashSet<String>();
-        values.addAll(m.getAllMetadata(key));
-        merge.put(key, values);
-      }
-    }
-    Metadata m = new Metadata();
-    for (Entry<String, LinkedHashSet<String>> entry : merge.entrySet())
-      m.addMetadata(entry.getKey(), new Vector<String>(entry.getValue()));
-    return m;
+      if (workflowProcessor.getWorkflowInstance().getState().getCategory()
+          .getName().equals(categoryName))
+        return true;
+    return false;
   }
 
   public String getHostName() {
@@ -336,4 +355,9 @@ public class WorkflowUtils {
       return "Unknown";
     return host;
   }
+
+  private WorkflowLifecycle getLifecycle(ParentChildWorkflow model) {
+    return lifecycle.getLifecycleForWorkflow(model) != null ? lifecycle
+        .getLifecycleForWorkflow(model) : lifecycle.getDefaultLifecycle();
+  }
 }

Modified: oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/WorkflowProcessorQueue.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/WorkflowProcessorQueue.java?rev=1380415&r1=1380414&r2=1380415&view=diff
==============================================================================
--- oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/WorkflowProcessorQueue.java (original)
+++ oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/WorkflowProcessorQueue.java Tue Sep  4 01:03:29 2012
@@ -25,7 +25,6 @@ import java.util.logging.Level;
 import java.util.logging.Logger;
 
 //OODT imports
-import org.apache.oodt.cas.metadata.Metadata;
 import org.apache.oodt.cas.workflow.engine.TaskQuerier;
 import org.apache.oodt.cas.workflow.instrepo.WorkflowInstanceRepository;
 import org.apache.oodt.cas.workflow.lifecycle.WorkflowLifecycle;
@@ -116,7 +115,6 @@ public class WorkflowProcessorQueue {
     if (inst.getParentChildWorkflow().getTasks() != null
         && inst.getParentChildWorkflow().getTasks().size() > 1) {
       processor = new SequentialProcessor();
-      processor.setExecutionType("sequential");
       processor.setWorkflowInstance(inst); 
       
       for (WorkflowTask task : inst.getParentChildWorkflow().getTasks()) {
@@ -141,21 +139,14 @@ public class WorkflowProcessorQueue {
         WorkflowProcessor subProcessor = fromWorkflowInstance(instance);
         processor.getSubProcessors().add(subProcessor);        
       }      
-      processor.setState(inst.getState());
+      processor.getWorkflowInstance().setState(inst.getState());
     }
     else{
       processor = new TaskProcessor();
-      processor.setExecutionType("task");
       processor.setWorkflowInstance(inst);
-      processor.setState(inst.getState());
+      processor.getWorkflowInstance().setState(inst.getState());
     }
-    
-    processor.setConditionProcessor(false);
-    processor.setDynamicMetadata(inst.getSharedContext());
-    processor.setPriority(inst.getPriority());
-    ProcessorDateTimeInfo dateTimeInfo = new ProcessorDateTimeInfo();
-    processor.setProcessorDateTimeInfo(dateTimeInfo);
-    processor.setStaticMetadata(new Metadata());
+
     processor.setLifecycleManager(lifecycle);
     
     return processor;

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=1380415&r1=1380414&r2=1380415&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 Tue Sep  4 01:03:29 2012
@@ -71,26 +71,24 @@ public class WorkflowInstance {
 
   private Date endDate;
 
-  private Date taskStartDate;
-
-  private Date taskEndDate;
-
   private Metadata sharedContext;
 
   private Priority priority;
 
+  private int timesBlocked;
+
   /**
    * Default Constructor.
    * 
    */
   public WorkflowInstance() {
-    this(null, null, null, null, new Date(), null, null, null, new Metadata(),
-        Priority.getDefault());
+    this(null, null, null, null, new Date(), null, new Metadata(),
+        0, Priority.getDefault());
   }
 
   public WorkflowInstance(Workflow workflow, String id, WorkflowState state,
-      String currentTaskId, Date startDate, Date endDate, Date taskStartDate,
-      Date taskEndDate, Metadata sharedContext, Priority priority) {
+      String currentTaskId, Date startDate, Date endDate, 
+      Metadata sharedContext, int timesBlocked, Priority priority) {
     this.workflow = workflow != null && workflow instanceof ParentChildWorkflow ? (ParentChildWorkflow) workflow
         : new ParentChildWorkflow(workflow != null ? workflow : new Workflow());
     this.id = id;
@@ -98,9 +96,8 @@ public class WorkflowInstance {
     this.currentTaskId = currentTaskId;
     this.startDate = startDate;
     this.endDate = endDate;
-    this.taskStartDate = taskStartDate;
-    this.taskEndDate = taskEndDate;
     this.sharedContext = sharedContext;
+    this.timesBlocked = timesBlocked;
     this.priority = priority;
   }
 
@@ -294,36 +291,6 @@ public class WorkflowInstance {
   }
 
   /**
-   * @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
@@ -377,8 +344,10 @@ public class WorkflowInstance {
    */
   @Deprecated
   public String getCurrentTaskEndDateTimeIsoStr() {
-    return this.taskEndDate != null ? DateConvert.isoFormat(this.taskEndDate)
-        : null;
+    return this.getTaskById(currentTaskId) != null ? 
+        (this.getTaskById(currentTaskId).getEndDate() != null ? 
+            DateConvert.isoFormat(this.getTaskById(currentTaskId).getEndDate())
+        : null):null;
   }
 
   /**
@@ -389,9 +358,11 @@ public class WorkflowInstance {
   public void setCurrentTaskEndDateTimeIsoStr(
       String currentTaskEndDateTimeIsoStr) {
     if (currentTaskEndDateTimeIsoStr != null
-        && !currentTaskEndDateTimeIsoStr.equals("")) {
+        && !currentTaskEndDateTimeIsoStr.equals("") && 
+        this.getTaskById(currentTaskId) != null) {
       try {
-        this.taskEndDate = DateConvert.isoParse(currentTaskEndDateTimeIsoStr);
+        this.getTaskById(currentTaskId).
+          setEndDate(DateConvert.isoParse(currentTaskEndDateTimeIsoStr));
       } catch (ParseException e) {
         e.printStackTrace();
         // fail silently besides this: it's just a setter
@@ -404,8 +375,9 @@ public class WorkflowInstance {
    */
   @Deprecated
   public String getCurrentTaskStartDateTimeIsoStr() {
-    return this.taskStartDate != null ? DateConvert
-        .isoFormat(this.taskStartDate) : null;
+    return this.getTaskById(currentTaskId) != null ? 
+        (this.getTaskById(currentTaskId).getStartDate() != null ? DateConvert
+        .isoFormat(this.getTaskById(currentTaskId).getStartDate()) : null):null;
   }
 
   /**
@@ -416,15 +388,58 @@ public class WorkflowInstance {
   public void setCurrentTaskStartDateTimeIsoStr(
       String currentTaskStartDateTimeIsoStr) {
     if (currentTaskStartDateTimeIsoStr != null
-        && !currentTaskStartDateTimeIsoStr.equals("")) {
+        && !currentTaskStartDateTimeIsoStr.equals("") && 
+        this.getTaskById(currentTaskId) != null) {
       try {
-        this.taskStartDate = DateConvert
-            .isoParse(currentTaskStartDateTimeIsoStr);
+        this.getTaskById(currentTaskId).setStartDate(DateConvert
+            .isoParse(currentTaskStartDateTimeIsoStr));
       } catch (ParseException e) {
         e.printStackTrace();
         // fail silently besides this: it's just a setter
       }
     }
   }
+  
+  /**
+   * Returns the currently executing {@link WorkflowTask}
+   * part of this instance.
+   * 
+   * @return The currently executing {@link WorkflowTask}
+   * part of this instance.
+   */
+  public WorkflowTask getCurrentTask(){
+    return getTaskById(currentTaskId);
+  }
+  
+
+  /**
+   * @return the timesBlocked
+   */
+  public int getTimesBlocked() {
+    return timesBlocked;
+  }
+
+  /**
+   * @param timesBlocked the timesBlocked to set
+   */
+  public void setTimesBlocked(int timesBlocked) {
+    this.timesBlocked = timesBlocked;
+  }
+  
+  
+  private WorkflowTask getTaskById(String taskId){
+    if(this.workflow.getTasks() != null && 
+        this.workflow.getTasks().size() > 0){
+      for(WorkflowTask task: this.workflow.getTasks()){
+        if(task.getTaskId().equals(taskId)){
+          return task;
+        }
+      }
+      
+      return null;
+    }
+    else return null;
+  }
+
 
 }

Modified: oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/WorkflowTask.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/WorkflowTask.java?rev=1380415&r1=1380414&r2=1380415&view=diff
==============================================================================
--- oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/WorkflowTask.java (original)
+++ oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/WorkflowTask.java Tue Sep  4 01:03:29 2012
@@ -15,10 +15,10 @@
  * limitations under the License.
  */
 
-
 package org.apache.oodt.cas.workflow.structs;
 
 //JDK imports
+import java.util.Date;
 import java.util.List;
 import java.util.Vector;
 
@@ -32,255 +32,310 @@ import java.util.Vector;
  */
 public class WorkflowTask {
 
-    /* a unique ID for the task */
-    protected String taskId = null;
+  /* a unique ID for the task */
+  protected String taskId = null;
 
-    /* the name of the task */
-    protected String taskName = null;
+  /* the name of the task */
+  protected String taskName = null;
 
-    /* the static configuration parameters for the task */
-    protected WorkflowTaskConfiguration taskConfig = null;
+  /* the static configuration parameters for the task */
+  protected WorkflowTaskConfiguration taskConfig = null;
 
-    /* pre conditions for this task */
-    protected List<WorkflowCondition> preConditions = null;
-    
-    /* post conditions for this task */
-    protected List<WorkflowCondition> postConditions = null;
-
-    /* the actual work performing portion of this WorkflowTask */
-    protected String taskInstanceClassName = null;
-
-    /* the order for this task */
-    protected int order = -1;
-    
-    /* the list of required metadata fields that need to be passed into this task */
-    protected List requiredMetFields = null;
-
-    /**
-     * <p>
-     * Default Constructor.
-     * </p>
-     * 
-     */
-    public WorkflowTask() {
-        this.preConditions = new Vector<WorkflowCondition>();
-        this.postConditions = new Vector<WorkflowCondition>();
-        requiredMetFields = new Vector();
-        taskConfig = new WorkflowTaskConfiguration();
-    }
-
-    /**
-     * 
-     * This constructor is now deprecated in Apache OODT 0.4, in favor of
-     * {@link #WorkflowTask(String, String, WorkflowTaskConfiguration, List, List, String, int)}
-     * that explicitly specifies pre- and post- {@link WorkflowCondition}s.
-     * As used, this method will set the pre-conditions via the passed in 
-     * {@link List} of {@link WorkflowCondition}s only.
-     * 
-     * @param taskId
-     *            The unique ID for this WorkflowTask.
-     * @param taskName
-     *            The display name for this WorkflowTask.
-     * @param taskConfig
-     *            The static configuration parameters for this WorkflowTask.
-     * @param conditions
-     *            The List of conditions attached to this WorkflowTask (if any).
-     * @param taskInstanceClassName
-     *            The instance class name for this WorkflowTask.
-     * @param order
-     *            The order in which this WorkflowTask is executed within a
-     *            Workflow.
-     */
-    @Deprecated
-    public WorkflowTask(String taskId, String taskName,
-            WorkflowTaskConfiguration taskConfig, List conditions,
-            String taskInstanceClassName, int order) {
-        this.taskId = taskId;
-        this.taskName = taskName;
-        this.taskConfig = taskConfig;
-        this.preConditions = conditions;
-        this.taskInstanceClassName = taskInstanceClassName;
-        this.order = order;
-    }
-    
-    /**
-     * Constructs a new WorkflowTask.
-     * 
-     * @param taskId The identifier for this task.
-     * @param taskName The name for this task.
-     * @param taskConfig The associated {@link WorkflowTaskConfiguration}.
-     * @param preConditions The {@link List} of pre-{@link WorkflowCondition}s.
-     * @param postConditions The {@link List} of post-{@link WorkflowCondition}s.
-     * @param taskInstanceClassName The implementing class name of this WorkflowTask.
-     * @param order The order in which this task should be run.
-     */
-    public WorkflowTask(String taskId, String taskName, 
-        WorkflowTaskConfiguration taskConfig, List<WorkflowCondition> 
-        preConditions, List<WorkflowCondition> postConditions, 
-        String taskInstanceClassName, int order){
-      this.taskId = taskId;
-      this.taskName = taskName;
-      this.taskConfig = taskConfig;
-      this.preConditions = preConditions;
-      this.postConditions = postConditions;
-      this.taskInstanceClassName = taskInstanceClassName;
-      this.order = order;
-      
-    }
-
-    /**
-     * @return Returns the taskConfig.
-     */
-    public WorkflowTaskConfiguration getTaskConfig() {
-        return taskConfig;
-    }
-
-    /**
-     * @return the preConditions
-     */
-    public List<WorkflowCondition> getPreConditions() {
-      return preConditions;
-    }
-
-    /**
-     * @param preConditions the preConditions to set
-     */
-    public void setPreConditions(List<WorkflowCondition> preConditions) {
-      this.preConditions = preConditions;
-    }
-
-    /**
-     * @return the postConditions
-     */
-    public List<WorkflowCondition> getPostConditions() {
-      return postConditions;
-    }
-
-    /**
-     * @param postConditions the postConditions to set
-     */
-    public void setPostConditions(List<WorkflowCondition> postConditions) {
-      this.postConditions = postConditions;
-    }
-
-    /**
-     * @param taskConfig
-     *            The taskConfig to set.
-     */
-    public void setTaskConfig(WorkflowTaskConfiguration taskConfig) {
-        this.taskConfig = taskConfig;
-    }
-
-    /**
-     * @return Returns the taskId.
-     */
-    public String getTaskId() {
-        return taskId;
-    }
-
-    /**
-     * @param taskId
-     *            The taskId to set.
-     */
-    public void setTaskId(String taskId) {
-        this.taskId = taskId;
-    }
-
-    /**
-     * @return Returns the taskInstanceClassName.
-     */
-    public String getTaskInstanceClassName() {
-        return taskInstanceClassName;
-    }
-
-    /**
-     * @param taskInstanceClassName
-     *            The taskInstanceClassName to set.
-     */
-    public void setTaskInstanceClassName(String taskInstanceClassName) {
-        this.taskInstanceClassName = taskInstanceClassName;
-    }
-
-    /**
-     * @return Returns the taskName.
-     */
-    public String getTaskName() {
-        return taskName;
-    }
-
-    /**
-     * @param taskName
-     *            The taskName to set.
-     */
-    public void setTaskName(String taskName) {
-        this.taskName = taskName;
-    }
-    
-    
-
-    /**
-     * This method is deprecated in favor of using 
-     * {@link #getPreConditions()} or {@link #getPostConditions()}. As called,
-     * will return a union of the Tasks's pre- and post- {@link WorkflowCondition}s.
-     * 
-     * @return A {@link List} of {@link WorkflowCondition}s associated with
-     *         this task.
-     */
-    @Deprecated
-    public List getConditions() {
-        List conditions = new Vector();
-        conditions.addAll(this.preConditions);
-        conditions.addAll(this.postConditions);
-        return conditions;
-    }
-
-    /**
-     * 
-     * This method is depcreated in favor of {@link #setPostConditions(List)} and
-     * {@link #setPreConditions(List)}, for explicitly setting the pre or post
-     * conditions of this WorkflowTask. 
-     * 
-     * To keep back compat, this method in its deprecated form will set the 
-     * WorkflowTask pre-conditions, as was the case before.
-     * 
-     * Sets the {@link List} of {@link WorkflowCondition}s associated with this
-     * task.
-     * 
-     * @param conditions
-     *            The condition {@link List}.
-     */
-    @Deprecated
-    public void setConditions(List conditions) {
-        this.preConditions = conditions;
-    }
-
-    /**
-     * @return Returns the order.
-     */
-    public int getOrder() {
-        return order;
-    }
-
-    /**
-     * @param order
-     *            The order to set.
-     */
-    public void setOrder(int order) {
-        this.order = order;
-    }
-
-    /**
-     * @return the requiredMetFields
-     */
-    public List getRequiredMetFields() {
-        return requiredMetFields;
-    }
-
-    /**
-     * @param requiredMetFields the requiredMetFields to set
-     */
-    public void setRequiredMetFields(List requiredMetFields) {
-        this.requiredMetFields = requiredMetFields;
-    }
+  /* pre conditions for this task */
+  protected List<WorkflowCondition> preConditions = null;
+
+  /* post conditions for this task */
+  protected List<WorkflowCondition> postConditions = null;
+
+  /* the actual work performing portion of this WorkflowTask */
+  protected String taskInstanceClassName = null;
+
+  /* the order for this task */
+  protected int order = -1;
+
+  /* the list of required metadata fields that need to be passed into this task */
+  protected List requiredMetFields = null;
+
+  private Date startDate;
+
+  private Date endDate;
+
+  /**
+   * <p>
+   * Default Constructor.
+   * </p>
+   * 
+   */
+  public WorkflowTask() {
+    this(null, null, new WorkflowTaskConfiguration(),
+        new Vector<WorkflowCondition>(), new Vector<WorkflowCondition>(),
+        new Vector<String>(), null, null, null, -1);
+  }
+
+  /**
+   * 
+   * This constructor is now deprecated in Apache OODT 0.4, in favor of
+   * {@link #WorkflowTask(String, String, WorkflowTaskConfiguration, List, List, String, int)}
+   * that explicitly specifies pre- and post- {@link WorkflowCondition}s. As
+   * used, this method will set the pre-conditions via the passed in
+   * {@link List} of {@link WorkflowCondition}s only.
+   * 
+   * @param taskId
+   *          The unique ID for this WorkflowTask.
+   * @param taskName
+   *          The display name for this WorkflowTask.
+   * @param taskConfig
+   *          The static configuration parameters for this WorkflowTask.
+   * @param conditions
+   *          The List of conditions attached to this WorkflowTask (if any).
+   * @param taskInstanceClassName
+   *          The instance class name for this WorkflowTask.
+   * @param order
+   *          The order in which this WorkflowTask is executed within a
+   *          Workflow.
+   */
+  @Deprecated
+  public WorkflowTask(String taskId, String taskName,
+      WorkflowTaskConfiguration taskConfig, List conditions,
+      String taskInstanceClassName, int order) {
+    this(taskId, taskName, taskConfig, conditions,
+        new Vector<WorkflowCondition>(), new Vector<String>(), null,
+        null, null, -1);
+  }
+
+  /**
+   * Constructs a new WorkflowTask.
+   * 
+   * @param taskId
+   *          The identifier for this task.
+   * @param taskName
+   *          The name for this task.
+   * @param taskConfig
+   *          The associated {@link WorkflowTaskConfiguration}.
+   * @param requiredMetFields
+   *          A {@link List} of String met field names that this task requires.
+   * @param preConditions
+   *          The {@link List} of pre-{@link WorkflowCondition}s.
+   * @param postConditions
+   *          The {@link List} of post-{@link WorkflowCondition}s.
+   * @param taskInstanceClassName
+   *          The implementing class name of this WorkflowTask.
+   * @param startDate
+   *          The time that this task started executing.
+   * @param endDate
+   *          The time that this task stopped executing.
+   * @param order
+   *          The order in which this task should be run.
+   */
+  public WorkflowTask(String taskId, String taskName,
+      WorkflowTaskConfiguration taskConfig,
+      List<WorkflowCondition> preConditions,
+      List<WorkflowCondition> postConditions, List<String> requiredMetFields,
+      String taskInstanceClassName, Date startDate, Date endDate, int order) {
+    this.taskId = taskId;
+    this.taskName = taskName;
+    this.taskConfig = taskConfig;
+    this.requiredMetFields = requiredMetFields;
+    this.preConditions = preConditions;
+    this.postConditions = postConditions;
+    this.taskInstanceClassName = taskInstanceClassName;
+    this.startDate = startDate;
+    this.endDate = endDate;
+    this.order = order;
+
+  }
+
+  /**
+   * @return Returns the taskConfig.
+   */
+  public WorkflowTaskConfiguration getTaskConfig() {
+    return taskConfig;
+  }
+
+  /**
+   * @return the preConditions
+   */
+  public List<WorkflowCondition> getPreConditions() {
+    return preConditions;
+  }
+
+  /**
+   * @param preConditions
+   *          the preConditions to set
+   */
+  public void setPreConditions(List<WorkflowCondition> preConditions) {
+    this.preConditions = preConditions;
+  }
+
+  /**
+   * @return the postConditions
+   */
+  public List<WorkflowCondition> getPostConditions() {
+    return postConditions;
+  }
+
+  /**
+   * @param postConditions
+   *          the postConditions to set
+   */
+  public void setPostConditions(List<WorkflowCondition> postConditions) {
+    this.postConditions = postConditions;
+  }
+
+  /**
+   * @param taskConfig
+   *          The taskConfig to set.
+   */
+  public void setTaskConfig(WorkflowTaskConfiguration taskConfig) {
+    this.taskConfig = taskConfig;
+  }
+
+  /**
+   * @return Returns the taskId.
+   */
+  public String getTaskId() {
+    return taskId;
+  }
+
+  /**
+   * @param taskId
+   *          The taskId to set.
+   */
+  public void setTaskId(String taskId) {
+    this.taskId = taskId;
+  }
+
+  /**
+   * @return Returns the taskInstanceClassName.
+   */
+  public String getTaskInstanceClassName() {
+    return taskInstanceClassName;
+  }
+
+  /**
+   * @param taskInstanceClassName
+   *          The taskInstanceClassName to set.
+   */
+  public void setTaskInstanceClassName(String taskInstanceClassName) {
+    this.taskInstanceClassName = taskInstanceClassName;
+  }
+
+  /**
+   * @return Returns the taskName.
+   */
+  public String getTaskName() {
+    return taskName;
+  }
+
+  /**
+   * @param taskName
+   *          The taskName to set.
+   */
+  public void setTaskName(String taskName) {
+    this.taskName = taskName;
+  }
+
+  /**
+   * This method is deprecated in favor of using {@link #getPreConditions()} or
+   * {@link #getPostConditions()}. As called, will return a union of the Tasks's
+   * pre- and post- {@link WorkflowCondition}s.
+   * 
+   * @return A {@link List} of {@link WorkflowCondition}s associated with this
+   *         task.
+   */
+  @Deprecated
+  public List getConditions() {
+    List conditions = new Vector();
+    conditions.addAll(this.preConditions);
+    conditions.addAll(this.postConditions);
+    return conditions;
+  }
+
+  /**
+   * 
+   * This method is depcreated in favor of {@link #setPostConditions(List)} and
+   * {@link #setPreConditions(List)}, for explicitly setting the pre or post
+   * conditions of this WorkflowTask.
+   * 
+   * To keep back compat, this method in its deprecated form will set the
+   * WorkflowTask pre-conditions, as was the case before.
+   * 
+   * Sets the {@link List} of {@link WorkflowCondition}s associated with this
+   * task.
+   * 
+   * @param conditions
+   *          The condition {@link List}.
+   */
+  @Deprecated
+  public void setConditions(List conditions) {
+    this.preConditions = conditions;
+  }
+
+  /**
+   * @return Returns the order. Don't use this method anymore -- order is not
+   *         relevant to the control flow which is acutally controlled now by
+   *         the surrounding workflow model.
+   */
+  @Deprecated
+  public int getOrder() {
+    return order;
+  }
+
+  /**
+   * Don't use this method anymore -- order is not relevant to the control flow
+   * which is acutally controlled now by the surrounding workflow model.
+   * 
+   * @param order
+   *          The order to set.
+   */
+  @Deprecated
+  public void setOrder(int order) {
+    this.order = order;
+  }
+
+  /**
+   * @return the requiredMetFields
+   */
+  public List getRequiredMetFields() {
+    return requiredMetFields;
+  }
+
+  /**
+   * @param requiredMetFields
+   *          the requiredMetFields to set
+   */
+  public void setRequiredMetFields(List requiredMetFields) {
+    this.requiredMetFields = requiredMetFields;
+  }
+
+  /**
+   * @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;
+  }
 
 }

Modified: oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/engine/MetSetterTaskQuerier.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/engine/MetSetterTaskQuerier.java?rev=1380415&r1=1380414&r2=1380415&view=diff
==============================================================================
--- oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/engine/MetSetterTaskQuerier.java (original)
+++ oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/engine/MetSetterTaskQuerier.java Tue Sep  4 01:03:29 2012
@@ -59,7 +59,7 @@ public class MetSetterTaskQuerier extend
     if(taskProcessor == null) return null;
     Metadata met = new Metadata();
     met.addMetadata("StartDateTime", DateUtils.toString(Calendar.getInstance()));
-    taskProcessor.setDynamicMetadata(met);
+    taskProcessor.getWorkflowInstance().setSharedContext(met);
     return taskProcessor;
   }
 

Modified: oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/engine/QuerierAndRunnerUtils.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/engine/QuerierAndRunnerUtils.java?rev=1380415&r1=1380414&r2=1380415&view=diff
==============================================================================
--- oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/engine/QuerierAndRunnerUtils.java (original)
+++ oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/engine/QuerierAndRunnerUtils.java Tue Sep  4 01:03:29 2012
@@ -91,19 +91,20 @@ public class QuerierAndRunnerUtils {
     SequentialProcessor processor = (SequentialProcessor) builder
         .build(SequentialProcessor.class);
     processor.setWorkflowInstance(inst);
-    processor.setState(lifecycleManager.getDefaultLifecycle().createState(
+    processor.getWorkflowInstance().setState(lifecycleManager.getDefaultLifecycle().createState(
         stateName, categoryName, ""));
     List<WorkflowProcessor> runnables = new Vector<WorkflowProcessor>();
     TaskProcessor taskProcessor = (TaskProcessor) builder
         .build(TaskProcessor.class);
-    taskProcessor.setState(lifecycleManager.getDefaultLifecycle().createState(
-        "Queued", "waiting", ""));
     ParentChildWorkflow taskWorkflow = new ParentChildWorkflow(new Graph());    
     taskWorkflow.getTasks().add(getTask(getTmpPath()));
     WorkflowInstance taskWorkflowInst = new WorkflowInstance();
+    taskWorkflowInst.setPriority(Priority.getPriority(priority));
     taskWorkflowInst.setWorkflow(taskWorkflow);
     taskWorkflowInst.setCurrentTaskId(taskWorkflow.getTasks().get(0).getTaskId());
     taskProcessor.setWorkflowInstance(taskWorkflowInst);
+    taskProcessor.getWorkflowInstance().setState(lifecycleManager.getDefaultLifecycle().createState(
+        "Queued", "waiting", ""));    
     runnables.add(taskProcessor);
     processor.setSubProcessors(runnables);
     return processor;

Modified: oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/engine/TestTaskQuerier.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/engine/TestTaskQuerier.java?rev=1380415&r1=1380414&r2=1380415&view=diff
==============================================================================
--- oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/engine/TestTaskQuerier.java (original)
+++ oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/engine/TestTaskQuerier.java Tue Sep  4 01:03:29 2012
@@ -87,10 +87,10 @@ public class TestTaskQuerier extends Tes
     assertNotNull(runnables);
     assertEquals(2, runnables.size());
     assertNotNull(runnables.get(0));
-    assertNotNull(runnables.get(0).getPriority());
-    assertEquals(2.1, runnables.get(0).getPriority()
+    assertNotNull(runnables.get(0).getWorkflowInstance().getPriority());
+    assertEquals(2.1, runnables.get(0).getWorkflowInstance().getPriority()
         .getValue()); // extra .1 since it's a task
-    assertEquals(7.1, runnables.get(1).getPriority()
+    assertEquals(7.1, runnables.get(1).getWorkflowInstance().getPriority()
         .getValue()); // extra .1 since it's a task
     try{
       querierThread.join();

Modified: oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/engine/TestThreadPoolWorkflowEngine.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/engine/TestThreadPoolWorkflowEngine.java?rev=1380415&r1=1380414&r2=1380415&view=diff
==============================================================================
--- oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/engine/TestThreadPoolWorkflowEngine.java (original)
+++ oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/engine/TestThreadPoolWorkflowEngine.java Tue Sep  4 01:03:29 2012
@@ -19,7 +19,10 @@
 package org.apache.oodt.cas.workflow.engine;
 
 //OODT imports
+import org.apache.oodt.cas.workflow.structs.Graph;
+import org.apache.oodt.cas.workflow.structs.ParentChildWorkflow;
 import org.apache.oodt.cas.workflow.structs.WorkflowInstance;
+import org.apache.oodt.cas.workflow.structs.WorkflowTask;
 import org.apache.oodt.commons.util.DateConvert;
 
 //JDK imports
@@ -50,6 +53,12 @@ public class TestThreadPoolWorkflowEngin
     public void testCurrentTaskWallClockTime() {
         // at first, there is no start date time
         WorkflowInstance inst = new WorkflowInstance();
+        WorkflowTask task = new WorkflowTask();
+        task.setTaskId("urn:oodt:testTask");
+        ParentChildWorkflow workflow = new ParentChildWorkflow(new Graph());
+        workflow.getTasks().add(task);
+        inst.setParentChildWorkflow(workflow);
+        inst.setCurrentTaskId("urn:oodt:testTask");
         assertEquals(Double.valueOf(0.0), Double
                 .valueOf(ThreadPoolWorkflowEngine
                         .getCurrentTaskWallClockMinutes(inst)));
@@ -57,6 +66,7 @@ public class TestThreadPoolWorkflowEngin
         // now set start date time, and assert that wall clock minutes > 0
         inst.setCurrentTaskStartDateTimeIsoStr(DateConvert
                 .isoFormat(new Date()));
+        System.out.println(ThreadPoolWorkflowEngine.getCurrentTaskWallClockMinutes(inst));
         assertTrue(ThreadPoolWorkflowEngine
                 .getCurrentTaskWallClockMinutes(inst) > 0.0);
 

Modified: oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/structs/TestWorkflowInstance.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/structs/TestWorkflowInstance.java?rev=1380415&r1=1380414&r2=1380415&view=diff
==============================================================================
--- oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/structs/TestWorkflowInstance.java (original)
+++ oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/structs/TestWorkflowInstance.java Tue Sep  4 01:03:29 2012
@@ -42,8 +42,8 @@ public class TestWorkflowInstance extend
 
     assertNull(inst.getEndDate());
     assertNotNull(inst.getStartDate()); // only one initially set to new Date()
-    assertNull(inst.getTaskStartDate());
-    assertNull(inst.getTaskEndDate());
+    assertNull(inst.getCurrentTaskStartDateTimeIsoStr());
+    assertNull(inst.getCurrentTaskEndDateTimeIsoStr());
   }
 
 }