Package adams.flow.standalone.rats
Class LoadSpectrumFileOutput
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.flow.standalone.rats.output.AbstractRatOutput
-
- adams.flow.standalone.rats.LoadSpectrumFileOutput
-
- All Implemented Interfaces:
adams.core.AdditionalInformationHandler
,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 LoadSpectrumFileOutput extends adams.flow.standalone.rats.output.AbstractRatOutput
Loads spectrum files with the specified reader and puts them in the specified queue.
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
- 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.
-
Constructor Summary
Constructors Constructor Description LoadSpectrumFileOutput()
-
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
-
-
-
-
Field Detail
-
SUFFIX_SUCESS
public static final String SUFFIX_SUCESS
the suffix for successful files.- See Also:
- Constant Field Values
-
SUFFIX_FAILURE
public static final String SUFFIX_FAILURE
the suffix for failed files.- See Also:
- Constant Field Values
-
m_Reader
protected AbstractSpectrumReader m_Reader
the sprectrum reader to use.
-
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.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceadams.core.GlobalInfoSupporter
- Specified by:
globalInfo
in classadams.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 interfaceadams.core.option.OptionHandler
- Overrides:
defineOptions
in classadams.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
-
getReader
public AbstractSpectrumReader getReader()
Returns the reader in use.- Returns:
- the reader
-
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.- Parameters:
value
- if true then attempt atomic move operation
-
getAtomicMove
public boolean getAtomicMove()
Returns whether to attempt atomic move operation.- Returns:
- true if to attempt atomic move operation
-
atomicMoveTipText
public String atomicMoveTipText()
Returns the tip text for this property.- 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 interfaceadams.core.QuickInfoSupporter
- Overrides:
getQuickInfo
in classadams.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 interfaceadams.flow.standalone.rats.output.RatOutput
- Specified by:
accepts
in classadams.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 filetarget
- the target filequeue
- the queue to add it to if successful, null to ignore
-
doTransmit
protected String doTransmit()
Performs the actual transmission.- Specified by:
doTransmit
in classadams.flow.standalone.rats.output.AbstractRatOutput
- Returns:
- null if successful, otherwise error message
-
-