use of org.apache.commons.vfs.FileSystemException in project symmetric-ds by JumpMind.
the class FtpDataWriter method sendFiles.
protected void sendFiles() {
if (fileInfoByTable.size() > 0) {
try {
String sftpUri = buildUri();
FileSystemOptions opts = new FileSystemOptions();
FtpFileSystemConfigBuilder.getInstance().setUserDirIsRoot(opts, true);
SftpFileSystemConfigBuilder.getInstance().setStrictHostKeyChecking(opts, "no");
SftpFileSystemConfigBuilder.getInstance().setTimeout(opts, 60000);
Collection<FileInfo> fileInfos = fileInfoByTable.values();
for (FileInfo fileInfo : fileInfos) {
FileObject fileObject = manager.resolveFile(sftpUri + "/" + fileInfo.outputFile.getName(), opts);
FileObject localFileObject = manager.resolveFile(fileInfo.outputFile.getAbsolutePath());
fileObject.copyFrom(localFileObject, Selectors.SELECT_SELF);
fileObject.close();
}
} catch (FileSystemException e) {
logger.warn("If you have not configured your ftp connection it should be configured in conf/ftp-extensions.xml");
throw new IoException(e);
} catch (Exception e) {
throw new IoException(e);
} finally {
manager.close();
}
}
}
Aggregations