Class LoadMultiSpectrumFileOutput

  • All Implemented Interfaces:
    adams.core.AdditionalInformationHandler, adams.core.AtomicMoveSupporter, adams.core.CleanUpHandler, adams.core.Destroyable, adams.core.GlobalInfoSupporter, adams.core.logging.LoggingLevelHandler, adams.core.logging.LoggingSupporter, adams.core.option.OptionHandler, adams.core.QuickInfoSupporter, adams.core.ShallowCopySupporter<adams.flow.standalone.rats.output.AbstractRatOutput>, adams.core.SizeOfHandler, adams.core.Stoppable, adams.core.StoppableWithFeedback, adams.event.VariableChangeListener, adams.flow.standalone.rats.output.RatOutput, Serializable

    public class LoadMultiSpectrumFileOutput
    extends adams.flow.standalone.rats.output.AbstractRatOutput
    implements adams.core.AtomicMoveSupporter
    Loads spectrum files with the specified reader and puts them in the specified queue as MultiSpectrum.
    Depending on whether a file could be successfully loaded or not, either .success or .failure gets appended to the filename.

    -logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel)
        The logging level for outputting errors and debugging output.
        default: WARNING
     
    -reader <knir.data.input.AbstractSpectrumReader> (property: reader)
        The reader to use for importing the data.
        default: knir.data.input.SimpleSpectrumReader
     
    -queue-spectra <adams.flow.control.StorageName> (property: queueSpectra)
        The name of the queue in the internal storage where the spectra are stored.
        default: spectra
     
    -queue-sucessful <adams.flow.control.StorageName> (property: queueSuccessful)
        The name of the (optional) queue in the internal storage where successful 
        filenames are stored.
        default: successful
     
    -queue-failed <adams.flow.control.StorageName> (property: queueFailed)
        The name of the (optional) queue in the internal storage where failed filenames 
        are stored.
        default: failed
     
    -atomic-move <boolean> (property: atomicMove)
        If true, then an atomic move operation will be attempted (NB: not supported 
        by all operating systems).
        default: false
     
    Version:
    $Revision$
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected boolean m_AtomicMove
      whether to perform an atomic move.
      protected adams.flow.control.StorageName m_QueueFailed
      the name of the queue in the internal storage for failed files.
      protected adams.flow.control.StorageName m_QueueSpectra
      the name of the queue in the internal storage for spectra.
      protected adams.flow.control.StorageName m_QueueSuccessful
      the name of the queue in the internal storage for successful files.
      protected AbstractSpectrumReader m_Reader
      the sprectrum reader to use.
      static String SUFFIX_FAILURE
      the suffix for failed files.
      static String SUFFIX_SUCESS
      the suffix for successful files.
      • Fields inherited from class adams.flow.standalone.rats.output.AbstractRatOutput

        m_BackupState, m_DetectedObjectVariables, m_DetectedVariables, m_Input, m_LoggingPrefix, m_Owner, m_Stopped, m_VariablesUpdated
      • Fields inherited from class adams.core.option.AbstractOptionHandler

        m_OptionManager
      • Fields inherited from class adams.core.logging.LoggingObject

        m_Logger, m_LoggingIsEnabled, m_LoggingLevel
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Class[] accepts()
      Returns the type of data that gets accepted.
      String atomicMoveTipText()
      Returns the tip text for this property.
      void defineOptions()
      Adds options to the internal list of options.
      protected String doTransmit()
      Performs the actual transmission.
      boolean getAtomicMove()
      Returns whether to attempt atomic move operation.
      protected AbstractSpectrumReader getDefaultReader()
      Returns the default reader to use.
      adams.flow.control.StorageName getQueueFailed()
      Returns the name for the queue in the internal storage for failed files.
      adams.flow.control.StorageName getQueueSpectra()
      Returns the name for the queue in the internal storage for failed files.
      adams.flow.control.StorageName getQueueSuccessful()
      Returns the name for the queue in the internal storage for successful files.
      String getQuickInfo()
      Returns a quick info about the actor, which will be displayed in the GUI.
      AbstractSpectrumReader getReader()
      Returns the reader in use.
      String globalInfo()
      Returns a string describing the object.
      protected void moveFile​(File source, File target, adams.flow.control.StorageQueueHandler queue)
      Moves the file and adds it to the queue if successful.
      String queueFailedTipText()
      Returns the tip text for this property.
      String queueSpectraTipText()
      Returns the tip text for this property.
      String queueSuccessfulTipText()
      Returns the tip text for this property.
      String readerTipText()
      Returns the tip text for this property.
      void setAtomicMove​(boolean value)
      Sets whether to attempt atomic move operation.
      void setQueueFailed​(adams.flow.control.StorageName value)
      Sets the name for the queue in the internal storage for failed files.
      void setQueueSpectra​(adams.flow.control.StorageName value)
      Sets the name for the queue in the internal storage for failed files.
      void setQueueSuccessful​(adams.flow.control.StorageName value)
      Sets the name for the queue in the internal storage for successful files.
      void setReader​(AbstractSpectrumReader value)
      Sets the reader to use.
      • Methods inherited from class adams.flow.standalone.rats.output.AbstractRatOutput

        backupState, canInput, check, cleanUp, configureLogger, doWait, findVariables, getAdditionalInformation, getFullName, getOwner, getQueue, getVariables, handleException, initialize, initTransmission, input, isBackedUp, isStopped, pruneBackup, pruneBackup, restoreState, setOwner, setUp, shallowCopy, shallowCopy, stopExecution, transmit, updateDetectedVariables, updatePrefix, updateVariables, variableChanged
      • Methods inherited from class adams.core.option.AbstractOptionHandler

        cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
      • Methods inherited from class adams.core.logging.LoggingObject

        getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
      • Methods inherited from interface adams.core.Destroyable

        destroy
      • Methods inherited from interface adams.core.logging.LoggingLevelHandler

        getLoggingLevel
      • Methods inherited from interface adams.core.option.OptionHandler

        cleanUpOptions, getOptionManager, toCommandLine
    • Field Detail

      • m_QueueSpectra

        protected adams.flow.control.StorageName m_QueueSpectra
        the name of the queue in the internal storage for spectra.
      • m_QueueSuccessful

        protected adams.flow.control.StorageName m_QueueSuccessful
        the name of the queue in the internal storage for successful files.
      • m_QueueFailed

        protected adams.flow.control.StorageName m_QueueFailed
        the name of the queue in the internal storage for failed files.
      • m_AtomicMove

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

      • LoadMultiSpectrumFileOutput

        public LoadMultiSpectrumFileOutput()
    • Method Detail

      • globalInfo

        public String globalInfo()
        Returns a string describing the object.
        Specified by:
        globalInfo in interface adams.core.GlobalInfoSupporter
        Specified by:
        globalInfo in class adams.core.option.AbstractOptionHandler
        Returns:
        a description suitable for displaying in the gui
      • defineOptions

        public void defineOptions()
        Adds options to the internal list of options.
        Specified by:
        defineOptions in interface adams.core.option.OptionHandler
        Overrides:
        defineOptions in class adams.core.option.AbstractOptionHandler
      • getDefaultReader

        protected AbstractSpectrumReader getDefaultReader()
        Returns the default reader to use.
        Returns:
        the default reader
      • setReader

        public void setReader​(AbstractSpectrumReader value)
        Sets the reader to use.
        Parameters:
        value - the filter
      • readerTipText

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

        public void setQueueSpectra​(adams.flow.control.StorageName value)
        Sets the name for the queue in the internal storage for failed files.
        Parameters:
        value - the name
      • getQueueSpectra

        public adams.flow.control.StorageName getQueueSpectra()
        Returns the name for the queue in the internal storage for failed files.
        Returns:
        the name
      • queueSpectraTipText

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

        public void setQueueSuccessful​(adams.flow.control.StorageName value)
        Sets the name for the queue in the internal storage for successful files.
        Parameters:
        value - the name
      • getQueueSuccessful

        public adams.flow.control.StorageName getQueueSuccessful()
        Returns the name for the queue in the internal storage for successful files.
        Returns:
        the name
      • queueSuccessfulTipText

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

        public void setQueueFailed​(adams.flow.control.StorageName value)
        Sets the name for the queue in the internal storage for failed files.
        Parameters:
        value - the name
      • getQueueFailed

        public adams.flow.control.StorageName getQueueFailed()
        Returns the name for the queue in the internal storage for failed files.
        Returns:
        the name
      • queueFailedTipText

        public String queueFailedTipText()
        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 adams.core.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 adams.core.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 adams.core.AtomicMoveSupporter
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • getQuickInfo

        public String getQuickInfo()
        Returns a quick info about the actor, which will be displayed in the GUI.
        Specified by:
        getQuickInfo in interface adams.core.QuickInfoSupporter
        Overrides:
        getQuickInfo in class adams.flow.standalone.rats.output.AbstractRatOutput
        Returns:
        null if no info available, otherwise short string
      • accepts

        public Class[] accepts()
        Returns the type of data that gets accepted.
        Specified by:
        accepts in interface adams.flow.standalone.rats.output.RatOutput
        Specified by:
        accepts in class adams.flow.standalone.rats.output.AbstractRatOutput
        Returns:
        the type of data
      • moveFile

        protected void moveFile​(File source,
                                File target,
                                adams.flow.control.StorageQueueHandler queue)
        Moves the file and adds it to the queue if successful.
        Parameters:
        source - the source file
        target - the target file
        queue - the queue to add it to if successful, null to ignore
      • doTransmit

        protected String doTransmit()
        Performs the actual transmission.
        Specified by:
        doTransmit in class adams.flow.standalone.rats.output.AbstractRatOutput
        Returns:
        null if successful, otherwise error message