servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r436737 - in /incubator/servicemix/trunk/servicemix-beanflow/src: main/java/org/apache/servicemix/beanflow/ main/java/org/apache/servicemix/beanflow/support/ test/java/org/apache/servicemix/beanflow/
Date Fri, 25 Aug 2006 09:38:09 GMT
Author: jstrachan
Date: Fri Aug 25 02:38:06 2006
New Revision: 436737

URL: http://svn.apache.org/viewvc?rev=436737&view=rev
Log:
minor refactor to make the Workflow class a bit easier to understand

Modified:
    incubator/servicemix/trunk/servicemix-beanflow/src/main/java/org/apache/servicemix/beanflow/Workflow.java
    incubator/servicemix/trunk/servicemix-beanflow/src/main/java/org/apache/servicemix/beanflow/support/ReflectionInterpreter.java
    incubator/servicemix/trunk/servicemix-beanflow/src/test/java/org/apache/servicemix/beanflow/ExampleStringWorkflow.java
    incubator/servicemix/trunk/servicemix-beanflow/src/test/java/org/apache/servicemix/beanflow/ExampleWorkflow.java

Modified: incubator/servicemix/trunk/servicemix-beanflow/src/main/java/org/apache/servicemix/beanflow/Workflow.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-beanflow/src/main/java/org/apache/servicemix/beanflow/Workflow.java?rev=436737&r1=436736&r2=436737&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-beanflow/src/main/java/org/apache/servicemix/beanflow/Workflow.java
(original)
+++ incubator/servicemix/trunk/servicemix-beanflow/src/main/java/org/apache/servicemix/beanflow/Workflow.java
Fri Aug 25 02:38:06 2006
@@ -70,7 +70,7 @@
         if (firstStep instanceof Enum) {
             validateStepsExist(firstStep.getClass());
         }
-        setNextStep(firstStep);
+        addStep(firstStep);
     }
 
     /**
@@ -81,9 +81,10 @@
     }
 
     /**
-     * Sets the next step to be executed when the current step completes
+     * Adds a step to be executed after the current step completes processing
      */
-    public void setNextStep(T stepName) {
+    public void addStep(T stepName) {
+        suspended.set(false);
         queue.add(stepName);
         executor.execute(this);
     }
@@ -178,7 +179,7 @@
     public Runnable createGoToStepTask(final T joinedStep) {
         return new Runnable() {
             public void run() {
-                setNextStep(joinedStep);
+                addStep(joinedStep);
             }
         };
     }

Modified: incubator/servicemix/trunk/servicemix-beanflow/src/main/java/org/apache/servicemix/beanflow/support/ReflectionInterpreter.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-beanflow/src/main/java/org/apache/servicemix/beanflow/support/ReflectionInterpreter.java?rev=436737&r1=436736&r2=436737&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-beanflow/src/main/java/org/apache/servicemix/beanflow/support/ReflectionInterpreter.java
(original)
+++ incubator/servicemix/trunk/servicemix-beanflow/src/main/java/org/apache/servicemix/beanflow/support/ReflectionInterpreter.java
Fri Aug 25 02:38:06 2006
@@ -43,7 +43,7 @@
             WorkflowStep<T> workflowStep = (WorkflowStep<T>) step;
             T nextStep = workflowStep.execute(workflow);
             if (nextStep != null) {
-                workflow.setNextStep(nextStep);
+                workflow.addStep(nextStep);
             }
             else {
                 workflow.suspend();
@@ -75,7 +75,7 @@
                 Object[] enumValues = EnumHelper.getEnumValues(step.getClass());
                 int index = step.ordinal();
                 if (++index < enumValues.length) {
-                    workflow.setNextStep((T) enumValues[index]);
+                    workflow.addStep((T) enumValues[index]);
                 }
                 else {
                     workflow.stop();
@@ -130,7 +130,7 @@
     @SuppressWarnings("unchecked")
     protected void handleStepResult(String step, Workflow workflow, Object result) {
         if (result != null) {
-            workflow.setNextStep(result);
+            workflow.addStep(result);
         }
         else {
             workflow.suspend();

Modified: incubator/servicemix/trunk/servicemix-beanflow/src/test/java/org/apache/servicemix/beanflow/ExampleStringWorkflow.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-beanflow/src/test/java/org/apache/servicemix/beanflow/ExampleStringWorkflow.java?rev=436737&r1=436736&r2=436737&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-beanflow/src/test/java/org/apache/servicemix/beanflow/ExampleStringWorkflow.java
(original)
+++ incubator/servicemix/trunk/servicemix-beanflow/src/test/java/org/apache/servicemix/beanflow/ExampleStringWorkflow.java
Fri Aug 25 02:38:06 2006
@@ -47,7 +47,7 @@
     public void startStep() {
         // lets use an explicit goTo() to tell the workflow
         // which step to go to next; though we can just return Strings
-        setNextStep("loopStep");
+        addStep("loopStep");
     }
 
     // lets use the return value to specify the next step
@@ -104,7 +104,7 @@
             this.userEmailAddress = emailAddress;
 
             log.info("Lets re-start the suspended workflow");
-            setNextStep("afterEnteredEmailStep");
+            addStep("afterEnteredEmailStep");
         }
     }
 }

Modified: incubator/servicemix/trunk/servicemix-beanflow/src/test/java/org/apache/servicemix/beanflow/ExampleWorkflow.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-beanflow/src/test/java/org/apache/servicemix/beanflow/ExampleWorkflow.java?rev=436737&r1=436736&r2=436737&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-beanflow/src/test/java/org/apache/servicemix/beanflow/ExampleWorkflow.java
(original)
+++ incubator/servicemix/trunk/servicemix-beanflow/src/test/java/org/apache/servicemix/beanflow/ExampleWorkflow.java
Fri Aug 25 02:38:06 2006
@@ -47,7 +47,7 @@
     public void startStep() {
         // lets use an explicit goTo() to tell the workflow
         // which step to go to next; though we can just return Strings
-        setNextStep(Step.loopStep);
+        addStep(Step.loopStep);
     }
 
     // lets use the return value to specify the next step
@@ -104,7 +104,7 @@
             this.userEmailAddress = emailAddress;
 
             log.info("Lets re-start the suspended workflow");
-            setNextStep(Step.afterEnteredEmailStep);
+            addStep(Step.afterEnteredEmailStep);
         }
     }
 }



Mime
View raw message