Introduce KeyedItemReader to push the getKey() method into a separate place.
This commit is contained in:
@@ -18,7 +18,6 @@ package org.springframework.batch.core.domain;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.batch.io.exception.BatchCriticalException;
|
||||
import org.springframework.batch.repeat.ExitStatus;
|
||||
|
||||
/**
|
||||
* Batch domain object representing a job. Job is an explicit abstraction
|
||||
@@ -39,6 +38,6 @@ public interface Job {
|
||||
|
||||
boolean isRestartable();
|
||||
|
||||
ExitStatus run(JobExecution execution) throws BatchCriticalException;
|
||||
void run(JobExecution execution) throws BatchCriticalException;
|
||||
|
||||
}
|
||||
@@ -20,7 +20,6 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.batch.io.exception.BatchCriticalException;
|
||||
import org.springframework.batch.repeat.ExitStatus;
|
||||
import org.springframework.beans.factory.BeanNameAware;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
@@ -134,7 +133,7 @@ public class JobSupport implements BeanNameAware, Job {
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.domain.Job#run(org.springframework.batch.core.domain.JobExecution)
|
||||
*/
|
||||
public ExitStatus run(JobExecution execution) throws BatchCriticalException {
|
||||
public void run(JobExecution execution) throws BatchCriticalException {
|
||||
throw new UnsupportedOperationException("JobSupport does not provide an implementation of run(). Use a smarter subclass.");
|
||||
}
|
||||
|
||||
|
||||
@@ -16,14 +16,12 @@
|
||||
package org.springframework.batch.core.domain;
|
||||
|
||||
import org.springframework.batch.io.exception.BatchCriticalException;
|
||||
import org.springframework.batch.repeat.ExitStatus;
|
||||
|
||||
|
||||
/**
|
||||
* Batch domain interface representing the configuration of a step. As with the
|
||||
* (@link Job), step configuration is meant to explicitly represent
|
||||
* a the configuration of a step by a developer. This allows for the separation
|
||||
* of what a developer configures from the myriad of concerns required for
|
||||
* (@link Job), step configuration is meant to explicitly represent a the
|
||||
* configuration of a step by a developer. This allows for the separation of
|
||||
* what a developer configures from the myriad of concerns required for
|
||||
* executing a job.
|
||||
*
|
||||
* @author Dave Syer
|
||||
@@ -41,7 +39,7 @@ public interface Step {
|
||||
* again.
|
||||
*/
|
||||
boolean isAllowStartIfComplete();
|
||||
|
||||
|
||||
/**
|
||||
* Flag to indicate if restart data needs to be saved for this step.
|
||||
* @return true if restart data should be saved
|
||||
@@ -53,11 +51,15 @@ public interface Step {
|
||||
* identifier.
|
||||
*/
|
||||
int getStartLimit();
|
||||
|
||||
|
||||
/**
|
||||
* It is not safe to re-use an instance of {@link StepExecutor} to process
|
||||
* multiple concurrent executions. Use the factory method in {@link Step} to
|
||||
* create a new instance and execute that.
|
||||
* Process the step and assign progress and status meta information to the
|
||||
* {@link StepExecution} provided. The {@link Step} is responsible for
|
||||
* setting the meta information and also saving it if required by the
|
||||
* implementation.<br/>
|
||||
*
|
||||
* It is not safe to re-use an instance of {@link Step} to process multiple
|
||||
* concurrent executions.
|
||||
*
|
||||
* @param stepExecution an entity representing the step to be executed
|
||||
*
|
||||
@@ -65,6 +67,6 @@ public interface Step {
|
||||
* @throws BatchCriticalException if there is a problem that needs to be
|
||||
* signalled to the caller
|
||||
*/
|
||||
ExitStatus process(StepExecution stepExecution) throws StepInterruptedException, BatchCriticalException;
|
||||
void process(StepExecution stepExecution) throws StepInterruptedException, BatchCriticalException;
|
||||
|
||||
}
|
||||
@@ -136,7 +136,7 @@ public class StepSupport implements Step, BeanNameAware {
|
||||
*
|
||||
* @see org.springframework.batch.core.domain.Step#process(org.springframework.batch.core.domain.StepExecution)
|
||||
*/
|
||||
public org.springframework.batch.repeat.ExitStatus process(StepExecution stepExecution)
|
||||
public void process(StepExecution stepExecution)
|
||||
throws StepInterruptedException, BatchCriticalException {
|
||||
throw new UnsupportedOperationException(
|
||||
"Cannot process a StepExecution. Use a smarter subclass of StepSupport.");
|
||||
|
||||
Reference in New Issue
Block a user