oodt-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mattm...@apache.org
Subject svn commit: r1156658 - in /oodt/trunk: ./ workflow/src/main/java/org/apache/oodt/cas/workflow/repository/ workflow/src/main/java/org/apache/oodt/cas/workflow/system/
Date Thu, 11 Aug 2011 16:07:30 GMT
Author: mattmann
Date: Thu Aug 11 16:07:29 2011
New Revision: 1156658

URL: http://svn.apache.org/viewvc?rev=1156658&view=rev
Log:
- fix for OODT-209 Workflow Manager Dynamic Workflows

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/WorkflowRepository.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/system/XmlRpcWorkflowManager.java
    oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/system/XmlRpcWorkflowManagerClient.java

Modified: oodt/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/oodt/trunk/CHANGES.txt?rev=1156658&r1=1156657&r2=1156658&view=diff
==============================================================================
--- oodt/trunk/CHANGES.txt (original)
+++ oodt/trunk/CHANGES.txt Thu Aug 11 16:07:29 2011
@@ -4,6 +4,8 @@ Apache OODT Change Log
 Release 0.4: Current Development
 --------------------------------------------
 
+* OODT-209 Workflow Manager Dynamic Workflows (mattmann)
+
 * OODT-211 Sub Workflows (mattmann, per OODT-70)
 
 * OODT-207 WorkflowConditions should have a timeout (mattmann)

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=1156658&r1=1156657&r2=1156658&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
Thu Aug 11 16:07:29 2011
@@ -1141,5 +1141,232 @@ public class DataSourceWorkflowRepositor
 
         return events;
     }
+    
+
+    /* (non-Javadoc)
+     * @see org.apache.oodt.cas.workflow.repository.WorkflowRepository#addWorkflow(org.apache.oodt.cas.workflow.structs.Workflow)
+     */
+    @Override
+    public String addWorkflow(Workflow workflow) throws RepositoryException {
+      // first check to see that its tasks are all present
+      if (workflow.getTasks() == null
+          || (workflow.getTasks() != null && workflow.getTasks().size() == 0)) {
+        throw new RepositoryException("Attempt to define a new worklfow: ["
+            + workflow.getName() + "] with no tasks.");
+      }
+      
+      List<WorkflowTask> allTasks = this.getTasks();
+
+      for (WorkflowTask task : (List<WorkflowTask>) workflow.getTasks()) {
+        if (!this.hasTaskId(allTasks, task.getTaskId())) {
+          throw new RepositoryException("Reference in new workflow: ["
+              + workflow.getName() + "] to undefined task with id: ["
+              + task.getTaskId() + "]");
+        }
+
+        // check its conditions
+        if (task.getConditions() != null && task.getConditions().size() > 0) {
+          List<WorkflowCondition> conditions = this.getConditionsByTaskId(task.getTaskId());
         
+          for (WorkflowCondition cond : (List<WorkflowCondition>) task
+              .getConditions()) {
+            if (!this.hasConditionId(conditions, cond.getConditionId())) {
+              throw new RepositoryException("Reference in new workflow: ["
+                  + workflow.getName() + "] to undefined condition ith id: ["
+                  + cond.getConditionId() + "]");
+            }
+          }
+        }
+      }
+      
+      String workflowId = this.commitWorkflow(workflow);
+      return workflowId;
+    }    
+
+  private String commitWorkflow(Workflow workflow) throws RepositoryException {
+    Connection conn = null;
+    Statement statement = null;
+    ResultSet rs = null;
+    String workflowId = null;
+
+    try {
+      conn = dataSource.getConnection();
+      conn.setAutoCommit(false);
+      statement = conn.createStatement();
+
+      String sql = "INSERT INTO workflows (workflow_name) VALUES ('"
+          + workflow.getName() + "')";
+
+      LOG.log(Level.FINE, "commitWorkflowToDB: Executing: " + sql);
+      statement.execute(sql);
+
+      sql = "SELECT MAX(workflow_id) AS max_id FROM workflows";
+      rs = statement.executeQuery(sql);
+
+      while (rs.next()) {
+        workflowId = String.valueOf(rs.getInt("max_id"));
+      }
+
+      workflow.setId(workflowId);
+
+      // event to workflow map
+      sql = "INSERT INTO event_workflow_map (workflow_id, event_name) VALUES ("
+          + workflowId + ",'workflow-" + workflowId + "')";
+      LOG.log(Level.FINE, "commitWorkflowToDB: Executing: " + sql);
+      statement.execute(sql);
+      conn.commit();
+
+    } catch (Exception e) {
+      e.printStackTrace();
+      LOG.log(Level.WARNING,
+          "Exception adding workflow. Message: " + e.getMessage());
+      try {
+        conn.rollback();
+      } catch (SQLException e2) {
+        LOG.log(
+            Level.SEVERE,
+            "Unable to rollback workflow 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 workflowId;
+  }
+    
+  private List<WorkflowTask> getTasks() throws RepositoryException {
+    Connection conn = null;
+    Statement statement = null;
+    ResultSet rs = null;
+
+    List<WorkflowTask> tasks = null;
+
+    try {
+      conn = dataSource.getConnection();
+      statement = conn.createStatement();
+
+      String getTasksSql = "SELECT workflow_tasks.*, workflow_task_map.task_order "
+          + "FROM workflow_tasks " + "ORDER BY workflow_task_map.task_order";
+
+      LOG.log(Level.FINE, "getTasks: Executing: " + getTasksSql);
+      rs = statement.executeQuery(getTasksSql);
+      tasks = new Vector<WorkflowTask>();
+
+      while (rs.next()) {
+        // get an instance of the class name
+
+        WorkflowTask task = DbStructFactory.getWorkflowTask(rs, true);
+
+        if (task != null) {
+          task.setConditions(getConditionsByTaskId(task.getTaskId()));
+          task.setTaskConfig(getConfigurationByTaskId(task.getTaskId()));
+          tasks.add(task);
+        }
+      }
+
+      if (tasks.size() == 0) {
+        tasks = null;
+      }
+
+    } catch (Exception e) {
+      e.printStackTrace();
+      LOG.log(Level.WARNING,
+          "Exception getting tasks. Message: " + e.getMessage());
+      try {
+        conn.rollback();
+      } catch (SQLException e2) {
+        LOG.log(
+            Level.SEVERE,
+            "Unable to rollback getTasks 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 tasks;
+  }
+  
+  private boolean hasTaskId(List<WorkflowTask> tasks, String id) {
+    if (tasks == null || (tasks != null && tasks.size() == 0))
+      return false;
+
+    for (WorkflowTask task : tasks) {
+      if (task.getTaskId().equals(id)) {
+        return true;
+      }
+    }
+
+    return false;
+  }
+
+  private boolean hasConditionId(List<WorkflowCondition> conds, String id) {
+    if (conds == null || (conds != null && conds.size() == 0))
+      return false;
+
+    for (WorkflowCondition cond : conds) {
+      if (cond.getConditionId().equals(id)) {
+        return true;
+      }
+    }
+
+    return false;
+  }
 
 }

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=1156658&r1=1156657&r2=1156658&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
Thu Aug 11 16:07:29 2011
@@ -264,6 +264,59 @@ public class PackagedWorkflowRepository 
     return Arrays.asList(this.eventWorkflowMap.keySet().toArray());
   }
 
+  /*
+   * (non-Javadoc)
+   * 
+   * @see
+   * org.apache.oodt.cas.workflow.repository.WorkflowRepository#addWorkflow(
+   * org.apache.oodt.cas.workflow.structs.Workflow)
+   */
+  @Override
+  public String addWorkflow(Workflow workflow) throws RepositoryException {
+    // first check to see that its tasks are all present
+    if (workflow.getTasks() == null
+        || (workflow.getTasks() != null && workflow.getTasks().size() == 0)) {
+      throw new RepositoryException("Attempt to define a new worklfow: ["
+          + workflow.getName() + "] with no tasks.");
+    }
+
+    for (WorkflowTask task : (List<WorkflowTask>) workflow.getTasks()) {
+      if (!this.tasks.containsKey(task.getTaskId())) {
+        throw new RepositoryException("Reference in new workflow: ["
+            + workflow.getName() + "] to undefined task with id: ["
+            + task.getTaskId() + "]");
+      }
+
+      // check its conditions
+      if (task.getConditions() != null && task.getConditions().size() > 0) {
+        for (WorkflowCondition cond : (List<WorkflowCondition>) task
+            .getConditions()) {
+          if (!this.conditions.containsKey(cond.getConditionId())) {
+            throw new RepositoryException("Reference in new workflow: ["
+                + workflow.getName() + "] to undefined condition ith id: ["
+                + cond.getConditionId() + "]");
+          }
+        }
+      }
+    }
+
+    // recast it as a parent/child workflow
+    String workflowId = UUID.randomUUID().toString();
+    workflow.setId(workflowId);
+
+    Graph graph = new Graph();
+    graph.setExecutionType("sequential");
+    ParentChildWorkflow pcw = new ParentChildWorkflow(graph);
+    pcw.setName(workflow.getName());
+    pcw.setTasks(workflow.getTasks());
+    pcw.setId(workflow.getId());
+    this.workflows.put(pcw.getId(), pcw);    
+    this.eventWorkflowMap.put(workflowId, Collections.singletonList(pcw));
+
+    // generate its ID
+    return workflowId;
+  }
+
   private void init() throws RepositoryException {
     this.workflows = new HashMap<String, ParentChildWorkflow>();
     this.tasks = new HashMap<String, WorkflowTask>();
@@ -647,7 +700,7 @@ public class PackagedWorkflowRepository 
     private List<String> excused;
 
     private String clazz;
-    
+
     private long timeout;
 
     private Graph parent;
@@ -665,9 +718,9 @@ public class PackagedWorkflowRepository 
       this.alias = graphElem.getAttribute("alias");
       this.minReqSuccessfulSubProcessors = graphElem.getAttribute("min");
       this.executionType = graphElem.getAttribute("execution");
-      this.timeout = Long.valueOf(graphElem.getAttribute("timeout") != null 
-          && !graphElem.getAttribute("timeout").equals("") ? 
-              graphElem.getAttribute("timeout"):"-1");
+      this.timeout = Long.valueOf(graphElem.getAttribute("timeout") != null
+          && !graphElem.getAttribute("timeout").equals("") ? graphElem
+          .getAttribute("timeout") : "-1");
 
       NamedNodeMap attrMap = graphElem.getAttributes();
       for (int i = 0; i < attrMap.getLength(); i++) {
@@ -924,7 +977,8 @@ public class PackagedWorkflowRepository 
     }
 
     /**
-     * @param timeout the timeout to set
+     * @param timeout
+     *          the timeout to set
      */
     public void setTimeout(long timeout) {
       this.timeout = timeout;
@@ -947,7 +1001,7 @@ public class PackagedWorkflowRepository 
       buf.append(",name=");
       buf.append(this.getName());
       buf.append(",parent=");
-      buf.append(this.graph.parent != null ? this.graph.parent.modelId:null);
+      buf.append(this.graph.parent != null ? this.graph.parent.modelId : null);
       buf.append(",children=");
       buf.append(this.graph.children);
       buf.append(",executionType=");

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=1156658&r1=1156657&r2=1156658&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
Thu Aug 11 16:07:29 2011
@@ -207,5 +207,16 @@ public interface WorkflowRepository {
 	 *             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;
 
 }

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=1156658&r1=1156657&r2=1156658&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
Thu Aug 11 16:07:29 2011
@@ -29,9 +29,11 @@ import org.apache.oodt.cas.workflow.stru
 //JDK imports
 import java.util.logging.Level;
 import java.util.logging.Logger;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Set;
+import java.util.UUID;
 import java.util.Vector;
 import java.util.Iterator;
 import java.util.Arrays;
@@ -257,6 +259,40 @@ public class XMLWorkflowRepository imple
         WorkflowTask task = (WorkflowTask) taskMap.get(taskId);
         return task.getTaskConfig();
     }
+    
+
+    /* (non-Javadoc)
+     * @see org.apache.oodt.cas.workflow.repository.WorkflowRepository#addWorkflow(org.apache.oodt.cas.workflow.structs.Workflow)
+     */
+    @Override
+    public String addWorkflow(Workflow workflow) throws RepositoryException {
+       // first check to see that its tasks are all present
+      if(workflow.getTasks() == null || (workflow.getTasks() != null && workflow.getTasks().size()
== 0)){
+        throw new RepositoryException("Attempt to define a new worklfow: ["+workflow.getName()+"]
with no tasks.");
+      }
+      
+      for(WorkflowTask task: (List<WorkflowTask>)workflow.getTasks()){
+        if(!this.taskMap.containsKey(task.getTaskId())){
+          throw new RepositoryException("Reference in new workflow: ["+workflow.getName()+"]
to undefined task with id: ["+task.getTaskId()+"]");
+        }
+        
+        // check its conditions
+        if(task.getConditions() != null && task.getConditions().size() > 0){
+          for(WorkflowCondition cond: (List<WorkflowCondition>)task.getConditions()){
+            if(!this.conditionMap.containsKey(cond.getConditionId())){
+              throw new RepositoryException("Reference in new workflow: ["+workflow.getName()+"]
to undefined condition ith id: ["+cond.getConditionId()+"]");
+            }
+          }
+        }
+      }
+      
+      // generate its ID
+      String workflowId = UUID.randomUUID().toString();
+      workflow.setId(workflowId);
+      this.workflowMap.put(workflowId, workflow);
+      this.eventMap.put(workflowId, Collections.singletonList(workflow));
+      return workflowId;
+    }    
 
     /**
      * @param args
@@ -600,4 +636,5 @@ public class XMLWorkflowRepository imple
         return document;
     }
 
+
 }

Modified: oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/system/XmlRpcWorkflowManager.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/system/XmlRpcWorkflowManager.java?rev=1156658&r1=1156657&r2=1156658&view=diff
==============================================================================
--- oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/system/XmlRpcWorkflowManager.java
(original)
+++ oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/system/XmlRpcWorkflowManager.java
Thu Aug 11 16:07:29 2011
@@ -49,6 +49,7 @@ import java.util.logging.Logger;
 import java.util.Hashtable;
 import java.util.Iterator;
 import java.util.List;
+import java.util.UUID;
 import java.util.Vector;
 
 /**
@@ -147,6 +148,32 @@ public class XmlRpcWorkflowManager {
 
     }
 
+  public String executeDynamicWorkflow(Vector<String> taskIds, Hashtable metadata)
+      throws RepositoryException, EngineException {
+    if (taskIds == null || (taskIds != null && taskIds.size() == 0))
+      throw new RepositoryException(
+          "Must specify task identifiers to build dynamic workflows!");
+
+    Workflow dynamicWorkflow = new Workflow();
+
+    for (String taskId : taskIds) {
+      WorkflowTask task = this.repo.getWorkflowTaskById(taskId);
+      if (task == null)
+        throw new RepositoryException("Dynamic workflow task: [" + taskId
+            + "] is not defined!");
+      dynamicWorkflow.getTasks().add(task);
+    }
+    
+    dynamicWorkflow.setId(this.repo.addWorkflow(dynamicWorkflow));
+    dynamicWorkflow.setName("Dynamic Workflow-" + dynamicWorkflow.getId());
+
+    Metadata met = new Metadata();
+    met.addMetadata(metadata);
+
+    WorkflowInstance inst = this.engine.startWorkflow(dynamicWorkflow, met);
+    return inst.getId();
+  }
+
     public Vector getRegisteredEvents() throws RepositoryException {
 
         List events = null;

Modified: oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/system/XmlRpcWorkflowManagerClient.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/system/XmlRpcWorkflowManagerClient.java?rev=1156658&r1=1156657&r2=1156658&view=diff
==============================================================================
--- oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/system/XmlRpcWorkflowManagerClient.java
(original)
+++ oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/system/XmlRpcWorkflowManagerClient.java
Thu Aug 11 16:07:29 2011
@@ -77,6 +77,30 @@ public class XmlRpcWorkflowManagerClient
         client = new XmlRpcClient(url);
         workflowManagerUrl = url;
     }
+    
+  public String executeDynamicWorkflow(List<String> taskIds, Metadata metadata)
+      throws Exception {
+    Vector argList = new Vector();
+    Vector<String> taskIdVector = new Vector<String>();
+    taskIdVector.addAll(taskIds);
+    String instId = null;
+    
+    argList.add(taskIdVector);
+    argList.add(metadata.getHashtable());
+
+    try {
+      instId = (String) client.execute("workflowmgr.executeDynamicWorkflow",
+          argList);
+    } catch (XmlRpcException e) {
+      e.printStackTrace();
+      throw new Exception(e.getMessage());
+    } catch (IOException e) {
+      throw new Exception(e.getMessage());
+    }
+
+    return instId;
+
+  }
 
     public List getRegisteredEvents() throws Exception {
         Vector argList = new Vector();
@@ -657,6 +681,7 @@ public class XmlRpcWorkflowManagerClient
             EngineException, RepositoryException {
 
         String sendEventOperation = "--sendEvent --eventName <name> [--metaData --key
<key1> <val1> <val2>...<valn>...--keyn <keyn> <val1> <val2>...<valn>]\n";
+        String dynWorkflowOperation = "--dynWorkflow --taskIds <task id1> <task
id2>...<task idn> [--metaData --key <key1> <val1> <val2>...<valn>...--keyn
<keyn> <val1> <val2>...<valn>]\n";
         String getWorkflowInstOperation = "--getWorkflowInsts\n";
         String getWorkflowsOperation = "--getWorkflows\n";
         String getTaskByIdOperation = "--getTaskById --id <taskId>\n";
@@ -678,6 +703,7 @@ public class XmlRpcWorkflowManagerClient
         String usage = "wmgr-client --url <url to xml rpc service> --operation [<operation>
[params]]\n"
                 + "operations:\n"
                 + sendEventOperation
+                + dynWorkflowOperation
                 + getWorkflowInstOperation
                 + getWorkflowsOperation
                 + getTaskByIdOperation
@@ -766,7 +792,71 @@ public class XmlRpcWorkflowManagerClient
                 throw new RuntimeException(e);
             }
 
-        } else if (operation.equals("--getWorkflowInsts")) {
+        }
+        
+        else if(operation.equals("--dynWorkflow")){
+          Metadata metadata = new Metadata();
+          List<String> taskIds = new Vector<String>();
+
+          for (int i = 4; i < args.length; i++) {
+              if (args[i].equals("--taskIds")) {
+                int j = -1;
+                  for(j = i+1; j < args.length; j++){
+                     
+                     if(!args[j].equals("--metaData")){
+                       System.out.println("Picked up task id: ["+args[j]+"]");
+                       taskIds.add(args[j]);
+                     }
+                     else{
+                       break;
+                     }
+                  }
+                  
+                  i = j-1;
+              } else if (args[i].equals("--metaData")) {
+                  for (int j = i + 1; j < args.length; j++) {
+
+                      if (args[j].equals("--key")) {
+                          String key = args[++j];
+                          List values = new Vector();
+
+                          boolean endOfList = true;
+                          for (j++; j < args.length; j++) {
+                              if (!args[j].equals("--key")) {
+                                  values.add(args[j]);
+                              } else {
+                                  endOfList = false;
+                                  break;
+                              }
+                          }
+
+                          if (!endOfList) {
+                              j--;
+                          }
+
+                          System.out.println("Picked up metadata: [key="
+                                  + key + ", values=" + values + "]");
+                          metadata.addMetadata(key, values);
+
+                      }
+                  }
+                  break;
+              }
+          }
+
+          // create the client
+          XmlRpcWorkflowManagerClient client = new XmlRpcWorkflowManagerClient(
+                  new URL(url));
+
+          try {
+              System.out.println(client.executeDynamicWorkflow(taskIds, metadata));
+          } catch (Exception e) {
+              e.printStackTrace();
+              throw new RuntimeException(e);
+          }
+          
+        }
+        else if (operation.equals("--getWorkflowInsts")) {
             XmlRpcWorkflowManagerClient client = new XmlRpcWorkflowManagerClient(
                     new URL(url));
 



Mime
View raw message