INT-1614 replaced 'directoryExists' with 'exists'

This commit is contained in:
Mark Fisher
2010-11-19 12:44:10 -05:00
parent 8df06ae0cf
commit 7edbc931b1
4 changed files with 5 additions and 11 deletions

View File

@@ -79,7 +79,7 @@ public class SftpInboundFileSynchronizer extends AbstractInboundFileSynchronizer
logger.trace("Pooled SftpSession " + session + " from the pool");
}
session.connect();
Assert.isTrue(session.directoryExists(remotePath), "remote path '" + remotePath + "' does not exist");
Assert.isTrue(session.exists(remotePath), "remote path '" + remotePath + "' does not exist");
Collection<ChannelSftp.LsEntry> beforeFilter = session.ls(remotePath);
ChannelSftp.LsEntry[] entries = (beforeFilter == null) ? new ChannelSftp.LsEntry[0] :
beforeFilter.toArray(new ChannelSftp.LsEntry[beforeFilter.size()]);

View File

@@ -120,12 +120,8 @@ public class CachingSftpSessionFactory implements SftpSessionFactory, Disposable
}
}
public boolean directoryExists(String path) {
return this.targetSession.directoryExists(path);
}
public boolean mkdir(String path) {
return this.targetSession.mkdir(path);
public boolean exists(String path) {
return this.targetSession.exists(path);
}
public boolean rm(String path) {

View File

@@ -135,7 +135,7 @@ public class DefaultSftpSession implements SftpSession {
}
}
public boolean directoryExists(String path) {
public boolean exists(String path) {
try {
SftpATTRS attrs = channel.stat(path);
return (attrs != null) && attrs.isDir();

View File

@@ -37,9 +37,7 @@ public interface SftpSession {
void disconnect();
boolean directoryExists(String path);
boolean mkdir(String path);
boolean exists(String path);
boolean rm(String path);