rename RequestBuilder to ActionRequestBuilder and have a request() method on the actual interface

This commit is contained in:
Shay Banon 2012-01-15 12:14:57 +02:00
parent 6ff15b928c
commit c3c5aec567
4 changed files with 19 additions and 7 deletions

View File

@ -27,7 +27,9 @@ import org.elasticsearch.action.ListenableActionFuture;
/**
*
*/
public interface RequestBuilder<Request extends ActionRequest, Response extends ActionResponse> {
public interface ActionRequestBuilder<Request extends ActionRequest, Response extends ActionResponse> {
Request request();
ListenableActionFuture<Response> execute();

View File

@ -25,13 +25,13 @@ import org.elasticsearch.action.ActionResponse;
import org.elasticsearch.action.ListenableActionFuture;
import org.elasticsearch.action.support.PlainListenableActionFuture;
import org.elasticsearch.client.ClusterAdminClient;
import org.elasticsearch.client.action.RequestBuilder;
import org.elasticsearch.client.action.ActionRequestBuilder;
import org.elasticsearch.client.internal.InternalClusterAdminClient;
/**
*
*/
public abstract class BaseClusterRequestBuilder<Request extends ActionRequest, Response extends ActionResponse> implements RequestBuilder<Request, Response> {
public abstract class BaseClusterRequestBuilder<Request extends ActionRequest, Response extends ActionResponse> implements ActionRequestBuilder<Request, Response> {
protected final InternalClusterAdminClient client;
@ -42,6 +42,11 @@ public abstract class BaseClusterRequestBuilder<Request extends ActionRequest, R
this.request = request;
}
@Override
public Request request() {
return request;
}
@Override
public ListenableActionFuture<Response> execute() {
PlainListenableActionFuture<Response> future = new PlainListenableActionFuture<Response>(request.listenerThreaded(), client.threadPool());

View File

@ -25,13 +25,13 @@ import org.elasticsearch.action.ActionResponse;
import org.elasticsearch.action.ListenableActionFuture;
import org.elasticsearch.action.support.PlainListenableActionFuture;
import org.elasticsearch.client.IndicesAdminClient;
import org.elasticsearch.client.action.RequestBuilder;
import org.elasticsearch.client.action.ActionRequestBuilder;
import org.elasticsearch.client.internal.InternalIndicesAdminClient;
/**
*
*/
public abstract class BaseIndicesRequestBuilder<Request extends ActionRequest, Response extends ActionResponse> implements RequestBuilder<Request, Response> {
public abstract class BaseIndicesRequestBuilder<Request extends ActionRequest, Response extends ActionResponse> implements ActionRequestBuilder<Request, Response> {
protected final InternalIndicesAdminClient client;
@ -42,6 +42,11 @@ public abstract class BaseIndicesRequestBuilder<Request extends ActionRequest, R
this.request = request;
}
@Override
public Request request() {
return request;
}
@Override
public ListenableActionFuture<Response> execute() {
PlainListenableActionFuture<Response> future = new PlainListenableActionFuture<Response>(request.listenerThreaded(), client.threadPool());

View File

@ -25,13 +25,13 @@ import org.elasticsearch.action.ActionResponse;
import org.elasticsearch.action.ListenableActionFuture;
import org.elasticsearch.action.support.PlainListenableActionFuture;
import org.elasticsearch.client.Client;
import org.elasticsearch.client.action.RequestBuilder;
import org.elasticsearch.client.action.ActionRequestBuilder;
import org.elasticsearch.client.internal.InternalClient;
/**
*
*/
public abstract class BaseRequestBuilder<Request extends ActionRequest, Response extends ActionResponse> implements RequestBuilder<Request, Response> {
public abstract class BaseRequestBuilder<Request extends ActionRequest, Response extends ActionResponse> implements ActionRequestBuilder<Request, Response> {
protected final InternalClient client;