You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2010/09/23 15:31:27 UTC

svn commit: r1000459 - in /camel/trunk: camel-core/src/main/java/org/apache/camel/component/file/ components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/

Author: davsclaus
Date: Thu Sep 23 13:31:27 2010
New Revision: 1000459

URL: http://svn.apache.org/viewvc?rev=1000459&view=rev
Log:
CAMEL-3149: Expose methods as public on file component, to make it easy for end users to leverage those if they want fine grained control of the file component, from Java code.

Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileProducer.java
    camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpEndpoint.java
    camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpsEndpoint.java
    camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileEndpoint.java
    camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileProducer.java
    camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpEndpoint.java

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileProducer.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileProducer.java?rev=1000459&r1=1000458&r2=1000459&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileProducer.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileProducer.java Thu Sep 23 13:31:27 2010
@@ -44,11 +44,11 @@ public class GenericFileProducer<T> exte
         this.operations = operations;
     }
     
-    protected String getFileSeparator() {
+    public String getFileSeparator() {
         return File.separator;
     }
 
-    protected String normalizePath(String name) {        
+    public String normalizePath(String name) {
         return FileUtil.normalizePath(name);
     }
 
@@ -177,25 +177,25 @@ public class GenericFileProducer<T> exte
      * If we fail writing out a file, we will call this method. This hook is
      * provided to disconnect from servers or clean up files we created (if needed).
      */
-    protected void handleFailedWrite(Exchange exchange, Exception exception) throws Exception {
+    public void handleFailedWrite(Exchange exchange, Exception exception) throws Exception {
         throw exception;
     }
 
     /**
      * Perform any actions that need to occur before we write such as connecting to an FTP server etc.
      */
-    protected void preWriteCheck() throws Exception {
+    public void preWriteCheck() throws Exception {
         // nothing needed to check
     }
 
     /**
      * Perform any actions that need to occur after we are done such as disconnecting.
      */
-    protected void postWriteCheck() {
+    public void postWriteCheck() {
         // nothing needed to check
     }
 
-    protected void writeFile(Exchange exchange, String fileName) throws GenericFileOperationFailedException {
+    public void writeFile(Exchange exchange, String fileName) throws GenericFileOperationFailedException {
         InputStream payload = exchange.getIn().getBody(InputStream.class);
         try {
             // build directory if auto create is enabled
@@ -232,7 +232,7 @@ public class GenericFileProducer<T> exte
 
     }
 
-    protected String createFileName(Exchange exchange) {
+    public String createFileName(Exchange exchange) {
         String answer;
 
         String name = exchange.getIn().getHeader(Exchange.FILE_NAME, String.class);
@@ -289,7 +289,7 @@ public class GenericFileProducer<T> exte
         return answer;
     }
 
-    protected String createTempFileName(Exchange exchange, String fileName) {
+    public String createTempFileName(Exchange exchange, String fileName) {
         // must normalize path to cater for Windows and other OS
         fileName = normalizePath(fileName);
 

Modified: camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpEndpoint.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpEndpoint.java?rev=1000459&r1=1000458&r2=1000459&view=diff
==============================================================================
--- camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpEndpoint.java (original)
+++ camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpEndpoint.java Thu Sep 23 13:31:27 2010
@@ -70,7 +70,7 @@ public class FtpEndpoint<T extends FTPFi
         }
     }
     
-    protected RemoteFileOperations<FTPFile> createRemoteFileOperations() throws Exception {
+    public RemoteFileOperations<FTPFile> createRemoteFileOperations() throws Exception {
         // configure ftp client
         FTPClient client = ftpClient;
         

Modified: camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpsEndpoint.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpsEndpoint.java?rev=1000459&r1=1000458&r2=1000459&view=diff
==============================================================================
--- camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpsEndpoint.java (original)
+++ camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpsEndpoint.java Thu Sep 23 13:31:27 2010
@@ -112,7 +112,7 @@ public class FtpsEndpoint extends FtpEnd
     }
 
     @Override
-    protected RemoteFileOperations<FTPFile> createRemoteFileOperations() throws Exception {
+    public RemoteFileOperations<FTPFile> createRemoteFileOperations() throws Exception {
         // configure ftp client
         FTPSClient client = getFtpsClient();
 

Modified: camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileEndpoint.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileEndpoint.java?rev=1000459&r1=1000458&r2=1000459&view=diff
==============================================================================
--- camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileEndpoint.java (original)
+++ camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileEndpoint.java Thu Sep 23 13:31:27 2010
@@ -122,7 +122,7 @@ public abstract class RemoteFileEndpoint
      * @return a new created operations
      * @throws Exception is thrown if error creating operations.
      */
-    protected abstract RemoteFileOperations<T> createRemoteFileOperations() throws Exception;
+    public abstract RemoteFileOperations<T> createRemoteFileOperations() throws Exception;
 
     /**
      * Returns human readable server information for logging purpose

Modified: camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileProducer.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileProducer.java?rev=1000459&r1=1000458&r2=1000459&view=diff
==============================================================================
--- camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileProducer.java (original)
+++ camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileProducer.java Thu Sep 23 13:31:27 2010
@@ -35,12 +35,12 @@ public class RemoteFileProducer<T> exten
     }
     
     @Override
-    protected String getFileSeparator() {
+    public String getFileSeparator() {
         return "/";
     }
     
     @Override
-    protected String normalizePath(String name) {        
+    public String normalizePath(String name) {
         return name;
     }
 
@@ -63,7 +63,7 @@ public class RemoteFileProducer<T> exten
     /**
      * The file could not be written. We need to disconnect from the remote server.
      */
-    protected void handleFailedWrite(Exchange exchange, Exception exception) throws Exception {
+    public void handleFailedWrite(Exchange exchange, Exception exception) throws Exception {
         loggedIn = false;
         if (isStopping() || isStopped()) {
             // if we are stopping then ignore any exception during a poll
@@ -92,7 +92,7 @@ public class RemoteFileProducer<T> exten
     }
 
     @Override
-    protected void preWriteCheck() throws Exception {
+    public void preWriteCheck() throws Exception {
         // before writing send a noop to see if the connection is alive and works
         boolean noop = false;
         if (loggedIn) {
@@ -127,7 +127,7 @@ public class RemoteFileProducer<T> exten
     }
 
     @Override
-    protected void postWriteCheck() {
+    public void postWriteCheck() {
         try {
             if (getEndpoint().isDisconnect()) {
                 if (log.isTraceEnabled()) {

Modified: camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpEndpoint.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpEndpoint.java?rev=1000459&r1=1000458&r2=1000459&view=diff
==============================================================================
--- camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpEndpoint.java (original)
+++ camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpEndpoint.java Thu Sep 23 13:31:27 2010
@@ -42,7 +42,7 @@ public class SftpEndpoint extends Remote
         return new RemoteFileProducer<ChannelSftp.LsEntry>(this, createRemoteFileOperations());
     }
 
-    protected RemoteFileOperations<ChannelSftp.LsEntry> createRemoteFileOperations() {
+    public RemoteFileOperations<ChannelSftp.LsEntry> createRemoteFileOperations() {
         SftpOperations operations = new SftpOperations();
         operations.setEndpoint(this);
         return operations;