This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 0d324fd3fee CAMEL-21352: camel-smb - More stuff
0d324fd3fee is described below
commit 0d324fd3fee7fcddead2e355aa023baaf4e44b06
Author: Claus Ibsen <[email protected]>
AuthorDate: Mon Jan 6 11:45:16 2025 +0100
CAMEL-21352: camel-smb - More stuff
---
.../camel/catalog/components/azure-files.json | 36 ++---
.../camel/component/file/azure/azure-files.json | 36 ++---
.../smb/SmbDefaultMoveExistingFileStrategy.java | 98 +++++++++++++
.../apache/camel/component/smb/SmbEndpoint.java | 13 ++
.../component/smb/SmbProducerToMoveExistingIT.java | 65 +++++++++
.../endpoint/dsl/FilesEndpointBuilderFactory.java | 152 ++++++---------------
.../smb/services/SmbLocalContainerService.java | 7 +-
.../test/infra/smb/services/SmbRemoteService.java | 6 +
.../camel/test/infra/smb/services/SmbService.java | 2 +
9 files changed, 263 insertions(+), 152 deletions(-)
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/azure-files.json
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/azure-files.json
index ae37b7a2e5c..00067cfbb86 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/azure-files.json
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/azure-files.json
@@ -68,24 +68,24 @@
"onCompletionExceptionHandler": { "index": 24, "kind": "parameter",
"displayName": "On Completion Exception Handler", "group": "consumer
(advanced)", "label": "consumer,advanced", "required": false, "type": "object",
"javaType": "org.apache.camel.spi.ExceptionHandler", "deprecated": false,
"autowired": false, "secret": false, "description": "To use a custom
org.apache.camel.spi.ExceptionHandler to handle any thrown exceptions that
happens during the file on completion process where t [...]
"pollStrategy": { "index": 25, "kind": "parameter", "displayName": "Poll
Strategy", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "object", "javaType":
"org.apache.camel.spi.PollingConsumerPollStrategy", "deprecated": false,
"autowired": false, "secret": false, "description": "A pluggable
org.apache.camel.PollingConsumerPollingStrategy allowing you to provide your
custom implementation to control error handling usually occurred during the po
[...]
"processStrategy": { "index": 26, "kind": "parameter", "displayName":
"Process Strategy", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "object", "javaType":
"org.apache.camel.component.file.GenericFileProcessStrategy<com.azure.storage.file.share.models.ShareFileItem>",
"deprecated": false, "autowired": false, "secret": false, "description": "A
pluggable org.apache.camel.component.file.GenericFileProcessStrategy allowing
you to implement you [...]
- "checksumFileAlgorithm": { "index": 27, "kind": "parameter",
"displayName": "Checksum File Algorithm", "group": "producer", "label":
"producer", "required": false, "type": "string", "javaType":
"java.lang.String", "enum": [ "MD2", "MD5", "SHA_1", "SHA_224", "SHA_256",
"SHA_384", "SHA_512", "SHA_512_224", "SHA_512_256", "SHA3_224", "SHA3_256",
"SHA3_384", "SHA3_512" ], "deprecated": false, "autowired": false, "secret":
false, "description": "If provided, then Camel will write a checks [...]
- "fileExist": { "index": 28, "kind": "parameter", "displayName": "File
Exist", "group": "producer", "label": "producer", "required": false, "type":
"object", "javaType": "org.apache.camel.component.file.GenericFileExist",
"enum": [ "Override", "Append", "Fail", "Ignore", "Move", "TryRename" ],
"deprecated": false, "autowired": false, "secret": false, "defaultValue":
"Override", "description": "What to do if a file already exists with the same
name. Override, which is the default, repl [...]
- "flatten": { "index": 29, "kind": "parameter", "displayName": "Flatten",
"group": "producer", "label": "producer", "required": false, "type": "boolean",
"javaType": "boolean", "deprecated": false, "autowired": false, "secret":
false, "defaultValue": false, "description": "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 [...]
- "jailStartingDirectory": { "index": 30, "kind": "parameter",
"displayName": "Jail Starting Directory", "group": "producer", "label":
"producer", "required": false, "type": "boolean", "javaType": "boolean",
"deprecated": false, "autowired": false, "secret": false, "defaultValue": true,
"description": "Used for jailing (restricting) writing files to the starting
directory (and sub) only. This is enabled by default to not allow Camel to
write files to outside directories (to be more sec [...]
- "tempFileName": { "index": 31, "kind": "parameter", "displayName": "Temp
File Name", "group": "producer", "label": "producer", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "description": "The same as tempPrefix
option but offering a more fine grained control on the naming of the temporary
filename as it uses the File Language. The location for tempFilename is
relative to the final file location in the o [...]
- "tempPrefix": { "index": 32, "kind": "parameter", "displayName": "Temp
Prefix", "group": "producer", "label": "producer", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "description": "This option is used to write the file
using a temporary name and then, after the write is complete, rename it to the
real name. Can be used to identify files being written and also avoid consumers
(not using exclusive read [...]
- "allowNullBody": { "index": 33, "kind": "parameter", "displayName": "Allow
Null Body", "group": "producer (advanced)", "label": "producer,advanced",
"required": false, "type": "boolean", "javaType": "boolean", "deprecated":
false, "autowired": false, "secret": false, "defaultValue": false,
"description": "Used to specify if a null body is allowed during file writing.
If set to true then an empty file will be created, when set to false, and
attempting to send a null body to the file c [...]
- "disconnectOnBatchComplete": { "index": 34, "kind": "parameter",
"displayName": "Disconnect On Batch Complete", "group": "producer (advanced)",
"label": "producer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Whether or not to disconnect from remote
FTP server right after a Batch upload is complete. disconnectOnBatchComplete
will only disconnect the current conne [...]
- "eagerDeleteTargetFile": { "index": 35, "kind": "parameter",
"displayName": "Eager Delete Target File", "group": "producer (advanced)",
"label": "producer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": true, "description": "Whether or not to eagerly delete any
existing target file. This option only applies when you use fileExists=Override
and the tempFileName option as well. You can use [...]
- "keepLastModified": { "index": 36, "kind": "parameter", "displayName":
"Keep Last Modified", "group": "producer (advanced)", "label":
"producer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Will keep the last modified timestamp
from the source file (if any). Will use the FileConstants.FILE_LAST_MODIFIED
header to located the timestamp. This header can contain eit [...]
- "lazyStartProducer": { "index": 37, "kind": "parameter", "displayName":
"Lazy Start Producer", "group": "producer (advanced)", "label":
"producer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Whether the producer should be started
lazy (on the first message). By starting lazy you can use this to allow
CamelContext and routes to startup in situations where a produ [...]
- "moveExistingFileStrategy": { "index": 38, "kind": "parameter",
"displayName": "Move Existing File Strategy", "group": "producer (advanced)",
"label": "producer,advanced", "required": false, "type": "object", "javaType":
"org.apache.camel.component.file.strategy.FileMoveExistingStrategy",
"deprecated": false, "autowired": false, "secret": false, "description":
"Strategy (Custom Strategy) used to move file with special naming token to use
when fileExist=Move is configured. By default, [...]
- "autoCreate": { "index": 39, "kind": "parameter", "displayName": "Auto
Create", "group": "advanced", "label": "advanced", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": true, "description": "Automatically create
missing directories in the file's pathname. For the file consumer, that means
creating the starting directory. For the file producer, it means the directory
the files should be written to." },
- "browseLimit": { "index": 40, "kind": "parameter", "displayName": "Browse
Limit", "group": "advanced", "label": "advanced", "required": false, "type":
"integer", "javaType": "int", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": 100, "description": "Maximum number of
messages to keep in memory available for browsing. Use 0 for unlimited." },
- "connectTimeout": { "index": 41, "kind": "parameter", "displayName":
"Connect Timeout", "group": "advanced", "label": "advanced", "required": false,
"type": "duration", "javaType": "int", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": "10000", "configurationClass":
"org.apache.camel.component.file.azure.FilesConfiguration",
"configurationField": "configuration", "description": "Sets the connect timeout
for waiting for a connection to be established Used by [...]
- "maximumReconnectAttempts": { "index": 42, "kind": "parameter",
"displayName": "Maximum Reconnect Attempts", "group": "advanced", "label":
"advanced", "required": false, "type": "integer", "javaType": "int",
"deprecated": false, "autowired": false, "secret": false, "description":
"Specifies the maximum reconnect attempts Camel performs when it tries to
connect to the remote FTP server. Use 0 to disable this behavior." },
- "reconnectDelay": { "index": 43, "kind": "parameter", "displayName":
"Reconnect Delay", "group": "advanced", "label": "advanced", "required": false,
"type": "duration", "javaType": "long", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": "1000", "description": "Delay in millis
Camel will wait before performing a reconnect attempt." },
- "throwExceptionOnConnectFailed": { "index": 44, "kind": "parameter",
"displayName": "Throw Exception On Connect Failed", "group": "advanced",
"label": "advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "configurationClass":
"org.apache.camel.component.file.azure.FilesConfiguration",
"configurationField": "configuration", "description": "Should an exception be
thrown if connection fa [...]
+ "throwExceptionOnConnectFailed": { "index": 27, "kind": "parameter",
"displayName": "Throw Exception On Connect Failed", "group": "consumer
(advanced)", "label": "consumer,advanced", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": false, "configurationClass":
"org.apache.camel.component.file.azure.FilesConfiguration",
"configurationField": "configuration", "description": "Should an exception be
thr [...]
+ "checksumFileAlgorithm": { "index": 28, "kind": "parameter",
"displayName": "Checksum File Algorithm", "group": "producer", "label":
"producer", "required": false, "type": "string", "javaType":
"java.lang.String", "enum": [ "MD2", "MD5", "SHA_1", "SHA_224", "SHA_256",
"SHA_384", "SHA_512", "SHA_512_224", "SHA_512_256", "SHA3_224", "SHA3_256",
"SHA3_384", "SHA3_512" ], "deprecated": false, "autowired": false, "secret":
false, "description": "If provided, then Camel will write a checks [...]
+ "fileExist": { "index": 29, "kind": "parameter", "displayName": "File
Exist", "group": "producer", "label": "producer", "required": false, "type":
"object", "javaType": "org.apache.camel.component.file.GenericFileExist",
"enum": [ "Override", "Append", "Fail", "Ignore", "Move", "TryRename" ],
"deprecated": false, "autowired": false, "secret": false, "defaultValue":
"Override", "description": "What to do if a file already exists with the same
name. Override, which is the default, repl [...]
+ "flatten": { "index": 30, "kind": "parameter", "displayName": "Flatten",
"group": "producer", "label": "producer", "required": false, "type": "boolean",
"javaType": "boolean", "deprecated": false, "autowired": false, "secret":
false, "defaultValue": false, "description": "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 [...]
+ "jailStartingDirectory": { "index": 31, "kind": "parameter",
"displayName": "Jail Starting Directory", "group": "producer", "label":
"producer", "required": false, "type": "boolean", "javaType": "boolean",
"deprecated": false, "autowired": false, "secret": false, "defaultValue": true,
"description": "Used for jailing (restricting) writing files to the starting
directory (and sub) only. This is enabled by default to not allow Camel to
write files to outside directories (to be more sec [...]
+ "tempFileName": { "index": 32, "kind": "parameter", "displayName": "Temp
File Name", "group": "producer", "label": "producer", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "description": "The same as tempPrefix
option but offering a more fine grained control on the naming of the temporary
filename as it uses the File Language. The location for tempFilename is
relative to the final file location in the o [...]
+ "tempPrefix": { "index": 33, "kind": "parameter", "displayName": "Temp
Prefix", "group": "producer", "label": "producer", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "description": "This option is used to write the file
using a temporary name and then, after the write is complete, rename it to the
real name. Can be used to identify files being written and also avoid consumers
(not using exclusive read [...]
+ "allowNullBody": { "index": 34, "kind": "parameter", "displayName": "Allow
Null Body", "group": "producer (advanced)", "label": "producer,advanced",
"required": false, "type": "boolean", "javaType": "boolean", "deprecated":
false, "autowired": false, "secret": false, "defaultValue": false,
"description": "Used to specify if a null body is allowed during file writing.
If set to true then an empty file will be created, when set to false, and
attempting to send a null body to the file c [...]
+ "disconnectOnBatchComplete": { "index": 35, "kind": "parameter",
"displayName": "Disconnect On Batch Complete", "group": "producer (advanced)",
"label": "producer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Whether or not to disconnect from remote
FTP server right after a Batch upload is complete. disconnectOnBatchComplete
will only disconnect the current conne [...]
+ "eagerDeleteTargetFile": { "index": 36, "kind": "parameter",
"displayName": "Eager Delete Target File", "group": "producer (advanced)",
"label": "producer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": true, "description": "Whether or not to eagerly delete any
existing target file. This option only applies when you use fileExists=Override
and the tempFileName option as well. You can use [...]
+ "keepLastModified": { "index": 37, "kind": "parameter", "displayName":
"Keep Last Modified", "group": "producer (advanced)", "label":
"producer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Will keep the last modified timestamp
from the source file (if any). Will use the FileConstants.FILE_LAST_MODIFIED
header to located the timestamp. This header can contain eit [...]
+ "lazyStartProducer": { "index": 38, "kind": "parameter", "displayName":
"Lazy Start Producer", "group": "producer (advanced)", "label":
"producer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Whether the producer should be started
lazy (on the first message). By starting lazy you can use this to allow
CamelContext and routes to startup in situations where a produ [...]
+ "moveExistingFileStrategy": { "index": 39, "kind": "parameter",
"displayName": "Move Existing File Strategy", "group": "producer (advanced)",
"label": "producer,advanced", "required": false, "type": "object", "javaType":
"org.apache.camel.component.file.strategy.FileMoveExistingStrategy",
"deprecated": false, "autowired": false, "secret": false, "description":
"Strategy (Custom Strategy) used to move file with special naming token to use
when fileExist=Move is configured. By default, [...]
+ "autoCreate": { "index": 40, "kind": "parameter", "displayName": "Auto
Create", "group": "advanced", "label": "advanced", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": true, "description": "Automatically create
missing directories in the file's pathname. For the file consumer, that means
creating the starting directory. For the file producer, it means the directory
the files should be written to." },
+ "browseLimit": { "index": 41, "kind": "parameter", "displayName": "Browse
Limit", "group": "advanced", "label": "advanced", "required": false, "type":
"integer", "javaType": "int", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": 100, "description": "Maximum number of
messages to keep in memory available for browsing. Use 0 for unlimited." },
+ "connectTimeout": { "index": 42, "kind": "parameter", "displayName":
"Connect Timeout", "group": "advanced", "label": "advanced", "required": false,
"type": "duration", "javaType": "int", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": "10000", "configurationClass":
"org.apache.camel.component.file.azure.FilesConfiguration",
"configurationField": "configuration", "description": "Sets the connect timeout
for waiting for a connection to be established Used by [...]
+ "maximumReconnectAttempts": { "index": 43, "kind": "parameter",
"displayName": "Maximum Reconnect Attempts", "group": "advanced", "label":
"advanced", "required": false, "type": "integer", "javaType": "int",
"deprecated": false, "autowired": false, "secret": false, "description":
"Specifies the maximum reconnect attempts Camel performs when it tries to
connect to the remote FTP server. Use 0 to disable this behavior." },
+ "reconnectDelay": { "index": 44, "kind": "parameter", "displayName":
"Reconnect Delay", "group": "advanced", "label": "advanced", "required": false,
"type": "duration", "javaType": "long", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": "1000", "description": "Delay in millis
Camel will wait before performing a reconnect attempt." },
"timeout": { "index": 45, "kind": "parameter", "displayName": "Timeout",
"group": "advanced", "label": "advanced", "required": false, "type":
"duration", "javaType": "int", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": "30000", "configurationClass":
"org.apache.camel.component.file.azure.FilesConfiguration",
"configurationField": "configuration", "description": "Sets the data timeout
for waiting for reply Used only by FTPClient" },
"antExclude": { "index": 46, "kind": "parameter", "displayName": "Ant
Exclude", "group": "filter", "label": "consumer,filter", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "description": "Ant style filter
exclusion. If both antInclude and antExclude are used, antExclude takes
precedence over antInclude. Multiple exclusions may be specified in
comma-delimited format." },
"antFilterCaseSensitive": { "index": 47, "kind": "parameter",
"displayName": "Ant Filter Case Sensitive", "group": "filter", "label":
"consumer,filter", "required": false, "type": "boolean", "javaType": "boolean",
"deprecated": false, "autowired": false, "secret": false, "defaultValue": true,
"description": "Sets case sensitive flag on ant filter." },
diff --git
a/components/camel-azure/camel-azure-files/src/generated/resources/META-INF/org/apache/camel/component/file/azure/azure-files.json
b/components/camel-azure/camel-azure-files/src/generated/resources/META-INF/org/apache/camel/component/file/azure/azure-files.json
index ae37b7a2e5c..00067cfbb86 100644
---
a/components/camel-azure/camel-azure-files/src/generated/resources/META-INF/org/apache/camel/component/file/azure/azure-files.json
+++
b/components/camel-azure/camel-azure-files/src/generated/resources/META-INF/org/apache/camel/component/file/azure/azure-files.json
@@ -68,24 +68,24 @@
"onCompletionExceptionHandler": { "index": 24, "kind": "parameter",
"displayName": "On Completion Exception Handler", "group": "consumer
(advanced)", "label": "consumer,advanced", "required": false, "type": "object",
"javaType": "org.apache.camel.spi.ExceptionHandler", "deprecated": false,
"autowired": false, "secret": false, "description": "To use a custom
org.apache.camel.spi.ExceptionHandler to handle any thrown exceptions that
happens during the file on completion process where t [...]
"pollStrategy": { "index": 25, "kind": "parameter", "displayName": "Poll
Strategy", "group": "consumer (advanced)", "label": "consumer,advanced",
"required": false, "type": "object", "javaType":
"org.apache.camel.spi.PollingConsumerPollStrategy", "deprecated": false,
"autowired": false, "secret": false, "description": "A pluggable
org.apache.camel.PollingConsumerPollingStrategy allowing you to provide your
custom implementation to control error handling usually occurred during the po
[...]
"processStrategy": { "index": 26, "kind": "parameter", "displayName":
"Process Strategy", "group": "consumer (advanced)", "label":
"consumer,advanced", "required": false, "type": "object", "javaType":
"org.apache.camel.component.file.GenericFileProcessStrategy<com.azure.storage.file.share.models.ShareFileItem>",
"deprecated": false, "autowired": false, "secret": false, "description": "A
pluggable org.apache.camel.component.file.GenericFileProcessStrategy allowing
you to implement you [...]
- "checksumFileAlgorithm": { "index": 27, "kind": "parameter",
"displayName": "Checksum File Algorithm", "group": "producer", "label":
"producer", "required": false, "type": "string", "javaType":
"java.lang.String", "enum": [ "MD2", "MD5", "SHA_1", "SHA_224", "SHA_256",
"SHA_384", "SHA_512", "SHA_512_224", "SHA_512_256", "SHA3_224", "SHA3_256",
"SHA3_384", "SHA3_512" ], "deprecated": false, "autowired": false, "secret":
false, "description": "If provided, then Camel will write a checks [...]
- "fileExist": { "index": 28, "kind": "parameter", "displayName": "File
Exist", "group": "producer", "label": "producer", "required": false, "type":
"object", "javaType": "org.apache.camel.component.file.GenericFileExist",
"enum": [ "Override", "Append", "Fail", "Ignore", "Move", "TryRename" ],
"deprecated": false, "autowired": false, "secret": false, "defaultValue":
"Override", "description": "What to do if a file already exists with the same
name. Override, which is the default, repl [...]
- "flatten": { "index": 29, "kind": "parameter", "displayName": "Flatten",
"group": "producer", "label": "producer", "required": false, "type": "boolean",
"javaType": "boolean", "deprecated": false, "autowired": false, "secret":
false, "defaultValue": false, "description": "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 [...]
- "jailStartingDirectory": { "index": 30, "kind": "parameter",
"displayName": "Jail Starting Directory", "group": "producer", "label":
"producer", "required": false, "type": "boolean", "javaType": "boolean",
"deprecated": false, "autowired": false, "secret": false, "defaultValue": true,
"description": "Used for jailing (restricting) writing files to the starting
directory (and sub) only. This is enabled by default to not allow Camel to
write files to outside directories (to be more sec [...]
- "tempFileName": { "index": 31, "kind": "parameter", "displayName": "Temp
File Name", "group": "producer", "label": "producer", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "description": "The same as tempPrefix
option but offering a more fine grained control on the naming of the temporary
filename as it uses the File Language. The location for tempFilename is
relative to the final file location in the o [...]
- "tempPrefix": { "index": 32, "kind": "parameter", "displayName": "Temp
Prefix", "group": "producer", "label": "producer", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "description": "This option is used to write the file
using a temporary name and then, after the write is complete, rename it to the
real name. Can be used to identify files being written and also avoid consumers
(not using exclusive read [...]
- "allowNullBody": { "index": 33, "kind": "parameter", "displayName": "Allow
Null Body", "group": "producer (advanced)", "label": "producer,advanced",
"required": false, "type": "boolean", "javaType": "boolean", "deprecated":
false, "autowired": false, "secret": false, "defaultValue": false,
"description": "Used to specify if a null body is allowed during file writing.
If set to true then an empty file will be created, when set to false, and
attempting to send a null body to the file c [...]
- "disconnectOnBatchComplete": { "index": 34, "kind": "parameter",
"displayName": "Disconnect On Batch Complete", "group": "producer (advanced)",
"label": "producer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Whether or not to disconnect from remote
FTP server right after a Batch upload is complete. disconnectOnBatchComplete
will only disconnect the current conne [...]
- "eagerDeleteTargetFile": { "index": 35, "kind": "parameter",
"displayName": "Eager Delete Target File", "group": "producer (advanced)",
"label": "producer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": true, "description": "Whether or not to eagerly delete any
existing target file. This option only applies when you use fileExists=Override
and the tempFileName option as well. You can use [...]
- "keepLastModified": { "index": 36, "kind": "parameter", "displayName":
"Keep Last Modified", "group": "producer (advanced)", "label":
"producer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Will keep the last modified timestamp
from the source file (if any). Will use the FileConstants.FILE_LAST_MODIFIED
header to located the timestamp. This header can contain eit [...]
- "lazyStartProducer": { "index": 37, "kind": "parameter", "displayName":
"Lazy Start Producer", "group": "producer (advanced)", "label":
"producer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Whether the producer should be started
lazy (on the first message). By starting lazy you can use this to allow
CamelContext and routes to startup in situations where a produ [...]
- "moveExistingFileStrategy": { "index": 38, "kind": "parameter",
"displayName": "Move Existing File Strategy", "group": "producer (advanced)",
"label": "producer,advanced", "required": false, "type": "object", "javaType":
"org.apache.camel.component.file.strategy.FileMoveExistingStrategy",
"deprecated": false, "autowired": false, "secret": false, "description":
"Strategy (Custom Strategy) used to move file with special naming token to use
when fileExist=Move is configured. By default, [...]
- "autoCreate": { "index": 39, "kind": "parameter", "displayName": "Auto
Create", "group": "advanced", "label": "advanced", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": true, "description": "Automatically create
missing directories in the file's pathname. For the file consumer, that means
creating the starting directory. For the file producer, it means the directory
the files should be written to." },
- "browseLimit": { "index": 40, "kind": "parameter", "displayName": "Browse
Limit", "group": "advanced", "label": "advanced", "required": false, "type":
"integer", "javaType": "int", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": 100, "description": "Maximum number of
messages to keep in memory available for browsing. Use 0 for unlimited." },
- "connectTimeout": { "index": 41, "kind": "parameter", "displayName":
"Connect Timeout", "group": "advanced", "label": "advanced", "required": false,
"type": "duration", "javaType": "int", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": "10000", "configurationClass":
"org.apache.camel.component.file.azure.FilesConfiguration",
"configurationField": "configuration", "description": "Sets the connect timeout
for waiting for a connection to be established Used by [...]
- "maximumReconnectAttempts": { "index": 42, "kind": "parameter",
"displayName": "Maximum Reconnect Attempts", "group": "advanced", "label":
"advanced", "required": false, "type": "integer", "javaType": "int",
"deprecated": false, "autowired": false, "secret": false, "description":
"Specifies the maximum reconnect attempts Camel performs when it tries to
connect to the remote FTP server. Use 0 to disable this behavior." },
- "reconnectDelay": { "index": 43, "kind": "parameter", "displayName":
"Reconnect Delay", "group": "advanced", "label": "advanced", "required": false,
"type": "duration", "javaType": "long", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": "1000", "description": "Delay in millis
Camel will wait before performing a reconnect attempt." },
- "throwExceptionOnConnectFailed": { "index": 44, "kind": "parameter",
"displayName": "Throw Exception On Connect Failed", "group": "advanced",
"label": "advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "configurationClass":
"org.apache.camel.component.file.azure.FilesConfiguration",
"configurationField": "configuration", "description": "Should an exception be
thrown if connection fa [...]
+ "throwExceptionOnConnectFailed": { "index": 27, "kind": "parameter",
"displayName": "Throw Exception On Connect Failed", "group": "consumer
(advanced)", "label": "consumer,advanced", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": false, "configurationClass":
"org.apache.camel.component.file.azure.FilesConfiguration",
"configurationField": "configuration", "description": "Should an exception be
thr [...]
+ "checksumFileAlgorithm": { "index": 28, "kind": "parameter",
"displayName": "Checksum File Algorithm", "group": "producer", "label":
"producer", "required": false, "type": "string", "javaType":
"java.lang.String", "enum": [ "MD2", "MD5", "SHA_1", "SHA_224", "SHA_256",
"SHA_384", "SHA_512", "SHA_512_224", "SHA_512_256", "SHA3_224", "SHA3_256",
"SHA3_384", "SHA3_512" ], "deprecated": false, "autowired": false, "secret":
false, "description": "If provided, then Camel will write a checks [...]
+ "fileExist": { "index": 29, "kind": "parameter", "displayName": "File
Exist", "group": "producer", "label": "producer", "required": false, "type":
"object", "javaType": "org.apache.camel.component.file.GenericFileExist",
"enum": [ "Override", "Append", "Fail", "Ignore", "Move", "TryRename" ],
"deprecated": false, "autowired": false, "secret": false, "defaultValue":
"Override", "description": "What to do if a file already exists with the same
name. Override, which is the default, repl [...]
+ "flatten": { "index": 30, "kind": "parameter", "displayName": "Flatten",
"group": "producer", "label": "producer", "required": false, "type": "boolean",
"javaType": "boolean", "deprecated": false, "autowired": false, "secret":
false, "defaultValue": false, "description": "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 [...]
+ "jailStartingDirectory": { "index": 31, "kind": "parameter",
"displayName": "Jail Starting Directory", "group": "producer", "label":
"producer", "required": false, "type": "boolean", "javaType": "boolean",
"deprecated": false, "autowired": false, "secret": false, "defaultValue": true,
"description": "Used for jailing (restricting) writing files to the starting
directory (and sub) only. This is enabled by default to not allow Camel to
write files to outside directories (to be more sec [...]
+ "tempFileName": { "index": 32, "kind": "parameter", "displayName": "Temp
File Name", "group": "producer", "label": "producer", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "description": "The same as tempPrefix
option but offering a more fine grained control on the naming of the temporary
filename as it uses the File Language. The location for tempFilename is
relative to the final file location in the o [...]
+ "tempPrefix": { "index": 33, "kind": "parameter", "displayName": "Temp
Prefix", "group": "producer", "label": "producer", "required": false, "type":
"string", "javaType": "java.lang.String", "deprecated": false, "autowired":
false, "secret": false, "description": "This option is used to write the file
using a temporary name and then, after the write is complete, rename it to the
real name. Can be used to identify files being written and also avoid consumers
(not using exclusive read [...]
+ "allowNullBody": { "index": 34, "kind": "parameter", "displayName": "Allow
Null Body", "group": "producer (advanced)", "label": "producer,advanced",
"required": false, "type": "boolean", "javaType": "boolean", "deprecated":
false, "autowired": false, "secret": false, "defaultValue": false,
"description": "Used to specify if a null body is allowed during file writing.
If set to true then an empty file will be created, when set to false, and
attempting to send a null body to the file c [...]
+ "disconnectOnBatchComplete": { "index": 35, "kind": "parameter",
"displayName": "Disconnect On Batch Complete", "group": "producer (advanced)",
"label": "producer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Whether or not to disconnect from remote
FTP server right after a Batch upload is complete. disconnectOnBatchComplete
will only disconnect the current conne [...]
+ "eagerDeleteTargetFile": { "index": 36, "kind": "parameter",
"displayName": "Eager Delete Target File", "group": "producer (advanced)",
"label": "producer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": true, "description": "Whether or not to eagerly delete any
existing target file. This option only applies when you use fileExists=Override
and the tempFileName option as well. You can use [...]
+ "keepLastModified": { "index": 37, "kind": "parameter", "displayName":
"Keep Last Modified", "group": "producer (advanced)", "label":
"producer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Will keep the last modified timestamp
from the source file (if any). Will use the FileConstants.FILE_LAST_MODIFIED
header to located the timestamp. This header can contain eit [...]
+ "lazyStartProducer": { "index": 38, "kind": "parameter", "displayName":
"Lazy Start Producer", "group": "producer (advanced)", "label":
"producer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Whether the producer should be started
lazy (on the first message). By starting lazy you can use this to allow
CamelContext and routes to startup in situations where a produ [...]
+ "moveExistingFileStrategy": { "index": 39, "kind": "parameter",
"displayName": "Move Existing File Strategy", "group": "producer (advanced)",
"label": "producer,advanced", "required": false, "type": "object", "javaType":
"org.apache.camel.component.file.strategy.FileMoveExistingStrategy",
"deprecated": false, "autowired": false, "secret": false, "description":
"Strategy (Custom Strategy) used to move file with special naming token to use
when fileExist=Move is configured. By default, [...]
+ "autoCreate": { "index": 40, "kind": "parameter", "displayName": "Auto
Create", "group": "advanced", "label": "advanced", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": true, "description": "Automatically create
missing directories in the file's pathname. For the file consumer, that means
creating the starting directory. For the file producer, it means the directory
the files should be written to." },
+ "browseLimit": { "index": 41, "kind": "parameter", "displayName": "Browse
Limit", "group": "advanced", "label": "advanced", "required": false, "type":
"integer", "javaType": "int", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": 100, "description": "Maximum number of
messages to keep in memory available for browsing. Use 0 for unlimited." },
+ "connectTimeout": { "index": 42, "kind": "parameter", "displayName":
"Connect Timeout", "group": "advanced", "label": "advanced", "required": false,
"type": "duration", "javaType": "int", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": "10000", "configurationClass":
"org.apache.camel.component.file.azure.FilesConfiguration",
"configurationField": "configuration", "description": "Sets the connect timeout
for waiting for a connection to be established Used by [...]
+ "maximumReconnectAttempts": { "index": 43, "kind": "parameter",
"displayName": "Maximum Reconnect Attempts", "group": "advanced", "label":
"advanced", "required": false, "type": "integer", "javaType": "int",
"deprecated": false, "autowired": false, "secret": false, "description":
"Specifies the maximum reconnect attempts Camel performs when it tries to
connect to the remote FTP server. Use 0 to disable this behavior." },
+ "reconnectDelay": { "index": 44, "kind": "parameter", "displayName":
"Reconnect Delay", "group": "advanced", "label": "advanced", "required": false,
"type": "duration", "javaType": "long", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": "1000", "description": "Delay in millis
Camel will wait before performing a reconnect attempt." },
"timeout": { "index": 45, "kind": "parameter", "displayName": "Timeout",
"group": "advanced", "label": "advanced", "required": false, "type":
"duration", "javaType": "int", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": "30000", "configurationClass":
"org.apache.camel.component.file.azure.FilesConfiguration",
"configurationField": "configuration", "description": "Sets the data timeout
for waiting for reply Used only by FTPClient" },
"antExclude": { "index": 46, "kind": "parameter", "displayName": "Ant
Exclude", "group": "filter", "label": "consumer,filter", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": false,
"autowired": false, "secret": false, "description": "Ant style filter
exclusion. If both antInclude and antExclude are used, antExclude takes
precedence over antInclude. Multiple exclusions may be specified in
comma-delimited format." },
"antFilterCaseSensitive": { "index": 47, "kind": "parameter",
"displayName": "Ant Filter Case Sensitive", "group": "filter", "label":
"consumer,filter", "required": false, "type": "boolean", "javaType": "boolean",
"deprecated": false, "autowired": false, "secret": false, "defaultValue": true,
"description": "Sets case sensitive flag on ant filter." },
diff --git
a/components/camel-smb/src/main/java/org/apache/camel/component/smb/SmbDefaultMoveExistingFileStrategy.java
b/components/camel-smb/src/main/java/org/apache/camel/component/smb/SmbDefaultMoveExistingFileStrategy.java
new file mode 100644
index 00000000000..0c4992ae3f8
--- /dev/null
+++
b/components/camel-smb/src/main/java/org/apache/camel/component/smb/SmbDefaultMoveExistingFileStrategy.java
@@ -0,0 +1,98 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.smb;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.component.file.GenericFileEndpoint;
+import org.apache.camel.component.file.GenericFileOperationFailedException;
+import org.apache.camel.component.file.GenericFileOperations;
+import org.apache.camel.component.file.strategy.FileMoveExistingStrategy;
+import org.apache.camel.util.FileUtil;
+import org.apache.camel.util.ObjectHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import static
org.apache.camel.component.file.MoveExistingFileStrategyUtils.completePartialRelativePath;
+
+public class SmbDefaultMoveExistingFileStrategy implements
FileMoveExistingStrategy {
+
+ private static final Logger LOG =
LoggerFactory.getLogger(SmbDefaultMoveExistingFileStrategy.class);
+
+ /**
+ * Moves any existing file due fileExists=Move is in use.
+ */
+ @Override
+ public boolean moveExistingFile(GenericFileEndpoint<?> endpoint,
GenericFileOperations<?> operations, String fileName)
+ throws GenericFileOperationFailedException {
+ // need to evaluate using a dummy and simulate the file first, to have
+ // access to all the file attributes
+ // create a dummy exchange as Exchange is needed for expression
+ // evaluation
+ // we support only the following 3 tokens.
+ Exchange dummy = endpoint.createExchange();
+ // we only support relative paths for the ftp component, so we strip
out
+ //any leading separator
+ String parent =
FileUtil.stripLeadingSeparator(FileUtil.onlyPath(fileName));
+ String onlyName = FileUtil.stripPath(fileName);
+ dummy.getIn().setHeader(SmbConstants.FILE_NAME, fileName);
+ dummy.getIn().setHeader(SmbConstants.FILE_NAME_ONLY, onlyName);
+ dummy.getIn().setHeader(SmbConstants.FILE_PARENT, parent);
+
+ String to = endpoint.getMoveExisting().evaluate(dummy, String.class);
+ // we only support relative paths for the ftp component, so strip any
+ // leading paths
+ to = FileUtil.stripLeadingSeparator(to);
+ // normalize accordingly to configuration
+
+ if (ObjectHelper.isEmpty(to)) {
+ throw new GenericFileOperationFailedException(
+ "moveExisting evaluated as empty String, cannot move
existing file: " + fileName);
+ }
+
+ to = completePartialRelativePath(to, onlyName, parent);
+
+ // do we have a sub directory
+ String dir = FileUtil.onlyPath(to);
+ if (dir != null) {
+ // ensure directory exists
+ operations.buildDirectory(dir, false);
+ }
+
+ // deal if there already exists a file
+ if (operations.existsFile(to)) {
+ if (endpoint.isEagerDeleteTargetFile()) {
+ LOG.trace("Deleting existing file: {}", to);
+ boolean result;
+ result = operations.deleteFile(to);
+ if (!result) {
+ throw new GenericFileOperationFailedException("Cannot
delete file: " + to);
+ }
+ } else {
+ throw new GenericFileOperationFailedException(
+ "Cannot move existing file from: " + fileName + " to:
" + to + " as there already exists a file: "
+ + to);
+ }
+ }
+
+ LOG.trace("Moving existing file: {} to: {}", fileName, to);
+ if (!operations.renameFile(fileName, to)) {
+ throw new GenericFileOperationFailedException("Cannot rename file
from: " + fileName + " to: " + to);
+ }
+ return true;
+ }
+
+}
diff --git
a/components/camel-smb/src/main/java/org/apache/camel/component/smb/SmbEndpoint.java
b/components/camel-smb/src/main/java/org/apache/camel/component/smb/SmbEndpoint.java
index ef102bb160a..a99d2cf34ef 100644
---
a/components/camel-smb/src/main/java/org/apache/camel/component/smb/SmbEndpoint.java
+++
b/components/camel-smb/src/main/java/org/apache/camel/component/smb/SmbEndpoint.java
@@ -32,6 +32,7 @@ import org.apache.camel.component.file.GenericFileOperations;
import org.apache.camel.component.file.GenericFilePollingConsumer;
import org.apache.camel.component.file.GenericFileProcessStrategy;
import org.apache.camel.component.file.GenericFileProducer;
+import org.apache.camel.component.file.strategy.FileMoveExistingStrategy;
import org.apache.camel.component.smb.strategy.SmbProcessStrategyFactory;
import org.apache.camel.spi.EndpointServiceLocation;
import org.apache.camel.spi.Metadata;
@@ -93,6 +94,9 @@ public class SmbEndpoint extends
GenericFileEndpoint<FileIdBothDirectoryInformat
@Override
public GenericFileProducer<FileIdBothDirectoryInformation>
createProducer() throws Exception {
try {
+ if (this.getMoveExistingFileStrategy() == null) {
+
this.setMoveExistingFileStrategy(createDefaultFtpMoveExistingFileStrategy());
+ }
return new SmbProducer(this, createOperations());
} catch (Exception e) {
throw new FailedToCreateProducerException(this, e);
@@ -122,6 +126,15 @@ public class SmbEndpoint extends
GenericFileEndpoint<FileIdBothDirectoryInformat
return configuration;
}
+ /**
+ * Default Existing File Move Strategy
+ *
+ * @return the default implementation for SMB components
+ */
+ private FileMoveExistingStrategy
createDefaultFtpMoveExistingFileStrategy() {
+ return new SmbDefaultMoveExistingFileStrategy();
+ }
+
@Override
public GenericFileConsumer<FileIdBothDirectoryInformation>
createConsumer(Processor processor) {
// if noop=true then idempotent should also be configured
diff --git
a/components/camel-smb/src/test/java/org/apache/camel/component/smb/SmbProducerToMoveExistingIT.java
b/components/camel-smb/src/test/java/org/apache/camel/component/smb/SmbProducerToMoveExistingIT.java
new file mode 100644
index 00000000000..a185b9bc710
--- /dev/null
+++
b/components/camel-smb/src/test/java/org/apache/camel/component/smb/SmbProducerToMoveExistingIT.java
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.smb;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class SmbProducerToMoveExistingIT extends SmbServerTestSupport {
+
+ protected String getSmbUrl() {
+ return String.format(
+
"smb:%s/%s?username=%s&password=%s&path=/toMoveExisting&fileExist=Move&moveExisting=old-${file:onlyname}",
+ service.address(), service.shareName(), service.userName(),
service.password());
+ }
+
+ @Test
+ public void testMoveExisting() throws Exception {
+ getMockEndpoint("mock:result").expectedMessageCount(2);
+
+ Map<String, Object> headers = new HashMap<>();
+ headers.put("myDir", "toMoveExisting");
+ headers.put(Exchange.FILE_NAME, "hello.txt");
+ template.sendBodyAndHeaders("direct:start", "Hello World", headers);
+ template.sendBodyAndHeaders("direct:start", "Bye World", headers);
+
+ MockEndpoint.assertIsSatisfied(context);
+
+ String data = service.smbFile("toMoveExisting/old-hello.txt");
+ Assertions.assertEquals("Hello World\n", data);
+ data = service.smbFile("toMoveExisting/hello.txt");
+ Assertions.assertEquals("Bye World\n", data);
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() {
+ return new RouteBuilder() {
+ @Override
+ public void configure() {
+ from("direct:start").to(getSmbUrl()).to("mock:result");
+ }
+ };
+ }
+
+
+}
diff --git
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/FilesEndpointBuilderFactory.java
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/FilesEndpointBuilderFactory.java
index 20d79763f2c..9fe36b476fe 100644
---
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/FilesEndpointBuilderFactory.java
+++
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/FilesEndpointBuilderFactory.java
@@ -2449,6 +2449,44 @@ public interface FilesEndpointBuilderFactory {
doSetProperty("processStrategy", processStrategy);
return this;
}
+ /**
+ * Should an exception be thrown if connection failed (exhausted)By
+ * default exception is not thrown and a WARN is logged. You can use
+ * this to enable exception being thrown and handle the thrown
exception
+ * from the org.apache.camel.spi.PollingConsumerPollStrategy rollback
+ * method.
+ *
+ * The option is a: <code>boolean</code> type.
+ *
+ * Default: false
+ * Group: consumer (advanced)
+ *
+ * @param throwExceptionOnConnectFailed the value to set
+ * @return the dsl builder
+ */
+ default AdvancedFilesEndpointConsumerBuilder
throwExceptionOnConnectFailed(boolean throwExceptionOnConnectFailed) {
+ doSetProperty("throwExceptionOnConnectFailed",
throwExceptionOnConnectFailed);
+ return this;
+ }
+ /**
+ * Should an exception be thrown if connection failed (exhausted)By
+ * default exception is not thrown and a WARN is logged. You can use
+ * this to enable exception being thrown and handle the thrown
exception
+ * from the org.apache.camel.spi.PollingConsumerPollStrategy rollback
+ * method.
+ *
+ * The option will be converted to a <code>boolean</code> type.
+ *
+ * Default: false
+ * Group: consumer (advanced)
+ *
+ * @param throwExceptionOnConnectFailed the value to set
+ * @return the dsl builder
+ */
+ default AdvancedFilesEndpointConsumerBuilder
throwExceptionOnConnectFailed(String throwExceptionOnConnectFailed) {
+ doSetProperty("throwExceptionOnConnectFailed",
throwExceptionOnConnectFailed);
+ return this;
+ }
/**
* Automatically create missing directories in the file's pathname. For
* the file consumer, that means creating the starting directory. For
@@ -2611,44 +2649,6 @@ public interface FilesEndpointBuilderFactory {
doSetProperty("reconnectDelay", reconnectDelay);
return this;
}
- /**
- * Should an exception be thrown if connection failed (exhausted)By
- * default exception is not thrown and a WARN is logged. You can use
- * this to enable exception being thrown and handle the thrown
exception
- * from the org.apache.camel.spi.PollingConsumerPollStrategy rollback
- * method.
- *
- * The option is a: <code>boolean</code> type.
- *
- * Default: false
- * Group: advanced
- *
- * @param throwExceptionOnConnectFailed the value to set
- * @return the dsl builder
- */
- default AdvancedFilesEndpointConsumerBuilder
throwExceptionOnConnectFailed(boolean throwExceptionOnConnectFailed) {
- doSetProperty("throwExceptionOnConnectFailed",
throwExceptionOnConnectFailed);
- return this;
- }
- /**
- * Should an exception be thrown if connection failed (exhausted)By
- * default exception is not thrown and a WARN is logged. You can use
- * this to enable exception being thrown and handle the thrown
exception
- * from the org.apache.camel.spi.PollingConsumerPollStrategy rollback
- * method.
- *
- * The option will be converted to a <code>boolean</code> type.
- *
- * Default: false
- * Group: advanced
- *
- * @param throwExceptionOnConnectFailed the value to set
- * @return the dsl builder
- */
- default AdvancedFilesEndpointConsumerBuilder
throwExceptionOnConnectFailed(String throwExceptionOnConnectFailed) {
- doSetProperty("throwExceptionOnConnectFailed",
throwExceptionOnConnectFailed);
- return this;
- }
/**
* Sets the data timeout for waiting for reply Used only by FTPClient.
*
@@ -3616,44 +3616,6 @@ public interface FilesEndpointBuilderFactory {
doSetProperty("reconnectDelay", reconnectDelay);
return this;
}
- /**
- * Should an exception be thrown if connection failed (exhausted)By
- * default exception is not thrown and a WARN is logged. You can use
- * this to enable exception being thrown and handle the thrown
exception
- * from the org.apache.camel.spi.PollingConsumerPollStrategy rollback
- * method.
- *
- * The option is a: <code>boolean</code> type.
- *
- * Default: false
- * Group: advanced
- *
- * @param throwExceptionOnConnectFailed the value to set
- * @return the dsl builder
- */
- default AdvancedFilesEndpointProducerBuilder
throwExceptionOnConnectFailed(boolean throwExceptionOnConnectFailed) {
- doSetProperty("throwExceptionOnConnectFailed",
throwExceptionOnConnectFailed);
- return this;
- }
- /**
- * Should an exception be thrown if connection failed (exhausted)By
- * default exception is not thrown and a WARN is logged. You can use
- * this to enable exception being thrown and handle the thrown
exception
- * from the org.apache.camel.spi.PollingConsumerPollStrategy rollback
- * method.
- *
- * The option will be converted to a <code>boolean</code> type.
- *
- * Default: false
- * Group: advanced
- *
- * @param throwExceptionOnConnectFailed the value to set
- * @return the dsl builder
- */
- default AdvancedFilesEndpointProducerBuilder
throwExceptionOnConnectFailed(String throwExceptionOnConnectFailed) {
- doSetProperty("throwExceptionOnConnectFailed",
throwExceptionOnConnectFailed);
- return this;
- }
/**
* Sets the data timeout for waiting for reply Used only by FTPClient.
*
@@ -4177,44 +4139,6 @@ public interface FilesEndpointBuilderFactory {
doSetProperty("reconnectDelay", reconnectDelay);
return this;
}
- /**
- * Should an exception be thrown if connection failed (exhausted)By
- * default exception is not thrown and a WARN is logged. You can use
- * this to enable exception being thrown and handle the thrown
exception
- * from the org.apache.camel.spi.PollingConsumerPollStrategy rollback
- * method.
- *
- * The option is a: <code>boolean</code> type.
- *
- * Default: false
- * Group: advanced
- *
- * @param throwExceptionOnConnectFailed the value to set
- * @return the dsl builder
- */
- default AdvancedFilesEndpointBuilder
throwExceptionOnConnectFailed(boolean throwExceptionOnConnectFailed) {
- doSetProperty("throwExceptionOnConnectFailed",
throwExceptionOnConnectFailed);
- return this;
- }
- /**
- * Should an exception be thrown if connection failed (exhausted)By
- * default exception is not thrown and a WARN is logged. You can use
- * this to enable exception being thrown and handle the thrown
exception
- * from the org.apache.camel.spi.PollingConsumerPollStrategy rollback
- * method.
- *
- * The option will be converted to a <code>boolean</code> type.
- *
- * Default: false
- * Group: advanced
- *
- * @param throwExceptionOnConnectFailed the value to set
- * @return the dsl builder
- */
- default AdvancedFilesEndpointBuilder
throwExceptionOnConnectFailed(String throwExceptionOnConnectFailed) {
- doSetProperty("throwExceptionOnConnectFailed",
throwExceptionOnConnectFailed);
- return this;
- }
/**
* Sets the data timeout for waiting for reply Used only by FTPClient.
*
diff --git
a/test-infra/camel-test-infra-smb/src/test/java/org/apache/camel/test/infra/smb/services/SmbLocalContainerService.java
b/test-infra/camel-test-infra-smb/src/test/java/org/apache/camel/test/infra/smb/services/SmbLocalContainerService.java
index 1828617321f..a494ae1bbd2 100644
---
a/test-infra/camel-test-infra-smb/src/test/java/org/apache/camel/test/infra/smb/services/SmbLocalContainerService.java
+++
b/test-infra/camel-test-infra-smb/src/test/java/org/apache/camel/test/infra/smb/services/SmbLocalContainerService.java
@@ -14,12 +14,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.apache.camel.test.infra.smb.services;
import java.io.InputStream;
import com.github.dockerjava.api.exception.NotFoundException;
+import org.apache.camel.util.IOHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testcontainers.utility.ThrowingFunction;
@@ -63,7 +63,6 @@ public class SmbLocalContainerService implements SmbService {
@Override
public void registerProperties() {
-
}
@Override
@@ -76,6 +75,10 @@ public class SmbLocalContainerService implements SmbService {
@Override
public void shutdown() {
+ }
+ public String smbFile(String file) {
+ return this.container.copyFileFromContainer("data/rw/" + file,
IOHelper::loadText);
}
+
}
diff --git
a/test-infra/camel-test-infra-smb/src/test/java/org/apache/camel/test/infra/smb/services/SmbRemoteService.java
b/test-infra/camel-test-infra-smb/src/test/java/org/apache/camel/test/infra/smb/services/SmbRemoteService.java
index 0fa8c911919..bf39bb785a6 100644
---
a/test-infra/camel-test-infra-smb/src/test/java/org/apache/camel/test/infra/smb/services/SmbRemoteService.java
+++
b/test-infra/camel-test-infra-smb/src/test/java/org/apache/camel/test/infra/smb/services/SmbRemoteService.java
@@ -48,6 +48,11 @@ public class SmbRemoteService implements SmbService {
return null;
}
+ @Override
+ public String smbFile(String file) {
+ return null;
+ }
+
@Override
public void registerProperties() {
@@ -62,4 +67,5 @@ public class SmbRemoteService implements SmbService {
public void shutdown() {
}
+
}
diff --git
a/test-infra/camel-test-infra-smb/src/test/java/org/apache/camel/test/infra/smb/services/SmbService.java
b/test-infra/camel-test-infra-smb/src/test/java/org/apache/camel/test/infra/smb/services/SmbService.java
index f320ae2fe6f..437efa99e26 100644
---
a/test-infra/camel-test-infra-smb/src/test/java/org/apache/camel/test/infra/smb/services/SmbService.java
+++
b/test-infra/camel-test-infra-smb/src/test/java/org/apache/camel/test/infra/smb/services/SmbService.java
@@ -37,6 +37,8 @@ public interface SmbService extends TestService,
BeforeTestExecutionCallback, Af
<T> T copyFileFromContainer(String fileName, ThrowingFunction<InputStream,
T> function);
+ String smbFile(String file);
+
@Override
default void beforeAll(ExtensionContext extensionContext) {
try {