public void copyDirectoryFrom( String fromDirName, String toDirName, boolean isRecursive, boolean failOnError ) { try { int port = localFileSystemOperations.openFileTransferSocket(); remoteFileSystemOperations.sendDirectoryTo(fromDirName, toDirName, HostUtils.getPublicLocalHostIp(this.atsAgent), port, isRecursive, failOnError); localFileSystemOperations.waitForFileTransferCompletion(port); } catch (Exception e) { String message = new StringBuilder().append("Unable to copy directory ") .append(fromDirName) .append(" from ") .append(this.atsAgent) .append(" to ") .append(toDirName) .append(" on the local host") .toString(); throw new FileSystemOperationException(message, e); } }
public void copyFileFrom( String fromFile, String toFile, boolean failOnError ) { try { Integer copyFileStartPort = getCopyFilePortProperty(ActionLibraryConfigurator.getInstance() .getCopyFileStartPort()); Integer copyFileEndPort = getCopyFilePortProperty(ActionLibraryConfigurator.getInstance() .getCopyFileEndPort()); if (copyFileStartPort != null && copyFileStartPort > 0 && copyFileEndPort != null && copyFileEndPort > 0) { localFileSystemOperations.setCopyFilePortRange(copyFileStartPort, copyFileEndPort); } int port = localFileSystemOperations.openFileTransferSocket(); remoteFileSystemOperations.sendFileTo(fromFile, toFile, HostUtils.getPublicLocalHostIp(this.atsAgent), port, failOnError); localFileSystemOperations.waitForFileTransferCompletion(port); } catch (Exception e) { String message = new StringBuilder().append("Unable to copy file ") .append(fromFile) .append(" from ") .append(this.atsAgent) .append(" to file ") .append(toFile) .append(" on the local host") .toString(); throw new FileSystemOperationException(message, e); } }