BATCH-220: Half way to rename StepHandler -> Tasklet

This commit is contained in:
dsyer
2008-08-28 10:38:26 +00:00
parent 223a58da18
commit ad5b0010dd
38 changed files with 200 additions and 110 deletions

View File

@@ -12,16 +12,22 @@ import org.springframework.batch.item.validator.ValidationException;
public class ItemTrackingItemWriter<T> implements ItemWriter<T> {
private List<T> items = new ArrayList<T>();
private T failed = null;
private int failure = -1;
private int counter = 0;
public void write(List<? extends T> item) throws Exception {
items.addAll(item);
public void write(List<? extends T> items) throws Exception {
if (failed!=null && items.contains(failed)) {
throw new ValidationException("validation failed");
}
this.items.addAll(items);
int current = counter;
counter += item.size();
counter += items.size();
if (current < failure && counter >= failure) {
failed = items.get(failure-current-1);
throw new ValidationException("validation failed");
}
}

View File

@@ -5,7 +5,7 @@ import org.apache.commons.logging.LogFactory;
import org.springframework.batch.core.StepContribution;
import org.springframework.batch.core.StepExecution;
import org.springframework.batch.core.listener.StepExecutionListenerSupport;
import org.springframework.batch.core.step.handler.StepHandler;
import org.springframework.batch.core.step.tasklet.StepHandler;
import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.repeat.ExitStatus;
import org.springframework.core.AttributeAccessor;

View File

@@ -5,7 +5,7 @@ import org.apache.commons.logging.LogFactory;
import org.springframework.batch.core.StepContribution;
import org.springframework.batch.core.StepExecution;
import org.springframework.batch.core.listener.StepExecutionListenerSupport;
import org.springframework.batch.core.step.handler.StepHandler;
import org.springframework.batch.core.step.tasklet.StepHandler;
import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.repeat.ExitStatus;
import org.springframework.core.AttributeAccessor;

View File

@@ -2,7 +2,7 @@ package org.springframework.batch.sample.tasklet;
import org.springframework.batch.core.StepContribution;
import org.springframework.batch.core.UnexpectedJobExecutionException;
import org.springframework.batch.core.step.handler.StepHandler;
import org.springframework.batch.core.step.tasklet.StepHandler;
import org.springframework.batch.repeat.ExitStatus;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.core.AttributeAccessor;