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 09:07:07 UTC

svn commit: r1157478 - in /oodt/trunk: ./ workflow/src/main/java/org/apache/oodt/cas/workflow/examples/ workflow/src/main/java/org/apache/oodt/cas/workflow/repository/ workflow/src/main/java/org/apache/oodt/cas/workflow/util/ workflow/src/main/resource...

Author: mattmann
Date: Sun Aug 14 07:07:06 2011
New Revision: 1157478

URL: http://svn.apache.org/viewvc?rev=1157478&view=rev
Log:
- fix for OODT-215 WorkflowInstances should have pre-conditions as well

Added:
    oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/examples/BranchRedirector.java
    oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/examples/NoOpTask.java
Modified:
    oodt/trunk/CHANGES.txt
    oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/DataSourceWorkflowRepository.java
    oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/PackagedWorkflowRepository.java
    oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/XMLWorkflowRepository.java
    oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/util/GenericWorkflowObjectFactory.java
    oodt/trunk/workflow/src/main/resources/examples/condition.workflow.xml
    oodt/trunk/workflow/src/main/resources/examples/events.xml

Modified: oodt/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/oodt/trunk/CHANGES.txt?rev=1157478&r1=1157477&r2=1157478&view=diff
==============================================================================
--- oodt/trunk/CHANGES.txt (original)
+++ oodt/trunk/CHANGES.txt Sun Aug 14 07:07:06 2011
@@ -4,6 +4,9 @@ Apache OODT Change Log
 Release 0.4: Current Development
 --------------------------------------------
 
+* OODT-215 WorkflowInstances should have pre-conditions as 
+  well (mattmann)
+
 * OODT-306 Added FileManager Tool Aliases (mattmann, goodale)
 
 * OODT-208 WorkflowConditions should be identifiable as optional 

Added: oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/examples/BranchRedirector.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/examples/BranchRedirector.java?rev=1157478&view=auto
==============================================================================
--- oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/examples/BranchRedirector.java (added)
+++ oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/examples/BranchRedirector.java Sun Aug 14 07:07:06 2011
@@ -0,0 +1,68 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.oodt.cas.workflow.examples;
+
+//JDK imports
+import java.net.URL;
+
+//OODT imports
+import org.apache.oodt.cas.metadata.Metadata;
+import org.apache.oodt.cas.workflow.metadata.CoreMetKeys;
+import org.apache.oodt.cas.workflow.structs.WorkflowTaskConfiguration;
+import org.apache.oodt.cas.workflow.structs.WorkflowTaskInstance;
+import org.apache.oodt.cas.workflow.structs.exceptions.WorkflowTaskInstanceException;
+import org.apache.oodt.cas.workflow.system.XmlRpcWorkflowManagerClient;
+
+/**
+ * 
+ * Redirects from an existing {@link WorkflowInstance} by sending a specified
+ * event specified by the task configuration parameter named
+ * <code>eventName</code>.
+ * 
+ * @author mattmann
+ * @version $Revision$
+ * 
+ */
+public class BranchRedirector implements WorkflowTaskInstance {
+
+  public BranchRedirector() {
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see
+   * org.apache.oodt.cas.workflow.structs.WorkflowTaskInstance#run(org.apache
+   * .oodt.cas.metadata.Metadata,
+   * org.apache.oodt.cas.workflow.structs.WorkflowTaskConfiguration)
+   */
+  @Override
+  public void run(Metadata metadata, WorkflowTaskConfiguration config)
+      throws WorkflowTaskInstanceException {
+    XmlRpcWorkflowManagerClient wm = null;
+
+    try {
+      wm = new XmlRpcWorkflowManagerClient(new URL(
+          metadata.getMetadata(CoreMetKeys.WORKFLOW_MANAGER_URL)));
+      wm.sendEvent(config.getProperty("eventName"), metadata);
+    } catch (Exception e) {
+      throw new WorkflowTaskInstanceException(e.getMessage());
+    }
+  }
+
+}

Added: oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/examples/NoOpTask.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/examples/NoOpTask.java?rev=1157478&view=auto
==============================================================================
--- oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/examples/NoOpTask.java (added)
+++ oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/examples/NoOpTask.java Sun Aug 14 07:07:06 2011
@@ -0,0 +1,50 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.oodt.cas.workflow.examples;
+
+//OODT imports
+import org.apache.oodt.cas.metadata.Metadata;
+import org.apache.oodt.cas.workflow.structs.WorkflowTaskConfiguration;
+import org.apache.oodt.cas.workflow.structs.WorkflowTaskInstance;
+import org.apache.oodt.cas.workflow.structs.exceptions.WorkflowTaskInstanceException;
+
+/**
+ * 
+ * Performs no action, an is a no-op.
+ * 
+ * @author mattmann
+ * @version $Revision$
+ * 
+ */
+public class NoOpTask implements WorkflowTaskInstance {
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see
+   * org.apache.oodt.cas.workflow.structs.WorkflowTaskInstance#run(org.apache
+   * .oodt.cas.metadata.Metadata,
+   * org.apache.oodt.cas.workflow.structs.WorkflowTaskConfiguration)
+   */
+  @Override
+  public void run(Metadata metadata, WorkflowTaskConfiguration config)
+      throws WorkflowTaskInstanceException {
+
+  }
+
+}

Modified: oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/DataSourceWorkflowRepository.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/DataSourceWorkflowRepository.java?rev=1157478&r1=1157477&r2=1157478&view=diff
==============================================================================
--- oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/DataSourceWorkflowRepository.java (original)
+++ oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/DataSourceWorkflowRepository.java Sun Aug 14 07:07:06 2011
@@ -19,6 +19,7 @@ package org.apache.oodt.cas.workflow.rep
 
 //OODT imports
 import org.apache.oodt.cas.workflow.util.DbStructFactory;
+import org.apache.oodt.cas.workflow.examples.NoOpTask;
 import org.apache.oodt.cas.workflow.structs.Workflow;
 import org.apache.oodt.cas.workflow.structs.WorkflowConditionConfiguration;
 import org.apache.oodt.cas.workflow.structs.WorkflowTask;
@@ -102,6 +103,7 @@ public class DataSourceWorkflowRepositor
 
         if (getConditions) {
           workflow.setConditions(getConditionsByWorkflowId(workflow.getId()));
+          handleGlobalWorkflowConditions(workflow);
         }
       }
 
@@ -190,6 +192,7 @@ public class DataSourceWorkflowRepositor
 
         if (getConditions) {
           workflow.setConditions(getConditionsByWorkflowId(workflow.getId()));
+          handleGlobalWorkflowConditions(workflow);
         }
       }
 
@@ -277,6 +280,7 @@ public class DataSourceWorkflowRepositor
 
         if (getConditions) {
           workflow.setConditions(getConditionsByWorkflowId(workflow.getId()));
+          handleGlobalWorkflowConditions(workflow);
         }
 
         workflows.add(workflow);
@@ -537,6 +541,7 @@ public class DataSourceWorkflowRepositor
 
         if (getConditions) {
           workflow.setConditions(getConditionsByWorkflowId(workflow.getId()));
+          handleGlobalWorkflowConditions(workflow);
         }
 
         workflows.add(workflow);
@@ -1370,6 +1375,86 @@ public class DataSourceWorkflowRepositor
     return workflowId;
   }
 
+  private String commitTask(Workflow workflow, WorkflowTask task) throws RepositoryException {
+    Connection conn = null;
+    Statement statement = null;
+    ResultSet rs = null;
+    String taskId = null;
+
+    try {
+      conn = dataSource.getConnection();
+      conn.setAutoCommit(false);
+      statement = conn.createStatement();
+
+      String sql = "INSERT INTO workflow_tasks (workflow_task_name, workflow_task_class) VALUES ('"
+          + task.getTaskName() + "', '"+task.getTaskInstanceClassName()+"')";
+
+      LOG.log(Level.FINE, "commitTaskToDB: Executing: " + sql);
+      statement.execute(sql);
+
+      sql = "SELECT MAX(workflow_task_id) AS max_id FROM workflow_tasks";
+      rs = statement.executeQuery(sql);
+
+      while (rs.next()) {
+        taskId = String.valueOf(rs.getInt("max_id"));
+      }
+
+      task.setTaskId(taskId);
+
+      // task to workflow map
+      sql = "INSERT INTO workflow_task_map (workflow_id, workflow_task_id, task_order) VALUES ("
+          + workflow.getId() + ","+taskId+",1)";
+      LOG.log(Level.FINE, "commitTaskToDB: Executing: " + sql);
+      statement.execute(sql);
+      conn.commit();
+
+    } catch (Exception e) {
+      e.printStackTrace();
+      LOG.log(Level.WARNING,
+          "Exception adding task. Message: " + e.getMessage());
+      try {
+        conn.rollback();
+      } catch (SQLException e2) {
+        LOG.log(
+            Level.SEVERE,
+            "Unable to rollback task transaction. Message: "
+                + e2.getMessage());
+      }
+      throw new RepositoryException(e.getMessage());
+    } finally {
+
+      if (rs != null) {
+        try {
+          rs.close();
+        } catch (SQLException ignore) {
+        }
+
+        rs = null;
+      }
+
+      if (statement != null) {
+        try {
+          statement.close();
+        } catch (SQLException ignore) {
+        }
+
+        statement = null;
+      }
+
+      if (conn != null) {
+        try {
+          conn.close();
+
+        } catch (SQLException ignore) {
+        }
+
+        conn = null;
+      }
+    }
+
+    return taskId;
+  }
+  
   private List<WorkflowTask> getTasks() throws RepositoryException {
     Connection conn = null;
     Statement statement = null;
@@ -1477,4 +1562,30 @@ public class DataSourceWorkflowRepositor
     return false;
   }
 
+  private void handleGlobalWorkflowConditions(Workflow workflow) throws RepositoryException {
+    if (workflow.getConditions() != null && workflow.getConditions().size() > 0) {
+      if (workflow.getTasks() == null
+          || (workflow.getTasks() != null && workflow.getTasks().size() == 0)) {
+        workflow.setTasks(new Vector<WorkflowTask>());
+      }
+
+      workflow.getTasks().add(
+          0,
+          getGlobalWorkflowConditionsTask(workflow,
+              workflow.getConditions()));
+    }
+  }
+
+  private WorkflowTask getGlobalWorkflowConditionsTask(Workflow workflow,
+      List<WorkflowCondition> conditions) throws RepositoryException {
+    WorkflowTask task = new WorkflowTask();
+    task.setConditions(conditions);
+    task.setTaskConfig(new WorkflowTaskConfiguration());
+    task.setTaskId(workflow.getId() + "-global-conditions-eval");
+    task.setTaskName(workflow.getName() + "-global-conditions-eval");
+    task.setTaskInstanceClassName(NoOpTask.class.getName());
+    task.setTaskId(this.commitTask(workflow, task));
+    return task;
+  }
+
 }

Modified: oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/PackagedWorkflowRepository.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/PackagedWorkflowRepository.java?rev=1157478&r1=1157477&r2=1157478&view=diff
==============================================================================
--- oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/PackagedWorkflowRepository.java (original)
+++ oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/PackagedWorkflowRepository.java Sun Aug 14 07:07:06 2011
@@ -18,22 +18,19 @@ package org.apache.oodt.cas.workflow.rep
 
 //OODT imports
 import org.apache.oodt.cas.metadata.Metadata;
-import org.apache.oodt.cas.workflow.metadata.CoreMetKeys;
+import org.apache.oodt.cas.workflow.examples.BranchRedirector;
+import org.apache.oodt.cas.workflow.examples.NoOpTask;
 import org.apache.oodt.cas.workflow.structs.Workflow;
 import org.apache.oodt.cas.workflow.structs.WorkflowCondition;
 import org.apache.oodt.cas.workflow.structs.WorkflowConditionConfiguration;
 import org.apache.oodt.cas.workflow.structs.WorkflowTask;
 import org.apache.oodt.cas.workflow.structs.WorkflowTaskConfiguration;
-import org.apache.oodt.cas.workflow.structs.WorkflowTaskInstance;
 import org.apache.oodt.cas.workflow.structs.exceptions.RepositoryException;
-import org.apache.oodt.cas.workflow.structs.exceptions.WorkflowTaskInstanceException;
-import org.apache.oodt.cas.workflow.system.XmlRpcWorkflowManagerClient;
 import org.apache.oodt.cas.workflow.util.XmlStructFactory;
 import org.apache.oodt.commons.xml.XMLUtils;
 
 //JDK imports
 import java.io.File;
-import java.net.URL;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
@@ -356,6 +353,7 @@ public class PackagedWorkflowRepository 
         loadTaskAndConditionDefinitions(rootElements, root, staticMetadata);
         loadGraphs(rootElements, root, new Graph(), staticMetadata);
         computeEvents();
+        computeWorkflowConditions();
       }
     } catch (Exception e) {
       e.printStackTrace();
@@ -363,6 +361,18 @@ public class PackagedWorkflowRepository 
     }
   }
 
+  private void computeWorkflowConditions() throws Exception {
+    if (this.workflows != null && this.workflows.values() != null
+        && this.workflows.values().size() > 0) {
+      for (ParentChildWorkflow w : this.workflows.values()) {
+        if (w.getConditions() != null && w.getConditions().size() > 0) {
+          w.getTasks().add(0,
+              getGlobalWorkflowConditionsTask(w.getName(), w.getId(), w.getConditions()));
+        }
+      }
+    }
+  }
+
   private void computeEvents() throws Exception {
     List<ParentChildWorkflow> workflows = new Vector<ParentChildWorkflow>();
     for (ParentChildWorkflow w : this.workflows.values()) {
@@ -1099,33 +1109,16 @@ public class PackagedWorkflowRepository 
 
   }
 
-  private class BranchRedirector implements WorkflowTaskInstance {
-
-    public BranchRedirector() {
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.apache.oodt.cas.workflow.structs.WorkflowTaskInstance#run(org.apache
-     * .oodt.cas.metadata.Metadata,
-     * org.apache.oodt.cas.workflow.structs.WorkflowTaskConfiguration)
-     */
-    @Override
-    public void run(Metadata metadata, WorkflowTaskConfiguration config)
-        throws WorkflowTaskInstanceException {
-      XmlRpcWorkflowManagerClient wm = null;
-
-      try {
-        wm = new XmlRpcWorkflowManagerClient(new URL(
-            metadata.getMetadata(CoreMetKeys.WORKFLOW_MANAGER_URL)));
-        wm.sendEvent(config.getProperty("eventName"), metadata);
-      } catch (Exception e) {
-        throw new WorkflowTaskInstanceException(e.getMessage());
-      }
-    }
-
+  private WorkflowTask getGlobalWorkflowConditionsTask(String workflowName, String workflowId,
+      List<WorkflowCondition> conditions) {
+    WorkflowTask task = new WorkflowTask();
+    task.setConditions(conditions);
+    task.setTaskConfig(new WorkflowTaskConfiguration());
+    task.setTaskId(workflowId + "-global-conditions-eval");
+    task.setTaskName(workflowName + "-global-conditions-eval");
+    task.setTaskInstanceClassName(NoOpTask.class.getName());
+    this.tasks.put(task.getTaskId(), task);
+    return task;
   }
 
 }

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=1157478&r1=1157477&r2=1157478&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 07:07:06 2011
@@ -19,12 +19,16 @@
 package org.apache.oodt.cas.workflow.repository;
 
 //OODT imports
+import org.apache.oodt.cas.metadata.Metadata;
 import org.apache.oodt.cas.workflow.util.XmlStructFactory;
+import org.apache.oodt.cas.workflow.examples.NoOpTask;
 import org.apache.oodt.cas.workflow.structs.Workflow;
 import org.apache.oodt.cas.workflow.structs.WorkflowTask;
 import org.apache.oodt.cas.workflow.structs.WorkflowCondition;
 import org.apache.oodt.cas.workflow.structs.WorkflowTaskConfiguration;
+import org.apache.oodt.cas.workflow.structs.WorkflowTaskInstance;
 import org.apache.oodt.cas.workflow.structs.exceptions.RepositoryException;
+import org.apache.oodt.cas.workflow.structs.exceptions.WorkflowTaskInstanceException;
 
 //JDK imports
 import java.util.logging.Level;
@@ -520,6 +524,11 @@ public class XMLWorkflowRepository imple
                                 Workflow w = XmlStructFactory.getWorkflow(
                                         workflowRoot.getDocumentElement(),
                                         taskMap, conditionMap);
+                                
+                                if(w.getConditions() != null && w.getConditions().size() > 0){
+                                  // add a virtual first task, with the conditions 
+                                  w.getTasks().add(0, getGlobalWorkflowConditionsTask(w.getName(), w.getId(), w.getConditions()));
+                                }
                                 workflowMap.put(workflowId, w);
                             } else {
                                 LOG
@@ -649,6 +658,16 @@ public class XMLWorkflowRepository imple
 
         return document;
     }
-
+    
+    private WorkflowTask getGlobalWorkflowConditionsTask(String workflowName, String workflowId, List<WorkflowCondition> conditions){
+      WorkflowTask task = new WorkflowTask();
+      task.setConditions(conditions);
+      task.setTaskConfig(new WorkflowTaskConfiguration());
+      task.setTaskId(workflowId+"-global-conditions-eval");
+      task.setTaskName(workflowName+"-global-conditions-eval");
+      task.setTaskInstanceClassName(NoOpTask.class.getName());
+      this.taskMap.put(task.getTaskId(), task);
+      return task;
+    }
 
 }

Modified: oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/util/GenericWorkflowObjectFactory.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/util/GenericWorkflowObjectFactory.java?rev=1157478&r1=1157477&r2=1157478&view=diff
==============================================================================
--- oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/util/GenericWorkflowObjectFactory.java (original)
+++ oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/util/GenericWorkflowObjectFactory.java Sun Aug 14 07:07:06 2011
@@ -28,6 +28,8 @@ import org.apache.oodt.cas.workflow.stru
 import org.apache.oodt.cas.workflow.structs.Workflow;
 
 //JDK imports
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 import java.util.List;
@@ -127,6 +129,67 @@ public final class GenericWorkflowObject
 		} else
 			return null;
 	}
+	
+  /**
+   * <p>
+   * Constructs a {@link WorkflowTaskInstance} from the given implementation
+   * class name.
+   * </p>
+   * 
+   * @param className
+   *            The String name of the inner class (including package qualifiers)
+   *            that implements the WorkflowTaskInstance interface to
+   *            construct.
+   * @return A new {@link WorkflowTaskInstance} implementation specified by
+   *         its class name.
+   */
+  public static WorkflowTaskInstance getTaskObjectFromInnerClassName(Class<?> enclosingInstance, String className) {
+
+    if (className != null) {
+      WorkflowTaskInstance taskInstance = null;
+
+      try {
+        Class workflowTaskClass = Class.forName(className);
+        Constructor construct = workflowTaskClass.getConstructor(enclosingInstance);
+        taskInstance = (WorkflowTaskInstance) construct.newInstance();
+
+        return taskInstance;
+
+      } catch (ClassNotFoundException e) {
+        e.printStackTrace();
+        LOG.log(Level.WARNING,
+            "ClassNotFound, Unable to locate task class: "
+                + className + ": cannot instantiate!");
+        return null;
+      } catch (InstantiationException e) {
+        e.printStackTrace();
+        LOG.log(Level.WARNING, "Unable to instantiate task class: "
+            + className + ": Reason: " + e.getMessage() + " !");
+        return null;
+      } catch (IllegalAccessException e) {
+        e.printStackTrace();
+        LOG.log(Level.WARNING,
+            "IllegalAccessException when instantiating task class: "
+                + className + ": cannot instantiate!");
+        return null;
+      }
+      catch (NoSuchMethodException e) {
+        e.printStackTrace();
+        LOG.log(Level.WARNING,
+            "NoSuchMethodException when instantiating task class: "
+                + className + ": cannot instantiate!");
+        return null;
+      }
+      catch (InvocationTargetException e) {
+        e.printStackTrace();
+        LOG.log(Level.WARNING,
+            "InvocationTargetException when instantiating task class: "
+                + className + ": cannot instantiate!");
+        return null;
+      }
+    } else
+      return null;
+  }	
 
 	/**
 	 * <p>

Modified: 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=1157478&r1=1157477&r2=1157478&view=diff
==============================================================================
--- oodt/trunk/workflow/src/main/resources/examples/condition.workflow.xml (original)
+++ oodt/trunk/workflow/src/main/resources/examples/condition.workflow.xml Sun Aug 14 07:07:06 2011
@@ -19,7 +19,7 @@
    <condition id="urn:oodt:TimeoutCondition"/>
  </conditions>
  <tasks>
-   <task id="urn:oodt:LongTask"/>
-   <task id="urn:oodt:LongTask"/>
+   <task id="urn:oodt:IntensiveTask"/>
+   <task id="urn:oodt:IntensiveTask"/>
  </tasks>
 </cas:workflow>

Modified: oodt/trunk/workflow/src/main/resources/examples/events.xml
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/resources/examples/events.xml?rev=1157478&r1=1157477&r2=1157478&view=diff
==============================================================================
--- oodt/trunk/workflow/src/main/resources/examples/events.xml (original)
+++ oodt/trunk/workflow/src/main/resources/examples/events.xml Sun Aug 14 07:07:06 2011
@@ -46,6 +46,9 @@
 	<event name="optional">
 	    <workflow id="urn:oodt:optionalWorkflow"/>
 	</event>
+	<event name="conditions">
+	    <workflow id="urn:oodt:conditionsWorkflow"/>
+	</event>
     <event name="GenericFileIngest">
        <workflow id="urn:oodt:mailWorkflow"/>
     </event>