org.springframework.batch.sample.common
Class StagingItemWriter<T>
java.lang.Object
org.springframework.dao.support.DaoSupport
org.springframework.jdbc.core.support.JdbcDaoSupport
org.springframework.batch.sample.common.StagingItemWriter<T>
- All Implemented Interfaces:
- StepExecutionListener, StepListener, ItemWriter<T>, InitializingBean
public class StagingItemWriter<T>
- extends JdbcDaoSupport
- implements StepExecutionListener, ItemWriter<T>
Database ItemWriter implementing the process indicator pattern.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NEW
public static final String NEW
- See Also:
- Constant Field Values
DONE
public static final String DONE
- See Also:
- Constant Field Values
WORKING
public static final Object WORKING
StagingItemWriter
public StagingItemWriter()
initDao
protected void initDao()
throws Exception
- Check mandatory properties.
- Overrides:
initDao in class DaoSupport
- Throws:
Exception- See Also:
DaoSupport.initDao()
setIncrementer
public void setIncrementer(DataFieldMaxValueIncrementer incrementer)
- Setter for the key generator for the staging table.
- Parameters:
incrementer - the DataFieldMaxValueIncrementer to set
write
public void write(List<? extends T> items)
- Serialize the item to the staging table, and add a NEW processed flag.
- Specified by:
write in interface ItemWriter<T>
- See Also:
ItemWriter.write(java.util.List)
afterStep
public ExitStatus afterStep(StepExecution stepExecution)
- Description copied from interface:
StepExecutionListener
- Give a listener a chance to modify the exit status from a step. The value
returned will be combined with the normal exit status using
ExitStatus.and(ExitStatus).
Called after execution of step's processing logic (both successful or
failed). Throwing exception in this method has no effect, it will only be
logged.
- Specified by:
afterStep in interface StepExecutionListener
- Returns:
- an
ExitStatus to combine with the normal value. Return
null to leave the old value unchanged.
beforeStep
public void beforeStep(StepExecution stepExecution)
- Description copied from interface:
StepExecutionListener
- Initialize the state of the listener with the
StepExecution from
the current scope.
- Specified by:
beforeStep in interface StepExecutionListener
onErrorInStep
public ExitStatus onErrorInStep(StepExecution stepExecution,
Throwable e)
Copyright © 2009 SpringSource. All Rights Reserved.