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 2019/05/28 04:10:29 UTC

[camel] 03/04: Move some options that was only used by file component out of general so they dont get inherited in ftp component.

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit dd6f67ae2cc44eafca1b8ab6901715114421d0f5
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue May 28 06:05:24 2019 +0200

    Move some options that was only used by file component out of general so they dont get inherited in ftp component.
---
 .../apache/camel/component/file/FileEndpoint.java  | 48 +++++++++++++++++++++-
 .../camel/component/file/GenericFileEndpoint.java  | 44 --------------------
 .../camel-ftp/src/main/docs/ftp-component.adoc     |  4 +-
 .../camel-ftp/src/main/docs/ftps-component.adoc    |  4 +-
 .../camel-ftp/src/main/docs/sftp-component.adoc    |  4 +-
 5 files changed, 49 insertions(+), 55 deletions(-)

diff --git a/components/camel-file/src/main/java/org/apache/camel/component/file/FileEndpoint.java b/components/camel-file/src/main/java/org/apache/camel/component/file/FileEndpoint.java
index 63af76d..a6100f1 100644
--- a/components/camel-file/src/main/java/org/apache/camel/component/file/FileEndpoint.java
+++ b/components/camel-file/src/main/java/org/apache/camel/component/file/FileEndpoint.java
@@ -57,12 +57,18 @@ public class FileEndpoint extends GenericFileEndpoint<File> {
     private boolean copyAndDeleteOnRenameFail = true;
     @UriParam(label = "advanced")
     private boolean renameUsingCopy;
-    @UriParam(label = "producer,advanced", defaultValue = "true")
-    private boolean forceWrites = true;
+    @UriParam(label = "consumer,advanced")
+    protected boolean startingDirectoryMustExist;
+    @UriParam(label = "consumer,advanced")
+    protected boolean startingDirectoryMustHaveAccess;
+    @UriParam(label = "consumer,advanced")
+    protected boolean directoryMustExist;
     @UriParam(label = "consumer,advanced")
     private boolean probeContentType;
     @UriParam(label = "consumer,advanced")
     private String extendedAttributes;
+    @UriParam(label = "producer,advanced", defaultValue = "true")
+    private boolean forceWrites = true;
     @UriParam(label = "producer,advanced")
     private String chmod;
     @UriParam(label = "producer,advanced")
@@ -258,6 +264,44 @@ public class FileEndpoint extends GenericFileEndpoint<File> {
         this.renameUsingCopy = renameUsingCopy;
     }
 
+    public boolean isStartingDirectoryMustExist() {
+        return startingDirectoryMustExist;
+    }
+
+    /**
+     * Whether the starting directory must exist. Mind that the autoCreate option is default enabled,
+     * which means the starting directory is normally auto created if it doesn't exist.
+     * You can disable autoCreate and enable this to ensure the starting directory must exist. Will thrown an exception if the directory doesn't exist.
+     */
+    public void setStartingDirectoryMustExist(boolean startingDirectoryMustExist) {
+        this.startingDirectoryMustExist = startingDirectoryMustExist;
+    }
+
+    public boolean isStartingDirectoryMustHaveAccess() {
+        return startingDirectoryMustHaveAccess;
+    }
+
+    /**
+     * Whether the starting directory has access permissions. Mind that the
+     * startingDirectoryMustExist parameter must be set to true in order to verify that the
+     * directory exists. Will thrown an exception if the directory doesn't have
+     * read and write permissions.
+     */
+    public void setStartingDirectoryMustHaveAccess(boolean startingDirectoryMustHaveAccess) {
+        this.startingDirectoryMustHaveAccess = startingDirectoryMustHaveAccess;
+    }
+
+    public boolean isDirectoryMustExist() {
+        return directoryMustExist;
+    }
+
+    /**
+     * Similar to the startingDirectoryMustExist option but this applies during polling (after starting the consumer).
+     */
+    public void setDirectoryMustExist(boolean directoryMustExist) {
+        this.directoryMustExist = directoryMustExist;
+    }
+
     public boolean isForceWrites() {
         return forceWrites;
     }
diff --git a/components/camel-file/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java b/components/camel-file/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java
index 62c39bd..ed2b8c9 100644
--- a/components/camel-file/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java
+++ b/components/camel-file/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java
@@ -108,12 +108,6 @@ public abstract class GenericFileEndpoint<T> extends ScheduledPollEndpoint imple
     protected IdempotentRepository inProgressRepository = MemoryIdempotentRepository.memoryIdempotentRepository(DEFAULT_IN_PROGRESS_CACHE_SIZE);
     @UriParam(label = "consumer,advanced")
     protected String localWorkDirectory;
-    @UriParam(label = "consumer,advanced")
-    protected boolean startingDirectoryMustExist;
-    @UriParam(label = "consumer,advanced")
-    protected boolean startingDirectoryMustHaveAccess;
-    @UriParam(label = "consumer,advanced")
-    protected boolean directoryMustExist;
     @UriParam(label = "consumer")
     protected boolean noop;
     @UriParam(label = "consumer")
@@ -1111,44 +1105,6 @@ public abstract class GenericFileEndpoint<T> extends ScheduledPollEndpoint imple
         this.autoCreate = autoCreate;
     }
 
-    public boolean isStartingDirectoryMustExist() {
-        return startingDirectoryMustExist;
-    }
-
-    /**
-     * Whether the starting directory must exist. Mind that the autoCreate option is default enabled,
-     * which means the starting directory is normally auto created if it doesn't exist.
-     * You can disable autoCreate and enable this to ensure the starting directory must exist. Will thrown an exception if the directory doesn't exist.
-     */
-    public void setStartingDirectoryMustExist(boolean startingDirectoryMustExist) {
-        this.startingDirectoryMustExist = startingDirectoryMustExist;
-    }
-
-    public boolean isStartingDirectoryMustHaveAccess() {
-        return startingDirectoryMustHaveAccess;
-    }
-
-    /**
-     * Whether the starting directory has access permissions. Mind that the
-     * startingDirectoryMustExist parameter must be set to true in order to verify that the
-     * directory exists. Will thrown an exception if the directory doesn't have
-     * read and write permissions.
-     */
-    public void setStartingDirectoryMustHaveAccess(boolean startingDirectoryMustHaveAccess) {
-        this.startingDirectoryMustHaveAccess = startingDirectoryMustHaveAccess;
-    }
-
-    public boolean isDirectoryMustExist() {
-        return directoryMustExist;
-    }
-
-    /**
-     * Similar to the startingDirectoryMustExist option but this applies during polling (after starting the consumer).
-     */
-    public void setDirectoryMustExist(boolean directoryMustExist) {
-        this.directoryMustExist = directoryMustExist;
-    }
-
     public GenericFileProcessStrategy<T> getProcessStrategy() {
         return processStrategy;
     }
diff --git a/components/camel-ftp/src/main/docs/ftp-component.adoc b/components/camel-ftp/src/main/docs/ftp-component.adoc
index a48b3ee..229b955 100644
--- a/components/camel-ftp/src/main/docs/ftp-component.adoc
+++ b/components/camel-ftp/src/main/docs/ftp-component.adoc
@@ -109,7 +109,7 @@ with the following path and query parameters:
 |===
 
 
-==== Query Parameters (111 parameters):
+==== Query Parameters (109 parameters):
 
 
 [width="100%",cols="2,5,^1,2",options="header"]
@@ -136,7 +136,6 @@ with the following path and query parameters:
 | *resumeDownload* (consumer) | Configures whether resume download is enabled. This must be supported by the FTP server (almost all FTP servers support it). In addition the options localWorkDirectory must be configured so downloaded files are stored in a local directory, and the option binary must be enabled, which is required to support resuming of downloads. | false | boolean
 | *sendEmptyMessageWhenIdle* (consumer) | If the polling consumer did not poll any files, you can enable this option to send an empty message (no body) instead. | false | boolean
 | *streamDownload* (consumer) | Sets the download method to use when not using a local working directory. If set to true, the remote files are streamed to the route as they are read. When set to false, the remote files are loaded into memory before being sent into the route. | false | boolean
-| *directoryMustExist* (consumer) | Similar to the startingDirectoryMustExist option but this applies during polling (after starting the consumer). | false | boolean
 | *download* (consumer) | Whether the FTP consumer should download the file. If this option is set to false, then the message body will be null, but the consumer will still trigger a Camel Exchange that has details about the file such as file name, file size, etc. It's just that the file will not be downloaded. | false | boolean
 | *exceptionHandler* (consumer) | To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By default the consumer will deal with exceptions, that will be logged at WARN or ERROR level and ignored. |  | ExceptionHandler
 | *exchangePattern* (consumer) | Sets the exchange pattern when the consumer creates an exchange. |  | ExchangePattern
@@ -148,7 +147,6 @@ with the following path and query parameters:
 | *pollStrategy* (consumer) | A pluggable org.apache.camel.PollingConsumerPollingStrategy allowing you to provide your custom implementation to control error handling usually occurred during the poll operation before an Exchange have been created and being routed in Camel. |  | PollingConsumerPoll Strategy
 | *processStrategy* (consumer) | A pluggable org.apache.camel.component.file.GenericFileProcessStrategy allowing you to implement your own readLock option or similar. Can also be used when special conditions must be met before a file can be consumed, such as a special ready file exists. If this option is set then the readLock option does not apply. |  | GenericFileProcess Strategy
 | *receiveBufferSize* (consumer) | The receive (download) buffer size Used only by FTPClient | 32768 | int
-| *startingDirectoryMustExist* (consumer) | Whether the starting directory must exist. Mind that the autoCreate option is default enabled, which means the starting directory is normally auto created if it doesn't exist. You can disable autoCreate and enable this to ensure the starting directory must exist. Will thrown an exception if the directory doesn't exist. | false | boolean
 | *useList* (consumer) | Whether to allow using LIST command when downloading a file. Default is true. In some use cases you may want to download a specific file and are not allowed to use the LIST command, and therefore you can set this option to false. Notice when using this option, then the specific file to download does not include meta-data information such as file size, timestamp, permissions etc, because those information is only possible to retrieve when LIST command is in use. | [...]
 | *fileExist* (producer) | What to do if a file already exists with the same name. Override, which is the default, replaces the existing file. Append - adds content to the existing file. Fail - throws a GenericFileOperationException, indicating that there is already an existing file. Ignore - silently ignores the problem and does not override the existing file, but assumes everything is okay. Move - option requires to use the moveExisting option to be configured as well. The option eager [...]
 | *flatten* (producer) | Flatten is used to flatten the file name path to strip any leading paths, so it's just the file name. This allows you to consume recursively into sub-directories, but when you eg write the files to another directory they will be written in a single directory. Setting this to true on the producer enforces that any file name in CamelFileName header will be stripped for any leading paths. | false | boolean
diff --git a/components/camel-ftp/src/main/docs/ftps-component.adoc b/components/camel-ftp/src/main/docs/ftps-component.adoc
index 9469afb..71464fa 100644
--- a/components/camel-ftp/src/main/docs/ftps-component.adoc
+++ b/components/camel-ftp/src/main/docs/ftps-component.adoc
@@ -61,7 +61,7 @@ with the following path and query parameters:
 |===
 
 
-==== Query Parameters (123 parameters):
+==== Query Parameters (121 parameters):
 
 
 [width="100%",cols="2,5,^1,2",options="header"]
@@ -88,7 +88,6 @@ with the following path and query parameters:
 | *resumeDownload* (consumer) | Configures whether resume download is enabled. This must be supported by the FTP server (almost all FTP servers support it). In addition the options localWorkDirectory must be configured so downloaded files are stored in a local directory, and the option binary must be enabled, which is required to support resuming of downloads. | false | boolean
 | *sendEmptyMessageWhenIdle* (consumer) | If the polling consumer did not poll any files, you can enable this option to send an empty message (no body) instead. | false | boolean
 | *streamDownload* (consumer) | Sets the download method to use when not using a local working directory. If set to true, the remote files are streamed to the route as they are read. When set to false, the remote files are loaded into memory before being sent into the route. | false | boolean
-| *directoryMustExist* (consumer) | Similar to the startingDirectoryMustExist option but this applies during polling (after starting the consumer). | false | boolean
 | *download* (consumer) | Whether the FTP consumer should download the file. If this option is set to false, then the message body will be null, but the consumer will still trigger a Camel Exchange that has details about the file such as file name, file size, etc. It's just that the file will not be downloaded. | false | boolean
 | *exceptionHandler* (consumer) | To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By default the consumer will deal with exceptions, that will be logged at WARN or ERROR level and ignored. |  | ExceptionHandler
 | *exchangePattern* (consumer) | Sets the exchange pattern when the consumer creates an exchange. |  | ExchangePattern
@@ -100,7 +99,6 @@ with the following path and query parameters:
 | *pollStrategy* (consumer) | A pluggable org.apache.camel.PollingConsumerPollingStrategy allowing you to provide your custom implementation to control error handling usually occurred during the poll operation before an Exchange have been created and being routed in Camel. |  | PollingConsumerPoll Strategy
 | *processStrategy* (consumer) | A pluggable org.apache.camel.component.file.GenericFileProcessStrategy allowing you to implement your own readLock option or similar. Can also be used when special conditions must be met before a file can be consumed, such as a special ready file exists. If this option is set then the readLock option does not apply. |  | GenericFileProcess Strategy
 | *receiveBufferSize* (consumer) | The receive (download) buffer size Used only by FTPClient | 32768 | int
-| *startingDirectoryMustExist* (consumer) | Whether the starting directory must exist. Mind that the autoCreate option is default enabled, which means the starting directory is normally auto created if it doesn't exist. You can disable autoCreate and enable this to ensure the starting directory must exist. Will thrown an exception if the directory doesn't exist. | false | boolean
 | *useList* (consumer) | Whether to allow using LIST command when downloading a file. Default is true. In some use cases you may want to download a specific file and are not allowed to use the LIST command, and therefore you can set this option to false. Notice when using this option, then the specific file to download does not include meta-data information such as file size, timestamp, permissions etc, because those information is only possible to retrieve when LIST command is in use. | [...]
 | *fileExist* (producer) | What to do if a file already exists with the same name. Override, which is the default, replaces the existing file. Append - adds content to the existing file. Fail - throws a GenericFileOperationException, indicating that there is already an existing file. Ignore - silently ignores the problem and does not override the existing file, but assumes everything is okay. Move - option requires to use the moveExisting option to be configured as well. The option eager [...]
 | *flatten* (producer) | Flatten is used to flatten the file name path to strip any leading paths, so it's just the file name. This allows you to consume recursively into sub-directories, but when you eg write the files to another directory they will be written in a single directory. Setting this to true on the producer enforces that any file name in CamelFileName header will be stripped for any leading paths. | false | boolean
diff --git a/components/camel-ftp/src/main/docs/sftp-component.adoc b/components/camel-ftp/src/main/docs/sftp-component.adoc
index 6739d42..52fb1b8 100644
--- a/components/camel-ftp/src/main/docs/sftp-component.adoc
+++ b/components/camel-ftp/src/main/docs/sftp-component.adoc
@@ -60,7 +60,7 @@ with the following path and query parameters:
 |===
 
 
-==== Query Parameters (119 parameters):
+==== Query Parameters (117 parameters):
 
 
 [width="100%",cols="2,5,^1,2",options="header"]
@@ -82,7 +82,6 @@ with the following path and query parameters:
 | *recursive* (consumer) | If a directory, will look for files in all the sub-directories as well. | false | boolean
 | *sendEmptyMessageWhenIdle* (consumer) | If the polling consumer did not poll any files, you can enable this option to send an empty message (no body) instead. | false | boolean
 | *streamDownload* (consumer) | Sets the download method to use when not using a local working directory. If set to true, the remote files are streamed to the route as they are read. When set to false, the remote files are loaded into memory before being sent into the route. | false | boolean
-| *directoryMustExist* (consumer) | Similar to the startingDirectoryMustExist option but this applies during polling (after starting the consumer). | false | boolean
 | *download* (consumer) | Whether the FTP consumer should download the file. If this option is set to false, then the message body will be null, but the consumer will still trigger a Camel Exchange that has details about the file such as file name, file size, etc. It's just that the file will not be downloaded. | false | boolean
 | *exceptionHandler* (consumer) | To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this option is not in use. By default the consumer will deal with exceptions, that will be logged at WARN or ERROR level and ignored. |  | ExceptionHandler
 | *exchangePattern* (consumer) | Sets the exchange pattern when the consumer creates an exchange. |  | ExchangePattern
@@ -92,7 +91,6 @@ with the following path and query parameters:
 | *onCompletionException Handler* (consumer) | To use a custom org.apache.camel.spi.ExceptionHandler to handle any thrown exceptions that happens during the file on completion process where the consumer does either a commit or rollback. The default implementation will log any exception at WARN level and ignore. |  | ExceptionHandler
 | *pollStrategy* (consumer) | A pluggable org.apache.camel.PollingConsumerPollingStrategy allowing you to provide your custom implementation to control error handling usually occurred during the poll operation before an Exchange have been created and being routed in Camel. |  | PollingConsumerPoll Strategy
 | *processStrategy* (consumer) | A pluggable org.apache.camel.component.file.GenericFileProcessStrategy allowing you to implement your own readLock option or similar. Can also be used when special conditions must be met before a file can be consumed, such as a special ready file exists. If this option is set then the readLock option does not apply. |  | GenericFileProcess Strategy
-| *startingDirectoryMustExist* (consumer) | Whether the starting directory must exist. Mind that the autoCreate option is default enabled, which means the starting directory is normally auto created if it doesn't exist. You can disable autoCreate and enable this to ensure the starting directory must exist. Will thrown an exception if the directory doesn't exist. | false | boolean
 | *useList* (consumer) | Whether to allow using LIST command when downloading a file. Default is true. In some use cases you may want to download a specific file and are not allowed to use the LIST command, and therefore you can set this option to false. Notice when using this option, then the specific file to download does not include meta-data information such as file size, timestamp, permissions etc, because those information is only possible to retrieve when LIST command is in use. | [...]
 | *fileExist* (producer) | What to do if a file already exists with the same name. Override, which is the default, replaces the existing file. Append - adds content to the existing file. Fail - throws a GenericFileOperationException, indicating that there is already an existing file. Ignore - silently ignores the problem and does not override the existing file, but assumes everything is okay. Move - option requires to use the moveExisting option to be configured as well. The option eager [...]
 | *flatten* (producer) | Flatten is used to flatten the file name path to strip any leading paths, so it's just the file name. This allows you to consume recursively into sub-directories, but when you eg write the files to another directory they will be written in a single directory. Setting this to true on the producer enforces that any file name in CamelFileName header will be stripped for any leading paths. | false | boolean