OPEN - issue BATCH-404: FactoryBeans for step configuration

http://jira.springframework.org/browse/BATCH-404

Let the factory bean take care of chunk and item listener callbacks.  ItemOrientedStep is much simpler as a result.
This commit is contained in:
dsyer
2008-03-02 15:03:12 +00:00
parent 81b9b5ebc8
commit bbeeee32d3
8 changed files with 204 additions and 114 deletions

View File

@@ -31,6 +31,21 @@ import org.springframework.util.Assert;
public class DelegatingItemReader extends AbstractItemReader implements Skippable, InitializingBean {
private ItemReader itemReader;
/**
* Default constructor.
*/
public DelegatingItemReader() {
super();
}
/**
* Convenience constructor for setting mandatory property.
*/
public DelegatingItemReader(ItemReader itemReader) {
this();
this.itemReader = itemReader;
}
public void afterPropertiesSet() throws Exception {
Assert.notNull(itemReader, "ItemReader must not be null.");

View File

@@ -16,6 +16,21 @@ public class DelegatingItemWriter implements ItemWriter, InitializingBean {
private ItemWriter writer;
/**
* Default constructor.
*/
public DelegatingItemWriter() {
super();
}
/**
* @param itemWriter
*/
public DelegatingItemWriter(ItemWriter itemWriter) {
this();
this.writer = itemWriter;
}
/**
* Calls {@link #doProcess(Object)} and then writes the result to the
* delegate {@link ItemWriter}.
@@ -23,7 +38,7 @@ public class DelegatingItemWriter implements ItemWriter, InitializingBean {
*
* @see ItemWriter#process(java.lang.Object)
*/
final public void write(Object item) throws Exception {
public void write(Object item) throws Exception {
Object result = doProcess(item);
writer.write(result);
}