[
https://issues.apache.org/jira/browse/CAMEL-25257?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen updated CAMEL-25257:
--------------------------------
Fix Version/s: 4.24.0
(was: 4.23.0)
> camel-api / camel-jbang - SPI for declarations a feature adds to route files
> (dependency detection and DSL conversion), implemented by camel-semantic
> -----------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-25257
> URL: https://issues.apache.org/jira/browse/CAMEL-25257
> Project: Camel
> Issue Type: Improvement
> Components: camel-ai, camel-core-api, camel-jbang
> Reporter: Claus Ibsen
> Priority: Minor
> Fix For: 4.24.0
>
>
> Some features add declarations to route files that are not part of the route
> model, such as the questions of camel-semantic:
> * YAML: a top-level {{- semantic:}} entry
> * XML: a {{<semantic>}} element
> * Java: {{semanticQuestions(this).question(...)...register()}}
> Tooling that reads route files without running them cannot handle these
> today. camel-jbang does not know that such a file needs camel-semantic, so
> the declarations fail to load before the {{semantic}} language could pull the
> dependency in. The route DSL converter ({{camel transform route}}, the source
> editor, the {{camel_transform_route}} MCP tool) can only refuse them, because
> only the feature itself knows its declarations.
> This ticket adds an SPI so the feature carries this knowledge, and
> camel-jbang stays free of feature code. It has two halves.
> *1. Dependency detection, keyed by name*
> A feature registers
> {{META-INF/services/org/apache/camel/dsl-declarations/<name>}}, where the
> name is the YAML key or XML element ({{semantic}}). The generated
> {{camel-factoryfinder-known-dependencies.properties}} of camel-kamelet-main
> then maps {{dsl-declarations/semantic}} to camel-semantic.
> When camel-jbang ({{camel run}}, {{camel export}}, the converter) meets an
> unknown top-level YAML key or XML element {{foo}}, it looks up
> {{dsl-declarations/foo}}. That downloads the jar, so the declarations can
> load. For Java, the {{org.apache.camel.semantic}} package is added to the
> known class dependencies.
> *2. The add-on*
> An interface in camel-api {{org.apache.camel.spi}} ({{@since 4.23}}), found
> by the key above. A feature implements it to:
> * detect its declarations in a route source (YAML, XML, Java);
> * take them out as plain data, leaving the routes to the regular readers;
> * write them in another DSL.
> The route DSL converter then carries the declarations over instead of
> refusing them. camel-semantic implements it, YAML and XML first. Java needs
> reading the {{semanticQuestions(...)}} chain without running it, because the
> Java DSL parser deliberately does not replay it.
> The add-on must follow the rules for tooling that reads route sources: no
> class of the project is loaded, no code of the project runs, and no property
> placeholder is resolved (see the security model).
> _Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v8.20.10#820010)