Remove NodeClientModule and PluginsModule
This commit is contained in:
parent
fb713774a1
commit
e50314bb6e
|
@ -1,34 +0,0 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.client.node;
|
||||
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.common.inject.AbstractModule;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class NodeClientModule extends AbstractModule {
|
||||
|
||||
@Override
|
||||
protected void configure() {
|
||||
bind(Client.class).to(NodeClient.class).asEagerSingleton();
|
||||
}
|
||||
}
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
package org.elasticsearch.client.transport;
|
||||
|
||||
import org.elasticsearch.Version;
|
||||
import org.elasticsearch.action.Action;
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.ActionModule;
|
||||
|
@ -46,7 +45,6 @@ import org.elasticsearch.monitor.MonitorService;
|
|||
import org.elasticsearch.node.Node;
|
||||
import org.elasticsearch.node.internal.InternalSettingsPreparer;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.plugins.PluginsModule;
|
||||
import org.elasticsearch.plugins.PluginsService;
|
||||
import org.elasticsearch.search.SearchModule;
|
||||
import org.elasticsearch.threadpool.ExecutorBuilder;
|
||||
|
@ -120,9 +118,6 @@ public class TransportClient extends AbstractClient {
|
|||
public TransportClient build() {
|
||||
final PluginsService pluginsService = newPluginService(providedSettings);
|
||||
final Settings settings = pluginsService.updatedSettings();
|
||||
|
||||
Version version = Version.CURRENT;
|
||||
|
||||
final ThreadPool threadPool = new ThreadPool(settings);
|
||||
final NetworkService networkService = new NetworkService(settings);
|
||||
NamedWriteableRegistry namedWriteableRegistry = new NamedWriteableRegistry();
|
||||
|
@ -133,7 +128,6 @@ public class TransportClient extends AbstractClient {
|
|||
for (Module pluginModule : pluginsService.nodeModules()) {
|
||||
modules.add(pluginModule);
|
||||
}
|
||||
modules.add(new PluginsModule(pluginsService));
|
||||
modules.add(new NetworkModule(networkService, settings, true, namedWriteableRegistry));
|
||||
modules.add(b -> b.bind(ThreadPool.class).toInstance(threadPool));
|
||||
modules.add(new SearchModule(settings, namedWriteableRegistry) {
|
||||
|
@ -156,7 +150,10 @@ public class TransportClient extends AbstractClient {
|
|||
CircuitBreakerService circuitBreakerService = Node.createCircuitBreakerService(settingsModule.getSettings(),
|
||||
settingsModule.getClusterSettings());
|
||||
modules.add(settingsModule);
|
||||
modules.add((b -> b.bind(CircuitBreakerService.class).toInstance(circuitBreakerService)));
|
||||
modules.add((b -> {
|
||||
b.bind(PluginsService.class).toInstance(pluginsService);
|
||||
b.bind(CircuitBreakerService.class).toInstance(circuitBreakerService);
|
||||
}));
|
||||
|
||||
Injector injector = modules.createInjector();
|
||||
final TransportService transportService = injector.getInstance(TransportService.class);
|
||||
|
|
|
@ -27,7 +27,7 @@ import org.elasticsearch.ElasticsearchTimeoutException;
|
|||
import org.elasticsearch.Version;
|
||||
import org.elasticsearch.action.ActionModule;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.node.NodeClientModule;
|
||||
import org.elasticsearch.client.node.NodeClient;
|
||||
import org.elasticsearch.cluster.ClusterModule;
|
||||
import org.elasticsearch.cluster.ClusterState;
|
||||
import org.elasticsearch.cluster.ClusterStateObserver;
|
||||
|
@ -87,7 +87,6 @@ import org.elasticsearch.monitor.jvm.JvmInfo;
|
|||
import org.elasticsearch.node.internal.InternalSettingsPreparer;
|
||||
import org.elasticsearch.node.service.NodeService;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.plugins.PluginsModule;
|
||||
import org.elasticsearch.plugins.PluginsService;
|
||||
import org.elasticsearch.plugins.ScriptPlugin;
|
||||
import org.elasticsearch.repositories.RepositoriesModule;
|
||||
|
@ -252,7 +251,6 @@ public class Node implements Closeable {
|
|||
modules.add(pluginModule);
|
||||
}
|
||||
final MonitorService monitorService = new MonitorService(settings, nodeEnvironment, threadPool);
|
||||
modules.add(new PluginsModule(pluginsService));
|
||||
modules.add(new NodeModule(this, monitorService));
|
||||
modules.add(new NetworkModule(networkService, settings, false, namedWriteableRegistry));
|
||||
modules.add(scriptModule);
|
||||
|
@ -262,7 +260,6 @@ public class Node implements Closeable {
|
|||
modules.add(new SearchModule(settings, namedWriteableRegistry));
|
||||
modules.add(new ActionModule(DiscoveryNode.isIngestNode(settings), false));
|
||||
modules.add(new GatewayModule());
|
||||
modules.add(new NodeClientModule());
|
||||
modules.add(new RepositoriesModule());
|
||||
modules.add(new AnalysisModule(environment));
|
||||
pluginsService.processModules(modules);
|
||||
|
@ -271,6 +268,8 @@ public class Node implements Closeable {
|
|||
resourcesToClose.add(circuitBreakerService);
|
||||
modules.add(settingsModule);
|
||||
modules.add(b -> {
|
||||
b.bind(PluginsService.class).toInstance(pluginsService);
|
||||
b.bind(Client.class).to(NodeClient.class).asEagerSingleton();
|
||||
b.bind(Environment.class).toInstance(environment);
|
||||
b.bind(ThreadPool.class).toInstance(threadPool);
|
||||
b.bind(NodeEnvironment.class).toInstance(nodeEnvironment);
|
||||
|
|
|
@ -1,36 +0,0 @@
|
|||
/*
|
||||
* Licensed to Elasticsearch under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.plugins;
|
||||
|
||||
import org.elasticsearch.common.inject.AbstractModule;
|
||||
|
||||
public class PluginsModule extends AbstractModule {
|
||||
|
||||
private final PluginsService pluginsService;
|
||||
|
||||
public PluginsModule(PluginsService pluginsService) {
|
||||
this.pluginsService = pluginsService;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configure() {
|
||||
bind(PluginsService.class).toInstance(pluginsService);
|
||||
}
|
||||
}
|
|
@ -93,7 +93,6 @@ import org.elasticsearch.indices.mapper.MapperRegistry;
|
|||
import org.elasticsearch.indices.query.IndicesQueriesRegistry;
|
||||
import org.elasticsearch.node.internal.InternalSettingsPreparer;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.plugins.PluginsModule;
|
||||
import org.elasticsearch.plugins.PluginsService;
|
||||
import org.elasticsearch.script.Script.ScriptParseException;
|
||||
import org.elasticsearch.script.ScriptModule;
|
||||
|
@ -889,9 +888,9 @@ public abstract class AbstractQueryTestCase<QB extends AbstractQueryBuilder<QB>>
|
|||
for (Module pluginModule : pluginsService.nodeModules()) {
|
||||
modulesBuilder.add(pluginModule);
|
||||
}
|
||||
modulesBuilder.add(new PluginsModule(pluginsService));
|
||||
modulesBuilder.add(
|
||||
(b) -> {
|
||||
b.bind(PluginsService.class).toInstance(pluginsService);
|
||||
b.bind(Environment.class).toInstance(new Environment(settings));
|
||||
b.bind(ThreadPool.class).toInstance(threadPool);
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue