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/08/14 07:39:57 UTC

svn commit: r1157470 [3/3] - in /oodt/trunk/workflow/src: main/java/org/apache/oodt/cas/workflow/engine/ main/java/org/apache/oodt/cas/workflow/instrepo/ main/java/org/apache/oodt/cas/workflow/repository/ main/java/org/apache/oodt/cas/workflow/structs/...

Modified: oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/WorkflowRepository.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/WorkflowRepository.java?rev=1157470&r1=1157469&r2=1157470&view=diff
==============================================================================
--- oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/WorkflowRepository.java (original)
+++ oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/WorkflowRepository.java Sun Aug 14 05:39:56 2011
@@ -1,4 +1,4 @@
-/*
+/**
  * 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.
@@ -15,7 +15,6 @@
  * limitations under the License.
  */
 
-
 package org.apache.oodt.cas.workflow.repository;
 
 //OODT imports
@@ -29,194 +28,222 @@ import org.apache.oodt.cas.workflow.stru
 import java.util.List;
 
 /**
- * @author mattmann
- * @version $Revision$
  * 
- * <p>
  * A repository interface for obtaining {@link Workflow}s, and managing the
  * information about their {@link WorkflowTask}s.
- * </p>
+ * 
+ * @author mattmann
+ * @version $Revision$
  * 
  */
 public interface WorkflowRepository {
 
-    /**
-     * <p>
-     * Returns a {@link Workflow} with the given <code>workflowName</code>.
-     * </p>
-     * 
-     * @param workflowName
-     *            The name of the {@link Workflow} to obtain.
-     * @return A {@link Workflow} with the specified name.
-     * @throws RepositoryException
-     *             If any error occurs.
-     */
-    public Workflow getWorkflowByName(String workflowName)
-            throws RepositoryException;
-
-    /**
-     * <p>
-     * Returns a {@link Workflow} with the given <code>workflowId</code>.
-     * </p>
-     * 
-     * @param workflowId
-     *            The ID of the {@link Workflow} to obtain.
-     * @return A {@link Workflow} with the given ID.
-     * @throws RepositoryException
-     *             If any error occurs.
-     */
-    public Workflow getWorkflowById(String workflowId)
-            throws RepositoryException;
-
-    /**
-     * <p>
-     * Gets all {@link Workflow}s from the repository.
-     * </p>
-     * 
-     * @return A {@link List} of all {@link Workflow}s in the repository.
-     * @throws RepositoryException
-     *             If any error occurs.
-     */
-    public List getWorkflows() throws RepositoryException;
-
-    /**
-     * <p>
-     * Returns a {@link List} of {@link WorkflowTask}s associated with the
-     * specified {@link Workflow} identified by its <code>workflowId</code>.
-     * </p>
-     * 
-     * @param workflowId
-     *            The ID of the {@link Workflow} to obtain the {@link List} of
-     *            {@link WorkflowTask}s for.
-     * @return A {@link List} of {@link WorkflowTask}s associated with the
-     *         specified Workflow.
-     * @throws RepositoryException
-     *             If any error occurs.
-     */
-    public List getTasksByWorkflowId(String workflowId)
-            throws RepositoryException;
-
-    /**
-     * <p>
-     * Returns a {@link List} of {@link WorkflowTask}s associated with the
-     * specified {@link Workflow} identified by its <code>workflowName</code>.
-     * </p>
-     * 
-     * @param workflowName
-     *            The Name of the {@link Workflow} to obtain the {@link List} of
-     *            {@link WorkflowTask}s for.
-     * @return A {@link List} of {@link WorkflowTask}s associated with the
-     *         specified Workflow.
-     * @throws RepositoryException
-     *             If any error occurs.
-     */
-    public List getTasksByWorkflowName(String workflowName)
-            throws RepositoryException;
-
-    /**
-     * <p>
-     * Returns a {@link List} of {@link Workflow}s associated with the
-     * specified <code>eventName</code>.
-     * </p>
-     * 
-     * @param eventName
-     *            The name of the event to search for workflows for.
-     *            </p>
-     * @return A {@link List} of {@link Workflow}s associated with the
-     *         specified event.
-     * @throws RepositoryException
-     *             If any error occurs.
-     */
-    public List getWorkflowsForEvent(String eventName)
-            throws RepositoryException;
-    
-    
-    /**
-	 * <p>Returns an ordered {@link List} of {@link WorkflowCondition}s associated with the given <code>taskName</code>.</p>
-	 * @param taskName The taskName to obtain the conditions for.
-	 * @return Returns a {@link List} of {@link WorkflowCondition}s associated with the given <code>taskName</code>
-	 * @throws RepositoryException If any error occurs.
-	 */
-	public List getConditionsByTaskName(String taskName)
-			throws RepositoryException;
-
-	/**
-	 * <p>
-	 * Returns an ordered {@link List} of {@link WorkflowCondition}s associated
-	 * with the given <code>taskId</code>.
-	 * </p>
-	 * 
-	 * @param taskId
-	 *            The ID of the task to obtain the conditions for.
-	 * @return Returns a {@link List} of {@link WorkflowCondition}s associated
-	 *         with the given <code>taskId</code>
-	 * @throws RepositoryException
-	 *             If any error occurs.
-	 */
-	public List getConditionsByTaskId(String taskId) throws RepositoryException;
-
-	/**
-	 * <p>
-	 * Gets the {@link WorkflowTaskConfiguration} metadata for the
-	 * {@link WorkflowTask} with the given <code>taskId</code>.
-	 * </p>
-	 * 
-	 * @param taskId
-	 *            The ID of the {@link WorkflowTask} to get the
-	 *            {@link WorkflowTaskConfiguration} metadata for.
-	 * @return The {@link WorkflowTaskConfiguration} metadata for the
-	 *         {@link WorkflowTask} with the given <code>taskId</code>.
-	 * @throws RepositoryException
-	 *             If any error occurs.
-	 */
-	public WorkflowTaskConfiguration getConfigurationByTaskId(String taskId)
-			throws RepositoryException;
-	
-	/**
-	 * <p>Returns the {@link WorkflowTask} with the given <code>taskId</code>.</p>
-	 * 
-	 * @param taskId The ID of the WorkflowTask to return.
-	 * @return the {@link WorkflowTask} with the given <code>taskId</code>.
-	 * @throws RepositoryException If any error occurs.
-	 */
-	public WorkflowTask getWorkflowTaskById(String taskId)
-			throws RepositoryException;
-
-	/**
-	 * <p>Returns the {@link WorkflowCondition} with the given <code>conditionId</code>.</p>
-	 * 
-	 * @param conditionId The ID of the WorkflowCondition to return.
-	 * @return the {@link WorkflowCondition} with the given <code>conditionId</code>.
-	 * @throws RepositoryException If any error occurs.
-	 */
-	public WorkflowCondition getWorkflowConditionById(String conditionId)
-			throws RepositoryException;
-	
-	
-	/**
-	 * <p>
-	 * Gets a {@link List} of <code>Event</code>s that are registered in the
-	 * Workflow Manager as having valid {@link Workflow}s mapped to their
-	 * names.
-	 * </p>
-	 * 
-	 * @return a {@link List} of <code>Event</code>s that are registered in
-	 *         the Workflow Manager as having valid {@link Workflow}s mapped to
-	 *         their names.
-	 * @throws RepositoryException
-	 *             If any error occurs.
-	 */
-	public List getRegisteredEvents() throws RepositoryException;
-	
-	
-	
-	/**
-	 * Adds the specified new {@link Workflow} to this Repository.
-	 * 
-	 * @param workflow The {@link Workflow} to add.
-	 * @return The identifier of the new {@link Workflow} as defined by this repository.
-	 * @throws RepositoryException If any error occurs.
-	 */
-	public String addWorkflow(Workflow workflow) throws RepositoryException;
+  /**
+   * <p>
+   * Returns a {@link Workflow} with the given <code>workflowName</code>.
+   * </p>
+   * 
+   * @param workflowName
+   *          The name of the {@link Workflow} to obtain.
+   * @return A {@link Workflow} with the specified name.
+   * @throws RepositoryException
+   *           If any error occurs.
+   */
+  public Workflow getWorkflowByName(String workflowName)
+      throws RepositoryException;
+
+  /**
+   * <p>
+   * Returns a {@link Workflow} with the given <code>workflowId</code>.
+   * </p>
+   * 
+   * @param workflowId
+   *          The ID of the {@link Workflow} to obtain.
+   * @return A {@link Workflow} with the given ID.
+   * @throws RepositoryException
+   *           If any error occurs.
+   */
+  public Workflow getWorkflowById(String workflowId) throws RepositoryException;
+
+  /**
+   * <p>
+   * Gets all {@link Workflow}s from the repository.
+   * </p>
+   * 
+   * @return A {@link List} of all {@link Workflow}s in the repository.
+   * @throws RepositoryException
+   *           If any error occurs.
+   */
+  public List getWorkflows() throws RepositoryException;
+
+  /**
+   * <p>
+   * Returns a {@link List} of {@link WorkflowTask}s associated with the
+   * specified {@link Workflow} identified by its <code>workflowId</code>.
+   * </p>
+   * 
+   * @param workflowId
+   *          The ID of the {@link Workflow} to obtain the {@link List} of
+   *          {@link WorkflowTask}s for.
+   * @return A {@link List} of {@link WorkflowTask}s associated with the
+   *         specified Workflow.
+   * @throws RepositoryException
+   *           If any error occurs.
+   */
+  public List getTasksByWorkflowId(String workflowId)
+      throws RepositoryException;
+
+  /**
+   * <p>
+   * Returns a {@link List} of {@link WorkflowTask}s associated with the
+   * specified {@link Workflow} identified by its <code>workflowName</code>.
+   * </p>
+   * 
+   * @param workflowName
+   *          The Name of the {@link Workflow} to obtain the {@link List} of
+   *          {@link WorkflowTask}s for.
+   * @return A {@link List} of {@link WorkflowTask}s associated with the
+   *         specified Workflow.
+   * @throws RepositoryException
+   *           If any error occurs.
+   */
+  public List getTasksByWorkflowName(String workflowName)
+      throws RepositoryException;
+
+  /**
+   * <p>
+   * Returns a {@link List} of {@link Workflow}s associated with the specified
+   * <code>eventName</code>.
+   * </p>
+   * 
+   * @param eventName
+   *          The name of the event to search for workflows for. </p>
+   * @return A {@link List} of {@link Workflow}s associated with the specified
+   *         event.
+   * @throws RepositoryException
+   *           If any error occurs.
+   */
+  public List getWorkflowsForEvent(String eventName) throws RepositoryException;
+
+  /**
+   * <p>
+   * Returns an ordered {@link List} of {@link WorkflowCondition}s associated
+   * with the given <code>taskName</code>.
+   * </p>
+   * 
+   * @param taskName
+   *          The taskName to obtain the conditions for.
+   * @return Returns a {@link List} of {@link WorkflowCondition}s associated
+   *         with the given <code>taskName</code>
+   * @throws RepositoryException
+   *           If any error occurs.
+   */
+  public List getConditionsByTaskName(String taskName)
+      throws RepositoryException;
+
+  /**
+   * <p>
+   * Returns an ordered {@link List} of {@link WorkflowCondition}s associated
+   * with the given <code>taskId</code>.
+   * </p>
+   * 
+   * @param taskId
+   *          The ID of the task to obtain the conditions for.
+   * @return Returns a {@link List} of {@link WorkflowCondition}s associated
+   *         with the given <code>taskId</code>
+   * @throws RepositoryException
+   *           If any error occurs.
+   */
+  public List getConditionsByTaskId(String taskId) throws RepositoryException;
+
+  /**
+   * <p>
+   * Gets the {@link WorkflowTaskConfiguration} metadata for the
+   * {@link WorkflowTask} with the given <code>taskId</code>.
+   * </p>
+   * 
+   * @param taskId
+   *          The ID of the {@link WorkflowTask} to get the
+   *          {@link WorkflowTaskConfiguration} metadata for.
+   * @return The {@link WorkflowTaskConfiguration} metadata for the
+   *         {@link WorkflowTask} with the given <code>taskId</code>.
+   * @throws RepositoryException
+   *           If any error occurs.
+   */
+  public WorkflowTaskConfiguration getConfigurationByTaskId(String taskId)
+      throws RepositoryException;
+
+  /**
+   * <p>
+   * Returns the {@link WorkflowTask} with the given <code>taskId</code>.
+   * </p>
+   * 
+   * @param taskId
+   *          The ID of the WorkflowTask to return.
+   * @return the {@link WorkflowTask} with the given <code>taskId</code>.
+   * @throws RepositoryException
+   *           If any error occurs.
+   */
+  public WorkflowTask getWorkflowTaskById(String taskId)
+      throws RepositoryException;
+
+  /**
+   * <p>
+   * Returns the {@link WorkflowCondition} with the given
+   * <code>conditionId</code>.
+   * </p>
+   * 
+   * @param conditionId
+   *          The ID of the WorkflowCondition to return.
+   * @return the {@link WorkflowCondition} with the given
+   *         <code>conditionId</code>.
+   * @throws RepositoryException
+   *           If any error occurs.
+   */
+  public WorkflowCondition getWorkflowConditionById(String conditionId)
+      throws RepositoryException;
+
+  /**
+   * <p>
+   * Gets a {@link List} of <code>Event</code>s that are registered in the
+   * Workflow Manager as having valid {@link Workflow}s mapped to their names.
+   * </p>
+   * 
+   * @return a {@link List} of <code>Event</code>s that are registered in the
+   *         Workflow Manager as having valid {@link Workflow}s mapped to their
+   *         names.
+   * @throws RepositoryException
+   *           If any error occurs.
+   */
+  public List getRegisteredEvents() throws RepositoryException;
+
+  /**
+   * Adds the specified new {@link Workflow} to this Repository.
+   * 
+   * @param workflow
+   *          The {@link Workflow} to add.
+   * @return The identifier of the new {@link Workflow} as defined by this
+   *         repository.
+   * @throws RepositoryException
+   *           If any error occurs.
+   */
+  public String addWorkflow(Workflow workflow) throws RepositoryException;
+
+  /**
+   * 
+   * Gets the associated {@link WorkflowCondition}s for this {@link Workflow}
+   * specified by its <code>workflowId</code>.
+   * 
+   * @param workflowId
+   *          The Identifier of the {@link Workflow} to get the
+   *          {@link WorkflowCondition}s for.
+   * 
+   * @return A {@link List} of {@link WorkflowCondition}s for this
+   *         {@link Workflow}.
+   * @throws RepositoryException
+   *           If any error occurs.
+   */
+  public List<WorkflowCondition> getConditionsByWorkflowId(String workflowId)
+      throws RepositoryException;
 
 }

Modified: oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/XMLWorkflowRepository.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/XMLWorkflowRepository.java?rev=1157470&r1=1157469&r2=1157470&view=diff
==============================================================================
--- oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/XMLWorkflowRepository.java (original)
+++ oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/XMLWorkflowRepository.java Sun Aug 14 05:39:56 2011
@@ -293,6 +293,19 @@ public class XMLWorkflowRepository imple
       this.eventMap.put(workflowId, Collections.singletonList(workflow));
       return workflowId;
     }    
+    
+    /* (non-Javadoc)
+     * @see org.apache.oodt.cas.workflow.repository.WorkflowRepository#getConditionsByWorkflowId(java.lang.String)
+     */
+    @Override
+    public List<WorkflowCondition> getConditionsByWorkflowId(String workflowId)
+        throws RepositoryException {
+      if(!this.workflowMap.containsKey(workflowId)) throw new 
+         RepositoryException("Attempt to obtain conditions for a workflow: " +
+         		"["+workflowId+"] that does not exist!");
+      
+      return ((Workflow)this.workflowMap.get(workflowId)).getConditions();
+    }    
 
     /**
      * @param args
@@ -506,7 +519,7 @@ public class XMLWorkflowRepository imple
                             if (workflowMap.get(workflowId) == null) {
                                 Workflow w = XmlStructFactory.getWorkflow(
                                         workflowRoot.getDocumentElement(),
-                                        taskMap);
+                                        taskMap, conditionMap);
                                 workflowMap.put(workflowId, w);
                             } else {
                                 LOG

Modified: oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/Workflow.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/Workflow.java?rev=1157470&r1=1157469&r2=1157470&view=diff
==============================================================================
--- oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/Workflow.java (original)
+++ oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/Workflow.java Sun Aug 14 05:39:56 2011
@@ -1,4 +1,4 @@
-/*
+/**
  * 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.
@@ -15,7 +15,6 @@
  * limitations under the License.
  */
 
-
 package org.apache.oodt.cas.workflow.structs;
 
 //JDK imports
@@ -23,10 +22,8 @@ import java.util.List;
 import java.util.Vector;
 
 /**
- * @author mattmann
- * @version $Revision$
  * 
- * <p>
+ * 
  * A Workflow is an abstract representation of a set of interconnected
  * processes. Processes, or jobs, may have dependencies upon one another, may
  * provide each other input, and/or output, or may be completely independent of
@@ -35,87 +32,112 @@ import java.util.Vector;
  * <br>
  * See <a href="http://www.gridbus.org/reports/GridWorkflowTaxonomy.pdf">Buyya
  * et al.</a> for a great description in detail of what exactly a Workflow is.
- * </p>
+ * 
+ * 
+ * @author mattmann
+ * @version $Revision$
  * 
  */
 public class Workflow {
 
-    private String name;
+  private String name;
+
+  private String id;
 
-    private String id;
+  private List<WorkflowTask> tasks;
 
-    private List tasks;
+  private List<WorkflowCondition> conditions;
 
-    /**
-     * Default Constructor
-     * 
-     */
-    public Workflow() {
-        tasks = new Vector();
-
-    }
-
-    /**
-     * Constructs a new Workflow with the given parameters.
-     * 
-     * @param name
-     *            The name of this workflow.
-     * @param id
-     *            The identifier for this workflow.
-     * @param tasks
-     *            The {@link List} of {@link WorkflowTask}s associated with
-     *            this workflow.
-     */
-    public Workflow(String name, String id, List tasks) {
-        name = name;
-        id = id;
-        tasks = tasks;
-
-    }
-
-    /**
-     * @return the id
-     */
-    public String getId() {
-        return id;
-    }
-
-    /**
-     * @param id
-     *            the id to set
-     */
-    public void setId(String id) {
-        this.id = id;
-    }
-
-    /**
-     * @return the name
-     */
-    public String getName() {
-        return name;
-    }
-
-    /**
-     * @param name
-     *            the name to set
-     */
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    /**
-     * @return the tasks
-     */
-    public List getTasks() {
-        return tasks;
-    }
-
-    /**
-     * @param tasks
-     *            the tasks to set
-     */
-    public void setTasks(List tasks) {
-        this.tasks = tasks;
-    }
+  /**
+   * Default Constructor
+   * 
+   */
+  public Workflow() {
+    this.tasks = new Vector<WorkflowTask>();
+    this.conditions = new Vector<WorkflowCondition>();
+  }
+
+  /**
+   * Constructs a new Workflow with the given parameters.
+   * 
+   * @param name
+   *          The name of this workflow.
+   * @param id
+   *          The identifier for this workflow.
+   * @param tasks
+   *          The {@link List} of {@link WorkflowTask}s associated with this
+   *          workflow.
+   * 
+   * @param conditions
+   *          The {@link List} of {@link WorkflowCondition}s associated with
+   *          this workflow.
+   */
+  public Workflow(String name, String id, List<WorkflowTask> tasks,
+      List<WorkflowCondition> conditions) {
+    this.name = name;
+    this.id = id;
+    this.tasks = tasks;
+    this.conditions = conditions;
+  }
+
+  /**
+   * @return the id
+   */
+  public String getId() {
+    return id;
+  }
+
+  /**
+   * @param id
+   *          the id to set
+   */
+  public void setId(String id) {
+    this.id = id;
+  }
+
+  /**
+   * @return the name
+   */
+  public String getName() {
+    return name;
+  }
+
+  /**
+   * @param name
+   *          the name to set
+   */
+  public void setName(String name) {
+    this.name = name;
+  }
+
+  /**
+   * @return the conditions
+   */
+  public List<WorkflowCondition> getConditions() {
+    return conditions;
+  }
+
+  /**
+   * @param conditions
+   *          the conditions to set
+   */
+  public void setConditions(List<WorkflowCondition> conditions) {
+    this.conditions = conditions;
+  }
+
+  /**
+   * @param tasks
+   *          the tasks to set
+   */
+  public void setTasks(List<WorkflowTask> tasks) {
+    this.tasks = tasks;
+  }
+
+  /**
+   * @return the tasks
+   */
+  public List<WorkflowTask> getTasks() {
+    return tasks;
+  }
 
 }

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=1157470&r1=1157469&r2=1157470&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 Sun Aug 14 05:39:56 2011
@@ -224,6 +224,7 @@ public final class XmlRpcStructFactory {
         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;
     }
@@ -242,6 +243,7 @@ public final class XmlRpcStructFactory {
         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;
     }

Modified: oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/util/XmlStructFactory.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/util/XmlStructFactory.java?rev=1157470&r1=1157469&r2=1157470&view=diff
==============================================================================
--- oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/util/XmlStructFactory.java (original)
+++ oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/util/XmlStructFactory.java Sun Aug 14 05:39:56 2011
@@ -1,4 +1,4 @@
-/*
+/**
  * 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.
@@ -15,7 +15,6 @@
  * limitations under the License.
  */
 
-
 package org.apache.oodt.cas.workflow.util;
 
 //JDK imports
@@ -40,288 +39,302 @@ import org.apache.oodt.cas.workflow.stru
 import org.apache.oodt.cas.workflow.structs.WorkflowCondition;
 
 /**
+ * * A class for constructing Workflow Manager objects from XML {@link Node}s
+ * and {@link Element}s.
+ * 
  * @author mattmann
  * @version $Revsion$
  * 
- * <p>
- * A class for constructing Workflow Manager objects from XML {@link Node}s and
- * {@link Element}s.
- * </p>
  */
 public final class XmlStructFactory {
 
-    /* our log stream */
-    public static Logger LOG = Logger.getLogger(XmlStructFactory.class
-            .getName());
-
-    private XmlStructFactory() throws InstantiationException {
-        throw new InstantiationException(
-                "Don't instantiate XML Struct Factories!");
-    }
+  /* our log stream */
+  public static Logger LOG = Logger.getLogger(XmlStructFactory.class.getName());
 
-    /**
-     * <p>
-     * Creates {@link Workflow}s from the XML Node and the map of existing
-     * {@link WorkflowTask}s.
-     * </p>
-     * 
-     * @param node
-     *            The XML node to construct the Workflow from.
-     * @param tasks
-     *            The {@link HashMap} of existing {@link WorkflowTask}s.
-     * @return A new {@link Workflow} created from the XML node.
-     */
-    public static Workflow getWorkflow(Node node, HashMap tasks) {
-        Element workflowRoot = (Element) node;
-
-        String id = workflowRoot.getAttribute("id");
-        String name = workflowRoot.getAttribute("name");
-
-        Workflow workflow = new Workflow();
-        workflow.setName(name);
-        workflow.setId(id);
-
-        Element taskElem = getFirstElement("tasks", workflowRoot);
-
-        NodeList taskList = taskElem.getElementsByTagName("task");
-
-        if (taskList != null && taskList.getLength() > 0) {
-            List workflowTasks = new Vector(taskList.getLength());
-
-            for (int i = 0; i < taskList.getLength(); i++) {
-                Element taskElement = (Element) taskList.item(i);
-
-                WorkflowTask t = (WorkflowTask) tasks.get(taskElement
-                        .getAttribute("id"));
-
-                if (t != null) {
-                    WorkflowTask workflowTask = new WorkflowTask();
-                    workflowTask.setTaskInstanceClassName(t
-                            .getTaskInstanceClassName());
-                    workflowTask.setConditions(t.getConditions());
-                    workflowTask.setTaskId(t.getTaskId());
-                    workflowTask.setTaskConfig(t.getTaskConfig());
-                    workflowTask.setTaskName(t.getTaskName());
-                    workflowTask.setOrder(i + 1);
-                    workflowTask.setRequiredMetFields(t.getRequiredMetFields());
-                    workflowTasks.add(workflowTask);
-                }
-            }
-            workflow.setTasks(workflowTasks);
-        }
+  private XmlStructFactory() throws InstantiationException {
+    throw new InstantiationException("Don't instantiate XML Struct Factories!");
+  }
+
+  /**
+   * <p>
+   * Creates {@link Workflow}s from the XML Node and the map of existing
+   * {@link WorkflowTask}s.
+   * </p>
+   * 
+   * @param node
+   *          The XML node to construct the Workflow from.
+   * @param tasks
+   *          The {@link HashMap} of existing {@link WorkflowTask}s.
+   * 
+   * @param conditions
+   *          The {@link HashMap} of existing {@link WorkflowCondition}s.
+   * 
+   * @return A new {@link Workflow} created from the XML node.
+   */
+  public static Workflow getWorkflow(Node node, HashMap tasks,
+      HashMap conditions) {
+    Element workflowRoot = (Element) node;
+
+    String id = workflowRoot.getAttribute("id");
+    String name = workflowRoot.getAttribute("name");
+
+    Workflow workflow = new Workflow();
+    workflow.setName(name);
+    workflow.setId(id);
+
+    Element taskElem = getFirstElement("tasks", workflowRoot);
+    Element conditionsElem = getFirstElement("conditions", workflowRoot);
+
+    if (taskElem != null)
+      workflow.setTasks(getTasks(taskElem, tasks));
+    if (conditionsElem != null)
+      workflow.setConditions(getConditions(conditionsElem, conditions));
+
+    return workflow;
+  }
+
+  /**
+   * <p>
+   * Constructs a new {@link WorkflowTask} from the given XML node and
+   * {@link HashMap} of {@link WorkflowCondition}s.
+   * </p>
+   * 
+   * @param node
+   *          The XML node to construct the {@link WorkflowTask} from.
+   * @param conditions
+   *          The {@link HashMap} of {@link WorkflowCondition}s to use when
+   *          constructing the WorkflowTask.
+   * @return A new {@link WorkflowTask} created from the given XML node.
+   */
+  public static WorkflowTask getWorkflowTask(Node node, HashMap conditions) {
+    Element taskNode = (Element) node;
+
+    String taskClassName = taskNode.getAttribute("class");
+    WorkflowTask task = new WorkflowTask();
+    task.setTaskInstanceClassName(taskClassName);
+
+    task.setTaskId(taskNode.getAttribute("id"));
+    task.setTaskName(taskNode.getAttribute("name"));
+
+    // get the list of condition IDs for this task and then get the
+    // conditions for them
+    task.setConditions(getConditions(taskNode, conditions));
+
+    Element reqMetFieldsElem = getFirstElement("requiredMetFields", taskNode);
+    if (reqMetFieldsElem != null) {
+      task.setRequiredMetFields(getRequiredMetFields(reqMetFieldsElem));
+    }
 
-        return workflow;
+    // load its configuration
+    Element configElement = getFirstElement("configuration", taskNode);
+    if (configElement != null) {
+      task.setTaskConfig(new WorkflowTaskConfiguration(
+          getConfiguration(configElement)));
     }
 
-    /**
-     * <p>
-     * Constructs a new {@link WorkflowTask} from the given XML node and
-     * {@link HashMap} of {@link WorkflowCondition}s.
-     * </p>
-     * 
-     * @param node
-     *            The XML node to construct the {@link WorkflowTask} from.
-     * @param conditions
-     *            The {@link HashMap} of {@link WorkflowCondition}s to use when
-     *            constructing the WorkflowTask.
-     * @return A new {@link WorkflowTask} created from the given XML node.
-     */
-    public static WorkflowTask getWorkflowTask(Node node, HashMap conditions) {
-        Element taskNode = (Element) node;
-
-        String taskClassName = taskNode.getAttribute("class");
-        WorkflowTask task = new WorkflowTask();
-        task.setTaskInstanceClassName(taskClassName);
-
-        task.setTaskId(taskNode.getAttribute("id"));
-        task.setTaskName(taskNode.getAttribute("name"));
-
-        // get the list of condition IDs for this task and then get the
-        // conditions for them
-        Element conditionRoot = getFirstElement("conditions", taskNode);
-        if (conditionRoot != null) {
-            NodeList conditionNodes = conditionRoot
-                    .getElementsByTagName("condition");
-
-            if (conditionNodes != null && conditionNodes.getLength() > 0) {
-                List conditionList = new Vector(conditionNodes.getLength());
-
-                for (int i = 0; i < conditionNodes.getLength(); i++) {
-                    Element conditionNode = (Element) conditionNodes.item(i);
-                    WorkflowCondition condition = (WorkflowCondition) conditions
-                            .get(conditionNode.getAttribute("id"));
-
-                    if (condition != null) {
-                        WorkflowCondition workflowCondition = new WorkflowCondition();
-                        workflowCondition
-                                .setConditionInstanceClassName(condition
-                                        .getConditionInstanceClassName());
-                        workflowCondition.setConditionId(condition
-                                .getConditionId());
-                        workflowCondition.setConditionName(condition
-                                .getConditionName());
-                        workflowCondition.setOrder(i + 1);
-                        workflowCondition.setTimeoutSeconds(condition.getTimeoutSeconds());
-                        workflowCondition.setOptional(condition.isOptional());
-                        workflowCondition.setCondConfig(condition.getTaskConfig());
-                        conditionList.add(workflowCondition);
-                    }
-                }
+    return task;
+  }
 
-                task.setConditions(conditionList);
-            }
+  /**
+   * <p>
+   * Constructs a new {@link WorkflowCondition} from the given XML Node.
+   * </p>
+   * 
+   * @param node
+   *          The XML node to construct the WorkflowCondition from.
+   * @return A new {@link WorkflowCondition} from the given XML node.
+   */
+  public static WorkflowCondition getWorkflowCondition(Node node) {
+    Element conditionElement = (Element) node;
+
+    String conditionClassName = conditionElement.getAttribute("class");
+    WorkflowCondition condition = new WorkflowCondition();
+    condition.setConditionInstanceClassName(conditionClassName);
+    condition.setConditionId(conditionElement.getAttribute("id"));
+    condition.setConditionName(conditionElement.getAttribute("name"));
+    condition
+        .setTimeoutSeconds(Long.valueOf(conditionElement
+            .getAttribute("timeout") != null
+            && !conditionElement.getAttribute("timeout").equals("") ? conditionElement
+            .getAttribute("timeout") : "-1"));
+    condition.setOptional(Boolean.valueOf(conditionElement
+        .getAttribute("optional")));
+
+    // load its configuration
+    Element configElement = getFirstElement("configuration", conditionElement);
+    if (configElement != null) {
+      condition.setCondConfig(new WorkflowConditionConfiguration(
+          getConfiguration(configElement)));
+    }
 
-        }
+    return condition;
 
-        Element reqMetFieldsElem = getFirstElement("requiredMetFields",
-                taskNode);
-        if (reqMetFieldsElem != null) {
-            task.setRequiredMetFields(getRequiredMetFields(reqMetFieldsElem));
-        }
+  }
 
-        // load its configuration
-        Element configElement = getFirstElement("configuration", taskNode);
-        if (configElement != null) {
-            task.setTaskConfig(new WorkflowTaskConfiguration(getConfiguration(configElement)));
-        }
+  /**
+   * 
+   * @param node
+   * @return
+   */
+  public static List getRequiredMetFields(Node node) {
+    Element reqMetFieldsElem = (Element) node;
+
+    NodeList reqMetFieldNodes = reqMetFieldsElem
+        .getElementsByTagName("metfield");
+    List reqFields = null;
+
+    if (reqMetFieldNodes != null && reqMetFieldNodes.getLength() > 0) {
+      reqFields = new Vector(reqMetFieldNodes.getLength());
+      for (int i = 0; i < reqMetFieldNodes.getLength(); i++) {
+        Element reqMetFieldElem = (Element) reqMetFieldNodes.item(i);
+        String reqFieldName = reqMetFieldElem.getAttribute("name");
+        reqFields.add(reqFieldName);
 
-        return task;
+      }
     }
 
-    /**
-     * <p>
-     * Constructs a new {@link WorkflowCondition} from the given XML Node.
-     * </p>
-     * 
-     * @param node
-     *            The XML node to construct the WorkflowCondition from.
-     * @return A new {@link WorkflowCondition} from the given XML node.
-     */
-    public static WorkflowCondition getWorkflowCondition(Node node) {
-        Element conditionElement = (Element) node;
-
-        String conditionClassName = conditionElement.getAttribute("class");
-        WorkflowCondition condition = new WorkflowCondition();
-        condition.setConditionInstanceClassName(conditionClassName);
-        condition.setConditionId(conditionElement.getAttribute("id"));
-        condition.setConditionName(conditionElement.getAttribute("name"));
-        condition.setTimeoutSeconds(Long.valueOf(conditionElement.getAttribute("timeout") != null && 
-            !conditionElement.getAttribute("timeout").equals("")
-            ? conditionElement.getAttribute("timeout"):"-1"));
-        condition.setOptional(Boolean.valueOf(conditionElement.getAttribute("optional")));
-
-        // load its configuration
-        Element configElement = getFirstElement("configuration", conditionElement);
-        if (configElement != null) {
-            condition.setCondConfig(new WorkflowConditionConfiguration(getConfiguration(configElement)));
-        }
-        
-        return condition;
+    return reqFields;
+  }
 
-    }
+  /**
+   * <p>
+   * Constructs a new {@link WorkflowTaskConfiguration} from the given XML node.
+   * </p>
+   * 
+   * @param node
+   *          The XML node to construct the WorkflowTaskConfiguration from.
+   * @return A new {@link WorkflowTaskConfiguration} constructed from the given
+   *         XML node.
+   */
+  public static Properties getConfiguration(Node node) {
+    Element configNode = (Element) node;
 
-    /**
-     * 
-     * @param node
-     * @return
-     */
-    public static List getRequiredMetFields(Node node) {
-        Element reqMetFieldsElem = (Element) node;
-
-        NodeList reqMetFieldNodes = reqMetFieldsElem
-                .getElementsByTagName("metfield");
-        List reqFields = null;
-
-        if (reqMetFieldNodes != null && reqMetFieldNodes.getLength() > 0) {
-            reqFields = new Vector(reqMetFieldNodes.getLength());
-            for (int i = 0; i < reqMetFieldNodes.getLength(); i++) {
-                Element reqMetFieldElem = (Element) reqMetFieldNodes.item(i);
-                String reqFieldName = reqMetFieldElem.getAttribute("name");
-                reqFields.add(reqFieldName);
+    NodeList configProperties = configNode.getElementsByTagName("property");
 
-            }
-        }
-
-        return reqFields;
+    if (configProperties == null) {
+      return null;
     }
 
-    /**
-     * <p>
-     * Constructs a new {@link WorkflowTaskConfiguration} from the given XML
-     * node.
-     * </p>
-     * 
-     * @param node
-     *            The XML node to construct the WorkflowTaskConfiguration from.
-     * @return A new {@link WorkflowTaskConfiguration} constructed from the
-     *         given XML node.
-     */
-    public static Properties getConfiguration(Node node) {
-        Element configNode = (Element) node;
+    Properties properties = new Properties();
+    for (int i = 0; i < configProperties.getLength(); i++) {
+      Element propElem = (Element) configProperties.item(i);
+      String value = propElem.getAttribute("value");
+
+      boolean doReplace = Boolean.valueOf(propElem.getAttribute("envReplace"))
+          .booleanValue();
+      if (doReplace) {
+        value = PathUtils.replaceEnvVariables(value);
+      }
+      properties.put(propElem.getAttribute("name"), value);
+    }
 
-        NodeList configProperties = configNode.getElementsByTagName("property");
+    return properties;
+  }
 
-        if (configProperties == null) {
-            return null;
-        }
+  public static Metadata getConfigurationAsMetadata(Node configNode)
+      throws Exception {
+    Metadata curMetadata = new Metadata();
+    NodeList curGrandChildren = configNode.getChildNodes();
+    for (int k = 0; k < curGrandChildren.getLength(); k++) {
+      if (curGrandChildren.item(k).getNodeName().equals("property")) {
+        Element property = (Element) curGrandChildren.item(k);
+        String delim = property.getAttribute("delim");
+        String envReplace = property.getAttribute("envReplace");
+        String name = property.getAttribute("name");
+        String value = property.getAttribute("value");
+        if (Boolean.parseBoolean(envReplace))
+          value = PathUtils.doDynamicReplacement(value);
+        List<String> values = new Vector<String>();
+        if (delim.length() > 0)
+          values.addAll(Arrays.asList(value.split("\\" + delim)));
+        else
+          values.add(value);
+        curMetadata.replaceMetadata(name, values);
+      }
+    }
+    return curMetadata;
+  }
 
-        Properties properties = new Properties();
-        for (int i = 0; i < configProperties.getLength(); i++) {
-            Element propElem = (Element) configProperties.item(i);
-            String value = propElem.getAttribute("value");
-
-            boolean doReplace = Boolean.valueOf(
-                    propElem.getAttribute("envReplace")).booleanValue();
-            if (doReplace) {
-                value = PathUtils.replaceEnvVariables(value);
-            }
-            properties.put(propElem.getAttribute("name"), value);
+  private static List<WorkflowTask> getTasks(Element rootNode, HashMap tasks) {
+    NodeList taskList = rootNode.getElementsByTagName("task");
+    List<WorkflowTask> workflowTasks = null;
+
+    if (taskList != null && taskList.getLength() > 0) {
+      workflowTasks = new Vector<WorkflowTask>(taskList.getLength());
+
+      for (int i = 0; i < taskList.getLength(); i++) {
+        Element taskElement = (Element) taskList.item(i);
+
+        WorkflowTask t = (WorkflowTask) tasks.get(taskElement
+            .getAttribute("id"));
+
+        if (t != null) {
+          WorkflowTask workflowTask = new WorkflowTask();
+          workflowTask.setTaskInstanceClassName(t.getTaskInstanceClassName());
+          workflowTask.setConditions(t.getConditions());
+          workflowTask.setTaskId(t.getTaskId());
+          workflowTask.setTaskConfig(t.getTaskConfig());
+          workflowTask.setTaskName(t.getTaskName());
+          workflowTask.setOrder(i + 1);
+          workflowTask.setRequiredMetFields(t.getRequiredMetFields());
+          workflowTasks.add(workflowTask);
         }
+      }
 
-        return properties;
     }
-    
-    public static Metadata getConfigurationAsMetadata(Node configNode)
-        throws Exception {
-      Metadata curMetadata = new Metadata();
-      NodeList curGrandChildren = configNode.getChildNodes();
-      for (int k = 0; k < curGrandChildren.getLength(); k++) {
-        if (curGrandChildren.item(k).getNodeName().equals("property")) {
-          Element property = (Element) curGrandChildren.item(k);
-          String delim = property.getAttribute("delim");
-          String envReplace = property.getAttribute("envReplace");
-          String name = property.getAttribute("name");
-          String value = property.getAttribute("value");
-          if (Boolean.parseBoolean(envReplace))
-            value = PathUtils.doDynamicReplacement(value);
-          List<String> values = new Vector<String>();
-          if (delim.length() > 0)
-            values.addAll(Arrays.asList(value.split("\\" + delim)));
-          else
-            values.add(value);
-          curMetadata.replaceMetadata(name, values);
+
+    return workflowTasks;
+  }
+
+  private static List<WorkflowCondition> getConditions(Element rootNode,
+      HashMap conditions) {
+    List<WorkflowCondition> conditionList = new Vector<WorkflowCondition>();
+    NodeList conditionNodes = rootNode.getElementsByTagName("condition");
+
+    if (conditionNodes != null && conditionNodes.getLength() > 0) {
+      conditionList = new Vector<WorkflowCondition>(conditionNodes.getLength());
+
+      for (int i = 0; i < conditionNodes.getLength(); i++) {
+        Element conditionNode = (Element) conditionNodes.item(i);
+        WorkflowCondition condition = (WorkflowCondition) conditions
+            .get(conditionNode.getAttribute("id"));
+
+        if (condition != null) {
+          WorkflowCondition workflowCondition = new WorkflowCondition();
+          workflowCondition.setConditionInstanceClassName(condition
+              .getConditionInstanceClassName());
+          workflowCondition.setConditionId(condition.getConditionId());
+          workflowCondition.setConditionName(condition.getConditionName());
+          workflowCondition.setOrder(i + 1);
+          workflowCondition.setTimeoutSeconds(condition.getTimeoutSeconds());
+          workflowCondition.setOptional(condition.isOptional());
+          workflowCondition.setCondConfig(condition.getCondConfig());
+          conditionList.add(workflowCondition);
         }
       }
-      return curMetadata;
-    }    
 
-    private static Element getFirstElement(String name, Element root) {
-        NodeList list = root.getElementsByTagName(name);
-        if (list != null) {
-            return (Element) list.item(0);
-        } else
-            return null;
     }
 
-    private static String getSimpleElementText(Element node) {
-        if (node.getChildNodes().item(0) instanceof Text) {
-            return node.getChildNodes().item(0).getNodeValue();
-        } else
-            return null;
-    }
+    return conditionList;
+  }
 
-    private static String getElementText(String elemName, Element root) {
-        Element elem = getFirstElement(elemName, root);
-        return getSimpleElementText(elem);
-    }
+  private static Element getFirstElement(String name, Element root) {
+    NodeList list = root.getElementsByTagName(name);
+    if (list != null) {
+      return (Element) list.item(0);
+    } else
+      return null;
+  }
+
+  private static String getSimpleElementText(Element node) {
+    if (node.getChildNodes().item(0) instanceof Text) {
+      return node.getChildNodes().item(0).getNodeValue();
+    } else
+      return null;
+  }
+
+  private static String getElementText(String elemName, Element root) {
+    Element elem = getFirstElement(elemName, root);
+    return getSimpleElementText(elem);
+  }
 }

Added: oodt/trunk/workflow/src/main/resources/examples/condition.workflow.xml
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/resources/examples/condition.workflow.xml?rev=1157470&view=auto
==============================================================================
--- oodt/trunk/workflow/src/main/resources/examples/condition.workflow.xml (added)
+++ oodt/trunk/workflow/src/main/resources/examples/condition.workflow.xml Sun Aug 14 05:39:56 2011
@@ -0,0 +1,25 @@
+<!--
+  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.
+-->
+<cas:workflow xmlns:cas="http://oodt.jpl.nasa.gov/1.0/cas" name="Conditions Workflow" id="urn:oodt:conditionsWorkflow">
+ <conditions>
+   <condition id="urn:oodt:TimeoutCondition"/>
+ </conditions>
+ <tasks>
+   <task id="urn:oodt:LongTask"/>
+   <task id="urn:oodt:LongTask"/>
+ </tasks>
+</cas:workflow>

Propchange: oodt/trunk/workflow/src/main/resources/examples/condition.workflow.xml
------------------------------------------------------------------------------
    svn:executable = *

Modified: oodt/trunk/workflow/src/main/resources/examples/wengine/hello-goodbye.xml
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/resources/examples/wengine/hello-goodbye.xml?rev=1157470&r1=1157469&r2=1157470&view=diff
==============================================================================
--- oodt/trunk/workflow/src/main/resources/examples/wengine/hello-goodbye.xml (original)
+++ oodt/trunk/workflow/src/main/resources/examples/wengine/hello-goodbye.xml Sun Aug 14 05:39:56 2011
@@ -23,6 +23,10 @@
 			<task id-ref="urn:oodt:HelloWorld" />
 			<task id-ref="urn:oodt:GoodbyeWorld" />
 		</sequential>
+		
+		<conditions>
+		  <condition id-ref="urn:oodt:TimeoutCondition"/>
+		</conditions>
 
 		<task id-ref="urn:oodt:IntensiveTask" />
 	</parallel>

Modified: oodt/trunk/workflow/src/main/resources/workflow.sql
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/resources/workflow.sql?rev=1157470&r1=1157469&r2=1157470&view=diff
==============================================================================
--- oodt/trunk/workflow/src/main/resources/workflow.sql (original)
+++ oodt/trunk/workflow/src/main/resources/workflow.sql Sun Aug 14 05:39:56 2011
@@ -17,6 +17,10 @@ CREATE TABLE workflows
 (workflow_id int PRIMARY KEY NOT NULL,
 workflow_name varchar(255));
 
+CREATE TABLE workflow_condition_map
+(workflow_id int NOT NULL,
+workflow_condition_id int NOT NULL);
+
 CREATE TABLE event_workflow_map
 (workflow_id int NOT NULL,
 event_name varchar(255) NOT NULL);
@@ -66,7 +70,7 @@ workflow_condition_class varchar(255) NO
 workflow_condition_timeout int,
 workflow_optional boolean DEFAULT false);
 
-CREATE TABLE workflow_condition_map
+CREATE TABLE  task_condition_map
 (workflow_task_id int NOT NULL, 
 workflow_condition_id int NOT NULL
 condition_order int NOT NULL);

Modified: oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/repository/TestPackagedWorkflowRepository.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/repository/TestPackagedWorkflowRepository.java?rev=1157470&r1=1157469&r2=1157470&view=diff
==============================================================================
--- oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/repository/TestPackagedWorkflowRepository.java (original)
+++ oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/repository/TestPackagedWorkflowRepository.java Sun Aug 14 05:39:56 2011
@@ -42,6 +42,24 @@ public class TestPackagedWorkflowReposit
 
   public TestPackagedWorkflowRepository() {
   }
+  
+  /**
+   * @since OODT-205
+   */
+  public void testWorkflowConditions(){
+    Workflow w = null;
+    try{
+      w = this.repo.getWorkflowById("urn:npp:GranuleMaps");
+    }
+    catch(Exception e){
+      fail(e.getMessage());
+    }
+    
+    assertNotNull(w);
+    assertNotNull(w.getConditions());
+    assertTrue(w.getConditions().size() > 0);
+    assertEquals(w.getConditions().size(), 3);
+  }
 
   public void testDetectOuterLevelWorkflows() {
     assertNotNull(this.repo);

Modified: oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/repository/TestWorkflowDataSourceRepository.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/repository/TestWorkflowDataSourceRepository.java?rev=1157470&r1=1157469&r2=1157470&view=diff
==============================================================================
--- oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/repository/TestWorkflowDataSourceRepository.java (original)
+++ oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/repository/TestWorkflowDataSourceRepository.java Sun Aug 14 05:39:56 2011
@@ -29,6 +29,7 @@ import javax.sql.DataSource;
 import org.apache.oodt.commons.database.DatabaseConnectionBuilder;
 import org.apache.oodt.commons.database.SqlScript;
 import org.apache.oodt.cas.metadata.Metadata;
+import org.apache.oodt.cas.workflow.structs.Workflow;
 import org.apache.oodt.cas.workflow.structs.WorkflowCondition;
 import org.apache.oodt.cas.workflow.structs.WorkflowConditionInstance;
 import org.apache.oodt.cas.workflow.structs.exceptions.RepositoryException;
@@ -102,6 +103,27 @@ public class TestWorkflowDataSourceRepos
         ds.getConnection().close();
     }
     
+    /**
+     * @since OODT-205
+     */
+    public void testWorkflowConditions(){
+      DataSourceWorkflowRepository repo = new DataSourceWorkflowRepository(ds);
+            
+      Workflow w = null;
+      try{
+        w = repo.getWorkflowById("1");
+      }
+      catch(Exception e){
+        fail(e.getMessage());
+      }
+      
+      assertNotNull(w);
+      assertNotNull(w.getConditions());
+      assertTrue(w.getConditions().size() > 0);
+      assertEquals(w.getConditions().size(), 1);
+    }
+    
+    
     public void testDataSourceRepo() throws SQLException, RepositoryException {
         DataSourceWorkflowRepository repo = new DataSourceWorkflowRepository(ds);
         

Modified: oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/repository/TestWorkflowRepository.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/repository/TestWorkflowRepository.java?rev=1157470&r1=1157469&r2=1157470&view=diff
==============================================================================
--- oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/repository/TestWorkflowRepository.java (original)
+++ oodt/trunk/workflow/src/test/org/apache/oodt/cas/workflow/repository/TestWorkflowRepository.java Sun Aug 14 05:39:56 2011
@@ -60,6 +60,24 @@ public class TestWorkflowRepository exte
                 .toString());
         workflowRepository = new XMLWorkflowRepository(workflowDirUris);
     }
+    
+    /**
+     * @since OODT-205
+     */
+    public void testWorkflowConditions(){
+      Workflow w = null;
+      try{
+        w = this.workflowRepository.getWorkflowById("urn:oodt:conditionsWorkflow");
+      }
+      catch(Exception e){
+        fail(e.getMessage());
+      }
+      
+      assertNotNull(w);
+      assertNotNull(w.getConditions());
+      assertTrue(w.getConditions().size() > 0);
+      assertEquals(w.getConditions().size(), 1);
+    }    
 
     public void testGetWorkflowByName() {
         Workflow w = null;
@@ -99,7 +117,7 @@ public class TestWorkflowRepository exte
         }
 
         assertNotNull(workflows);
-        assertEquals(10, workflows.size());
+        assertEquals(11, workflows.size());
     }
 
     public void testGetWorkflowsForEvent() {

Modified: oodt/trunk/workflow/src/testdata/workflow.sql
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/testdata/workflow.sql?rev=1157470&r1=1157469&r2=1157470&view=diff
==============================================================================
--- oodt/trunk/workflow/src/testdata/workflow.sql (original)
+++ oodt/trunk/workflow/src/testdata/workflow.sql Sun Aug 14 05:39:56 2011
@@ -1,12 +1,13 @@
 
 DROP TABLE workflows IF EXISTS;
+DROP TABLE workflow_condition_map IF EXISTS;
 DROP TABLE event_workflow_map IF EXISTS;
 DROP TABLE workflow_tasks IF EXISTS;
 DROP TABLE workflow_task_map IF EXISTS;
 DROP TABLE workflow_instances IF EXISTS;
 DROP TABLE workflow_instance_metadata IF EXISTS;
 DROP TABLE workflow_conditions IF EXISTS;
-DROP TABLE workflow_condition_map IF EXISTS;
+DROP TABLE task_condition_map IF EXISTS;
 DROP TABLE workflow_task_configuration IF EXISTS;
 DROP TABLE workflow_condition_configuration IF EXISTS;
 
@@ -14,6 +15,11 @@ CREATE TABLE workflows 
 (workflow_id int NOT NULL PRIMARY KEY, 
 workflow_name varchar(255));
 
+CREATE TABLE workflow_condition_map
+(workflow_id int NOT NULL,
+workflow_condition_id int NOT NULL,
+condition_order int NOT NULL);
+
 CREATE TABLE event_workflow_map
 (workflow_id int NOT NULL,
 event_name varchar(255) NOT NULL);
@@ -50,7 +56,7 @@ workflow_condition_class varchar(255) NO
 workflow_condition_timeout int NOT NULL,
 workflow_condition_optional boolean DEFAULT false);
 
-CREATE TABLE workflow_condition_map
+CREATE TABLE task_condition_map
 (workflow_task_id int NOT NULL, 
 workflow_condition_id int NOT NULL,
 condition_order int NOT NULL);
@@ -69,3 +75,5 @@ INSERT INTO workflow_conditions VALUES (
 INSERT INTO workflow_condition_configuration VALUES ('1', 'reqMetKeys', 'Met1,Met2,Met3');
 INSERT INTO workflow_conditions VALUES ('2', 'FalseCond', 'org.apache.oodt.cas.workflow.examples.FalseCondition', 10, true);
 INSERT INTO workflow_conditions VALUES ('3', 'TrueCond', 'org.apache.oodt.cas.workflow.examples.TrueCondition', 30, true);
+INSERT INTO workflows VALUES ('1', 'Test Workflow');
+INSERT INTO workflow_condition_map VALUES ('1', '3', '1');