Allow plugins to provide additional settings.
This commit is contained in:
parent
85aeaaedd0
commit
785fb11f2a
|
@ -25,6 +25,8 @@ import org.elasticsearch.common.inject.Module;
|
||||||
import org.elasticsearch.index.CloseableIndexComponent;
|
import org.elasticsearch.index.CloseableIndexComponent;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A base class for a plugin.
|
* A base class for a plugin.
|
||||||
|
@ -78,4 +80,9 @@ public abstract class AbstractPlugin implements Plugin {
|
||||||
@Override public void processModule(Module module) {
|
@Override public void processModule(Module module) {
|
||||||
// nothing to do here
|
// nothing to do here
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override public Map<String, String> additionalSettings() {
|
||||||
|
return Collections.emptyMap();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@ import org.elasticsearch.common.inject.Module;
|
||||||
import org.elasticsearch.index.CloseableIndexComponent;
|
import org.elasticsearch.index.CloseableIndexComponent;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An extension point allowing to plug in custom functionality.
|
* An extension point allowing to plug in custom functionality.
|
||||||
|
@ -73,4 +74,9 @@ public interface Plugin {
|
||||||
Collection<Class<? extends CloseableIndexComponent>> shardServices();
|
Collection<Class<? extends CloseableIndexComponent>> shardServices();
|
||||||
|
|
||||||
void processModule(Module module);
|
void processModule(Module module);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Additional node settings loaded by the plugin
|
||||||
|
*/
|
||||||
|
Map<String, String> additionalSettings();
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@ import org.elasticsearch.common.component.AbstractComponent;
|
||||||
import org.elasticsearch.common.component.LifecycleComponent;
|
import org.elasticsearch.common.component.LifecycleComponent;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.inject.Module;
|
import org.elasticsearch.common.inject.Module;
|
||||||
|
import org.elasticsearch.common.settings.ImmutableSettings;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.env.Environment;
|
import org.elasticsearch.env.Environment;
|
||||||
import org.elasticsearch.index.CloseableIndexComponent;
|
import org.elasticsearch.index.CloseableIndexComponent;
|
||||||
|
@ -81,7 +82,12 @@ public class PluginsService extends AbstractComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Settings updatedSettings() {
|
public Settings updatedSettings() {
|
||||||
return this.settings;
|
ImmutableSettings.Builder builder = ImmutableSettings.settingsBuilder()
|
||||||
|
.put(this.settings);
|
||||||
|
for (Plugin plugin : plugins.values()) {
|
||||||
|
builder.put(plugin.additionalSettings());
|
||||||
|
}
|
||||||
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<Class<? extends Module>> modules() {
|
public Collection<Class<? extends Module>> modules() {
|
||||||
|
|
Loading…
Reference in New Issue