-
Notifications
You must be signed in to change notification settings - Fork 1.1k
GH-9988: Add FileExistsMode expression support #10019
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Fixes: spring-projects#9988 Issue link: spring-projects#9988 This change allows dynamic determination of FileExistsMode using SpEL expressions, making the component more flexible when handling file existence conflicts. * Add fileExistsModeExpression field and setter methods * Use resolveFileExistsMode in put and get operations * Add changes to the docs Signed-off-by: Jooyoung Pyoung <[email protected]>
Improve runtime behavior by ignoring temporary filename settings when file exists mode is APPEND. Now, in FileExistsMode.APPEND mode, content is always appended directly to the original file regardless of useTemporaryFileName setting. In RemoteFileTemplate: - Remove exception validation when APPEND mode is used with temporary filenames - Modify logic to skip applying temporaryFileSuffix in APPEND mode In AbstractRemoteFileOutboundGateway: - Remove logic that disabled temporary filenames when setting APPEND mode Signed-off-by: Jooyoung Pyoung <[email protected]>
Signed-off-by: Jooyoung Pyoung <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, consider to describe this new feature in the: https://docs.spring.io/spring-integration/reference/ftp/rft.html#page-title. (src/reference/antora/modules/ROOT/pages/sftp/rft.adoc
file)
And also mention new feature in the whats-new.adoc
.
And as a bonus we also can consider to expose this new option on the RemoteFileOutboundGatewaySpec
for Java DSL.
Thanks
...ation-file/src/main/java/org/springframework/integration/file/remote/RemoteFileTemplate.java
Outdated
Show resolved
Hide resolved
...a/org/springframework/integration/file/remote/gateway/AbstractRemoteFileOutboundGateway.java
Outdated
Show resolved
Hide resolved
...a/org/springframework/integration/file/remote/gateway/AbstractRemoteFileOutboundGateway.java
Outdated
Show resolved
Hide resolved
...ation-file/src/main/java/org/springframework/integration/file/remote/RemoteFileTemplate.java
Show resolved
Hide resolved
- Optimize EvaluationContext usage by creating it once in doInit() - Enhance expression evaluation to support String representation of FileExistsMode - Optimize temporary filename handling logic in RemoteFileTemplate - Add warning message for incompatible APPEND mode with temporary filenames - Rename method to setFileExistsModeExpressionString for consistency - Update Java DSL support in RemoteFileOutboundGatewaySpec - Update reference documentation and release notes Signed-off-by: Jooyoung Pyoung <[email protected]>
I've implemented all these suggestions:
Thank you for the helpful guidance! Please let me know if any further adjustments are needed. |
...le/src/main/java/org/springframework/integration/file/dsl/RemoteFileOutboundGatewaySpec.java
Show resolved
Hide resolved
...a/org/springframework/integration/file/remote/gateway/AbstractRemoteFileOutboundGateway.java
Outdated
Show resolved
Hide resolved
...a/org/springframework/integration/file/remote/gateway/AbstractRemoteFileOutboundGateway.java
Outdated
Show resolved
Hide resolved
...a/org/springframework/integration/file/remote/gateway/AbstractRemoteFileOutboundGateway.java
Outdated
Show resolved
Hide resolved
- Add Function variant to RemoteFileOutboundGatewaySpec - Update documentations to use one-sentence-per-line style - Improve code flow in resolveFileExistsMode method Signed-off-by: Jooyoung Pyoung <[email protected]>
...le/src/main/java/org/springframework/integration/file/dsl/RemoteFileOutboundGatewaySpec.java
Outdated
Show resolved
Hide resolved
...a/org/springframework/integration/file/remote/gateway/AbstractRemoteFileOutboundGateway.java
Show resolved
Hide resolved
...a/org/springframework/integration/file/remote/gateway/AbstractRemoteFileOutboundGateway.java
Outdated
Show resolved
Hide resolved
- Use Object instead of String in fileExistsModeFunction - Fix return method call in fileExistsModeFunction (remoteDirectoryExpression -> fileExistsModeExpression) - Fix standardEvaluationContext initialization in doInit - Ensure proper EvaluationContext usage in other methods Signed-off-by: Jooyoung Pyoung <[email protected]>
I've fixed all the issues you pointed out in your reviews, as well as additional mistake I noticed. I think I made these mistakes because I was rushing with the 6.5 release timeline in mind. Please let me know if there's anything else I might have missed! Thanks. |
thank you very much for the contribution; looking forward for more! |
Fixes #9988
In
AbstractRemoteFileOutboundGateway
:fileExistsModeExpression
field and setter methodsresolveFileExistsMode
in put and get operationsAPPEND
modeIn
RemoteFileTemplate
: