Package adams.flow.sink
Class NotesWriter
-
- All Implemented Interfaces:
AdditionalInformationHandler,CleanUpHandler,Destroyable,GlobalInfoSupporter,LoggingLevelHandler,LoggingSupporter,OptionHandler,QuickInfoSupporter,ShallowCopySupporter<Actor>,SizeOfHandler,Stoppable,StoppableWithFeedback,VariablesInspectionHandler,VariableChangeListener,Actor,ErrorHandler,InputConsumer,Serializable,Comparable
public class NotesWriter extends AbstractSink
Saves the notes attached to a data structure to a text file.
Input/output:
- accepts:
adams.data.NotesHandler
Valid options are:
-D <int> (property: debugLevel) The greater the number the more additional info the scheme may output to the console (0 = off). default: 0 minimum: 0
-name <java.lang.String> (property: name) The name of the actor. default: NotesWriter
-annotation <adams.core.base.BaseText> (property: annotations) The annotations to attach to this actor. default:
-skip (property: skip) If set to true, transformation is skipped and the input token is just forwarded as it is.
-outputDir <adams.core.io.PlaceholderFile> (property: outputDir) The output directory for the notes. default: .
-suffix <java.lang.String> (property: suffix) The suffix for the notes filename, before the extension. default:
-generator <adams.data.id.AbstractIDGenerator [options]> (property: generator) The generator to use for generating the IDs. default: adams.data.id.SimpleIDGenerator
-output-db-id (property: outputDatabaseID) If set to true, then the database ID will be output in the file as well.
-output-errors (property: outputErrors) If set to true, then the errors will be output.
-output-warnings (property: outputWarnings) If set to true, then the warnings will be output.
-output-process-info (property: outputProcessInformation) If set to true, then the process information will be output.
-output-all (property: outputAll) If set to true, then everything will be output.
- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static StringFILE_EXTENSIONthe extension used for the filenames.protected AbstractIDGeneratorm_Generatorthe ID generator to use.protected booleanm_OutputAllwhether to output everything.protected booleanm_OutputDatabaseIDwhether to include the database ID as well in the text file.protected PlaceholderDirectorym_OutputDirthe output directory.protected booleanm_OutputErrorswhether to output the errors.protected booleanm_OutputProcessInformationwhether to output the process information.protected booleanm_OutputWarningswhether to output the warnings.protected Stringm_Suffixthe suffix for the filename (before the ".txt" extension).-
Fields inherited from class adams.flow.sink.AbstractSink
BACKUP_INPUT, m_InputToken
-
Fields inherited from class adams.flow.core.AbstractActor
m_Annotations, m_BackupState, m_DetectedObjectVariables, m_DetectedVariables, m_ErrorHandler, m_Executed, m_Executing, m_ExecutionListeningSupporter, m_FullName, m_LoggingPrefix, m_Name, m_Parent, m_ScopeHandler, m_Self, m_Silent, m_Skip, m_StopFlowOnError, m_StopMessage, m_Stopped, m_StorageHandler, 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
-
Fields inherited from interface adams.flow.core.Actor
FILE_EXTENSION_GZ
-
-
Constructor Summary
Constructors Constructor Description NotesWriter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Class[]accepts()Returns the class that the consumer accepts.voiddefineOptions()Adds options to the internal list of options.protected StringdoExecute()Executes the flow item.StringgeneratorTipText()Returns the tip text for this property.AbstractIDGeneratorgetGenerator()Returns the generator in use.booleangetOutputAll()Returns whether to output everything.booleangetOutputDatabaseID()Returns whether to output the database ID as well in the file.PlaceholderDirectorygetOutputDir()Returns the output directory.booleangetOutputErrors()Returns whether to output the errors.booleangetOutputProcessInformation()Returns whether to output the process information.booleangetOutputWarnings()Returns whether to output the warnings.StringgetQuickInfo()Returns a quick info about the actor, which will be displayed in the GUI.StringgetSuffix()Returns the suffix for the notes.StringglobalInfo()Returns a string describing the object.protected String[]merge(String[] array1, String[] array2)Generates an array combining both arrays.protected String[]notesToArray(Notes notes)Turns the provided notes into an array, if th notes contain anything.StringoutputAllTipText()Returns the tip text for this property.StringoutputDatabaseIDTipText()Returns the tip text for this property.StringoutputDirTipText()Returns the tip text for this property.StringoutputErrorsTipText()Returns the tip text for this property.StringoutputProcessInformationTipText()Returns the tip text for this property.StringoutputWarningsTipText()Returns the tip text for this property.voidsetGenerator(AbstractIDGenerator value)Sets the generator to use.voidsetOutputAll(boolean value)Sets whether to output everything.voidsetOutputDatabaseID(boolean value)Sets whether to output the database ID as well in the file.voidsetOutputDir(PlaceholderDirectory value)Sets the output directory.voidsetOutputErrors(boolean value)Sets whether to output the errors.voidsetOutputProcessInformation(boolean value)Sets whether to output the process information.voidsetOutputWarnings(boolean value)Sets whether to output the warnings.voidsetSuffix(String value)Sets the suffix for the notes.StringsuffixTipText()Returns the tip text for this property.-
Methods inherited from class adams.flow.sink.AbstractSink
backupState, currentInput, hasInput, input, postExecute, restoreState, wrapUp
-
Methods inherited from class adams.flow.core.AbstractActor
annotationsTipText, canInspectOptions, canPerformSetUpCheck, cleanUp, compareTo, configureLogger, destroy, equals, execute, finalUpdateVariables, findVariables, findVariables, forceVariables, forCommandLine, forName, forName, getAdditionalInformation, getAnnotations, getDefaultName, getDetectedVariables, getErrorHandler, getFlowActors, getFlowExecutionListeningSupporter, getFullName, getName, getNextSibling, getParent, getParentComponent, getPreviousSibling, getRoot, getScopeHandler, getSilent, getSkip, getStopFlowOnError, getStopMessage, getStorageHandler, getVariables, handleError, handleException, hasErrorHandler, hasStopMessage, index, initialize, isBackedUp, isExecuted, isExecuting, isFinished, isHeadless, isStopped, nameTipText, performSetUpChecks, performVariableChecks, preExecute, pruneBackup, pruneBackup, reset, setAnnotations, setErrorHandler, setName, setParent, setSilent, setSkip, setStopFlowOnError, setUp, setVariables, shallowCopy, shallowCopy, silentTipText, sizeOf, skipTipText, stopExecution, stopExecution, stopFlowOnErrorTipText, updateDetectedVariables, updatePrefix, updateVariables, variableChanged
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, finishInit, getDefaultLoggingLevel, getOptionManager, loggingLevelTipText, newOptionManager, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.flow.core.Actor
cleanUp, compareTo, destroy, equals, execute, findVariables, getAnnotations, getDefaultName, getDetectedVariables, getErrorHandler, getFlowExecutionListeningSupporter, getFullName, getName, getNextSibling, getParent, getParentComponent, getPreviousSibling, getRoot, getScopeHandler, getSilent, getSkip, getStopFlowOnError, getStopMessage, getStorageHandler, getVariables, handleError, hasErrorHandler, hasStopMessage, index, isExecuted, isFinished, isHeadless, isStopped, setAnnotations, setErrorHandler, setName, setParent, setSilent, setSkip, setStopFlowOnError, setUp, setVariables, shallowCopy, shallowCopy, sizeOf, stopExecution, stopExecution, toCommandLine, variableChanged
-
Methods inherited from interface adams.core.AdditionalInformationHandler
getAdditionalInformation
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel, setLoggingLevel
-
Methods inherited from interface adams.core.logging.LoggingSupporter
getLogger, isLoggingEnabled
-
Methods inherited from interface adams.core.option.OptionHandler
cleanUpOptions, getOptionManager
-
Methods inherited from interface adams.core.VariablesInspectionHandler
canInspectOptions
-
-
-
-
Field Detail
-
FILE_EXTENSION
public static final String FILE_EXTENSION
the extension used for the filenames.- See Also:
- Constant Field Values
-
m_OutputDir
protected PlaceholderDirectory m_OutputDir
the output directory.
-
m_Generator
protected AbstractIDGenerator m_Generator
the ID generator to use.
-
m_Suffix
protected String m_Suffix
the suffix for the filename (before the ".txt" extension).
-
m_OutputDatabaseID
protected boolean m_OutputDatabaseID
whether to include the database ID as well in the text file.
-
m_OutputErrors
protected boolean m_OutputErrors
whether to output the errors.
-
m_OutputWarnings
protected boolean m_OutputWarnings
whether to output the warnings.
-
m_OutputProcessInformation
protected boolean m_OutputProcessInformation
whether to output the process information.
-
m_OutputAll
protected boolean m_OutputAll
whether to output everything.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfoin interfaceGlobalInfoSupporter- Specified by:
globalInfoin classAbstractOptionHandler- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin classAbstractActor
-
getQuickInfo
public String getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.- Specified by:
getQuickInfoin interfaceActor- Specified by:
getQuickInfoin interfaceQuickInfoSupporter- Overrides:
getQuickInfoin classAbstractActor- Returns:
- null if no info available, otherwise short string
-
accepts
public Class[] accepts()
Returns the class that the consumer accepts.- Returns:
- adams.data.NotesHandler.class
-
setOutputDir
public void setOutputDir(PlaceholderDirectory value)
Sets the output directory.- Parameters:
value- the output directory
-
getOutputDir
public PlaceholderDirectory getOutputDir()
Returns the output directory.- Returns:
- the output directory
-
outputDirTipText
public String outputDirTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setGenerator
public void setGenerator(AbstractIDGenerator value)
Sets the generator to use.- Parameters:
value- the generator
-
getGenerator
public AbstractIDGenerator getGenerator()
Returns the generator in use.- Returns:
- the generator
-
generatorTipText
public String generatorTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setSuffix
public void setSuffix(String value)
Sets the suffix for the notes.- Parameters:
value- the suffix
-
getSuffix
public String getSuffix()
Returns the suffix for the notes.- Returns:
- the suffix
-
suffixTipText
public String suffixTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setOutputDatabaseID
public void setOutputDatabaseID(boolean value)
Sets whether to output the database ID as well in the file.- Parameters:
value- if true then the database ID will be output
-
getOutputDatabaseID
public boolean getOutputDatabaseID()
Returns whether to output the database ID as well in the file.- Returns:
- true if the database ID is output as well
-
outputDatabaseIDTipText
public String outputDatabaseIDTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setOutputErrors
public void setOutputErrors(boolean value)
Sets whether to output the errors.- Parameters:
value- if true then the errors will be output
-
getOutputErrors
public boolean getOutputErrors()
Returns whether to output the errors.- Returns:
- true if the errors will be output
-
outputErrorsTipText
public String outputErrorsTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setOutputWarnings
public void setOutputWarnings(boolean value)
Sets whether to output the warnings.- Parameters:
value- if true then the warnings will be output
-
getOutputWarnings
public boolean getOutputWarnings()
Returns whether to output the warnings.- Returns:
- true if the warnings will be output
-
outputWarningsTipText
public String outputWarningsTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setOutputProcessInformation
public void setOutputProcessInformation(boolean value)
Sets whether to output the process information.- Parameters:
value- if true then the process information will be output
-
getOutputProcessInformation
public boolean getOutputProcessInformation()
Returns whether to output the process information.- Returns:
- true if the process information will be output
-
outputProcessInformationTipText
public String outputProcessInformationTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setOutputAll
public void setOutputAll(boolean value)
Sets whether to output everything.- Parameters:
value- if true then everything will be output
-
getOutputAll
public boolean getOutputAll()
Returns whether to output everything.- Returns:
- true if everything will be output
-
outputAllTipText
public String outputAllTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
notesToArray
protected String[] notesToArray(Notes notes)
Turns the provided notes into an array, if th notes contain anything.- Parameters:
notes- the notes to convert- Returns:
- the generated array of null if no notes present
-
merge
protected String[] merge(String[] array1, String[] array2)
Generates an array combining both arrays.- Parameters:
array1- the first arrayarray2- the second array- Returns:
- the merged array
-
doExecute
protected String doExecute()
Executes the flow item.- Specified by:
doExecutein classAbstractActor- Returns:
- null if everything is fine, otherwise error message
-
-