simplify support transport actions, no need to provide several action paths, we can derive them

This commit is contained in:
Shay Banon 2012-01-03 13:43:27 +02:00
parent a793336635
commit ed1d1249fc
26 changed files with 4 additions and 129 deletions

View File

@ -60,11 +60,6 @@ public class TransportNodesInfoAction extends TransportNodesOperationAction<Node
return TransportActions.Admin.Cluster.Node.INFO; return TransportActions.Admin.Cluster.Node.INFO;
} }
@Override
protected String transportNodeAction() {
return "/cluster/nodes/info/node";
}
@Override @Override
protected NodesInfoResponse newResponse(NodesInfoRequest nodesInfoRequest, AtomicReferenceArray responses) { protected NodesInfoResponse newResponse(NodesInfoRequest nodesInfoRequest, AtomicReferenceArray responses) {
final List<NodeInfo> nodesInfos = new ArrayList<NodeInfo>(); final List<NodeInfo> nodesInfos = new ArrayList<NodeInfo>();

View File

@ -79,11 +79,6 @@ public class TransportNodesRestartAction extends TransportNodesOperationAction<N
return TransportActions.Admin.Cluster.Node.RESTART; return TransportActions.Admin.Cluster.Node.RESTART;
} }
@Override
protected String transportNodeAction() {
return "/cluster/nodes/restart/node";
}
@Override @Override
protected NodesRestartResponse newResponse(NodesRestartRequest nodesShutdownRequest, AtomicReferenceArray responses) { protected NodesRestartResponse newResponse(NodesRestartRequest nodesShutdownRequest, AtomicReferenceArray responses) {
final List<NodesRestartResponse.NodeRestartResponse> nodeRestartResponses = newArrayList(); final List<NodesRestartResponse.NodeRestartResponse> nodeRestartResponses = newArrayList();

View File

@ -60,11 +60,6 @@ public class TransportNodesStatsAction extends TransportNodesOperationAction<Nod
return TransportActions.Admin.Cluster.Node.STATS; return TransportActions.Admin.Cluster.Node.STATS;
} }
@Override
protected String transportNodeAction() {
return "/cluster/nodes/stats/node";
}
@Override @Override
protected NodesStatsResponse newResponse(NodesStatsRequest nodesInfoRequest, AtomicReferenceArray responses) { protected NodesStatsResponse newResponse(NodesStatsRequest nodesInfoRequest, AtomicReferenceArray responses) {
final List<NodeStats> nodeStats = Lists.newArrayList(); final List<NodeStats> nodeStats = Lists.newArrayList();

View File

@ -59,11 +59,6 @@ public class TransportBroadcastPingAction extends TransportBroadcastOperationAct
return TransportActions.Admin.Cluster.Ping.BROADCAST; return TransportActions.Admin.Cluster.Ping.BROADCAST;
} }
@Override
protected String transportShardAction() {
return "/cluster/ping/broadcast/shard";
}
@Override @Override
protected BroadcastPingRequest newRequest() { protected BroadcastPingRequest newRequest() {
return new BroadcastPingRequest(); return new BroadcastPingRequest();

View File

@ -50,11 +50,6 @@ public class TransportSinglePingAction extends TransportShardSingleOperationActi
return TransportActions.Admin.Cluster.Ping.SINGLE; return TransportActions.Admin.Cluster.Ping.SINGLE;
} }
@Override
protected String transportShardAction() {
return "/cluster/ping/single/shard";
}
@Override @Override
protected ShardIterator shards(ClusterState clusterState, SinglePingRequest request) throws ElasticSearchException { protected ShardIterator shards(ClusterState clusterState, SinglePingRequest request) throws ElasticSearchException {
return clusterService.operationRouting() return clusterService.operationRouting()

View File

@ -86,11 +86,6 @@ public class TransportAnalyzeAction extends TransportSingleCustomOperationAction
return TransportActions.Admin.Indices.ANALYZE; return TransportActions.Admin.Indices.ANALYZE;
} }
@Override
protected String transportShardAction() {
return "indices/analyze/shard";
}
@Override @Override
protected ShardsIterator shards(ClusterState clusterState, AnalyzeRequest request) { protected ShardsIterator shards(ClusterState clusterState, AnalyzeRequest request) {
if (request.index() == null) { if (request.index() == null) {

View File

@ -43,8 +43,6 @@ import static com.google.common.collect.Lists.newArrayList;
/** /**
* Indices clear cache action. * Indices clear cache action.
*
*
*/ */
public class TransportClearIndicesCacheAction extends TransportBroadcastOperationAction<ClearIndicesCacheRequest, ClearIndicesCacheResponse, ShardClearIndicesCacheRequest, ShardClearIndicesCacheResponse> { public class TransportClearIndicesCacheAction extends TransportBroadcastOperationAction<ClearIndicesCacheRequest, ClearIndicesCacheResponse, ShardClearIndicesCacheRequest, ShardClearIndicesCacheResponse> {
@ -67,12 +65,6 @@ public class TransportClearIndicesCacheAction extends TransportBroadcastOperatio
return TransportActions.Admin.Indices.Cache.CLEAR; return TransportActions.Admin.Indices.Cache.CLEAR;
} }
@Override
protected String transportShardAction() {
return "indices/cache/clear/shard";
}
@Override @Override
protected ClearIndicesCacheRequest newRequest() { protected ClearIndicesCacheRequest newRequest() {
return new ClearIndicesCacheRequest(); return new ClearIndicesCacheRequest();

View File

@ -44,8 +44,6 @@ import static com.google.common.collect.Lists.newArrayList;
/** /**
* Flush Action. * Flush Action.
*
*
*/ */
public class TransportFlushAction extends TransportBroadcastOperationAction<FlushRequest, FlushResponse, ShardFlushRequest, ShardFlushResponse> { public class TransportFlushAction extends TransportBroadcastOperationAction<FlushRequest, FlushResponse, ShardFlushRequest, ShardFlushResponse> {
@ -67,11 +65,6 @@ public class TransportFlushAction extends TransportBroadcastOperationAction<Flus
return TransportActions.Admin.Indices.FLUSH; return TransportActions.Admin.Indices.FLUSH;
} }
@Override
protected String transportShardAction() {
return "indices/flush/shard";
}
@Override @Override
protected FlushRequest newRequest() { protected FlushRequest newRequest() {
return new FlushRequest(); return new FlushRequest();

View File

@ -64,11 +64,6 @@ public class TransportGatewaySnapshotAction extends TransportBroadcastOperationA
return TransportActions.Admin.Indices.Gateway.SNAPSHOT; return TransportActions.Admin.Indices.Gateway.SNAPSHOT;
} }
@Override
protected String transportShardAction() {
return "indices/gateway/snapshot/shard";
}
@Override @Override
protected GatewaySnapshotRequest newRequest() { protected GatewaySnapshotRequest newRequest() {
return new GatewaySnapshotRequest(); return new GatewaySnapshotRequest();

View File

@ -44,8 +44,6 @@ import static com.google.common.collect.Lists.newArrayList;
/** /**
* Optimize index/indices action. * Optimize index/indices action.
*
*
*/ */
public class TransportOptimizeAction extends TransportBroadcastOperationAction<OptimizeRequest, OptimizeResponse, ShardOptimizeRequest, ShardOptimizeResponse> { public class TransportOptimizeAction extends TransportBroadcastOperationAction<OptimizeRequest, OptimizeResponse, ShardOptimizeRequest, ShardOptimizeResponse> {
@ -70,11 +68,6 @@ public class TransportOptimizeAction extends TransportBroadcastOperationAction<O
return TransportActions.Admin.Indices.OPTIMIZE; return TransportActions.Admin.Indices.OPTIMIZE;
} }
@Override
protected String transportShardAction() {
return "indices/optimize/shard";
}
@Override @Override
protected OptimizeRequest newRequest() { protected OptimizeRequest newRequest() {
return new OptimizeRequest(); return new OptimizeRequest();

View File

@ -70,11 +70,6 @@ public class TransportRefreshAction extends TransportBroadcastOperationAction<Re
return TransportActions.Admin.Indices.REFRESH; return TransportActions.Admin.Indices.REFRESH;
} }
@Override
protected String transportShardAction() {
return "indices/refresh/shard";
}
@Override @Override
protected RefreshRequest newRequest() { protected RefreshRequest newRequest() {
return new RefreshRequest(); return new RefreshRequest();

View File

@ -70,11 +70,6 @@ public class TransportIndicesSegmentsAction extends TransportBroadcastOperationA
return TransportActions.Admin.Indices.SEGMENTS; return TransportActions.Admin.Indices.SEGMENTS;
} }
@Override
protected String transportShardAction() {
return "indices/segments/shard";
}
@Override @Override
protected IndicesSegmentsRequest newRequest() { protected IndicesSegmentsRequest newRequest() {
return new IndicesSegmentsRequest(); return new IndicesSegmentsRequest();

View File

@ -70,11 +70,6 @@ public class TransportIndicesStatsAction extends TransportBroadcastOperationActi
return TransportActions.Admin.Indices.STATS; return TransportActions.Admin.Indices.STATS;
} }
@Override
protected String transportShardAction() {
return "indices/stats/shard";
}
@Override @Override
protected IndicesStatsRequest newRequest() { protected IndicesStatsRequest newRequest() {
return new IndicesStatsRequest(); return new IndicesStatsRequest();

View File

@ -79,11 +79,6 @@ public class TransportIndicesStatusAction extends TransportBroadcastOperationAct
return TransportActions.Admin.Indices.STATUS; return TransportActions.Admin.Indices.STATUS;
} }
@Override
protected String transportShardAction() {
return "indices/status/shard";
}
@Override @Override
protected IndicesStatusRequest newRequest() { protected IndicesStatusRequest newRequest() {
return new IndicesStatusRequest(); return new IndicesStatusRequest();

View File

@ -69,11 +69,6 @@ public class TransportValidateQueryAction extends TransportBroadcastOperationAct
return TransportActions.Admin.Indices.VALIDATE_QUERY; return TransportActions.Admin.Indices.VALIDATE_QUERY;
} }
@Override
protected String transportShardAction() {
return "indices/validateQuery/shard";
}
@Override @Override
protected ValidateQueryRequest newRequest() { protected ValidateQueryRequest newRequest() {
return new ValidateQueryRequest(); return new ValidateQueryRequest();

View File

@ -67,11 +67,6 @@ public class TransportCountAction extends TransportBroadcastOperationAction<Coun
return TransportActions.COUNT; return TransportActions.COUNT;
} }
@Override
protected String transportShardAction() {
return TransportActions.COUNT + "/shard";
}
@Override @Override
protected CountRequest newRequest() { protected CountRequest newRequest() {
return new CountRequest(); return new CountRequest();

View File

@ -66,11 +66,6 @@ public class TransportGetAction extends TransportShardSingleOperationAction<GetR
return TransportActions.GET; return TransportActions.GET;
} }
@Override
protected String transportShardAction() {
return TransportActions.GET + "/shard";
}
@Override @Override
protected void checkBlock(GetRequest request, ClusterState state) { protected void checkBlock(GetRequest request, ClusterState state) {
state.blocks().indexBlockedRaiseException(ClusterBlockLevel.READ, request.index()); state.blocks().indexBlockedRaiseException(ClusterBlockLevel.READ, request.index());

View File

@ -63,11 +63,6 @@ public class TransportShardMultiGetAction extends TransportShardSingleOperationA
return TransportActions.MULTI_GET + "/shard"; return TransportActions.MULTI_GET + "/shard";
} }
@Override
protected String transportShardAction() {
return TransportActions.MULTI_GET + "/shard/s";
}
@Override @Override
protected MultiGetShardRequest newRequest() { protected MultiGetShardRequest newRequest() {
return new MultiGetShardRequest(); return new MultiGetShardRequest();

View File

@ -68,11 +68,6 @@ public class TransportPercolateAction extends TransportSingleCustomOperationActi
return TransportActions.PERCOLATE; return TransportActions.PERCOLATE;
} }
@Override
protected String transportShardAction() {
return TransportActions.PERCOLATE + "/shard";
}
@Override @Override
protected ShardsIterator shards(ClusterState clusterState, PercolateRequest request) { protected ShardsIterator shards(ClusterState clusterState, PercolateRequest request) {
request.index(clusterState.metaData().concreteIndex(request.index())); request.index(clusterState.metaData().concreteIndex(request.index()));

View File

@ -60,7 +60,7 @@ public abstract class TransportBroadcastOperationAction<Request extends Broadcas
this.threadPool = threadPool; this.threadPool = threadPool;
this.transportAction = transportAction(); this.transportAction = transportAction();
this.transportShardAction = transportShardAction(); this.transportShardAction = transportAction() + "/s";
this.executor = executor(); this.executor = executor();
transportService.registerHandler(transportAction, new TransportHandler()); transportService.registerHandler(transportAction, new TransportHandler());
@ -74,8 +74,6 @@ public abstract class TransportBroadcastOperationAction<Request extends Broadcas
protected abstract String transportAction(); protected abstract String transportAction();
protected abstract String transportShardAction();
protected abstract String executor(); protected abstract String executor();
protected abstract Request newRequest(); protected abstract Request newRequest();

View File

@ -61,7 +61,7 @@ public abstract class TransportNodesOperationAction<Request extends NodesOperati
this.transportService = transportService; this.transportService = transportService;
this.transportAction = transportAction(); this.transportAction = transportAction();
this.transportNodeAction = transportNodeAction(); this.transportNodeAction = transportAction() + "/n";
this.executor = executor(); this.executor = executor();
transportService.registerHandler(transportAction, new TransportHandler()); transportService.registerHandler(transportAction, new TransportHandler());
@ -75,8 +75,6 @@ public abstract class TransportNodesOperationAction<Request extends NodesOperati
protected abstract String transportAction(); protected abstract String transportAction();
protected abstract String transportNodeAction();
protected boolean transportCompress() { protected boolean transportCompress() {
return false; return false;
} }

View File

@ -58,7 +58,7 @@ public abstract class TransportSingleCustomOperationAction<Request extends Singl
this.transportService = transportService; this.transportService = transportService;
this.transportAction = transportAction(); this.transportAction = transportAction();
this.transportShardAction = transportShardAction(); this.transportShardAction = transportAction() + "/s";
this.executor = executor(); this.executor = executor();
transportService.registerHandler(transportAction, new TransportHandler()); transportService.registerHandler(transportAction, new TransportHandler());
@ -72,8 +72,6 @@ public abstract class TransportSingleCustomOperationAction<Request extends Singl
protected abstract String transportAction(); protected abstract String transportAction();
protected abstract String transportShardAction();
protected abstract String executor(); protected abstract String executor();
/** /**

View File

@ -59,7 +59,7 @@ public abstract class TransportShardSingleOperationAction<Request extends Single
this.transportService = transportService; this.transportService = transportService;
this.transportAction = transportAction(); this.transportAction = transportAction();
this.transportShardAction = transportShardAction(); this.transportShardAction = transportAction() + "/s";
this.executor = executor(); this.executor = executor();
transportService.registerHandler(transportAction, new TransportHandler()); transportService.registerHandler(transportAction, new TransportHandler());
@ -73,8 +73,6 @@ public abstract class TransportShardSingleOperationAction<Request extends Single
protected abstract String transportAction(); protected abstract String transportAction();
protected abstract String transportShardAction();
protected abstract String executor(); protected abstract String executor();
protected abstract Response shardOperation(Request request, int shardId) throws ElasticSearchException; protected abstract Response shardOperation(Request request, int shardId) throws ElasticSearchException;

View File

@ -72,11 +72,6 @@ public class TransportNodesListGatewayMetaState extends TransportNodesOperationA
return "/gateway/local/meta-state"; return "/gateway/local/meta-state";
} }
@Override
protected String transportNodeAction() {
return "/gateway/local/meta-state/node";
}
@Override @Override
protected boolean transportCompress() { protected boolean transportCompress() {
return true; // compress since the metadata can become large return true; // compress since the metadata can become large

View File

@ -74,11 +74,6 @@ public class TransportNodesListGatewayStartedShards extends TransportNodesOperat
return "/gateway/local/started-shards"; return "/gateway/local/started-shards";
} }
@Override
protected String transportNodeAction() {
return "/gateway/local/started-shards/node";
}
@Override @Override
protected boolean transportCompress() { protected boolean transportCompress() {
return true; // this can become big... return true; // this can become big...

View File

@ -86,11 +86,6 @@ public class TransportNodesListShardStoreMetaData extends TransportNodesOperatio
return "/cluster/nodes/indices/shard/store"; return "/cluster/nodes/indices/shard/store";
} }
@Override
protected String transportNodeAction() {
return "/cluster/nodes/indices/shard/store/node";
}
@Override @Override
protected Request newRequest() { protected Request newRequest() {
return new Request(); return new Request();