Centralize admin implementations and action execution

This change removes the multiple implementations of different admin interfaces and centralizes it with AbstractClient. It also makes sure *all* executions of actions now go through a single AbstractClient#execute method, taking care of copying headers and wrapping listener.
This also has the side benefit of removing all the code around differnet possible clients, and removes quite a bit of code (most of the + code is actually removal of generics and such).

This change also changes how TransportClient is constructed, requiring a Builder to create it, its a breaking change and its noted in the migration guide.

Yea another step towards simplifying the action infra and making it simpler...
This commit is contained in:
Shay Banon 2015-05-04 16:23:08 +02:00
parent bd453db411
commit 187d79b6df
208 changed files with 2341 additions and 4216 deletions

View File

@ -134,7 +134,7 @@ be "two hop" operations).
-------------------------------------------------- --------------------------------------------------
// on startup // on startup
Client client = new TransportClient() Client client = TransportClient.builder().build()
.addTransportAddress(new InetSocketTransportAddress("host1", 9300)) .addTransportAddress(new InetSocketTransportAddress("host1", 9300))
.addTransportAddress(new InetSocketTransportAddress("host2", 9300)); .addTransportAddress(new InetSocketTransportAddress("host2", 9300));
@ -150,7 +150,7 @@ Note that you have to set the cluster name if you use one different than
-------------------------------------------------- --------------------------------------------------
Settings settings = ImmutableSettings.settingsBuilder() Settings settings = ImmutableSettings.settingsBuilder()
.put("cluster.name", "myClusterName").build(); .put("cluster.name", "myClusterName").build();
Client client = new TransportClient(settings); Client client = TransportClient.builder().settings(settings).build();
//Add transport addresses and do something with the client... //Add transport addresses and do something with the client...
-------------------------------------------------- --------------------------------------------------
@ -166,7 +166,7 @@ used will be the ones that the other nodes were started with (the
-------------------------------------------------- --------------------------------------------------
Settings settings = ImmutableSettings.settingsBuilder() Settings settings = ImmutableSettings.settingsBuilder()
.put("client.transport.sniff", true).build(); .put("client.transport.sniff", true).build();
TransportClient client = new TransportClient(settings); TransportClient client = TransportClient.builder().settings(settings).build();
-------------------------------------------------- --------------------------------------------------
Other transport client level settings include: Other transport client level settings include:

View File

@ -463,3 +463,23 @@ The `index.store.distributor` setting has also been removed.
The parameter `indices.analysis.hunspell.dictionary.location` has been removed, The parameter `indices.analysis.hunspell.dictionary.location` has been removed,
and `<path.conf>/hunspell` is always used. and `<path.conf>/hunspell` is always used.
=== Java API Transport API construction
The `TransportClient` construction code has changed, it now uses the builder
pattern. Instead of using:
[source,java]
--------------------------------------------------
Settings settings = ImmutableSettings.settingsBuilder()
.put("cluster.name", "myClusterName").build();
Client client = new TransportClient(settings);
Use:
[source,java]
--------------------------------------------------
Settings settings = ImmutableSettings.settingsBuilder()
.put("cluster.name", "myClusterName").build();
Client client = TransportClient.builder().settings(settings).build();
--------------------------------------------------

View File

@ -24,7 +24,7 @@ import org.elasticsearch.client.ElasticsearchClient;
/** /**
* Base action. Supports building the <code>Request</code> through a <code>RequestBuilder</code>. * Base action. Supports building the <code>Request</code> through a <code>RequestBuilder</code>.
*/ */
public abstract class Action<Request extends ActionRequest, Response extends ActionResponse, RequestBuilder extends ActionRequestBuilder<Request, Response, RequestBuilder, Client>, Client extends ElasticsearchClient> public abstract class Action<Request extends ActionRequest, Response extends ActionResponse, RequestBuilder extends ActionRequestBuilder<Request, Response, RequestBuilder>>
extends GenericAction<Request, Response> { extends GenericAction<Request, Response> {
protected Action(String name) { protected Action(String name) {
@ -34,5 +34,5 @@ public abstract class Action<Request extends ActionRequest, Response extends Act
/** /**
* Creates a new request builder given the client provided as argument * Creates a new request builder given the client provided as argument
*/ */
public abstract RequestBuilder newRequestBuilder(Client client); public abstract RequestBuilder newRequestBuilder(ElasticsearchClient client);
} }

View File

@ -19,6 +19,7 @@
package org.elasticsearch.action; package org.elasticsearch.action;
import com.google.common.base.Preconditions;
import org.elasticsearch.ElasticsearchException; import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.action.support.PlainListenableActionFuture; import org.elasticsearch.action.support.PlainListenableActionFuture;
import org.elasticsearch.client.Client; import org.elasticsearch.client.Client;
@ -26,18 +27,22 @@ import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.client.ElasticsearchClient; import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.client.IndicesAdminClient; import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.search.aggregations.reducers.ReducerBuilder;
import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.threadpool.ThreadPool;
/** /**
* *
*/ */
public abstract class ActionRequestBuilder<Request extends ActionRequest, Response extends ActionResponse, RequestBuilder extends ActionRequestBuilder, Client extends ElasticsearchClient> { public abstract class ActionRequestBuilder<Request extends ActionRequest, Response extends ActionResponse, RequestBuilder extends ActionRequestBuilder<Request, Response, RequestBuilder>> {
protected final Action<Request, Response, RequestBuilder> action;
protected final Request request; protected final Request request;
private final ThreadPool threadPool; private final ThreadPool threadPool;
protected final Client client; protected final ElasticsearchClient client;
protected ActionRequestBuilder(Client client, Request request) { protected ActionRequestBuilder(ElasticsearchClient client, Action<Request, Response, RequestBuilder> action, Request request) {
Preconditions.checkNotNull(action, "action must not be null");
this.action = action;
this.request = request; this.request = request;
this.client = client; this.client = client;
threadPool = client.threadPool(); threadPool = client.threadPool();
@ -81,9 +86,14 @@ public abstract class ActionRequestBuilder<Request extends ActionRequest, Respon
return execute().actionGet(timeout); return execute().actionGet(timeout);
} }
public void execute(ActionListener<Response> listener) { public final void execute(ActionListener<Response> listener) {
doExecute(listener); client.execute(action, beforeExecute(request), listener);
} }
protected abstract void doExecute(ActionListener<Response> listener); /**
* A callback to additionally process the request before its executed
*/
protected Request beforeExecute(Request request) {
return request;
}
} }

View File

@ -1,33 +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.action;
import org.elasticsearch.client.Client;
/**
* Action (used with {@link Client} API).
*/
public abstract class ClientAction<Request extends ActionRequest, Response extends ActionResponse, RequestBuilder extends ActionRequestBuilder<Request, Response, RequestBuilder, Client>>
extends Action<Request, Response, RequestBuilder, Client> {
protected ClientAction(String name) {
super(name);
}
}

View File

@ -1,37 +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.action.admin.cluster;
import org.elasticsearch.action.Action;
import org.elasticsearch.action.ActionRequest;
import org.elasticsearch.action.ActionRequestBuilder;
import org.elasticsearch.action.ActionResponse;
import org.elasticsearch.client.ClusterAdminClient;
/**
* Cluster action (used with {@link ClusterAdminClient} API).
*/
public abstract class ClusterAction<Request extends ActionRequest, Response extends ActionResponse, RequestBuilder extends ActionRequestBuilder<Request, Response, RequestBuilder, ClusterAdminClient>>
extends Action<Request, Response, RequestBuilder, ClusterAdminClient> {
protected ClusterAction(String name) {
super(name);
}
}

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.cluster.health; package org.elasticsearch.action.admin.cluster.health;
import org.elasticsearch.action.admin.cluster.ClusterAction; import org.elasticsearch.action.Action;
import org.elasticsearch.client.ClusterAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
*/ */
public class ClusterHealthAction extends ClusterAction<ClusterHealthRequest, ClusterHealthResponse, ClusterHealthRequestBuilder> { public class ClusterHealthAction extends Action<ClusterHealthRequest, ClusterHealthResponse, ClusterHealthRequestBuilder> {
public static final ClusterHealthAction INSTANCE = new ClusterHealthAction(); public static final ClusterHealthAction INSTANCE = new ClusterHealthAction();
public static final String NAME = "cluster:monitor/health"; public static final String NAME = "cluster:monitor/health";
@ -39,7 +39,7 @@ public class ClusterHealthAction extends ClusterAction<ClusterHealthRequest, Clu
} }
@Override @Override
public ClusterHealthRequestBuilder newRequestBuilder(ClusterAdminClient client) { public ClusterHealthRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new ClusterHealthRequestBuilder(client); return new ClusterHealthRequestBuilder(client, this);
} }
} }

View File

@ -19,19 +19,18 @@
package org.elasticsearch.action.admin.cluster.health; package org.elasticsearch.action.admin.cluster.health;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.master.MasterNodeReadOperationRequestBuilder; import org.elasticsearch.action.support.master.MasterNodeReadOperationRequestBuilder;
import org.elasticsearch.client.ClusterAdminClient; import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.common.Priority; import org.elasticsearch.common.Priority;
import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.unit.TimeValue;
/** /**
* *
*/ */
public class ClusterHealthRequestBuilder extends MasterNodeReadOperationRequestBuilder<ClusterHealthRequest, ClusterHealthResponse, ClusterHealthRequestBuilder, ClusterAdminClient> { public class ClusterHealthRequestBuilder extends MasterNodeReadOperationRequestBuilder<ClusterHealthRequest, ClusterHealthResponse, ClusterHealthRequestBuilder> {
public ClusterHealthRequestBuilder(ClusterAdminClient clusterClient) { public ClusterHealthRequestBuilder(ElasticsearchClient client, ClusterHealthAction action) {
super(clusterClient, new ClusterHealthRequest()); super(client, action, new ClusterHealthRequest());
} }
public ClusterHealthRequestBuilder setIndices(String... indices) { public ClusterHealthRequestBuilder setIndices(String... indices) {
@ -86,9 +85,4 @@ public class ClusterHealthRequestBuilder extends MasterNodeReadOperationRequestB
request.waitForEvents(waitForEvents); request.waitForEvents(waitForEvents);
return this; return this;
} }
@Override
protected void doExecute(ActionListener<ClusterHealthResponse> listener) {
client.health(request, listener);
}
} }

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.cluster.node.hotthreads; package org.elasticsearch.action.admin.cluster.node.hotthreads;
import org.elasticsearch.action.admin.cluster.ClusterAction; import org.elasticsearch.action.Action;
import org.elasticsearch.client.ClusterAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
*/ */
public class NodesHotThreadsAction extends ClusterAction<NodesHotThreadsRequest, NodesHotThreadsResponse, NodesHotThreadsRequestBuilder> { public class NodesHotThreadsAction extends Action<NodesHotThreadsRequest, NodesHotThreadsResponse, NodesHotThreadsRequestBuilder> {
public static final NodesHotThreadsAction INSTANCE = new NodesHotThreadsAction(); public static final NodesHotThreadsAction INSTANCE = new NodesHotThreadsAction();
public static final String NAME = "cluster:monitor/nodes/hot_threads"; public static final String NAME = "cluster:monitor/nodes/hot_threads";
@ -39,7 +39,7 @@ public class NodesHotThreadsAction extends ClusterAction<NodesHotThreadsRequest,
} }
@Override @Override
public NodesHotThreadsRequestBuilder newRequestBuilder(ClusterAdminClient client) { public NodesHotThreadsRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new NodesHotThreadsRequestBuilder(client); return new NodesHotThreadsRequestBuilder(client, this);
} }
} }

View File

@ -22,14 +22,15 @@ package org.elasticsearch.action.admin.cluster.node.hotthreads;
import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.nodes.NodesOperationRequestBuilder; import org.elasticsearch.action.support.nodes.NodesOperationRequestBuilder;
import org.elasticsearch.client.ClusterAdminClient; import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.unit.TimeValue;
/** /**
*/ */
public class NodesHotThreadsRequestBuilder extends NodesOperationRequestBuilder<NodesHotThreadsRequest, NodesHotThreadsResponse, NodesHotThreadsRequestBuilder> { public class NodesHotThreadsRequestBuilder extends NodesOperationRequestBuilder<NodesHotThreadsRequest, NodesHotThreadsResponse, NodesHotThreadsRequestBuilder> {
public NodesHotThreadsRequestBuilder(ClusterAdminClient clusterClient) { public NodesHotThreadsRequestBuilder(ElasticsearchClient client, NodesHotThreadsAction action) {
super(clusterClient, new NodesHotThreadsRequest()); super(client, action, new NodesHotThreadsRequest());
} }
public NodesHotThreadsRequestBuilder setThreads(int threads) { public NodesHotThreadsRequestBuilder setThreads(int threads) {
@ -51,9 +52,4 @@ public class NodesHotThreadsRequestBuilder extends NodesOperationRequestBuilder<
request.interval(interval); request.interval(interval);
return this; return this;
} }
@Override
protected void doExecute(ActionListener<NodesHotThreadsResponse> listener) {
client.nodesHotThreads(request, listener);
}
} }

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.cluster.node.info; package org.elasticsearch.action.admin.cluster.node.info;
import org.elasticsearch.action.admin.cluster.ClusterAction; import org.elasticsearch.action.Action;
import org.elasticsearch.client.ClusterAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
*/ */
public class NodesInfoAction extends ClusterAction<NodesInfoRequest, NodesInfoResponse, NodesInfoRequestBuilder> { public class NodesInfoAction extends Action<NodesInfoRequest, NodesInfoResponse, NodesInfoRequestBuilder> {
public static final NodesInfoAction INSTANCE = new NodesInfoAction(); public static final NodesInfoAction INSTANCE = new NodesInfoAction();
public static final String NAME = "cluster:monitor/nodes/info"; public static final String NAME = "cluster:monitor/nodes/info";
@ -39,7 +39,7 @@ public class NodesInfoAction extends ClusterAction<NodesInfoRequest, NodesInfoRe
} }
@Override @Override
public NodesInfoRequestBuilder newRequestBuilder(ClusterAdminClient client) { public NodesInfoRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new NodesInfoRequestBuilder(client); return new NodesInfoRequestBuilder(client, this);
} }
} }

View File

@ -19,17 +19,16 @@
package org.elasticsearch.action.admin.cluster.node.info; package org.elasticsearch.action.admin.cluster.node.info;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.nodes.NodesOperationRequestBuilder; import org.elasticsearch.action.support.nodes.NodesOperationRequestBuilder;
import org.elasticsearch.client.ClusterAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
* *
*/ */
public class NodesInfoRequestBuilder extends NodesOperationRequestBuilder<NodesInfoRequest, NodesInfoResponse, NodesInfoRequestBuilder> { public class NodesInfoRequestBuilder extends NodesOperationRequestBuilder<NodesInfoRequest, NodesInfoResponse, NodesInfoRequestBuilder> {
public NodesInfoRequestBuilder(ClusterAdminClient clusterClient) { public NodesInfoRequestBuilder(ElasticsearchClient client, NodesInfoAction action) {
super(clusterClient, new NodesInfoRequest()); super(client, action, new NodesInfoRequest());
} }
/** /**
@ -119,9 +118,4 @@ public class NodesInfoRequestBuilder extends NodesOperationRequestBuilder<NodesI
request().plugins(plugins); request().plugins(plugins);
return this; return this;
} }
@Override
protected void doExecute(ActionListener<NodesInfoResponse> listener) {
client.nodesInfo(request, listener);
}
} }

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.cluster.node.stats; package org.elasticsearch.action.admin.cluster.node.stats;
import org.elasticsearch.action.admin.cluster.ClusterAction; import org.elasticsearch.action.Action;
import org.elasticsearch.client.ClusterAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
*/ */
public class NodesStatsAction extends ClusterAction<NodesStatsRequest, NodesStatsResponse, NodesStatsRequestBuilder> { public class NodesStatsAction extends Action<NodesStatsRequest, NodesStatsResponse, NodesStatsRequestBuilder> {
public static final NodesStatsAction INSTANCE = new NodesStatsAction(); public static final NodesStatsAction INSTANCE = new NodesStatsAction();
public static final String NAME = "cluster:monitor/nodes/stats"; public static final String NAME = "cluster:monitor/nodes/stats";
@ -39,7 +39,7 @@ public class NodesStatsAction extends ClusterAction<NodesStatsRequest, NodesStat
} }
@Override @Override
public NodesStatsRequestBuilder newRequestBuilder(ClusterAdminClient client) { public NodesStatsRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new NodesStatsRequestBuilder(client); return new NodesStatsRequestBuilder(client, this);
} }
} }

View File

@ -22,15 +22,15 @@ package org.elasticsearch.action.admin.cluster.node.stats;
import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.admin.indices.stats.CommonStatsFlags; import org.elasticsearch.action.admin.indices.stats.CommonStatsFlags;
import org.elasticsearch.action.support.nodes.NodesOperationRequestBuilder; import org.elasticsearch.action.support.nodes.NodesOperationRequestBuilder;
import org.elasticsearch.client.ClusterAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
* *
*/ */
public class NodesStatsRequestBuilder extends NodesOperationRequestBuilder<NodesStatsRequest, NodesStatsResponse, NodesStatsRequestBuilder> { public class NodesStatsRequestBuilder extends NodesOperationRequestBuilder<NodesStatsRequest, NodesStatsResponse, NodesStatsRequestBuilder> {
public NodesStatsRequestBuilder(ClusterAdminClient clusterClient) { public NodesStatsRequestBuilder(ElasticsearchClient client, NodesStatsAction action) {
super(clusterClient, new NodesStatsRequest()); super(client, action, new NodesStatsRequest());
} }
/** /**
@ -133,9 +133,4 @@ public class NodesStatsRequestBuilder extends NodesOperationRequestBuilder<Nodes
request.http(http); request.http(http);
return this; return this;
} }
@Override
protected void doExecute(ActionListener<NodesStatsResponse> listener) {
client.nodesStats(request, listener);
}
} }

View File

@ -19,13 +19,13 @@
package org.elasticsearch.action.admin.cluster.repositories.delete; package org.elasticsearch.action.admin.cluster.repositories.delete;
import org.elasticsearch.action.admin.cluster.ClusterAction; import org.elasticsearch.action.Action;
import org.elasticsearch.client.ClusterAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
* Unregister repository action * Unregister repository action
*/ */
public class DeleteRepositoryAction extends ClusterAction<DeleteRepositoryRequest, DeleteRepositoryResponse, DeleteRepositoryRequestBuilder> { public class DeleteRepositoryAction extends Action<DeleteRepositoryRequest, DeleteRepositoryResponse, DeleteRepositoryRequestBuilder> {
public static final DeleteRepositoryAction INSTANCE = new DeleteRepositoryAction(); public static final DeleteRepositoryAction INSTANCE = new DeleteRepositoryAction();
public static final String NAME = "cluster:admin/repository/delete"; public static final String NAME = "cluster:admin/repository/delete";
@ -40,8 +40,8 @@ public class DeleteRepositoryAction extends ClusterAction<DeleteRepositoryReques
} }
@Override @Override
public DeleteRepositoryRequestBuilder newRequestBuilder(ClusterAdminClient client) { public DeleteRepositoryRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new DeleteRepositoryRequestBuilder(client); return new DeleteRepositoryRequestBuilder(client, this);
} }
} }

View File

@ -19,31 +19,26 @@
package org.elasticsearch.action.admin.cluster.repositories.delete; package org.elasticsearch.action.admin.cluster.repositories.delete;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.master.AcknowledgedRequestBuilder; import org.elasticsearch.action.support.master.AcknowledgedRequestBuilder;
import org.elasticsearch.client.ClusterAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
* Builder for unregister repository request * Builder for unregister repository request
*/ */
public class DeleteRepositoryRequestBuilder extends AcknowledgedRequestBuilder<DeleteRepositoryRequest, DeleteRepositoryResponse, DeleteRepositoryRequestBuilder, ClusterAdminClient> { public class DeleteRepositoryRequestBuilder extends AcknowledgedRequestBuilder<DeleteRepositoryRequest, DeleteRepositoryResponse, DeleteRepositoryRequestBuilder> {
/** /**
* Constructs unregister repository request builder * Constructs unregister repository request builder
*
* @param clusterAdminClient cluster admin client
*/ */
public DeleteRepositoryRequestBuilder(ClusterAdminClient clusterAdminClient) { public DeleteRepositoryRequestBuilder(ElasticsearchClient client, DeleteRepositoryAction action) {
super(clusterAdminClient, new DeleteRepositoryRequest()); super(client, action, new DeleteRepositoryRequest());
} }
/** /**
* Constructs unregister repository request builder with specified repository name * Constructs unregister repository request builder with specified repository name
*
* @param clusterAdminClient cluster adming client
*/ */
public DeleteRepositoryRequestBuilder(ClusterAdminClient clusterAdminClient, String name) { public DeleteRepositoryRequestBuilder(ElasticsearchClient client, DeleteRepositoryAction action, String name) {
super(clusterAdminClient, new DeleteRepositoryRequest(name)); super(client, action, new DeleteRepositoryRequest(name));
} }
/** /**
@ -55,9 +50,4 @@ public class DeleteRepositoryRequestBuilder extends AcknowledgedRequestBuilder<D
request.name(name); request.name(name);
return this; return this;
} }
@Override
protected void doExecute(ActionListener<DeleteRepositoryResponse> listener) {
client.deleteRepository(request, listener);
}
} }

View File

@ -19,13 +19,13 @@
package org.elasticsearch.action.admin.cluster.repositories.get; package org.elasticsearch.action.admin.cluster.repositories.get;
import org.elasticsearch.action.admin.cluster.ClusterAction; import org.elasticsearch.action.Action;
import org.elasticsearch.client.ClusterAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
* Get repositories action * Get repositories action
*/ */
public class GetRepositoriesAction extends ClusterAction<GetRepositoriesRequest, GetRepositoriesResponse, GetRepositoriesRequestBuilder> { public class GetRepositoriesAction extends Action<GetRepositoriesRequest, GetRepositoriesResponse, GetRepositoriesRequestBuilder> {
public static final GetRepositoriesAction INSTANCE = new GetRepositoriesAction(); public static final GetRepositoriesAction INSTANCE = new GetRepositoriesAction();
public static final String NAME = "cluster:admin/repository/get"; public static final String NAME = "cluster:admin/repository/get";
@ -40,8 +40,8 @@ public class GetRepositoriesAction extends ClusterAction<GetRepositoriesRequest,
} }
@Override @Override
public GetRepositoriesRequestBuilder newRequestBuilder(ClusterAdminClient client) { public GetRepositoriesRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new GetRepositoriesRequestBuilder(client); return new GetRepositoriesRequestBuilder(client, this);
} }
} }

View File

@ -20,32 +20,26 @@
package org.elasticsearch.action.admin.cluster.repositories.get; package org.elasticsearch.action.admin.cluster.repositories.get;
import com.google.common.collect.ObjectArrays; import com.google.common.collect.ObjectArrays;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.master.MasterNodeReadOperationRequestBuilder; import org.elasticsearch.action.support.master.MasterNodeReadOperationRequestBuilder;
import org.elasticsearch.client.ClusterAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
* Get repository request builder * Get repository request builder
*/ */
public class GetRepositoriesRequestBuilder extends MasterNodeReadOperationRequestBuilder<GetRepositoriesRequest, GetRepositoriesResponse, GetRepositoriesRequestBuilder, ClusterAdminClient> { public class GetRepositoriesRequestBuilder extends MasterNodeReadOperationRequestBuilder<GetRepositoriesRequest, GetRepositoriesResponse, GetRepositoriesRequestBuilder> {
/** /**
* Creates new get repository request builder * Creates new get repository request builder
*
* @param clusterAdminClient cluster admin client
*/ */
public GetRepositoriesRequestBuilder(ClusterAdminClient clusterAdminClient) { public GetRepositoriesRequestBuilder(ElasticsearchClient client, GetRepositoriesAction action) {
super(clusterAdminClient, new GetRepositoriesRequest()); super(client, action, new GetRepositoriesRequest());
} }
/** /**
* Creates new get repository request builder * Creates new get repository request builder
*
* @param clusterAdminClient cluster admin client
* @param repositories list of repositories to get
*/ */
public GetRepositoriesRequestBuilder(ClusterAdminClient clusterAdminClient, String... repositories) { public GetRepositoriesRequestBuilder(ElasticsearchClient client, GetRepositoriesAction action, String... repositories) {
super(clusterAdminClient, new GetRepositoriesRequest(repositories)); super(client, action, new GetRepositoriesRequest(repositories));
} }
/** /**
@ -69,9 +63,4 @@ public class GetRepositoriesRequestBuilder extends MasterNodeReadOperationReques
request.repositories(ObjectArrays.concat(request.repositories(), repositories, String.class)); request.repositories(ObjectArrays.concat(request.repositories(), repositories, String.class));
return this; return this;
} }
@Override
protected void doExecute(ActionListener<GetRepositoriesResponse> listener) {
client.getRepositories(request, listener);
}
} }

View File

@ -19,13 +19,13 @@
package org.elasticsearch.action.admin.cluster.repositories.put; package org.elasticsearch.action.admin.cluster.repositories.put;
import org.elasticsearch.action.admin.cluster.ClusterAction; import org.elasticsearch.action.Action;
import org.elasticsearch.client.ClusterAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
* Register repository action * Register repository action
*/ */
public class PutRepositoryAction extends ClusterAction<PutRepositoryRequest, PutRepositoryResponse, PutRepositoryRequestBuilder> { public class PutRepositoryAction extends Action<PutRepositoryRequest, PutRepositoryResponse, PutRepositoryRequestBuilder> {
public static final PutRepositoryAction INSTANCE = new PutRepositoryAction(); public static final PutRepositoryAction INSTANCE = new PutRepositoryAction();
public static final String NAME = "cluster:admin/repository/put"; public static final String NAME = "cluster:admin/repository/put";
@ -40,8 +40,8 @@ public class PutRepositoryAction extends ClusterAction<PutRepositoryRequest, Put
} }
@Override @Override
public PutRepositoryRequestBuilder newRequestBuilder(ClusterAdminClient client) { public PutRepositoryRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new PutRepositoryRequestBuilder(client); return new PutRepositoryRequestBuilder(client, this);
} }
} }

View File

@ -21,7 +21,7 @@ package org.elasticsearch.action.admin.cluster.repositories.put;
import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.master.AcknowledgedRequestBuilder; import org.elasticsearch.action.support.master.AcknowledgedRequestBuilder;
import org.elasticsearch.client.ClusterAdminClient; import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import java.util.Map; import java.util.Map;
@ -29,25 +29,20 @@ import java.util.Map;
/** /**
* Register repository request builder * Register repository request builder
*/ */
public class PutRepositoryRequestBuilder extends AcknowledgedRequestBuilder<PutRepositoryRequest, PutRepositoryResponse, PutRepositoryRequestBuilder, ClusterAdminClient> { public class PutRepositoryRequestBuilder extends AcknowledgedRequestBuilder<PutRepositoryRequest, PutRepositoryResponse, PutRepositoryRequestBuilder> {
/** /**
* Constructs register repository request * Constructs register repository request
*
* @param clusterAdminClient cluster admin client
*/ */
public PutRepositoryRequestBuilder(ClusterAdminClient clusterAdminClient) { public PutRepositoryRequestBuilder(ElasticsearchClient client, PutRepositoryAction action) {
super(clusterAdminClient, new PutRepositoryRequest()); super(client, action, new PutRepositoryRequest());
} }
/** /**
* Constructs register repository request for the repository with a given name * Constructs register repository request for the repository with a given name
*
* @param clusterAdminClient cluster admin client
* @param name repository name
*/ */
public PutRepositoryRequestBuilder(ClusterAdminClient clusterAdminClient, String name) { public PutRepositoryRequestBuilder(ElasticsearchClient client, PutRepositoryAction action, String name) {
super(clusterAdminClient, new PutRepositoryRequest(name)); super(client, action, new PutRepositoryRequest(name));
} }
/** /**
@ -126,9 +121,4 @@ public class PutRepositoryRequestBuilder extends AcknowledgedRequestBuilder<PutR
request.verify(verify); request.verify(verify);
return this; return this;
} }
@Override
protected void doExecute(ActionListener<PutRepositoryResponse> listener) {
client.putRepository(request, listener);
}
} }

View File

@ -19,13 +19,13 @@
package org.elasticsearch.action.admin.cluster.repositories.verify; package org.elasticsearch.action.admin.cluster.repositories.verify;
import org.elasticsearch.action.admin.cluster.ClusterAction; import org.elasticsearch.action.Action;
import org.elasticsearch.client.ClusterAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
* Unregister repository action * Unregister repository action
*/ */
public class VerifyRepositoryAction extends ClusterAction<VerifyRepositoryRequest, VerifyRepositoryResponse, VerifyRepositoryRequestBuilder> { public class VerifyRepositoryAction extends Action<VerifyRepositoryRequest, VerifyRepositoryResponse, VerifyRepositoryRequestBuilder> {
public static final VerifyRepositoryAction INSTANCE = new VerifyRepositoryAction(); public static final VerifyRepositoryAction INSTANCE = new VerifyRepositoryAction();
public static final String NAME = "cluster:admin/repository/verify"; public static final String NAME = "cluster:admin/repository/verify";
@ -40,8 +40,8 @@ public class VerifyRepositoryAction extends ClusterAction<VerifyRepositoryReques
} }
@Override @Override
public VerifyRepositoryRequestBuilder newRequestBuilder(ClusterAdminClient client) { public VerifyRepositoryRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new VerifyRepositoryRequestBuilder(client); return new VerifyRepositoryRequestBuilder(client, this);
} }
} }

View File

@ -19,32 +19,26 @@
package org.elasticsearch.action.admin.cluster.repositories.verify; package org.elasticsearch.action.admin.cluster.repositories.verify;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.master.AcknowledgedRequestBuilder;
import org.elasticsearch.action.support.master.MasterNodeOperationRequestBuilder; import org.elasticsearch.action.support.master.MasterNodeOperationRequestBuilder;
import org.elasticsearch.client.ClusterAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
* Builder for unregister repository request * Builder for unregister repository request
*/ */
public class VerifyRepositoryRequestBuilder extends MasterNodeOperationRequestBuilder<VerifyRepositoryRequest, VerifyRepositoryResponse, VerifyRepositoryRequestBuilder, ClusterAdminClient> { public class VerifyRepositoryRequestBuilder extends MasterNodeOperationRequestBuilder<VerifyRepositoryRequest, VerifyRepositoryResponse, VerifyRepositoryRequestBuilder> {
/** /**
* Constructs unregister repository request builder * Constructs unregister repository request builder
*
* @param clusterAdminClient cluster admin client
*/ */
public VerifyRepositoryRequestBuilder(ClusterAdminClient clusterAdminClient) { public VerifyRepositoryRequestBuilder(ElasticsearchClient client, VerifyRepositoryAction action) {
super(clusterAdminClient, new VerifyRepositoryRequest()); super(client, action, new VerifyRepositoryRequest());
} }
/** /**
* Constructs unregister repository request builder with specified repository name * Constructs unregister repository request builder with specified repository name
*
* @param clusterAdminClient cluster adming client
*/ */
public VerifyRepositoryRequestBuilder(ClusterAdminClient clusterAdminClient, String name) { public VerifyRepositoryRequestBuilder(ElasticsearchClient client, VerifyRepositoryAction action, String name) {
super(clusterAdminClient, new VerifyRepositoryRequest(name)); super(client, action, new VerifyRepositoryRequest(name));
} }
/** /**
@ -56,9 +50,4 @@ public class VerifyRepositoryRequestBuilder extends MasterNodeOperationRequestBu
request.name(name); request.name(name);
return this; return this;
} }
@Override
protected void doExecute(ActionListener<VerifyRepositoryResponse> listener) {
client.verifyRepository(request, listener);
}
} }

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.cluster.reroute; package org.elasticsearch.action.admin.cluster.reroute;
import org.elasticsearch.action.admin.cluster.ClusterAction; import org.elasticsearch.action.Action;
import org.elasticsearch.client.ClusterAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
*/ */
public class ClusterRerouteAction extends ClusterAction<ClusterRerouteRequest, ClusterRerouteResponse, ClusterRerouteRequestBuilder> { public class ClusterRerouteAction extends Action<ClusterRerouteRequest, ClusterRerouteResponse, ClusterRerouteRequestBuilder> {
public static final ClusterRerouteAction INSTANCE = new ClusterRerouteAction(); public static final ClusterRerouteAction INSTANCE = new ClusterRerouteAction();
public static final String NAME = "cluster:admin/reroute"; public static final String NAME = "cluster:admin/reroute";
@ -39,7 +39,7 @@ public class ClusterRerouteAction extends ClusterAction<ClusterRerouteRequest, C
} }
@Override @Override
public ClusterRerouteRequestBuilder newRequestBuilder(ClusterAdminClient client) { public ClusterRerouteRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new ClusterRerouteRequestBuilder(client); return new ClusterRerouteRequestBuilder(client, this);
} }
} }

View File

@ -19,19 +19,18 @@
package org.elasticsearch.action.admin.cluster.reroute; package org.elasticsearch.action.admin.cluster.reroute;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.master.AcknowledgedRequestBuilder; import org.elasticsearch.action.support.master.AcknowledgedRequestBuilder;
import org.elasticsearch.client.ClusterAdminClient; import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.cluster.routing.allocation.command.AllocationCommand; import org.elasticsearch.cluster.routing.allocation.command.AllocationCommand;
import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.bytes.BytesReference;
/** /**
* Builder for a cluster reroute request * Builder for a cluster reroute request
*/ */
public class ClusterRerouteRequestBuilder extends AcknowledgedRequestBuilder<ClusterRerouteRequest, ClusterRerouteResponse, ClusterRerouteRequestBuilder, ClusterAdminClient> { public class ClusterRerouteRequestBuilder extends AcknowledgedRequestBuilder<ClusterRerouteRequest, ClusterRerouteResponse, ClusterRerouteRequestBuilder> {
public ClusterRerouteRequestBuilder(ClusterAdminClient clusterClient) { public ClusterRerouteRequestBuilder(ElasticsearchClient client, ClusterRerouteAction action) {
super(clusterClient, new ClusterRerouteRequest()); super(client, action, new ClusterRerouteRequest());
} }
/** /**
@ -68,9 +67,4 @@ public class ClusterRerouteRequestBuilder extends AcknowledgedRequestBuilder<Clu
request.source(source); request.source(source);
return this; return this;
} }
@Override
protected void doExecute(ActionListener<ClusterRerouteResponse> listener) {
client.reroute(request, listener);
}
} }

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.cluster.settings; package org.elasticsearch.action.admin.cluster.settings;
import org.elasticsearch.action.admin.cluster.ClusterAction; import org.elasticsearch.action.Action;
import org.elasticsearch.client.ClusterAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
*/ */
public class ClusterUpdateSettingsAction extends ClusterAction<ClusterUpdateSettingsRequest, ClusterUpdateSettingsResponse, ClusterUpdateSettingsRequestBuilder> { public class ClusterUpdateSettingsAction extends Action<ClusterUpdateSettingsRequest, ClusterUpdateSettingsResponse, ClusterUpdateSettingsRequestBuilder> {
public static final ClusterUpdateSettingsAction INSTANCE = new ClusterUpdateSettingsAction(); public static final ClusterUpdateSettingsAction INSTANCE = new ClusterUpdateSettingsAction();
public static final String NAME = "cluster:admin/settings/update"; public static final String NAME = "cluster:admin/settings/update";
@ -39,7 +39,7 @@ public class ClusterUpdateSettingsAction extends ClusterAction<ClusterUpdateSett
} }
@Override @Override
public ClusterUpdateSettingsRequestBuilder newRequestBuilder(ClusterAdminClient client) { public ClusterUpdateSettingsRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new ClusterUpdateSettingsRequestBuilder(client); return new ClusterUpdateSettingsRequestBuilder(client, this);
} }
} }

View File

@ -19,9 +19,8 @@
package org.elasticsearch.action.admin.cluster.settings; package org.elasticsearch.action.admin.cluster.settings;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.master.AcknowledgedRequestBuilder; import org.elasticsearch.action.support.master.AcknowledgedRequestBuilder;
import org.elasticsearch.client.ClusterAdminClient; import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import java.util.Map; import java.util.Map;
@ -29,10 +28,10 @@ import java.util.Map;
/** /**
* Builder for a cluster update settings request * Builder for a cluster update settings request
*/ */
public class ClusterUpdateSettingsRequestBuilder extends AcknowledgedRequestBuilder<ClusterUpdateSettingsRequest, ClusterUpdateSettingsResponse, ClusterUpdateSettingsRequestBuilder, ClusterAdminClient> { public class ClusterUpdateSettingsRequestBuilder extends AcknowledgedRequestBuilder<ClusterUpdateSettingsRequest, ClusterUpdateSettingsResponse, ClusterUpdateSettingsRequestBuilder> {
public ClusterUpdateSettingsRequestBuilder(ClusterAdminClient clusterClient) { public ClusterUpdateSettingsRequestBuilder(ElasticsearchClient client, ClusterUpdateSettingsAction action) {
super(clusterClient, new ClusterUpdateSettingsRequest()); super(client, action, new ClusterUpdateSettingsRequest());
} }
/** /**
@ -98,9 +97,4 @@ public class ClusterUpdateSettingsRequestBuilder extends AcknowledgedRequestBuil
request.persistentSettings(settings); request.persistentSettings(settings);
return this; return this;
} }
@Override
protected void doExecute(ActionListener<ClusterUpdateSettingsResponse> listener) {
client.updateSettings(request, listener);
}
} }

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.cluster.shards; package org.elasticsearch.action.admin.cluster.shards;
import org.elasticsearch.action.admin.cluster.ClusterAction; import org.elasticsearch.action.Action;
import org.elasticsearch.client.ClusterAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
*/ */
public class ClusterSearchShardsAction extends ClusterAction<ClusterSearchShardsRequest, ClusterSearchShardsResponse, ClusterSearchShardsRequestBuilder> { public class ClusterSearchShardsAction extends Action<ClusterSearchShardsRequest, ClusterSearchShardsResponse, ClusterSearchShardsRequestBuilder> {
public static final ClusterSearchShardsAction INSTANCE = new ClusterSearchShardsAction(); public static final ClusterSearchShardsAction INSTANCE = new ClusterSearchShardsAction();
public static final String NAME = "indices:admin/shards/search_shards"; public static final String NAME = "indices:admin/shards/search_shards";
@ -39,7 +39,7 @@ public class ClusterSearchShardsAction extends ClusterAction<ClusterSearchShards
} }
@Override @Override
public ClusterSearchShardsRequestBuilder newRequestBuilder(ClusterAdminClient client) { public ClusterSearchShardsRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new ClusterSearchShardsRequestBuilder(client); return new ClusterSearchShardsRequestBuilder(client, this);
} }
} }

View File

@ -19,17 +19,16 @@
package org.elasticsearch.action.admin.cluster.shards; package org.elasticsearch.action.admin.cluster.shards;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.action.support.master.MasterNodeReadOperationRequestBuilder; import org.elasticsearch.action.support.master.MasterNodeReadOperationRequestBuilder;
import org.elasticsearch.client.ClusterAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
*/ */
public class ClusterSearchShardsRequestBuilder extends MasterNodeReadOperationRequestBuilder<ClusterSearchShardsRequest, ClusterSearchShardsResponse, ClusterSearchShardsRequestBuilder, ClusterAdminClient> { public class ClusterSearchShardsRequestBuilder extends MasterNodeReadOperationRequestBuilder<ClusterSearchShardsRequest, ClusterSearchShardsResponse, ClusterSearchShardsRequestBuilder> {
public ClusterSearchShardsRequestBuilder(ClusterAdminClient clusterClient) { public ClusterSearchShardsRequestBuilder(ElasticsearchClient client, ClusterSearchShardsAction action) {
super(clusterClient, new ClusterSearchShardsRequest()); super(client, action, new ClusterSearchShardsRequest());
} }
/** /**
@ -83,10 +82,4 @@ public class ClusterSearchShardsRequestBuilder extends MasterNodeReadOperationRe
request().indicesOptions(indicesOptions); request().indicesOptions(indicesOptions);
return this; return this;
} }
@Override
protected void doExecute(ActionListener<ClusterSearchShardsResponse> listener) {
client.searchShards(request, listener);
}
} }

View File

@ -19,13 +19,13 @@
package org.elasticsearch.action.admin.cluster.snapshots.create; package org.elasticsearch.action.admin.cluster.snapshots.create;
import org.elasticsearch.action.admin.cluster.ClusterAction; import org.elasticsearch.action.Action;
import org.elasticsearch.client.ClusterAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
* Create snapshot action * Create snapshot action
*/ */
public class CreateSnapshotAction extends ClusterAction<CreateSnapshotRequest, CreateSnapshotResponse, CreateSnapshotRequestBuilder> { public class CreateSnapshotAction extends Action<CreateSnapshotRequest, CreateSnapshotResponse, CreateSnapshotRequestBuilder> {
public static final CreateSnapshotAction INSTANCE = new CreateSnapshotAction(); public static final CreateSnapshotAction INSTANCE = new CreateSnapshotAction();
public static final String NAME = "cluster:admin/snapshot/create"; public static final String NAME = "cluster:admin/snapshot/create";
@ -40,8 +40,8 @@ public class CreateSnapshotAction extends ClusterAction<CreateSnapshotRequest, C
} }
@Override @Override
public CreateSnapshotRequestBuilder newRequestBuilder(ClusterAdminClient client) { public CreateSnapshotRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new CreateSnapshotRequestBuilder(client); return new CreateSnapshotRequestBuilder(client, this);
} }
} }

View File

@ -22,7 +22,7 @@ package org.elasticsearch.action.admin.cluster.snapshots.create;
import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.action.support.master.MasterNodeOperationRequestBuilder; import org.elasticsearch.action.support.master.MasterNodeOperationRequestBuilder;
import org.elasticsearch.client.ClusterAdminClient; import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import java.util.Map; import java.util.Map;
@ -30,26 +30,20 @@ import java.util.Map;
/** /**
* Create snapshot request builder * Create snapshot request builder
*/ */
public class CreateSnapshotRequestBuilder extends MasterNodeOperationRequestBuilder<CreateSnapshotRequest, CreateSnapshotResponse, CreateSnapshotRequestBuilder, ClusterAdminClient> { public class CreateSnapshotRequestBuilder extends MasterNodeOperationRequestBuilder<CreateSnapshotRequest, CreateSnapshotResponse, CreateSnapshotRequestBuilder> {
/** /**
* Constructs a new create snapshot request builder * Constructs a new create snapshot request builder
*
* @param clusterAdminClient cluster admin client
*/ */
public CreateSnapshotRequestBuilder(ClusterAdminClient clusterAdminClient) { public CreateSnapshotRequestBuilder(ElasticsearchClient client, CreateSnapshotAction action) {
super(clusterAdminClient, new CreateSnapshotRequest()); super(client, action, new CreateSnapshotRequest());
} }
/** /**
* Constructs a new create snapshot request builder with specified repository and snapshot names * Constructs a new create snapshot request builder with specified repository and snapshot names
*
* @param clusterAdminClient cluster admin client
* @param repository repository name
* @param snapshot snapshot name
*/ */
public CreateSnapshotRequestBuilder(ClusterAdminClient clusterAdminClient, String repository, String snapshot) { public CreateSnapshotRequestBuilder(ElasticsearchClient client, CreateSnapshotAction action, String repository, String snapshot) {
super(clusterAdminClient, new CreateSnapshotRequest(repository, snapshot)); super(client, action, new CreateSnapshotRequest(repository, snapshot));
} }
/** /**
@ -184,9 +178,4 @@ public class CreateSnapshotRequestBuilder extends MasterNodeOperationRequestBuil
request.includeGlobalState(includeGlobalState); request.includeGlobalState(includeGlobalState);
return this; return this;
} }
@Override
protected void doExecute(ActionListener<CreateSnapshotResponse> listener) {
client.createSnapshot(request, listener);
}
} }

View File

@ -19,13 +19,13 @@
package org.elasticsearch.action.admin.cluster.snapshots.delete; package org.elasticsearch.action.admin.cluster.snapshots.delete;
import org.elasticsearch.action.admin.cluster.ClusterAction; import org.elasticsearch.action.Action;
import org.elasticsearch.client.ClusterAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
* Delete snapshot action * Delete snapshot action
*/ */
public class DeleteSnapshotAction extends ClusterAction<DeleteSnapshotRequest, DeleteSnapshotResponse, DeleteSnapshotRequestBuilder> { public class DeleteSnapshotAction extends Action<DeleteSnapshotRequest, DeleteSnapshotResponse, DeleteSnapshotRequestBuilder> {
public static final DeleteSnapshotAction INSTANCE = new DeleteSnapshotAction(); public static final DeleteSnapshotAction INSTANCE = new DeleteSnapshotAction();
public static final String NAME = "cluster:admin/snapshot/delete"; public static final String NAME = "cluster:admin/snapshot/delete";
@ -40,8 +40,8 @@ public class DeleteSnapshotAction extends ClusterAction<DeleteSnapshotRequest, D
} }
@Override @Override
public DeleteSnapshotRequestBuilder newRequestBuilder(ClusterAdminClient client) { public DeleteSnapshotRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new DeleteSnapshotRequestBuilder(client); return new DeleteSnapshotRequestBuilder(client, this);
} }
} }

View File

@ -21,31 +21,25 @@ package org.elasticsearch.action.admin.cluster.snapshots.delete;
import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.master.MasterNodeOperationRequestBuilder; import org.elasticsearch.action.support.master.MasterNodeOperationRequestBuilder;
import org.elasticsearch.client.ClusterAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
* Delete snapshot request builder * Delete snapshot request builder
*/ */
public class DeleteSnapshotRequestBuilder extends MasterNodeOperationRequestBuilder<DeleteSnapshotRequest, DeleteSnapshotResponse, DeleteSnapshotRequestBuilder, ClusterAdminClient> { public class DeleteSnapshotRequestBuilder extends MasterNodeOperationRequestBuilder<DeleteSnapshotRequest, DeleteSnapshotResponse, DeleteSnapshotRequestBuilder> {
/** /**
* Constructs delete snapshot request builder * Constructs delete snapshot request builder
*
* @param clusterAdminClient cluster admin client
*/ */
public DeleteSnapshotRequestBuilder(ClusterAdminClient clusterAdminClient) { public DeleteSnapshotRequestBuilder(ElasticsearchClient client, DeleteSnapshotAction action) {
super(clusterAdminClient, new DeleteSnapshotRequest()); super(client, action, new DeleteSnapshotRequest());
} }
/** /**
* Constructs delete snapshot request builder with specified repository and snapshot names * Constructs delete snapshot request builder with specified repository and snapshot names
*
* @param clusterAdminClient cluster admin client
* @param repository repository name
* @param snapshot snapshot name
*/ */
public DeleteSnapshotRequestBuilder(ClusterAdminClient clusterAdminClient, String repository, String snapshot) { public DeleteSnapshotRequestBuilder(ElasticsearchClient client, DeleteSnapshotAction action, String repository, String snapshot) {
super(clusterAdminClient, new DeleteSnapshotRequest(repository, snapshot)); super(client, action, new DeleteSnapshotRequest(repository, snapshot));
} }
/** /**
@ -69,9 +63,4 @@ public class DeleteSnapshotRequestBuilder extends MasterNodeOperationRequestBuil
request.snapshot(snapshot); request.snapshot(snapshot);
return this; return this;
} }
@Override
protected void doExecute(ActionListener<DeleteSnapshotResponse> listener) {
client.deleteSnapshot(request, listener);
}
} }

View File

@ -19,13 +19,13 @@
package org.elasticsearch.action.admin.cluster.snapshots.get; package org.elasticsearch.action.admin.cluster.snapshots.get;
import org.elasticsearch.action.admin.cluster.ClusterAction; import org.elasticsearch.action.Action;
import org.elasticsearch.client.ClusterAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
* Get snapshots action * Get snapshots action
*/ */
public class GetSnapshotsAction extends ClusterAction<GetSnapshotsRequest, GetSnapshotsResponse, GetSnapshotsRequestBuilder> { public class GetSnapshotsAction extends Action<GetSnapshotsRequest, GetSnapshotsResponse, GetSnapshotsRequestBuilder> {
public static final GetSnapshotsAction INSTANCE = new GetSnapshotsAction(); public static final GetSnapshotsAction INSTANCE = new GetSnapshotsAction();
public static final String NAME = "cluster:admin/snapshot/get"; public static final String NAME = "cluster:admin/snapshot/get";
@ -40,8 +40,8 @@ public class GetSnapshotsAction extends ClusterAction<GetSnapshotsRequest, GetSn
} }
@Override @Override
public GetSnapshotsRequestBuilder newRequestBuilder(ClusterAdminClient client) { public GetSnapshotsRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new GetSnapshotsRequestBuilder(client); return new GetSnapshotsRequestBuilder(client, this);
} }
} }

View File

@ -20,32 +20,26 @@
package org.elasticsearch.action.admin.cluster.snapshots.get; package org.elasticsearch.action.admin.cluster.snapshots.get;
import com.google.common.collect.ObjectArrays; import com.google.common.collect.ObjectArrays;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.master.MasterNodeOperationRequestBuilder; import org.elasticsearch.action.support.master.MasterNodeOperationRequestBuilder;
import org.elasticsearch.client.ClusterAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
* Get snapshots request builder * Get snapshots request builder
*/ */
public class GetSnapshotsRequestBuilder extends MasterNodeOperationRequestBuilder<GetSnapshotsRequest, GetSnapshotsResponse, GetSnapshotsRequestBuilder, ClusterAdminClient> { public class GetSnapshotsRequestBuilder extends MasterNodeOperationRequestBuilder<GetSnapshotsRequest, GetSnapshotsResponse, GetSnapshotsRequestBuilder> {
/** /**
* Constructs the new get snapshot request * Constructs the new get snapshot request
*
* @param clusterAdminClient cluster admin client
*/ */
public GetSnapshotsRequestBuilder(ClusterAdminClient clusterAdminClient) { public GetSnapshotsRequestBuilder(ElasticsearchClient client, GetSnapshotsAction action) {
super(clusterAdminClient, new GetSnapshotsRequest()); super(client, action, new GetSnapshotsRequest());
} }
/** /**
* Constructs the new get snapshot request with specified repository * Constructs the new get snapshot request with specified repository
*
* @param clusterAdminClient cluster admin client
* @param repository repository name
*/ */
public GetSnapshotsRequestBuilder(ClusterAdminClient clusterAdminClient, String repository) { public GetSnapshotsRequestBuilder(ElasticsearchClient client, GetSnapshotsAction action, String repository) {
super(clusterAdminClient, new GetSnapshotsRequest(repository)); super(client, action, new GetSnapshotsRequest(repository));
} }
/** /**
@ -76,7 +70,7 @@ public class GetSnapshotsRequestBuilder extends MasterNodeOperationRequestBuilde
* @return this builder * @return this builder
*/ */
public GetSnapshotsRequestBuilder setCurrentSnapshot() { public GetSnapshotsRequestBuilder setCurrentSnapshot() {
request.snapshots(new String[] {GetSnapshotsRequest.CURRENT_SNAPSHOT}); request.snapshots(new String[]{GetSnapshotsRequest.CURRENT_SNAPSHOT});
return this; return this;
} }
@ -90,9 +84,4 @@ public class GetSnapshotsRequestBuilder extends MasterNodeOperationRequestBuilde
request.snapshots(ObjectArrays.concat(request.snapshots(), snapshots, String.class)); request.snapshots(ObjectArrays.concat(request.snapshots(), snapshots, String.class));
return this; return this;
} }
@Override
protected void doExecute(ActionListener<GetSnapshotsResponse> listener) {
client.getSnapshots(request, listener);
}
} }

View File

@ -19,13 +19,13 @@
package org.elasticsearch.action.admin.cluster.snapshots.restore; package org.elasticsearch.action.admin.cluster.snapshots.restore;
import org.elasticsearch.action.admin.cluster.ClusterAction; import org.elasticsearch.action.Action;
import org.elasticsearch.client.ClusterAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
* Restore snapshot action * Restore snapshot action
*/ */
public class RestoreSnapshotAction extends ClusterAction<RestoreSnapshotRequest, RestoreSnapshotResponse, RestoreSnapshotRequestBuilder> { public class RestoreSnapshotAction extends Action<RestoreSnapshotRequest, RestoreSnapshotResponse, RestoreSnapshotRequestBuilder> {
public static final RestoreSnapshotAction INSTANCE = new RestoreSnapshotAction(); public static final RestoreSnapshotAction INSTANCE = new RestoreSnapshotAction();
public static final String NAME = "cluster:admin/snapshot/restore"; public static final String NAME = "cluster:admin/snapshot/restore";
@ -40,8 +40,8 @@ public class RestoreSnapshotAction extends ClusterAction<RestoreSnapshotRequest,
} }
@Override @Override
public RestoreSnapshotRequestBuilder newRequestBuilder(ClusterAdminClient client) { public RestoreSnapshotRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new RestoreSnapshotRequestBuilder(client); return new RestoreSnapshotRequestBuilder(client, this);
} }
} }

View File

@ -19,10 +19,9 @@
package org.elasticsearch.action.admin.cluster.snapshots.restore; package org.elasticsearch.action.admin.cluster.snapshots.restore;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.action.support.master.MasterNodeOperationRequestBuilder; import org.elasticsearch.action.support.master.MasterNodeOperationRequestBuilder;
import org.elasticsearch.client.ClusterAdminClient; import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import java.util.List; import java.util.List;
@ -31,26 +30,20 @@ import java.util.Map;
/** /**
* Restore snapshot request builder * Restore snapshot request builder
*/ */
public class RestoreSnapshotRequestBuilder extends MasterNodeOperationRequestBuilder<RestoreSnapshotRequest, RestoreSnapshotResponse, RestoreSnapshotRequestBuilder, ClusterAdminClient> { public class RestoreSnapshotRequestBuilder extends MasterNodeOperationRequestBuilder<RestoreSnapshotRequest, RestoreSnapshotResponse, RestoreSnapshotRequestBuilder> {
/** /**
* Constructs new restore snapshot request builder * Constructs new restore snapshot request builder
*
* @param clusterAdminClient cluster admin client
*/ */
public RestoreSnapshotRequestBuilder(ClusterAdminClient clusterAdminClient) { public RestoreSnapshotRequestBuilder(ElasticsearchClient client, RestoreSnapshotAction action) {
super(clusterAdminClient, new RestoreSnapshotRequest()); super(client, action, new RestoreSnapshotRequest());
} }
/** /**
* Constructs new restore snapshot request builder with specified repository and snapshot names * Constructs new restore snapshot request builder with specified repository and snapshot names
*
* @param clusterAdminClient cluster admin client
* @param repository reposiory name
* @param name snapshot name
*/ */
public RestoreSnapshotRequestBuilder(ClusterAdminClient clusterAdminClient, String repository, String name) { public RestoreSnapshotRequestBuilder(ElasticsearchClient client, RestoreSnapshotAction action, String repository, String name) {
super(clusterAdminClient, new RestoreSnapshotRequest(repository, name)); super(client, action, new RestoreSnapshotRequest(repository, name));
} }
@ -233,6 +226,7 @@ public class RestoreSnapshotRequestBuilder extends MasterNodeOperationRequestBui
/** /**
* Sets index settings that should be added or replaced during restore * Sets index settings that should be added or replaced during restore
*
* @param settings index settings * @param settings index settings
* @return this builder * @return this builder
*/ */
@ -243,7 +237,7 @@ public class RestoreSnapshotRequestBuilder extends MasterNodeOperationRequestBui
/** /**
* Sets index settings that should be added or replaced during restore * Sets index settings that should be added or replaced during restore
*
* @param settings index settings * @param settings index settings
* @return this builder * @return this builder
*/ */
@ -254,7 +248,7 @@ public class RestoreSnapshotRequestBuilder extends MasterNodeOperationRequestBui
/** /**
* Sets index settings that should be added or replaced during restore * Sets index settings that should be added or replaced during restore
*
* @param source index settings * @param source index settings
* @return this builder * @return this builder
*/ */
@ -265,7 +259,7 @@ public class RestoreSnapshotRequestBuilder extends MasterNodeOperationRequestBui
/** /**
* Sets index settings that should be added or replaced during restore * Sets index settings that should be added or replaced during restore
*
* @param source index settings * @param source index settings
* @return this builder * @return this builder
*/ */
@ -290,10 +284,4 @@ public class RestoreSnapshotRequestBuilder extends MasterNodeOperationRequestBui
request.ignoreIndexSettings(ignoreIndexSettings); request.ignoreIndexSettings(ignoreIndexSettings);
return this; return this;
} }
@Override
protected void doExecute(ActionListener<RestoreSnapshotResponse> listener) {
client.restoreSnapshot(request, listener);
}
} }

View File

@ -19,13 +19,13 @@
package org.elasticsearch.action.admin.cluster.snapshots.status; package org.elasticsearch.action.admin.cluster.snapshots.status;
import org.elasticsearch.action.admin.cluster.ClusterAction; import org.elasticsearch.action.Action;
import org.elasticsearch.client.ClusterAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
* Snapshots status action * Snapshots status action
*/ */
public class SnapshotsStatusAction extends ClusterAction<SnapshotsStatusRequest, SnapshotsStatusResponse, SnapshotsStatusRequestBuilder> { public class SnapshotsStatusAction extends Action<SnapshotsStatusRequest, SnapshotsStatusResponse, SnapshotsStatusRequestBuilder> {
public static final SnapshotsStatusAction INSTANCE = new SnapshotsStatusAction(); public static final SnapshotsStatusAction INSTANCE = new SnapshotsStatusAction();
public static final String NAME = "cluster:admin/snapshot/status"; public static final String NAME = "cluster:admin/snapshot/status";
@ -40,8 +40,8 @@ public class SnapshotsStatusAction extends ClusterAction<SnapshotsStatusRequest,
} }
@Override @Override
public SnapshotsStatusRequestBuilder newRequestBuilder(ClusterAdminClient client) { public SnapshotsStatusRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new SnapshotsStatusRequestBuilder(client); return new SnapshotsStatusRequestBuilder(client, this);
} }
} }

View File

@ -22,30 +22,25 @@ package org.elasticsearch.action.admin.cluster.snapshots.status;
import com.google.common.collect.ObjectArrays; import com.google.common.collect.ObjectArrays;
import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.master.MasterNodeOperationRequestBuilder; import org.elasticsearch.action.support.master.MasterNodeOperationRequestBuilder;
import org.elasticsearch.client.ClusterAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
* Snapshots status request builder * Snapshots status request builder
*/ */
public class SnapshotsStatusRequestBuilder extends MasterNodeOperationRequestBuilder<SnapshotsStatusRequest, SnapshotsStatusResponse, SnapshotsStatusRequestBuilder, ClusterAdminClient> { public class SnapshotsStatusRequestBuilder extends MasterNodeOperationRequestBuilder<SnapshotsStatusRequest, SnapshotsStatusResponse, SnapshotsStatusRequestBuilder> {
/** /**
* Constructs the new snapshotstatus request * Constructs the new snapshotstatus request
*
* @param clusterAdminClient cluster admin client
*/ */
public SnapshotsStatusRequestBuilder(ClusterAdminClient clusterAdminClient) { public SnapshotsStatusRequestBuilder(ElasticsearchClient client, SnapshotsStatusAction action) {
super(clusterAdminClient, new SnapshotsStatusRequest()); super(client, action, new SnapshotsStatusRequest());
} }
/** /**
* Constructs the new snapshot status request with specified repository * Constructs the new snapshot status request with specified repository
*
* @param clusterAdminClient cluster admin client
* @param repository repository name
*/ */
public SnapshotsStatusRequestBuilder(ClusterAdminClient clusterAdminClient, String repository) { public SnapshotsStatusRequestBuilder(ElasticsearchClient client, SnapshotsStatusAction action, String repository) {
super(clusterAdminClient, new SnapshotsStatusRequest(repository)); super(client, action, new SnapshotsStatusRequest(repository));
} }
/** /**
@ -80,9 +75,4 @@ public class SnapshotsStatusRequestBuilder extends MasterNodeOperationRequestBui
request.snapshots(ObjectArrays.concat(request.snapshots(), snapshots, String.class)); request.snapshots(ObjectArrays.concat(request.snapshots(), snapshots, String.class));
return this; return this;
} }
@Override
protected void doExecute(ActionListener<SnapshotsStatusResponse> listener) {
client.snapshotsStatus(request, listener);
}
} }

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.cluster.state; package org.elasticsearch.action.admin.cluster.state;
import org.elasticsearch.action.admin.cluster.ClusterAction; import org.elasticsearch.action.Action;
import org.elasticsearch.client.ClusterAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
*/ */
public class ClusterStateAction extends ClusterAction<ClusterStateRequest, ClusterStateResponse, ClusterStateRequestBuilder> { public class ClusterStateAction extends Action<ClusterStateRequest, ClusterStateResponse, ClusterStateRequestBuilder> {
public static final ClusterStateAction INSTANCE = new ClusterStateAction(); public static final ClusterStateAction INSTANCE = new ClusterStateAction();
public static final String NAME = "cluster:monitor/state"; public static final String NAME = "cluster:monitor/state";
@ -39,7 +39,7 @@ public class ClusterStateAction extends ClusterAction<ClusterStateRequest, Clust
} }
@Override @Override
public ClusterStateRequestBuilder newRequestBuilder(ClusterAdminClient client) { public ClusterStateRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new ClusterStateRequestBuilder(client); return new ClusterStateRequestBuilder(client, this);
} }
} }

View File

@ -19,18 +19,17 @@
package org.elasticsearch.action.admin.cluster.state; package org.elasticsearch.action.admin.cluster.state;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.action.support.master.MasterNodeReadOperationRequestBuilder; import org.elasticsearch.action.support.master.MasterNodeReadOperationRequestBuilder;
import org.elasticsearch.client.ClusterAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
* *
*/ */
public class ClusterStateRequestBuilder extends MasterNodeReadOperationRequestBuilder<ClusterStateRequest, ClusterStateResponse, ClusterStateRequestBuilder, ClusterAdminClient> { public class ClusterStateRequestBuilder extends MasterNodeReadOperationRequestBuilder<ClusterStateRequest, ClusterStateResponse, ClusterStateRequestBuilder> {
public ClusterStateRequestBuilder(ClusterAdminClient clusterClient) { public ClusterStateRequestBuilder(ElasticsearchClient client, ClusterStateAction action) {
super(clusterClient, new ClusterStateRequest()); super(client, action, new ClusterStateRequest());
} }
/** /**
@ -94,9 +93,4 @@ public class ClusterStateRequestBuilder extends MasterNodeReadOperationRequestBu
request.indicesOptions(indicesOptions); request.indicesOptions(indicesOptions);
return this; return this;
} }
@Override
protected void doExecute(ActionListener<ClusterStateResponse> listener) {
client.state(request, listener);
}
} }

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.cluster.stats; package org.elasticsearch.action.admin.cluster.stats;
import org.elasticsearch.action.admin.cluster.ClusterAction; import org.elasticsearch.action.Action;
import org.elasticsearch.client.ClusterAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
*/ */
public class ClusterStatsAction extends ClusterAction<ClusterStatsRequest, ClusterStatsResponse, ClusterStatsRequestBuilder> { public class ClusterStatsAction extends Action<ClusterStatsRequest, ClusterStatsResponse, ClusterStatsRequestBuilder> {
public static final ClusterStatsAction INSTANCE = new ClusterStatsAction(); public static final ClusterStatsAction INSTANCE = new ClusterStatsAction();
public static final String NAME = "cluster:monitor/stats"; public static final String NAME = "cluster:monitor/stats";
@ -39,7 +39,7 @@ public class ClusterStatsAction extends ClusterAction<ClusterStatsRequest, Clust
} }
@Override @Override
public ClusterStatsRequestBuilder newRequestBuilder(ClusterAdminClient client) { public ClusterStatsRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new ClusterStatsRequestBuilder(client); return new ClusterStatsRequestBuilder(client, this);
} }
} }

View File

@ -19,21 +19,15 @@
package org.elasticsearch.action.admin.cluster.stats; package org.elasticsearch.action.admin.cluster.stats;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.nodes.NodesOperationRequestBuilder; import org.elasticsearch.action.support.nodes.NodesOperationRequestBuilder;
import org.elasticsearch.client.ClusterAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
* *
*/ */
public class ClusterStatsRequestBuilder extends NodesOperationRequestBuilder<ClusterStatsRequest, ClusterStatsResponse, ClusterStatsRequestBuilder> { public class ClusterStatsRequestBuilder extends NodesOperationRequestBuilder<ClusterStatsRequest, ClusterStatsResponse, ClusterStatsRequestBuilder> {
public ClusterStatsRequestBuilder(ClusterAdminClient clusterClient) { public ClusterStatsRequestBuilder(ElasticsearchClient client, ClusterStatsAction action) {
super(clusterClient, new ClusterStatsRequest()); super(client, action, new ClusterStatsRequest());
}
@Override
protected void doExecute(ActionListener<ClusterStatsResponse> listener) {
client.clusterStats(request, listener);
} }
} }

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.cluster.tasks; package org.elasticsearch.action.admin.cluster.tasks;
import org.elasticsearch.action.admin.cluster.ClusterAction; import org.elasticsearch.action.Action;
import org.elasticsearch.client.ClusterAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
*/ */
public class PendingClusterTasksAction extends ClusterAction<PendingClusterTasksRequest, PendingClusterTasksResponse, PendingClusterTasksRequestBuilder> { public class PendingClusterTasksAction extends Action<PendingClusterTasksRequest, PendingClusterTasksResponse, PendingClusterTasksRequestBuilder> {
public static final PendingClusterTasksAction INSTANCE = new PendingClusterTasksAction(); public static final PendingClusterTasksAction INSTANCE = new PendingClusterTasksAction();
public static final String NAME = "cluster:monitor/task"; public static final String NAME = "cluster:monitor/task";
@ -39,7 +39,7 @@ public class PendingClusterTasksAction extends ClusterAction<PendingClusterTasks
} }
@Override @Override
public PendingClusterTasksRequestBuilder newRequestBuilder(ClusterAdminClient client) { public PendingClusterTasksRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new PendingClusterTasksRequestBuilder(client); return new PendingClusterTasksRequestBuilder(client, this);
} }
} }

View File

@ -19,20 +19,14 @@
package org.elasticsearch.action.admin.cluster.tasks; package org.elasticsearch.action.admin.cluster.tasks;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.master.MasterNodeReadOperationRequestBuilder; import org.elasticsearch.action.support.master.MasterNodeReadOperationRequestBuilder;
import org.elasticsearch.client.ClusterAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
*/ */
public class PendingClusterTasksRequestBuilder extends MasterNodeReadOperationRequestBuilder<PendingClusterTasksRequest, PendingClusterTasksResponse, PendingClusterTasksRequestBuilder, ClusterAdminClient> { public class PendingClusterTasksRequestBuilder extends MasterNodeReadOperationRequestBuilder<PendingClusterTasksRequest, PendingClusterTasksResponse, PendingClusterTasksRequestBuilder> {
public PendingClusterTasksRequestBuilder(ClusterAdminClient client) { public PendingClusterTasksRequestBuilder(ElasticsearchClient client, PendingClusterTasksAction action) {
super(client, new PendingClusterTasksRequest()); super(client, action, new PendingClusterTasksRequest());
}
@Override
protected void doExecute(ActionListener<PendingClusterTasksResponse> listener) {
client.pendingClusterTasks(request, listener);
} }
} }

View File

@ -1,34 +0,0 @@
/*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.action.admin.indices;
import org.elasticsearch.action.*;
import org.elasticsearch.client.IndicesAdminClient;
/**
* Indices action (used with {@link IndicesAdminClient} API).
*/
public abstract class IndicesAction<Request extends ActionRequest, Response extends ActionResponse, RequestBuilder extends ActionRequestBuilder<Request, Response, RequestBuilder, IndicesAdminClient>>
extends Action<Request, Response, RequestBuilder, IndicesAdminClient> {
protected IndicesAction(String name) {
super(name);
}
}

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.indices.alias; package org.elasticsearch.action.admin.indices.alias;
import org.elasticsearch.action.admin.indices.IndicesAction; import org.elasticsearch.action.Action;
import org.elasticsearch.client.IndicesAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
*/ */
public class IndicesAliasesAction extends IndicesAction<IndicesAliasesRequest, IndicesAliasesResponse, IndicesAliasesRequestBuilder> { public class IndicesAliasesAction extends Action<IndicesAliasesRequest, IndicesAliasesResponse, IndicesAliasesRequestBuilder> {
public static final IndicesAliasesAction INSTANCE = new IndicesAliasesAction(); public static final IndicesAliasesAction INSTANCE = new IndicesAliasesAction();
public static final String NAME = "indices:admin/aliases"; public static final String NAME = "indices:admin/aliases";
@ -39,7 +39,7 @@ public class IndicesAliasesAction extends IndicesAction<IndicesAliasesRequest, I
} }
@Override @Override
public IndicesAliasesRequestBuilder newRequestBuilder(IndicesAdminClient client) { public IndicesAliasesRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new IndicesAliasesRequestBuilder(client); return new IndicesAliasesRequestBuilder(client, this);
} }
} }

View File

@ -19,10 +19,9 @@
package org.elasticsearch.action.admin.indices.alias; package org.elasticsearch.action.admin.indices.alias;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest.AliasActions; import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest.AliasActions;
import org.elasticsearch.action.support.master.AcknowledgedRequestBuilder; import org.elasticsearch.action.support.master.AcknowledgedRequestBuilder;
import org.elasticsearch.client.IndicesAdminClient; import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.cluster.metadata.AliasAction; import org.elasticsearch.cluster.metadata.AliasAction;
import org.elasticsearch.index.query.FilterBuilder; import org.elasticsearch.index.query.FilterBuilder;
@ -31,10 +30,10 @@ import java.util.Map;
/** /**
* *
*/ */
public class IndicesAliasesRequestBuilder extends AcknowledgedRequestBuilder<IndicesAliasesRequest, IndicesAliasesResponse, IndicesAliasesRequestBuilder, IndicesAdminClient> { public class IndicesAliasesRequestBuilder extends AcknowledgedRequestBuilder<IndicesAliasesRequest, IndicesAliasesResponse, IndicesAliasesRequestBuilder> {
public IndicesAliasesRequestBuilder(IndicesAdminClient indicesClient) { public IndicesAliasesRequestBuilder(ElasticsearchClient client, IndicesAliasesAction action) {
super(indicesClient, new IndicesAliasesRequest()); super(client, action, new IndicesAliasesRequest());
} }
/** /**
@ -166,11 +165,6 @@ public class IndicesAliasesRequestBuilder extends AcknowledgedRequestBuilder<Ind
return this; return this;
} }
@Override
protected void doExecute(ActionListener<IndicesAliasesResponse> listener) {
client.aliases(request, listener);
}
/** /**
* Adds an alias action to the request. * Adds an alias action to the request.
* *

View File

@ -19,13 +19,13 @@
package org.elasticsearch.action.admin.indices.alias.exists; package org.elasticsearch.action.admin.indices.alias.exists;
import org.elasticsearch.action.admin.indices.IndicesAction; import org.elasticsearch.action.Action;
import org.elasticsearch.action.admin.indices.alias.get.GetAliasesRequest; import org.elasticsearch.action.admin.indices.alias.get.GetAliasesRequest;
import org.elasticsearch.client.IndicesAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
*/ */
public class AliasesExistAction extends IndicesAction<GetAliasesRequest, AliasesExistResponse, AliasesExistRequestBuilder> { public class AliasesExistAction extends Action<GetAliasesRequest, AliasesExistResponse, AliasesExistRequestBuilder> {
public static final AliasesExistAction INSTANCE = new AliasesExistAction(); public static final AliasesExistAction INSTANCE = new AliasesExistAction();
public static final String NAME = "indices:admin/aliases/exists"; public static final String NAME = "indices:admin/aliases/exists";
@ -35,8 +35,8 @@ public class AliasesExistAction extends IndicesAction<GetAliasesRequest, Aliases
} }
@Override @Override
public AliasesExistRequestBuilder newRequestBuilder(IndicesAdminClient client) { public AliasesExistRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new AliasesExistRequestBuilder(client); return new AliasesExistRequestBuilder(client, this);
} }
@Override @Override

View File

@ -19,21 +19,14 @@
package org.elasticsearch.action.admin.indices.alias.exists; package org.elasticsearch.action.admin.indices.alias.exists;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.admin.indices.alias.get.BaseAliasesRequestBuilder; import org.elasticsearch.action.admin.indices.alias.get.BaseAliasesRequestBuilder;
import org.elasticsearch.client.IndicesAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
*/ */
public class AliasesExistRequestBuilder extends BaseAliasesRequestBuilder<AliasesExistResponse, AliasesExistRequestBuilder> { public class AliasesExistRequestBuilder extends BaseAliasesRequestBuilder<AliasesExistResponse, AliasesExistRequestBuilder> {
public AliasesExistRequestBuilder(IndicesAdminClient client, String... aliases) { public AliasesExistRequestBuilder(ElasticsearchClient client, AliasesExistAction action, String... aliases) {
super(client, aliases); super(client, action, aliases);
} }
@Override
protected void doExecute(ActionListener<AliasesExistResponse> listener) {
client.aliasesExist(request, listener);
}
} }

View File

@ -20,17 +20,19 @@
package org.elasticsearch.action.admin.indices.alias.get; package org.elasticsearch.action.admin.indices.alias.get;
import com.google.common.collect.ObjectArrays; import com.google.common.collect.ObjectArrays;
import org.elasticsearch.action.Action;
import org.elasticsearch.action.ActionResponse; import org.elasticsearch.action.ActionResponse;
import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.action.support.master.MasterNodeReadOperationRequestBuilder; import org.elasticsearch.action.support.master.MasterNodeReadOperationRequestBuilder;
import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.client.IndicesAdminClient; import org.elasticsearch.client.IndicesAdminClient;
/** /**
*/ */
public abstract class BaseAliasesRequestBuilder<Response extends ActionResponse, Builder extends BaseAliasesRequestBuilder<Response, Builder>> extends MasterNodeReadOperationRequestBuilder<GetAliasesRequest, Response, Builder, IndicesAdminClient> { public abstract class BaseAliasesRequestBuilder<Response extends ActionResponse, Builder extends BaseAliasesRequestBuilder<Response, Builder>> extends MasterNodeReadOperationRequestBuilder<GetAliasesRequest, Response, Builder> {
public BaseAliasesRequestBuilder(IndicesAdminClient client, String... aliases) { public BaseAliasesRequestBuilder(ElasticsearchClient client, Action<GetAliasesRequest, Response, Builder> action, String... aliases) {
super(client, new GetAliasesRequest(aliases)); super(client, action, new GetAliasesRequest(aliases));
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.indices.alias.get; package org.elasticsearch.action.admin.indices.alias.get;
import org.elasticsearch.action.admin.indices.IndicesAction; import org.elasticsearch.action.Action;
import org.elasticsearch.client.IndicesAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
*/ */
public class GetAliasesAction extends IndicesAction<GetAliasesRequest, GetAliasesResponse, GetAliasesRequestBuilder> { public class GetAliasesAction extends Action<GetAliasesRequest, GetAliasesResponse, GetAliasesRequestBuilder> {
public static final GetAliasesAction INSTANCE = new GetAliasesAction(); public static final GetAliasesAction INSTANCE = new GetAliasesAction();
public static final String NAME = "indices:admin/aliases/get"; public static final String NAME = "indices:admin/aliases/get";
@ -34,8 +34,8 @@ public class GetAliasesAction extends IndicesAction<GetAliasesRequest, GetAliase
} }
@Override @Override
public GetAliasesRequestBuilder newRequestBuilder(IndicesAdminClient client) { public GetAliasesRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new GetAliasesRequestBuilder(client); return new GetAliasesRequestBuilder(client, this);
} }
@Override @Override

View File

@ -19,20 +19,13 @@
package org.elasticsearch.action.admin.indices.alias.get; package org.elasticsearch.action.admin.indices.alias.get;
import org.elasticsearch.action.ActionListener; import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.client.IndicesAdminClient;
/** /**
*/ */
public class GetAliasesRequestBuilder extends BaseAliasesRequestBuilder<GetAliasesResponse, GetAliasesRequestBuilder> { public class GetAliasesRequestBuilder extends BaseAliasesRequestBuilder<GetAliasesResponse, GetAliasesRequestBuilder> {
public GetAliasesRequestBuilder(IndicesAdminClient client, String... aliases) { public GetAliasesRequestBuilder(ElasticsearchClient client, GetAliasesAction action, String... aliases) {
super(client, aliases); super(client, action, aliases);
} }
@Override
protected void doExecute(ActionListener<GetAliasesResponse> listener) {
client.getAliases(request, listener);
}
} }

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.indices.analyze; package org.elasticsearch.action.admin.indices.analyze;
import org.elasticsearch.action.admin.indices.IndicesAction; import org.elasticsearch.action.Action;
import org.elasticsearch.client.IndicesAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
*/ */
public class AnalyzeAction extends IndicesAction<AnalyzeRequest, AnalyzeResponse, AnalyzeRequestBuilder> { public class AnalyzeAction extends Action<AnalyzeRequest, AnalyzeResponse, AnalyzeRequestBuilder> {
public static final AnalyzeAction INSTANCE = new AnalyzeAction(); public static final AnalyzeAction INSTANCE = new AnalyzeAction();
public static final String NAME = "indices:admin/analyze"; public static final String NAME = "indices:admin/analyze";
@ -39,7 +39,7 @@ public class AnalyzeAction extends IndicesAction<AnalyzeRequest, AnalyzeResponse
} }
@Override @Override
public AnalyzeRequestBuilder newRequestBuilder(IndicesAdminClient client) { public AnalyzeRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new AnalyzeRequestBuilder(client); return new AnalyzeRequestBuilder(client, this);
} }
} }

View File

@ -18,21 +18,20 @@
*/ */
package org.elasticsearch.action.admin.indices.analyze; package org.elasticsearch.action.admin.indices.analyze;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.single.custom.SingleCustomOperationRequestBuilder; import org.elasticsearch.action.support.single.custom.SingleCustomOperationRequestBuilder;
import org.elasticsearch.client.IndicesAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
* *
*/ */
public class AnalyzeRequestBuilder extends SingleCustomOperationRequestBuilder<AnalyzeRequest, AnalyzeResponse, AnalyzeRequestBuilder> { public class AnalyzeRequestBuilder extends SingleCustomOperationRequestBuilder<AnalyzeRequest, AnalyzeResponse, AnalyzeRequestBuilder> {
public AnalyzeRequestBuilder(IndicesAdminClient indicesClient) { public AnalyzeRequestBuilder(ElasticsearchClient client, AnalyzeAction action) {
super(indicesClient, new AnalyzeRequest()); super(client, action, new AnalyzeRequest());
} }
public AnalyzeRequestBuilder(IndicesAdminClient indicesClient, String index, String text) { public AnalyzeRequestBuilder(ElasticsearchClient client, AnalyzeAction action, String index, String text) {
super(indicesClient, new AnalyzeRequest(index).text(text)); super(client, action, new AnalyzeRequest(index).text(text));
} }
/** /**
@ -87,9 +86,4 @@ public class AnalyzeRequestBuilder extends SingleCustomOperationRequestBuilder<A
request.charFilters(charFilters); request.charFilters(charFilters);
return this; return this;
} }
@Override
protected void doExecute(ActionListener<AnalyzeResponse> listener) {
client.analyze(request, listener);
}
} }

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.indices.cache.clear; package org.elasticsearch.action.admin.indices.cache.clear;
import org.elasticsearch.action.admin.indices.IndicesAction; import org.elasticsearch.action.Action;
import org.elasticsearch.client.IndicesAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
*/ */
public class ClearIndicesCacheAction extends IndicesAction<ClearIndicesCacheRequest, ClearIndicesCacheResponse, ClearIndicesCacheRequestBuilder> { public class ClearIndicesCacheAction extends Action<ClearIndicesCacheRequest, ClearIndicesCacheResponse, ClearIndicesCacheRequestBuilder> {
public static final ClearIndicesCacheAction INSTANCE = new ClearIndicesCacheAction(); public static final ClearIndicesCacheAction INSTANCE = new ClearIndicesCacheAction();
public static final String NAME = "indices:admin/cache/clear"; public static final String NAME = "indices:admin/cache/clear";
@ -39,7 +39,7 @@ public class ClearIndicesCacheAction extends IndicesAction<ClearIndicesCacheRequ
} }
@Override @Override
public ClearIndicesCacheRequestBuilder newRequestBuilder(IndicesAdminClient client) { public ClearIndicesCacheRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new ClearIndicesCacheRequestBuilder(client); return new ClearIndicesCacheRequestBuilder(client, this);
} }
} }

View File

@ -19,18 +19,16 @@
package org.elasticsearch.action.admin.indices.cache.clear; package org.elasticsearch.action.admin.indices.cache.clear;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.broadcast.BroadcastOperationRequestBuilder; import org.elasticsearch.action.support.broadcast.BroadcastOperationRequestBuilder;
import org.elasticsearch.client.Client; import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.client.IndicesAdminClient;
/** /**
* *
*/ */
public class ClearIndicesCacheRequestBuilder extends BroadcastOperationRequestBuilder<ClearIndicesCacheRequest, ClearIndicesCacheResponse, ClearIndicesCacheRequestBuilder, IndicesAdminClient> { public class ClearIndicesCacheRequestBuilder extends BroadcastOperationRequestBuilder<ClearIndicesCacheRequest, ClearIndicesCacheResponse, ClearIndicesCacheRequestBuilder> {
public ClearIndicesCacheRequestBuilder(IndicesAdminClient indicesClient) { public ClearIndicesCacheRequestBuilder(ElasticsearchClient client, ClearIndicesCacheAction action) {
super(indicesClient, new ClearIndicesCacheRequest()); super(client, action, new ClearIndicesCacheRequest());
} }
public ClearIndicesCacheRequestBuilder setFilterCache(boolean filterCache) { public ClearIndicesCacheRequestBuilder setFilterCache(boolean filterCache) {
@ -57,9 +55,4 @@ public class ClearIndicesCacheRequestBuilder extends BroadcastOperationRequestBu
request.idCache(idCache); request.idCache(idCache);
return this; return this;
} }
@Override
protected void doExecute(ActionListener<ClearIndicesCacheResponse> listener) {
client.clearCache(request, listener);
}
} }

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.indices.close; package org.elasticsearch.action.admin.indices.close;
import org.elasticsearch.action.admin.indices.IndicesAction; import org.elasticsearch.action.Action;
import org.elasticsearch.client.IndicesAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
*/ */
public class CloseIndexAction extends IndicesAction<CloseIndexRequest, CloseIndexResponse, CloseIndexRequestBuilder> { public class CloseIndexAction extends Action<CloseIndexRequest, CloseIndexResponse, CloseIndexRequestBuilder> {
public static final CloseIndexAction INSTANCE = new CloseIndexAction(); public static final CloseIndexAction INSTANCE = new CloseIndexAction();
public static final String NAME = "indices:admin/close"; public static final String NAME = "indices:admin/close";
@ -39,7 +39,7 @@ public class CloseIndexAction extends IndicesAction<CloseIndexRequest, CloseInde
} }
@Override @Override
public CloseIndexRequestBuilder newRequestBuilder(IndicesAdminClient client) { public CloseIndexRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new CloseIndexRequestBuilder(client); return new CloseIndexRequestBuilder(client, this);
} }
} }

View File

@ -19,26 +19,26 @@
package org.elasticsearch.action.admin.indices.close; package org.elasticsearch.action.admin.indices.close;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.action.support.master.AcknowledgedRequestBuilder; import org.elasticsearch.action.support.master.AcknowledgedRequestBuilder;
import org.elasticsearch.client.IndicesAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
* Builder for close index request * Builder for close index request
*/ */
public class CloseIndexRequestBuilder extends AcknowledgedRequestBuilder<CloseIndexRequest, CloseIndexResponse, CloseIndexRequestBuilder, IndicesAdminClient> { public class CloseIndexRequestBuilder extends AcknowledgedRequestBuilder<CloseIndexRequest, CloseIndexResponse, CloseIndexRequestBuilder> {
public CloseIndexRequestBuilder(IndicesAdminClient indicesClient) { public CloseIndexRequestBuilder(ElasticsearchClient client, CloseIndexAction action) {
super(indicesClient, new CloseIndexRequest()); super(client, action, new CloseIndexRequest());
} }
public CloseIndexRequestBuilder(IndicesAdminClient indicesClient, String... indices) { public CloseIndexRequestBuilder(ElasticsearchClient client, CloseIndexAction action, String... indices) {
super(indicesClient, new CloseIndexRequest(indices)); super(client, action, new CloseIndexRequest(indices));
} }
/** /**
* Sets the indices to be closed * Sets the indices to be closed
*
* @param indices the indices to be closed * @param indices the indices to be closed
* @return the request itself * @return the request itself
*/ */
@ -58,9 +58,4 @@ public class CloseIndexRequestBuilder extends AcknowledgedRequestBuilder<CloseIn
request.indicesOptions(indicesOptions); request.indicesOptions(indicesOptions);
return this; return this;
} }
@Override
protected void doExecute(ActionListener<CloseIndexResponse> listener) {
client.close(request, listener);
}
} }

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.indices.create; package org.elasticsearch.action.admin.indices.create;
import org.elasticsearch.action.admin.indices.IndicesAction; import org.elasticsearch.action.Action;
import org.elasticsearch.client.IndicesAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
*/ */
public class CreateIndexAction extends IndicesAction<CreateIndexRequest, CreateIndexResponse, CreateIndexRequestBuilder> { public class CreateIndexAction extends Action<CreateIndexRequest, CreateIndexResponse, CreateIndexRequestBuilder> {
public static final CreateIndexAction INSTANCE = new CreateIndexAction(); public static final CreateIndexAction INSTANCE = new CreateIndexAction();
public static final String NAME = "indices:admin/create"; public static final String NAME = "indices:admin/create";
@ -39,7 +39,7 @@ public class CreateIndexAction extends IndicesAction<CreateIndexRequest, CreateI
} }
@Override @Override
public CreateIndexRequestBuilder newRequestBuilder(IndicesAdminClient client) { public CreateIndexRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new CreateIndexRequestBuilder(client); return new CreateIndexRequestBuilder(client, this);
} }
} }

View File

@ -19,10 +19,9 @@
package org.elasticsearch.action.admin.indices.create; package org.elasticsearch.action.admin.indices.create;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.admin.indices.alias.Alias; import org.elasticsearch.action.admin.indices.alias.Alias;
import org.elasticsearch.action.support.master.AcknowledgedRequestBuilder; import org.elasticsearch.action.support.master.AcknowledgedRequestBuilder;
import org.elasticsearch.client.IndicesAdminClient; import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.cluster.metadata.IndexMetaData;
import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
@ -33,14 +32,14 @@ import java.util.Map;
/** /**
* Builder for a create index request * Builder for a create index request
*/ */
public class CreateIndexRequestBuilder extends AcknowledgedRequestBuilder<CreateIndexRequest, CreateIndexResponse, CreateIndexRequestBuilder, IndicesAdminClient> { public class CreateIndexRequestBuilder extends AcknowledgedRequestBuilder<CreateIndexRequest, CreateIndexResponse, CreateIndexRequestBuilder> {
public CreateIndexRequestBuilder(IndicesAdminClient indicesClient) { public CreateIndexRequestBuilder(ElasticsearchClient client, CreateIndexAction action) {
super(indicesClient, new CreateIndexRequest()); super(client, action, new CreateIndexRequest());
} }
public CreateIndexRequestBuilder(IndicesAdminClient indicesClient, String index) { public CreateIndexRequestBuilder(ElasticsearchClient client, CreateIndexAction action, String index) {
super(indicesClient, new CreateIndexRequest(index)); super(client, action, new CreateIndexRequest(index));
} }
/** /**
@ -244,9 +243,4 @@ public class CreateIndexRequestBuilder extends AcknowledgedRequestBuilder<Create
request.source(source); request.source(source);
return this; return this;
} }
@Override
protected void doExecute(ActionListener<CreateIndexResponse> listener) {
client.create(request, listener);
}
} }

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.indices.delete; package org.elasticsearch.action.admin.indices.delete;
import org.elasticsearch.action.admin.indices.IndicesAction; import org.elasticsearch.action.Action;
import org.elasticsearch.client.IndicesAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
*/ */
public class DeleteIndexAction extends IndicesAction<DeleteIndexRequest, DeleteIndexResponse, DeleteIndexRequestBuilder> { public class DeleteIndexAction extends Action<DeleteIndexRequest, DeleteIndexResponse, DeleteIndexRequestBuilder> {
public static final DeleteIndexAction INSTANCE = new DeleteIndexAction(); public static final DeleteIndexAction INSTANCE = new DeleteIndexAction();
public static final String NAME = "indices:admin/delete"; public static final String NAME = "indices:admin/delete";
@ -39,7 +39,7 @@ public class DeleteIndexAction extends IndicesAction<DeleteIndexRequest, DeleteI
} }
@Override @Override
public DeleteIndexRequestBuilder newRequestBuilder(IndicesAdminClient client) { public DeleteIndexRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new DeleteIndexRequestBuilder(client); return new DeleteIndexRequestBuilder(client, this);
} }
} }

View File

@ -19,19 +19,18 @@
package org.elasticsearch.action.admin.indices.delete; package org.elasticsearch.action.admin.indices.delete;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.action.support.master.MasterNodeOperationRequestBuilder; import org.elasticsearch.action.support.master.MasterNodeOperationRequestBuilder;
import org.elasticsearch.client.IndicesAdminClient; import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.unit.TimeValue;
/** /**
* *
*/ */
public class DeleteIndexRequestBuilder extends MasterNodeOperationRequestBuilder<DeleteIndexRequest, DeleteIndexResponse, DeleteIndexRequestBuilder, IndicesAdminClient> { public class DeleteIndexRequestBuilder extends MasterNodeOperationRequestBuilder<DeleteIndexRequest, DeleteIndexResponse, DeleteIndexRequestBuilder> {
public DeleteIndexRequestBuilder(IndicesAdminClient indicesClient, String... indices) { public DeleteIndexRequestBuilder(ElasticsearchClient client, DeleteIndexAction action, String... indices) {
super(indicesClient, new DeleteIndexRequest(indices)); super(client, action, new DeleteIndexRequest(indices));
} }
/** /**
@ -54,16 +53,11 @@ public class DeleteIndexRequestBuilder extends MasterNodeOperationRequestBuilder
/** /**
* Specifies what type of requested indices to ignore and wildcard indices expressions. * Specifies what type of requested indices to ignore and wildcard indices expressions.
* * <p/>
* For example indices that don't exist. * For example indices that don't exist.
*/ */
public DeleteIndexRequestBuilder setIndicesOptions(IndicesOptions options) { public DeleteIndexRequestBuilder setIndicesOptions(IndicesOptions options) {
request.indicesOptions(options); request.indicesOptions(options);
return this; return this;
} }
@Override
protected void doExecute(ActionListener<DeleteIndexResponse> listener) {
client.delete(request, listener);
}
} }

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.indices.exists.indices; package org.elasticsearch.action.admin.indices.exists.indices;
import org.elasticsearch.action.admin.indices.IndicesAction; import org.elasticsearch.action.Action;
import org.elasticsearch.client.IndicesAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
*/ */
public class IndicesExistsAction extends IndicesAction<IndicesExistsRequest, IndicesExistsResponse, IndicesExistsRequestBuilder> { public class IndicesExistsAction extends Action<IndicesExistsRequest, IndicesExistsResponse, IndicesExistsRequestBuilder> {
public static final IndicesExistsAction INSTANCE = new IndicesExistsAction(); public static final IndicesExistsAction INSTANCE = new IndicesExistsAction();
public static final String NAME = "indices:admin/exists"; public static final String NAME = "indices:admin/exists";
@ -39,7 +39,7 @@ public class IndicesExistsAction extends IndicesAction<IndicesExistsRequest, Ind
} }
@Override @Override
public IndicesExistsRequestBuilder newRequestBuilder(IndicesAdminClient client) { public IndicesExistsRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new IndicesExistsRequestBuilder(client); return new IndicesExistsRequestBuilder(client, this);
} }
} }

View File

@ -19,18 +19,17 @@
package org.elasticsearch.action.admin.indices.exists.indices; package org.elasticsearch.action.admin.indices.exists.indices;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.action.support.master.MasterNodeReadOperationRequestBuilder; import org.elasticsearch.action.support.master.MasterNodeReadOperationRequestBuilder;
import org.elasticsearch.client.IndicesAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
* *
*/ */
public class IndicesExistsRequestBuilder extends MasterNodeReadOperationRequestBuilder<IndicesExistsRequest, IndicesExistsResponse, IndicesExistsRequestBuilder, IndicesAdminClient> { public class IndicesExistsRequestBuilder extends MasterNodeReadOperationRequestBuilder<IndicesExistsRequest, IndicesExistsResponse, IndicesExistsRequestBuilder> {
public IndicesExistsRequestBuilder(IndicesAdminClient indicesClient, String... indices) { public IndicesExistsRequestBuilder(ElasticsearchClient client, IndicesExistsAction action, String... indices) {
super(indicesClient, new IndicesExistsRequest(indices)); super(client, action, new IndicesExistsRequest(indices));
} }
public IndicesExistsRequestBuilder setIndices(String... indices) { public IndicesExistsRequestBuilder setIndices(String... indices) {
@ -40,16 +39,11 @@ public class IndicesExistsRequestBuilder extends MasterNodeReadOperationRequestB
/** /**
* Specifies what type of requested indices to ignore and wildcard indices expressions. * Specifies what type of requested indices to ignore and wildcard indices expressions.
* * <p/>
* For example indices that don't exist. * For example indices that don't exist.
*/ */
public IndicesExistsRequestBuilder setIndicesOptions(IndicesOptions options) { public IndicesExistsRequestBuilder setIndicesOptions(IndicesOptions options) {
request.indicesOptions(options); request.indicesOptions(options);
return this; return this;
} }
@Override
protected void doExecute(ActionListener<IndicesExistsResponse> listener) {
client.exists(request, listener);
}
} }

View File

@ -18,12 +18,12 @@
*/ */
package org.elasticsearch.action.admin.indices.exists.types; package org.elasticsearch.action.admin.indices.exists.types;
import org.elasticsearch.action.admin.indices.IndicesAction; import org.elasticsearch.action.Action;
import org.elasticsearch.client.IndicesAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
*/ */
public class TypesExistsAction extends IndicesAction<TypesExistsRequest, TypesExistsResponse, TypesExistsRequestBuilder> { public class TypesExistsAction extends Action<TypesExistsRequest, TypesExistsResponse, TypesExistsRequestBuilder> {
public static final TypesExistsAction INSTANCE = new TypesExistsAction(); public static final TypesExistsAction INSTANCE = new TypesExistsAction();
public static final String NAME = "indices:admin/types/exists"; public static final String NAME = "indices:admin/types/exists";
@ -38,7 +38,7 @@ public class TypesExistsAction extends IndicesAction<TypesExistsRequest, TypesEx
} }
@Override @Override
public TypesExistsRequestBuilder newRequestBuilder(IndicesAdminClient client) { public TypesExistsRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new TypesExistsRequestBuilder(client); return new TypesExistsRequestBuilder(client, this);
} }
} }

View File

@ -18,26 +18,25 @@
*/ */
package org.elasticsearch.action.admin.indices.exists.types; package org.elasticsearch.action.admin.indices.exists.types;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.action.support.master.MasterNodeReadOperationRequestBuilder; import org.elasticsearch.action.support.master.MasterNodeReadOperationRequestBuilder;
import org.elasticsearch.client.IndicesAdminClient; import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.common.Strings; import org.elasticsearch.common.Strings;
/** /**
* A builder for {@link TypesExistsRequest}. * A builder for {@link TypesExistsRequest}.
*/ */
public class TypesExistsRequestBuilder extends MasterNodeReadOperationRequestBuilder<TypesExistsRequest, TypesExistsResponse, TypesExistsRequestBuilder, IndicesAdminClient> { public class TypesExistsRequestBuilder extends MasterNodeReadOperationRequestBuilder<TypesExistsRequest, TypesExistsResponse, TypesExistsRequestBuilder> {
/** /**
* @param indices What indices to check for types * @param indices What indices to check for types
*/ */
public TypesExistsRequestBuilder(IndicesAdminClient indicesClient, String... indices) { public TypesExistsRequestBuilder(ElasticsearchClient client, TypesExistsAction action, String... indices) {
super(indicesClient, new TypesExistsRequest(indices, Strings.EMPTY_ARRAY)); super(client, action, new TypesExistsRequest(indices, Strings.EMPTY_ARRAY));
} }
TypesExistsRequestBuilder(IndicesAdminClient client) { TypesExistsRequestBuilder(ElasticsearchClient client, TypesExistsAction action) {
super(client, new TypesExistsRequest()); super(client, action, new TypesExistsRequest());
} }
/** /**
@ -63,9 +62,4 @@ public class TypesExistsRequestBuilder extends MasterNodeReadOperationRequestBui
request.indicesOptions(indicesOptions); request.indicesOptions(indicesOptions);
return this; return this;
} }
@Override
protected void doExecute(ActionListener<TypesExistsResponse> listener) {
client.typesExists(request, listener);
}
} }

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.indices.flush; package org.elasticsearch.action.admin.indices.flush;
import org.elasticsearch.action.admin.indices.IndicesAction; import org.elasticsearch.action.Action;
import org.elasticsearch.client.IndicesAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
*/ */
public class FlushAction extends IndicesAction<FlushRequest, FlushResponse, FlushRequestBuilder> { public class FlushAction extends Action<FlushRequest, FlushResponse, FlushRequestBuilder> {
public static final FlushAction INSTANCE = new FlushAction(); public static final FlushAction INSTANCE = new FlushAction();
public static final String NAME = "indices:admin/flush"; public static final String NAME = "indices:admin/flush";
@ -39,7 +39,7 @@ public class FlushAction extends IndicesAction<FlushRequest, FlushResponse, Flus
} }
@Override @Override
public FlushRequestBuilder newRequestBuilder(IndicesAdminClient client) { public FlushRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new FlushRequestBuilder(client); return new FlushRequestBuilder(client, this);
} }
} }

View File

@ -19,17 +19,16 @@
package org.elasticsearch.action.admin.indices.flush; package org.elasticsearch.action.admin.indices.flush;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.broadcast.BroadcastOperationRequestBuilder; import org.elasticsearch.action.support.broadcast.BroadcastOperationRequestBuilder;
import org.elasticsearch.client.IndicesAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
* *
*/ */
public class FlushRequestBuilder extends BroadcastOperationRequestBuilder<FlushRequest, FlushResponse, FlushRequestBuilder, IndicesAdminClient> { public class FlushRequestBuilder extends BroadcastOperationRequestBuilder<FlushRequest, FlushResponse, FlushRequestBuilder> {
public FlushRequestBuilder(IndicesAdminClient indicesClient) { public FlushRequestBuilder(ElasticsearchClient client, FlushAction action) {
super(indicesClient, new FlushRequest()); super(client, action, new FlushRequest());
} }
public FlushRequestBuilder setForce(boolean force) { public FlushRequestBuilder setForce(boolean force) {
@ -37,11 +36,6 @@ public class FlushRequestBuilder extends BroadcastOperationRequestBuilder<FlushR
return this; return this;
} }
@Override
protected void doExecute(ActionListener<FlushResponse> listener) {
client.flush(request, listener);
}
public FlushRequestBuilder setWaitIfOngoing(boolean waitIfOngoing) { public FlushRequestBuilder setWaitIfOngoing(boolean waitIfOngoing) {
request.waitIfOngoing(waitIfOngoing); request.waitIfOngoing(waitIfOngoing);
return this; return this;

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.indices.get; package org.elasticsearch.action.admin.indices.get;
import org.elasticsearch.action.admin.indices.IndicesAction; import org.elasticsearch.action.Action;
import org.elasticsearch.client.IndicesAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
*/ */
public class GetIndexAction extends IndicesAction<GetIndexRequest, GetIndexResponse, GetIndexRequestBuilder> { public class GetIndexAction extends Action<GetIndexRequest, GetIndexResponse, GetIndexRequestBuilder> {
public static final GetIndexAction INSTANCE = new GetIndexAction(); public static final GetIndexAction INSTANCE = new GetIndexAction();
public static final String NAME = "indices:admin/get"; public static final String NAME = "indices:admin/get";
@ -34,8 +34,8 @@ public class GetIndexAction extends IndicesAction<GetIndexRequest, GetIndexRespo
} }
@Override @Override
public GetIndexRequestBuilder newRequestBuilder(IndicesAdminClient client) { public GetIndexRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new GetIndexRequestBuilder(client); return new GetIndexRequestBuilder(client, this);
} }
@Override @Override

View File

@ -19,18 +19,17 @@
package org.elasticsearch.action.admin.indices.get; package org.elasticsearch.action.admin.indices.get;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.admin.indices.get.GetIndexRequest.Feature; import org.elasticsearch.action.admin.indices.get.GetIndexRequest.Feature;
import org.elasticsearch.action.support.master.info.ClusterInfoRequestBuilder; import org.elasticsearch.action.support.master.info.ClusterInfoRequestBuilder;
import org.elasticsearch.client.IndicesAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
* *
*/ */
public class GetIndexRequestBuilder extends ClusterInfoRequestBuilder<GetIndexRequest, GetIndexResponse, GetIndexRequestBuilder> { public class GetIndexRequestBuilder extends ClusterInfoRequestBuilder<GetIndexRequest, GetIndexResponse, GetIndexRequestBuilder> {
public GetIndexRequestBuilder(IndicesAdminClient client, String... indices) { public GetIndexRequestBuilder(ElasticsearchClient client, GetIndexAction action, String... indices) {
super(client, new GetIndexRequest().indices(indices)); super(client, action, new GetIndexRequest().indices(indices));
} }
public GetIndexRequestBuilder setFeatures(Feature... features) { public GetIndexRequestBuilder setFeatures(Feature... features) {
@ -42,9 +41,4 @@ public class GetIndexRequestBuilder extends ClusterInfoRequestBuilder<GetIndexRe
request.addFeatures(features); request.addFeatures(features);
return this; return this;
} }
@Override
protected void doExecute(ActionListener<GetIndexResponse> listener) {
client.getIndex(request, listener);
}
} }

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.indices.mapping.get; package org.elasticsearch.action.admin.indices.mapping.get;
import org.elasticsearch.action.admin.indices.IndicesAction; import org.elasticsearch.action.Action;
import org.elasticsearch.client.IndicesAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
*/ */
public class GetFieldMappingsAction extends IndicesAction<GetFieldMappingsRequest, GetFieldMappingsResponse, GetFieldMappingsRequestBuilder> { public class GetFieldMappingsAction extends Action<GetFieldMappingsRequest, GetFieldMappingsResponse, GetFieldMappingsRequestBuilder> {
public static final GetFieldMappingsAction INSTANCE = new GetFieldMappingsAction(); public static final GetFieldMappingsAction INSTANCE = new GetFieldMappingsAction();
public static final String NAME = "indices:admin/mappings/fields/get"; public static final String NAME = "indices:admin/mappings/fields/get";
@ -34,8 +34,8 @@ public class GetFieldMappingsAction extends IndicesAction<GetFieldMappingsReques
} }
@Override @Override
public GetFieldMappingsRequestBuilder newRequestBuilder(IndicesAdminClient client) { public GetFieldMappingsRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new GetFieldMappingsRequestBuilder(client); return new GetFieldMappingsRequestBuilder(client, this);
} }
@Override @Override

View File

@ -23,13 +23,14 @@ import com.google.common.collect.ObjectArrays;
import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.ActionRequestBuilder; import org.elasticsearch.action.ActionRequestBuilder;
import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.client.IndicesAdminClient; import org.elasticsearch.client.IndicesAdminClient;
/** A helper class to build {@link GetFieldMappingsRequest} objects */ /** A helper class to build {@link GetFieldMappingsRequest} objects */
public class GetFieldMappingsRequestBuilder extends ActionRequestBuilder<GetFieldMappingsRequest, GetFieldMappingsResponse, GetFieldMappingsRequestBuilder, IndicesAdminClient> { public class GetFieldMappingsRequestBuilder extends ActionRequestBuilder<GetFieldMappingsRequest, GetFieldMappingsResponse, GetFieldMappingsRequestBuilder> {
public GetFieldMappingsRequestBuilder(IndicesAdminClient client, String... indices) { public GetFieldMappingsRequestBuilder(ElasticsearchClient client, GetFieldMappingsAction action, String... indices) {
super(client, new GetFieldMappingsRequest().indices(indices)); super(client, action, new GetFieldMappingsRequest().indices(indices));
} }
public GetFieldMappingsRequestBuilder setIndices(String... indices) { public GetFieldMappingsRequestBuilder setIndices(String... indices) {
@ -69,10 +70,4 @@ public class GetFieldMappingsRequestBuilder extends ActionRequestBuilder<GetFiel
request.includeDefaults(includeDefaults); request.includeDefaults(includeDefaults);
return this; return this;
} }
@Override
protected void doExecute(ActionListener<GetFieldMappingsResponse> listener) {
client.getFieldMappings(request, listener);
}
} }

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.indices.mapping.get; package org.elasticsearch.action.admin.indices.mapping.get;
import org.elasticsearch.action.admin.indices.IndicesAction; import org.elasticsearch.action.Action;
import org.elasticsearch.client.IndicesAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
*/ */
public class GetMappingsAction extends IndicesAction<GetMappingsRequest, GetMappingsResponse, GetMappingsRequestBuilder> { public class GetMappingsAction extends Action<GetMappingsRequest, GetMappingsResponse, GetMappingsRequestBuilder> {
public static final GetMappingsAction INSTANCE = new GetMappingsAction(); public static final GetMappingsAction INSTANCE = new GetMappingsAction();
public static final String NAME = "indices:admin/mappings/get"; public static final String NAME = "indices:admin/mappings/get";
@ -34,8 +34,8 @@ public class GetMappingsAction extends IndicesAction<GetMappingsRequest, GetMapp
} }
@Override @Override
public GetMappingsRequestBuilder newRequestBuilder(IndicesAdminClient client) { public GetMappingsRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new GetMappingsRequestBuilder(client); return new GetMappingsRequestBuilder(client, this);
} }
@Override @Override

View File

@ -19,20 +19,14 @@
package org.elasticsearch.action.admin.indices.mapping.get; package org.elasticsearch.action.admin.indices.mapping.get;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.master.info.ClusterInfoRequestBuilder; import org.elasticsearch.action.support.master.info.ClusterInfoRequestBuilder;
import org.elasticsearch.client.IndicesAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
*/ */
public class GetMappingsRequestBuilder extends ClusterInfoRequestBuilder<GetMappingsRequest, GetMappingsResponse, GetMappingsRequestBuilder> { public class GetMappingsRequestBuilder extends ClusterInfoRequestBuilder<GetMappingsRequest, GetMappingsResponse, GetMappingsRequestBuilder> {
public GetMappingsRequestBuilder(IndicesAdminClient client, String... indices) { public GetMappingsRequestBuilder(ElasticsearchClient client, GetMappingsAction action, String... indices) {
super(client, new GetMappingsRequest().indices(indices)); super(client, action, new GetMappingsRequest().indices(indices));
}
@Override
protected void doExecute(ActionListener<GetMappingsResponse> listener) {
client.getMappings(request, listener);
} }
} }

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.indices.mapping.put; package org.elasticsearch.action.admin.indices.mapping.put;
import org.elasticsearch.action.admin.indices.IndicesAction; import org.elasticsearch.action.Action;
import org.elasticsearch.client.IndicesAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
*/ */
public class PutMappingAction extends IndicesAction<PutMappingRequest, PutMappingResponse, PutMappingRequestBuilder> { public class PutMappingAction extends Action<PutMappingRequest, PutMappingResponse, PutMappingRequestBuilder> {
public static final PutMappingAction INSTANCE = new PutMappingAction(); public static final PutMappingAction INSTANCE = new PutMappingAction();
public static final String NAME = "indices:admin/mapping/put"; public static final String NAME = "indices:admin/mapping/put";
@ -39,7 +39,7 @@ public class PutMappingAction extends IndicesAction<PutMappingRequest, PutMappin
} }
@Override @Override
public PutMappingRequestBuilder newRequestBuilder(IndicesAdminClient client) { public PutMappingRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new PutMappingRequestBuilder(client); return new PutMappingRequestBuilder(client, this);
} }
} }

View File

@ -19,10 +19,9 @@
package org.elasticsearch.action.admin.indices.mapping.put; package org.elasticsearch.action.admin.indices.mapping.put;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.action.support.master.AcknowledgedRequestBuilder; import org.elasticsearch.action.support.master.AcknowledgedRequestBuilder;
import org.elasticsearch.client.IndicesAdminClient; import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
import java.util.Map; import java.util.Map;
@ -30,10 +29,10 @@ import java.util.Map;
/** /**
* Builder for a put mapping request * Builder for a put mapping request
*/ */
public class PutMappingRequestBuilder extends AcknowledgedRequestBuilder<PutMappingRequest, PutMappingResponse, PutMappingRequestBuilder, IndicesAdminClient> { public class PutMappingRequestBuilder extends AcknowledgedRequestBuilder<PutMappingRequest, PutMappingResponse, PutMappingRequestBuilder> {
public PutMappingRequestBuilder(IndicesAdminClient indicesClient) { public PutMappingRequestBuilder(ElasticsearchClient client, PutMappingAction action) {
super(indicesClient, new PutMappingRequest()); super(client, action, new PutMappingRequest());
} }
public PutMappingRequestBuilder setIndices(String... indices) { public PutMappingRequestBuilder setIndices(String... indices) {
@ -43,7 +42,7 @@ public class PutMappingRequestBuilder extends AcknowledgedRequestBuilder<PutMapp
/** /**
* Specifies what type of requested indices to ignore and wildcard indices expressions. * Specifies what type of requested indices to ignore and wildcard indices expressions.
* * <p/>
* For example indices that don't exist. * For example indices that don't exist.
*/ */
public PutMappingRequestBuilder setIndicesOptions(IndicesOptions options) { public PutMappingRequestBuilder setIndicesOptions(IndicesOptions options) {
@ -101,9 +100,4 @@ public class PutMappingRequestBuilder extends AcknowledgedRequestBuilder<PutMapp
request.ignoreConflicts(ignoreConflicts); request.ignoreConflicts(ignoreConflicts);
return this; return this;
} }
@Override
protected void doExecute(ActionListener<PutMappingResponse> listener) {
client.putMapping(request, listener);
}
} }

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.indices.open; package org.elasticsearch.action.admin.indices.open;
import org.elasticsearch.action.admin.indices.IndicesAction; import org.elasticsearch.action.Action;
import org.elasticsearch.client.IndicesAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
*/ */
public class OpenIndexAction extends IndicesAction<OpenIndexRequest, OpenIndexResponse, OpenIndexRequestBuilder> { public class OpenIndexAction extends Action<OpenIndexRequest, OpenIndexResponse, OpenIndexRequestBuilder> {
public static final OpenIndexAction INSTANCE = new OpenIndexAction(); public static final OpenIndexAction INSTANCE = new OpenIndexAction();
public static final String NAME = "indices:admin/open"; public static final String NAME = "indices:admin/open";
@ -39,7 +39,7 @@ public class OpenIndexAction extends IndicesAction<OpenIndexRequest, OpenIndexRe
} }
@Override @Override
public OpenIndexRequestBuilder newRequestBuilder(IndicesAdminClient client) { public OpenIndexRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new OpenIndexRequestBuilder(client); return new OpenIndexRequestBuilder(client, this);
} }
} }

View File

@ -19,26 +19,26 @@
package org.elasticsearch.action.admin.indices.open; package org.elasticsearch.action.admin.indices.open;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.action.support.master.AcknowledgedRequestBuilder; import org.elasticsearch.action.support.master.AcknowledgedRequestBuilder;
import org.elasticsearch.client.IndicesAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
* Builder for for open index request * Builder for for open index request
*/ */
public class OpenIndexRequestBuilder extends AcknowledgedRequestBuilder<OpenIndexRequest, OpenIndexResponse, OpenIndexRequestBuilder, IndicesAdminClient> { public class OpenIndexRequestBuilder extends AcknowledgedRequestBuilder<OpenIndexRequest, OpenIndexResponse, OpenIndexRequestBuilder> {
public OpenIndexRequestBuilder(IndicesAdminClient indicesClient) { public OpenIndexRequestBuilder(ElasticsearchClient client, OpenIndexAction action) {
super(indicesClient, new OpenIndexRequest()); super(client, action, new OpenIndexRequest());
} }
public OpenIndexRequestBuilder(IndicesAdminClient indicesClient, String... indices) { public OpenIndexRequestBuilder(ElasticsearchClient client, OpenIndexAction action, String... indices) {
super(indicesClient, new OpenIndexRequest(indices)); super(client, action, new OpenIndexRequest(indices));
} }
/** /**
* Sets the indices to be opened * Sets the indices to be opened
*
* @param indices the indices to be opened * @param indices the indices to be opened
* @return the request itself * @return the request itself
*/ */
@ -58,9 +58,4 @@ public class OpenIndexRequestBuilder extends AcknowledgedRequestBuilder<OpenInde
request.indicesOptions(indicesOptions); request.indicesOptions(indicesOptions);
return this; return this;
} }
@Override
protected void doExecute(ActionListener<OpenIndexResponse> listener) {
client.open(request, listener);
}
} }

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.indices.optimize; package org.elasticsearch.action.admin.indices.optimize;
import org.elasticsearch.action.admin.indices.IndicesAction; import org.elasticsearch.action.Action;
import org.elasticsearch.client.IndicesAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
*/ */
public class OptimizeAction extends IndicesAction<OptimizeRequest, OptimizeResponse, OptimizeRequestBuilder> { public class OptimizeAction extends Action<OptimizeRequest, OptimizeResponse, OptimizeRequestBuilder> {
public static final OptimizeAction INSTANCE = new OptimizeAction(); public static final OptimizeAction INSTANCE = new OptimizeAction();
public static final String NAME = "indices:admin/optimize"; public static final String NAME = "indices:admin/optimize";
@ -39,7 +39,7 @@ public class OptimizeAction extends IndicesAction<OptimizeRequest, OptimizeRespo
} }
@Override @Override
public OptimizeRequestBuilder newRequestBuilder(IndicesAdminClient client) { public OptimizeRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new OptimizeRequestBuilder(client); return new OptimizeRequestBuilder(client, this);
} }
} }

View File

@ -19,9 +19,8 @@
package org.elasticsearch.action.admin.indices.optimize; package org.elasticsearch.action.admin.indices.optimize;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.broadcast.BroadcastOperationRequestBuilder; import org.elasticsearch.action.support.broadcast.BroadcastOperationRequestBuilder;
import org.elasticsearch.client.IndicesAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
* A request to optimize one or more indices. In order to optimize on all the indices, pass an empty array or * A request to optimize one or more indices. In order to optimize on all the indices, pass an empty array or
@ -30,10 +29,10 @@ import org.elasticsearch.client.IndicesAdminClient;
* <p>{@link #setMaxNumSegments(int)} allows to control the number of segments to optimize down to. By default, will * <p>{@link #setMaxNumSegments(int)} allows to control the number of segments to optimize down to. By default, will
* cause the optimize process to optimize down to half the configured number of segments. * cause the optimize process to optimize down to half the configured number of segments.
*/ */
public class OptimizeRequestBuilder extends BroadcastOperationRequestBuilder<OptimizeRequest, OptimizeResponse, OptimizeRequestBuilder, IndicesAdminClient> { public class OptimizeRequestBuilder extends BroadcastOperationRequestBuilder<OptimizeRequest, OptimizeResponse, OptimizeRequestBuilder> {
public OptimizeRequestBuilder(IndicesAdminClient indicesClient) { public OptimizeRequestBuilder(ElasticsearchClient client, OptimizeAction action) {
super(indicesClient, new OptimizeRequest()); super(client, action, new OptimizeRequest());
} }
/** /**
@ -61,9 +60,4 @@ public class OptimizeRequestBuilder extends BroadcastOperationRequestBuilder<Opt
request.flush(flush); request.flush(flush);
return this; return this;
} }
@Override
protected void doExecute(ActionListener<OptimizeResponse> listener) {
client.optimize(request, listener);
}
} }

View File

@ -19,13 +19,13 @@
package org.elasticsearch.action.admin.indices.recovery; package org.elasticsearch.action.admin.indices.recovery;
import org.elasticsearch.client.IndicesAdminClient; import org.elasticsearch.action.Action;
import org.elasticsearch.action.admin.indices.IndicesAction; import org.elasticsearch.client.ElasticsearchClient;
/** /**
* Recovery information action * Recovery information action
*/ */
public class RecoveryAction extends IndicesAction<RecoveryRequest, RecoveryResponse, RecoveryRequestBuilder> { public class RecoveryAction extends Action<RecoveryRequest, RecoveryResponse, RecoveryRequestBuilder> {
public static final RecoveryAction INSTANCE = new RecoveryAction(); public static final RecoveryAction INSTANCE = new RecoveryAction();
public static final String NAME = "indices:monitor/recovery"; public static final String NAME = "indices:monitor/recovery";
@ -35,8 +35,8 @@ public class RecoveryAction extends IndicesAction<RecoveryRequest, RecoveryRespo
} }
@Override @Override
public RecoveryRequestBuilder newRequestBuilder(IndicesAdminClient client) { public RecoveryRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new RecoveryRequestBuilder(client); return new RecoveryRequestBuilder(client, this);
} }
@Override @Override

View File

@ -19,27 +19,19 @@
package org.elasticsearch.action.admin.indices.recovery; package org.elasticsearch.action.admin.indices.recovery;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.broadcast.BroadcastOperationRequestBuilder; import org.elasticsearch.action.support.broadcast.BroadcastOperationRequestBuilder;
import org.elasticsearch.client.IndicesAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
* Recovery information request builder. * Recovery information request builder.
*/ */
public class RecoveryRequestBuilder extends BroadcastOperationRequestBuilder<RecoveryRequest, RecoveryResponse, RecoveryRequestBuilder, IndicesAdminClient> { public class RecoveryRequestBuilder extends BroadcastOperationRequestBuilder<RecoveryRequest, RecoveryResponse, RecoveryRequestBuilder> {
/** /**
* Constructs a new recovery information request builder. * Constructs a new recovery information request builder.
*
* @param indicesClient Indices admin client
*/ */
public RecoveryRequestBuilder(IndicesAdminClient indicesClient) { public RecoveryRequestBuilder(ElasticsearchClient client, RecoveryAction action) {
super(indicesClient, new RecoveryRequest()); super(client, action, new RecoveryRequest());
}
@Override
protected void doExecute(ActionListener<RecoveryResponse> listener) {
client.recoveries(request, listener);
} }
public RecoveryRequestBuilder setDetailed(boolean detailed) { public RecoveryRequestBuilder setDetailed(boolean detailed) {

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.indices.refresh; package org.elasticsearch.action.admin.indices.refresh;
import org.elasticsearch.action.admin.indices.IndicesAction; import org.elasticsearch.action.Action;
import org.elasticsearch.client.IndicesAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
*/ */
public class RefreshAction extends IndicesAction<RefreshRequest, RefreshResponse, RefreshRequestBuilder> { public class RefreshAction extends Action<RefreshRequest, RefreshResponse, RefreshRequestBuilder> {
public static final RefreshAction INSTANCE = new RefreshAction(); public static final RefreshAction INSTANCE = new RefreshAction();
public static final String NAME = "indices:admin/refresh"; public static final String NAME = "indices:admin/refresh";
@ -39,7 +39,7 @@ public class RefreshAction extends IndicesAction<RefreshRequest, RefreshResponse
} }
@Override @Override
public RefreshRequestBuilder newRequestBuilder(IndicesAdminClient client) { public RefreshRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new RefreshRequestBuilder(client); return new RefreshRequestBuilder(client, this);
} }
} }

View File

@ -19,23 +19,17 @@
package org.elasticsearch.action.admin.indices.refresh; package org.elasticsearch.action.admin.indices.refresh;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.broadcast.BroadcastOperationRequestBuilder; import org.elasticsearch.action.support.broadcast.BroadcastOperationRequestBuilder;
import org.elasticsearch.client.IndicesAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
* A refresh request making all operations performed since the last refresh available for search. The (near) real-time * A refresh request making all operations performed since the last refresh available for search. The (near) real-time
* capabilities depends on the index engine used. For example, the internal one requires refresh to be called, but by * capabilities depends on the index engine used. For example, the internal one requires refresh to be called, but by
* default a refresh is scheduled periodically. * default a refresh is scheduled periodically.
*/ */
public class RefreshRequestBuilder extends BroadcastOperationRequestBuilder<RefreshRequest, RefreshResponse, RefreshRequestBuilder, IndicesAdminClient> { public class RefreshRequestBuilder extends BroadcastOperationRequestBuilder<RefreshRequest, RefreshResponse, RefreshRequestBuilder> {
public RefreshRequestBuilder(IndicesAdminClient indicesClient) { public RefreshRequestBuilder(ElasticsearchClient client, RefreshAction action) {
super(indicesClient, new RefreshRequest()); super(client, action, new RefreshRequest());
}
@Override
protected void doExecute(ActionListener<RefreshResponse> listener) {
client.refresh(request, listener);
} }
} }

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.indices.segments; package org.elasticsearch.action.admin.indices.segments;
import org.elasticsearch.action.admin.indices.IndicesAction; import org.elasticsearch.action.Action;
import org.elasticsearch.client.IndicesAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
*/ */
public class IndicesSegmentsAction extends IndicesAction<IndicesSegmentsRequest, IndicesSegmentResponse, IndicesSegmentsRequestBuilder> { public class IndicesSegmentsAction extends Action<IndicesSegmentsRequest, IndicesSegmentResponse, IndicesSegmentsRequestBuilder> {
public static final IndicesSegmentsAction INSTANCE = new IndicesSegmentsAction(); public static final IndicesSegmentsAction INSTANCE = new IndicesSegmentsAction();
public static final String NAME = "indices:monitor/segments"; public static final String NAME = "indices:monitor/segments";
@ -39,7 +39,7 @@ public class IndicesSegmentsAction extends IndicesAction<IndicesSegmentsRequest,
} }
@Override @Override
public IndicesSegmentsRequestBuilder newRequestBuilder(IndicesAdminClient client) { public IndicesSegmentsRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new IndicesSegmentsRequestBuilder(client); return new IndicesSegmentsRequestBuilder(client, this);
} }
} }

View File

@ -19,26 +19,20 @@
package org.elasticsearch.action.admin.indices.segments; package org.elasticsearch.action.admin.indices.segments;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.broadcast.BroadcastOperationRequestBuilder; import org.elasticsearch.action.support.broadcast.BroadcastOperationRequestBuilder;
import org.elasticsearch.client.IndicesAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
* *
*/ */
public class IndicesSegmentsRequestBuilder extends BroadcastOperationRequestBuilder<IndicesSegmentsRequest, IndicesSegmentResponse, IndicesSegmentsRequestBuilder, IndicesAdminClient> { public class IndicesSegmentsRequestBuilder extends BroadcastOperationRequestBuilder<IndicesSegmentsRequest, IndicesSegmentResponse, IndicesSegmentsRequestBuilder> {
public IndicesSegmentsRequestBuilder(IndicesAdminClient indicesClient) { public IndicesSegmentsRequestBuilder(ElasticsearchClient client, IndicesSegmentsAction action) {
super(indicesClient, new IndicesSegmentsRequest()); super(client, action, new IndicesSegmentsRequest());
} }
public IndicesSegmentsRequestBuilder setVerbose(boolean verbose) { public IndicesSegmentsRequestBuilder setVerbose(boolean verbose) {
request.verbose = verbose; request.verbose = verbose;
return this; return this;
} }
@Override
protected void doExecute(ActionListener<IndicesSegmentResponse> listener) {
client.segments(request, listener);
}
} }

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.indices.settings.get; package org.elasticsearch.action.admin.indices.settings.get;
import org.elasticsearch.action.admin.indices.IndicesAction; import org.elasticsearch.action.Action;
import org.elasticsearch.client.IndicesAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
*/ */
public class GetSettingsAction extends IndicesAction<GetSettingsRequest, GetSettingsResponse, GetSettingsRequestBuilder> { public class GetSettingsAction extends Action<GetSettingsRequest, GetSettingsResponse, GetSettingsRequestBuilder> {
public static final GetSettingsAction INSTANCE = new GetSettingsAction(); public static final GetSettingsAction INSTANCE = new GetSettingsAction();
public static final String NAME = "indices:monitor/settings/get"; public static final String NAME = "indices:monitor/settings/get";
@ -34,8 +34,8 @@ public class GetSettingsAction extends IndicesAction<GetSettingsRequest, GetSett
} }
@Override @Override
public GetSettingsRequestBuilder newRequestBuilder(IndicesAdminClient client) { public GetSettingsRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new GetSettingsRequestBuilder(client); return new GetSettingsRequestBuilder(client, this);
} }
@Override @Override

View File

@ -20,17 +20,16 @@
package org.elasticsearch.action.admin.indices.settings.get; package org.elasticsearch.action.admin.indices.settings.get;
import com.google.common.collect.ObjectArrays; import com.google.common.collect.ObjectArrays;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.action.support.master.MasterNodeReadOperationRequestBuilder; import org.elasticsearch.action.support.master.MasterNodeReadOperationRequestBuilder;
import org.elasticsearch.client.IndicesAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
*/ */
public class GetSettingsRequestBuilder extends MasterNodeReadOperationRequestBuilder<GetSettingsRequest, GetSettingsResponse, GetSettingsRequestBuilder, IndicesAdminClient> { public class GetSettingsRequestBuilder extends MasterNodeReadOperationRequestBuilder<GetSettingsRequest, GetSettingsResponse, GetSettingsRequestBuilder> {
public GetSettingsRequestBuilder(IndicesAdminClient client, String... indices) { public GetSettingsRequestBuilder(ElasticsearchClient client, GetSettingsAction action, String... indices) {
super(client, new GetSettingsRequest().indices(indices)); super(client, action, new GetSettingsRequest().indices(indices));
} }
public GetSettingsRequestBuilder setIndices(String... indices) { public GetSettingsRequestBuilder setIndices(String... indices) {
@ -45,7 +44,7 @@ public class GetSettingsRequestBuilder extends MasterNodeReadOperationRequestBui
/** /**
* Specifies what type of requested indices to ignore and wildcard indices expressions. * Specifies what type of requested indices to ignore and wildcard indices expressions.
* * <p/>
* For example indices that don't exist. * For example indices that don't exist.
*/ */
public GetSettingsRequestBuilder setIndicesOptions(IndicesOptions options) { public GetSettingsRequestBuilder setIndicesOptions(IndicesOptions options) {
@ -57,9 +56,4 @@ public class GetSettingsRequestBuilder extends MasterNodeReadOperationRequestBui
request.names(names); request.names(names);
return this; return this;
} }
@Override
protected void doExecute(ActionListener<GetSettingsResponse> listener) {
client.getSettings(request, listener);
}
} }

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.indices.settings.put; package org.elasticsearch.action.admin.indices.settings.put;
import org.elasticsearch.action.admin.indices.IndicesAction; import org.elasticsearch.action.Action;
import org.elasticsearch.client.IndicesAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
*/ */
public class UpdateSettingsAction extends IndicesAction<UpdateSettingsRequest, UpdateSettingsResponse, UpdateSettingsRequestBuilder> { public class UpdateSettingsAction extends Action<UpdateSettingsRequest, UpdateSettingsResponse, UpdateSettingsRequestBuilder> {
public static final UpdateSettingsAction INSTANCE = new UpdateSettingsAction(); public static final UpdateSettingsAction INSTANCE = new UpdateSettingsAction();
public static final String NAME = "indices:admin/settings/update"; public static final String NAME = "indices:admin/settings/update";
@ -39,7 +39,7 @@ public class UpdateSettingsAction extends IndicesAction<UpdateSettingsRequest, U
} }
@Override @Override
public UpdateSettingsRequestBuilder newRequestBuilder(IndicesAdminClient client) { public UpdateSettingsRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new UpdateSettingsRequestBuilder(client); return new UpdateSettingsRequestBuilder(client, this);
} }
} }

View File

@ -22,7 +22,7 @@ package org.elasticsearch.action.admin.indices.settings.put;
import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.action.support.master.AcknowledgedRequestBuilder; import org.elasticsearch.action.support.master.AcknowledgedRequestBuilder;
import org.elasticsearch.client.IndicesAdminClient; import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import java.util.Map; import java.util.Map;
@ -30,10 +30,10 @@ import java.util.Map;
/** /**
* Builder for an update index settings request * Builder for an update index settings request
*/ */
public class UpdateSettingsRequestBuilder extends AcknowledgedRequestBuilder<UpdateSettingsRequest, UpdateSettingsResponse, UpdateSettingsRequestBuilder, IndicesAdminClient> { public class UpdateSettingsRequestBuilder extends AcknowledgedRequestBuilder<UpdateSettingsRequest, UpdateSettingsResponse, UpdateSettingsRequestBuilder> {
public UpdateSettingsRequestBuilder(IndicesAdminClient indicesClient, String... indices) { public UpdateSettingsRequestBuilder(ElasticsearchClient client, UpdateSettingsAction action, String... indices) {
super(indicesClient, new UpdateSettingsRequest(indices)); super(client, action, new UpdateSettingsRequest(indices));
} }
/** /**
@ -46,7 +46,7 @@ public class UpdateSettingsRequestBuilder extends AcknowledgedRequestBuilder<Upd
/** /**
* Specifies what type of requested indices to ignore and wildcard indices expressions. * Specifies what type of requested indices to ignore and wildcard indices expressions.
* * <p/>
* For example indices that don't exist. * For example indices that don't exist.
*/ */
public UpdateSettingsRequestBuilder setIndicesOptions(IndicesOptions options) { public UpdateSettingsRequestBuilder setIndicesOptions(IndicesOptions options) {
@ -85,9 +85,4 @@ public class UpdateSettingsRequestBuilder extends AcknowledgedRequestBuilder<Upd
request.settings(source); request.settings(source);
return this; return this;
} }
@Override
protected void doExecute(ActionListener<UpdateSettingsResponse> listener) {
client.updateSettings(request, listener);
}
} }

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.indices.stats; package org.elasticsearch.action.admin.indices.stats;
import org.elasticsearch.action.admin.indices.IndicesAction; import org.elasticsearch.action.Action;
import org.elasticsearch.client.IndicesAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
*/ */
public class IndicesStatsAction extends IndicesAction<IndicesStatsRequest, IndicesStatsResponse, IndicesStatsRequestBuilder> { public class IndicesStatsAction extends Action<IndicesStatsRequest, IndicesStatsResponse, IndicesStatsRequestBuilder> {
public static final IndicesStatsAction INSTANCE = new IndicesStatsAction(); public static final IndicesStatsAction INSTANCE = new IndicesStatsAction();
public static final String NAME = "indices:monitor/stats"; public static final String NAME = "indices:monitor/stats";
@ -39,7 +39,7 @@ public class IndicesStatsAction extends IndicesAction<IndicesStatsRequest, Indic
} }
@Override @Override
public IndicesStatsRequestBuilder newRequestBuilder(IndicesAdminClient client) { public IndicesStatsRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new IndicesStatsRequestBuilder(client); return new IndicesStatsRequestBuilder(client, this);
} }
} }

View File

@ -19,9 +19,8 @@
package org.elasticsearch.action.admin.indices.stats; package org.elasticsearch.action.admin.indices.stats;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.broadcast.BroadcastOperationRequestBuilder; import org.elasticsearch.action.support.broadcast.BroadcastOperationRequestBuilder;
import org.elasticsearch.client.IndicesAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
* A request to get indices level stats. Allow to enable different stats to be returned. * A request to get indices level stats. Allow to enable different stats to be returned.
@ -32,10 +31,10 @@ import org.elasticsearch.client.IndicesAdminClient;
* <p>All the stats to be returned can be cleared using {@link #clear()}, at which point, specific * <p>All the stats to be returned can be cleared using {@link #clear()}, at which point, specific
* stats can be enabled. * stats can be enabled.
*/ */
public class IndicesStatsRequestBuilder extends BroadcastOperationRequestBuilder<IndicesStatsRequest, IndicesStatsResponse, IndicesStatsRequestBuilder, IndicesAdminClient> { public class IndicesStatsRequestBuilder extends BroadcastOperationRequestBuilder<IndicesStatsRequest, IndicesStatsResponse, IndicesStatsRequestBuilder> {
public IndicesStatsRequestBuilder(IndicesAdminClient indicesClient) { public IndicesStatsRequestBuilder(ElasticsearchClient client, IndicesStatsAction action) {
super(indicesClient, new IndicesStatsRequest()); super(client, action, new IndicesStatsRequest());
} }
/** /**
@ -172,9 +171,4 @@ public class IndicesStatsRequestBuilder extends BroadcastOperationRequestBuilder
request.recovery(recovery); request.recovery(recovery);
return this; return this;
} }
@Override
protected void doExecute(ActionListener<IndicesStatsResponse> listener) {
client.stats(request, listener);
}
} }

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.indices.template.delete; package org.elasticsearch.action.admin.indices.template.delete;
import org.elasticsearch.action.admin.indices.IndicesAction; import org.elasticsearch.action.Action;
import org.elasticsearch.client.IndicesAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
*/ */
public class DeleteIndexTemplateAction extends IndicesAction<DeleteIndexTemplateRequest, DeleteIndexTemplateResponse, DeleteIndexTemplateRequestBuilder> { public class DeleteIndexTemplateAction extends Action<DeleteIndexTemplateRequest, DeleteIndexTemplateResponse, DeleteIndexTemplateRequestBuilder> {
public static final DeleteIndexTemplateAction INSTANCE = new DeleteIndexTemplateAction(); public static final DeleteIndexTemplateAction INSTANCE = new DeleteIndexTemplateAction();
public static final String NAME = "indices:admin/template/delete"; public static final String NAME = "indices:admin/template/delete";
@ -39,7 +39,7 @@ public class DeleteIndexTemplateAction extends IndicesAction<DeleteIndexTemplate
} }
@Override @Override
public DeleteIndexTemplateRequestBuilder newRequestBuilder(IndicesAdminClient client) { public DeleteIndexTemplateRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new DeleteIndexTemplateRequestBuilder(client); return new DeleteIndexTemplateRequestBuilder(client, this);
} }
} }

View File

@ -18,25 +18,19 @@
*/ */
package org.elasticsearch.action.admin.indices.template.delete; package org.elasticsearch.action.admin.indices.template.delete;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.master.MasterNodeOperationRequestBuilder; import org.elasticsearch.action.support.master.MasterNodeOperationRequestBuilder;
import org.elasticsearch.client.IndicesAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
* *
*/ */
public class DeleteIndexTemplateRequestBuilder extends MasterNodeOperationRequestBuilder<DeleteIndexTemplateRequest, DeleteIndexTemplateResponse, DeleteIndexTemplateRequestBuilder, IndicesAdminClient> { public class DeleteIndexTemplateRequestBuilder extends MasterNodeOperationRequestBuilder<DeleteIndexTemplateRequest, DeleteIndexTemplateResponse, DeleteIndexTemplateRequestBuilder> {
public DeleteIndexTemplateRequestBuilder(IndicesAdminClient indicesClient) { public DeleteIndexTemplateRequestBuilder(ElasticsearchClient client, DeleteIndexTemplateAction action) {
super(indicesClient, new DeleteIndexTemplateRequest()); super(client, action, new DeleteIndexTemplateRequest());
} }
public DeleteIndexTemplateRequestBuilder(IndicesAdminClient indicesClient, String name) { public DeleteIndexTemplateRequestBuilder(ElasticsearchClient client, DeleteIndexTemplateAction action, String name) {
super(indicesClient, new DeleteIndexTemplateRequest(name)); super(client, action, new DeleteIndexTemplateRequest(name));
}
@Override
protected void doExecute(ActionListener<DeleteIndexTemplateResponse> listener) {
client.deleteTemplate(request, listener);
} }
} }

View File

@ -18,13 +18,13 @@
*/ */
package org.elasticsearch.action.admin.indices.template.get; package org.elasticsearch.action.admin.indices.template.get;
import org.elasticsearch.action.admin.indices.IndicesAction; import org.elasticsearch.action.Action;
import org.elasticsearch.client.IndicesAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
* *
*/ */
public class GetIndexTemplatesAction extends IndicesAction<GetIndexTemplatesRequest, GetIndexTemplatesResponse, GetIndexTemplatesRequestBuilder> { public class GetIndexTemplatesAction extends Action<GetIndexTemplatesRequest, GetIndexTemplatesResponse, GetIndexTemplatesRequestBuilder> {
public static final GetIndexTemplatesAction INSTANCE = new GetIndexTemplatesAction(); public static final GetIndexTemplatesAction INSTANCE = new GetIndexTemplatesAction();
public static final String NAME = "indices:admin/template/get"; public static final String NAME = "indices:admin/template/get";
@ -39,7 +39,7 @@ public class GetIndexTemplatesAction extends IndicesAction<GetIndexTemplatesRequ
} }
@Override @Override
public GetIndexTemplatesRequestBuilder newRequestBuilder(IndicesAdminClient client) { public GetIndexTemplatesRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new GetIndexTemplatesRequestBuilder(client); return new GetIndexTemplatesRequestBuilder(client, this);
} }
} }

View File

@ -18,25 +18,19 @@
*/ */
package org.elasticsearch.action.admin.indices.template.get; package org.elasticsearch.action.admin.indices.template.get;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.master.MasterNodeReadOperationRequestBuilder; import org.elasticsearch.action.support.master.MasterNodeReadOperationRequestBuilder;
import org.elasticsearch.client.IndicesAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
* *
*/ */
public class GetIndexTemplatesRequestBuilder extends MasterNodeReadOperationRequestBuilder<GetIndexTemplatesRequest, GetIndexTemplatesResponse, GetIndexTemplatesRequestBuilder, IndicesAdminClient> { public class GetIndexTemplatesRequestBuilder extends MasterNodeReadOperationRequestBuilder<GetIndexTemplatesRequest, GetIndexTemplatesResponse, GetIndexTemplatesRequestBuilder> {
public GetIndexTemplatesRequestBuilder(IndicesAdminClient indicesClient) { public GetIndexTemplatesRequestBuilder(ElasticsearchClient client, GetIndexTemplatesAction action) {
super(indicesClient, new GetIndexTemplatesRequest()); super(client, action, new GetIndexTemplatesRequest());
} }
public GetIndexTemplatesRequestBuilder(IndicesAdminClient indicesClient, String... names) { public GetIndexTemplatesRequestBuilder(ElasticsearchClient client, GetIndexTemplatesAction action, String... names) {
super(indicesClient, new GetIndexTemplatesRequest(names)); super(client, action, new GetIndexTemplatesRequest(names));
}
@Override
protected void doExecute(ActionListener<GetIndexTemplatesResponse> listener) {
client.getTemplates(request, listener);
} }
} }

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.indices.template.put; package org.elasticsearch.action.admin.indices.template.put;
import org.elasticsearch.action.admin.indices.IndicesAction; import org.elasticsearch.action.Action;
import org.elasticsearch.client.IndicesAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
*/ */
public class PutIndexTemplateAction extends IndicesAction<PutIndexTemplateRequest, PutIndexTemplateResponse, PutIndexTemplateRequestBuilder> { public class PutIndexTemplateAction extends Action<PutIndexTemplateRequest, PutIndexTemplateResponse, PutIndexTemplateRequestBuilder> {
public static final PutIndexTemplateAction INSTANCE = new PutIndexTemplateAction(); public static final PutIndexTemplateAction INSTANCE = new PutIndexTemplateAction();
public static final String NAME = "indices:admin/template/put"; public static final String NAME = "indices:admin/template/put";
@ -39,7 +39,7 @@ public class PutIndexTemplateAction extends IndicesAction<PutIndexTemplateReques
} }
@Override @Override
public PutIndexTemplateRequestBuilder newRequestBuilder(IndicesAdminClient client) { public PutIndexTemplateRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new PutIndexTemplateRequestBuilder(client); return new PutIndexTemplateRequestBuilder(client, this);
} }
} }

View File

@ -21,7 +21,7 @@ package org.elasticsearch.action.admin.indices.template.put;
import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.admin.indices.alias.Alias; import org.elasticsearch.action.admin.indices.alias.Alias;
import org.elasticsearch.action.support.master.MasterNodeOperationRequestBuilder; import org.elasticsearch.action.support.master.MasterNodeOperationRequestBuilder;
import org.elasticsearch.client.IndicesAdminClient; import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
@ -31,14 +31,14 @@ import java.util.Map;
/** /**
* *
*/ */
public class PutIndexTemplateRequestBuilder extends MasterNodeOperationRequestBuilder<PutIndexTemplateRequest, PutIndexTemplateResponse, PutIndexTemplateRequestBuilder, IndicesAdminClient> { public class PutIndexTemplateRequestBuilder extends MasterNodeOperationRequestBuilder<PutIndexTemplateRequest, PutIndexTemplateResponse, PutIndexTemplateRequestBuilder> {
public PutIndexTemplateRequestBuilder(IndicesAdminClient indicesClient) { public PutIndexTemplateRequestBuilder(ElasticsearchClient client, PutIndexTemplateAction action) {
super(indicesClient, new PutIndexTemplateRequest()); super(client, action, new PutIndexTemplateRequest());
} }
public PutIndexTemplateRequestBuilder(IndicesAdminClient indicesClient, String name) { public PutIndexTemplateRequestBuilder(ElasticsearchClient client, PutIndexTemplateAction action, String name) {
super(indicesClient, new PutIndexTemplateRequest(name)); super(client, action, new PutIndexTemplateRequest(name));
} }
/** /**
@ -238,9 +238,4 @@ public class PutIndexTemplateRequestBuilder extends MasterNodeOperationRequestBu
request.source(templateSource, offset, length); request.source(templateSource, offset, length);
return this; return this;
} }
@Override
protected void doExecute(ActionListener<PutIndexTemplateResponse> listener) {
client.putTemplate(request, listener);
}
} }

View File

@ -19,12 +19,12 @@
package org.elasticsearch.action.admin.indices.validate.query; package org.elasticsearch.action.admin.indices.validate.query;
import org.elasticsearch.action.admin.indices.IndicesAction; import org.elasticsearch.action.Action;
import org.elasticsearch.client.IndicesAdminClient; import org.elasticsearch.client.ElasticsearchClient;
/** /**
*/ */
public class ValidateQueryAction extends IndicesAction<ValidateQueryRequest, ValidateQueryResponse, ValidateQueryRequestBuilder> { public class ValidateQueryAction extends Action<ValidateQueryRequest, ValidateQueryResponse, ValidateQueryRequestBuilder> {
public static final ValidateQueryAction INSTANCE = new ValidateQueryAction(); public static final ValidateQueryAction INSTANCE = new ValidateQueryAction();
public static final String NAME = "indices:admin/validate/query"; public static final String NAME = "indices:admin/validate/query";
@ -39,7 +39,7 @@ public class ValidateQueryAction extends IndicesAction<ValidateQueryRequest, Val
} }
@Override @Override
public ValidateQueryRequestBuilder newRequestBuilder(IndicesAdminClient client) { public ValidateQueryRequestBuilder newRequestBuilder(ElasticsearchClient client) {
return new ValidateQueryRequestBuilder(client); return new ValidateQueryRequestBuilder(client, this);
} }
} }

View File

@ -22,19 +22,19 @@ package org.elasticsearch.action.admin.indices.validate.query;
import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.QuerySourceBuilder; import org.elasticsearch.action.support.QuerySourceBuilder;
import org.elasticsearch.action.support.broadcast.BroadcastOperationRequestBuilder; import org.elasticsearch.action.support.broadcast.BroadcastOperationRequestBuilder;
import org.elasticsearch.client.IndicesAdminClient; import org.elasticsearch.client.ElasticsearchClient;
import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.index.query.QueryBuilder; import org.elasticsearch.index.query.QueryBuilder;
/** /**
* *
*/ */
public class ValidateQueryRequestBuilder extends BroadcastOperationRequestBuilder<ValidateQueryRequest, ValidateQueryResponse, ValidateQueryRequestBuilder, IndicesAdminClient> { public class ValidateQueryRequestBuilder extends BroadcastOperationRequestBuilder<ValidateQueryRequest, ValidateQueryResponse, ValidateQueryRequestBuilder> {
private QuerySourceBuilder sourceBuilder; private QuerySourceBuilder sourceBuilder;
public ValidateQueryRequestBuilder(IndicesAdminClient client) { public ValidateQueryRequestBuilder(ElasticsearchClient client, ValidateQueryAction action) {
super(client, new ValidateQueryRequest()); super(client, action, new ValidateQueryRequest());
} }
/** /**
@ -94,12 +94,11 @@ public class ValidateQueryRequestBuilder extends BroadcastOperationRequestBuilde
} }
@Override @Override
protected void doExecute(ActionListener<ValidateQueryResponse> listener) { protected ValidateQueryRequest beforeExecute(ValidateQueryRequest request) {
if (sourceBuilder != null) { if (sourceBuilder != null) {
request.source(sourceBuilder); request.source(sourceBuilder);
} }
return request;
client.validateQuery(request, listener);
} }
private QuerySourceBuilder sourceBuilder() { private QuerySourceBuilder sourceBuilder() {

Some files were not shown because too many files have changed in this diff Show More