From 4ab268bab2cfd7fc3cb4c4808f706d5049c1fae5 Mon Sep 17 00:00:00 2001 From: javanna Date: Wed, 10 Sep 2014 15:52:47 +0200 Subject: [PATCH] Internal: refactor copy headers mechanism to not require a client factory With #7594 we replaced the static `BaseRestHandler#addUsefulHeaders` by introducing the `RestClientFactory` that can be injected and used to register the relevant headers. To simplify things, we can now register relevant headers through the `RestController` and remove the `RestClientFactory` that was just introduced. Closes #7675 --- .../elasticsearch/rest/BaseRestHandler.java | 114 +++++++++++- .../elasticsearch/rest/RestClientFactory.java | 164 ------------------ .../elasticsearch/rest/RestController.java | 22 +++ .../health/RestClusterHealthAction.java | 4 +- .../hotthreads/RestNodesHotThreadsAction.java | 4 +- .../node/info/RestNodesInfoAction.java | 5 +- .../node/restart/RestNodesRestartAction.java | 4 +- .../shutdown/RestNodesShutdownAction.java | 4 +- .../node/stats/RestNodesStatsAction.java | 4 +- .../delete/RestDeleteRepositoryAction.java | 4 +- .../get/RestGetRepositoriesAction.java | 4 +- .../put/RestPutRepositoryAction.java | 4 +- .../reroute/RestClusterRerouteAction.java | 5 +- .../RestClusterGetSettingsAction.java | 4 +- .../RestClusterUpdateSettingsAction.java | 4 +- .../shards/RestClusterSearchShardsAction.java | 4 +- .../create/RestCreateSnapshotAction.java | 4 +- .../delete/RestDeleteSnapshotAction.java | 4 +- .../snapshots/get/RestGetSnapshotsAction.java | 4 +- .../restore/RestRestoreSnapshotAction.java | 4 +- .../status/RestSnapshotsStatusAction.java | 4 +- .../cluster/state/RestClusterStateAction.java | 5 +- .../cluster/stats/RestClusterStatsAction.java | 4 +- .../tasks/RestPendingClusterTasksAction.java | 4 +- .../alias/RestIndicesAliasesAction.java | 4 +- .../delete/RestIndexDeleteAliasesAction.java | 4 +- .../alias/get/RestGetAliasesAction.java | 4 +- .../get/RestGetIndicesAliasesAction.java | 4 +- .../alias/head/RestAliasesExistAction.java | 4 +- .../alias/put/RestIndexPutAliasAction.java | 4 +- .../indices/analyze/RestAnalyzeAction.java | 4 +- .../clear/RestClearIndicesCacheAction.java | 4 +- .../indices/close/RestCloseIndexAction.java | 4 +- .../indices/create/RestCreateIndexAction.java | 4 +- .../indices/delete/RestDeleteIndexAction.java | 4 +- .../indices/RestIndicesExistsAction.java | 10 +- .../exists/types/RestTypesExistsAction.java | 4 +- .../admin/indices/flush/RestFlushAction.java | 4 +- .../indices/get/RestGetIndicesAction.java | 4 +- .../delete/RestDeleteMappingAction.java | 4 +- .../get/RestGetFieldMappingAction.java | 4 +- .../mapping/get/RestGetMappingAction.java | 4 +- .../mapping/put/RestPutMappingAction.java | 4 +- .../indices/open/RestOpenIndexAction.java | 4 +- .../indices/optimize/RestOptimizeAction.java | 4 +- .../indices/recovery/RestRecoveryAction.java | 4 +- .../indices/refresh/RestRefreshAction.java | 4 +- .../segments/RestIndicesSegmentsAction.java | 4 +- .../settings/RestGetSettingsAction.java | 4 +- .../settings/RestUpdateSettingsAction.java | 4 +- .../indices/stats/RestIndicesStatsAction.java | 4 +- .../delete/RestDeleteIndexTemplateAction.java | 4 +- .../get/RestGetIndexTemplateAction.java | 4 +- .../head/RestHeadIndexTemplateAction.java | 4 +- .../put/RestPutIndexTemplateAction.java | 4 +- .../query/RestValidateQueryAction.java | 4 +- .../warmer/delete/RestDeleteWarmerAction.java | 4 +- .../warmer/get/RestGetWarmerAction.java | 4 +- .../warmer/put/RestPutWarmerAction.java | 4 +- .../rest/action/bench/RestBenchAction.java | 4 +- .../rest/action/bulk/RestBulkAction.java | 4 +- .../rest/action/cat/AbstractCatAction.java | 4 +- .../rest/action/cat/RestAliasAction.java | 4 +- .../rest/action/cat/RestAllocationAction.java | 4 +- .../rest/action/cat/RestCatAction.java | 4 +- .../rest/action/cat/RestCountAction.java | 4 +- .../rest/action/cat/RestFielddataAction.java | 4 +- .../rest/action/cat/RestHealthAction.java | 4 +- .../rest/action/cat/RestIndicesAction.java | 4 +- .../rest/action/cat/RestMasterAction.java | 4 +- .../rest/action/cat/RestNodesAction.java | 4 +- .../cat/RestPendingClusterTasksAction.java | 4 +- .../rest/action/cat/RestPluginsAction.java | 4 +- .../rest/action/cat/RestRecoveryAction.java | 4 +- .../rest/action/cat/RestSegmentsAction.java | 4 +- .../rest/action/cat/RestShardsAction.java | 4 +- .../rest/action/cat/RestThreadPoolAction.java | 4 +- .../rest/action/count/RestCountAction.java | 4 +- .../rest/action/delete/RestDeleteAction.java | 4 +- .../RestDeleteByQueryAction.java | 4 +- .../rest/action/exists/RestExistsAction.java | 4 +- .../action/explain/RestExplainAction.java | 4 +- .../rest/action/get/RestGetAction.java | 4 +- .../rest/action/get/RestGetSourceAction.java | 4 +- .../rest/action/get/RestHeadAction.java | 4 +- .../rest/action/get/RestMultiGetAction.java | 4 +- .../rest/action/index/RestIndexAction.java | 10 +- .../rest/action/main/RestMainAction.java | 4 +- .../action/mlt/RestMoreLikeThisAction.java | 4 +- .../percolate/RestMultiPercolateAction.java | 4 +- .../action/percolate/RestPercolateAction.java | 22 +-- .../script/RestDeleteIndexedScriptAction.java | 12 +- .../script/RestGetIndexedScriptAction.java | 12 +- .../script/RestPutIndexedScriptAction.java | 25 +-- .../action/search/RestClearScrollAction.java | 4 +- .../action/search/RestMultiSearchAction.java | 4 +- .../rest/action/search/RestSearchAction.java | 6 +- .../action/search/RestSearchScrollAction.java | 4 +- .../action/suggest/RestSuggestAction.java | 4 +- .../RestDeleteSearchTemplateAction.java | 6 +- .../template/RestGetSearchTemplateAction.java | 6 +- .../template/RestPutSearchTemplateAction.java | 12 +- .../RestMultiTermVectorsAction.java | 4 +- .../termvector/RestTermVectorAction.java | 4 +- .../rest/action/update/RestUpdateAction.java | 4 +- .../TestResponseHeaderRestAction.java | 4 +- .../HeadersAndContextCopyClientTests.java | 12 +- 107 files changed, 384 insertions(+), 424 deletions(-) delete mode 100644 src/main/java/org/elasticsearch/rest/RestClientFactory.java diff --git a/src/main/java/org/elasticsearch/rest/BaseRestHandler.java b/src/main/java/org/elasticsearch/rest/BaseRestHandler.java index 0971dce5094..9b83c2648b3 100644 --- a/src/main/java/org/elasticsearch/rest/BaseRestHandler.java +++ b/src/main/java/org/elasticsearch/rest/BaseRestHandler.java @@ -19,31 +19,135 @@ package org.elasticsearch.rest; +import org.elasticsearch.action.*; import org.elasticsearch.client.Client; +import org.elasticsearch.client.ClusterAdminClient; +import org.elasticsearch.client.FilterClient; +import org.elasticsearch.client.IndicesAdminClient; import org.elasticsearch.common.component.AbstractComponent; import org.elasticsearch.common.settings.Settings; +import java.util.Set; + /** * Base handler for REST requests. * * This handler makes sure that the headers & context of the handled {@link RestRequest requests} are copied over to * the transport requests executed by the associated client. While the context is fully copied over, not all the headers * are copied, but a selected few. It is possible to control what headers are copied over by registering them using - * {@link RestClientFactory#addRelevantHeaders(String...)} + * {@link org.elasticsearch.rest.RestController#registerRelevantHeaders(String...)} */ public abstract class BaseRestHandler extends AbstractComponent implements RestHandler { - private final RestClientFactory restClientFactory; + private final RestController controller; + private final Client client; - protected BaseRestHandler(Settings settings, RestClientFactory restClientFactory) { + protected BaseRestHandler(Settings settings, RestController controller, Client client) { super(settings); - this.restClientFactory = restClientFactory; + this.controller = controller; + this.client = client; } @Override public final void handleRequest(RestRequest request, RestChannel channel) throws Exception { - handleRequest(request, channel, restClientFactory.client(request)); + handleRequest(request, channel, new HeadersAndContextCopyClient(client, request, controller.relevantHeaders())); } protected abstract void handleRequest(RestRequest request, RestChannel channel, Client client) throws Exception; + + static final class HeadersAndContextCopyClient extends FilterClient { + + private final RestRequest restRequest; + private final IndicesAdmin indicesAdmin; + private final ClusterAdmin clusterAdmin; + private final Set headers; + + HeadersAndContextCopyClient(Client in, RestRequest restRequest, Set headers) { + super(in); + this.restRequest = restRequest; + this.indicesAdmin = new IndicesAdmin(in.admin().indices(), restRequest, headers); + this.clusterAdmin = new ClusterAdmin(in.admin().cluster(), restRequest, headers); + this.headers = headers; + } + + private static void copyHeadersAndContext(ActionRequest actionRequest, RestRequest restRequest, Set headers) { + for (String usefulHeader : headers) { + String headerValue = restRequest.header(usefulHeader); + if (headerValue != null) { + actionRequest.putHeader(usefulHeader, headerValue); + } + } + actionRequest.copyContextFrom(restRequest); + } + + @Override + public > ActionFuture execute(Action action, Request request) { + copyHeadersAndContext(request, restRequest, headers); + return super.execute(action, request); + } + + @Override + public > void execute(Action action, Request request, ActionListener listener) { + copyHeadersAndContext(request, restRequest, headers); + super.execute(action, request, listener); + } + + @Override + public ClusterAdminClient cluster() { + return clusterAdmin; + } + + @Override + public IndicesAdminClient indices() { + return indicesAdmin; + } + + private static final class ClusterAdmin extends FilterClient.ClusterAdmin { + + private final RestRequest restRequest; + private final Set headers; + + private ClusterAdmin(ClusterAdminClient in, RestRequest restRequest, Set headers) { + super(in); + this.restRequest = restRequest; + this.headers = headers; + } + + @Override + public > ActionFuture execute(Action action, Request request) { + copyHeadersAndContext(request, restRequest, headers); + return super.execute(action, request); + } + + @Override + public > void execute(Action action, Request request, ActionListener listener) { + copyHeadersAndContext(request, restRequest, headers); + super.execute(action, request, listener); + } + } + + private final class IndicesAdmin extends FilterClient.IndicesAdmin { + + private final RestRequest restRequest; + private final Set headers; + + private IndicesAdmin(IndicesAdminClient in, RestRequest restRequest, Set headers) { + super(in); + this.restRequest = restRequest; + this.headers = headers; + } + + @Override + public > ActionFuture execute(Action action, Request request) { + copyHeadersAndContext(request, restRequest, headers); + return super.execute(action, request); + } + + @Override + public > void execute(Action action, Request request, ActionListener listener) { + copyHeadersAndContext(request, restRequest, headers); + super.execute(action, request, listener); + } + } + } } \ No newline at end of file diff --git a/src/main/java/org/elasticsearch/rest/RestClientFactory.java b/src/main/java/org/elasticsearch/rest/RestClientFactory.java deleted file mode 100644 index 792d307afc4..00000000000 --- a/src/main/java/org/elasticsearch/rest/RestClientFactory.java +++ /dev/null @@ -1,164 +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.rest; - -import com.google.common.collect.Sets; -import org.elasticsearch.action.*; -import org.elasticsearch.client.Client; -import org.elasticsearch.client.ClusterAdminClient; -import org.elasticsearch.client.FilterClient; -import org.elasticsearch.client.IndicesAdminClient; -import org.elasticsearch.common.inject.Inject; - -import java.util.Collections; -import java.util.Set; - -/** - * Client factory that returns a proper {@link Client} given a {@link org.elasticsearch.rest.RestRequest}. - * Makes it possible to register useful headers that will be copied over from REST requests - * to corresponding transport requests at execution time. - */ -public final class RestClientFactory { - - private Set relevantHeaders = Sets.newCopyOnWriteArraySet(); - private final Client client; - - @Inject - public RestClientFactory(Client client) { - this.client = client; - } - - /** - * Returns a proper {@link Client client} given the provided {@link org.elasticsearch.rest.RestRequest} - */ - public Client client(RestRequest restRequest) { - return relevantHeaders.size() == 0 ? client : new HeadersAndContextCopyClient(client, restRequest, relevantHeaders); - } - - /** - * Controls which REST headers get copied over from a {@link org.elasticsearch.rest.RestRequest} to - * its corresponding {@link org.elasticsearch.transport.TransportRequest}(s). - * - * By default no headers get copied but it is possible to extend this behaviour via plugins by calling this method. - */ - public void addRelevantHeaders(String... headers) { - Collections.addAll(relevantHeaders, headers); - } - - Set relevantHeaders() { - return relevantHeaders; - } - - static final class HeadersAndContextCopyClient extends FilterClient { - - private final RestRequest restRequest; - private final IndicesAdmin indicesAdmin; - private final ClusterAdmin clusterAdmin; - private final Set headers; - - HeadersAndContextCopyClient(Client in, RestRequest restRequest, Set headers) { - super(in); - this.restRequest = restRequest; - this.indicesAdmin = new IndicesAdmin(in.admin().indices(), restRequest, headers); - this.clusterAdmin = new ClusterAdmin(in.admin().cluster(), restRequest, headers); - this.headers = headers; - } - - private static void copyHeadersAndContext(ActionRequest actionRequest, RestRequest restRequest, Set headers) { - for (String usefulHeader : headers) { - String headerValue = restRequest.header(usefulHeader); - if (headerValue != null) { - actionRequest.putHeader(usefulHeader, headerValue); - } - } - actionRequest.copyContextFrom(restRequest); - } - - @Override - public > ActionFuture execute(Action action, Request request) { - copyHeadersAndContext(request, restRequest, headers); - return super.execute(action, request); - } - - @Override - public > void execute(Action action, Request request, ActionListener listener) { - copyHeadersAndContext(request, restRequest, headers); - super.execute(action, request, listener); - } - - @Override - public ClusterAdminClient cluster() { - return clusterAdmin; - } - - @Override - public IndicesAdminClient indices() { - return indicesAdmin; - } - - private static final class ClusterAdmin extends FilterClient.ClusterAdmin { - - private final RestRequest restRequest; - private final Set headers; - - private ClusterAdmin(ClusterAdminClient in, RestRequest restRequest, Set headers) { - super(in); - this.restRequest = restRequest; - this.headers = headers; - } - - @Override - public > ActionFuture execute(Action action, Request request) { - copyHeadersAndContext(request, restRequest, headers); - return super.execute(action, request); - } - - @Override - public > void execute(Action action, Request request, ActionListener listener) { - copyHeadersAndContext(request, restRequest, headers); - super.execute(action, request, listener); - } - } - - private final class IndicesAdmin extends FilterClient.IndicesAdmin { - - private final RestRequest restRequest; - private final Set headers; - - private IndicesAdmin(IndicesAdminClient in, RestRequest restRequest, Set headers) { - super(in); - this.restRequest = restRequest; - this.headers = headers; - } - - @Override - public > ActionFuture execute(Action action, Request request) { - copyHeadersAndContext(request, restRequest, headers); - return super.execute(action, request); - } - - @Override - public > void execute(Action action, Request request, ActionListener listener) { - copyHeadersAndContext(request, restRequest, headers); - super.execute(action, request, listener); - } - } - } -} diff --git a/src/main/java/org/elasticsearch/rest/RestController.java b/src/main/java/org/elasticsearch/rest/RestController.java index 6dcb72c37d3..fb01e241cc5 100644 --- a/src/main/java/org/elasticsearch/rest/RestController.java +++ b/src/main/java/org/elasticsearch/rest/RestController.java @@ -19,6 +19,7 @@ package org.elasticsearch.rest; +import com.google.common.collect.ImmutableSet; import org.elasticsearch.ElasticsearchException; import org.elasticsearch.ElasticsearchIllegalArgumentException; import org.elasticsearch.ElasticsearchIllegalStateException; @@ -44,6 +45,8 @@ public class RestController extends AbstractLifecycleComponent { public static final String HTTP_JSON_ENABLE = "http.jsonp.enable"; + private ImmutableSet relevantHeaders = ImmutableSet.of(); + private final PathTrie getHandlers = new PathTrie<>(RestUtils.REST_DECODER); private final PathTrie postHandlers = new PathTrie<>(RestUtils.REST_DECODER); private final PathTrie putHandlers = new PathTrie<>(RestUtils.REST_DECODER); @@ -76,6 +79,25 @@ public class RestController extends AbstractLifecycleComponent { } } + /** + * Controls which REST headers get copied over from a {@link org.elasticsearch.rest.RestRequest} to + * its corresponding {@link org.elasticsearch.transport.TransportRequest}(s). + * + * By default no headers get copied but it is possible to extend this behaviour via plugins by calling this method. + */ + public synchronized void registerRelevantHeaders(String... headers) { + relevantHeaders = new ImmutableSet.Builder().addAll(relevantHeaders).add(headers).build(); + } + + /** + * Returns the REST headers that get copied over from a {@link org.elasticsearch.rest.RestRequest} to + * its corresponding {@link org.elasticsearch.transport.TransportRequest}(s). + * By default no headers get copied but it is possible to extend this behaviour via plugins by calling {@link #registerRelevantHeaders(String...)}. + */ + public ImmutableSet relevantHeaders() { + return relevantHeaders; + } + /** * Registers a pre processor to be executed before the rest request is actually handled. */ diff --git a/src/main/java/org/elasticsearch/rest/action/admin/cluster/health/RestClusterHealthAction.java b/src/main/java/org/elasticsearch/rest/action/admin/cluster/health/RestClusterHealthAction.java index 69658989808..b080e51055d 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/cluster/health/RestClusterHealthAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/cluster/health/RestClusterHealthAction.java @@ -39,8 +39,8 @@ import static org.elasticsearch.client.Requests.clusterHealthRequest; public class RestClusterHealthAction extends BaseRestHandler { @Inject - public RestClusterHealthAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestClusterHealthAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(RestRequest.Method.GET, "/_cluster/health", this); controller.registerHandler(RestRequest.Method.GET, "/_cluster/health/{index}", this); diff --git a/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/hotthreads/RestNodesHotThreadsAction.java b/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/hotthreads/RestNodesHotThreadsAction.java index b8d12378e95..ee27b974657 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/hotthreads/RestNodesHotThreadsAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/hotthreads/RestNodesHotThreadsAction.java @@ -36,8 +36,8 @@ import org.elasticsearch.rest.action.support.RestResponseListener; public class RestNodesHotThreadsAction extends BaseRestHandler { @Inject - public RestNodesHotThreadsAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestNodesHotThreadsAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(RestRequest.Method.GET, "/_cluster/nodes/hotthreads", this); controller.registerHandler(RestRequest.Method.GET, "/_cluster/nodes/hot_threads", this); controller.registerHandler(RestRequest.Method.GET, "/_cluster/nodes/{nodeId}/hotthreads", this); diff --git a/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/info/RestNodesInfoAction.java b/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/info/RestNodesInfoAction.java index 26cba6d6f22..e058f2cf216 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/info/RestNodesInfoAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/info/RestNodesInfoAction.java @@ -45,9 +45,8 @@ public class RestNodesInfoAction extends BaseRestHandler { private final static Set ALLOWED_METRICS = Sets.newHashSet("http", "jvm", "network", "os", "plugins", "process", "settings", "thread_pool", "transport"); @Inject - public RestNodesInfoAction(Settings settings, RestController controller, - SettingsFilter settingsFilter, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestNodesInfoAction(Settings settings, RestController controller, Client client, SettingsFilter settingsFilter) { + super(settings, controller, client); controller.registerHandler(GET, "/_nodes", this); // this endpoint is used for metrics, not for nodeIds, like /_nodes/fs controller.registerHandler(GET, "/_nodes/{nodeId}", this); diff --git a/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/restart/RestNodesRestartAction.java b/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/restart/RestNodesRestartAction.java index 9b088f94ff0..524412270b1 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/restart/RestNodesRestartAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/restart/RestNodesRestartAction.java @@ -35,8 +35,8 @@ import org.elasticsearch.rest.action.support.RestBuilderListener; public class RestNodesRestartAction extends BaseRestHandler { @Inject - public RestNodesRestartAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestNodesRestartAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(RestRequest.Method.POST, "/_cluster/nodes/_restart", this); controller.registerHandler(RestRequest.Method.POST, "/_cluster/nodes/{nodeId}/_restart", this); diff --git a/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/shutdown/RestNodesShutdownAction.java b/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/shutdown/RestNodesShutdownAction.java index a65ff5ba5c3..950ce9083af 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/shutdown/RestNodesShutdownAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/shutdown/RestNodesShutdownAction.java @@ -36,8 +36,8 @@ import org.elasticsearch.rest.action.support.RestBuilderListener; public class RestNodesShutdownAction extends BaseRestHandler { @Inject - public RestNodesShutdownAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestNodesShutdownAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(RestRequest.Method.POST, "/_shutdown", this); controller.registerHandler(RestRequest.Method.POST, "/_cluster/nodes/_shutdown", this); diff --git a/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/stats/RestNodesStatsAction.java b/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/stats/RestNodesStatsAction.java index e9e1f0e7bdd..4704d8ee832 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/stats/RestNodesStatsAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/stats/RestNodesStatsAction.java @@ -41,8 +41,8 @@ import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestNodesStatsAction extends BaseRestHandler { @Inject - public RestNodesStatsAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestNodesStatsAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(GET, "/_nodes/stats", this); controller.registerHandler(GET, "/_nodes/{nodeId}/stats", this); diff --git a/src/main/java/org/elasticsearch/rest/action/admin/cluster/repositories/delete/RestDeleteRepositoryAction.java b/src/main/java/org/elasticsearch/rest/action/admin/cluster/repositories/delete/RestDeleteRepositoryAction.java index 06251b341b8..46c06ecbe75 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/cluster/repositories/delete/RestDeleteRepositoryAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/cluster/repositories/delete/RestDeleteRepositoryAction.java @@ -36,8 +36,8 @@ import static org.elasticsearch.rest.RestRequest.Method.DELETE; public class RestDeleteRepositoryAction extends BaseRestHandler { @Inject - public RestDeleteRepositoryAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestDeleteRepositoryAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(DELETE, "/_snapshot/{repository}", this); } diff --git a/src/main/java/org/elasticsearch/rest/action/admin/cluster/repositories/get/RestGetRepositoriesAction.java b/src/main/java/org/elasticsearch/rest/action/admin/cluster/repositories/get/RestGetRepositoriesAction.java index 78f75a0c2e4..be4e1b4e3f3 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/cluster/repositories/get/RestGetRepositoriesAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/cluster/repositories/get/RestGetRepositoriesAction.java @@ -41,8 +41,8 @@ import static org.elasticsearch.rest.RestStatus.OK; public class RestGetRepositoriesAction extends BaseRestHandler { @Inject - public RestGetRepositoriesAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestGetRepositoriesAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(GET, "/_snapshot", this); controller.registerHandler(GET, "/_snapshot/{repository}", this); } diff --git a/src/main/java/org/elasticsearch/rest/action/admin/cluster/repositories/put/RestPutRepositoryAction.java b/src/main/java/org/elasticsearch/rest/action/admin/cluster/repositories/put/RestPutRepositoryAction.java index 5ee911f01b2..4177913830f 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/cluster/repositories/put/RestPutRepositoryAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/cluster/repositories/put/RestPutRepositoryAction.java @@ -37,8 +37,8 @@ import static org.elasticsearch.rest.RestRequest.Method.PUT; public class RestPutRepositoryAction extends BaseRestHandler { @Inject - public RestPutRepositoryAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestPutRepositoryAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(PUT, "/_snapshot/{repository}", this); controller.registerHandler(POST, "/_snapshot/{repository}", this); } diff --git a/src/main/java/org/elasticsearch/rest/action/admin/cluster/reroute/RestClusterRerouteAction.java b/src/main/java/org/elasticsearch/rest/action/admin/cluster/reroute/RestClusterRerouteAction.java index 5466f01d644..43f35a7d6b9 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/cluster/reroute/RestClusterRerouteAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/cluster/reroute/RestClusterRerouteAction.java @@ -45,9 +45,8 @@ public class RestClusterRerouteAction extends BaseRestHandler { private static String DEFAULT_METRICS = Strings.arrayToCommaDelimitedString(EnumSet.complementOf(EnumSet.of(ClusterState.Metric.METADATA)).toArray()); @Inject - public RestClusterRerouteAction(Settings settings, RestController controller, - SettingsFilter settingsFilter, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestClusterRerouteAction(Settings settings, RestController controller, Client client, SettingsFilter settingsFilter) { + super(settings, controller, client); this.settingsFilter = settingsFilter; controller.registerHandler(RestRequest.Method.POST, "/_cluster/reroute", this); } diff --git a/src/main/java/org/elasticsearch/rest/action/admin/cluster/settings/RestClusterGetSettingsAction.java b/src/main/java/org/elasticsearch/rest/action/admin/cluster/settings/RestClusterGetSettingsAction.java index 9c4b300df95..5ef9c403ac2 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/cluster/settings/RestClusterGetSettingsAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/cluster/settings/RestClusterGetSettingsAction.java @@ -34,8 +34,8 @@ import org.elasticsearch.rest.action.support.RestBuilderListener; public class RestClusterGetSettingsAction extends BaseRestHandler { @Inject - public RestClusterGetSettingsAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestClusterGetSettingsAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(RestRequest.Method.GET, "/_cluster/settings", this); } diff --git a/src/main/java/org/elasticsearch/rest/action/admin/cluster/settings/RestClusterUpdateSettingsAction.java b/src/main/java/org/elasticsearch/rest/action/admin/cluster/settings/RestClusterUpdateSettingsAction.java index 1635f1f04a0..87363d386ef 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/cluster/settings/RestClusterUpdateSettingsAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/cluster/settings/RestClusterUpdateSettingsAction.java @@ -38,8 +38,8 @@ import java.util.Map; public class RestClusterUpdateSettingsAction extends BaseRestHandler { @Inject - public RestClusterUpdateSettingsAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestClusterUpdateSettingsAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(RestRequest.Method.PUT, "/_cluster/settings", this); } diff --git a/src/main/java/org/elasticsearch/rest/action/admin/cluster/shards/RestClusterSearchShardsAction.java b/src/main/java/org/elasticsearch/rest/action/admin/cluster/shards/RestClusterSearchShardsAction.java index b24f42dd736..22151e7b0ad 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/cluster/shards/RestClusterSearchShardsAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/cluster/shards/RestClusterSearchShardsAction.java @@ -38,8 +38,8 @@ import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestClusterSearchShardsAction extends BaseRestHandler { @Inject - public RestClusterSearchShardsAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestClusterSearchShardsAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(GET, "/_search_shards", this); controller.registerHandler(POST, "/_search_shards", this); controller.registerHandler(GET, "/{index}/_search_shards", this); diff --git a/src/main/java/org/elasticsearch/rest/action/admin/cluster/snapshots/create/RestCreateSnapshotAction.java b/src/main/java/org/elasticsearch/rest/action/admin/cluster/snapshots/create/RestCreateSnapshotAction.java index a79b2fa330e..ff71f7e60f9 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/cluster/snapshots/create/RestCreateSnapshotAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/cluster/snapshots/create/RestCreateSnapshotAction.java @@ -37,8 +37,8 @@ import static org.elasticsearch.rest.RestRequest.Method.PUT; public class RestCreateSnapshotAction extends BaseRestHandler { @Inject - public RestCreateSnapshotAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestCreateSnapshotAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(PUT, "/_snapshot/{repository}/{snapshot}", this); controller.registerHandler(POST, "/_snapshot/{repository}/{snapshot}/_create", this); } diff --git a/src/main/java/org/elasticsearch/rest/action/admin/cluster/snapshots/delete/RestDeleteSnapshotAction.java b/src/main/java/org/elasticsearch/rest/action/admin/cluster/snapshots/delete/RestDeleteSnapshotAction.java index 21fb186867b..7e88817ff7f 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/cluster/snapshots/delete/RestDeleteSnapshotAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/cluster/snapshots/delete/RestDeleteSnapshotAction.java @@ -36,8 +36,8 @@ import static org.elasticsearch.rest.RestRequest.Method.DELETE; public class RestDeleteSnapshotAction extends BaseRestHandler { @Inject - public RestDeleteSnapshotAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestDeleteSnapshotAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(DELETE, "/_snapshot/{repository}/{snapshot}", this); } diff --git a/src/main/java/org/elasticsearch/rest/action/admin/cluster/snapshots/get/RestGetSnapshotsAction.java b/src/main/java/org/elasticsearch/rest/action/admin/cluster/snapshots/get/RestGetSnapshotsAction.java index c0ccf001505..06ad133fefb 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/cluster/snapshots/get/RestGetSnapshotsAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/cluster/snapshots/get/RestGetSnapshotsAction.java @@ -37,8 +37,8 @@ import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestGetSnapshotsAction extends BaseRestHandler { @Inject - public RestGetSnapshotsAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestGetSnapshotsAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(GET, "/_snapshot/{repository}/{snapshot}", this); } diff --git a/src/main/java/org/elasticsearch/rest/action/admin/cluster/snapshots/restore/RestRestoreSnapshotAction.java b/src/main/java/org/elasticsearch/rest/action/admin/cluster/snapshots/restore/RestRestoreSnapshotAction.java index 9428acfe07f..4dc2eed7794 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/cluster/snapshots/restore/RestRestoreSnapshotAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/cluster/snapshots/restore/RestRestoreSnapshotAction.java @@ -36,8 +36,8 @@ import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestRestoreSnapshotAction extends BaseRestHandler { @Inject - public RestRestoreSnapshotAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestRestoreSnapshotAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(POST, "/_snapshot/{repository}/{snapshot}/_restore", this); } diff --git a/src/main/java/org/elasticsearch/rest/action/admin/cluster/snapshots/status/RestSnapshotsStatusAction.java b/src/main/java/org/elasticsearch/rest/action/admin/cluster/snapshots/status/RestSnapshotsStatusAction.java index 1749823e542..f22300432a5 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/cluster/snapshots/status/RestSnapshotsStatusAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/cluster/snapshots/status/RestSnapshotsStatusAction.java @@ -37,8 +37,8 @@ import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestSnapshotsStatusAction extends BaseRestHandler { @Inject - public RestSnapshotsStatusAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestSnapshotsStatusAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(GET, "/_snapshot/{repository}/{snapshot}/_status", this); controller.registerHandler(GET, "/_snapshot/{repository}/_status", this); controller.registerHandler(GET, "/_snapshot/_status", this); diff --git a/src/main/java/org/elasticsearch/rest/action/admin/cluster/state/RestClusterStateAction.java b/src/main/java/org/elasticsearch/rest/action/admin/cluster/state/RestClusterStateAction.java index 7644612ba4a..ff3218f2039 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/cluster/state/RestClusterStateAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/cluster/state/RestClusterStateAction.java @@ -44,9 +44,8 @@ public class RestClusterStateAction extends BaseRestHandler { private final SettingsFilter settingsFilter; @Inject - public RestClusterStateAction(Settings settings, RestController controller, - SettingsFilter settingsFilter, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestClusterStateAction(Settings settings, RestController controller, Client client, SettingsFilter settingsFilter) { + super(settings, controller, client); controller.registerHandler(RestRequest.Method.GET, "/_cluster/state", this); controller.registerHandler(RestRequest.Method.GET, "/_cluster/state/{metric}", this); controller.registerHandler(RestRequest.Method.GET, "/_cluster/state/{metric}/{indices}", this); diff --git a/src/main/java/org/elasticsearch/rest/action/admin/cluster/stats/RestClusterStatsAction.java b/src/main/java/org/elasticsearch/rest/action/admin/cluster/stats/RestClusterStatsAction.java index 7e31cf50fbc..5dd1c638b83 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/cluster/stats/RestClusterStatsAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/cluster/stats/RestClusterStatsAction.java @@ -34,8 +34,8 @@ import org.elasticsearch.rest.action.support.RestToXContentListener; public class RestClusterStatsAction extends BaseRestHandler { @Inject - public RestClusterStatsAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestClusterStatsAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(RestRequest.Method.GET, "/_cluster/stats", this); controller.registerHandler(RestRequest.Method.GET, "/_cluster/stats/nodes/{nodeId}", this); } diff --git a/src/main/java/org/elasticsearch/rest/action/admin/cluster/tasks/RestPendingClusterTasksAction.java b/src/main/java/org/elasticsearch/rest/action/admin/cluster/tasks/RestPendingClusterTasksAction.java index 529ac5a497b..0277a084619 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/cluster/tasks/RestPendingClusterTasksAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/cluster/tasks/RestPendingClusterTasksAction.java @@ -32,8 +32,8 @@ import org.elasticsearch.rest.action.support.RestToXContentListener; public class RestPendingClusterTasksAction extends BaseRestHandler { @Inject - public RestPendingClusterTasksAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestPendingClusterTasksAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(RestRequest.Method.GET, "/_cluster/pending_tasks", this); } diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/RestIndicesAliasesAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/RestIndicesAliasesAction.java index 859cd4c10de..423d1c0f73b 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/RestIndicesAliasesAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/RestIndicesAliasesAction.java @@ -42,8 +42,8 @@ import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestIndicesAliasesAction extends BaseRestHandler { @Inject - public RestIndicesAliasesAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestIndicesAliasesAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(POST, "/_aliases", this); } diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/delete/RestIndexDeleteAliasesAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/delete/RestIndexDeleteAliasesAction.java index 1f8658e4028..b9102a0048f 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/delete/RestIndexDeleteAliasesAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/delete/RestIndexDeleteAliasesAction.java @@ -34,8 +34,8 @@ import static org.elasticsearch.rest.RestRequest.Method.DELETE; public class RestIndexDeleteAliasesAction extends BaseRestHandler { @Inject - public RestIndexDeleteAliasesAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestIndexDeleteAliasesAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(DELETE, "/{index}/_alias/{name}", this); controller.registerHandler(DELETE, "/{index}/_aliases/{name}", this); } diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/get/RestGetAliasesAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/get/RestGetAliasesAction.java index 3bd8e858c51..4a1b0bf938b 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/get/RestGetAliasesAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/get/RestGetAliasesAction.java @@ -45,8 +45,8 @@ import static org.elasticsearch.rest.RestStatus.OK; public class RestGetAliasesAction extends BaseRestHandler { @Inject - public RestGetAliasesAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestGetAliasesAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(GET, "/_alias/{name}", this); controller.registerHandler(GET, "/{index}/_alias/{name}", this); } diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/get/RestGetIndicesAliasesAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/get/RestGetIndicesAliasesAction.java index 3c8acbe6913..060ec3f3012 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/get/RestGetIndicesAliasesAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/get/RestGetIndicesAliasesAction.java @@ -45,8 +45,8 @@ import static org.elasticsearch.rest.RestStatus.OK; public class RestGetIndicesAliasesAction extends BaseRestHandler { @Inject - public RestGetIndicesAliasesAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestGetIndicesAliasesAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(GET, "/{index}/_aliases/{name}", this); controller.registerHandler(GET, "/_aliases/{name}", this); } diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/head/RestAliasesExistAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/head/RestAliasesExistAction.java index 4d76d5c85ec..93342fbf0ba 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/head/RestAliasesExistAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/head/RestAliasesExistAction.java @@ -39,8 +39,8 @@ import static org.elasticsearch.rest.RestStatus.OK; public class RestAliasesExistAction extends BaseRestHandler { @Inject - public RestAliasesExistAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestAliasesExistAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(HEAD, "/_alias/{name}", this); controller.registerHandler(HEAD, "/{index}/_alias/{name}", this); controller.registerHandler(HEAD, "/{index}/_alias", this); diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/put/RestIndexPutAliasAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/put/RestIndexPutAliasAction.java index d61798a3a6d..2dcaf976afc 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/put/RestIndexPutAliasAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/put/RestIndexPutAliasAction.java @@ -42,8 +42,8 @@ import static org.elasticsearch.rest.RestRequest.Method.PUT; public class RestIndexPutAliasAction extends BaseRestHandler { @Inject - public RestIndexPutAliasAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestIndexPutAliasAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(PUT, "/{index}/_alias/{name}", this); controller.registerHandler(PUT, "/_alias/{name}", this); controller.registerHandler(PUT, "/{index}/_aliases/{name}", this); diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/analyze/RestAnalyzeAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/analyze/RestAnalyzeAction.java index 0dd2b4af2d1..e573f5c86eb 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/analyze/RestAnalyzeAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/analyze/RestAnalyzeAction.java @@ -36,8 +36,8 @@ import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestAnalyzeAction extends BaseRestHandler { @Inject - public RestAnalyzeAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestAnalyzeAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(GET, "/_analyze", this); controller.registerHandler(GET, "/{index}/_analyze", this); controller.registerHandler(POST, "/_analyze", this); diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/cache/clear/RestClearIndicesCacheAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/cache/clear/RestClearIndicesCacheAction.java index 3adcc0b3c08..8bd49e39d63 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/cache/clear/RestClearIndicesCacheAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/cache/clear/RestClearIndicesCacheAction.java @@ -44,8 +44,8 @@ import static org.elasticsearch.rest.action.support.RestActions.buildBroadcastSh public class RestClearIndicesCacheAction extends BaseRestHandler { @Inject - public RestClearIndicesCacheAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestClearIndicesCacheAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(POST, "/_cache/clear", this); controller.registerHandler(POST, "/{index}/_cache/clear", this); diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/close/RestCloseIndexAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/close/RestCloseIndexAction.java index 5ad14f89e8a..03b5a8c542f 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/close/RestCloseIndexAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/close/RestCloseIndexAction.java @@ -35,8 +35,8 @@ import org.elasticsearch.rest.action.support.AcknowledgedRestListener; public class RestCloseIndexAction extends BaseRestHandler { @Inject - public RestCloseIndexAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestCloseIndexAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(RestRequest.Method.POST, "/_close", this); controller.registerHandler(RestRequest.Method.POST, "/{index}/_close", this); } diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/create/RestCreateIndexAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/create/RestCreateIndexAction.java index b20da9cd68b..2fca3ff6a27 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/create/RestCreateIndexAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/create/RestCreateIndexAction.java @@ -33,8 +33,8 @@ import org.elasticsearch.rest.action.support.AcknowledgedRestListener; public class RestCreateIndexAction extends BaseRestHandler { @Inject - public RestCreateIndexAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestCreateIndexAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(RestRequest.Method.PUT, "/{index}", this); controller.registerHandler(RestRequest.Method.POST, "/{index}", this); } diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/delete/RestDeleteIndexAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/delete/RestDeleteIndexAction.java index adeef670ce0..126c471578e 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/delete/RestDeleteIndexAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/delete/RestDeleteIndexAction.java @@ -35,8 +35,8 @@ import org.elasticsearch.rest.action.support.AcknowledgedRestListener; public class RestDeleteIndexAction extends BaseRestHandler { @Inject - public RestDeleteIndexAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestDeleteIndexAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(RestRequest.Method.DELETE, "/", this); controller.registerHandler(RestRequest.Method.DELETE, "/{index}", this); } diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/exists/indices/RestIndicesExistsAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/exists/indices/RestIndicesExistsAction.java index 8d1355bb5e8..a0cf436a468 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/exists/indices/RestIndicesExistsAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/exists/indices/RestIndicesExistsAction.java @@ -26,7 +26,6 @@ import org.elasticsearch.client.Client; import org.elasticsearch.common.Strings; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.settings.SettingsFilter; import org.elasticsearch.rest.*; import org.elasticsearch.rest.action.support.RestResponseListener; @@ -39,15 +38,10 @@ import static org.elasticsearch.rest.RestStatus.OK; */ public class RestIndicesExistsAction extends BaseRestHandler { - private final SettingsFilter settingsFilter; - @Inject - public RestIndicesExistsAction(Settings settings, RestController controller, - SettingsFilter settingsFilter, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestIndicesExistsAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(HEAD, "/{index}", this); - - this.settingsFilter = settingsFilter; } @Override diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/exists/types/RestTypesExistsAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/exists/types/RestTypesExistsAction.java index c5fd7107ba4..c5571313a2f 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/exists/types/RestTypesExistsAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/exists/types/RestTypesExistsAction.java @@ -38,8 +38,8 @@ import static org.elasticsearch.rest.RestStatus.OK; public class RestTypesExistsAction extends BaseRestHandler { @Inject - public RestTypesExistsAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestTypesExistsAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(HEAD, "/{index}/{type}", this); } diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/flush/RestFlushAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/flush/RestFlushAction.java index a81ba7125e8..c4fb3679340 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/flush/RestFlushAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/flush/RestFlushAction.java @@ -41,8 +41,8 @@ import static org.elasticsearch.rest.action.support.RestActions.buildBroadcastSh public class RestFlushAction extends BaseRestHandler { @Inject - public RestFlushAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestFlushAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(POST, "/_flush", this); controller.registerHandler(POST, "/{index}/_flush", this); diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/get/RestGetIndicesAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/get/RestGetIndicesAction.java index 9ad2bd6c9b0..fbbf9942cec 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/get/RestGetIndicesAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/get/RestGetIndicesAction.java @@ -49,8 +49,8 @@ import static org.elasticsearch.rest.RestStatus.OK; public class RestGetIndicesAction extends BaseRestHandler { @Inject - public RestGetIndicesAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestGetIndicesAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(GET, "/{index}", this); controller.registerHandler(GET, "/{index}/{type}", this); } diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/delete/RestDeleteMappingAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/delete/RestDeleteMappingAction.java index 3b272f3b2c6..db1382d1d70 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/delete/RestDeleteMappingAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/delete/RestDeleteMappingAction.java @@ -38,8 +38,8 @@ import static org.elasticsearch.rest.RestRequest.Method.DELETE; public class RestDeleteMappingAction extends BaseRestHandler { @Inject - public RestDeleteMappingAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestDeleteMappingAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(DELETE, "/{index}/{type}/_mapping", this); controller.registerHandler(DELETE, "/{index}/{type}", this); controller.registerHandler(DELETE, "/{index}/_mapping/{type}", this); diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/get/RestGetFieldMappingAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/get/RestGetFieldMappingAction.java index 4771b91c6a8..8234153d4e7 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/get/RestGetFieldMappingAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/get/RestGetFieldMappingAction.java @@ -46,8 +46,8 @@ import static org.elasticsearch.rest.RestStatus.OK; public class RestGetFieldMappingAction extends BaseRestHandler { @Inject - public RestGetFieldMappingAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestGetFieldMappingAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(GET, "/_mapping/field/{fields}", this); controller.registerHandler(GET, "/_mapping/{type}/field/{fields}", this); controller.registerHandler(GET, "/{index}/_mapping/field/{fields}", this); diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/get/RestGetMappingAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/get/RestGetMappingAction.java index 2ce1a7232db..3e9b40027f4 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/get/RestGetMappingAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/get/RestGetMappingAction.java @@ -46,8 +46,8 @@ import static org.elasticsearch.rest.RestStatus.OK; public class RestGetMappingAction extends BaseRestHandler { @Inject - public RestGetMappingAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestGetMappingAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(GET, "/{index}/{type}/_mapping", this); controller.registerHandler(GET, "/{index}/_mappings/{type}", this); controller.registerHandler(GET, "/{index}/_mapping/{type}", this); diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/put/RestPutMappingAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/put/RestPutMappingAction.java index 4bf21a82fe6..d067ed96bd1 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/put/RestPutMappingAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/put/RestPutMappingAction.java @@ -40,8 +40,8 @@ public class RestPutMappingAction extends BaseRestHandler { @Inject - public RestPutMappingAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestPutMappingAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(PUT, "/{index}/_mapping/", this); controller.registerHandler(PUT, "/{index}/{type}/_mapping", this); controller.registerHandler(PUT, "/{index}/_mapping/{type}", this); diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/open/RestOpenIndexAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/open/RestOpenIndexAction.java index 81d1252f558..7ff9a8fb620 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/open/RestOpenIndexAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/open/RestOpenIndexAction.java @@ -35,8 +35,8 @@ import org.elasticsearch.rest.action.support.AcknowledgedRestListener; public class RestOpenIndexAction extends BaseRestHandler { @Inject - public RestOpenIndexAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestOpenIndexAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(RestRequest.Method.POST, "/_open", this); controller.registerHandler(RestRequest.Method.POST, "/{index}/_open", this); } diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/optimize/RestOptimizeAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/optimize/RestOptimizeAction.java index d016edfd46c..611f59fc4c5 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/optimize/RestOptimizeAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/optimize/RestOptimizeAction.java @@ -41,8 +41,8 @@ import static org.elasticsearch.rest.action.support.RestActions.buildBroadcastSh public class RestOptimizeAction extends BaseRestHandler { @Inject - public RestOptimizeAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestOptimizeAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(POST, "/_optimize", this); controller.registerHandler(POST, "/{index}/_optimize", this); diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/recovery/RestRecoveryAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/recovery/RestRecoveryAction.java index 38a3737868c..2abd624a3c4 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/recovery/RestRecoveryAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/recovery/RestRecoveryAction.java @@ -39,8 +39,8 @@ import static org.elasticsearch.rest.RestStatus.OK; public class RestRecoveryAction extends BaseRestHandler { @Inject - public RestRecoveryAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestRecoveryAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(GET, "/_recovery", this); controller.registerHandler(GET, "/{index}/_recovery", this); } diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/refresh/RestRefreshAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/refresh/RestRefreshAction.java index 958f9e38199..0f63e9df4e2 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/refresh/RestRefreshAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/refresh/RestRefreshAction.java @@ -41,8 +41,8 @@ import static org.elasticsearch.rest.action.support.RestActions.buildBroadcastSh public class RestRefreshAction extends BaseRestHandler { @Inject - public RestRefreshAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestRefreshAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(POST, "/_refresh", this); controller.registerHandler(POST, "/{index}/_refresh", this); diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/segments/RestIndicesSegmentsAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/segments/RestIndicesSegmentsAction.java index d84f74d5f49..d9c3c7e8331 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/segments/RestIndicesSegmentsAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/segments/RestIndicesSegmentsAction.java @@ -39,8 +39,8 @@ import static org.elasticsearch.rest.action.support.RestActions.buildBroadcastSh public class RestIndicesSegmentsAction extends BaseRestHandler { @Inject - public RestIndicesSegmentsAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestIndicesSegmentsAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(GET, "/_segments", this); controller.registerHandler(GET, "/{index}/_segments", this); } diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/settings/RestGetSettingsAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/settings/RestGetSettingsAction.java index 573ab862a6f..f32aa988d23 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/settings/RestGetSettingsAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/settings/RestGetSettingsAction.java @@ -38,8 +38,8 @@ import static org.elasticsearch.rest.RestStatus.OK; public class RestGetSettingsAction extends BaseRestHandler { @Inject - public RestGetSettingsAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestGetSettingsAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(GET, "/{index}/_settings/{name}", this); controller.registerHandler(GET, "/_settings/{name}", this); controller.registerHandler(GET, "/{index}/_setting/{name}", this); diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/settings/RestUpdateSettingsAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/settings/RestUpdateSettingsAction.java index b45cf8847d4..a9a9916be76 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/settings/RestUpdateSettingsAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/settings/RestUpdateSettingsAction.java @@ -40,8 +40,8 @@ import static org.elasticsearch.client.Requests.updateSettingsRequest; public class RestUpdateSettingsAction extends BaseRestHandler { @Inject - public RestUpdateSettingsAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestUpdateSettingsAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(RestRequest.Method.PUT, "/{index}/_settings", this); controller.registerHandler(RestRequest.Method.PUT, "/_settings", this); } diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/stats/RestIndicesStatsAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/stats/RestIndicesStatsAction.java index 7731b64e646..4172e6e4601 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/stats/RestIndicesStatsAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/stats/RestIndicesStatsAction.java @@ -41,8 +41,8 @@ import static org.elasticsearch.rest.action.support.RestActions.buildBroadcastSh public class RestIndicesStatsAction extends BaseRestHandler { @Inject - public RestIndicesStatsAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestIndicesStatsAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(GET, "/_stats", this); controller.registerHandler(GET, "/_stats/{metric}", this); controller.registerHandler(GET, "/_stats/{metric}/{indexMetric}", this); diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/template/delete/RestDeleteIndexTemplateAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/template/delete/RestDeleteIndexTemplateAction.java index 928aaed43af..8ebb8675d76 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/template/delete/RestDeleteIndexTemplateAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/template/delete/RestDeleteIndexTemplateAction.java @@ -32,8 +32,8 @@ import org.elasticsearch.rest.action.support.AcknowledgedRestListener; public class RestDeleteIndexTemplateAction extends BaseRestHandler { @Inject - public RestDeleteIndexTemplateAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestDeleteIndexTemplateAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(RestRequest.Method.DELETE, "/_template/{name}", this); } diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/template/get/RestGetIndexTemplateAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/template/get/RestGetIndexTemplateAction.java index f628a3194e2..79841fd531e 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/template/get/RestGetIndexTemplateAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/template/get/RestGetIndexTemplateAction.java @@ -43,8 +43,8 @@ import static org.elasticsearch.rest.RestStatus.OK; public class RestGetIndexTemplateAction extends BaseRestHandler { @Inject - public RestGetIndexTemplateAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestGetIndexTemplateAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(GET, "/_template", this); controller.registerHandler(GET, "/_template/{name}", this); diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/template/head/RestHeadIndexTemplateAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/template/head/RestHeadIndexTemplateAction.java index b9f3c54e688..b18503fac56 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/template/head/RestHeadIndexTemplateAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/template/head/RestHeadIndexTemplateAction.java @@ -36,8 +36,8 @@ import static org.elasticsearch.rest.RestStatus.OK; public class RestHeadIndexTemplateAction extends BaseRestHandler { @Inject - public RestHeadIndexTemplateAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestHeadIndexTemplateAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(HEAD, "/_template/{name}", this); } diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/template/put/RestPutIndexTemplateAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/template/put/RestPutIndexTemplateAction.java index 9ac0315441d..7875f12259b 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/template/put/RestPutIndexTemplateAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/template/put/RestPutIndexTemplateAction.java @@ -32,8 +32,8 @@ import org.elasticsearch.rest.action.support.AcknowledgedRestListener; public class RestPutIndexTemplateAction extends BaseRestHandler { @Inject - public RestPutIndexTemplateAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestPutIndexTemplateAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(RestRequest.Method.PUT, "/_template/{name}", this); controller.registerHandler(RestRequest.Method.POST, "/_template/{name}", this); } diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/validate/query/RestValidateQueryAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/validate/query/RestValidateQueryAction.java index 7a03af4a954..93a2a79d241 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/validate/query/RestValidateQueryAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/validate/query/RestValidateQueryAction.java @@ -44,8 +44,8 @@ import static org.elasticsearch.rest.action.support.RestActions.buildBroadcastSh public class RestValidateQueryAction extends BaseRestHandler { @Inject - public RestValidateQueryAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestValidateQueryAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(GET, "/_validate/query", this); controller.registerHandler(POST, "/_validate/query", this); controller.registerHandler(GET, "/{index}/_validate/query", this); diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/warmer/delete/RestDeleteWarmerAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/warmer/delete/RestDeleteWarmerAction.java index a46f5440986..da41e80cc97 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/warmer/delete/RestDeleteWarmerAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/warmer/delete/RestDeleteWarmerAction.java @@ -35,8 +35,8 @@ import static org.elasticsearch.rest.RestRequest.Method.DELETE; public class RestDeleteWarmerAction extends BaseRestHandler { @Inject - public RestDeleteWarmerAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestDeleteWarmerAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(DELETE, "/{index}/_warmer", this); controller.registerHandler(DELETE, "/{index}/_warmer/{name}", this); controller.registerHandler(DELETE, "/{index}/_warmers", this); diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/warmer/get/RestGetWarmerAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/warmer/get/RestGetWarmerAction.java index 106c028e0b0..7023eecedd4 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/warmer/get/RestGetWarmerAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/warmer/get/RestGetWarmerAction.java @@ -41,8 +41,8 @@ import static org.elasticsearch.rest.RestStatus.OK; public class RestGetWarmerAction extends BaseRestHandler { @Inject - public RestGetWarmerAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestGetWarmerAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(GET, "/_warmer/{name}", this); controller.registerHandler(GET, "/{index}/_warmer/{name}", this); controller.registerHandler(GET, "/{index}/_warmers/{name}", this); diff --git a/src/main/java/org/elasticsearch/rest/action/admin/indices/warmer/put/RestPutWarmerAction.java b/src/main/java/org/elasticsearch/rest/action/admin/indices/warmer/put/RestPutWarmerAction.java index c24bf56ab53..66c8266bc35 100644 --- a/src/main/java/org/elasticsearch/rest/action/admin/indices/warmer/put/RestPutWarmerAction.java +++ b/src/main/java/org/elasticsearch/rest/action/admin/indices/warmer/put/RestPutWarmerAction.java @@ -37,8 +37,8 @@ import static org.elasticsearch.rest.RestRequest.Method.PUT; public class RestPutWarmerAction extends BaseRestHandler { @Inject - public RestPutWarmerAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestPutWarmerAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(PUT, "/_warmer/{name}", this); controller.registerHandler(PUT, "/{index}/_warmer/{name}", this); controller.registerHandler(PUT, "/{index}/{type}/_warmer/{name}", this); diff --git a/src/main/java/org/elasticsearch/rest/action/bench/RestBenchAction.java b/src/main/java/org/elasticsearch/rest/action/bench/RestBenchAction.java index 06e825c1e9c..5145cf2da9a 100644 --- a/src/main/java/org/elasticsearch/rest/action/bench/RestBenchAction.java +++ b/src/main/java/org/elasticsearch/rest/action/bench/RestBenchAction.java @@ -52,8 +52,8 @@ import static org.elasticsearch.rest.RestStatus.*; public class RestBenchAction extends BaseRestHandler { @Inject - public RestBenchAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestBenchAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); // List active benchmarks controller.registerHandler(GET, "/_bench", this); diff --git a/src/main/java/org/elasticsearch/rest/action/bulk/RestBulkAction.java b/src/main/java/org/elasticsearch/rest/action/bulk/RestBulkAction.java index f5720e1db83..c32c5cf9f4c 100644 --- a/src/main/java/org/elasticsearch/rest/action/bulk/RestBulkAction.java +++ b/src/main/java/org/elasticsearch/rest/action/bulk/RestBulkAction.java @@ -55,8 +55,8 @@ public class RestBulkAction extends BaseRestHandler { private final boolean allowExplicitIndex; @Inject - public RestBulkAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestBulkAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(POST, "/_bulk", this); controller.registerHandler(PUT, "/_bulk", this); diff --git a/src/main/java/org/elasticsearch/rest/action/cat/AbstractCatAction.java b/src/main/java/org/elasticsearch/rest/action/cat/AbstractCatAction.java index 5cda6e94561..0c9e2102493 100644 --- a/src/main/java/org/elasticsearch/rest/action/cat/AbstractCatAction.java +++ b/src/main/java/org/elasticsearch/rest/action/cat/AbstractCatAction.java @@ -33,8 +33,8 @@ import static org.elasticsearch.rest.action.support.RestTable.pad; */ public abstract class AbstractCatAction extends BaseRestHandler { - public AbstractCatAction(Settings settings, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public AbstractCatAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); } abstract void doRequest(final RestRequest request, final RestChannel channel, final Client client); diff --git a/src/main/java/org/elasticsearch/rest/action/cat/RestAliasAction.java b/src/main/java/org/elasticsearch/rest/action/cat/RestAliasAction.java index db8aa3bcf93..06f766f936f 100644 --- a/src/main/java/org/elasticsearch/rest/action/cat/RestAliasAction.java +++ b/src/main/java/org/elasticsearch/rest/action/cat/RestAliasAction.java @@ -41,8 +41,8 @@ import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestAliasAction extends AbstractCatAction { @Inject - public RestAliasAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestAliasAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(GET, "/_cat/aliases", this); controller.registerHandler(GET, "/_cat/aliases/{alias}", this); } diff --git a/src/main/java/org/elasticsearch/rest/action/cat/RestAllocationAction.java b/src/main/java/org/elasticsearch/rest/action/cat/RestAllocationAction.java index a810de9062a..2334dc80bb3 100644 --- a/src/main/java/org/elasticsearch/rest/action/cat/RestAllocationAction.java +++ b/src/main/java/org/elasticsearch/rest/action/cat/RestAllocationAction.java @@ -44,8 +44,8 @@ import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestAllocationAction extends AbstractCatAction { @Inject - public RestAllocationAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestAllocationAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(GET, "/_cat/allocation", this); controller.registerHandler(GET, "/_cat/allocation/{nodes}", this); } diff --git a/src/main/java/org/elasticsearch/rest/action/cat/RestCatAction.java b/src/main/java/org/elasticsearch/rest/action/cat/RestCatAction.java index 71c1d698127..cebcf3159ab 100644 --- a/src/main/java/org/elasticsearch/rest/action/cat/RestCatAction.java +++ b/src/main/java/org/elasticsearch/rest/action/cat/RestCatAction.java @@ -35,8 +35,8 @@ public class RestCatAction extends BaseRestHandler { private final String HELP; @Inject - public RestCatAction(Settings settings, RestController controller, Set catActions, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestCatAction(Settings settings, RestController controller, Set catActions, Client client) { + super(settings, controller, client); controller.registerHandler(GET, "/_cat", this); StringBuilder sb = new StringBuilder(); sb.append(CAT_NL); diff --git a/src/main/java/org/elasticsearch/rest/action/cat/RestCountAction.java b/src/main/java/org/elasticsearch/rest/action/cat/RestCountAction.java index fadec4f4b81..8813fe63b46 100644 --- a/src/main/java/org/elasticsearch/rest/action/cat/RestCountAction.java +++ b/src/main/java/org/elasticsearch/rest/action/cat/RestCountAction.java @@ -41,8 +41,8 @@ import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestCountAction extends AbstractCatAction { @Inject - protected RestCountAction(Settings settings, RestController restController, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + protected RestCountAction(Settings settings, RestController restController, RestController controller, Client client) { + super(settings, controller, client); restController.registerHandler(GET, "/_cat/count", this); restController.registerHandler(GET, "/_cat/count/{index}", this); } diff --git a/src/main/java/org/elasticsearch/rest/action/cat/RestFielddataAction.java b/src/main/java/org/elasticsearch/rest/action/cat/RestFielddataAction.java index 10887ecea74..ed6c186a6dd 100644 --- a/src/main/java/org/elasticsearch/rest/action/cat/RestFielddataAction.java +++ b/src/main/java/org/elasticsearch/rest/action/cat/RestFielddataAction.java @@ -46,8 +46,8 @@ import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestFielddataAction extends AbstractCatAction { @Inject - public RestFielddataAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestFielddataAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(GET, "/_cat/fielddata", this); controller.registerHandler(GET, "/_cat/fielddata/{fields}", this); } diff --git a/src/main/java/org/elasticsearch/rest/action/cat/RestHealthAction.java b/src/main/java/org/elasticsearch/rest/action/cat/RestHealthAction.java index 67fb820e94b..9f4686af34a 100644 --- a/src/main/java/org/elasticsearch/rest/action/cat/RestHealthAction.java +++ b/src/main/java/org/elasticsearch/rest/action/cat/RestHealthAction.java @@ -39,8 +39,8 @@ import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestHealthAction extends AbstractCatAction { @Inject - public RestHealthAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestHealthAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(GET, "/_cat/health", this); } diff --git a/src/main/java/org/elasticsearch/rest/action/cat/RestIndicesAction.java b/src/main/java/org/elasticsearch/rest/action/cat/RestIndicesAction.java index 4a8eb240f5b..e5119670e1d 100644 --- a/src/main/java/org/elasticsearch/rest/action/cat/RestIndicesAction.java +++ b/src/main/java/org/elasticsearch/rest/action/cat/RestIndicesAction.java @@ -46,8 +46,8 @@ import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestIndicesAction extends AbstractCatAction { @Inject - public RestIndicesAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestIndicesAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(GET, "/_cat/indices", this); controller.registerHandler(GET, "/_cat/indices/{index}", this); } diff --git a/src/main/java/org/elasticsearch/rest/action/cat/RestMasterAction.java b/src/main/java/org/elasticsearch/rest/action/cat/RestMasterAction.java index 641ae7ec214..92628ef5496 100644 --- a/src/main/java/org/elasticsearch/rest/action/cat/RestMasterAction.java +++ b/src/main/java/org/elasticsearch/rest/action/cat/RestMasterAction.java @@ -36,8 +36,8 @@ import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestMasterAction extends AbstractCatAction { @Inject - public RestMasterAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestMasterAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(GET, "/_cat/master", this); } diff --git a/src/main/java/org/elasticsearch/rest/action/cat/RestNodesAction.java b/src/main/java/org/elasticsearch/rest/action/cat/RestNodesAction.java index 3c2e2ae9074..09c5182b2b4 100644 --- a/src/main/java/org/elasticsearch/rest/action/cat/RestNodesAction.java +++ b/src/main/java/org/elasticsearch/rest/action/cat/RestNodesAction.java @@ -47,8 +47,8 @@ import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestNodesAction extends AbstractCatAction { @Inject - public RestNodesAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestNodesAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(GET, "/_cat/nodes", this); } diff --git a/src/main/java/org/elasticsearch/rest/action/cat/RestPendingClusterTasksAction.java b/src/main/java/org/elasticsearch/rest/action/cat/RestPendingClusterTasksAction.java index 2bb51c1dba4..4bb144246b2 100644 --- a/src/main/java/org/elasticsearch/rest/action/cat/RestPendingClusterTasksAction.java +++ b/src/main/java/org/elasticsearch/rest/action/cat/RestPendingClusterTasksAction.java @@ -34,8 +34,8 @@ import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestPendingClusterTasksAction extends AbstractCatAction { @Inject - public RestPendingClusterTasksAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestPendingClusterTasksAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(GET, "/_cat/pending_tasks", this); } diff --git a/src/main/java/org/elasticsearch/rest/action/cat/RestPluginsAction.java b/src/main/java/org/elasticsearch/rest/action/cat/RestPluginsAction.java index 7eb47f71072..d104328fe74 100644 --- a/src/main/java/org/elasticsearch/rest/action/cat/RestPluginsAction.java +++ b/src/main/java/org/elasticsearch/rest/action/cat/RestPluginsAction.java @@ -41,8 +41,8 @@ import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestPluginsAction extends AbstractCatAction { @Inject - public RestPluginsAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestPluginsAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(GET, "/_cat/plugins", this); } diff --git a/src/main/java/org/elasticsearch/rest/action/cat/RestRecoveryAction.java b/src/main/java/org/elasticsearch/rest/action/cat/RestRecoveryAction.java index 94d0f4517fd..ff46af04cc7 100644 --- a/src/main/java/org/elasticsearch/rest/action/cat/RestRecoveryAction.java +++ b/src/main/java/org/elasticsearch/rest/action/cat/RestRecoveryAction.java @@ -48,8 +48,8 @@ import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestRecoveryAction extends AbstractCatAction { @Inject - protected RestRecoveryAction(Settings settings, RestController restController, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + protected RestRecoveryAction(Settings settings, RestController restController, RestController controller, Client client) { + super(settings, controller, client); restController.registerHandler(GET, "/_cat/recovery", this); restController.registerHandler(GET, "/_cat/recovery/{index}", this); } diff --git a/src/main/java/org/elasticsearch/rest/action/cat/RestSegmentsAction.java b/src/main/java/org/elasticsearch/rest/action/cat/RestSegmentsAction.java index 2cfb97ad213..b2b42bd2d87 100644 --- a/src/main/java/org/elasticsearch/rest/action/cat/RestSegmentsAction.java +++ b/src/main/java/org/elasticsearch/rest/action/cat/RestSegmentsAction.java @@ -42,8 +42,8 @@ import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestSegmentsAction extends AbstractCatAction { @Inject - public RestSegmentsAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestSegmentsAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(GET, "/_cat/segments", this); controller.registerHandler(GET, "/_cat/segments/{index}", this); } diff --git a/src/main/java/org/elasticsearch/rest/action/cat/RestShardsAction.java b/src/main/java/org/elasticsearch/rest/action/cat/RestShardsAction.java index ad71c548bb8..8a094c969d8 100644 --- a/src/main/java/org/elasticsearch/rest/action/cat/RestShardsAction.java +++ b/src/main/java/org/elasticsearch/rest/action/cat/RestShardsAction.java @@ -40,8 +40,8 @@ import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestShardsAction extends AbstractCatAction { @Inject - public RestShardsAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestShardsAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(GET, "/_cat/shards", this); controller.registerHandler(GET, "/_cat/shards/{index}", this); } diff --git a/src/main/java/org/elasticsearch/rest/action/cat/RestThreadPoolAction.java b/src/main/java/org/elasticsearch/rest/action/cat/RestThreadPoolAction.java index e399e553ca1..bc423ce90bd 100644 --- a/src/main/java/org/elasticsearch/rest/action/cat/RestThreadPoolAction.java +++ b/src/main/java/org/elasticsearch/rest/action/cat/RestThreadPoolAction.java @@ -105,8 +105,8 @@ public class RestThreadPoolAction extends AbstractCatAction { } @Inject - public RestThreadPoolAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestThreadPoolAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(GET, "/_cat/thread_pool", this); } diff --git a/src/main/java/org/elasticsearch/rest/action/count/RestCountAction.java b/src/main/java/org/elasticsearch/rest/action/count/RestCountAction.java index 129fd78c792..58ac7ee730e 100644 --- a/src/main/java/org/elasticsearch/rest/action/count/RestCountAction.java +++ b/src/main/java/org/elasticsearch/rest/action/count/RestCountAction.java @@ -45,8 +45,8 @@ import static org.elasticsearch.rest.action.support.RestActions.buildBroadcastSh public class RestCountAction extends BaseRestHandler { @Inject - public RestCountAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestCountAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(POST, "/_count", this); controller.registerHandler(GET, "/_count", this); controller.registerHandler(POST, "/{index}/_count", this); diff --git a/src/main/java/org/elasticsearch/rest/action/delete/RestDeleteAction.java b/src/main/java/org/elasticsearch/rest/action/delete/RestDeleteAction.java index 7685fff7e35..e2a748524e4 100644 --- a/src/main/java/org/elasticsearch/rest/action/delete/RestDeleteAction.java +++ b/src/main/java/org/elasticsearch/rest/action/delete/RestDeleteAction.java @@ -43,8 +43,8 @@ import static org.elasticsearch.rest.RestStatus.OK; public class RestDeleteAction extends BaseRestHandler { @Inject - public RestDeleteAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestDeleteAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(DELETE, "/{index}/{type}/{id}", this); } diff --git a/src/main/java/org/elasticsearch/rest/action/deletebyquery/RestDeleteByQueryAction.java b/src/main/java/org/elasticsearch/rest/action/deletebyquery/RestDeleteByQueryAction.java index 5f19d6de931..76321c9cc6a 100644 --- a/src/main/java/org/elasticsearch/rest/action/deletebyquery/RestDeleteByQueryAction.java +++ b/src/main/java/org/elasticsearch/rest/action/deletebyquery/RestDeleteByQueryAction.java @@ -46,8 +46,8 @@ import static org.elasticsearch.rest.RestRequest.Method.DELETE; public class RestDeleteByQueryAction extends BaseRestHandler { @Inject - public RestDeleteByQueryAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestDeleteByQueryAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(DELETE, "/{index}/_query", this); controller.registerHandler(DELETE, "/{index}/{type}/_query", this); } diff --git a/src/main/java/org/elasticsearch/rest/action/exists/RestExistsAction.java b/src/main/java/org/elasticsearch/rest/action/exists/RestExistsAction.java index da7f4e26363..7741da25372 100644 --- a/src/main/java/org/elasticsearch/rest/action/exists/RestExistsAction.java +++ b/src/main/java/org/elasticsearch/rest/action/exists/RestExistsAction.java @@ -40,8 +40,8 @@ import static org.elasticsearch.rest.RestStatus.OK; */ public class RestExistsAction extends BaseRestHandler { - public RestExistsAction(Settings settings, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestExistsAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); } @Override diff --git a/src/main/java/org/elasticsearch/rest/action/explain/RestExplainAction.java b/src/main/java/org/elasticsearch/rest/action/explain/RestExplainAction.java index 9effe34a87a..2d31b289c42 100644 --- a/src/main/java/org/elasticsearch/rest/action/explain/RestExplainAction.java +++ b/src/main/java/org/elasticsearch/rest/action/explain/RestExplainAction.java @@ -51,8 +51,8 @@ import static org.elasticsearch.rest.RestStatus.OK; public class RestExplainAction extends BaseRestHandler { @Inject - public RestExplainAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestExplainAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(GET, "/{index}/{type}/{id}/_explain", this); controller.registerHandler(POST, "/{index}/{type}/{id}/_explain", this); } diff --git a/src/main/java/org/elasticsearch/rest/action/get/RestGetAction.java b/src/main/java/org/elasticsearch/rest/action/get/RestGetAction.java index 5137d161744..ae2e76be690 100644 --- a/src/main/java/org/elasticsearch/rest/action/get/RestGetAction.java +++ b/src/main/java/org/elasticsearch/rest/action/get/RestGetAction.java @@ -42,8 +42,8 @@ import static org.elasticsearch.rest.RestStatus.OK; public class RestGetAction extends BaseRestHandler { @Inject - public RestGetAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestGetAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(GET, "/{index}/{type}/{id}", this); } diff --git a/src/main/java/org/elasticsearch/rest/action/get/RestGetSourceAction.java b/src/main/java/org/elasticsearch/rest/action/get/RestGetSourceAction.java index 46db9660e14..4142e667985 100644 --- a/src/main/java/org/elasticsearch/rest/action/get/RestGetSourceAction.java +++ b/src/main/java/org/elasticsearch/rest/action/get/RestGetSourceAction.java @@ -43,8 +43,8 @@ import static org.elasticsearch.rest.RestStatus.OK; public class RestGetSourceAction extends BaseRestHandler { @Inject - public RestGetSourceAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestGetSourceAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(GET, "/{index}/{type}/{id}/_source", this); } diff --git a/src/main/java/org/elasticsearch/rest/action/get/RestHeadAction.java b/src/main/java/org/elasticsearch/rest/action/get/RestHeadAction.java index c199e7dceda..9217200a7e6 100644 --- a/src/main/java/org/elasticsearch/rest/action/get/RestHeadAction.java +++ b/src/main/java/org/elasticsearch/rest/action/get/RestHeadAction.java @@ -38,8 +38,8 @@ import static org.elasticsearch.rest.RestStatus.OK; public class RestHeadAction extends BaseRestHandler { @Inject - public RestHeadAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestHeadAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(HEAD, "/{index}/{type}/{id}", this); controller.registerHandler(HEAD, "/{index}/{type}/{id}/_source", this); } diff --git a/src/main/java/org/elasticsearch/rest/action/get/RestMultiGetAction.java b/src/main/java/org/elasticsearch/rest/action/get/RestMultiGetAction.java index d6bae1ed0c1..b9cdd78063c 100644 --- a/src/main/java/org/elasticsearch/rest/action/get/RestMultiGetAction.java +++ b/src/main/java/org/elasticsearch/rest/action/get/RestMultiGetAction.java @@ -38,8 +38,8 @@ public class RestMultiGetAction extends BaseRestHandler { private final boolean allowExplicitIndex; @Inject - public RestMultiGetAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestMultiGetAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(GET, "/_mget", this); controller.registerHandler(POST, "/_mget", this); controller.registerHandler(GET, "/{index}/_mget", this); diff --git a/src/main/java/org/elasticsearch/rest/action/index/RestIndexAction.java b/src/main/java/org/elasticsearch/rest/action/index/RestIndexAction.java index 933c2f4f867..24e00ecf90d 100644 --- a/src/main/java/org/elasticsearch/rest/action/index/RestIndexAction.java +++ b/src/main/java/org/elasticsearch/rest/action/index/RestIndexAction.java @@ -46,19 +46,19 @@ import static org.elasticsearch.rest.RestStatus.*; public class RestIndexAction extends BaseRestHandler { @Inject - public RestIndexAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestIndexAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(POST, "/{index}/{type}", this); // auto id creation controller.registerHandler(PUT, "/{index}/{type}/{id}", this); controller.registerHandler(POST, "/{index}/{type}/{id}", this); - CreateHandler createHandler = new CreateHandler(settings, restClientFactory); + CreateHandler createHandler = new CreateHandler(settings, controller, client); controller.registerHandler(PUT, "/{index}/{type}/{id}/_create", createHandler); controller.registerHandler(POST, "/{index}/{type}/{id}/_create", createHandler); } final class CreateHandler extends BaseRestHandler { - protected CreateHandler(Settings settings, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + protected CreateHandler(Settings settings, RestController controller, Client client) { + super(settings, controller, client); } @Override diff --git a/src/main/java/org/elasticsearch/rest/action/main/RestMainAction.java b/src/main/java/org/elasticsearch/rest/action/main/RestMainAction.java index 908267013b3..58bf9551860 100644 --- a/src/main/java/org/elasticsearch/rest/action/main/RestMainAction.java +++ b/src/main/java/org/elasticsearch/rest/action/main/RestMainAction.java @@ -45,8 +45,8 @@ public class RestMainAction extends BaseRestHandler { private final ClusterName clusterName; @Inject - public RestMainAction(Settings settings, Version version, RestController controller, ClusterName clusterName, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestMainAction(Settings settings, Version version, RestController controller, ClusterName clusterName, Client client) { + super(settings, controller, client); this.version = version; this.clusterName = clusterName; controller.registerHandler(GET, "/", this); diff --git a/src/main/java/org/elasticsearch/rest/action/mlt/RestMoreLikeThisAction.java b/src/main/java/org/elasticsearch/rest/action/mlt/RestMoreLikeThisAction.java index 403bdf36280..6b43352c7b0 100644 --- a/src/main/java/org/elasticsearch/rest/action/mlt/RestMoreLikeThisAction.java +++ b/src/main/java/org/elasticsearch/rest/action/mlt/RestMoreLikeThisAction.java @@ -40,8 +40,8 @@ import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestMoreLikeThisAction extends BaseRestHandler { @Inject - public RestMoreLikeThisAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestMoreLikeThisAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(GET, "/{index}/{type}/{id}/_mlt", this); controller.registerHandler(POST, "/{index}/{type}/{id}/_mlt", this); } diff --git a/src/main/java/org/elasticsearch/rest/action/percolate/RestMultiPercolateAction.java b/src/main/java/org/elasticsearch/rest/action/percolate/RestMultiPercolateAction.java index 6559e7c747e..c532c147aea 100644 --- a/src/main/java/org/elasticsearch/rest/action/percolate/RestMultiPercolateAction.java +++ b/src/main/java/org/elasticsearch/rest/action/percolate/RestMultiPercolateAction.java @@ -40,8 +40,8 @@ public class RestMultiPercolateAction extends BaseRestHandler { private final boolean allowExplicitIndex; @Inject - public RestMultiPercolateAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestMultiPercolateAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(POST, "/_mpercolate", this); controller.registerHandler(POST, "/{index}/_mpercolate", this); controller.registerHandler(POST, "/{index}/{type}/_mpercolate", this); diff --git a/src/main/java/org/elasticsearch/rest/action/percolate/RestPercolateAction.java b/src/main/java/org/elasticsearch/rest/action/percolate/RestPercolateAction.java index 8d7536df0d8..4f24c82c3cf 100644 --- a/src/main/java/org/elasticsearch/rest/action/percolate/RestPercolateAction.java +++ b/src/main/java/org/elasticsearch/rest/action/percolate/RestPercolateAction.java @@ -40,20 +40,20 @@ import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestPercolateAction extends BaseRestHandler { @Inject - public RestPercolateAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestPercolateAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(GET, "/{index}/{type}/_percolate", this); controller.registerHandler(POST, "/{index}/{type}/_percolate", this); - RestPercolateExistingDocHandler existingDocHandler = new RestPercolateExistingDocHandler(settings, restClientFactory); + RestPercolateExistingDocHandler existingDocHandler = new RestPercolateExistingDocHandler(settings, controller, client); controller.registerHandler(GET, "/{index}/{type}/{id}/_percolate", existingDocHandler); controller.registerHandler(POST, "/{index}/{type}/{id}/_percolate", existingDocHandler); - RestCountPercolateDocHandler countHandler = new RestCountPercolateDocHandler(settings, restClientFactory); + RestCountPercolateDocHandler countHandler = new RestCountPercolateDocHandler(settings, controller, client); controller.registerHandler(GET, "/{index}/{type}/_percolate/count", countHandler); controller.registerHandler(POST, "/{index}/{type}/_percolate/count", countHandler); - RestCountPercolateExistingDocHandler countExistingDocHandler = new RestCountPercolateExistingDocHandler(settings, restClientFactory); + RestCountPercolateExistingDocHandler countExistingDocHandler = new RestCountPercolateExistingDocHandler(settings, controller, client); controller.registerHandler(GET, "/{index}/{type}/{id}/_percolate/count", countExistingDocHandler); controller.registerHandler(POST, "/{index}/{type}/{id}/_percolate/count", countExistingDocHandler); } @@ -107,8 +107,8 @@ public class RestPercolateAction extends BaseRestHandler { final class RestCountPercolateDocHandler extends BaseRestHandler { - private RestCountPercolateDocHandler(Settings settings, final RestClientFactory restClientFactory) { - super(settings, restClientFactory); + private RestCountPercolateDocHandler(Settings settings, final RestController controller, Client client) { + super(settings, controller, client); } @Override @@ -121,8 +121,8 @@ public class RestPercolateAction extends BaseRestHandler { final class RestPercolateExistingDocHandler extends BaseRestHandler { - protected RestPercolateExistingDocHandler(Settings settings, final RestClientFactory restClientFactory) { - super(settings, restClientFactory); + protected RestPercolateExistingDocHandler(Settings settings, final RestController controller, Client client) { + super(settings, controller, client); } @Override @@ -134,8 +134,8 @@ public class RestPercolateAction extends BaseRestHandler { final class RestCountPercolateExistingDocHandler extends BaseRestHandler { - protected RestCountPercolateExistingDocHandler(Settings settings, final RestClientFactory restClientFactory) { - super(settings, restClientFactory); + protected RestCountPercolateExistingDocHandler(Settings settings, final RestController controller, Client client) { + super(settings, controller, client); } @Override diff --git a/src/main/java/org/elasticsearch/rest/action/script/RestDeleteIndexedScriptAction.java b/src/main/java/org/elasticsearch/rest/action/script/RestDeleteIndexedScriptAction.java index 40f64a3b2d2..4d8d678a304 100644 --- a/src/main/java/org/elasticsearch/rest/action/script/RestDeleteIndexedScriptAction.java +++ b/src/main/java/org/elasticsearch/rest/action/script/RestDeleteIndexedScriptAction.java @@ -36,13 +36,15 @@ import static org.elasticsearch.rest.RestStatus.OK; public class RestDeleteIndexedScriptAction extends BaseRestHandler { @Inject - public RestDeleteIndexedScriptAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); - controller.registerHandler(DELETE, "/_scripts/{lang}/{id}", this); + public RestDeleteIndexedScriptAction(Settings settings, RestController controller, Client client) { + this(settings, controller, true, client); } - protected RestDeleteIndexedScriptAction(Settings settings, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + protected RestDeleteIndexedScriptAction(Settings settings, RestController controller, boolean registerDefaultHandlers, Client client) { + super(settings, controller, client); + if (registerDefaultHandlers) { + controller.registerHandler(DELETE, "/_scripts/{lang}/{id}", this); + } } protected String getScriptLang(RestRequest request) { diff --git a/src/main/java/org/elasticsearch/rest/action/script/RestGetIndexedScriptAction.java b/src/main/java/org/elasticsearch/rest/action/script/RestGetIndexedScriptAction.java index d099dcfdba4..abc5b0def42 100644 --- a/src/main/java/org/elasticsearch/rest/action/script/RestGetIndexedScriptAction.java +++ b/src/main/java/org/elasticsearch/rest/action/script/RestGetIndexedScriptAction.java @@ -43,13 +43,15 @@ import static org.elasticsearch.rest.RestStatus.OK; public class RestGetIndexedScriptAction extends BaseRestHandler { @Inject - public RestGetIndexedScriptAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); - controller.registerHandler(GET, "/_scripts/{lang}/{id}", this); + public RestGetIndexedScriptAction(Settings settings, RestController controller, Client client) { + this(settings, controller, true, client); } - protected RestGetIndexedScriptAction(Settings settings, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + protected RestGetIndexedScriptAction(Settings settings, RestController controller, boolean registerDefaultHandlers, Client client) { + super(settings, controller, client); + if (registerDefaultHandlers) { + controller.registerHandler(GET, "/_scripts/{lang}/{id}", this); + } } protected String getScriptLang(RestRequest request) { diff --git a/src/main/java/org/elasticsearch/rest/action/script/RestPutIndexedScriptAction.java b/src/main/java/org/elasticsearch/rest/action/script/RestPutIndexedScriptAction.java index 1cd514c2e5e..6a4ce195b7d 100644 --- a/src/main/java/org/elasticsearch/rest/action/script/RestPutIndexedScriptAction.java +++ b/src/main/java/org/elasticsearch/rest/action/script/RestPutIndexedScriptAction.java @@ -43,23 +43,24 @@ import static org.elasticsearch.rest.RestStatus.*; public class RestPutIndexedScriptAction extends BaseRestHandler { @Inject - public RestPutIndexedScriptAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); - - controller.registerHandler(POST, "/_scripts/{lang}/{id}", this); - controller.registerHandler(PUT, "/_scripts/{lang}/{id}", this); - - controller.registerHandler(PUT, "/_scripts/{lang}/{id}/_create", new CreateHandler(settings, restClientFactory)); - controller.registerHandler(POST, "/_scripts/{lang}/{id}/_create", new CreateHandler(settings, restClientFactory)); + public RestPutIndexedScriptAction(Settings settings, RestController controller, Client client) { + this(settings, controller, true, client); } - protected RestPutIndexedScriptAction(Settings settings, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + protected RestPutIndexedScriptAction(Settings settings, RestController controller, boolean registerDefaultHandlers, Client client) { + super(settings, controller, client); + if (registerDefaultHandlers) { + controller.registerHandler(POST, "/_scripts/{lang}/{id}", this); + controller.registerHandler(PUT, "/_scripts/{lang}/{id}", this); + + controller.registerHandler(PUT, "/_scripts/{lang}/{id}/_create", new CreateHandler(settings, controller, client)); + controller.registerHandler(POST, "/_scripts/{lang}/{id}/_create", new CreateHandler(settings, controller, client)); + } } final class CreateHandler extends BaseRestHandler { - protected CreateHandler(Settings settings, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + protected CreateHandler(Settings settings, RestController controller, Client client) { + super(settings, controller, client); } @Override diff --git a/src/main/java/org/elasticsearch/rest/action/search/RestClearScrollAction.java b/src/main/java/org/elasticsearch/rest/action/search/RestClearScrollAction.java index ddebffbd74e..74d01be7238 100644 --- a/src/main/java/org/elasticsearch/rest/action/search/RestClearScrollAction.java +++ b/src/main/java/org/elasticsearch/rest/action/search/RestClearScrollAction.java @@ -38,8 +38,8 @@ import static org.elasticsearch.rest.RestRequest.Method.DELETE; public class RestClearScrollAction extends BaseRestHandler { @Inject - public RestClearScrollAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestClearScrollAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(DELETE, "/_search/scroll", this); controller.registerHandler(DELETE, "/_search/scroll/{scroll_id}", this); diff --git a/src/main/java/org/elasticsearch/rest/action/search/RestMultiSearchAction.java b/src/main/java/org/elasticsearch/rest/action/search/RestMultiSearchAction.java index 2c54883163a..e22290c6c24 100644 --- a/src/main/java/org/elasticsearch/rest/action/search/RestMultiSearchAction.java +++ b/src/main/java/org/elasticsearch/rest/action/search/RestMultiSearchAction.java @@ -40,8 +40,8 @@ public class RestMultiSearchAction extends BaseRestHandler { private final boolean allowExplicitIndex; @Inject - public RestMultiSearchAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestMultiSearchAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(GET, "/_msearch", this); controller.registerHandler(POST, "/_msearch", this); diff --git a/src/main/java/org/elasticsearch/rest/action/search/RestSearchAction.java b/src/main/java/org/elasticsearch/rest/action/search/RestSearchAction.java index a18e9ed7d10..22d3e6c98ed 100644 --- a/src/main/java/org/elasticsearch/rest/action/search/RestSearchAction.java +++ b/src/main/java/org/elasticsearch/rest/action/search/RestSearchAction.java @@ -49,8 +49,8 @@ import static org.elasticsearch.search.suggest.SuggestBuilders.termSuggestion; public class RestSearchAction extends BaseRestHandler { @Inject - public RestSearchAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestSearchAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(GET, "/_search", this); controller.registerHandler(POST, "/_search", this); controller.registerHandler(GET, "/{index}/_search", this); @@ -64,7 +64,7 @@ public class RestSearchAction extends BaseRestHandler { controller.registerHandler(GET, "/{index}/{type}/_search/template", this); controller.registerHandler(POST, "/{index}/{type}/_search/template", this); - RestExistsAction restExistsAction = new RestExistsAction(settings, restClientFactory); + RestExistsAction restExistsAction = new RestExistsAction(settings, controller, client); controller.registerHandler(GET, "/_search/exists", restExistsAction); controller.registerHandler(POST, "/_search/exists", restExistsAction); controller.registerHandler(GET, "/{index}/_search/exists", restExistsAction); diff --git a/src/main/java/org/elasticsearch/rest/action/search/RestSearchScrollAction.java b/src/main/java/org/elasticsearch/rest/action/search/RestSearchScrollAction.java index 08e3d417798..4d4c3ce6eb1 100644 --- a/src/main/java/org/elasticsearch/rest/action/search/RestSearchScrollAction.java +++ b/src/main/java/org/elasticsearch/rest/action/search/RestSearchScrollAction.java @@ -39,8 +39,8 @@ import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestSearchScrollAction extends BaseRestHandler { @Inject - public RestSearchScrollAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestSearchScrollAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(GET, "/_search/scroll", this); controller.registerHandler(POST, "/_search/scroll", this); diff --git a/src/main/java/org/elasticsearch/rest/action/suggest/RestSuggestAction.java b/src/main/java/org/elasticsearch/rest/action/suggest/RestSuggestAction.java index 5f90e7a7040..ed64b69ab07 100644 --- a/src/main/java/org/elasticsearch/rest/action/suggest/RestSuggestAction.java +++ b/src/main/java/org/elasticsearch/rest/action/suggest/RestSuggestAction.java @@ -43,8 +43,8 @@ import static org.elasticsearch.rest.action.support.RestActions.buildBroadcastSh public class RestSuggestAction extends BaseRestHandler { @Inject - public RestSuggestAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestSuggestAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(POST, "/_suggest", this); controller.registerHandler(GET, "/_suggest", this); controller.registerHandler(POST, "/{index}/_suggest", this); diff --git a/src/main/java/org/elasticsearch/rest/action/template/RestDeleteSearchTemplateAction.java b/src/main/java/org/elasticsearch/rest/action/template/RestDeleteSearchTemplateAction.java index f21cbb80b4b..ebb217187a3 100644 --- a/src/main/java/org/elasticsearch/rest/action/template/RestDeleteSearchTemplateAction.java +++ b/src/main/java/org/elasticsearch/rest/action/template/RestDeleteSearchTemplateAction.java @@ -18,9 +18,9 @@ */ package org.elasticsearch.rest.action.template; +import org.elasticsearch.client.Client; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.rest.RestClientFactory; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.script.RestDeleteIndexedScriptAction; @@ -30,8 +30,8 @@ import static org.elasticsearch.rest.RestRequest.Method.DELETE; public class RestDeleteSearchTemplateAction extends RestDeleteIndexedScriptAction { @Inject - public RestDeleteSearchTemplateAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestDeleteSearchTemplateAction(Settings settings, RestController controller, Client client) { + super(settings, controller, false, client); controller.registerHandler(DELETE, "/_search/template/{id}", this); } diff --git a/src/main/java/org/elasticsearch/rest/action/template/RestGetSearchTemplateAction.java b/src/main/java/org/elasticsearch/rest/action/template/RestGetSearchTemplateAction.java index b7cda71861f..4c505c13360 100644 --- a/src/main/java/org/elasticsearch/rest/action/template/RestGetSearchTemplateAction.java +++ b/src/main/java/org/elasticsearch/rest/action/template/RestGetSearchTemplateAction.java @@ -18,9 +18,9 @@ */ package org.elasticsearch.rest.action.template; +import org.elasticsearch.client.Client; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.rest.RestClientFactory; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.script.RestGetIndexedScriptAction; @@ -33,8 +33,8 @@ import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestGetSearchTemplateAction extends RestGetIndexedScriptAction { @Inject - public RestGetSearchTemplateAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestGetSearchTemplateAction(Settings settings, RestController controller, Client client) { + super(settings, controller, false, client); controller.registerHandler(GET, "/_search/template/{id}", this); } diff --git a/src/main/java/org/elasticsearch/rest/action/template/RestPutSearchTemplateAction.java b/src/main/java/org/elasticsearch/rest/action/template/RestPutSearchTemplateAction.java index 9126838fbda..304f8d117f8 100644 --- a/src/main/java/org/elasticsearch/rest/action/template/RestPutSearchTemplateAction.java +++ b/src/main/java/org/elasticsearch/rest/action/template/RestPutSearchTemplateAction.java @@ -33,20 +33,20 @@ import static org.elasticsearch.rest.RestRequest.Method.PUT; public class RestPutSearchTemplateAction extends RestPutIndexedScriptAction { @Inject - public RestPutSearchTemplateAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestPutSearchTemplateAction(Settings settings, RestController controller, Client client) { + super(settings, controller, false, client); //controller.registerHandler(GET, "/template", this); controller.registerHandler(POST, "/_search/template/{id}", this); controller.registerHandler(PUT, "/_search/template/{id}", this); - controller.registerHandler(PUT, "/_search/template/{id}/_create", new CreateHandler(settings, restClientFactory)); - controller.registerHandler(POST, "/_search/template/{id}/_create", new CreateHandler(settings, restClientFactory)); + controller.registerHandler(PUT, "/_search/template/{id}/_create", new CreateHandler(settings, controller, client)); + controller.registerHandler(POST, "/_search/template/{id}/_create", new CreateHandler(settings, controller, client)); } final class CreateHandler extends BaseRestHandler { - protected CreateHandler(Settings settings, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + protected CreateHandler(Settings settings, RestController controller, Client client) { + super(settings, controller, client); } @Override diff --git a/src/main/java/org/elasticsearch/rest/action/termvector/RestMultiTermVectorsAction.java b/src/main/java/org/elasticsearch/rest/action/termvector/RestMultiTermVectorsAction.java index f43b940ca53..36abdadb5fc 100644 --- a/src/main/java/org/elasticsearch/rest/action/termvector/RestMultiTermVectorsAction.java +++ b/src/main/java/org/elasticsearch/rest/action/termvector/RestMultiTermVectorsAction.java @@ -36,8 +36,8 @@ import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestMultiTermVectorsAction extends BaseRestHandler { @Inject - public RestMultiTermVectorsAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestMultiTermVectorsAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(GET, "/_mtermvectors", this); controller.registerHandler(POST, "/_mtermvectors", this); controller.registerHandler(GET, "/{index}/_mtermvectors", this); diff --git a/src/main/java/org/elasticsearch/rest/action/termvector/RestTermVectorAction.java b/src/main/java/org/elasticsearch/rest/action/termvector/RestTermVectorAction.java index 80f7ce028c9..435cec7f8db 100644 --- a/src/main/java/org/elasticsearch/rest/action/termvector/RestTermVectorAction.java +++ b/src/main/java/org/elasticsearch/rest/action/termvector/RestTermVectorAction.java @@ -43,8 +43,8 @@ import static org.elasticsearch.rest.RestRequest.Method.POST; public class RestTermVectorAction extends BaseRestHandler { @Inject - public RestTermVectorAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestTermVectorAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(GET, "/{index}/{type}/_termvector", this); controller.registerHandler(POST, "/{index}/{type}/_termvector", this); controller.registerHandler(GET, "/{index}/{type}/{id}/_termvector", this); diff --git a/src/main/java/org/elasticsearch/rest/action/update/RestUpdateAction.java b/src/main/java/org/elasticsearch/rest/action/update/RestUpdateAction.java index f786cbd0f06..ef8546ed8e1 100644 --- a/src/main/java/org/elasticsearch/rest/action/update/RestUpdateAction.java +++ b/src/main/java/org/elasticsearch/rest/action/update/RestUpdateAction.java @@ -47,8 +47,8 @@ import static org.elasticsearch.rest.RestStatus.OK; public class RestUpdateAction extends BaseRestHandler { @Inject - public RestUpdateAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public RestUpdateAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(POST, "/{index}/{type}/{id}/_update", this); } diff --git a/src/test/java/org/elasticsearch/plugins/responseheader/TestResponseHeaderRestAction.java b/src/test/java/org/elasticsearch/plugins/responseheader/TestResponseHeaderRestAction.java index 70c34ac94bb..83fa3e21295 100644 --- a/src/test/java/org/elasticsearch/plugins/responseheader/TestResponseHeaderRestAction.java +++ b/src/test/java/org/elasticsearch/plugins/responseheader/TestResponseHeaderRestAction.java @@ -26,8 +26,8 @@ import org.elasticsearch.rest.*; public class TestResponseHeaderRestAction extends BaseRestHandler { @Inject - public TestResponseHeaderRestAction(Settings settings, RestController controller, RestClientFactory restClientFactory) { - super(settings, restClientFactory); + public TestResponseHeaderRestAction(Settings settings, RestController controller, Client client) { + super(settings, controller, client); controller.registerHandler(RestRequest.Method.GET, "/_protected", this); } diff --git a/src/test/java/org/elasticsearch/rest/HeadersAndContextCopyClientTests.java b/src/test/java/org/elasticsearch/rest/HeadersAndContextCopyClientTests.java index fcff74f3496..4549291c501 100644 --- a/src/test/java/org/elasticsearch/rest/HeadersAndContextCopyClientTests.java +++ b/src/test/java/org/elasticsearch/rest/HeadersAndContextCopyClientTests.java @@ -36,6 +36,7 @@ import org.elasticsearch.client.support.AbstractClient; import org.elasticsearch.client.support.AbstractClusterAdminClient; import org.elasticsearch.client.support.AbstractIndicesAdminClient; import org.elasticsearch.common.collect.ImmutableOpenMap; +import org.elasticsearch.common.settings.ImmutableSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.test.ElasticsearchTestCase; import org.elasticsearch.threadpool.ThreadPool; @@ -53,9 +54,10 @@ import static org.hamcrest.Matchers.*; public class HeadersAndContextCopyClientTests extends ElasticsearchTestCase { @Test - public void testAddRelevantHeaders() throws InterruptedException { + public void testRegisterRelevantHeaders() throws InterruptedException { + + final RestController restController = new RestController(ImmutableSettings.EMPTY); - final RestClientFactory restClientFactory = new RestClientFactory(null); int iterations = randomIntBetween(1, 5); Set headers = new HashSet<>(); @@ -72,14 +74,14 @@ public class HeadersAndContextCopyClientTests extends ElasticsearchTestCase { executorService.submit(new Runnable() { @Override public void run() { - restClientFactory.addRelevantHeaders(newHeaders.toArray(new String[newHeaders.size()])); + restController.registerRelevantHeaders(newHeaders.toArray(new String[newHeaders.size()])); } }); } executorService.shutdown(); assertThat(executorService.awaitTermination(1, TimeUnit.SECONDS), equalTo(true)); - String[] relevantHeaders = restClientFactory.relevantHeaders().toArray(new String[restClientFactory.relevantHeaders().size()]); + String[] relevantHeaders = restController.relevantHeaders().toArray(new String[restController.relevantHeaders().size()]); assertThat(relevantHeaders.length, equalTo(headers.size())); Arrays.sort(relevantHeaders); @@ -375,7 +377,7 @@ public class HeadersAndContextCopyClientTests extends ElasticsearchTestCase { } private static Client client(Client noOpClient, RestRequest restRequest, Set usefulRestHeaders) { - return new RestClientFactory.HeadersAndContextCopyClient(noOpClient, restRequest, usefulRestHeaders); + return new BaseRestHandler.HeadersAndContextCopyClient(noOpClient, restRequest, usefulRestHeaders); } private static void putHeaders(ActionRequest request, Map headers) {