Package nl.knaw.dans.layerstore
Class SshRunner
java.lang.Object
nl.knaw.dans.layerstore.AbstractRunner
nl.knaw.dans.layerstore.SshRunner
A runner for the ssh command line tool, which executes commands on a remote host via SSH.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
fileExists
(String archiveName) Checks if the given archive name exists on the remote host.Lists the files in the remote base directory.Methods inherited from class nl.knaw.dans.layerstore.AbstractRunner
checkExecutableForSecurity, checkRemoteBaseDirForSecurity, checkUserOrHostNameForSecurity
-
Constructor Details
-
SshRunner
Creates a new SshRunner.- Parameters:
sshExecutable
- path to the ssh executableuser
- username for the remote hosthost
- host name or IP address of the remote hostremoteBaseDir
- 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 executableuser
- username for the remote hosthost
- host name or IP address of the remote hostremoteBaseDir
- base directory on the remote host where archives are storedconnectionTimeout
- connection timeout in seconds
-
-
Method Details
-
fileExists
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
Lists the files in the remote base directory.- Returns:
- a list of file names in the remote base directory
-