Author: davsclaus Date: Wed Oct 6 06:17:52 2010 New Revision: 1004901 URL: http://svn.apache.org/viewvc?rev=1004901&view=rev Log: Polished
Modified: camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpOperations.java camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java Modified: camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpOperations.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpOperations.java?rev=1004901&r1=1004900&r2=1004901&view=diff ============================================================================== --- camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpOperations.java (original) +++ camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpOperations.java Wed Oct 6 06:17:52 2010 @@ -238,7 +238,7 @@ public class FtpOperations implements Re public boolean buildDirectory(String directory, boolean absolute) throws GenericFileOperationFailedException { if (log.isTraceEnabled()) { - log.trace("makeDirectory(" + directory + ")"); + log.trace("buildDirectory(" + directory + ")"); } try { String originalDirectory = client.printWorkingDirectory(); @@ -486,7 +486,7 @@ public class FtpOperations implements Re public String getCurrentDirectory() throws GenericFileOperationFailedException { if (log.isTraceEnabled()) { - log.trace("printWorkingDirectory()"); + log.trace("getCurrentDirectory()"); } try { return client.printWorkingDirectory(); @@ -636,25 +636,4 @@ public class FtpOperations implements Re return success; } - private boolean changeDirectoryChunks(String dirName) throws GenericFileOperationFailedException { - final String[] dirs = dirName.split("/|\\\\"); - - boolean success = false; - for (String dir : dirs) { - if (log.isTraceEnabled()) { - log.trace("Changing to directory: " + dir); - } - try { - success = client.changeWorkingDirectory(dir); - } catch (IOException e) { - throw new GenericFileOperationFailedException(client.getReplyCode(), client.getReplyString(), e.getMessage(), e); - } - if (!success) { - return false; - } - } - - return success; - } - } Modified: camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java?rev=1004901&r1=1004900&r2=1004901&view=diff ============================================================================== --- camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java (original) +++ camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java Wed Oct 6 06:17:52 2010 @@ -267,6 +267,9 @@ public class SftpOperations implements R } public boolean buildDirectory(String directory, boolean absolute) throws GenericFileOperationFailedException { + if (LOG.isTraceEnabled()) { + LOG.trace("buildDirectory(" + directory + "," + absolute + ")"); + } // ignore absolute as all dirs are relative with FTP boolean success = false; @@ -335,6 +338,9 @@ public class SftpOperations implements R } public String getCurrentDirectory() throws GenericFileOperationFailedException { + if (LOG.isTraceEnabled()) { + LOG.trace("getCurrentDirectory()"); + } try { return channel.pwd(); } catch (SftpException e) { @@ -343,6 +349,9 @@ public class SftpOperations implements R } public void changeCurrentDirectory(String path) throws GenericFileOperationFailedException { + if (LOG.isTraceEnabled()) { + LOG.trace("changeCurrentDirectory(" + path + ")"); + } if (ObjectHelper.isEmpty(path)) { return; } @@ -385,6 +394,9 @@ public class SftpOperations implements R } public void changeToParentDirectory() throws GenericFileOperationFailedException { + if (LOG.isTraceEnabled()) { + LOG.trace("changeToParentDirectory()"); + } String current = getCurrentDirectory(); String parent = FileUtil.compactPath(current + "/.."); @@ -401,6 +413,9 @@ public class SftpOperations implements R } public List<ChannelSftp.LsEntry> listFiles(String path) throws GenericFileOperationFailedException { + if (LOG.isTraceEnabled()) { + LOG.trace("listFiles(" + path + ")"); + } if (ObjectHelper.isEmpty(path)) { // list current directory if file path is not given path = "."; @@ -422,6 +437,9 @@ public class SftpOperations implements R } public boolean retrieveFile(String name, Exchange exchange) throws GenericFileOperationFailedException { + if (LOG.isTraceEnabled()) { + LOG.trace("retrieveFile(" + name + ")"); + } if (ObjectHelper.isNotEmpty(endpoint.getLocalWorkDirectory())) { // local work directory is configured so we should store file content as files in this local directory return retrieveFileToFileInLocalWorkDirectory(name, exchange); @@ -565,6 +583,10 @@ public class SftpOperations implements R } public boolean storeFile(String name, Exchange exchange) throws GenericFileOperationFailedException { + if (LOG.isTraceEnabled()) { + LOG.trace("storeFile(" + name + ")"); + } + // if an existing file already exists what should we do? if (endpoint.getFileExist() == GenericFileExist.Ignore || endpoint.getFileExist() == GenericFileExist.Fail) { boolean existFile = existsFile(name); @@ -599,6 +621,10 @@ public class SftpOperations implements R } public boolean existsFile(String name) throws GenericFileOperationFailedException { + if (LOG.isTraceEnabled()) { + LOG.trace("existsFile(" + name + ")"); + } + // check whether a file already exists String directory = FileUtil.onlyPath(name); if (directory == null) {