INT-1664 renamed copy() methods to read(..) and write(..)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -125,12 +125,12 @@ public class CachingSessionFactory implements SessionFactory, DisposableBean {
|
||||
return this.targetSession.<F>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() {
|
||||
|
||||
@@ -35,9 +35,9 @@ public interface Session {
|
||||
|
||||
<F> 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();
|
||||
|
||||
|
||||
@@ -159,7 +159,7 @@ public abstract class AbstractInboundFileSynchronizer<F> 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){
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user