Class CronJobDumpHandler

  • All Implemented Interfaces:
    DumpHandler

    public class CronJobDumpHandler
    extends AbstractDumpHandler
    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 Detail

      • CronJobDumpHandler

        public CronJobDumpHandler​(ImpExImportCronJob cronjob)
        Instantiates a new handler using the given cronjob for storing dump storages.
        Parameters:
        cronjob - used cronjob instance
    • Method Detail

      • init

        public void init()
                  throws java.io.IOException
        Description copied from interface: DumpHandler
        Initializes the handler by creating the first dump storage and providing a writer object to that storage when calling DumpHandler.getWriterOfCurrentDump().
        Throws:
        java.io.IOException - error while storage creation
      • finish

        public void finish​(boolean saveCurrentDump)
        Description copied from interface: DumpHandler
        Deletes last dump storage definitely and current one if given flag is set.
        Parameters:
        saveCurrentDump - should the current storage be deleted
      • createWriter

        protected CSVWriter createWriter()
                                  throws java.io.IOException
        Creates a new writer using a new created temp file as temporary dump.
        Returns:
        writer object to new temporary dump
        Throws:
        java.io.IOException - error while accessing file
      • createReader

        protected CSVReader createReader()
                                  throws java.io.IOException
        Creates a new reader using last dump media as input.
        Returns:
        reader object to last dump media
        Throws:
        java.io.IOException - error while accessing media
      • switchCurrentToLastDump

        protected void switchCurrentToLastDump()
                                        throws JaloBusinessException
        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

        protected java.io.File getTempDump()
        Gets the temporary dump file.
        Returns:
        temporary dump file
      • setTempDump

        protected void setTempDump​(java.io.File tempFile)
        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.