Make sure license plugins classes are loaded before we can instantiate them
Original commit: elastic/x-pack-elasticsearch@c46fd7287e
This commit is contained in:
parent
c74ae7aad2
commit
70ed74cd7d
|
@ -69,7 +69,8 @@ public class ShieldPlugin extends Plugin {
|
||||||
private final Settings settings;
|
private final Settings settings;
|
||||||
private final boolean enabled;
|
private final boolean enabled;
|
||||||
private final boolean clientMode;
|
private final boolean clientMode;
|
||||||
private final ShieldLicenseState shieldLicenseState = new ShieldLicenseState();
|
private ShieldLicenseState shieldLicenseState;
|
||||||
|
|
||||||
|
|
||||||
public ShieldPlugin(Settings settings) {
|
public ShieldPlugin(Settings settings) {
|
||||||
this.settings = settings;
|
this.settings = settings;
|
||||||
|
@ -99,6 +100,10 @@ public class ShieldPlugin extends Plugin {
|
||||||
new ShieldTransportModule(settings),
|
new ShieldTransportModule(settings),
|
||||||
new SSLModule(settings));
|
new SSLModule(settings));
|
||||||
} else {
|
} else {
|
||||||
|
// we can't load that at construction time since the license plugin might not have been loaded at that point
|
||||||
|
// which might not be the case during Plugin class instantiation. Once nodeModules are pulled
|
||||||
|
// everything should have been loaded
|
||||||
|
shieldLicenseState = new ShieldLicenseState();
|
||||||
return Arrays.<Module>asList(
|
return Arrays.<Module>asList(
|
||||||
new ShieldModule(settings),
|
new ShieldModule(settings),
|
||||||
new LicenseModule(settings, shieldLicenseState),
|
new LicenseModule(settings, shieldLicenseState),
|
||||||
|
@ -155,7 +160,10 @@ public class ShieldPlugin extends Plugin {
|
||||||
if (enabled == false) {
|
if (enabled == false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
module.setSearcherWrapper((indexService) -> new ShieldIndexSearcherWrapper(indexService.getIndexSettings(), indexService.queryParserService(), indexService.mapperService(), indexService.bitsetFilterCache(), shieldLicenseState));
|
assert shieldLicenseState != null;
|
||||||
|
module.setSearcherWrapper((indexService) -> new ShieldIndexSearcherWrapper(indexService.getIndexSettings(),
|
||||||
|
indexService.queryParserService(), indexService.mapperService(),
|
||||||
|
indexService.bitsetFilterCache(), shieldLicenseState));
|
||||||
if (clientMode == false) {
|
if (clientMode == false) {
|
||||||
module.registerQueryCache(ShieldPlugin.OPT_OUT_QUERY_CACHE, OptOutQueryCache::new);
|
module.registerQueryCache(ShieldPlugin.OPT_OUT_QUERY_CACHE, OptOutQueryCache::new);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue