- java.lang.Object
-
- org.duracloud.snapshot.service.impl.StepExecutionSupport
-
- All Implemented Interfaces:
org.springframework.batch.core.StepExecutionListener,org.springframework.batch.core.StepListener
- Direct Known Subclasses:
ContentPropertiesFileReader,ContentPropertiesWriter,FileSystemReader,ManifestVerifier,SnapshotContentItemVerifier,SnapshotManifestReader,SnapshotRepoManifestReader,SpaceItemWriter,SpaceVerifier,SyncWriter
public abstract class StepExecutionSupport extends Object implements org.springframework.batch.core.StepExecutionListener
This class serves as a base class for item readers and writers.- Author:
- Daniel Bernstein Date: Jul 28, 2015
-
-
Field Summary
Fields Modifier and Type Field Description static StringERRORS_KEYstatic StringITEMS_READ_KEY
-
Constructor Summary
Constructors Constructor Description StepExecutionSupport()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddError(String error)protected voidaddToItemsRead(long value)protected voidaddToLong(String key, long value)Adds the specified value to the existing key.org.springframework.batch.core.ExitStatusafterStep(org.springframework.batch.core.StepExecution stepExecution)voidbeforeStep(org.springframework.batch.core.StepExecution stepExecution)protected voidclearErrors()protected voidfailExecution()protected List<String>getErrors()protected org.springframework.batch.item.ExecutionContextgetExecutionContext()protected longgetItemsRead()protected longgetLongValue(String key)protected org.springframework.batch.core.StepExecutiongetStepExecution()protected voidresetContextState()voidsetIsTest()protected voidskipLinesAlreadyRead(Iterator it)Skips the iterator ahead to the items read value stored in the execution contextprotected List<String>verifySpace(SpaceManifestSnapshotManifestVerifier verifier)
-
-
-
Field Detail
-
ITEMS_READ_KEY
public static String ITEMS_READ_KEY
-
ERRORS_KEY
public static final String ERRORS_KEY
- See Also:
- Constant Field Values
-
-
Method Detail
-
getExecutionContext
protected org.springframework.batch.item.ExecutionContext getExecutionContext()
-
addError
protected void addError(String error)
-
clearErrors
protected void clearErrors()
-
resetContextState
protected void resetContextState()
-
getErrors
protected List<String> getErrors()
- Returns:
- a list of errors from the execution context or empty list if there are no errors
-
addToItemsRead
protected void addToItemsRead(long value)
-
getItemsRead
protected long getItemsRead()
-
skipLinesAlreadyRead
protected void skipLinesAlreadyRead(Iterator it)
Skips the iterator ahead to the items read value stored in the execution context- Parameters:
it- any iterator
-
beforeStep
public void beforeStep(org.springframework.batch.core.StepExecution stepExecution)
- Specified by:
beforeStepin interfaceorg.springframework.batch.core.StepExecutionListener
-
getStepExecution
protected org.springframework.batch.core.StepExecution getStepExecution()
-
failExecution
protected void failExecution()
-
afterStep
public org.springframework.batch.core.ExitStatus afterStep(org.springframework.batch.core.StepExecution stepExecution)
- Specified by:
afterStepin interfaceorg.springframework.batch.core.StepExecutionListener
-
addToLong
protected void addToLong(String key, long value)
Adds the specified value to the existing key.- Parameters:
key-value-
-
getLongValue
protected long getLongValue(String key)
-
verifySpace
protected List<String> verifySpace(SpaceManifestSnapshotManifestVerifier verifier)
-
setIsTest
public void setIsTest()
-
-