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 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_MaxTime

        protected int m_MaxTime
      • m_PrefixStdOut

        protected String m_PrefixStdOut
        the stdout prefix.
      • m_PrefixStdErr

        protected String m_PrefixStdErr
        the stderr prefix.
    • Constructor Detail

      • SimpleRSync

        public SimpleRSync()
    • Method Detail

      • 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()
      • setExclude

        public void setExclude​(BaseString[] value)
      • excludeTipText

        public String excludeTipText()
      • excludeFromTipText

        public String excludeFromTipText()
      • setInclude

        public void setInclude​(BaseString[] value)
      • includeTipText

        public String includeTipText()
      • includeFromTipText

        public String includeFromTipText()
      • filesFromTipText

        public String filesFromTipText()
      • 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.
      • generates

        public Class[] generates()
        Returns the class of objects that it generates.
        Specified by:
        generates in interface OutputProducer
        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:
        getOutputType in interface com.github.fracpete.processoutput4j.core.StreamingProcessOwner
        Returns:
        the output type
      • processOutput

        public void processOutput​(String line,
                                  boolean stdout)
        Processes the incoming line.
        Specified by:
        processOutput in interface com.github.fracpete.processoutput4j.core.StreamingProcessOwner
        Parameters:
        line - the line to process
        stdout - whether stdout or stderr
      • doExecute

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