Use TransportMasterNodeOperationAction in TransportGetIndexTemplatesAction

No need to use ClusterInfoRequest, as we do not need to access any indices.
This commit is contained in:
Alexander Reelsen 2013-08-12 14:44:25 +02:00
parent 4d40a1e77c
commit 5c853fb22d
2 changed files with 5 additions and 7 deletions

View File

@ -19,7 +19,7 @@
package org.elasticsearch.action.admin.indices.template.get; package org.elasticsearch.action.admin.indices.template.get;
import org.elasticsearch.action.ActionRequestValidationException; import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.support.master.info.ClusterInfoRequest; import org.elasticsearch.action.support.master.MasterNodeOperationRequest;
import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.StreamOutput;
@ -30,7 +30,7 @@ import static org.elasticsearch.action.ValidateActions.addValidationError;
/** /**
* *
*/ */
public class GetIndexTemplatesRequest extends ClusterInfoRequest<GetIndexTemplatesRequest> { public class GetIndexTemplatesRequest extends MasterNodeOperationRequest<GetIndexTemplatesRequest> {
private String name; private String name;

View File

@ -21,12 +21,10 @@ package org.elasticsearch.action.admin.indices.template.get;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import org.elasticsearch.ElasticSearchException; import org.elasticsearch.ElasticSearchException;
import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.master.info.TransportClusterInfoAction; import org.elasticsearch.action.support.master.TransportMasterNodeOperationAction;
import org.elasticsearch.cluster.ClusterService; import org.elasticsearch.cluster.ClusterService;
import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.metadata.IndexMetaData;
import org.elasticsearch.cluster.metadata.IndexTemplateMetaData; import org.elasticsearch.cluster.metadata.IndexTemplateMetaData;
import org.elasticsearch.cluster.metadata.MetaDataIndexTemplateService;
import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.regex.Regex; import org.elasticsearch.common.regex.Regex;
import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.Settings;
@ -39,7 +37,7 @@ import java.util.Map;
/** /**
* *
*/ */
public class TransportGetIndexTemplatesAction extends TransportClusterInfoAction<GetIndexTemplatesRequest, GetIndexTemplatesResponse> { public class TransportGetIndexTemplatesAction extends TransportMasterNodeOperationAction<GetIndexTemplatesRequest, GetIndexTemplatesResponse> {
@Inject @Inject
public TransportGetIndexTemplatesAction(Settings settings, TransportService transportService, ClusterService clusterService, ThreadPool threadPool) { public TransportGetIndexTemplatesAction(Settings settings, TransportService transportService, ClusterService clusterService, ThreadPool threadPool) {
@ -67,7 +65,7 @@ public class TransportGetIndexTemplatesAction extends TransportClusterInfoAction
} }
@Override @Override
protected void doMasterOperation(final GetIndexTemplatesRequest request, final ClusterState state, final ActionListener<GetIndexTemplatesResponse> listener) throws ElasticSearchException { protected void masterOperation(GetIndexTemplatesRequest request, ClusterState state, ActionListener<GetIndexTemplatesResponse> listener) throws ElasticSearchException {
List<IndexTemplateMetaData> results = Lists.newArrayList(); List<IndexTemplateMetaData> results = Lists.newArrayList();
if (Regex.isSimpleMatchPattern(request.name())) { if (Regex.isSimpleMatchPattern(request.name())) {