Package adams.flow.source
Class SimpleRSync
-
- All Implemented Interfaces:
AdditionalInformationHandler,CleanUpHandler,Destroyable,GlobalInfoSupporter,LoggingLevelHandler,LoggingSupporter,OptionHandler,QuickInfoSupporter,ShallowCopySupporter<Actor>,SizeOfHandler,Stoppable,StoppableWithFeedback,VariablesInspectionHandler,VariableChangeListener,Actor,ErrorHandler,OutputProducer,com.github.fracpete.processoutput4j.core.StreamingProcessOwner,Serializable,Comparable
public class SimpleRSync extends AbstractBufferingSource implements com.github.fracpete.processoutput4j.core.StreamingProcessOwner
An rsync wrapper with a reduced set of options.
Input/output:
- generates:
java.lang.String
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING
-name <java.lang.String> (property: name) The name of the actor. default: SimpleRSync
-annotation <adams.core.base.BaseAnnotation> (property: annotations) The annotations to attach to this actor. default:
-skip <boolean> (property: skip) If set to true, transformation is skipped and the input token is just forwarded as it is. default: false
-stop-flow-on-error <boolean> (property: stopFlowOnError) If set to true, the flow execution at this level gets stopped in case this actor encounters an error; the error gets propagated; useful for critical actors. default: false
-silent <boolean> (property: silent) If enabled, then no errors are output in the console; Note: the enclosing actor handler must have this enabled as well. default: false
-source <java.lang.String> (property: source) The local or remote source path (path or [user@]host:path) default:
-destination <java.lang.String> (property: destination) The local or remote destination path (path or [user@]host:path) default:
-outputCommandline <boolean> (property: outputCommandline) output the command-line generated for the rsync binary default: false
-verbose <boolean> (property: verbose) increase verbosity default: false
-quiet <boolean> (property: quiet) suppress non-error messages default: false
-checksum <boolean> (property: checksum) skip based on checksum, not mod-time & size default: false
-archive <boolean> (property: archive) archive mode; equals -rlptgoD (no -H,-A,-X) default: false
-recursive <boolean> (property: recursive) recurse into directories default: false
-relative <boolean> (property: relative) use relative path names default: false
-perms <boolean> (property: perms) preserve permissions default: false
-executability <boolean> (property: executability) preserve the file's executability default: false
-times <boolean> (property: times) preserve modification times default: false
-dry_run <boolean> (property: dryRun) perform a trial run with no changes made default: false
-rsh <java.lang.String> (property: rsh) specify the remote shell to use default:
-rsync_path <java.lang.String> (property: rsyncPath) specify the rsync to run on the remote machine default:
-delete <boolean> (property: delete) delete extraneous files from destination dirs default: false
-exclude <adams.core.base.BaseString> [-exclude ...] (property: exclude) exclude files matching PATTERN default:
-exclude_from <adams.core.io.PlaceholderFile> (property: excludeFrom) read exclude patterns from FILE default: ${CWD}-include <adams.core.base.BaseString> [-include ...] (property: include) include files matching PATTERN default:
-include_from <adams.core.io.PlaceholderFile> (property: includeFrom) read include patterns from FILE default: ${CWD}-files_from <adams.core.io.PlaceholderFile> (property: filesFrom) read list of source-file names from FILE default: ${CWD}-filter <adams.core.base.BaseString> [-filter ...] (property: filter) add a file-filtering RULE default:
-max_time <int> (property: maxTime) time out in seconds, stopping rsync process once exceeded, ignored if less than 1 default: -1 minimum: -1
-prefix-stdout <java.lang.String> (property: prefixStdOut) The (optional) prefix to use for output from stdout. default:
-prefix-stderr <java.lang.String> (property: prefixStdErr) The (optional) prefix to use for output from stderr. default:
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanm_Archiveprotected booleanm_Checksumprotected booleanm_Deleteprotected Stringm_Destinationthe destination path/url.protected booleanm_DryRunprotected BaseString[]m_Excludeprotected PlaceholderFilem_ExcludeFromprotected booleanm_Executabilityprotected PlaceholderFilem_FilesFromprotected BaseString[]m_Filterprotected BaseString[]m_Includeprotected PlaceholderFilem_IncludeFromprotected intm_MaxTimeprotected booleanm_OutputCommandlinewhether to output the commandline.protected booleanm_Permsprotected Stringm_PrefixStdErrthe stderr prefix.protected Stringm_PrefixStdOutthe stdout prefix.protected booleanm_Quietprotected booleanm_Recursiveprotected booleanm_Relativeprotected Stringm_Rshprotected Stringm_RsyncPathprotected Stringm_Sourcethe source path/url.protected booleanm_Timesprotected booleanm_Verbose-
Fields inherited from class adams.flow.source.AbstractBufferingSource
m_Queue
-
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, FILE_EXTENSION_GZ
-
-
Constructor Summary
Constructors Constructor Description SimpleRSync()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringarchiveTipText()StringchecksumTipText()voiddefineOptions()Adds options to the internal list of options.StringdeleteTipText()StringdestinationTipText()protected StringdoExecute()Executes the flow item.StringdryRunTipText()StringexcludeFromTipText()StringexcludeTipText()StringexecutabilityTipText()StringfilesFromTipText()StringfilterTipText()Class[]generates()Returns the class of objects that it generates.StringgetDestination()Returns the current destination path/url.BaseString[]getExclude()PlaceholderFilegetExcludeFrom()PlaceholderFilegetFilesFrom()BaseString[]getFilter()BaseString[]getInclude()PlaceholderFilegetIncludeFrom()intgetMaxTime()booleangetOutputCommandline()Returns output commandline flag.com.github.fracpete.processoutput4j.core.StreamingProcessOutputTypegetOutputType()Returns what output from the process to forward.StringgetPrefixStdErr()Returns the (optional) prefix to use for output from stderr.StringgetPrefixStdOut()Returns the (optional) prefix to use for output from stdout.StringgetQuickInfo()Returns a quick info about the actor, which will be displayed in the GUI.StringgetRsh()StringgetRsyncPath()StringgetSource()Returns the current source path/url.StringglobalInfo()Returns a string describing the object.StringincludeFromTipText()StringincludeTipText()booleanisArchive()booleanisChecksum()booleanisDelete()booleanisDryRun()booleanisExecutability()booleanisPerms()booleanisQuiet()booleanisRecursive()booleanisRelative()booleanisTimes()booleanisVerbose()StringmaxTimeTipText()StringoutputCommandlineTipText()StringpermsTipText()StringprefixStdErrTipText()Returns the tip text for this property.StringprefixStdOutTipText()Returns the tip text for this property.voidprocessOutput(String line, boolean stdout)Processes the incoming line.StringquietTipText()StringrecursiveTipText()StringrelativeTipText()StringrshTipText()StringrsyncPathTipText()voidsetArchive(boolean value)voidsetChecksum(boolean value)voidsetDelete(boolean value)voidsetDestination(String value)Sets the destination path/url.voidsetDryRun(boolean value)voidsetExclude(BaseString[] value)voidsetExcludeFrom(PlaceholderFile value)voidsetExecutability(boolean value)voidsetFilesFrom(PlaceholderFile value)voidsetFilter(BaseString[] value)voidsetInclude(BaseString[] value)voidsetIncludeFrom(PlaceholderFile value)voidsetMaxTime(int value)voidsetOutputCommandline(boolean value)Sets output commandline flag.voidsetPerms(boolean value)voidsetPrefixStdErr(String value)Sets the (optional) prefix to use for output from stderr.voidsetPrefixStdOut(String value)Sets the (optional) prefix to use for output from stdout.voidsetQuiet(boolean value)voidsetRecursive(boolean value)voidsetRelative(boolean value)voidsetRsh(String value)voidsetRsyncPath(String value)voidsetSource(String value)Sets the source path/url.voidsetTimes(boolean value)voidsetVerbose(boolean value)StringsourceTipText()StringtimesTipText()StringverboseTipText()-
Methods inherited from class adams.flow.source.AbstractBufferingSource
hasPendingOutput, initialize, output, reset, wrapUp
-
Methods inherited from class adams.flow.core.AbstractActor
annotationsTipText, backupState, 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, isBackedUp, isExecuted, isExecuting, isFinished, isHeadless, isStopped, nameTipText, performSetUpChecks, performVariableChecks, postExecute, preExecute, pruneBackup, pruneBackup, restoreState, 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
-
m_Source
protected String m_Source
the source path/url.
-
m_Destination
protected String m_Destination
the destination path/url.
-
m_OutputCommandline
protected boolean m_OutputCommandline
whether to output the commandline.
-
m_Verbose
protected boolean m_Verbose
-
m_Quiet
protected boolean m_Quiet
-
m_Checksum
protected boolean m_Checksum
-
m_Archive
protected boolean m_Archive
-
m_Recursive
protected boolean m_Recursive
-
m_Relative
protected boolean m_Relative
-
m_Perms
protected boolean m_Perms
-
m_Executability
protected boolean m_Executability
-
m_Times
protected boolean m_Times
-
m_DryRun
protected boolean m_DryRun
-
m_Rsh
protected String m_Rsh
-
m_RsyncPath
protected String m_RsyncPath
-
m_Delete
protected boolean m_Delete
-
m_Exclude
protected BaseString[] m_Exclude
-
m_ExcludeFrom
protected PlaceholderFile m_ExcludeFrom
-
m_Include
protected BaseString[] m_Include
-
m_IncludeFrom
protected PlaceholderFile m_IncludeFrom
-
m_FilesFrom
protected PlaceholderFile m_FilesFrom
-
m_Filter
protected BaseString[] m_Filter
-
m_MaxTime
protected int m_MaxTime
-
m_PrefixStdOut
protected String m_PrefixStdOut
the stdout prefix.
-
m_PrefixStdErr
protected String m_PrefixStdErr
the stderr prefix.
-
-
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
-
setSource
public void setSource(String value)
Sets the source path/url.- Parameters:
value- the source
-
getSource
public String getSource()
Returns the current source path/url.- Returns:
- the source, null if not set
-
sourceTipText
public String sourceTipText()
-
setDestination
public void setDestination(String value)
Sets the destination path/url.- Parameters:
value- the destination
-
getDestination
public String getDestination()
Returns the current destination path/url.- Returns:
- the destination, null if not set
-
destinationTipText
public String destinationTipText()
-
setOutputCommandline
public void setOutputCommandline(boolean value)
Sets output commandline flag.- Parameters:
value- true if to output commandline
-
getOutputCommandline
public boolean getOutputCommandline()
Returns output commandline flag.- Returns:
- true if to output commandline
-
outputCommandlineTipText
public String outputCommandlineTipText()
-
isVerbose
public boolean isVerbose()
-
setVerbose
public void setVerbose(boolean value)
-
verboseTipText
public String verboseTipText()
-
isQuiet
public boolean isQuiet()
-
setQuiet
public void setQuiet(boolean value)
-
quietTipText
public String quietTipText()
-
isChecksum
public boolean isChecksum()
-
setChecksum
public void setChecksum(boolean value)
-
checksumTipText
public String checksumTipText()
-
isArchive
public boolean isArchive()
-
setArchive
public void setArchive(boolean value)
-
archiveTipText
public String archiveTipText()
-
isRecursive
public boolean isRecursive()
-
setRecursive
public void setRecursive(boolean value)
-
recursiveTipText
public String recursiveTipText()
-
isRelative
public boolean isRelative()
-
setRelative
public void setRelative(boolean value)
-
relativeTipText
public String relativeTipText()
-
isPerms
public boolean isPerms()
-
setPerms
public void setPerms(boolean value)
-
permsTipText
public String permsTipText()
-
isExecutability
public boolean isExecutability()
-
setExecutability
public void setExecutability(boolean value)
-
executabilityTipText
public String executabilityTipText()
-
isTimes
public boolean isTimes()
-
setTimes
public void setTimes(boolean value)
-
timesTipText
public String timesTipText()
-
isDryRun
public boolean isDryRun()
-
setDryRun
public void setDryRun(boolean value)
-
dryRunTipText
public String dryRunTipText()
-
getRsh
public String getRsh()
-
setRsh
public void setRsh(String value)
-
rshTipText
public String rshTipText()
-
getRsyncPath
public String getRsyncPath()
-
setRsyncPath
public void setRsyncPath(String value)
-
rsyncPathTipText
public String rsyncPathTipText()
-
isDelete
public boolean isDelete()
-
setDelete
public void setDelete(boolean value)
-
deleteTipText
public String deleteTipText()
-
getExclude
public BaseString[] getExclude()
-
setExclude
public void setExclude(BaseString[] value)
-
excludeTipText
public String excludeTipText()
-
getExcludeFrom
public PlaceholderFile getExcludeFrom()
-
setExcludeFrom
public void setExcludeFrom(PlaceholderFile value)
-
excludeFromTipText
public String excludeFromTipText()
-
getInclude
public BaseString[] getInclude()
-
setInclude
public void setInclude(BaseString[] value)
-
includeTipText
public String includeTipText()
-
getIncludeFrom
public PlaceholderFile getIncludeFrom()
-
setIncludeFrom
public void setIncludeFrom(PlaceholderFile value)
-
includeFromTipText
public String includeFromTipText()
-
getFilesFrom
public PlaceholderFile getFilesFrom()
-
setFilesFrom
public void setFilesFrom(PlaceholderFile value)
-
filesFromTipText
public String filesFromTipText()
-
getFilter
public BaseString[] getFilter()
-
setFilter
public void setFilter(BaseString[] value)
-
filterTipText
public String filterTipText()
-
getMaxTime
public int getMaxTime()
-
setMaxTime
public void setMaxTime(int value)
-
maxTimeTipText
public String maxTimeTipText()
-
setPrefixStdOut
public void setPrefixStdOut(String value)
Sets the (optional) prefix to use for output from stdout.- Parameters:
value- the prefix
-
getPrefixStdOut
public String getPrefixStdOut()
Returns the (optional) prefix to use for output from stdout.- Returns:
- the prefix
-
prefixStdOutTipText
public String prefixStdOutTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setPrefixStdErr
public void setPrefixStdErr(String value)
Sets the (optional) prefix to use for output from stderr.- Parameters:
value- the prefix
-
getPrefixStdErr
public String getPrefixStdErr()
Returns the (optional) prefix to use for output from stderr.- Returns:
- the prefix
-
prefixStdErrTipText
public String prefixStdErrTipText()
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:
getQuickInfoin interfaceActor- Specified by:
getQuickInfoin interfaceQuickInfoSupporter- Overrides:
getQuickInfoin classAbstractActor- Returns:
- null if no info available, otherwise short string
-
generates
public Class[] generates()
Returns the class of objects that it generates.- Specified by:
generatesin interfaceOutputProducer- Returns:
- the Class of the generated tokens
-
getOutputType
public com.github.fracpete.processoutput4j.core.StreamingProcessOutputType getOutputType()
Returns what output from the process to forward.- Specified by:
getOutputTypein interfacecom.github.fracpete.processoutput4j.core.StreamingProcessOwner- Returns:
- the output type
-
processOutput
public void processOutput(String line, boolean stdout)
Processes the incoming line.- Specified by:
processOutputin interfacecom.github.fracpete.processoutput4j.core.StreamingProcessOwner- Parameters:
line- the line to processstdout- whether stdout or stderr
-
doExecute
protected String doExecute()
Executes the flow item.- Specified by:
doExecutein classAbstractActor- Returns:
- null if everything is fine, otherwise error message
-
-