Class CronJobDumpHandler
java.lang.Object
de.hybris.platform.impex.jalo.imp.AbstractDumpHandler
de.hybris.platform.impex.jalo.cronjob.CronJobDumpHandler
- All Implemented Interfaces:
DumpHandler
Implementation of a
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 Summary
ConstructorsConstructorDescriptionCronJobDumpHandler(ImpExImportCronJob cronjob) Instantiates a new handler using the given cronjob for storing dump storages. -
Method Summary
Modifier and TypeMethodDescriptionprotected CSVReaderCreates a new reader using last dump media as input.protected CSVWriterCreates a new writer using a new created temp file as temporary dump.protected voidDeletes the temporary dump file.voidfinish(boolean saveCurrentDump) Deletes last dump storage definitely and current one if given flag is set.Gets the current dump as media object.protected FileGets the temporary dump file.voidinit()Initializes the handler by creating the first dump storage and providing a writer object to that storage when callingDumpHandler.getWriterOfCurrentDump().protected voidSaves the temporary dump to the unresolved data media of the cronjob.protected voidsetTempDump(File tempFile) Remembers given temporary dump.protected voidSwitches the reference of current dump media to last dump media and prepares unresolved media attribute.voidReferences 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).Methods inherited from class de.hybris.platform.impex.jalo.imp.AbstractDumpHandler
getDumpAsFile, getDumpAsString, getReaderOfLastDump, getWriterOfCurrentDump, setReaderOfLastDump, setWriterOfCurrentDump
-
Constructor Details
-
CronJobDumpHandler
Instantiates a new handler using the given cronjob for storing dump storages.- Parameters:
cronjob- used cronjob instance
-
-
Method Details
-
init
Description copied from interface:DumpHandlerInitializes the handler by creating the first dump storage and providing a writer object to that storage when callingDumpHandler.getWriterOfCurrentDump().- Throws:
IOException- error while storage creation
-
finish
public void finish(boolean saveCurrentDump) Description copied from interface:DumpHandlerDeletes last dump storage definitely and current one if given flag is set.- Parameters:
saveCurrentDump- should the current storage be deleted
-
switchDump
Description copied from interface:DumpHandlerReferences 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). If there was a storage referenced by 'last' it will be deleted.- Throws:
ImpExException- error while storage handling
-
getDumpAsMedia
Description copied from interface:DumpHandlerGets the current dump as media object.- Specified by:
getDumpAsMediain interfaceDumpHandler- Overrides:
getDumpAsMediain classAbstractDumpHandler- Returns:
- current dump as media
-
createWriter
Creates a new writer using a new created temp file as temporary dump.- Returns:
- writer object to new temporary dump
- Throws:
IOException- error while accessing file
-
createReader
Creates a new reader using last dump media as input.- Returns:
- reader object to last dump media
- Throws:
IOException- error while accessing media
-
switchCurrentToLastDump
Switches the reference of current dump media to last dump media and prepares unresolved media attribute.- Throws:
JaloBusinessException- error while accessing data of medias
-
deleteTempDump
protected void deleteTempDump()Deletes the temporary dump file. -
getTempDump
Gets the temporary dump file.- Returns:
- temporary dump file
-
setTempDump
Remembers given temporary dump.- Parameters:
tempFile- file to store
-
saveAndDeleteTempDump
protected void saveAndDeleteTempDump()Saves the temporary dump to the unresolved data media of the cronjob.
-