Class DefaultDumpHandler
- java.lang.Object
-
- de.hybris.platform.impex.jalo.imp.AbstractDumpHandler
-
- de.hybris.platform.impex.jalo.imp.DefaultDumpHandler
-
- All Implemented Interfaces:
DumpHandler
public class DefaultDumpHandler extends AbstractDumpHandler
Default implementation of aDumpHeaderusing plain files as dump storage.
-
-
Constructor Summary
Constructors Constructor Description DefaultDumpHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected CSVReadercreateReader()Creates a new reader using last dump file as input.protected CSVWritercreateWriter()Creates a new writer using a new created temp file as current dump file.protected voiddeleteCurrentDump()Deletes the file holding the current dump.protected voiddeleteLastDump()Deletes the file holding the last dump.voidfinish(boolean saveCurrentDump)Deletes last dump storage definitely and current one if given flag is set.java.io.FilegetDumpAsFile()Gets the current dump as file.ImpExMediagetDumpAsMedia()Gets the current dump as media object.voidinit()Initializes the handler by creating the first dump storage and providing a writer object to that storage when callingDumpHandler.getWriterOfCurrentDump().protected voidswitchCurrentToLastDump()Switches the reference of current dump file to last dump file.voidswitchDump()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).-
Methods inherited from class de.hybris.platform.impex.jalo.imp.AbstractDumpHandler
getDumpAsString, getReaderOfLastDump, getWriterOfCurrentDump, setReaderOfLastDump, setWriterOfCurrentDump
-
-
-
-
Method Detail
-
init
public void init() throws java.io.IOExceptionDescription copied from interface:DumpHandlerInitializes the handler by creating the first dump storage and providing a writer object to that storage when callingDumpHandler.getWriterOfCurrentDump().- Throws:
java.io.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
public void switchDump() throws ImpExExceptionDescription 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
-
getDumpAsFile
public java.io.File getDumpAsFile()
Description copied from interface:DumpHandlerGets the current dump as file.- Specified by:
getDumpAsFilein interfaceDumpHandler- Overrides:
getDumpAsFilein classAbstractDumpHandler- Returns:
- current dump as file
-
getDumpAsMedia
public ImpExMedia getDumpAsMedia()
Description copied from interface:DumpHandlerGets the current dump as media object.- Specified by:
getDumpAsMediain interfaceDumpHandler- Overrides:
getDumpAsMediain classAbstractDumpHandler- Returns:
- current dump as media
-
deleteLastDump
protected void deleteLastDump()
Deletes the file holding the last dump.
-
deleteCurrentDump
protected void deleteCurrentDump()
Deletes the file holding the current dump.
-
switchCurrentToLastDump
protected void switchCurrentToLastDump()
Switches the reference of current dump file to last dump file.
-
createReader
protected CSVReader createReader() throws java.io.IOException
Creates a new reader using last dump file as input.- Returns:
- reader object to last dump file
- Throws:
java.io.IOException- error while accessing file
-
createWriter
protected CSVWriter createWriter() throws java.io.IOException
Creates a new writer using a new created temp file as current dump file.- Returns:
- writer object to new current dump file
- Throws:
java.io.IOException- error while accessing file
-
-