pvcnt commented on code in PR #2016:
URL: https://github.com/apache/solr/pull/2016#discussion_r1363842905
##########
solr/core/src/java/org/apache/solr/api/ContainerPluginsRegistry.java:
##########
@@ -120,6 +123,33 @@ public void unregisterListener(PluginRegistryListener
listener) {
public ContainerPluginsRegistry(CoreContainer coreContainer, ApiBag apiBag) {
this.coreContainer = coreContainer;
this.containerApiBag = apiBag;
+ loadFromNodeConfig();
+ }
+
+ private void loadFromNodeConfig() {
+ // Load plugins defined in solr.xml. Those plugins are then considered
exactly like
+ // other plugins, e.g., they can be updated or uninstalled.
+ for (PluginInfo pluginInfo :
coreContainer.getNodeConfig().getNodePlugins()) {
+ Map<String, Object> info = new HashMap<>();
+ info.put("name", pluginInfo.name);
+ info.put("class", pluginInfo.className);
+ String version = pluginInfo.attributes.get("version");
+ if (null != version) {
+ info.put("version", version);
+ }
+ String pathPrefix = pluginInfo.attributes.get("path-prefix");
+ if (null != pathPrefix) {
+ info.put("path-prefix", pathPrefix);
+ }
+ if (pluginInfo.initArgs.size() > 0) {
+ info.put("config", pluginInfo.initArgs.toMap(new HashMap<>()));
+ }
+ try {
+ addOrUpdatePlugin(Diff.ADDED, pluginInfo.name, new
PluginMetaHolder(info));
+ } catch (Exception exp) {
+ log.error("Invalid pluginInfo configuration", exp);
Review Comment:
If I remember well, it should technically never happen. The only checked
exception is thrown in the constructor of `PluginMetaHolder` where the JSON is
parsed, but here JSON is built manually. I would have liked to get a rid of
that step btw, but I was not comfortable with changing the existing behaviour
too much.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]