SOLR-13965: Factor out public static StreamHandler.addExpressiblePlugins method.

This commit is contained in:
Christine Poerschke 2020-01-21 18:09:11 +00:00
parent ab924fd4ea
commit 1af171e47f
1 changed files with 15 additions and 11 deletions

View File

@ -123,17 +123,7 @@ public class StreamHandler extends RequestHandlerBase implements SolrCoreAware,
streamFactory.withSolrResourceLoader(core.getResourceLoader());
// This pulls all the overrides and additions from the config
List<PluginInfo> pluginInfos = core.getSolrConfig().getPluginInfos(Expressible.class.getName());
for (PluginInfo pluginInfo : pluginInfos) {
if (pluginInfo.pkgName != null) {
ExpressibleHolder holder = new ExpressibleHolder(pluginInfo, core, SolrConfig.classVsSolrPluginInfo.get(Expressible.class));
streamFactory.withFunctionName(pluginInfo.name,
() -> holder.getClazz());
} else {
Class<? extends Expressible> clazz = core.getMemClassLoader().findClass(pluginInfo.className, Expressible.class);
streamFactory.withFunctionName(pluginInfo.name, clazz);
}
}
addExpressiblePlugins(streamFactory, core);
core.addCloseHook(new CloseHook() {
@Override
@ -148,6 +138,20 @@ public class StreamHandler extends RequestHandlerBase implements SolrCoreAware,
});
}
public static void addExpressiblePlugins(StreamFactory streamFactory, SolrCore core) {
List<PluginInfo> pluginInfos = core.getSolrConfig().getPluginInfos(Expressible.class.getName());
for (PluginInfo pluginInfo : pluginInfos) {
if (pluginInfo.pkgName != null) {
ExpressibleHolder holder = new ExpressibleHolder(pluginInfo, core, SolrConfig.classVsSolrPluginInfo.get(Expressible.class));
streamFactory.withFunctionName(pluginInfo.name,
() -> holder.getClazz());
} else {
Class<? extends Expressible> clazz = core.getMemClassLoader().findClass(pluginInfo.className, Expressible.class);
streamFactory.withFunctionName(pluginInfo.name, clazz);
}
}
}
public static class ExpressibleHolder extends PackagePluginHolder {
private Class clazz;