Updated to handle the transition between splits and decisions
This commit is contained in:
@@ -173,7 +173,7 @@ public class SimpleFlowFactoryBean implements FactoryBean, InitializingBean {
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
private static class DelegateState extends AbstractState implements FlowHolder {
|
||||
public static class DelegateState extends AbstractState implements FlowHolder {
|
||||
private final State state;
|
||||
|
||||
private DelegateState(String name, State state) {
|
||||
@@ -181,6 +181,10 @@ public class SimpleFlowFactoryBean implements FactoryBean, InitializingBean {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public State getState() {
|
||||
return this.state;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEndState() {
|
||||
return state.isEndState();
|
||||
|
||||
@@ -79,6 +79,10 @@ public class SimpleFlow implements Flow, InitializingBean {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public State getStartState() {
|
||||
return this.startState;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name for this flow.
|
||||
*
|
||||
@@ -229,7 +233,7 @@ public class SimpleFlow implements Flow, InitializingBean {
|
||||
|
||||
}
|
||||
|
||||
private boolean isFlowContinued(State state, FlowExecutionStatus status, StepExecution stepExecution) {
|
||||
protected boolean isFlowContinued(State state, FlowExecutionStatus status, StepExecution stepExecution) {
|
||||
boolean continued = true;
|
||||
|
||||
continued = state != null && status!=FlowExecutionStatus.STOPPED;
|
||||
|
||||
@@ -19,12 +19,20 @@ import org.springframework.batch.core.ExitStatus;
|
||||
import org.springframework.batch.core.JobExecution;
|
||||
import org.springframework.batch.core.JobExecutionException;
|
||||
import org.springframework.batch.core.JobInterruptedException;
|
||||
import org.springframework.batch.core.Step;
|
||||
import org.springframework.batch.core.configuration.xml.SimpleFlowFactoryBean.DelegateState;
|
||||
import org.springframework.batch.core.explore.JobExplorer;
|
||||
import org.springframework.batch.core.job.AbstractJob;
|
||||
import org.springframework.batch.core.job.flow.Flow;
|
||||
import org.springframework.batch.core.job.flow.FlowExecutionException;
|
||||
import org.springframework.batch.core.job.flow.FlowJob;
|
||||
import org.springframework.batch.core.job.flow.JobFlowExecutor;
|
||||
import org.springframework.batch.core.job.flow.State;
|
||||
import org.springframework.batch.core.job.flow.support.state.FlowState;
|
||||
import org.springframework.batch.core.job.flow.support.state.StepState;
|
||||
import org.springframework.batch.core.jsr.job.DefaultStepHandler;
|
||||
import org.springframework.batch.core.jsr.job.flow.support.DefaultFlow;
|
||||
import org.springframework.batch.core.jsr.step.DecisionStep;
|
||||
import org.springframework.batch.core.launch.NoSuchJobException;
|
||||
import org.springframework.batch.core.launch.support.ExitCodeMapper;
|
||||
|
||||
@@ -66,6 +74,11 @@ public class JsrFlowJob extends FlowJob {
|
||||
try {
|
||||
JobFlowExecutor executor = new JsrFlowExecutor(getJobRepository(),
|
||||
new DefaultStepHandler(getJobRepository(), jobExplorer), execution);
|
||||
|
||||
State startState = ((DefaultFlow)flow).getStartState();
|
||||
|
||||
validateFirstStep(startState);
|
||||
|
||||
executor.updateJobExecutionStatus(flow.start(executor).getStatus());
|
||||
}
|
||||
catch (FlowExecutionException e) {
|
||||
@@ -76,6 +89,28 @@ public class JsrFlowJob extends FlowJob {
|
||||
}
|
||||
}
|
||||
|
||||
private void validateFirstStep(State startState)
|
||||
throws JobExecutionException {
|
||||
while(true) {
|
||||
if(startState instanceof DelegateState) {
|
||||
startState = ((DelegateState) startState).getState();
|
||||
} else if(startState instanceof StepState) {
|
||||
String stepName = startState.getName().substring(startState.getName().indexOf(".") + 1, startState.getName().length());
|
||||
Step step = ((StepState) startState).getStep(stepName);
|
||||
if(step instanceof DecisionStep) {
|
||||
throw new JobExecutionException("Invalid first step");
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
} else if(startState instanceof FlowState){
|
||||
Flow firstFlow = ((FlowState) startState).getFlows().iterator().next();
|
||||
startState = firstFlow.getStates().iterator().next();
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Default mapping from throwable to {@link ExitStatus}.
|
||||
*
|
||||
|
||||
@@ -20,12 +20,14 @@ import java.util.Set;
|
||||
import org.springframework.batch.core.JobExecutionException;
|
||||
import org.springframework.batch.core.Step;
|
||||
import org.springframework.batch.core.StepExecution;
|
||||
import org.springframework.batch.core.configuration.xml.SimpleFlowFactoryBean.DelegateState;
|
||||
import org.springframework.batch.core.job.flow.Flow;
|
||||
import org.springframework.batch.core.job.flow.FlowExecutionException;
|
||||
import org.springframework.batch.core.job.flow.FlowExecutionStatus;
|
||||
import org.springframework.batch.core.job.flow.State;
|
||||
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.state.StepState;
|
||||
import org.springframework.batch.item.ExecutionContext;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
@@ -41,6 +43,8 @@ import org.springframework.util.StringUtils;
|
||||
*/
|
||||
public class DefaultFlow extends SimpleFlow {
|
||||
|
||||
private StepState currentStep;
|
||||
|
||||
/**
|
||||
* @param name name of the flow
|
||||
*/
|
||||
@@ -48,6 +52,27 @@ public class DefaultFlow extends SimpleFlow {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public String getMostRecentStepName() {
|
||||
if(currentStep != null) {
|
||||
return currentStep.getStep().getName();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isFlowContinued(State state, FlowExecutionStatus status, StepExecution stepExecution) {
|
||||
if(state instanceof DelegateState) {
|
||||
state = ((DelegateState) state).getState();
|
||||
}
|
||||
|
||||
if(state instanceof StepState) {
|
||||
currentStep = (StepState) state;
|
||||
}
|
||||
|
||||
return super.isFlowContinued(state, status, stepExecution);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected State nextState(String stateName, FlowExecutionStatus status, StepExecution stepExecution) throws FlowExecutionException {
|
||||
State nextState = findState(stateName, status, stepExecution);
|
||||
|
||||
@@ -15,13 +15,16 @@
|
||||
*/
|
||||
package org.springframework.batch.core.jsr.job.flow.support.state;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.batch.core.JobExecution;
|
||||
import org.springframework.batch.core.job.flow.Flow;
|
||||
import org.springframework.batch.core.job.flow.FlowExecution;
|
||||
import org.springframework.batch.core.job.flow.FlowExecutionStatus;
|
||||
import org.springframework.batch.core.job.flow.FlowExecutor;
|
||||
import org.springframework.batch.core.jsr.job.flow.support.DefaultFlow;
|
||||
|
||||
/**
|
||||
* JSR-352 states that artifacts cannot set the ExitStatus from within a split for a job. Because
|
||||
@@ -50,6 +53,19 @@ public class SplitState extends org.springframework.batch.core.job.flow.support.
|
||||
*/
|
||||
@Override
|
||||
protected FlowExecutionStatus doAggregation(Collection<FlowExecution> results, FlowExecutor executor) {
|
||||
List<String> stepNames = new ArrayList<String>();
|
||||
|
||||
for (Flow curFlow : getFlows()) {
|
||||
DefaultFlow flow = (DefaultFlow) curFlow;
|
||||
if(flow.getMostRecentStepName() != null) {
|
||||
stepNames.add(flow.getMostRecentStepName());
|
||||
}
|
||||
}
|
||||
|
||||
if(!stepNames.isEmpty()) {
|
||||
executor.getJobExecution().getExecutionContext().put("batch.splitLastSteps", stepNames);
|
||||
}
|
||||
|
||||
executor.getJobExecution().setExitStatus(null);
|
||||
|
||||
return super.doAggregation(results, executor);
|
||||
|
||||
@@ -15,15 +15,17 @@
|
||||
*/
|
||||
package org.springframework.batch.core.jsr.step;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import javax.batch.api.Decider;
|
||||
import javax.batch.operations.BatchRuntimeException;
|
||||
|
||||
import org.springframework.batch.core.ExitStatus;
|
||||
import org.springframework.batch.core.Step;
|
||||
import org.springframework.batch.core.StepExecution;
|
||||
import org.springframework.batch.core.step.AbstractStep;
|
||||
import org.springframework.batch.item.ExecutionContext;
|
||||
|
||||
/**
|
||||
* Implements a {@link Step} to follow the rules for a decision state
|
||||
@@ -47,34 +49,41 @@ public class DecisionStep extends AbstractStep {
|
||||
|
||||
@Override
|
||||
protected void doExecute(StepExecution stepExecution) throws Exception {
|
||||
Collection<StepExecution> stepExecutions = stepExecution.getJobExecution().getStepExecutions();
|
||||
ExecutionContext executionContext = stepExecution.getJobExecution().getExecutionContext();
|
||||
List<javax.batch.runtime.StepExecution> stepExecutions = new ArrayList<javax.batch.runtime.StepExecution>();
|
||||
|
||||
// Used to determine if this step is the first step in the job (not allowed)
|
||||
if(stepExecutions.size() == 1) {
|
||||
stepExecution.setTerminateOnly();
|
||||
throw new BatchRuntimeException("Decision not a valid first step");
|
||||
}
|
||||
if(executionContext.containsKey("batch.splitLastSteps")) {
|
||||
List<String> stepNames = (List<String>) executionContext.get("batch.splitLastSteps");
|
||||
|
||||
// Currently does not support splits
|
||||
StepExecution lastExecution = null;
|
||||
for (String stepName : stepNames) {
|
||||
StepExecution curStepExecution = getJobRepository().getLastStepExecution(stepExecution.getJobExecution().getJobInstance(), stepName);
|
||||
stepExecutions.add(new org.springframework.batch.core.jsr.StepExecution(curStepExecution));
|
||||
}
|
||||
} else {
|
||||
Collection<StepExecution> currentRunStepExecutions = stepExecution.getJobExecution().getStepExecutions();
|
||||
|
||||
if(stepExecutions != null) {
|
||||
for (StepExecution curStepExecution : stepExecutions) {
|
||||
if(lastExecution == null || (curStepExecution.getEndTime() != null && curStepExecution.getEndTime().after(lastExecution.getEndTime()))) {
|
||||
lastExecution = curStepExecution;
|
||||
StepExecution lastExecution = null;
|
||||
|
||||
if(stepExecutions != null) {
|
||||
for (StepExecution curStepExecution : currentRunStepExecutions) {
|
||||
if(lastExecution == null || (curStepExecution.getEndTime() != null && curStepExecution.getEndTime().after(lastExecution.getEndTime()))) {
|
||||
lastExecution = curStepExecution;
|
||||
}
|
||||
}
|
||||
|
||||
stepExecutions.add(new org.springframework.batch.core.jsr.StepExecution(lastExecution));
|
||||
}
|
||||
}
|
||||
|
||||
javax.batch.runtime.StepExecution [] executions = new org.springframework.batch.core.jsr.StepExecution[1];
|
||||
|
||||
executions[0] = new org.springframework.batch.core.jsr.StepExecution(lastExecution);
|
||||
|
||||
try {
|
||||
ExitStatus exitStatus = new ExitStatus(decider.decide(executions));
|
||||
ExitStatus exitStatus = new ExitStatus(decider.decide(stepExecutions.toArray(new javax.batch.runtime.StepExecution[0])));
|
||||
|
||||
stepExecution.getJobExecution().setExitStatus(exitStatus);
|
||||
stepExecution.setExitStatus(exitStatus);
|
||||
|
||||
if(executionContext.containsKey("batch.splitLastSteps")) {
|
||||
executionContext.remove("batch.splitLastSteps");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
stepExecution.setTerminateOnly();
|
||||
stepExecution.addFailureException(e);
|
||||
|
||||
@@ -1,120 +1,118 @@
|
||||
package org.springframework.batch.core.jsr.step;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.springframework.batch.core.jsr.JsrTestUtils.runJob;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.batch.api.Decider;
|
||||
import javax.batch.runtime.BatchRuntime;
|
||||
import javax.batch.runtime.BatchStatus;
|
||||
import javax.batch.runtime.JobExecution;
|
||||
import javax.batch.runtime.StepExecution;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.batch.core.BatchStatus;
|
||||
import org.springframework.batch.core.Job;
|
||||
import org.springframework.batch.core.JobExecution;
|
||||
import org.springframework.batch.core.JobParameters;
|
||||
import org.springframework.batch.core.launch.JobLauncher;
|
||||
import org.springframework.batch.core.explore.JobExplorer;
|
||||
import org.springframework.beans.factory.access.BeanFactoryLocator;
|
||||
import org.springframework.beans.factory.access.BeanFactoryReference;
|
||||
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.support.GenericXmlApplicationContext;
|
||||
import org.springframework.context.access.ContextSingletonBeanFactoryLocator;
|
||||
|
||||
@SuppressWarnings("resource")
|
||||
public class DecisionStepTests {
|
||||
|
||||
private static ApplicationContext baseContext;
|
||||
|
||||
public JobExplorer jobExplorer;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
StepExecutionCountingDecider.previousStepCount = 0;
|
||||
|
||||
if(jobExplorer == null) {
|
||||
BeanFactoryLocator beanFactoryLocactor = ContextSingletonBeanFactoryLocator.getInstance();
|
||||
BeanFactoryReference ref = beanFactoryLocactor.useBeanFactory("baseContext");
|
||||
baseContext = (ApplicationContext) ref.getFactory();
|
||||
|
||||
baseContext.getAutowireCapableBeanFactory().autowireBeanProperties(this,
|
||||
AutowireCapableBeanFactory.AUTOWIRE_BY_NAME, false);
|
||||
}
|
||||
}
|
||||
|
||||
public void setJobExplorer(JobExplorer jobExplorer) {
|
||||
this.jobExplorer = jobExplorer;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDecisionAsFirstStepOfJob() throws Exception {
|
||||
ApplicationContext context = new GenericXmlApplicationContext("classpath:/org/springframework/batch/core/jsr/step/DecisionStepTests-decisionAsFirstStep-context.xml");
|
||||
|
||||
JobLauncher launcher = context.getBean(JobLauncher.class);
|
||||
Job job = context.getBean(Job.class);
|
||||
|
||||
JobExecution execution = launcher.run(job, new JobParameters());
|
||||
assertEquals(BatchStatus.FAILED, execution.getStatus());
|
||||
assertEquals(1, execution.getStepExecutions().size());
|
||||
JobExecution execution = runJob("DecisionStepTests-decisionAsFirstStep-context", new Properties(), 10000l);
|
||||
assertEquals(BatchStatus.FAILED, execution.getBatchStatus());
|
||||
assertEquals(0, BatchRuntime.getJobOperator().getStepExecutions(execution.getExecutionId()).size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDecisionThrowsException() throws Exception {
|
||||
ApplicationContext context = new GenericXmlApplicationContext("classpath:/org/springframework/batch/core/jsr/step/DecisionStepTests-decisionThrowsException-context.xml");
|
||||
|
||||
JobLauncher launcher = context.getBean(JobLauncher.class);
|
||||
Job job = context.getBean(Job.class);
|
||||
|
||||
JobExecution execution = launcher.run(job, new JobParameters());
|
||||
assertEquals(BatchStatus.FAILED, execution.getStatus());
|
||||
assertEquals(2, execution.getStepExecutions().size());
|
||||
List<Throwable> allFailureExceptions = execution.getAllFailureExceptions();
|
||||
|
||||
boolean found = false;
|
||||
for (Throwable throwable : allFailureExceptions) {
|
||||
if(throwable.getMessage().equals("Expected")) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!found) {
|
||||
fail();
|
||||
}
|
||||
JobExecution execution = runJob("DecisionStepTests-decisionThrowsException-context", new Properties(), 10000l);
|
||||
assertEquals(BatchStatus.FAILED, execution.getBatchStatus());
|
||||
assertEquals(2, BatchRuntime.getJobOperator().getStepExecutions(execution.getExecutionId()).size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDecisionValidExitStatus() throws Exception {
|
||||
ApplicationContext context = new GenericXmlApplicationContext("classpath:/org/springframework/batch/core/jsr/step/DecisionStepTests-decisionValidExitStatus-context.xml");
|
||||
|
||||
JobLauncher launcher = context.getBean(JobLauncher.class);
|
||||
Job job = context.getBean(Job.class);
|
||||
|
||||
JobExecution execution = launcher.run(job, new JobParameters());
|
||||
assertEquals(BatchStatus.COMPLETED, execution.getStatus());
|
||||
assertEquals(3, execution.getStepExecutions().size());
|
||||
JobExecution execution = runJob("DecisionStepTests-decisionValidExitStatus-context", new Properties(), 10000l);
|
||||
assertEquals(BatchStatus.COMPLETED, execution.getBatchStatus());
|
||||
assertEquals(3, BatchRuntime.getJobOperator().getStepExecutions(execution.getExecutionId()).size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDecisionUnmappedExitStatus() throws Exception {
|
||||
ApplicationContext context = new GenericXmlApplicationContext("classpath:/org/springframework/batch/core/jsr/step/DecisionStepTests-decisionInvalidExitStatus-context.xml");
|
||||
JobExecution execution = runJob("DecisionStepTests-decisionInvalidExitStatus-context", new Properties(), 10000l);
|
||||
assertEquals(BatchStatus.COMPLETED, execution.getBatchStatus());
|
||||
List<StepExecution> stepExecutions = BatchRuntime.getJobOperator().getStepExecutions(execution.getExecutionId());
|
||||
assertEquals(2, stepExecutions.size());
|
||||
|
||||
JobLauncher launcher = context.getBean(JobLauncher.class);
|
||||
Job job = context.getBean(Job.class);
|
||||
|
||||
JobExecution execution = launcher.run(job, new JobParameters());
|
||||
assertEquals(BatchStatus.COMPLETED, execution.getStatus());
|
||||
assertEquals(2, execution.getStepExecutions().size());
|
||||
|
||||
for (org.springframework.batch.core.StepExecution curExecution : execution.getStepExecutions()) {
|
||||
assertEquals(BatchStatus.COMPLETED, curExecution.getStatus());
|
||||
for (StepExecution curExecution : stepExecutions) {
|
||||
assertEquals(BatchStatus.COMPLETED, curExecution.getBatchStatus());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDecisionCustomExitStatus() throws Exception {
|
||||
ApplicationContext context = new GenericXmlApplicationContext("classpath:/org/springframework/batch/core/jsr/step/DecisionStepTests-decisionCustomExitStatus-context.xml");
|
||||
|
||||
JobLauncher launcher = context.getBean(JobLauncher.class);
|
||||
Job job = context.getBean(Job.class);
|
||||
|
||||
JobExecution execution = launcher.run(job, new JobParameters());
|
||||
assertEquals(BatchStatus.FAILED, execution.getStatus());
|
||||
assertEquals(2, execution.getStepExecutions().size());
|
||||
assertEquals("CustomFail", execution.getExitStatus().getExitCode());
|
||||
JobExecution execution = runJob("DecisionStepTests-decisionCustomExitStatus-context", new Properties(), 10000l);
|
||||
assertEquals(BatchStatus.FAILED, execution.getBatchStatus());
|
||||
assertEquals(2, BatchRuntime.getJobOperator().getStepExecutions(execution.getExecutionId()).size());
|
||||
assertEquals("CustomFail", execution.getExitStatus());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore("Flows as first steps are not supported yet")
|
||||
public void testDecisionAfterFlow() throws Exception {
|
||||
ApplicationContext context = new GenericXmlApplicationContext("classpath:/org/springframework/batch/core/jsr/step/DecisionStepTests-decisionAfterFlow-context.xml");
|
||||
|
||||
JobLauncher launcher = context.getBean(JobLauncher.class);
|
||||
Job job = context.getBean(Job.class);
|
||||
|
||||
JobExecution execution = launcher.run(job, new JobParameters());
|
||||
assertEquals(BatchStatus.COMPLETED, execution.getStatus());
|
||||
assertEquals(3, execution.getStepExecutions().size());
|
||||
JobExecution execution = runJob("DecisionStepTests-decisionAfterFlow-context", new Properties(), 10000l);
|
||||
assertEquals(BatchStatus.COMPLETED, execution.getBatchStatus());
|
||||
assertEquals(3, BatchRuntime.getJobOperator().getStepExecutions(execution.getExecutionId()).size());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore("Splits are not implemented yet as part of our JSR implementation")
|
||||
public void testDecisionAfterSplit() {
|
||||
public void testDecisionAfterSplit() throws Exception {
|
||||
JobExecution execution = runJob("DecisionStepTests-decisionAfterSplit-context", new Properties(), 10000l);
|
||||
assertEquals(BatchStatus.COMPLETED, execution.getBatchStatus());
|
||||
assertEquals(4, BatchRuntime.getJobOperator().getStepExecutions(execution.getExecutionId()).size());
|
||||
assertEquals(2, StepExecutionCountingDecider.previousStepCount);
|
||||
}
|
||||
|
||||
public static class StepExecutionCountingDecider implements Decider {
|
||||
|
||||
static int previousStepCount = 0;
|
||||
|
||||
@Override
|
||||
public String decide(StepExecution[] executions) throws Exception {
|
||||
for (StepExecution stepExecution : executions) {
|
||||
System.err.println(stepExecution.getStepName());
|
||||
}
|
||||
previousStepCount = executions.length;
|
||||
return "next";
|
||||
}
|
||||
}
|
||||
|
||||
public static class NextDecider implements Decider {
|
||||
|
||||
@@ -18,18 +18,6 @@
|
||||
</step>
|
||||
</job>
|
||||
|
||||
<bean id="transactionManager" class="org.springframework.batch.support.transaction.ResourcelessTransactionManager"/>
|
||||
|
||||
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
|
||||
<property name="jobRepository" ref="jobRepository"/>
|
||||
</bean>
|
||||
|
||||
<bean id="jobRepository" class="org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean"/>
|
||||
|
||||
<bean id="jobExplorer" class="org.springframework.batch.core.explore.support.MapJobExplorerFactoryBean">
|
||||
<property name="repositoryFactory" ref="&jobRepository"/>
|
||||
</bean>
|
||||
|
||||
<bean id="nextDecider" class="org.springframework.batch.core.jsr.step.DecisionStepTests$NextDecider"/>
|
||||
|
||||
<bean id="doSomethingBatchlet" class="org.springframework.batch.core.jsr.step.batchlet.BatchletSupport"/>
|
||||
@@ -4,27 +4,28 @@
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/jobXML_1_0.xsd">
|
||||
<job id="job1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0">
|
||||
<split id="spit1" next="decision1">
|
||||
<flow id="flow1">
|
||||
<step id="flow1.step1">
|
||||
<batchlet ref="doSomethingBatchlet"/>
|
||||
</step>
|
||||
</flow>
|
||||
<flow id="flow2">
|
||||
<step id="flow2.step1">
|
||||
<batchlet ref="doSomethingBatchlet"/>
|
||||
</step>
|
||||
</flow>
|
||||
</split>
|
||||
<decision ref="nextDecider" id="decision1">
|
||||
<next on="*" to="step2"/>
|
||||
<next on="next" to="step1"/>
|
||||
<end on="*"/>
|
||||
</decision>
|
||||
<step id="step2">
|
||||
<step id="step1">
|
||||
<batchlet ref="doSomethingBatchlet"/>
|
||||
</step>
|
||||
</job>
|
||||
|
||||
<bean id="transactionManager" class="org.springframework.batch.support.transaction.ResourcelessTransactionManager"/>
|
||||
|
||||
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
|
||||
<property name="jobRepository" ref="jobRepository"/>
|
||||
</bean>
|
||||
|
||||
<bean id="jobRepository" class="org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean"/>
|
||||
|
||||
<bean id="jobExplorer" class="org.springframework.batch.core.explore.support.MapJobExplorerFactoryBean">
|
||||
<property name="repositoryFactory" ref="&jobRepository"/>
|
||||
</bean>
|
||||
|
||||
<bean id="nextDecider" class="org.springframework.batch.core.jsr.step.DecisionStepTests$NextDecider"/>
|
||||
<bean id="nextDecider" class="org.springframework.batch.core.jsr.step.DecisionStepTests$StepExecutionCountingDecider"/>
|
||||
|
||||
<bean id="doSomethingBatchlet" class="org.springframework.batch.core.jsr.step.batchlet.BatchletSupport"/>
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/jobXML_1_0.xsd">
|
||||
<job id="job1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0">
|
||||
<decision ref="org.springframework.batch.core.jsr.step.DecisionStepTests$NextDecider" id="decision1">
|
||||
<next on="*" to="step2"/>
|
||||
</decision>
|
||||
<step id="step2">
|
||||
<batchlet ref="org.springframework.batch.core.jsr.step.batchlet.BatchletSupport"/>
|
||||
</step>
|
||||
</job>
|
||||
</beans>
|
||||
@@ -12,18 +12,6 @@
|
||||
</decision>
|
||||
</job>
|
||||
|
||||
<bean id="transactionManager" class="org.springframework.batch.support.transaction.ResourcelessTransactionManager"/>
|
||||
|
||||
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
|
||||
<property name="jobRepository" ref="jobRepository"/>
|
||||
</bean>
|
||||
|
||||
<bean id="jobRepository" class="org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean"/>
|
||||
|
||||
<bean id="jobExplorer" class="org.springframework.batch.core.explore.support.MapJobExplorerFactoryBean">
|
||||
<property name="repositoryFactory" ref="&jobRepository"/>
|
||||
</bean>
|
||||
|
||||
<bean id="nextDecider" class="org.springframework.batch.core.jsr.step.DecisionStepTests$NextDecider"/>
|
||||
|
||||
<bean id="doSomethingBatchlet" class="org.springframework.batch.core.jsr.step.batchlet.BatchletSupport"/>
|
||||
@@ -15,18 +15,6 @@
|
||||
</step>
|
||||
</job>
|
||||
|
||||
<bean id="transactionManager" class="org.springframework.batch.support.transaction.ResourcelessTransactionManager"/>
|
||||
|
||||
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
|
||||
<property name="jobRepository" ref="jobRepository"/>
|
||||
</bean>
|
||||
|
||||
<bean id="jobRepository" class="org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean"/>
|
||||
|
||||
<bean id="jobExplorer" class="org.springframework.batch.core.explore.support.MapJobExplorerFactoryBean">
|
||||
<property name="repositoryFactory" ref="&jobRepository"/>
|
||||
</bean>
|
||||
|
||||
<bean id="nextDecider" class="org.springframework.batch.core.jsr.step.DecisionStepTests$NextDecider"/>
|
||||
|
||||
<bean id="doSomethingBatchlet" class="org.springframework.batch.core.jsr.step.batchlet.BatchletSupport"/>
|
||||
@@ -15,18 +15,6 @@
|
||||
</step>
|
||||
</job>
|
||||
|
||||
<bean id="transactionManager" class="org.springframework.batch.support.transaction.ResourcelessTransactionManager"/>
|
||||
|
||||
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
|
||||
<property name="jobRepository" ref="jobRepository"/>
|
||||
</bean>
|
||||
|
||||
<bean id="jobRepository" class="org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean"/>
|
||||
|
||||
<bean id="jobExplorer" class="org.springframework.batch.core.explore.support.MapJobExplorerFactoryBean">
|
||||
<property name="repositoryFactory" ref="&jobRepository"/>
|
||||
</bean>
|
||||
|
||||
<bean id="failureDecider" class="org.springframework.batch.core.jsr.step.DecisionStepTests$FailureDecider"/>
|
||||
|
||||
<bean id="doSomethingBatchlet" class="org.springframework.batch.core.jsr.step.batchlet.BatchletSupport"/>
|
||||
@@ -16,18 +16,6 @@
|
||||
</step>
|
||||
</job>
|
||||
|
||||
<bean id="transactionManager" class="org.springframework.batch.support.transaction.ResourcelessTransactionManager"/>
|
||||
|
||||
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
|
||||
<property name="jobRepository" ref="jobRepository"/>
|
||||
</bean>
|
||||
|
||||
<bean id="jobRepository" class="org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean"/>
|
||||
|
||||
<bean id="jobExplorer" class="org.springframework.batch.core.explore.support.MapJobExplorerFactoryBean">
|
||||
<property name="repositoryFactory" ref="&jobRepository"/>
|
||||
</bean>
|
||||
|
||||
<bean id="nextDecider" class="org.springframework.batch.core.jsr.step.DecisionStepTests$NextDecider"/>
|
||||
|
||||
<bean id="doSomethingBatchlet" class="org.springframework.batch.core.jsr.step.batchlet.BatchletSupport"/>
|
||||
Reference in New Issue
Block a user