remove broken Stream registration API

This commit is contained in:
Simon Willnauer 2015-10-27 16:25:58 +01:00
parent 67cdd21573
commit 6fbfdb0e12
8 changed files with 12 additions and 23 deletions

View File

@ -143,7 +143,7 @@ public class TransportClient extends AbstractClient {
modules.add(new ClusterNameModule(this.settings));
modules.add(new ThreadPoolModule(threadPool));
modules.add(new TransportModule(this.settings));
modules.add(new SearchModule(this.settings) {
modules.add(new SearchModule() {
@Override
protected void configure() {
// noop

View File

@ -182,7 +182,7 @@ public class Node implements Releasable {
modules.add(new HttpServerModule(settings));
}
modules.add(new IndicesModule());
modules.add(new SearchModule(settings));
modules.add(new SearchModule());
modules.add(new ActionModule(false));
modules.add(new MonitorModule(settings));
modules.add(new GatewayModule(settings));

View File

@ -156,7 +156,6 @@ import java.util.Set;
*/
public class SearchModule extends AbstractModule {
private final Settings settings;
private final Set<Class<? extends Aggregator.Parser>> aggParsers = new HashSet<>();
private final Set<Class<? extends PipelineAggregator.Parser>> pipelineAggParsers = new HashSet<>();
private final Highlighters highlighters = new Highlighters();
@ -169,19 +168,6 @@ public class SearchModule extends AbstractModule {
// pkg private so tests can mock
Class<? extends SearchService> searchServiceImpl = SearchService.class;
public SearchModule(Settings settings) {
this.settings = settings;
}
// TODO document public API
public void registerStream(SignificanceHeuristicStreams.Stream stream) {
SignificanceHeuristicStreams.registerStream(stream);
}
public void registerStream(MovAvgModelStreams.Stream stream) {
MovAvgModelStreams.registerStream(stream);
}
public void registerHighlighter(String key, Class<? extends Highlighter> clazz) {
highlighters.registerExtension(key, clazz);
}

View File

@ -79,7 +79,7 @@ public class SignificanceHeuristicStreams {
* @param name The given name
* @return The associated stream
*/
public static synchronized Stream stream(String name) {
private static synchronized Stream stream(String name) {
return STREAMS.get(name);
}

View File

@ -79,7 +79,7 @@ public class MovAvgModelStreams {
* @param name The given name
* @return The associated stream
*/
public static synchronized Stream stream(String name) {
private static synchronized Stream stream(String name) {
return STREAMS.get(name);
}

View File

@ -111,7 +111,7 @@ public class PluginsServiceTests extends ESTestCase {
}
}
public void testOnModuleExceptionsArePropergated() {
public void testOnModuleExceptionsArePropagated() {
Settings settings = Settings.builder()
.put("path.home", createTempDir()).build();
PluginsService service = newPluginsService(settings, FailOnModule.class);

View File

@ -31,7 +31,7 @@ import org.elasticsearch.search.suggest.phrase.PhraseSuggester;
public class SearchModuleTests extends ModuleTestCase {
public void testDoubleRegister() {
SearchModule module = new SearchModule(Settings.EMPTY);
SearchModule module = new SearchModule();
try {
module.registerHighlighter("fvh", PlainHighlighter.class);
} catch (IllegalArgumentException e) {
@ -46,7 +46,7 @@ public class SearchModuleTests extends ModuleTestCase {
}
public void testRegisterSuggester() {
SearchModule module = new SearchModule(Settings.EMPTY);
SearchModule module = new SearchModule();
module.registerSuggester("custom", CustomSuggester.class);
try {
module.registerSuggester("custom", CustomSuggester.class);
@ -57,7 +57,7 @@ public class SearchModuleTests extends ModuleTestCase {
}
public void testRegisterHighlighter() {
SearchModule module = new SearchModule(Settings.EMPTY);
SearchModule module = new SearchModule();
module.registerHighlighter("custom", CustomHighlighter.class);
try {
module.registerHighlighter("custom", CustomHighlighter.class);

View File

@ -174,6 +174,10 @@ public class SignificantTermsSignificanceScoreTests extends ESIntegTestCase {
public static class CustomSignificanceHeuristicPlugin extends Plugin {
static {
SignificanceHeuristicStreams.registerStream(SimpleHeuristic.STREAM);
}
@Override
public String name() {
return "test-plugin-significance-heuristic";
@ -186,7 +190,6 @@ public class SignificantTermsSignificanceScoreTests extends ESIntegTestCase {
public void onModule(SearchModule significanceModule) {
significanceModule.registerHeuristicParser(SimpleHeuristic.SimpleHeuristicParser.class);
significanceModule.registerStream(SimpleHeuristic.STREAM);
}
public void onModule(ScriptModule module) {
module.registerScript(NativeSignificanceScoreScriptNoParams.NATIVE_SIGNIFICANCE_SCORE_SCRIPT_NO_PARAMS, NativeSignificanceScoreScriptNoParams.Factory.class);