oodt-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bfos...@apache.org
Subject svn commit: r1369914 - in /oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow: engine/ system/ util/
Date Mon, 06 Aug 2012 18:31:54 GMT
Author: bfoster
Date: Mon Aug  6 18:31:53 2012
New Revision: 1369914

URL: http://svn.apache.org/viewvc?rev=1369914&view=rev
Log:
- Fixed: EngineRunnerFactory introduction and Java property cleanup

------------
OODT-310

Added:
    oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/EngineRunnerFactory.java   (with props)
    oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/ResourceRunnerFactory.java   (with props)
Modified:
    oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/EngineRunner.java
    oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/PrioritizedQueueBasedWorkflowEngine.java
    oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/ThreadPoolWorkflowEngine.java
    oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/ThreadPoolWorkflowEngineFactory.java
    oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/WorkflowEngine.java
    oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/WorkflowEngineFactory.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/util/GenericWorkflowObjectFactory.java

Modified: oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/EngineRunner.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/EngineRunner.java?rev=1369914&r1=1369913&r2=1369914&view=diff
==============================================================================
--- oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/EngineRunner.java (original)
+++ oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/EngineRunner.java Mon Aug  6 18:31:53 2012
@@ -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.
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.oodt.cas.workflow.engine;
 
 //OODT imports
@@ -22,14 +21,14 @@ import org.apache.oodt.cas.metadata.Meta
 import org.apache.oodt.cas.workflow.structs.WorkflowTask;
 
 /**
- * 
+ *
  * Obfuscates the underlying substrate on which a {@link WorkflowTask} should
  * run. In short, executes a {@link WorkflowTask} for the Workflow Engine.
- * 
+ *
  * @author bfoster
  * @author mattmann
  * @version $Revision$
- * 
+ *
  */
 public abstract class EngineRunner {
 
@@ -37,12 +36,12 @@ public abstract class EngineRunner {
    * Executes a {@link WorkflowTask} on an execution substrate. Ideally there
    * will only ever be two of these substrates, one for local execution, and
    * another for communication with the Resource Manager.
-   * 
+   *
    * @param workflowTask
    *          The model of the {@link WorkflowTask} to instantiate and execute.
    * @param dynMetadata
    *          The dynamic {@link Metadata} passed to this {@link WorkflowTask}.
-   * 
+   *
    * @throws Exception
    *           If any error occurs.
    */
@@ -51,10 +50,10 @@ public abstract class EngineRunner {
 
   /**
    * Shuts this runner down and frees its resources.
-   * 
+   *
    * @throws Exception
    *           If any error occurs while freeing resources.
-   * 
+   *
    */
   public abstract void shutdown() throws Exception;
   

Added: oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/EngineRunnerFactory.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/EngineRunnerFactory.java?rev=1369914&view=auto
==============================================================================
--- oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/EngineRunnerFactory.java (added)
+++ oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/EngineRunnerFactory.java Mon Aug  6 18:31:53 2012
@@ -0,0 +1,27 @@
+/*
+ * 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.engine;
+
+/**
+ * Factory which creates {@link EngineRunner}s.
+ *
+ * @author bfoster (Brian Foster)
+ */
+public interface EngineRunnerFactory {
+
+   public EngineRunner createEngineRunner();
+}

Propchange: oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/EngineRunnerFactory.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/PrioritizedQueueBasedWorkflowEngine.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/PrioritizedQueueBasedWorkflowEngine.java?rev=1369914&r1=1369913&r2=1369914&view=diff
==============================================================================
--- oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/PrioritizedQueueBasedWorkflowEngine.java (original)
+++ oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/PrioritizedQueueBasedWorkflowEngine.java Mon Aug  6 18:31:53 2012
@@ -39,32 +39,33 @@ import org.apache.oodt.cas.workflow.stru
 import org.apache.oodt.commons.util.DateConvert;
 
 /**
- * 
+ *
  * Describe your class here.
  * @author mattmann
  * @author bfoster
  * @version $Revision$
- * 
+ *
  */
 public class PrioritizedQueueBasedWorkflowEngine implements WorkflowEngine {
 
-  
+
   private static final Logger LOG = Logger.getLogger(PrioritizedQueueBasedWorkflowEngine.class.getName());
-  
+
   //private Map<String, WorkflowPro> processorQueue;
-  private List<WorkflowProcessor> runnableTasks;
-  private Map<String, WorkflowProcessor> executingTasks;
+  private final List<WorkflowProcessor> runnableTasks;
+  private final Map<String, WorkflowProcessor> executingTasks;
   //private WorkflowProcessorLock processorLock;
   private List<String> metadataKeysToCache;
   private boolean debugMode;
-  private boolean allowQueuerToWork;  
-  private Thread queuerThread;
-  private WorkflowInstanceRepository repo;  
-  private PrioritySorter prioritizer;
+  private final boolean allowQueuerToWork;
+  private final Thread queuerThread;
+  private final WorkflowInstanceRepository repo;
+  private final PrioritySorter prioritizer;
   private WorkflowProcessorQueue processorQueue;
-  private URL wmgrUrl;  
-  private long conditionWait;
-  
+  private final URL wmgrUrl;
+  private final long conditionWait;
+  private EngineRunner runner;
+
   public PrioritizedQueueBasedWorkflowEngine(WorkflowInstanceRepository repo, PrioritySorter prioritizer, long conditionWait){
     this.repo = repo;
     this.prioritizer = prioritizer != null ? new HighestFIFOPrioritySorter(1, 50, 1/*secondsBetweenBoosts, boostAmount, boostCap*/):
@@ -77,20 +78,24 @@ public class PrioritizedQueueBasedWorkfl
     //this.processorLock = new WorkflowProcessorLock();
     if (metadataKeysToCache != null)
       this.metadataKeysToCache = new Vector<String>(metadataKeysToCache);
-    this.debugMode = debugMode;
+//    this.debugMode = debugMode;
     this.allowQueuerToWork = true;
-    
+
    /* try {
       this.loadProcessorRepo();
     }catch (Exception e) {
       e.printStackTrace();
     }*/
-    
+
     // Task QUEUER thread
     queuerThread = new Thread(new TaskQuerier(processorQueue, prioritizer));
     queuerThread.start();
   }
-  
+
+  @Override
+  public void setEngineRunner(EngineRunner runner) {
+     this.runner = runner;
+  }
 
   /* (non-Javadoc)
    * @see org.apache.oodt.cas.workflow.engine.WorkflowEngine#startWorkflow(org.apache.oodt.cas.workflow.structs.Workflow, org.apache.oodt.cas.metadata.Metadata)
@@ -108,7 +113,7 @@ public class PrioritizedQueueBasedWorkfl
   @Override
   public void stopWorkflow(String workflowInstId) {
     // TODO Auto-generated method stub
-    
+
   }
 
   /* (non-Javadoc)
@@ -117,7 +122,7 @@ public class PrioritizedQueueBasedWorkfl
   @Override
   public void pauseWorkflowInstance(String workflowInstId) {
     // TODO Auto-generated method stub
-    
+
   }
 
   /* (non-Javadoc)
@@ -126,7 +131,7 @@ public class PrioritizedQueueBasedWorkfl
   @Override
   public void resumeWorkflowInstance(String workflowInstId) {
     // TODO Auto-generated method stub
-    
+
   }
 
   /* (non-Javadoc)
@@ -153,7 +158,7 @@ public class PrioritizedQueueBasedWorkfl
   @Override
   public void setWorkflowManagerUrl(URL url) {
     // TODO Auto-generated method stub
-    
+
   }
 
   /* (non-Javadoc)
@@ -182,7 +187,7 @@ public class PrioritizedQueueBasedWorkfl
     // TODO Auto-generated method stub
     return null;
   }
-    
+
 
    //FIXME: add in methods from WEngine
 

Added: oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/ResourceRunnerFactory.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/ResourceRunnerFactory.java?rev=1369914&view=auto
==============================================================================
--- oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/ResourceRunnerFactory.java (added)
+++ oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/ResourceRunnerFactory.java Mon Aug  6 18:31:53 2012
@@ -0,0 +1,61 @@
+/*
+ * 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.engine;
+
+//JDK imports
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+//Google imports
+import com.google.common.base.Preconditions;
+
+/**
+ * Factory which creates {@link ResourceRunner}s.
+ *
+ * @author bfoster (Brian Foster)
+ */
+public class ResourceRunnerFactory implements EngineRunnerFactory{
+
+   private static final Logger LOG = Logger.getLogger(ResourceRunnerFactory.class.getName());
+
+   private static final String RESOURCE_MANAGER_URL_PROPERTY = "org.apache.oodt.cas.workflow.engine.resourcemgr.url";
+
+   private String resUrl;
+
+   public ResourceRunnerFactory() {
+      resUrl = System.getProperty(RESOURCE_MANAGER_URL_PROPERTY);
+   }
+
+   @Override
+   public ResourceRunner createEngineRunner() {
+      try {
+         Preconditions.checkNotNull(resUrl,
+               "Must specify Resource Manager URL [property = "
+                     + RESOURCE_MANAGER_URL_PROPERTY + "]");
+         return new ResourceRunner(new URL(resUrl));
+      } catch (MalformedURLException e) {
+         LOG.log(Level.SEVERE, "Failed to load ResourceRunner : " + e.getMessage(), e);
+         return null;
+      }
+   }
+
+   public void setResourceManagerUrl(String resUrl) {
+      this.resUrl = resUrl;
+   }
+}

Propchange: oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/ResourceRunnerFactory.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/ThreadPoolWorkflowEngine.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/ThreadPoolWorkflowEngine.java?rev=1369914&r1=1369913&r2=1369914&view=diff
==============================================================================
--- oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/ThreadPoolWorkflowEngine.java (original)
+++ oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/ThreadPoolWorkflowEngine.java Mon Aug  6 18:31:53 2012
@@ -46,14 +46,14 @@ import EDU.oswego.cs.dl.util.concurrent.
 import EDU.oswego.cs.dl.util.concurrent.ThreadedExecutor;
 
 /**
- * 
+ *
  * The ThreadPooling portion of the WorkflowEngine. This class is meant to be an
  * extension point for WorkflowEngines that want to implement ThreadPooling.
  * This WorkflowEngine provides everything needed to manage a ThreadPool using
  * Doug Lea's wonderful java.util.concurrent package that made it into JDK5.
- * 
+ *
  * @author mattmann
- * 
+ *
  */
 public class ThreadPoolWorkflowEngine implements WorkflowEngine, WorkflowStatus {
 
@@ -71,12 +71,12 @@ public class ThreadPoolWorkflowEngine im
   private WorkflowInstanceRepository instRep = null;
 
   /* the URL pointer to the parent Workflow Manager */
-  private URL wmgrUrl = null;
+  private final URL wmgrUrl = null;
 
   /* how long to wait before checking whether a condition is satisfied. */
-  private long conditionWait;
+  private final long conditionWait;
 
-  private ConditionProcessor condProcessor;
+  private final ConditionProcessor condProcessor;
 
   private EngineRunner runner;
 
@@ -84,7 +84,7 @@ public class ThreadPoolWorkflowEngine im
 
   /**
    * Default Constructor.
-   * 
+   *
    * @param instRep
    *          The WorkflowInstanceRepository to be used by this engine.
    * @param queueSize
@@ -100,17 +100,13 @@ public class ThreadPoolWorkflowEngine im
    * @param unlimitedQueue
    *          Whether or not to use a queue whose bounds are dictated by the
    *          physical memory of the underlying hardware.
-   * @param resUrl
-   *          A URL pointer to a resource manager. If this is set Tasks will be
-   *          wrapped as Resource Manager {@link Job}s and sent through the
-   *          Resource Manager. If this parameter is not set, local execution
-   *          (the default) will be used
    */
   public ThreadPoolWorkflowEngine(WorkflowInstanceRepository instRep,
       int queueSize, int maxPoolSize, int minPoolSize,
-      long threadKeepAliveTime, boolean unlimitedQueue, URL resUrl) {
+      long threadKeepAliveTime, boolean unlimitedQueue) {
 
     this.instRep = instRep;
+
     Channel c = null;
     if (unlimitedQueue) {
       c = new LinkedQueue();
@@ -124,12 +120,6 @@ public class ThreadPoolWorkflowEngine im
 
     workerMap = new HashMap();
 
-    if (resUrl != null) {
-      this.runner = new ResourceRunner(resUrl);
-    } else {
-      this.runner = new AsynchronousLocalEngineRunner();
-    }
-
     this.conditionWait = Long.getLong(
         "org.apache.oodt.cas.workflow.engine.preConditionWaitTime", 10)
         .longValue();
@@ -137,9 +127,14 @@ public class ThreadPoolWorkflowEngine im
     this.condProcessor = new ConditionProcessor(lifecycleManager);
   }
 
+  @Override
+  public void setEngineRunner(EngineRunner runner) {
+     this.runner = runner;
+  }
+
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see
    * org.apache.oodt.cas.workflow.engine.WorkflowEngine#startWorkflow(org.apache
    * .oodt.cas.workflow.structs.Workflow, org.apache.oodt.cas.metadata.Metadata)
@@ -155,7 +150,7 @@ public class ThreadPoolWorkflowEngine im
 
     WorkflowInstance wInst = new WorkflowInstance();
     wInst.setWorkflow(workflow);
-    wInst.setCurrentTaskId(((WorkflowTask) workflow.getTasks().get(0))
+    wInst.setCurrentTaskId((workflow.getTasks().get(0))
         .getTaskId());
     wInst.setSharedContext(metadata);
     wInst.setStatus(CREATED);
@@ -178,7 +173,7 @@ public class ThreadPoolWorkflowEngine im
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see
    * org.apache.oodt.cas.workflow.engine.WorkflowEngine#stopWorkflow(java.lang
    * .String)
@@ -191,7 +186,7 @@ public class ThreadPoolWorkflowEngine im
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see
    * org.apache.oodt.cas.workflow.engine.WorkflowEngine#pauseWorkflowInstance
    * (java.lang.String)
@@ -204,7 +199,7 @@ public class ThreadPoolWorkflowEngine im
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see
    * org.apache.oodt.cas.workflow.engine.WorkflowEngine#resumeWorkflowInstance
    * (java.lang.String)
@@ -217,7 +212,7 @@ public class ThreadPoolWorkflowEngine im
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see
    * org.apache.oodt.cas.workflow.engine.WorkflowEngine#getInstanceRepository()
    */
@@ -228,7 +223,7 @@ public class ThreadPoolWorkflowEngine im
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see
    * org.apache.oodt.cas.workflow.engine.WorkflowEngine#updateMetadata(java.
    * lang.String, org.apache.oodt.cas.metadata.Metadata)
@@ -241,7 +236,7 @@ public class ThreadPoolWorkflowEngine im
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see
    * org.apache.oodt.cas.workflow.engine.WorkflowEngine#setWorkflowManagerUrl
    * (java.net.URL)
@@ -254,7 +249,7 @@ public class ThreadPoolWorkflowEngine im
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see
    * org.apache.oodt.cas.workflow.engine.WorkflowEngine#getWallClockMinutes(
    * java.lang.String)
@@ -267,7 +262,7 @@ public class ThreadPoolWorkflowEngine im
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see org.apache.oodt.cas.workflow.engine.WorkflowEngine#
    * getCurrentTaskWallClockMinutes(java.lang.String)
    */
@@ -279,7 +274,7 @@ public class ThreadPoolWorkflowEngine im
 
   /*
    * (non-Javadoc)
-   * 
+   *
    * @see
    * org.apache.oodt.cas.workflow.engine.WorkflowEngine#getWorkflowInstanceMetadata
    * (java.lang.String)

Modified: oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/ThreadPoolWorkflowEngineFactory.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/ThreadPoolWorkflowEngineFactory.java?rev=1369914&r1=1369913&r2=1369914&view=diff
==============================================================================
--- oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/ThreadPoolWorkflowEngineFactory.java (original)
+++ oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/ThreadPoolWorkflowEngineFactory.java Mon Aug  6 18:31:53 2012
@@ -14,106 +14,70 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
-
 package org.apache.oodt.cas.workflow.engine;
 
-//OODT imports
-import java.net.MalformedURLException;
-import java.net.URL;
+//JDK static imports
+import static java.lang.Boolean.getBoolean;
+import static java.lang.Integer.getInteger;
+import static java.lang.Long.getLong;
 
-import org.apache.oodt.cas.metadata.util.PathUtils;
+//OODT imports
 import org.apache.oodt.cas.workflow.instrepo.WorkflowInstanceRepository;
 import org.apache.oodt.cas.workflow.util.GenericWorkflowObjectFactory;
 
 /**
- * @author mattmann
- * @version $Revision$
- * 
- * <p>
  * A Factory class for creating {@link ThreadPoolWorkflowEngine}s.
- * </p>.
+ *
+ * @author mattmann (Chris Mattmann)
+ * @author bfoster (Brian Foster)
  */
 public class ThreadPoolWorkflowEngineFactory implements WorkflowEngineFactory {
 
-	/* default queue size */
-	private int queueSize = -1;
-
-	/* default max pool size */
-	private int maxPoolSize = -1;
-
-	/* the min pool size */
-	private int minPoolSize = -1;
-
-	/*
-	 * the amount of minutes to keep each worker thread alive
-	 */
-	private long threadKeepAliveTime = -1L;
-
-	/*
-	 * whether or not an unlimited queue of worker threads should be allowed
-	 */
-	private boolean unlimitedQueue = false;
-	
-	/* the workflow instance repository */
-	private WorkflowInstanceRepository workflowInstRep = null;
-
- /* res mgr url */
- private URL resMgrUrl = null;
-
-	public ThreadPoolWorkflowEngineFactory() throws InstantiationException{
-		// need to get the values for some of the default thread pool values
-		queueSize = Integer.getInteger(
-				"org.apache.oodt.cas.workflow.engine.queueSize", 10)
-				.intValue();
-		maxPoolSize = Integer.getInteger(
-				"org.apache.oodt.cas.workflow.engine.maxPoolSize", 10)
-				.intValue();
-		minPoolSize = Integer.getInteger(
-				"org.apache.oodt.cas.workflow.engine.minPoolSize", 4)
-				.intValue();
-		threadKeepAliveTime = Long
-				.getLong(
-						"org.apache.oodt.cas.workflow.engine.threadKeepAlive.minutes",
-						5).longValue();
-		unlimitedQueue = Boolean
-				.getBoolean("org.apache.oodt.cas.workflow.engine.unlimitedQueue");
-		
-		String instRepClazzName = System
-				.getProperty("workflow.engine.instanceRep.factory");
-		if (instRepClazzName == null) {
-			throw new InstantiationException(
-					"instance repository factory not specified in workflow properties: failing!");
-		}
-
-    this.workflowInstRep = GenericWorkflowObjectFactory
-        .getWorkflowInstanceRepositoryFromClassName(instRepClazzName);
-
-    // see if we are using a resource manager or not
-    String resMgrUrlStr = System
-        .getProperty("org.apache.oodt.cas.workflow.engine.resourcemgr.url");
-    if (resMgrUrlStr != null) {
-      resMgrUrlStr = PathUtils.replaceEnvVariables(resMgrUrlStr);
-      resMgrUrl = safeGetUrlFromString(resMgrUrlStr);
-    }
-  }
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see org.apache.oodt.cas.workflow.engine.WorkflowEngineFactory#createWorkflowEngine()
-	 */
-	public WorkflowEngine createWorkflowEngine() {
-		return new ThreadPoolWorkflowEngine(workflowInstRep, queueSize, maxPoolSize,
-				minPoolSize, threadKeepAliveTime, unlimitedQueue, resMgrUrl);
-	}
-
- private URL safeGetUrlFromString(String urlStr) {
-    try {
-      return new URL(urlStr);
-    } catch (MalformedURLException e) {
-      return null;
-    }
-  }
-
+   private static final String INSTANCE_REPO_FACTORY_PROPERTY = "workflow.engine.instanceRep.factory";
+   private static final String QUEUE_SIZE_PROPERTY = "org.apache.oodt.cas.workflow.engine.queueSize";
+   private static final String MAX_POOL_SIZE_PROPERTY = "org.apache.oodt.cas.workflow.engine.maxPoolSize";
+   private static final String MIN_POOL_SIZE_PROPERTY = "org.apache.oodt.cas.workflow.engine.minPoolSize";
+   private static final String THREAD_KEEP_ALIVE_PROPERTY = "org.apache.oodt.cas.workflow.engine.threadKeepAlive.minutes";
+   private static final String UNLIMITED_QUEUE_PROPERTY = "org.apache.oodt.cas.workflow.engine.unlimitedQueue";
+
+   private static final int DEFAULT_QUEUE_SIZE = 10;
+   private static final int DEFAULT_MAX_POOL_SIZE = 10;
+   private static final int DEFAULT_MIN_POOL_SIZE = 4;
+   private static final long DEFAULT_THREAD_KEEP_ALIVE_MINS = 5;
+
+   @Override
+   public WorkflowEngine createWorkflowEngine() {
+      return new ThreadPoolWorkflowEngine(getWorkflowInstanceRepository(),
+                                          getQueueSize(),
+                                          getMaxPoolSize(),
+                                          getMinPoolSize(),
+                                          getThreadKeepAliveMinutes(),
+                                          isUnlimitedQueue());
+   }
+
+   protected WorkflowInstanceRepository getWorkflowInstanceRepository() {
+      return GenericWorkflowObjectFactory
+            .getWorkflowInstanceRepositoryFromClassName(System
+                  .getProperty(INSTANCE_REPO_FACTORY_PROPERTY));
+   }
+
+   protected int getQueueSize() {
+      return getInteger(QUEUE_SIZE_PROPERTY, DEFAULT_QUEUE_SIZE);
+   }
+
+   protected int getMaxPoolSize() {
+      return getInteger(MAX_POOL_SIZE_PROPERTY, DEFAULT_MAX_POOL_SIZE);
+   }
+
+   protected int getMinPoolSize() {
+      return getInteger(MIN_POOL_SIZE_PROPERTY, DEFAULT_MIN_POOL_SIZE);
+   }
+
+   protected long getThreadKeepAliveMinutes() {
+      return getLong(THREAD_KEEP_ALIVE_PROPERTY, DEFAULT_THREAD_KEEP_ALIVE_MINS);
+   }
+
+   protected boolean isUnlimitedQueue() {
+      return getBoolean(UNLIMITED_QUEUE_PROPERTY);
+   }
 }

Modified: oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/WorkflowEngine.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/WorkflowEngine.java?rev=1369914&r1=1369913&r2=1369914&view=diff
==============================================================================
--- oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/WorkflowEngine.java (original)
+++ oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/WorkflowEngine.java Mon Aug  6 18:31:53 2012
@@ -14,13 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
-
 package org.apache.oodt.cas.workflow.engine;
 
-//OODT imports
+//JDK imports
 import java.net.URL;
 
+//OODT imports
 import org.apache.oodt.cas.workflow.instrepo.WorkflowInstanceRepository;
 import org.apache.oodt.cas.workflow.structs.exceptions.EngineException;
 import org.apache.oodt.cas.workflow.structs.Workflow;
@@ -28,21 +27,22 @@ import org.apache.oodt.cas.workflow.stru
 import org.apache.oodt.cas.metadata.Metadata;
 
 /**
- * @author mattmann
- * @version $Revision$
- * 
- * <p>
  * The engine that executes and monitors {@link WorkflowInstance}s, which are
  * the physical executing representation of the abtract {@link Workflow}s
  * provided.
- * </p>
- * 
+ *
+ * @author mattmann (Chris Mattmann)
  */
 public interface WorkflowEngine {
 
     public static final String X_POINT_ID = WorkflowEngine.class.getName();
 
     /**
+     * @param runner The Runner to use when executing TaskInstances.
+     */
+    public void setEngineRunner(EngineRunner runner);
+
+    /**
      * <p>
      * Starts the specified {@link Workflow} by creating a
      * {@link WorkflowInstance}, and then running that instance. The started
@@ -50,7 +50,7 @@ public interface WorkflowEngine {
      * by the workflow engine, including its status field, and its
      * currentTaskId.
      * </p>
-     * 
+     *
      * @param workflow
      *            The abstract representation of the {@link Workflow} to start.
      * @param metadata
@@ -67,7 +67,7 @@ public interface WorkflowEngine {
     /**
      * Stops the {@link WorkflowInstance} identified by the given
      * <code>workflowInstId</code>.
-     * 
+     *
      * @param workflowInstId
      *            The identifier of the {@link WorkflowInstance} to stop.
      */
@@ -78,7 +78,7 @@ public interface WorkflowEngine {
      * Pauses the {@link WorkflowInstance} specified by its
      * <code>workflowInstId</code>.
      * </p>
-     * 
+     *
      * @param workflowInstId
      *            The ID of the Workflow Instance to pause.
      */
@@ -89,7 +89,7 @@ public interface WorkflowEngine {
      * Resumes Execution of the specified {@link WorkflowInstance} identified by
      * its <code>workflowInstId</code>.
      * </p>
-     * 
+     *
      * @param workflowInstId
      *            The ID of the {@link WorkflowInstance} to resume.
      */
@@ -98,7 +98,7 @@ public interface WorkflowEngine {
     /**
      * Gets the {@link WorkflowInstanceRepository} used by this
      * {@link WorkflowEngine}.
-     * 
+     *
      * @return The {@link WorkflowInstanceRepository} used by this
      *         {@link WorkflowEngine}.
      */
@@ -107,7 +107,7 @@ public interface WorkflowEngine {
     /**
      * Updates the {@link Metadata} context for the {@link WorkflowInstance}
      * identified by the given <code>workflowInstId</code>
-     * 
+     *
      * @param workflowInstId
      *            Identifies the {@link WorkflowInstance} whose {@link Metadata}
      *            context will be updated.
@@ -120,7 +120,7 @@ public interface WorkflowEngine {
     /**
      * Sets a pointer to the Workflow Manager that this {@link WorkflowEngine}
      * belongs to.
-     * 
+     *
      * @param url
      *            The {@link URL} pointer to the Workflow Manager that this
      *            {@link WorkflowEngine} belongs to.
@@ -132,11 +132,11 @@ public interface WorkflowEngine {
      * {@link WorkflowInstance} (identified by its <code>workflowInst</code>)
      * has been executing. This includes time spent <code>QUEUED</code>, time
      * spent <code>WAITING</code>, throughout its entire lifecycle.
-     * 
+     *
      * @param workflowInstId
      *            The identifier of the {@link WorkflowInstance} to measure wall
      *            clock time for.
-     * 
+     *
      * @return The amount of wall clock minutes that a particular
      *         {@link WorkflowInstance} has been executing for.
      */
@@ -146,7 +146,7 @@ public interface WorkflowEngine {
      * Gets the amount of wall clock minutes that the particular
      * {@link WorkflowTask} within a {@link WorkflowInstance} has been executing
      * for.
-     * 
+     *
      * @param workflowInstId
      *            The identifier of the {@link WorkflowInstance} to measure wall
      *            clock time for its current {@link WorkflowTask}.
@@ -159,13 +159,13 @@ public interface WorkflowEngine {
     /**
      * Gets the {@link Metadata} associated with the {@link WorkflowInstance}
      * identified by the given identifier.
-     * 
+     *
      * @param workflowInstId
      *            The identifier of the {@link WorkflowInstance} to obtain the
      *            {@link Metadata} for.
      * @return The {@link Metadata} shared context of the
      *         {@link WorkflowInstance} with the given identifier.
-     * 
+     *
      */
     public Metadata getWorkflowInstanceMetadata(String workflowInstId);
 

Modified: oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/WorkflowEngineFactory.java
URL: http://svn.apache.org/viewvc/oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/WorkflowEngineFactory.java?rev=1369914&r1=1369913&r2=1369914&view=diff
==============================================================================
--- oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/WorkflowEngineFactory.java (original)
+++ oodt/trunk/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/WorkflowEngineFactory.java Mon Aug  6 18:31:53 2012
@@ -14,23 +14,20 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
-
 package org.apache.oodt.cas.workflow.engine;
 
 /**
- * @author mattmann
- * @version $Revision$
- * 
- * <p>
  * A factory interface for creating {@link WorkflowEngine} objects.
- * </p>
- * 
+ *
+ * @author mattmann (Chris Mattmann)
+ * @author bfoster (Brian Foster)
  */
 public interface WorkflowEngineFactory {
 
-    /**
-     * @return An implementation of the {@link WorkflowEngine} interface.
-     */
-    public WorkflowEngine createWorkflowEngine();
+   /**
+    * Method which creates {@link WorkflowEngine}s.
+    *
+    * @return An implementation of the {@link WorkflowEngine} interface
+    */
+   public WorkflowEngine createWorkflowEngine();
 }

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=1369914&r1=1369913&r2=1369914&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 Mon Aug  6 18:31:53 2012
@@ -14,19 +14,24 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
-
 package org.apache.oodt.cas.workflow.system;
 
-//APACHE imports
+//OODT static imports
+import static org.apache.oodt.cas.workflow.util.GenericWorkflowObjectFactory.getEngineRunnerFromClassName;
+import static org.apache.oodt.cas.workflow.util.GenericWorkflowObjectFactory.getWorkflowEngineFromClassName;
+import static org.apache.oodt.cas.workflow.util.GenericWorkflowObjectFactory.getWorkflowRepositoryFromClassName;
+
+//Apache imports
 import org.apache.xmlrpc.WebServer;
 
 //OODT imports
 import org.apache.oodt.cas.workflow.util.XmlRpcStructFactory;
-import org.apache.oodt.cas.workflow.engine.WorkflowEngineFactory;
+import org.apache.oodt.cas.workflow.engine.EngineRunner;
+import org.apache.oodt.cas.workflow.engine.SynchronousLocalEngineRunner;
+import org.apache.oodt.cas.workflow.engine.ThreadPoolWorkflowEngine;
 import org.apache.oodt.cas.workflow.engine.WorkflowEngine;
+import org.apache.oodt.cas.workflow.repository.DataSourceWorkflowRepositoryFactory;
 import org.apache.oodt.cas.workflow.repository.WorkflowRepository;
-import org.apache.oodt.cas.workflow.repository.WorkflowRepositoryFactory;
 import org.apache.oodt.cas.workflow.structs.Workflow;
 import org.apache.oodt.cas.workflow.structs.WorkflowInstance;
 import org.apache.oodt.cas.workflow.structs.WorkflowInstancePage;
@@ -40,6 +45,8 @@ import org.apache.oodt.cas.metadata.Meta
 //JDK imports
 import java.io.File;
 import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
 import java.net.InetAddress;
 import java.net.MalformedURLException;
 import java.net.URL;
@@ -49,113 +56,67 @@ 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;
 
+//Google imports
+import com.google.common.base.Preconditions;
+
 /**
- * @author mattmann
- * @version $Revision$
- * 
- * <p>
  * An XML RPC-based Workflow manager.
- * </p>
- * 
+ *
+ * @author mattmann (Chris Mattmann)
+ * @author bfoster (Brian Foster)
  */
 public class XmlRpcWorkflowManager {
 
-    /* the port to run the XML RPC web server on, default is 2000 */
-    private int webServerPort = 2000;
+   private static final Logger LOG = Logger.getLogger(XmlRpcWorkflowManager.class.getName());
 
-    /* our log stream */
-    private Logger LOG = Logger
-            .getLogger(XmlRpcWorkflowManager.class.getName());
-
-    /* our xml rpc web server */
-    private WebServer webServer = null;
-
-    /* our workflow engine */
-    private WorkflowEngine engine = null;
-
-    /* our workflow repository */
-    private WorkflowRepository repo = null;
-
-    /**
-     * 
-     * @param port
-     *            The web server port to run the XML Rpc server on, defaults to
-     *            2000.
-     */
-    public XmlRpcWorkflowManager(int port) throws Exception {
-        Class engineFactoryClass = null, repositoryFactoryClass = null;
-
-        WorkflowEngineFactory engineFactory = null;
-        WorkflowRepositoryFactory repoFactory = null;
-
-        // load properties from workflow manager properties file, if specified
-        if (System.getProperty("org.apache.oodt.cas.workflow.properties") != null) {
-            String configFile = System
-                    .getProperty("org.apache.oodt.cas.workflow.properties");
-            LOG.log(Level.INFO,
-                    "Loading Workflow Manager Configuration Properties from: ["
-                            + configFile + "]");
-            System.getProperties().load(
-                    new FileInputStream(new File(configFile)));
-        }
+   public static final int DEFAULT_WEB_SERVER_PORT = 9001;
+   public static final String XML_RPC_HANDLER_NAME = "workflowmgr";
 
-        String engineClassStr = System
-                .getProperty("workflow.engine.factory",
-                        "org.apache.oodt.cas.workflow.engine.DataSourceWorkflowEngineFactory");
-        String repositoryClassStr = System
-                .getProperty("workflow.repo.factory",
-                        "org.apache.oodt.cas.workflow.repository.DataSourceWorkflowRepositoryFactory");
-
-        try {
-            engineFactoryClass = Class.forName(engineClassStr);
-            engineFactory = (WorkflowEngineFactory) engineFactoryClass
-                    .newInstance();
-            engine = engineFactory.createWorkflowEngine();
-        } catch (ClassNotFoundException e) {
-            e.printStackTrace();
-            throw new Exception("Unable to load workflow engine factory class "
-                    + engineClassStr);
-        }
-
-        webServerPort = port;
-
-        // set the corresponding workflow manager url
-        engine.setWorkflowManagerUrl(safeGetUrlFromString("http://"
-                + getHostname() + ":" + this.webServerPort));
-
-        try {
-            repositoryFactoryClass = Class.forName(repositoryClassStr);
-            repoFactory = (WorkflowRepositoryFactory) repositoryFactoryClass
-                    .newInstance();
-            repo = repoFactory.createRepository();
-        } catch (ClassNotFoundException e) {
-            e.printStackTrace();
-            throw new Exception(
-                    "Unable to load workflow repository factory class "
-                            + repositoryClassStr);
-        }
-
-        // start up the web server
-        webServer = new WebServer(webServerPort);
-        webServer.addHandler("workflowmgr", this);
-        webServer.start();
-
-        LOG.log(Level.INFO, "Workflow Manager started by "
-                + System.getProperty("user.name", "unknown"));
-
-    }
-
-  public boolean shutdown() {
-    if (this.webServer != null) {
-      webServer.shutdown();
-      webServer = null;
-      return true;
-    } else
-      return false;
-  }
+   public static final String PROPERTIES_FILE_PROPERTY = "org.apache.oodt.cas.workflow.properties";
+   public static final String WORKFLOW_ENGINE_FACTORY_PROPERTY = "workflow.engine.factory";
+   public static final String ENGINE_RUNNER_FACTORY_PROPERTY = "workflow.engine.runner.factory";
+   public static final String WORKFLOW_REPOSITORY_FACTORY_PROPERTY = "workflow.repo.factory";
+
+   private final int webServerPort;
+   private WebServer webServer;
+   private final WorkflowEngine engine;
+   private final EngineRunner runner;
+   private final WorkflowRepository repo;
+
+   public XmlRpcWorkflowManager() {
+      this(DEFAULT_WEB_SERVER_PORT);
+   }
+
+   public XmlRpcWorkflowManager(int port) {
+      Preconditions.checkArgument(port > 0, "Must specify a port greater than 0");
+      webServerPort = port;
+
+      runner = getEngineRunnerFromProperty();
+      engine = getWorkflowEngineFromProperty();
+      engine.setEngineRunner(runner);
+      engine.setWorkflowManagerUrl(safeGetUrlFromString("http://"
+            + getHostname() + ":" + this.webServerPort));
+      repo = getWorkflowRepositoryFromProperty();
+
+      // start up the web server
+      webServer = new WebServer(webServerPort);
+      webServer.addHandler(XML_RPC_HANDLER_NAME, this);
+      webServer.start();
+
+      LOG.log(Level.INFO, "Workflow Manager started by "
+            + System.getProperty("user.name", "unknown"));
+   }
+
+   public boolean shutdown() {
+      if (webServer != null) {
+         webServer.shutdown();
+         webServer = null;
+         return true;
+      } else
+         return false;
+   }
 
   public String executeDynamicWorkflow(Vector<String> taskIds, Hashtable metadata)
       throws RepositoryException, EngineException {
@@ -172,7 +133,7 @@ public class XmlRpcWorkflowManager {
             + "] is not defined!");
       dynamicWorkflow.getTasks().add(task);
     }
-    
+
     dynamicWorkflow.setId(this.repo.addWorkflow(dynamicWorkflow));
     dynamicWorkflow.setName("Dynamic Workflow-" + dynamicWorkflow.getId());
 
@@ -193,7 +154,7 @@ public class XmlRpcWorkflowManager {
 
             if (events != null) {
                 for (Iterator i = events.iterator(); i.hasNext();) {
-                    eventsVector.add((String) i.next());
+                    eventsVector.add(i.next());
                 }
 
             }
@@ -644,6 +605,7 @@ public class XmlRpcWorkflowManager {
             System.exit(1);
         }
 
+        loadProperties();
         XmlRpcWorkflowManager manager = new XmlRpcWorkflowManager(portNum);
 
         for (;;)
@@ -653,6 +615,35 @@ public class XmlRpcWorkflowManager {
             }
     }
 
+    public static void loadProperties() throws FileNotFoundException, IOException {
+       String configFile = System.getProperty(PROPERTIES_FILE_PROPERTY);
+       if (configFile != null) {
+          LOG.log(Level.INFO,
+                "Loading Workflow Manager Configuration Properties from: ["
+                      + configFile + "]");
+          System.getProperties().load(new FileInputStream(new File(
+                configFile)));
+       }
+    }
+
+    private static WorkflowEngine getWorkflowEngineFromProperty() {
+       return getWorkflowEngineFromClassName(System.getProperty(
+             WORKFLOW_ENGINE_FACTORY_PROPERTY,
+             ThreadPoolWorkflowEngine.class.getCanonicalName()));
+    }
+
+    private static EngineRunner getEngineRunnerFromProperty() {
+       return getEngineRunnerFromClassName(System.getProperty(
+             ENGINE_RUNNER_FACTORY_PROPERTY,
+             SynchronousLocalEngineRunner.class.getCanonicalName()));
+    }
+
+    private static WorkflowRepository getWorkflowRepositoryFromProperty() {
+       return getWorkflowRepositoryFromClassName(System.getProperty(
+             WORKFLOW_REPOSITORY_FACTORY_PROPERTY,
+             DataSourceWorkflowRepositoryFactory.class.getCanonicalName()));
+    }
+
     private String getHostname() {
         try {
             // Get hostname by textual representation of IP address

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=1369914&r1=1369913&r2=1369914&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 Mon Aug  6 18:31:53 2012
@@ -14,13 +14,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
-
 package org.apache.oodt.cas.workflow.util;
 
 //OODT imports
+import org.apache.oodt.cas.workflow.engine.EngineRunner;
+import org.apache.oodt.cas.workflow.engine.EngineRunnerFactory;
+import org.apache.oodt.cas.workflow.engine.WorkflowEngine;
+import org.apache.oodt.cas.workflow.engine.WorkflowEngineFactory;
 import org.apache.oodt.cas.workflow.instrepo.WorkflowInstanceRepository;
 import org.apache.oodt.cas.workflow.instrepo.WorkflowInstanceRepositoryFactory;
+import org.apache.oodt.cas.workflow.repository.WorkflowRepository;
+import org.apache.oodt.cas.workflow.repository.WorkflowRepositoryFactory;
 import org.apache.oodt.cas.workflow.structs.WorkflowCondition;
 import org.apache.oodt.cas.workflow.structs.WorkflowTask;
 import org.apache.oodt.cas.workflow.structs.WorkflowTaskInstance;
@@ -37,11 +41,10 @@ import java.util.Vector;
 import java.util.Iterator;
 
 /**
- * @author mattmann
- * @version $Revision$
- *
- * <p>Generic Workflow object construction utilities.</p>
+ * Generic Workflow object construction utilities.
  *
+ * @author mattmann (Chris Mattmann)
+ * @author bfoster (Brian Foster)
  */
 public final class GenericWorkflowObjectFactory {
 
@@ -53,8 +56,67 @@ public final class GenericWorkflowObject
 		throw new InstantiationException(
 		"Don't instantiate XML Struct Factories!");
 	}
-	
-	
+
+   public static WorkflowEngine getWorkflowEngineFromClassName(String engineFactory) {
+      try {
+         return ((WorkflowEngineFactory) Class.forName(engineFactory)
+               .newInstance()).createWorkflowEngine();
+      } catch (ClassNotFoundException e) {
+         LOG.log(Level.WARNING, "ClassNotFoundException when "
+               + "loading workflow engine factory class "
+               + engineFactory + " Message: " + e.getMessage());
+      } catch (InstantiationException e) {
+         LOG.log(Level.WARNING, "InstantiationException when "
+               + "loading workflow engine factory class "
+               + engineFactory + " Message: " + e.getMessage());
+      } catch (IllegalAccessException e) {
+         LOG.log(Level.WARNING, "IllegalAccessException when loading "
+               + "workflow engine factory class "
+               + engineFactory + " Message: " + e.getMessage());
+      }
+      return null;
+   }
+
+	public static EngineRunner getEngineRunnerFromClassName(String engineFactory) {
+	   try {
+         return ((EngineRunnerFactory) Class.forName(engineFactory)
+               .newInstance()).createEngineRunner();
+      } catch (ClassNotFoundException e) {
+         LOG.log(Level.WARNING, "ClassNotFoundException when "
+               + "loading engine runner factory class "
+               + engineFactory + " Message: " + e.getMessage());
+      } catch (InstantiationException e) {
+         LOG.log(Level.WARNING, "InstantiationException when "
+               + "loading engine runner factory class "
+               + engineFactory + " Message: " + e.getMessage());
+      } catch (IllegalAccessException e) {
+         LOG.log(Level.WARNING, "IllegalAccessException when loading "
+               + "engine runner factory class "
+               + engineFactory + " Message: " + e.getMessage());
+      }
+      return null;
+	}
+
+   public static WorkflowRepository getWorkflowRepositoryFromClassName(String repositoryFactory) {
+      try {
+         return ((WorkflowRepositoryFactory) Class.forName(repositoryFactory)
+               .newInstance()).createRepository();
+      } catch (ClassNotFoundException e) {
+         LOG.log(Level.WARNING, "ClassNotFoundException when "
+               + "loading engine runner factory class "
+               + repositoryFactory + " Message: " + e.getMessage());
+      } catch (InstantiationException e) {
+         LOG.log(Level.WARNING, "InstantiationException when "
+               + "loading engine runner factory class "
+               + repositoryFactory + " Message: " + e.getMessage());
+      } catch (IllegalAccessException e) {
+         LOG.log(Level.WARNING, "IllegalAccessException when loading "
+               + "engine runner factory class "
+               + repositoryFactory + " Message: " + e.getMessage());
+      }
+      return null;
+   }
+
 	public static WorkflowInstanceRepository getWorkflowInstanceRepositoryFromClassName(
 			String serviceFactory) {
 		WorkflowInstanceRepositoryFactory factory = null;
@@ -83,13 +145,13 @@ public final class GenericWorkflowObject
 
 		return null;
 	}
-	
+
 	/**
 	 * <p>
 	 * Constructs a {@link WorkflowTaskInstance} from the given implementation
 	 * class name.
 	 * </p>
-	 * 
+	 *
 	 * @param className
 	 *            The String name of the class (including package qualifiers)
 	 *            that implements the WorkflowTaskInstance interface to
@@ -129,13 +191,13 @@ 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
@@ -189,14 +251,14 @@ public final class GenericWorkflowObject
       }
     } else
       return null;
-  }	
+  }
 
 	/**
 	 * <p>
 	 * Constructs a {@link WorkflowConditionInstance} from the given implementation
 	 * class name.
 	 * </p>
-	 * 
+	 *
 	 * @param className
 	 *            The String name of the class (including package qualifiers)
 	 *            that implements the WorkflowConditionInstance interface to construct.
@@ -234,13 +296,13 @@ public final class GenericWorkflowObject
 		} else
 			return null;
 	}
-	
+
 	/**
 	 * <p>
 	 * Constructs a {@link Workflow} instance from the given implementation
 	 * class name.
 	 * </p>
-	 * 
+	 *
 	 * @param className
 	 *            The String name of the class (including package qualifiers)
 	 *            that implements the Workflow interface to construct.
@@ -275,9 +337,9 @@ public final class GenericWorkflowObject
 				return null;
 			}
 		} else
-			return null;		
+			return null;
 	}
-	
+
 	public static List copyWorkflows(List workflows){
 		if(workflows != null){
 			List newWorkflows = new Vector(workflows.size());
@@ -286,60 +348,60 @@ public final class GenericWorkflowObject
 				Workflow newWorkflow = copyWorkflow(w);
 				newWorkflows.add(newWorkflow);
 			}
-			
+
 			return newWorkflows;
 		}
 		else return null;
 	}
-	
+
 	/**
-	 * <p>Creates an exact copy of the specified {@link Workflow} <code>w</code>, 
+	 * <p>Creates an exact copy of the specified {@link Workflow} <code>w</code>,
 	 * allocating new memory for the new object, and then returning it. The Workflow's
 	 * {@link WorkflowTask}s and {@link WorkflowCondition}s on those tasks are also constructed
 	 * anew, and copied from their original instances.</p>
-	 * 
+	 *
 	 * @param w The Workflow object to create a copy of.
 	 * @return A copy of the specified Workflow.
 	 */
 	public static Workflow copyWorkflow(Workflow w){
 		Workflow newWorkflow = null;
-		
-		
+
+
 		newWorkflow = getWorkflowObjectFromClassName(w.getClass().getName());
-		
-		
+
+
 		//copy through
 		newWorkflow.setName(w.getName());
 		newWorkflow.setId(w.getId());
 		newWorkflow.setTasks(copyTasks(w.getTasks()));
-		
+
 		return newWorkflow;
 	}
-	
+
 	/**
 	 * <p>Creates copies of each {@link WorkflowTask} within the specified
 	 * {@link List} of WorkflowTasks specified by <code>taskList</code>. The new
 	 * List of WorkflowTasks is returned.</p>
-	 * 
+	 *
 	 * @param taskList The original List of WorkflowTasks to copy.
 	 * @return A new List of WorkflowTasks, copied from the original one specified.
 	 */
 	public static List copyTasks(List taskList){
 		if(taskList != null){
-			
+
 			List newTaskList = new Vector(taskList.size());
-			
+
 			for(Iterator i = taskList.iterator(); i.hasNext(); ){
 				WorkflowTask t = (WorkflowTask)i.next();
 				WorkflowTask newTask = copyTask(t);
 				newTaskList.add(newTask);
 			}
-			
+
 			return newTaskList;
 		}
 		else return null;
 	}
-	
+
 	public static WorkflowTask copyTask(WorkflowTask t){
 		WorkflowTask newTask = new WorkflowTask();
 		newTask.setTaskConfig(t.getTaskConfig());
@@ -355,25 +417,25 @@ public final class GenericWorkflowObject
 	 * <p>Creates copies of each {@link WorkflowCondition} within the specified
 	 * {@link List} of WorkflowConditions specified by <code>conditionList</code>. The new
 	 * List of WorkflowConditions is returned.</p>
-	 * 
+	 *
 	 * @param conditionList The original List of WorkflowConditions to copy.
 	 * @return A new List of WorkflowConditions, copied from the original one specified.
 	 */
 	public static List copyConditions(List conditionList){
 		if(conditionList != null){
 			List newConditionList = new Vector(conditionList.size());
-			
+
 			for(Iterator i = conditionList.iterator(); i.hasNext(); ){
 				WorkflowCondition c = (WorkflowCondition)i.next();
 				WorkflowCondition newCondition = copyCondition(c);
 				newConditionList.add(newCondition);
 			}
-			
+
 			return newConditionList;
 		}
 		else return null;
 	}
-	
+
 	public static WorkflowCondition copyCondition(WorkflowCondition c){
 		WorkflowCondition newCondition = new WorkflowCondition();
 		newCondition.setConditionName(c.getConditionName());



Mime
View raw message