public class CronJobDumpHandler extends AbstractDumpHandler
DumpHandler for usage in ImpExImportCronJobs. The current dump storage
is hold by a temporary file which will be saved to the persistent unresolved media attribute of the cronjob at each
switchDump call or when calling the savepoint method. The last dump storage is located at
the persistent work media attribute of the cronjob (used for input).| Constructor and Description |
|---|
CronJobDumpHandler(ImpExImportCronJob cronjob)
Instantiates a new handler using the given cronjob for storing dump storages.
|
| Modifier and Type | Method and Description |
|---|---|
protected CSVReader |
createReader()
Creates a new reader using last dump media as input.
|
protected CSVWriter |
createWriter()
Creates a new writer using a new created temp file as temporary dump.
|
protected void |
deleteTempDump()
Deletes the temporary dump file.
|
void |
finish(boolean saveCurrentDump)
Deletes last dump storage definitely and current one if given flag is set.
|
ImpExMedia |
getDumpAsMedia()
Gets the current dump as media object.
|
protected File |
getTempDump()
Gets the temporary dump file.
|
void |
init()
Initializes the handler by creating the first dump storage and providing a writer object to that storage when
calling
DumpHandler.getWriterOfCurrentDump(). |
protected void |
saveAndDeleteTempDump()
Saves the temporary dump to the unresolved data media of the cronjob.
|
protected void |
setTempDump(File tempFile)
Remembers given temporary dump.
|
protected void |
switchCurrentToLastDump()
Switches the reference of current dump media to last dump media and prepares unresolved media attribute.
|
void |
switchDump()
References the 'current' dump storage as 'last' dump storage (
DumpHandler.getReaderOfLastDump() now provides a reader
object to that storage) and creates a new 'current' dump storage (DumpHandler.getWriterOfCurrentDump() now provides a
writer object to that storage). |
getDumpAsFile, getDumpAsString, getReaderOfLastDump, getWriterOfCurrentDump, setReaderOfLastDump, setWriterOfCurrentDumppublic CronJobDumpHandler(ImpExImportCronJob cronjob)
cronjob - used cronjob instancepublic void init()
throws IOException
DumpHandlerDumpHandler.getWriterOfCurrentDump().IOException - error while storage creationpublic void finish(boolean saveCurrentDump)
DumpHandlersaveCurrentDump - should the current storage be deletedpublic void switchDump()
throws ImpExException
DumpHandlerDumpHandler.getReaderOfLastDump() now provides a reader
object to that storage) and creates a new 'current' dump storage (DumpHandler.getWriterOfCurrentDump() now provides a
writer object to that storage). If there was a storage referenced by 'last' it will be deleted.ImpExException - error while storage handlingpublic ImpExMedia getDumpAsMedia()
DumpHandlergetDumpAsMedia in interface DumpHandlergetDumpAsMedia in class AbstractDumpHandlerprotected CSVWriter createWriter() throws IOException
IOException - error while accessing fileprotected CSVReader createReader() throws IOException
IOException - error while accessing mediaprotected void switchCurrentToLastDump()
throws JaloBusinessException
JaloBusinessException - error while accessing data of mediasprotected void deleteTempDump()
protected File getTempDump()
protected void setTempDump(File tempFile)
tempFile - file to storeprotected void saveAndDeleteTempDump()
Copyright © 2017 SAP SE. All Rights Reserved.