davsclaus opened a new pull request, #27715: URL: https://github.com/apache/camel/pull/27715
Given Java source files, `camel cmd route-diagram`, `route-structure` and `route-topology` (and the `camel_render_route_diagram` MCP tool) booted a short-lived Camel through `Run.runTransform`, which compiles the routes and dumps the route model as JSON. That takes seconds, needs the project's classes and dependencies, and could not be unit tested. Now they read Java sources with the Java DSL parser, as `camel transform route` (CAMEL-25202) and `camel overview` already do: - `TransformJavaRoutes.dumpStructure` reads the files with the parser (catalog endpoint DSL resolver, constants of the other sources in the folder), adds the routes to a CamelContext that is never started, and dumps the route structure and `route-topology.json` with the same `DefaultDumpRoutesStrategy`. The commands read that JSON as before. - A route read only partly is still shown: a lambda or processor is the placeholder step the parser puts in the model, and the parts it could not read are listed (not with `--json`). A Java file with no routes the parser can read says so and points to `--compile`. - The parsed routes get their source location set (`file:Orders.java` plus line), so route-structure shows `Source: Orders.java` as before. - New `--compile` option on the three commands to compile and boot the sources as before. YAML and XML sources are unchanged. - MCP tool: the description now says how Java routes are read, and the success message includes the parts the parser could not read. - `TransformJavaRoutes` is now public (used from the `action` package); `transform` keeps its strict behaviour (any unread part falls back to compiling). Docs: route-diagram page, diagnostics page, `design/java-dsl-parser.adoc`, regenerated command docs, and a 4.24 upgrade-guide entry (new `camel-4x-upgrade-guide-4_24.adoc`; #27681, #27679 and #27714 add the same file, so whichever is merged later keeps the header once and all sections). Tests: new `RouteActionJavaSourceTest`. It covers diagram (two files, a lambda placeholder, notes printed), a source without routes, `--compile` still checking the files, topology linking two files with `--json` (no notes in the JSON), and structure showing the source. All 1768 camel-jbang-core tests pass, and so do the `RouteDiagramToolsTest` MCP tests. Fixes [CAMEL-25565](https://issues.apache.org/jira/browse/CAMEL-25565) _Claude Code on behalf of Claus Ibsen_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
