From f4f0c2ea36fd4c989de19434c6947eb2980e8946 Mon Sep 17 00:00:00 2001 From: Oleg Zhurakousky Date: Mon, 6 Dec 2010 12:37:51 -0500 Subject: [PATCH] INT-1664 renamed copy() methods to read(..) and write(..) --- .../remote/handler/FileTransferringMessageHandler.java | 2 +- .../file/remote/session/CachingSessionFactory.java | 8 ++++---- .../integration/file/remote/session/Session.java | 4 ++-- .../synchronizer/AbstractInboundFileSynchronizer.java | 2 +- .../integration/ftp/session/FtpSession.java | 4 ++-- .../integration/sftp/session/SftpSession.java | 9 ++------- 6 files changed, 12 insertions(+), 17 deletions(-) diff --git a/spring-integration-file/src/main/java/org/springframework/integration/file/remote/handler/FileTransferringMessageHandler.java b/spring-integration-file/src/main/java/org/springframework/integration/file/remote/handler/FileTransferringMessageHandler.java index 552ee1b6e5..5d402e3bc0 100644 --- a/spring-integration-file/src/main/java/org/springframework/integration/file/remote/handler/FileTransferringMessageHandler.java +++ b/spring-integration-file/src/main/java/org/springframework/integration/file/remote/handler/FileTransferringMessageHandler.java @@ -178,7 +178,7 @@ public class FileTransferringMessageHandler extends AbstractMessageHandler { remoteDirectory += File.separatorChar; } String remoteFilePath = remoteDirectory + file.getName(); - session.copy(fileInputStream, remoteFilePath); + session.write(fileInputStream, remoteFilePath); fileInputStream.close(); return true; } diff --git a/spring-integration-file/src/main/java/org/springframework/integration/file/remote/session/CachingSessionFactory.java b/spring-integration-file/src/main/java/org/springframework/integration/file/remote/session/CachingSessionFactory.java index 206a464af5..52621df315 100644 --- a/spring-integration-file/src/main/java/org/springframework/integration/file/remote/session/CachingSessionFactory.java +++ b/spring-integration-file/src/main/java/org/springframework/integration/file/remote/session/CachingSessionFactory.java @@ -125,12 +125,12 @@ public class CachingSessionFactory implements SessionFactory, DisposableBean { return this.targetSession.list(path); } - public void copy(String source, OutputStream os) throws IOException{ - this.targetSession.copy(source, os); + public void read(String source, OutputStream os) throws IOException{ + this.targetSession.read(source, os); } - public void copy(InputStream inputStream, String destination) throws IOException{ - this.targetSession.copy(inputStream, destination); + public void write(InputStream inputStream, String destination) throws IOException{ + this.targetSession.write(inputStream, destination); } public boolean isOpen() { diff --git a/spring-integration-file/src/main/java/org/springframework/integration/file/remote/session/Session.java b/spring-integration-file/src/main/java/org/springframework/integration/file/remote/session/Session.java index 2cd7c38438..c3117d5ee8 100644 --- a/spring-integration-file/src/main/java/org/springframework/integration/file/remote/session/Session.java +++ b/spring-integration-file/src/main/java/org/springframework/integration/file/remote/session/Session.java @@ -35,9 +35,9 @@ public interface Session { F[] list(String path) throws IOException; - void copy(String source, OutputStream outputStream) throws IOException; + void read(String source, OutputStream outputStream) throws IOException; - void copy(InputStream inputStream, String destination) throws IOException; + void write(InputStream inputStream, String destination) throws IOException; void close(); diff --git a/spring-integration-file/src/main/java/org/springframework/integration/file/remote/synchronizer/AbstractInboundFileSynchronizer.java b/spring-integration-file/src/main/java/org/springframework/integration/file/remote/synchronizer/AbstractInboundFileSynchronizer.java index 1d6dfebd7f..6848af8be8 100644 --- a/spring-integration-file/src/main/java/org/springframework/integration/file/remote/synchronizer/AbstractInboundFileSynchronizer.java +++ b/spring-integration-file/src/main/java/org/springframework/integration/file/remote/synchronizer/AbstractInboundFileSynchronizer.java @@ -159,7 +159,7 @@ public abstract class AbstractInboundFileSynchronizer implements InboundFileS InputStream inputStream = null; FileOutputStream fileOutputStream = new FileOutputStream(tempFile); try { - session.copy(remoteFilePath, fileOutputStream); + session.read(remoteFilePath, fileOutputStream); } catch (Exception e) { if (e instanceof RuntimeException){ diff --git a/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/session/FtpSession.java b/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/session/FtpSession.java index 4046483db2..0b1180ebc3 100644 --- a/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/session/FtpSession.java +++ b/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/session/FtpSession.java @@ -63,7 +63,7 @@ class FtpSession implements Session { return this.client.listFiles(path); } - public void copy(String path, OutputStream fos) throws IOException{ + public void read(String path, OutputStream fos) throws IOException{ Assert.hasText(path, "path must not be null"); Assert.notNull(fos, "outputStream must not be null"); boolean completed = this.client.retrieveFile(path, fos); @@ -73,7 +73,7 @@ class FtpSession implements Session { logger.info("File have been successfully transfered to: " + path); } - public void copy(InputStream inputStream, String path) throws IOException{ + public void write(InputStream inputStream, String path) throws IOException{ Assert.notNull(inputStream, "inputStream must not be null"); Assert.hasText(path, "path must not be null"); boolean completed = client.storeFile(path, inputStream); diff --git a/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/session/SftpSession.java b/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/session/SftpSession.java index 50102593d7..92868f97f9 100644 --- a/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/session/SftpSession.java +++ b/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/session/SftpSession.java @@ -21,9 +21,6 @@ import java.io.InputStream; import java.io.OutputStream; import java.util.Vector; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - import org.springframework.integration.file.remote.session.Session; import org.springframework.util.Assert; import org.springframework.util.FileCopyUtils; @@ -44,8 +41,6 @@ import com.jcraft.jsch.SftpException; */ class SftpSession implements Session { - private final Log logger = LogFactory.getLog(this.getClass()); - private volatile ChannelSftp channel; private final com.jcraft.jsch.Session jschSession; @@ -89,7 +84,7 @@ class SftpSession implements Session { return new LsEntry[0]; } - public void copy(String source, OutputStream os) throws IOException{ + public void read(String source, OutputStream os) throws IOException{ Assert.state(this.channel != null, "session is not connected"); try { @@ -101,7 +96,7 @@ class SftpSession implements Session { } } - public void copy(InputStream inputStream, String destination) throws IOException{ + public void write(InputStream inputStream, String destination) throws IOException{ Assert.state(this.channel != null, "session is not connected"); try { this.channel.put(inputStream, destination);