Class PushTask.PushTaskBuilder

Enclosing class:
PushTask

public static class PushTask.PushTaskBuilder extends AbstractOptimisedTask.AbstractOptimisedTaskBuilder<PushTask.PushTaskBuilder,PushTask,com.sshtools.common.files.AbstractFile>
Builder for PushTask.
  • Method Details

    • create

      public static PushTask.PushTaskBuilder create()
      Returns:
      builder
    • addFilePaths

      public PushTask.PushTaskBuilder addFilePaths(Collection<String> filePaths)
      Add a collection of paths to transfer. Each should be the path of the Local file, and will be resolved against the current virtual file system configured on the SftpClient.
      Parameters:
      filePaths - file paths to add.
      Returns:
      builder for chaining
    • addPaths

      public PushTask.PushTaskBuilder addPaths(Collection<Path> paths)
      Add a collection of paths to transfer. Each should be the path of the Local file, and will be resolved against the current virtual file system configured on the SftpClient.
      Parameters:
      paths - file paths to add.
      Returns:
      builder for chaining
    • addFiles

      public PushTask.PushTaskBuilder addFiles(Collection<File> files)
      Add a collection of files to transfer. Each should be the path of the Local file, and will be resolved against the current virtual file system configured on the SftpClient.
      Parameters:
      files - file paths to add.
      Returns:
      builder for chaining
    • withFilePaths

      public PushTask.PushTaskBuilder withFilePaths(Collection<String> files)
      Set a collection of file paths to transfer. Any paths already added to this builder will be replaced. Each should be the path of the Local file, and will be resolved against the current virtual file system configured on the SftpClient.
      Parameters:
      paths - all file paths to transfer.
      Returns:
      builder for chaining
    • withPaths

      public PushTask.PushTaskBuilder withPaths(Collection<Path> paths)
      Set a collection of file paths to transfer. Any paths already added to this builder will be replaced. Each should be the path of the Local file, and will be resolved against the current virtual file system configured on the SftpClient.
      Parameters:
      paths - all file paths to transfer.
      Returns:
      builder for chaining
    • withFiles

      public PushTask.PushTaskBuilder withFiles(File... files)
      Set an array of files to transfer. Any paths already added to this builder will be replaced. Each should be the path of the Local file, and will be resolved against the current virtual file system configured on the SftpClient.
      Parameters:
      files - all file paths to transfer.
      Returns:
      builder for chaining
    • withPaths

      public PushTask.PushTaskBuilder withPaths(Path... paths)
      Set an array of files to transfer. Any paths already added to this builder will be replaced. Each should be the path of the Local file, and will be resolved against the current virtual file system configured on the SftpClient.
      Parameters:
      paths - all file paths to transfer.
      Returns:
      builder for chaining
    • withFilesPaths

      public PushTask.PushTaskBuilder withFilesPaths(String... filePaths)
      Set an array of files to transfer. Any paths already added to this builder will be replaced. Each should be the path of the Local file, and will be resolved against the current virtual file system configured on the SftpClient.
      Parameters:
      filePaths - all file paths to transfer.
      Returns:
      builder for chaining
    • withRemoteFolder

      public PushTask.PushTaskBuilder withRemoteFolder(String remoteFolder)
      Set the remote folder where any transferred paths will be placed.
      Parameters:
      remoteFolder - remote folder
      Returns:
      builder for chaining
    • withRemoteFolder

      public PushTask.PushTaskBuilder withRemoteFolder(Path remoteFolder)
      Set the remote folder where any transferred paths will be placed.
      Parameters:
      remoteFolder - remote folder
      Returns:
      builder for chaining
    • withRemoteFolder

      public PushTask.PushTaskBuilder withRemoteFolder(Optional<Path> remoteFolder)
      Set the remote folder where any transferred paths will be placed. If this evaluates to Optional.empty(), then the default remote folder will be used (e.g. the users home directory).
      Parameters:
      remoteFolder - remote folder
      Returns:
      builder for chaining
    • build

      public PushTask build()
      Build a new PushTask that may be scheduled for execution (e.g. SshClient.addTask(Task)). The created task takes a copy of the configuration in this builder for the immutable task, so if the builder is changed after building the task instance, it will not be affected.
      Specified by:
      build in class AbstractFileTask.AbstractFileTaskBuilder<PushTask.PushTaskBuilder,PushTask>
      Returns:
      task