Class AbstractDataProcessor

    • Field Detail

      • m_Processing

        protected PlaceholderDirectory m_Processing
        the directory containing the elements being processed.
      • m_Processed

        protected PlaceholderDirectory m_Processed
        the directory containing the elements that were processed successfully.
      • m_Failed

        protected PlaceholderDirectory m_Failed
        the directory containing the elements that couldn't be processed.
      • m_ProcessError

        protected String m_ProcessError
        the last error that occurred during processing.
      • m_UseTimestampDirs

        protected boolean m_UseTimestampDirs
        whether to create directories with a timestamp as name for the files that are being processed, in order to avoid name clashes.
      • m_TimestampDirFormat

        protected SimpleDateFormat m_TimestampDirFormat
        the format for the timestamp directories.
      • m_DestinationFile

        protected File m_DestinationFile
        the final resting place of the processed file (failed or not).
      • m_AtomicMove

        protected boolean m_AtomicMove
        whether to perform an atomic move.
    • Constructor Detail

      • AbstractDataProcessor

        public AbstractDataProcessor()
    • Method Detail

      • setProcessing

        public void setProcessing​(PlaceholderDirectory value)
        Sets the "processing" directory.
        Parameters:
        value - the directory
      • getProcessing

        public PlaceholderDirectory getProcessing()
        Returns the "processing" directory.
        Returns:
        the directory
      • processingTipText

        public String processingTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setProcessed

        public void setProcessed​(PlaceholderDirectory value)
        Sets the "processed" directory.
        Parameters:
        value - the directory
      • getProcessed

        public PlaceholderDirectory getProcessed()
        Returns the "processed" directory.
        Returns:
        the directory
      • processedTipText

        public String processedTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setFailed

        public void setFailed​(PlaceholderDirectory value)
        Sets the "failed" directory.
        Parameters:
        value - the directory
      • getFailed

        public PlaceholderDirectory getFailed()
        Returns the "failed" directory.
        Returns:
        the directory
      • failedTipText

        public String failedTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setUseTimestampDirs

        public void setUseTimestampDirs​(boolean value)
        Sets whether to use timestamp directories to avoid name clashes of the files/dirs being processed.
        Parameters:
        value - if truen then the files/dirs get encapsulated in timestamp dir
      • getUseTimestampDirs

        public boolean getUseTimestampDirs()
        Returns whether files/dirs that are being processed get encapsulated in timestamp directories or not.
        Returns:
        true if files/dirs get encapsulated
      • useTimestampDirsTipText

        public String useTimestampDirsTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setAtomicMove

        public void setAtomicMove​(boolean value)
        Sets whether to attempt atomic move operation.
        Specified by:
        setAtomicMove in interface AtomicMoveSupporter
        Parameters:
        value - if true then attempt atomic move operation
      • getAtomicMove

        public boolean getAtomicMove()
        Returns whether to attempt atomic move operation.
        Specified by:
        getAtomicMove in interface AtomicMoveSupporter
        Returns:
        true if to attempt atomic move operation
      • atomicMoveTipText

        public String atomicMoveTipText()
        Returns the tip text for this property.
        Specified by:
        atomicMoveTipText in interface AtomicMoveSupporter
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • accepts

        public Class[] accepts()
        Returns the class that the consumer accepts.
        Specified by:
        accepts in interface InputConsumer
        Returns:
        String.class, File.class
      • nextTimestampDir

        protected File nextTimestampDir​(File parent)
        Returns the next available timestamp directory in the given parent directory.
        Parameters:
        parent - the directory in which to create the timestamp dir
        Returns:
        the generated timestamp directory
      • prepareData

        protected File prepareData​(File file)
        Moves the data to the "processing" directory.
        Parameters:
        file - the file/dir to move
        Returns:
        the new location
      • processData

        protected abstract boolean processData​(File file)
        Processes the given data.
        Parameters:
        file - the file/dir to process
        Returns:
        true if everything went alright
        See Also:
        m_ProcessError
      • postProcessData

        protected boolean postProcessData​(File file,
                                          boolean success)
        Post-processes the data.
        Parameters:
        file - the file to finish up
        success - whether processing was successful
        Returns:
        true if successful
        See Also:
        m_ProcessError
      • doExecute

        protected String doExecute()
        Executes the flow item.
        Specified by:
        doExecute in class AbstractActor
        Returns:
        null if everything is fine, otherwise error message