Add file integration improvements#692
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Pull request overview
This pull request enhances FTP file integration by moving the monitoring path from listener configuration to a service-level annotation pattern, adding post-processing actions for file handlers, and updating to FTP module version 2.17.0.
Changes:
- Moved
pathconfiguration from listener parameters to@ftp:ServiceConfigservice annotation - Added post-processing actions (
postProcessActionOnSuccessandpostProcessActionOnError) for FTP file handlers with support for MOVE, DELETE, and NONE actions - Updated FTP module version from 2.15.1/2.16.0 to 2.17.0 and corresponding package icons
- Added
FTPFunctionBuilderto handle function-level annotation transformations - Enhanced listener reuse logic to filter out legacy FTP listeners that don't use the new annotation pattern
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| ftp_service.json | Added annotServiceConfig property and post-processing actions to all file handlers; updated version to 2.17.0 |
| ftp_init.json | Moved path property from listener config to service-level with SERVICE_ANNOTATION codedata type; removed from protocol choices; updated version to 2.17.0 |
| FTPServiceBuilder.java | Implemented listener reuse with legacy filtering, service path annotation generation, and post-processing action parsing from function annotations |
| FTPFunctionBuilder.java | New builder to transform post-processing choice properties into @ftp:FunctionConfig annotations |
| Utils.java | Added SERVICE_ANNOTATION handling to group annotation fields together |
| CommonUtils.java | Enhanced annotation field extraction to handle non-literal expressions |
| Artifact.java | Added FTP path field to moduleAnnotationFields for architecture model generation |
| Test resources | Updated test files with new annotation pattern and line number adjustments |
| FunctionBuilderRouter.java | Registered FTPFunctionBuilder for FTP protocol |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...ain/java/io/ballerina/servicemodelgenerator/extension/builder/service/FTPServiceBuilder.java
Outdated
Show resolved
Hide resolved
...ain/java/io/ballerina/servicemodelgenerator/extension/builder/service/FTPServiceBuilder.java
Outdated
Show resolved
Hide resolved
...l-generator-ls-extension/src/test/resources/get_sm_from_source/config/ftp_service_model.json
Show resolved
Hide resolved
...rator-ls-extension/src/test/resources/add_service_and_listener/config/ftp_service_model.json
Show resolved
Hide resolved
...l-generator-ls-extension/src/test/resources/get_sm_from_source/config/ftp_service_model.json
Outdated
Show resolved
Hide resolved
...ain/java/io/ballerina/servicemodelgenerator/extension/builder/service/FTPServiceBuilder.java
Show resolved
Hide resolved
...n/java/io/ballerina/servicemodelgenerator/extension/builder/function/FTPFunctionBuilder.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 19 out of 19 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Check for @ftp:ServiceConfig annotation (allow alias prefixes) | ||
| if (annotationText.endsWith("ServiceConfig")) { |
There was a problem hiding this comment.
hasServiceConfigAnnotation is intended to verify the presence of @ftp:ServiceConfig, but it currently accepts any annotation whose reference ends with ServiceConfig (e.g., @http:ServiceConfig, @graphql:ServiceConfig). This can incorrectly classify a listener as “non-legacy” and allow reusing it even when the FTP service is missing the required FTP annotation. Tighten the check to ensure the annotation resolves to the ballerina/ftp module (e.g., via SemanticModel symbol resolution for the annotation reference, or by matching the qualifier/alias that corresponds to the imported ftp module).
| // Check for @ftp:ServiceConfig annotation (allow alias prefixes) | |
| if (annotationText.endsWith("ServiceConfig")) { | |
| // Check specifically for @ftp:ServiceConfig annotation | |
| if ("ftp:ServiceConfig".equals(annotationText)) { |
| String serviceConfigAnnotation = "@ftp:ServiceConfig {" + NEW_LINE + | ||
| " path: " + folderPath + NEW_LINE + | ||
| "}" + NEW_LINE; |
There was a problem hiding this comment.
The generated service annotation is hardcoded as @ftp:ServiceConfig, which assumes the module is imported with the default prefix ftp. If the user already has import ballerina/ftp as <alias>; in the file, importExists will return true (it ignores the alias) and the generated @ftp:... reference will not compile. Consider resolving the actual import prefix/alias for ballerina/ftp from the existing import declarations and using that prefix when emitting the annotation reference (or otherwise ensuring the prefix used in generated code matches the import).
Summary
This draft PR adds and stabilizes FTP service-model support in the language server for file integration flows.
Included changes
onErrorhandler model support.ftp_service.jsonstructure.Notes