From dade6952c8f53df8c1e0fde2df37a5cccbba8204 Mon Sep 17 00:00:00 2001 From: dsyer Date: Thu, 30 Oct 2008 11:33:05 +0000 Subject: [PATCH] OPEN - issue BATCH-679: Non-sequential execution - add state subpackage --- .../batch/core/configuration/xml/DecisionParser.java | 4 ++-- .../batch/core/configuration/xml/SplitParser.java | 4 ++-- .../batch/core/configuration/xml/StepParser.java | 4 ++-- .../springframework/batch/core/job/flow/Flow.java | 4 ++-- .../flow/{JobFlowExecutor.java => FlowExecutor.java} | 2 +- .../springframework/batch/core/job/flow/FlowJob.java | 6 +++--- .../batch/core/job/flow/support/SimpleFlow.java | 10 +++++----- .../batch/core/job/flow/support/State.java | 4 ++-- .../batch/core/job/flow/support/StateTransition.java | 1 + .../job/flow/support/{ => state}/AbstractState.java | 7 ++++--- .../job/flow/support/{ => state}/DecisionState.java | 6 +++--- .../core/job/flow/support/{ => state}/EndState.java | 9 +++++---- .../support/{ => state}/FlowExecutionAggregator.java | 2 +- .../support/{ => state}/JobExecutionDecider.java | 2 +- .../{ => state}/MaxValueFlowExecutionAggregator.java | 2 +- .../job/flow/support/{ => state}/PauseState.java | 6 +++--- .../job/flow/support/{ => state}/SplitState.java | 9 +++++---- .../core/job/flow/support/{ => state}/StepState.java | 9 +++++---- .../job/flow/support/{ => util}/PatternMatcher.java | 2 +- .../configuration/xml/DecisionJobParserTests.java | 2 +- .../core/configuration/xml/StopJobParserTests.java | 2 +- .../batch/core/job/flow/FlowJobTests.java | 10 +++++----- .../job/flow/support/JobFlowExecutorSupport.java | 4 ++-- .../{BasicFlowTests.java => SimpleFlowTests.java} | 10 +++++----- .../batch/core/job/flow/support/StateSupport.java | 6 +++--- .../job/flow/support/{ => state}/EndStateTests.java | 12 +++++++----- .../SimpleFlowExecutionAggregatorTests.java | 4 ++-- .../flow/support/{ => state}/SplitStateTests.java | 4 ++-- 28 files changed, 77 insertions(+), 70 deletions(-) rename spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/{JobFlowExecutor.java => FlowExecutor.java} (98%) rename spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/{ => state}/AbstractState.java (79%) rename spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/{ => state}/DecisionState.java (66%) rename spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/{ => state}/EndState.java (78%) rename spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/{ => state}/FlowExecutionAggregator.java (94%) rename spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/{ => state}/JobExecutionDecider.java (95%) rename spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/{ => state}/MaxValueFlowExecutionAggregator.java (94%) rename spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/{ => state}/PauseState.java (81%) rename spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/{ => state}/SplitState.java (90%) rename spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/{ => state}/StepState.java (54%) rename spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/{ => util}/PatternMatcher.java (98%) rename spring-batch-core/src/test/java/org/springframework/batch/core/job/flow/support/{BasicFlowTests.java => SimpleFlowTests.java} (96%) rename spring-batch-core/src/test/java/org/springframework/batch/core/job/flow/support/{ => state}/EndStateTests.java (83%) rename spring-batch-core/src/test/java/org/springframework/batch/core/job/flow/support/{ => state}/SimpleFlowExecutionAggregatorTests.java (91%) rename spring-batch-core/src/test/java/org/springframework/batch/core/job/flow/support/{ => state}/SplitStateTests.java (94%) diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/DecisionParser.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/DecisionParser.java index e52c410ee..b09480068 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/DecisionParser.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/DecisionParser.java @@ -17,9 +17,9 @@ package org.springframework.batch.core.configuration.xml; import java.util.Collection; -import org.springframework.batch.core.job.flow.support.DecisionState; -import org.springframework.batch.core.job.flow.support.JobExecutionDecider; import org.springframework.batch.core.job.flow.support.StateTransition; +import org.springframework.batch.core.job.flow.support.state.DecisionState; +import org.springframework.batch.core.job.flow.support.state.JobExecutionDecider; import org.springframework.beans.factory.config.RuntimeBeanReference; import org.springframework.beans.factory.support.BeanDefinitionBuilder; import org.springframework.beans.factory.xml.ParserContext; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/SplitParser.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/SplitParser.java index 6408ee94a..3a9098dc9 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/SplitParser.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/SplitParser.java @@ -19,9 +19,9 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; -import org.springframework.batch.core.job.flow.support.JobExecutionDecider; -import org.springframework.batch.core.job.flow.support.SplitState; import org.springframework.batch.core.job.flow.support.StateTransition; +import org.springframework.batch.core.job.flow.support.state.JobExecutionDecider; +import org.springframework.batch.core.job.flow.support.state.SplitState; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.config.RuntimeBeanReference; import org.springframework.beans.factory.support.BeanDefinitionBuilder; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/StepParser.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/StepParser.java index 86623d3a2..50f09e3bb 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/StepParser.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/StepParser.java @@ -21,9 +21,9 @@ import java.util.List; import org.springframework.batch.core.BatchStatus; import org.springframework.batch.core.Step; -import org.springframework.batch.core.job.flow.support.EndState; import org.springframework.batch.core.job.flow.support.StateTransition; -import org.springframework.batch.core.job.flow.support.StepState; +import org.springframework.batch.core.job.flow.support.state.EndState; +import org.springframework.batch.core.job.flow.support.state.StepState; import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.config.RuntimeBeanReference; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/Flow.java b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/Flow.java index 882a2fae4..c497ecea1 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/Flow.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/Flow.java @@ -29,7 +29,7 @@ public interface Flow { /** * @throws FlowExecutionException */ - FlowExecution start(JobFlowExecutor executor) throws FlowExecutionException; + FlowExecution start(FlowExecutor executor) throws FlowExecutionException; /** * @param stateName the name of the state to resume on @@ -37,6 +37,6 @@ public interface Flow { * @return a {@link FlowExecution} containing the exit status of the flow * @throws FlowExecutionException */ - FlowExecution resume(String stateName, JobFlowExecutor executor) throws FlowExecutionException; + FlowExecution resume(String stateName, FlowExecutor executor) throws FlowExecutionException; } \ No newline at end of file diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/JobFlowExecutor.java b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/FlowExecutor.java similarity index 98% rename from spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/JobFlowExecutor.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/FlowExecutor.java index 448f8f47b..302735622 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/JobFlowExecutor.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/FlowExecutor.java @@ -29,7 +29,7 @@ import org.springframework.batch.core.repository.JobRestartException; * @author Dave Syer * */ -public interface JobFlowExecutor { +public interface FlowExecutor { /** * @param step a {@link Step} to execute diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/FlowJob.java b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/FlowJob.java index c9bd62891..6af1341cb 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/FlowJob.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/FlowJob.java @@ -62,7 +62,7 @@ public class FlowJob extends AbstractJob { @Override protected StepExecution doExecute(final JobExecution execution) throws JobExecutionException { try { - FlowExecution result = flow.start(new SimpleJobFlowExecutor(execution)); + FlowExecution result = flow.start(new JobFlowExecutor(execution)); return getLastStepExecution(execution, result); } catch (FlowExecutionException e) { @@ -121,7 +121,7 @@ public class FlowJob extends AbstractJob { * @author Dave Syer * */ - private class SimpleJobFlowExecutor implements JobFlowExecutor { + private class JobFlowExecutor implements FlowExecutor { private final ThreadLocal stepExecutionHolder = new ThreadLocal(); private final JobExecution execution; @@ -129,7 +129,7 @@ public class FlowJob extends AbstractJob { /** * @param execution */ - private SimpleJobFlowExecutor(JobExecution execution) { + private JobFlowExecutor(JobExecution execution) { this.execution = execution; stepExecutionHolder.set(null); } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/SimpleFlow.java b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/SimpleFlow.java index 71768f4ef..a3224aa2e 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/SimpleFlow.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/SimpleFlow.java @@ -27,7 +27,7 @@ import org.springframework.batch.core.JobExecutionException; import org.springframework.batch.core.job.flow.Flow; import org.springframework.batch.core.job.flow.FlowExecution; import org.springframework.batch.core.job.flow.FlowExecutionException; -import org.springframework.batch.core.job.flow.JobFlowExecutor; +import org.springframework.batch.core.job.flow.FlowExecutor; import org.springframework.beans.factory.InitializingBean; import com.sun.org.apache.xerces.internal.impl.xpath.XPath.Step; @@ -101,9 +101,9 @@ public class SimpleFlow implements Flow, InitializingBean { } /** - * @see Flow#start(JobFlowExecutor) + * @see Flow#start(FlowExecutor) */ - public FlowExecution start(JobFlowExecutor executor) throws FlowExecutionException { + public FlowExecution start(FlowExecutor executor) throws FlowExecutionException { if (startState == null) { initializeTransitions(); } @@ -113,9 +113,9 @@ public class SimpleFlow implements Flow, InitializingBean { } /** - * @see Flow#resume(String, JobFlowExecutor) + * @see Flow#resume(String, FlowExecutor) */ - public FlowExecution resume(String stateName, JobFlowExecutor executor) throws FlowExecutionException { + public FlowExecution resume(String stateName, FlowExecutor executor) throws FlowExecutionException { String status = FlowExecution.UNKNOWN; State state = stateMap.get(stateName); diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/State.java b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/State.java index 5c3bf084a..be00a7a2f 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/State.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/State.java @@ -16,7 +16,7 @@ package org.springframework.batch.core.job.flow.support; import org.springframework.batch.core.job.flow.FlowExecution; -import org.springframework.batch.core.job.flow.JobFlowExecutor; +import org.springframework.batch.core.job.flow.FlowExecutor; /** @@ -45,6 +45,6 @@ public interface State { * @return a status for the execution * @throws Exception if anything goes wrong */ - String handle(JobFlowExecutor executor) throws Exception; + String handle(FlowExecutor executor) throws Exception; } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/StateTransition.java b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/StateTransition.java index c6f1e0c2c..7830b1c38 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/StateTransition.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/StateTransition.java @@ -15,6 +15,7 @@ */ package org.springframework.batch.core.job.flow.support; +import org.springframework.batch.core.job.flow.support.util.PatternMatcher; import org.springframework.batch.repeat.ExitStatus; import org.springframework.util.StringUtils; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/AbstractState.java b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/state/AbstractState.java similarity index 79% rename from spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/AbstractState.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/state/AbstractState.java index 79ef219aa..2fe14db1d 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/AbstractState.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/state/AbstractState.java @@ -13,9 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.core.job.flow.support; +package org.springframework.batch.core.job.flow.support.state; -import org.springframework.batch.core.job.flow.JobFlowExecutor; +import org.springframework.batch.core.job.flow.FlowExecutor; +import org.springframework.batch.core.job.flow.support.State; /** @@ -45,6 +46,6 @@ public abstract class AbstractState implements State { return getClass().getSimpleName()+": name=["+name+"]"; } - public abstract String handle(JobFlowExecutor executor) throws Exception; + public abstract String handle(FlowExecutor executor) throws Exception; } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/DecisionState.java b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/state/DecisionState.java similarity index 66% rename from spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/DecisionState.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/state/DecisionState.java index 2f1111118..6ca2ce743 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/DecisionState.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/state/DecisionState.java @@ -1,6 +1,6 @@ -package org.springframework.batch.core.job.flow.support; +package org.springframework.batch.core.job.flow.support.state; -import org.springframework.batch.core.job.flow.JobFlowExecutor; +import org.springframework.batch.core.job.flow.FlowExecutor; /** @@ -20,7 +20,7 @@ public class DecisionState extends AbstractState { } @Override - public String handle(JobFlowExecutor executor) throws Exception { + public String handle(FlowExecutor executor) throws Exception { return decider.decide(executor.getJobExecution(), executor.getStepExecution()); } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/EndState.java b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/state/EndState.java similarity index 78% rename from spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/EndState.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/state/EndState.java index edb1ce1b0..5dda8130a 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/EndState.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/state/EndState.java @@ -1,9 +1,10 @@ -package org.springframework.batch.core.job.flow.support; +package org.springframework.batch.core.job.flow.support.state; import org.springframework.batch.core.BatchStatus; import org.springframework.batch.core.JobExecution; import org.springframework.batch.core.job.flow.FlowExecution; -import org.springframework.batch.core.job.flow.JobFlowExecutor; +import org.springframework.batch.core.job.flow.FlowExecutor; +import org.springframework.batch.core.job.flow.support.State; /** * {@link State} implementation for ending a job if it is in progress and @@ -29,10 +30,10 @@ public class EndState extends AbstractState { * is the first place we came after a restart we do nothing (otherwise the * same outcome that ended the job on the last run will occur). * - * @see State#handle(JobFlowExecutor) + * @see State#handle(FlowExecutor) */ @Override - public String handle(JobFlowExecutor executor) throws Exception { + public String handle(FlowExecutor executor) throws Exception { JobExecution jobExecution = executor.getJobExecution(); // If there are no step executions, then we are at the beginning of a // restart diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/FlowExecutionAggregator.java b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/state/FlowExecutionAggregator.java similarity index 94% rename from spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/FlowExecutionAggregator.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/state/FlowExecutionAggregator.java index edeb85c85..0f0167964 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/FlowExecutionAggregator.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/state/FlowExecutionAggregator.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.core.job.flow.support; +package org.springframework.batch.core.job.flow.support.state; import java.util.Collection; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/JobExecutionDecider.java b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/state/JobExecutionDecider.java similarity index 95% rename from spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/JobExecutionDecider.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/state/JobExecutionDecider.java index 8c750eb0f..29922b962 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/JobExecutionDecider.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/state/JobExecutionDecider.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.core.job.flow.support; +package org.springframework.batch.core.job.flow.support.state; import org.springframework.batch.core.JobExecution; import org.springframework.batch.core.StepExecution; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/MaxValueFlowExecutionAggregator.java b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/state/MaxValueFlowExecutionAggregator.java similarity index 94% rename from spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/MaxValueFlowExecutionAggregator.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/state/MaxValueFlowExecutionAggregator.java index 41dc45986..24a39ceff 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/MaxValueFlowExecutionAggregator.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/state/MaxValueFlowExecutionAggregator.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.core.job.flow.support; +package org.springframework.batch.core.job.flow.support.state; import java.util.Collection; import java.util.Collections; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/PauseState.java b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/state/PauseState.java similarity index 81% rename from spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/PauseState.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/state/PauseState.java index dabfca848..401ac3373 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/PauseState.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/state/PauseState.java @@ -1,9 +1,9 @@ -package org.springframework.batch.core.job.flow.support; +package org.springframework.batch.core.job.flow.support.state; import org.springframework.batch.core.BatchStatus; import org.springframework.batch.core.JobExecution; import org.springframework.batch.core.job.flow.FlowExecution; -import org.springframework.batch.core.job.flow.JobFlowExecutor; +import org.springframework.batch.core.job.flow.FlowExecutor; /** * @author Dave Syer @@ -19,7 +19,7 @@ public class PauseState extends AbstractState { } @Override - public String handle(JobFlowExecutor executor) throws Exception { + public String handle(FlowExecutor executor) throws Exception { JobExecution jobExecution = executor.getJobExecution(); diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/SplitState.java b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/state/SplitState.java similarity index 90% rename from spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/SplitState.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/state/SplitState.java index c1afeb58b..590e04d86 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/SplitState.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/state/SplitState.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.core.job.flow.support; +package org.springframework.batch.core.job.flow.support.state; import java.util.ArrayList; import java.util.Collection; @@ -23,7 +23,8 @@ import java.util.concurrent.FutureTask; import org.springframework.batch.core.job.flow.Flow; import org.springframework.batch.core.job.flow.FlowExecution; import org.springframework.batch.core.job.flow.FlowExecutionException; -import org.springframework.batch.core.job.flow.JobFlowExecutor; +import org.springframework.batch.core.job.flow.FlowExecutor; +import org.springframework.batch.core.job.flow.support.State; import org.springframework.core.task.SyncTaskExecutor; import org.springframework.core.task.TaskExecutor; import org.springframework.core.task.TaskRejectedException; @@ -63,10 +64,10 @@ public class SplitState extends AbstractState { * Execute the flows in parallel by passing them to the {@link TaskExecutor} * and wait for all of them to finish before proceeding. * - * @see State#handle(JobFlowExecutor) + * @see State#handle(FlowExecutor) */ @Override - public String handle(final JobFlowExecutor executor) throws Exception { + public String handle(final FlowExecutor executor) throws Exception { Collection> tasks = new ArrayList>(); diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/StepState.java b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/state/StepState.java similarity index 54% rename from spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/StepState.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/state/StepState.java index 961f2458a..e888ce188 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/StepState.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/state/StepState.java @@ -1,10 +1,11 @@ -package org.springframework.batch.core.job.flow.support; +package org.springframework.batch.core.job.flow.support.state; import org.springframework.batch.core.Step; -import org.springframework.batch.core.job.flow.JobFlowExecutor; +import org.springframework.batch.core.job.flow.FlowExecutor; +import org.springframework.batch.core.job.flow.support.State; /** - * {@link State} implementation that delegates to a {@link JobFlowExecutor} to + * {@link State} implementation that delegates to a {@link FlowExecutor} to * execute the specified {@link Step}. * * @author Dave Syer @@ -23,7 +24,7 @@ public class StepState extends AbstractState { } @Override - public String handle(JobFlowExecutor executor) throws Exception { + public String handle(FlowExecutor executor) throws Exception { return executor.executeStep(step); } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/PatternMatcher.java b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/util/PatternMatcher.java similarity index 98% rename from spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/PatternMatcher.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/util/PatternMatcher.java index 18b03bc48..4d2c5aa40 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/PatternMatcher.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/job/flow/support/util/PatternMatcher.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.core.job.flow.support; +package org.springframework.batch.core.job.flow.support.util; /** * @author Dave Syer diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DecisionJobParserTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DecisionJobParserTests.java index a907a44e6..fc659b179 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DecisionJobParserTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/DecisionJobParserTests.java @@ -26,7 +26,7 @@ import org.springframework.batch.core.Job; import org.springframework.batch.core.JobExecution; import org.springframework.batch.core.JobParameters; import org.springframework.batch.core.StepExecution; -import org.springframework.batch.core.job.flow.support.JobExecutionDecider; +import org.springframework.batch.core.job.flow.support.state.JobExecutionDecider; import org.springframework.batch.core.repository.JobRepository; import org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean; import org.springframework.beans.factory.annotation.Autowired; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StopJobParserTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StopJobParserTests.java index c5afb63c8..0767cb6e8 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StopJobParserTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StopJobParserTests.java @@ -26,7 +26,7 @@ import org.springframework.batch.core.Job; import org.springframework.batch.core.JobExecution; import org.springframework.batch.core.JobParameters; import org.springframework.batch.core.StepExecution; -import org.springframework.batch.core.job.flow.support.JobExecutionDecider; +import org.springframework.batch.core.job.flow.support.state.JobExecutionDecider; import org.springframework.batch.core.repository.JobRepository; import org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean; import org.springframework.beans.factory.annotation.Autowired; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/job/flow/FlowJobTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/job/flow/FlowJobTests.java index a1325a879..fc0e23490 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/job/flow/FlowJobTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/job/flow/FlowJobTests.java @@ -32,13 +32,13 @@ import org.springframework.batch.core.JobParameters; import org.springframework.batch.core.Step; import org.springframework.batch.core.StepExecution; import org.springframework.batch.core.UnexpectedJobExecutionException; -import org.springframework.batch.core.job.flow.support.DecisionState; -import org.springframework.batch.core.job.flow.support.EndState; -import org.springframework.batch.core.job.flow.support.JobExecutionDecider; -import org.springframework.batch.core.job.flow.support.PauseState; import org.springframework.batch.core.job.flow.support.SimpleFlow; import org.springframework.batch.core.job.flow.support.StateTransition; -import org.springframework.batch.core.job.flow.support.StepState; +import org.springframework.batch.core.job.flow.support.state.DecisionState; +import org.springframework.batch.core.job.flow.support.state.EndState; +import org.springframework.batch.core.job.flow.support.state.JobExecutionDecider; +import org.springframework.batch.core.job.flow.support.state.PauseState; +import org.springframework.batch.core.job.flow.support.state.StepState; import org.springframework.batch.core.repository.JobRepository; import org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean; import org.springframework.batch.core.step.StepSupport; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/job/flow/support/JobFlowExecutorSupport.java b/spring-batch-core/src/test/java/org/springframework/batch/core/job/flow/support/JobFlowExecutorSupport.java index ade45314b..9a6e809ed 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/job/flow/support/JobFlowExecutorSupport.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/job/flow/support/JobFlowExecutorSupport.java @@ -21,14 +21,14 @@ import org.springframework.batch.core.StartLimitExceededException; import org.springframework.batch.core.Step; import org.springframework.batch.core.StepExecution; import org.springframework.batch.core.job.flow.FlowExecution; -import org.springframework.batch.core.job.flow.JobFlowExecutor; +import org.springframework.batch.core.job.flow.FlowExecutor; import org.springframework.batch.core.repository.JobRestartException; /** * @author Dave Syer * */ -public class JobFlowExecutorSupport implements JobFlowExecutor { +public class JobFlowExecutorSupport implements FlowExecutor { public String executeStep(Step step) throws JobInterruptedException, JobRestartException, StartLimitExceededException { diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/job/flow/support/BasicFlowTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/job/flow/support/SimpleFlowTests.java similarity index 96% rename from spring-batch-core/src/test/java/org/springframework/batch/core/job/flow/support/BasicFlowTests.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/job/flow/support/SimpleFlowTests.java index 790e1c221..d28017a83 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/job/flow/support/BasicFlowTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/job/flow/support/SimpleFlowTests.java @@ -27,7 +27,7 @@ import java.util.List; import org.junit.Test; import org.springframework.batch.core.job.flow.FlowExecution; import org.springframework.batch.core.job.flow.FlowExecutionException; -import org.springframework.batch.core.job.flow.JobFlowExecutor; +import org.springframework.batch.core.job.flow.FlowExecutor; import org.springframework.batch.core.job.flow.support.SimpleFlow; import org.springframework.batch.core.job.flow.support.StateTransition; @@ -35,11 +35,11 @@ import org.springframework.batch.core.job.flow.support.StateTransition; * @author Dave Syer * */ -public class BasicFlowTests { +public class SimpleFlowTests { private SimpleFlow flow = new SimpleFlow("job"); - private JobFlowExecutor executor = new JobFlowExecutorSupport(); + private FlowExecutor executor = new JobFlowExecutorSupport(); @Test(expected = IllegalArgumentException.class) public void testEmptySteps() throws Exception { @@ -156,7 +156,7 @@ public class BasicFlowTests { public void testFailedStep() throws Exception { flow.setStateTransitions(collect(StateTransition.createStateTransition(new StubState("step1") { @Override - public String handle(JobFlowExecutor executor) { + public String handle(FlowExecutor executor) { return FlowExecution.FAILED; } }, "step2"), StateTransition.createEndStateTransition(new StubState("step2")))); @@ -185,7 +185,7 @@ public class BasicFlowTests { private boolean paused = false; @Override - public String handle(JobFlowExecutor executor) throws Exception { + public String handle(FlowExecutor executor) throws Exception { if (!paused) { paused = true; return FlowExecution.PAUSED; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/job/flow/support/StateSupport.java b/spring-batch-core/src/test/java/org/springframework/batch/core/job/flow/support/StateSupport.java index a91f57599..22edefc81 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/job/flow/support/StateSupport.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/job/flow/support/StateSupport.java @@ -16,9 +16,9 @@ package org.springframework.batch.core.job.flow.support; import org.springframework.batch.core.job.flow.FlowExecution; -import org.springframework.batch.core.job.flow.JobFlowExecutor; -import org.springframework.batch.core.job.flow.support.AbstractState; +import org.springframework.batch.core.job.flow.FlowExecutor; import org.springframework.batch.core.job.flow.support.State; +import org.springframework.batch.core.job.flow.support.state.AbstractState; /** * Base class for {@link State} implementations. @@ -36,7 +36,7 @@ public class StateSupport extends AbstractState { } @Override - public String handle(JobFlowExecutor executor) throws Exception { + public String handle(FlowExecutor executor) throws Exception { return FlowExecution.COMPLETED; } diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/job/flow/support/EndStateTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/job/flow/support/state/EndStateTests.java similarity index 83% rename from spring-batch-core/src/test/java/org/springframework/batch/core/job/flow/support/EndStateTests.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/job/flow/support/state/EndStateTests.java index 88d667387..6c98d2dc0 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/job/flow/support/EndStateTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/job/flow/support/state/EndStateTests.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.core.job.flow.support; +package org.springframework.batch.core.job.flow.support.state; import static org.junit.Assert.assertEquals; @@ -21,7 +21,9 @@ import org.junit.Before; import org.junit.Test; import org.springframework.batch.core.BatchStatus; import org.springframework.batch.core.JobExecution; -import org.springframework.batch.core.job.flow.JobFlowExecutor; +import org.springframework.batch.core.job.flow.FlowExecutor; +import org.springframework.batch.core.job.flow.support.JobFlowExecutorSupport; +import org.springframework.batch.core.job.flow.support.state.EndState; /** * @author Dave Syer @@ -37,7 +39,7 @@ public class EndStateTests { } /** - * Test method for {@link EndState#handle(JobFlowExecutor)}. + * Test method for {@link EndState#handle(FlowExecutor)}. * @throws Exception */ @Test @@ -58,7 +60,7 @@ public class EndStateTests { } /** - * Test method for {@link EndState#handle(JobFlowExecutor)}. + * Test method for {@link EndState#handle(FlowExecutor)}. * @throws Exception */ @Test @@ -79,7 +81,7 @@ public class EndStateTests { } /** - * Test method for {@link EndState#handle(JobFlowExecutor)}. + * Test method for {@link EndState#handle(FlowExecutor)}. * @throws Exception */ @Test diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/job/flow/support/SimpleFlowExecutionAggregatorTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/job/flow/support/state/SimpleFlowExecutionAggregatorTests.java similarity index 91% rename from spring-batch-core/src/test/java/org/springframework/batch/core/job/flow/support/SimpleFlowExecutionAggregatorTests.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/job/flow/support/state/SimpleFlowExecutionAggregatorTests.java index 763394807..e0838084a 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/job/flow/support/SimpleFlowExecutionAggregatorTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/job/flow/support/state/SimpleFlowExecutionAggregatorTests.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.core.job.flow.support; +package org.springframework.batch.core.job.flow.support.state; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; @@ -23,7 +23,7 @@ import java.util.Collections; import org.junit.Test; import org.springframework.batch.core.job.flow.FlowExecution; -import org.springframework.batch.core.job.flow.support.MaxValueFlowExecutionAggregator; +import org.springframework.batch.core.job.flow.support.state.MaxValueFlowExecutionAggregator; /** * @author Dave Syer diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/job/flow/support/SplitStateTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/job/flow/support/state/SplitStateTests.java similarity index 94% rename from spring-batch-core/src/test/java/org/springframework/batch/core/job/flow/support/SplitStateTests.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/job/flow/support/state/SplitStateTests.java index 201bf1098..22cae8351 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/job/flow/support/SplitStateTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/job/flow/support/state/SplitStateTests.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.core.job.flow.support; +package org.springframework.batch.core.job.flow.support.state; import static org.junit.Assert.assertEquals; @@ -24,7 +24,7 @@ import org.easymock.EasyMock; import org.junit.Test; import org.springframework.batch.core.job.flow.Flow; import org.springframework.batch.core.job.flow.FlowExecution; -import org.springframework.batch.core.job.flow.support.SplitState; +import org.springframework.batch.core.job.flow.support.state.SplitState; import org.springframework.core.task.SimpleAsyncTaskExecutor;