Class SshRunner

java.lang.Object
nl.knaw.dans.layerstore.AbstractRunner
nl.knaw.dans.layerstore.SshRunner

public class SshRunner extends AbstractRunner
A runner for the ssh command line tool, which executes commands on a remote host via SSH.
  • Constructor Details

    • SshRunner

      public SshRunner(Path sshExecutable, String user, String host, Path remoteBaseDir)
      Creates a new SshRunner.
      Parameters:
      sshExecutable - path to the ssh executable
      user - username for the remote host
      host - host name or IP address of the remote host
      remoteBaseDir - base directory on the remote host where archives are stored
    • SshRunner

      public SshRunner(Path sshExecutable, String user, String host, Path remoteBaseDir, int connectionTimeout)
      Creates a new SshRunner.
      Parameters:
      sshExecutable - path to the ssh executable
      user - username for the remote host
      host - host name or IP address of the remote host
      remoteBaseDir - base directory on the remote host where archives are stored
      connectionTimeout - connection timeout in seconds
  • Method Details

    • fileExists

      public boolean fileExists(String archiveName)
      Checks if the given archive name exists on the remote host.
      Parameters:
      archiveName - the name of the archive to check
      Returns:
      true if the archive exists, false otherwise
    • listFiles

      public List<String> listFiles()
      Lists the files in the remote base directory.
      Returns:
      a list of file names in the remote base directory