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 2013/09/05 13:32:45 UTC

[2/3] git commit: CAMEL-6671: FTP consumer. Added useList and ignoreFileNotFound options to allow to download a single file without using FTP LIST command which is needed in some use-cases, such as user has no permission to do FTP LIST.

CAMEL-6671: FTP consumer. Added useList and ignoreFileNotFound options to allow to download a single file without using FTP LIST command which is needed in some use-cases, such as user has no permission to do FTP LIST.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/e92a69c2
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/e92a69c2
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/e92a69c2

Branch: refs/heads/master
Commit: e92a69c2382c5b827d8a4f83a7f0e904a92ff9a1
Parents: d99d594
Author: Claus Ibsen <da...@apache.org>
Authored: Thu Sep 5 13:06:58 2013 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Sep 5 13:22:23 2013 +0200

----------------------------------------------------------------------
 .../apache/camel/component/file/GenericFileConsumer.java    | 9 +++++++--
 .../camel/component/file/remote/RemoteFileEndpoint.java     | 4 ++++
 2 files changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/e92a69c2/camel-core/src/main/java/org/apache/camel/component/file/GenericFileConsumer.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/file/GenericFileConsumer.java b/camel-core/src/main/java/org/apache/camel/component/file/GenericFileConsumer.java
index c55755e..3a3fc59 100644
--- a/camel-core/src/main/java/org/apache/camel/component/file/GenericFileConsumer.java
+++ b/camel-core/src/main/java/org/apache/camel/component/file/GenericFileConsumer.java
@@ -201,7 +201,7 @@ public abstract class GenericFileConsumer<T> extends ScheduledBatchPollingConsum
                 started = processExchange(exchange);
             }
 
-            // if we did not start process the file then decremember the counter
+            // if we did not start process the file then decrement the counter
             if (!started) {
                 answer--;
             }
@@ -213,6 +213,12 @@ public abstract class GenericFileConsumer<T> extends ScheduledBatchPollingConsum
         return answer;
     }
 
+    /**
+     * Drain any in progress files as we are done with this batch
+     *
+     * @param exchanges  the exchanges
+     * @param limit      the limit
+     */
     protected void removeExcessiveInProgressFiles(Deque<Exchange> exchanges, int limit) {
         // remove the file from the in progress list in case the batch was limited by max messages per poll
         while (exchanges.size() > limit) {
@@ -224,7 +230,6 @@ public abstract class GenericFileConsumer<T> extends ScheduledBatchPollingConsum
         }
     }
 
-
     /**
      * Whether or not we can continue polling for more files
      *

http://git-wip-us.apache.org/repos/asf/camel/blob/e92a69c2/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileEndpoint.java b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileEndpoint.java
index 1951143..6ceaa01 100644
--- a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileEndpoint.java
+++ b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileEndpoint.java
@@ -103,6 +103,10 @@ public abstract class RemoteFileEndpoint<T> extends GenericFileEndpoint<T> {
             idempotentRepository = MemoryIdempotentRepository.memoryIdempotentRepository(DEFAULT_IDEMPOTENT_CACHE_SIZE);
         }
 
+        if (!getConfiguration().isUseList() && getFileName() == null) {
+            throw new IllegalArgumentException("Endpoint is configured with useList=false, then fileName must be configured also");
+        }
+
         // set max messages per poll
         consumer.setMaxMessagesPerPoll(getMaxMessagesPerPoll());
         consumer.setEagerLimitMaxMessagesPerPoll(isEagerMaxMessagesPerPoll());