mirror of https://github.com/apache/lucene.git
SOLR-13965: Factor out public static StreamHandler.addExpressiblePlugins method.
This commit is contained in:
parent
ab924fd4ea
commit
1af171e47f
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue