}
String sshInstallDir = getInstallDir().replace('\\', '/');
SFTPClient sftpClient = sshLauncher.getSFTPClient();
SCPClient scpClient = sshLauncher.getSCPClient();
try {
if (!sftpClient.exists(sshInstallDir)) {
sftpClient.mkdirs(sshInstallDir, 0755);
}
}
catch (IOException ioe) {
logger.info(Strings.get("mkdir.failed", sshInstallDir, host));
throw new IOException(ioe);
}
if (checkIfAlreadyInstalled(host, sshInstallDir))
continue;
//delete the sshInstallDir contents if non-empty
try {
//get list of file in DAS sshInstallDir
List<String> files = getListOfInstallFiles(sshInstallDir);
deleteRemoteFiles(sftpClient, files, sshInstallDir, getForce());
}
catch (IOException ex) {
logger.finer("Failed to remove sshInstallDir contents");
throw new IOException(ex);
}
String zip = zipFile.getCanonicalPath();
try {
logger.info("Copying " + zip + " (" + zipFile.length() + " bytes)"
+ " to " + host + ":" + sshInstallDir);
// Looks like we need to quote the paths to scp in case they
// contain spaces.
scpClient.put(zipFile.getAbsolutePath(), FileUtils.quoteString(sshInstallDir));
logger.finer("Copied " + zip + " to " + host + ":" + sshInstallDir);
}
catch (IOException ex) {
logger.info(Strings.get("cannot.copy.zip.file", zip, host));
throw new IOException(ex);