CAMEL-23491: Add known 3rd party plugin catalog to camel-jbang#23443
CAMEL-23491: Add known 3rd party plugin catalog to camel-jbang#23443davsclaus wants to merge 3 commits into
Conversation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@Croway do you have a better forage jbang plugin description we can use |
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
|
🧪 CI tested the following changed modules:
💡 Manual integration tests recommended:
All tested modules (6 modules)
|
|
for Forage, something like |
gnodet
left a comment
There was a problem hiding this comment.
Good feature -- the known-plugin catalog is a nice UX improvement. A couple of items to address:
-
FQCN in
PluginHelper.loadKnownPlugins():java.nio.charset.StandardCharsets.UTF_8is used inline instead of importingStandardCharsets. The project convention (and the OpenRewrite CI check) requires using simple class names with an import statement. -
Forage description: @Croway suggested a better description in the comments: "Configure components via opinionated bean factories". The
known-plugins.jsonshould be updated accordingly.
Otherwise the implementation looks clean, the tests are properly updated, and the documentation is good.
Claude Code on behalf of Guillaume Nodet
…l/dsl/jbang/core/common/PluginHelper.java Co-authored-by: Guillaume Nodet <gnodet@gmail.com>
…ins.json Co-authored-by: Guillaume Nodet <gnodet@gmail.com>
@Croway can we come up with a better description. As an end user I would not really what that means and why I should care. Its something about connectors and adapters that adjust to chosen runtimes, and their best practices. The bean factory is more an implementation detail. |
gnodet
left a comment
There was a problem hiding this comment.
Follow-up review after commits 08cc321 and 09c358d.
Compile error in PluginHelper.loadKnownPlugins()
The web-editor commit (08cc321) appears to have mangled the method body. The current code has three issues that will prevent compilation:
-
Duplicate variable declaration:
String textis declared twice — the original FQCN line (java.nio.charset.StandardCharsets.UTF_8) was not removed when the replacement line (StandardCharsets.UTF_8) was added. -
Missing
forloop: Thefor (Object o : arr)loop structure was lost — only the body (if (o instanceof JsonObject jo) { ... }) and closing braces remain. -
Double stream consumption:
is.readAllBytes()would be called twice on the sameInputStream, which yields an empty byte array on the second call.
The corrected method should be:
public static List<JsonObject> loadKnownPlugins() {
try (InputStream is = PluginHelper.class.getClassLoader().getResourceAsStream("known-plugins.json")) {
if (is != null) {
String text = new String(is.readAllBytes(), StandardCharsets.UTF_8);
JsonArray arr = (JsonArray) Jsoner.deserialize(text);
List<JsonObject> result = new ArrayList<>(arr.size());
for (Object o : arr) {
if (o instanceof JsonObject jo) {
result.add(jo);
}
}
return result;
}
} catch (Exception e) {
// ignore
}
return List.of();
}Other observations on the new commits:
known-plugins.json: The updated forage description ("Configure components via opinionated bean factories") is more accurate — good improvement.- The rest of the changeset (PluginGet, PluginAdd, PluginType vendor field, docs, tests) looks solid.
Please fix the loadKnownPlugins() method — it's the only blocking issue.
Claude Code on behalf of Guillaume Nodet
Summary
known-plugins.json) so users can install them by name without specifying GAV coordinates (e.g.,camel plugin add forage)vendorfield toPluginTypeenum to distinguish ASF vs Community pluginscamel plugin get --allnow shows three sections: active, supported (ASF), and known 3rd party (Community)--versionflag; defaults toLATESTfor 3rd party pluginsTest plan
camel plugin get --allshows vendor column and 3rd party sectioncamel plugin add forageauto-fills GAV from catalogcamel plugin add forage --version=1.2.3pins specific version🤖 Generated with Claude Code