From 303c9faca559459949ec332deeca0e9a2bc2a025 Mon Sep 17 00:00:00 2001 From: Nik Everett Date: Fri, 29 Jul 2016 17:30:58 -0400 Subject: [PATCH] Squash o.e.rest.action.admin.cluster In an effort to reduce the number of tiny packages we have in the code base this moves all the files that were in subdirectories of `org.elasticsearch.rest.action.admin.cluster` into `org.elasticsearch.rest.action.admin.cluster`. Also fixes line length in these packages. --- .../resources/checkstyle_suppressions.xml | 7 --- .../elasticsearch/action/ActionModule.java | 54 +++++++++---------- .../elasticsearch/rest/RestController.java | 1 - .../org/elasticsearch/rest/RestRequest.java | 1 - .../rest/{support => }/RestUtils.java | 6 +-- .../tasks => }/RestCancelTasksAction.java | 4 +- .../RestClusterAllocationExplainAction.java | 2 +- .../RestClusterGetSettingsAction.java | 13 +++-- .../{health => }/RestClusterHealthAction.java | 2 +- .../RestClusterRerouteAction.java | 2 +- .../RestClusterSearchShardsAction.java | 2 +- .../{state => }/RestClusterStateAction.java | 14 ++--- .../{stats => }/RestClusterStatsAction.java | 2 +- .../RestClusterUpdateSettingsAction.java | 30 +++++------ .../create => }/RestCreateSnapshotAction.java | 2 +- .../RestDeleteRepositoryAction.java | 2 +- .../delete => }/RestDeleteSnapshotAction.java | 2 +- .../RestDeleteStoredScriptAction.java | 2 +- .../get => }/RestGetRepositoriesAction.java | 2 +- .../get => }/RestGetSnapshotsAction.java | 2 +- .../RestGetStoredScriptAction.java | 2 +- .../{node/tasks => }/RestGetTaskAction.java | 2 +- .../{node/tasks => }/RestListTasksAction.java | 2 +- .../RestNodesHotThreadsAction.java | 2 +- .../{node/info => }/RestNodesInfoAction.java | 18 ++++--- .../stats => }/RestNodesStatsAction.java | 12 ++--- .../RestPendingClusterTasksAction.java | 7 +-- .../put => }/RestPutRepositoryAction.java | 2 +- .../RestPutStoredScriptAction.java | 2 +- .../RestRestoreSnapshotAction.java | 2 +- .../RestSnapshotsStatusAction.java | 2 +- .../RestVerifyRepositoryAction.java | 2 +- .../action/admin/cluster/package-info.java | 24 +++++++++ .../rest/action/cat/RestTasksAction.java | 2 +- .../reroute/ClusterRerouteRequestTests.java | 2 +- .../common/path/PathTrieTests.java | 2 +- .../rest/BytesRestResponseTests.java | 1 - .../rest/{util => }/RestUtilsTests.java | 15 +++--- .../DedicatedClusterSnapshotRestoreIT.java | 4 +- .../RestDeleteSearchTemplateAction.java | 2 +- .../mustache/RestGetSearchTemplateAction.java | 2 +- .../mustache/RestPutSearchTemplateAction.java | 2 +- .../index/reindex/RestRethrottleAction.java | 2 +- .../http/netty3/Netty3HttpRequest.java | 2 +- .../netty3/Netty3HttpServerTransport.java | 2 +- .../http/netty4/Netty4HttpRequest.java | 3 +- .../netty4/Netty4HttpServerTransport.java | 2 +- .../blobstore/gcs/MockHttpTransport.java | 2 +- 48 files changed, 143 insertions(+), 133 deletions(-) rename core/src/main/java/org/elasticsearch/rest/{support => }/RestUtils.java (99%) rename core/src/main/java/org/elasticsearch/rest/action/admin/cluster/{node/tasks => }/RestCancelTasksAction.java (94%) rename core/src/main/java/org/elasticsearch/rest/action/admin/cluster/{allocation => }/RestClusterAllocationExplainAction.java (98%) rename core/src/main/java/org/elasticsearch/rest/action/admin/cluster/{settings => }/RestClusterGetSettingsAction.java (94%) rename core/src/main/java/org/elasticsearch/rest/action/admin/cluster/{health => }/RestClusterHealthAction.java (98%) rename core/src/main/java/org/elasticsearch/rest/action/admin/cluster/{reroute => }/RestClusterRerouteAction.java (99%) rename core/src/main/java/org/elasticsearch/rest/action/admin/cluster/{shards => }/RestClusterSearchShardsAction.java (98%) rename core/src/main/java/org/elasticsearch/rest/action/admin/cluster/{state => }/RestClusterStateAction.java (91%) rename core/src/main/java/org/elasticsearch/rest/action/admin/cluster/{stats => }/RestClusterStatsAction.java (97%) rename core/src/main/java/org/elasticsearch/rest/action/admin/cluster/{settings => }/RestClusterUpdateSettingsAction.java (76%) rename core/src/main/java/org/elasticsearch/rest/action/admin/cluster/{snapshots/create => }/RestCreateSnapshotAction.java (97%) rename core/src/main/java/org/elasticsearch/rest/action/admin/cluster/{repositories/delete => }/RestDeleteRepositoryAction.java (97%) rename core/src/main/java/org/elasticsearch/rest/action/admin/cluster/{snapshots/delete => }/RestDeleteSnapshotAction.java (97%) rename core/src/main/java/org/elasticsearch/rest/action/admin/cluster/{storedscripts => }/RestDeleteStoredScriptAction.java (97%) rename core/src/main/java/org/elasticsearch/rest/action/admin/cluster/{repositories/get => }/RestGetRepositoriesAction.java (98%) rename core/src/main/java/org/elasticsearch/rest/action/admin/cluster/{snapshots/get => }/RestGetSnapshotsAction.java (97%) rename core/src/main/java/org/elasticsearch/rest/action/admin/cluster/{storedscripts => }/RestGetStoredScriptAction.java (98%) rename core/src/main/java/org/elasticsearch/rest/action/admin/cluster/{node/tasks => }/RestGetTaskAction.java (97%) rename core/src/main/java/org/elasticsearch/rest/action/admin/cluster/{node/tasks => }/RestListTasksAction.java (98%) rename core/src/main/java/org/elasticsearch/rest/action/admin/cluster/{node/hotthreads => }/RestNodesHotThreadsAction.java (98%) rename core/src/main/java/org/elasticsearch/rest/action/admin/cluster/{node/info => }/RestNodesInfoAction.java (94%) rename core/src/main/java/org/elasticsearch/rest/action/admin/cluster/{node/stats => }/RestNodesStatsAction.java (93%) rename core/src/main/java/org/elasticsearch/rest/action/admin/cluster/{tasks => }/RestPendingClusterTasksAction.java (90%) rename core/src/main/java/org/elasticsearch/rest/action/admin/cluster/{repositories/put => }/RestPutRepositoryAction.java (97%) rename core/src/main/java/org/elasticsearch/rest/action/admin/cluster/{storedscripts => }/RestPutStoredScriptAction.java (97%) rename core/src/main/java/org/elasticsearch/rest/action/admin/cluster/{snapshots/restore => }/RestRestoreSnapshotAction.java (97%) rename core/src/main/java/org/elasticsearch/rest/action/admin/cluster/{snapshots/status => }/RestSnapshotsStatusAction.java (97%) rename core/src/main/java/org/elasticsearch/rest/action/admin/cluster/{repositories/verify => }/RestVerifyRepositoryAction.java (96%) create mode 100644 core/src/main/java/org/elasticsearch/rest/action/admin/cluster/package-info.java rename core/src/test/java/org/elasticsearch/rest/{util => }/RestUtilsTests.java (95%) diff --git a/buildSrc/src/main/resources/checkstyle_suppressions.xml b/buildSrc/src/main/resources/checkstyle_suppressions.xml index 05351b0f8e2..d16383cb87a 100644 --- a/buildSrc/src/main/resources/checkstyle_suppressions.xml +++ b/buildSrc/src/main/resources/checkstyle_suppressions.xml @@ -507,12 +507,6 @@ - - - - - - @@ -989,7 +983,6 @@ - diff --git a/core/src/main/java/org/elasticsearch/action/ActionModule.java b/core/src/main/java/org/elasticsearch/action/ActionModule.java index 83c3ec712b9..9bff5fda187 100644 --- a/core/src/main/java/org/elasticsearch/action/ActionModule.java +++ b/core/src/main/java/org/elasticsearch/action/ActionModule.java @@ -209,33 +209,33 @@ import org.elasticsearch.plugins.ActionPlugin; import org.elasticsearch.plugins.ActionPlugin.ActionHandler; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestHandler; -import org.elasticsearch.rest.action.admin.cluster.allocation.RestClusterAllocationExplainAction; -import org.elasticsearch.rest.action.admin.cluster.health.RestClusterHealthAction; -import org.elasticsearch.rest.action.admin.cluster.node.hotthreads.RestNodesHotThreadsAction; -import org.elasticsearch.rest.action.admin.cluster.node.info.RestNodesInfoAction; -import org.elasticsearch.rest.action.admin.cluster.node.stats.RestNodesStatsAction; -import org.elasticsearch.rest.action.admin.cluster.node.tasks.RestCancelTasksAction; -import org.elasticsearch.rest.action.admin.cluster.node.tasks.RestGetTaskAction; -import org.elasticsearch.rest.action.admin.cluster.node.tasks.RestListTasksAction; -import org.elasticsearch.rest.action.admin.cluster.repositories.delete.RestDeleteRepositoryAction; -import org.elasticsearch.rest.action.admin.cluster.repositories.get.RestGetRepositoriesAction; -import org.elasticsearch.rest.action.admin.cluster.repositories.put.RestPutRepositoryAction; -import org.elasticsearch.rest.action.admin.cluster.repositories.verify.RestVerifyRepositoryAction; -import org.elasticsearch.rest.action.admin.cluster.reroute.RestClusterRerouteAction; -import org.elasticsearch.rest.action.admin.cluster.settings.RestClusterGetSettingsAction; -import org.elasticsearch.rest.action.admin.cluster.settings.RestClusterUpdateSettingsAction; -import org.elasticsearch.rest.action.admin.cluster.shards.RestClusterSearchShardsAction; -import org.elasticsearch.rest.action.admin.cluster.snapshots.create.RestCreateSnapshotAction; -import org.elasticsearch.rest.action.admin.cluster.snapshots.delete.RestDeleteSnapshotAction; -import org.elasticsearch.rest.action.admin.cluster.snapshots.get.RestGetSnapshotsAction; -import org.elasticsearch.rest.action.admin.cluster.snapshots.restore.RestRestoreSnapshotAction; -import org.elasticsearch.rest.action.admin.cluster.snapshots.status.RestSnapshotsStatusAction; -import org.elasticsearch.rest.action.admin.cluster.state.RestClusterStateAction; -import org.elasticsearch.rest.action.admin.cluster.stats.RestClusterStatsAction; -import org.elasticsearch.rest.action.admin.cluster.storedscripts.RestDeleteStoredScriptAction; -import org.elasticsearch.rest.action.admin.cluster.storedscripts.RestGetStoredScriptAction; -import org.elasticsearch.rest.action.admin.cluster.storedscripts.RestPutStoredScriptAction; -import org.elasticsearch.rest.action.admin.cluster.tasks.RestPendingClusterTasksAction; +import org.elasticsearch.rest.action.admin.cluster.RestCancelTasksAction; +import org.elasticsearch.rest.action.admin.cluster.RestClusterAllocationExplainAction; +import org.elasticsearch.rest.action.admin.cluster.RestClusterGetSettingsAction; +import org.elasticsearch.rest.action.admin.cluster.RestClusterHealthAction; +import org.elasticsearch.rest.action.admin.cluster.RestClusterRerouteAction; +import org.elasticsearch.rest.action.admin.cluster.RestClusterSearchShardsAction; +import org.elasticsearch.rest.action.admin.cluster.RestClusterStateAction; +import org.elasticsearch.rest.action.admin.cluster.RestClusterStatsAction; +import org.elasticsearch.rest.action.admin.cluster.RestClusterUpdateSettingsAction; +import org.elasticsearch.rest.action.admin.cluster.RestCreateSnapshotAction; +import org.elasticsearch.rest.action.admin.cluster.RestDeleteRepositoryAction; +import org.elasticsearch.rest.action.admin.cluster.RestDeleteSnapshotAction; +import org.elasticsearch.rest.action.admin.cluster.RestDeleteStoredScriptAction; +import org.elasticsearch.rest.action.admin.cluster.RestGetRepositoriesAction; +import org.elasticsearch.rest.action.admin.cluster.RestGetSnapshotsAction; +import org.elasticsearch.rest.action.admin.cluster.RestGetStoredScriptAction; +import org.elasticsearch.rest.action.admin.cluster.RestGetTaskAction; +import org.elasticsearch.rest.action.admin.cluster.RestListTasksAction; +import org.elasticsearch.rest.action.admin.cluster.RestNodesHotThreadsAction; +import org.elasticsearch.rest.action.admin.cluster.RestNodesInfoAction; +import org.elasticsearch.rest.action.admin.cluster.RestNodesStatsAction; +import org.elasticsearch.rest.action.admin.cluster.RestPendingClusterTasksAction; +import org.elasticsearch.rest.action.admin.cluster.RestPutRepositoryAction; +import org.elasticsearch.rest.action.admin.cluster.RestPutStoredScriptAction; +import org.elasticsearch.rest.action.admin.cluster.RestRestoreSnapshotAction; +import org.elasticsearch.rest.action.admin.cluster.RestSnapshotsStatusAction; +import org.elasticsearch.rest.action.admin.cluster.RestVerifyRepositoryAction; import org.elasticsearch.rest.action.admin.indices.RestAliasesExistAction; import org.elasticsearch.rest.action.admin.indices.RestAnalyzeAction; import org.elasticsearch.rest.action.admin.indices.RestClearIndicesCacheAction; diff --git a/core/src/main/java/org/elasticsearch/rest/RestController.java b/core/src/main/java/org/elasticsearch/rest/RestController.java index cf7c811a84c..d5ba350ff46 100644 --- a/core/src/main/java/org/elasticsearch/rest/RestController.java +++ b/core/src/main/java/org/elasticsearch/rest/RestController.java @@ -29,7 +29,6 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.util.concurrent.ThreadContext; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.plugins.ActionPlugin; -import org.elasticsearch.rest.support.RestUtils; import java.io.IOException; import java.util.Arrays; diff --git a/core/src/main/java/org/elasticsearch/rest/RestRequest.java b/core/src/main/java/org/elasticsearch/rest/RestRequest.java index 897ba294039..2db917dacf0 100644 --- a/core/src/main/java/org/elasticsearch/rest/RestRequest.java +++ b/core/src/main/java/org/elasticsearch/rest/RestRequest.java @@ -26,7 +26,6 @@ import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.ToXContent; -import org.elasticsearch.rest.support.RestUtils; import java.net.SocketAddress; import java.util.Collections; diff --git a/core/src/main/java/org/elasticsearch/rest/support/RestUtils.java b/core/src/main/java/org/elasticsearch/rest/RestUtils.java similarity index 99% rename from core/src/main/java/org/elasticsearch/rest/support/RestUtils.java rename to core/src/main/java/org/elasticsearch/rest/RestUtils.java index 7b8bf780719..e2be316cf92 100644 --- a/core/src/main/java/org/elasticsearch/rest/support/RestUtils.java +++ b/core/src/main/java/org/elasticsearch/rest/RestUtils.java @@ -17,9 +17,8 @@ * under the License. */ -package org.elasticsearch.rest.support; +package org.elasticsearch.rest; -import org.elasticsearch.common.Nullable; import org.elasticsearch.common.Strings; import org.elasticsearch.common.path.PathTrie; @@ -29,9 +28,6 @@ import java.util.Arrays; import java.util.Map; import java.util.regex.Pattern; -/** - * - */ public class RestUtils { public static final PathTrie.Decoder REST_DECODER = new PathTrie.Decoder() { diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/tasks/RestCancelTasksAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCancelTasksAction.java similarity index 94% rename from core/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/tasks/RestCancelTasksAction.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCancelTasksAction.java index b9eec1ba98a..5ed865e2716 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/tasks/RestCancelTasksAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCancelTasksAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.admin.cluster.node.tasks; +package org.elasticsearch.rest.action.admin.cluster; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.admin.cluster.node.tasks.cancel.CancelTasksRequest; @@ -35,7 +35,7 @@ import org.elasticsearch.rest.action.support.RestToXContentListener; import org.elasticsearch.tasks.TaskId; import static org.elasticsearch.rest.RestRequest.Method.POST; -import static org.elasticsearch.rest.action.admin.cluster.node.tasks.RestListTasksAction.nodeSettingListener; +import static org.elasticsearch.rest.action.admin.cluster.RestListTasksAction.nodeSettingListener; public class RestCancelTasksAction extends BaseRestHandler { diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/allocation/RestClusterAllocationExplainAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterAllocationExplainAction.java similarity index 98% rename from core/src/main/java/org/elasticsearch/rest/action/admin/cluster/allocation/RestClusterAllocationExplainAction.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterAllocationExplainAction.java index bed11bb3ec0..f615fd6cfae 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/allocation/RestClusterAllocationExplainAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterAllocationExplainAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.admin.cluster.allocation; +package org.elasticsearch.rest.action.admin.cluster; import java.io.IOException; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/settings/RestClusterGetSettingsAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterGetSettingsAction.java similarity index 94% rename from core/src/main/java/org/elasticsearch/rest/action/admin/cluster/settings/RestClusterGetSettingsAction.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterGetSettingsAction.java index a1e85c5d298..4a225687d7e 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/settings/RestClusterGetSettingsAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterGetSettingsAction.java @@ -17,15 +17,14 @@ * under the License. */ -package org.elasticsearch.rest.action.admin.cluster.settings; +package org.elasticsearch.rest.action.admin.cluster; import org.elasticsearch.action.admin.cluster.state.ClusterStateRequest; import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse; -import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.client.Requests; +import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.common.inject.Inject; -import org.elasticsearch.common.settings.AbstractScopedSettings; import org.elasticsearch.common.settings.ClusterSettings; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.settings.SettingsFilter; @@ -42,15 +41,14 @@ import org.elasticsearch.rest.action.support.RestBuilderListener; import java.io.IOException; -/** - */ public class RestClusterGetSettingsAction extends BaseRestHandler { private final ClusterSettings clusterSettings; private final SettingsFilter settingsFilter; @Inject - public RestClusterGetSettingsAction(Settings settings, RestController controller, ClusterSettings clusterSettings, SettingsFilter settingsFilter) { + public RestClusterGetSettingsAction(Settings settings, RestController controller, ClusterSettings clusterSettings, + SettingsFilter settingsFilter) { super(settings); this.clusterSettings = clusterSettings; controller.registerHandler(RestRequest.Method.GET, "/_cluster/settings", this); @@ -77,7 +75,8 @@ public class RestClusterGetSettingsAction extends BaseRestHandler { return false; } - private XContentBuilder renderResponse(ClusterState state, boolean renderDefaults, XContentBuilder builder, ToXContent.Params params) throws IOException { + private XContentBuilder renderResponse(ClusterState state, boolean renderDefaults, XContentBuilder builder, ToXContent.Params params) + throws IOException { builder.startObject(); builder.startObject("persistent"); diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/health/RestClusterHealthAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterHealthAction.java similarity index 98% rename from core/src/main/java/org/elasticsearch/rest/action/admin/cluster/health/RestClusterHealthAction.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterHealthAction.java index 6082b60443d..12708b2e98b 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/health/RestClusterHealthAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterHealthAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.admin.cluster.health; +package org.elasticsearch.rest.action.admin.cluster; import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest; import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/reroute/RestClusterRerouteAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterRerouteAction.java similarity index 99% rename from core/src/main/java/org/elasticsearch/rest/action/admin/cluster/reroute/RestClusterRerouteAction.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterRerouteAction.java index ad4abaf10c4..b70f8c70bf0 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/reroute/RestClusterRerouteAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterRerouteAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.admin.cluster.reroute; +package org.elasticsearch.rest.action.admin.cluster; import org.elasticsearch.action.admin.cluster.reroute.ClusterRerouteRequest; import org.elasticsearch.action.admin.cluster.reroute.ClusterRerouteResponse; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/shards/RestClusterSearchShardsAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterSearchShardsAction.java similarity index 98% rename from core/src/main/java/org/elasticsearch/rest/action/admin/cluster/shards/RestClusterSearchShardsAction.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterSearchShardsAction.java index 82edb74c7e6..96cf742844d 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/shards/RestClusterSearchShardsAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterSearchShardsAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.admin.cluster.shards; +package org.elasticsearch.rest.action.admin.cluster; import org.elasticsearch.action.admin.cluster.shards.ClusterSearchShardsRequest; import org.elasticsearch.action.admin.cluster.shards.ClusterSearchShardsResponse; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/state/RestClusterStateAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterStateAction.java similarity index 91% rename from core/src/main/java/org/elasticsearch/rest/action/admin/cluster/state/RestClusterStateAction.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterStateAction.java index b3f5a407d91..c8799edea53 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/state/RestClusterStateAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterStateAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.admin.cluster.state; +package org.elasticsearch.rest.action.admin.cluster; import org.elasticsearch.action.admin.cluster.state.ClusterStateRequest; import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse; @@ -41,10 +41,6 @@ import org.elasticsearch.rest.action.support.RestBuilderListener; import java.util.EnumSet; - -/** - * - */ public class RestClusterStateAction extends BaseRestHandler { private final SettingsFilter settingsFilter; @@ -76,8 +72,12 @@ public class RestClusterStateAction extends BaseRestHandler { EnumSet metrics = ClusterState.Metric.parseString(request.param("metric"), true); // do not ask for what we do not need. clusterStateRequest.nodes(metrics.contains(ClusterState.Metric.NODES) || metrics.contains(ClusterState.Metric.MASTER_NODE)); - //there is no distinction in Java api between routing_table and routing_nodes, it's the same info set over the wire, one single flag to ask for it - clusterStateRequest.routingTable(metrics.contains(ClusterState.Metric.ROUTING_TABLE) || metrics.contains(ClusterState.Metric.ROUTING_NODES)); + /* + * there is no distinction in Java api between routing_table and routing_nodes, it's the same info set over the wire, one single + * flag to ask for it + */ + clusterStateRequest.routingTable( + metrics.contains(ClusterState.Metric.ROUTING_TABLE) || metrics.contains(ClusterState.Metric.ROUTING_NODES)); clusterStateRequest.metaData(metrics.contains(ClusterState.Metric.METADATA)); clusterStateRequest.blocks(metrics.contains(ClusterState.Metric.BLOCKS)); clusterStateRequest.customs(metrics.contains(ClusterState.Metric.CUSTOMS)); diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/stats/RestClusterStatsAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterStatsAction.java similarity index 97% rename from core/src/main/java/org/elasticsearch/rest/action/admin/cluster/stats/RestClusterStatsAction.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterStatsAction.java index a43b428ae9c..b1fee12d747 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/stats/RestClusterStatsAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterStatsAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.admin.cluster.stats; +package org.elasticsearch.rest.action.admin.cluster; import org.elasticsearch.action.admin.cluster.stats.ClusterStatsRequest; import org.elasticsearch.client.node.NodeClient; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/settings/RestClusterUpdateSettingsAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterUpdateSettingsAction.java similarity index 76% rename from core/src/main/java/org/elasticsearch/rest/action/admin/cluster/settings/RestClusterUpdateSettingsAction.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterUpdateSettingsAction.java index 055bcc4df60..1513f218239 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/settings/RestClusterUpdateSettingsAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterUpdateSettingsAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.admin.cluster.settings; +package org.elasticsearch.rest.action.admin.cluster; import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest; import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsResponse; @@ -37,8 +37,6 @@ import org.elasticsearch.rest.action.support.AcknowledgedRestListener; import java.io.IOException; import java.util.Map; -/** - */ public class RestClusterUpdateSettingsAction extends BaseRestHandler { @Inject @@ -51,7 +49,8 @@ public class RestClusterUpdateSettingsAction extends BaseRestHandler { public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) throws Exception { final ClusterUpdateSettingsRequest clusterUpdateSettingsRequest = Requests.clusterUpdateSettingsRequest(); clusterUpdateSettingsRequest.timeout(request.paramAsTime("timeout", clusterUpdateSettingsRequest.timeout())); - clusterUpdateSettingsRequest.masterNodeTimeout(request.paramAsTime("master_timeout", clusterUpdateSettingsRequest.masterNodeTimeout())); + clusterUpdateSettingsRequest.masterNodeTimeout( + request.paramAsTime("master_timeout", clusterUpdateSettingsRequest.masterNodeTimeout())); Map source; try (XContentParser parser = XContentFactory.xContent(request.content()).createParser(request.content())) { source = parser.map(); @@ -63,18 +62,19 @@ public class RestClusterUpdateSettingsAction extends BaseRestHandler { clusterUpdateSettingsRequest.persistentSettings((Map) source.get("persistent")); } - client.admin().cluster().updateSettings(clusterUpdateSettingsRequest, new AcknowledgedRestListener(channel) { - @Override - protected void addCustomFields(XContentBuilder builder, ClusterUpdateSettingsResponse response) throws IOException { - builder.startObject("persistent"); - response.getPersistentSettings().toXContent(builder, request); - builder.endObject(); + client.admin().cluster().updateSettings(clusterUpdateSettingsRequest, + new AcknowledgedRestListener(channel) { + @Override + protected void addCustomFields(XContentBuilder builder, ClusterUpdateSettingsResponse response) throws IOException { + builder.startObject("persistent"); + response.getPersistentSettings().toXContent(builder, request); + builder.endObject(); - builder.startObject("transient"); - response.getTransientSettings().toXContent(builder, request); - builder.endObject(); - } - }); + builder.startObject("transient"); + response.getTransientSettings().toXContent(builder, request); + builder.endObject(); + } + }); } @Override diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/snapshots/create/RestCreateSnapshotAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCreateSnapshotAction.java similarity index 97% rename from core/src/main/java/org/elasticsearch/rest/action/admin/cluster/snapshots/create/RestCreateSnapshotAction.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCreateSnapshotAction.java index 14f02c94b61..be10ca94c7d 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/snapshots/create/RestCreateSnapshotAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCreateSnapshotAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.admin.cluster.snapshots.create; +package org.elasticsearch.rest.action.admin.cluster; import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotRequest; import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotResponse; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/repositories/delete/RestDeleteRepositoryAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteRepositoryAction.java similarity index 97% rename from core/src/main/java/org/elasticsearch/rest/action/admin/cluster/repositories/delete/RestDeleteRepositoryAction.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteRepositoryAction.java index c2dce1cae36..5576434602c 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/repositories/delete/RestDeleteRepositoryAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteRepositoryAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.admin.cluster.repositories.delete; +package org.elasticsearch.rest.action.admin.cluster; import org.elasticsearch.action.admin.cluster.repositories.delete.DeleteRepositoryRequest; import org.elasticsearch.action.admin.cluster.repositories.delete.DeleteRepositoryResponse; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/snapshots/delete/RestDeleteSnapshotAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteSnapshotAction.java similarity index 97% rename from core/src/main/java/org/elasticsearch/rest/action/admin/cluster/snapshots/delete/RestDeleteSnapshotAction.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteSnapshotAction.java index 5b99cb3a5ee..1295a92555f 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/snapshots/delete/RestDeleteSnapshotAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteSnapshotAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.admin.cluster.snapshots.delete; +package org.elasticsearch.rest.action.admin.cluster; import org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotRequest; import org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotResponse; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/storedscripts/RestDeleteStoredScriptAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteStoredScriptAction.java similarity index 97% rename from core/src/main/java/org/elasticsearch/rest/action/admin/cluster/storedscripts/RestDeleteStoredScriptAction.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteStoredScriptAction.java index 6416a693550..d3b1a21e6af 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/storedscripts/RestDeleteStoredScriptAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteStoredScriptAction.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.elasticsearch.rest.action.admin.cluster.storedscripts; +package org.elasticsearch.rest.action.admin.cluster; import org.elasticsearch.action.admin.cluster.storedscripts.DeleteStoredScriptRequest; import org.elasticsearch.client.node.NodeClient; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/repositories/get/RestGetRepositoriesAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetRepositoriesAction.java similarity index 98% rename from core/src/main/java/org/elasticsearch/rest/action/admin/cluster/repositories/get/RestGetRepositoriesAction.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetRepositoriesAction.java index 34004156d5b..91d810c5922 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/repositories/get/RestGetRepositoriesAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetRepositoriesAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.admin.cluster.repositories.get; +package org.elasticsearch.rest.action.admin.cluster; import org.elasticsearch.action.admin.cluster.repositories.get.GetRepositoriesRequest; import org.elasticsearch.action.admin.cluster.repositories.get.GetRepositoriesResponse; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/snapshots/get/RestGetSnapshotsAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetSnapshotsAction.java similarity index 97% rename from core/src/main/java/org/elasticsearch/rest/action/admin/cluster/snapshots/get/RestGetSnapshotsAction.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetSnapshotsAction.java index 835c23ac191..dfec03c8cf6 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/snapshots/get/RestGetSnapshotsAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetSnapshotsAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.admin.cluster.snapshots.get; +package org.elasticsearch.rest.action.admin.cluster; import org.elasticsearch.action.admin.cluster.snapshots.get.GetSnapshotsRequest; import org.elasticsearch.action.admin.cluster.snapshots.get.GetSnapshotsResponse; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/storedscripts/RestGetStoredScriptAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetStoredScriptAction.java similarity index 98% rename from core/src/main/java/org/elasticsearch/rest/action/admin/cluster/storedscripts/RestGetStoredScriptAction.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetStoredScriptAction.java index fb6fd0ca7c9..34009384591 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/storedscripts/RestGetStoredScriptAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetStoredScriptAction.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.elasticsearch.rest.action.admin.cluster.storedscripts; +package org.elasticsearch.rest.action.admin.cluster; import org.elasticsearch.action.admin.cluster.storedscripts.GetStoredScriptRequest; import org.elasticsearch.action.admin.cluster.storedscripts.GetStoredScriptResponse; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/tasks/RestGetTaskAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetTaskAction.java similarity index 97% rename from core/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/tasks/RestGetTaskAction.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetTaskAction.java index 501e96857fd..780a1d2ca40 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/tasks/RestGetTaskAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetTaskAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.admin.cluster.node.tasks; +package org.elasticsearch.rest.action.admin.cluster; import org.elasticsearch.action.admin.cluster.node.tasks.get.GetTaskRequest; import org.elasticsearch.client.node.NodeClient; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/tasks/RestListTasksAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestListTasksAction.java similarity index 98% rename from core/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/tasks/RestListTasksAction.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestListTasksAction.java index d2f1769041e..4d9f9bd6fa7 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/tasks/RestListTasksAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestListTasksAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.admin.cluster.node.tasks; +package org.elasticsearch.rest.action.admin.cluster; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.admin.cluster.node.tasks.list.ListTasksRequest; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/hotthreads/RestNodesHotThreadsAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesHotThreadsAction.java similarity index 98% rename from core/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/hotthreads/RestNodesHotThreadsAction.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesHotThreadsAction.java index 1d0daa3e7d6..487fe223d0d 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/hotthreads/RestNodesHotThreadsAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesHotThreadsAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.admin.cluster.node.hotthreads; +package org.elasticsearch.rest.action.admin.cluster; import org.elasticsearch.action.admin.cluster.node.hotthreads.NodeHotThreads; import org.elasticsearch.action.admin.cluster.node.hotthreads.NodesHotThreadsRequest; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/info/RestNodesInfoAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesInfoAction.java similarity index 94% rename from core/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/info/RestNodesInfoAction.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesInfoAction.java index 8826efef225..eb6c449603e 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/info/RestNodesInfoAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesInfoAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.admin.cluster.node.info; +package org.elasticsearch.rest.action.admin.cluster; import org.elasticsearch.action.admin.cluster.node.info.NodesInfoRequest; import org.elasticsearch.client.node.NodeClient; @@ -36,14 +36,20 @@ import java.util.Set; import static org.elasticsearch.rest.RestRequest.Method.GET; - -/** - * - */ public class RestNodesInfoAction extends BaseRestHandler { + private static final Set ALLOWED_METRICS = Sets.newHashSet( + "http", + "ingest", + "indices", + "jvm", + "os", + "plugins", + "process", + "settings", + "thread_pool", + "transport"); private final SettingsFilter settingsFilter; - private static final Set ALLOWED_METRICS = Sets.newHashSet("http", "jvm", "os", "plugins", "process", "settings", "thread_pool", "transport", "ingest", "indices"); @Inject public RestNodesInfoAction(Settings settings, RestController controller, SettingsFilter settingsFilter) { diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/stats/RestNodesStatsAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesStatsAction.java similarity index 93% rename from core/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/stats/RestNodesStatsAction.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesStatsAction.java index 1b0e434ef5c..e2ba5db66d2 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/node/stats/RestNodesStatsAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesStatsAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.admin.cluster.node.stats; +package org.elasticsearch.rest.action.admin.cluster; import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsRequest; import org.elasticsearch.action.admin.indices.stats.CommonStatsFlags; @@ -36,10 +36,6 @@ import java.util.Set; import static org.elasticsearch.rest.RestRequest.Method.GET; - -/** - * - */ public class RestNodesStatsAction extends BaseRestHandler { @Inject @@ -98,10 +94,12 @@ public class RestNodesStatsAction extends BaseRestHandler { } if (nodesStatsRequest.indices().isSet(Flag.FieldData) && (request.hasParam("fields") || request.hasParam("fielddata_fields"))) { - nodesStatsRequest.indices().fieldDataFields(request.paramAsStringArray("fielddata_fields", request.paramAsStringArray("fields", null))); + nodesStatsRequest.indices().fieldDataFields( + request.paramAsStringArray("fielddata_fields", request.paramAsStringArray("fields", null))); } if (nodesStatsRequest.indices().isSet(Flag.Completion) && (request.hasParam("fields") || request.hasParam("completion_fields"))) { - nodesStatsRequest.indices().completionDataFields(request.paramAsStringArray("completion_fields", request.paramAsStringArray("fields", null))); + nodesStatsRequest.indices().completionDataFields( + request.paramAsStringArray("completion_fields", request.paramAsStringArray("fields", null))); } if (nodesStatsRequest.indices().isSet(Flag.Search) && (request.hasParam("groups"))) { nodesStatsRequest.indices().groups(request.paramAsStringArray("groups", null)); diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/tasks/RestPendingClusterTasksAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPendingClusterTasksAction.java similarity index 90% rename from core/src/main/java/org/elasticsearch/rest/action/admin/cluster/tasks/RestPendingClusterTasksAction.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPendingClusterTasksAction.java index e106dd1f980..202bc2e60a5 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/tasks/RestPendingClusterTasksAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPendingClusterTasksAction.java @@ -17,10 +17,9 @@ * under the License. */ -package org.elasticsearch.rest.action.admin.cluster.tasks; +package org.elasticsearch.rest.action.admin.cluster; import org.elasticsearch.action.admin.cluster.tasks.PendingClusterTasksRequest; -import org.elasticsearch.action.admin.cluster.tasks.PendingClusterTasksResponse; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; @@ -30,8 +29,6 @@ import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.support.RestToXContentListener; -/** - */ public class RestPendingClusterTasksAction extends BaseRestHandler { @Inject @@ -45,6 +42,6 @@ public class RestPendingClusterTasksAction extends BaseRestHandler { PendingClusterTasksRequest pendingClusterTasksRequest = new PendingClusterTasksRequest(); pendingClusterTasksRequest.masterNodeTimeout(request.paramAsTime("master_timeout", pendingClusterTasksRequest.masterNodeTimeout())); pendingClusterTasksRequest.local(request.paramAsBoolean("local", pendingClusterTasksRequest.local())); - client.admin().cluster().pendingClusterTasks(pendingClusterTasksRequest, new RestToXContentListener(channel)); + client.admin().cluster().pendingClusterTasks(pendingClusterTasksRequest, new RestToXContentListener<>(channel)); } } diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/repositories/put/RestPutRepositoryAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPutRepositoryAction.java similarity index 97% rename from core/src/main/java/org/elasticsearch/rest/action/admin/cluster/repositories/put/RestPutRepositoryAction.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPutRepositoryAction.java index 59563816dd8..1dd61f9cace 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/repositories/put/RestPutRepositoryAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPutRepositoryAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.admin.cluster.repositories.put; +package org.elasticsearch.rest.action.admin.cluster; import org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryRequest; import org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryResponse; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/storedscripts/RestPutStoredScriptAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPutStoredScriptAction.java similarity index 97% rename from core/src/main/java/org/elasticsearch/rest/action/admin/cluster/storedscripts/RestPutStoredScriptAction.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPutStoredScriptAction.java index bb62528fc17..cfe3f357863 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/storedscripts/RestPutStoredScriptAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPutStoredScriptAction.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.elasticsearch.rest.action.admin.cluster.storedscripts; +package org.elasticsearch.rest.action.admin.cluster; import org.elasticsearch.action.admin.cluster.storedscripts.PutStoredScriptRequest; import org.elasticsearch.client.node.NodeClient; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/snapshots/restore/RestRestoreSnapshotAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestRestoreSnapshotAction.java similarity index 97% rename from core/src/main/java/org/elasticsearch/rest/action/admin/cluster/snapshots/restore/RestRestoreSnapshotAction.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestRestoreSnapshotAction.java index dce7fcf6dbc..6265c441d0b 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/snapshots/restore/RestRestoreSnapshotAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestRestoreSnapshotAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.admin.cluster.snapshots.restore; +package org.elasticsearch.rest.action.admin.cluster; import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotRequest; import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotResponse; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/snapshots/status/RestSnapshotsStatusAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestSnapshotsStatusAction.java similarity index 97% rename from core/src/main/java/org/elasticsearch/rest/action/admin/cluster/snapshots/status/RestSnapshotsStatusAction.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestSnapshotsStatusAction.java index 484ee4e5120..f03e12fcb0f 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/snapshots/status/RestSnapshotsStatusAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestSnapshotsStatusAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.admin.cluster.snapshots.status; +package org.elasticsearch.rest.action.admin.cluster; import org.elasticsearch.action.admin.cluster.snapshots.status.SnapshotsStatusRequest; import org.elasticsearch.action.admin.cluster.snapshots.status.SnapshotsStatusResponse; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/repositories/verify/RestVerifyRepositoryAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestVerifyRepositoryAction.java similarity index 96% rename from core/src/main/java/org/elasticsearch/rest/action/admin/cluster/repositories/verify/RestVerifyRepositoryAction.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestVerifyRepositoryAction.java index b3f6fe776fe..007e2fdcb64 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/repositories/verify/RestVerifyRepositoryAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestVerifyRepositoryAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.admin.cluster.repositories.verify; +package org.elasticsearch.rest.action.admin.cluster; import org.elasticsearch.action.admin.cluster.repositories.verify.VerifyRepositoryRequest; import org.elasticsearch.client.node.NodeClient; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/package-info.java b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/package-info.java new file mode 100644 index 00000000000..56c244c50f9 --- /dev/null +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/package-info.java @@ -0,0 +1,24 @@ +/* + * 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. + */ + +/** + * {@link org.elasticsearch.rest.RestHandler}s for administrative actions that can be taken on the cluster as a whole like getting the + * listing tasks, adding repositories, and getting stats. + */ +package org.elasticsearch.rest.action.admin.cluster; \ No newline at end of file diff --git a/core/src/main/java/org/elasticsearch/rest/action/cat/RestTasksAction.java b/core/src/main/java/org/elasticsearch/rest/action/cat/RestTasksAction.java index 94116e30ad1..6957dec1786 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/cat/RestTasksAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/cat/RestTasksAction.java @@ -45,7 +45,7 @@ import java.util.ArrayList; import java.util.List; import static org.elasticsearch.rest.RestRequest.Method.GET; -import static org.elasticsearch.rest.action.admin.cluster.node.tasks.RestListTasksAction.generateListTasksRequest; +import static org.elasticsearch.rest.action.admin.cluster.RestListTasksAction.generateListTasksRequest; public class RestTasksAction extends AbstractCatAction { private final ClusterService clusterService; diff --git a/core/src/test/java/org/elasticsearch/action/admin/cluster/reroute/ClusterRerouteRequestTests.java b/core/src/test/java/org/elasticsearch/action/admin/cluster/reroute/ClusterRerouteRequestTests.java index c2f9938861b..15ef330887c 100644 --- a/core/src/test/java/org/elasticsearch/action/admin/cluster/reroute/ClusterRerouteRequestTests.java +++ b/core/src/test/java/org/elasticsearch/action/admin/cluster/reroute/ClusterRerouteRequestTests.java @@ -39,7 +39,7 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.admin.cluster.reroute.RestClusterRerouteAction; +import org.elasticsearch.rest.action.admin.cluster.RestClusterRerouteAction; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.test.rest.FakeRestRequest; diff --git a/core/src/test/java/org/elasticsearch/common/path/PathTrieTests.java b/core/src/test/java/org/elasticsearch/common/path/PathTrieTests.java index e2a6f0fa482..0121b855068 100644 --- a/core/src/test/java/org/elasticsearch/common/path/PathTrieTests.java +++ b/core/src/test/java/org/elasticsearch/common/path/PathTrieTests.java @@ -19,7 +19,7 @@ package org.elasticsearch.common.path; -import org.elasticsearch.rest.support.RestUtils; +import org.elasticsearch.rest.RestUtils; import org.elasticsearch.test.ESTestCase; import java.util.HashMap; diff --git a/core/src/test/java/org/elasticsearch/rest/BytesRestResponseTests.java b/core/src/test/java/org/elasticsearch/rest/BytesRestResponseTests.java index 642b3a53a34..b9f97156df3 100644 --- a/core/src/test/java/org/elasticsearch/rest/BytesRestResponseTests.java +++ b/core/src/test/java/org/elasticsearch/rest/BytesRestResponseTests.java @@ -26,7 +26,6 @@ import org.elasticsearch.action.search.ShardSearchFailure; import org.elasticsearch.common.ParsingException; import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.index.Index; -import org.elasticsearch.rest.support.RestUtils; import org.elasticsearch.search.SearchShardTarget; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.test.rest.FakeRestRequest; diff --git a/core/src/test/java/org/elasticsearch/rest/util/RestUtilsTests.java b/core/src/test/java/org/elasticsearch/rest/RestUtilsTests.java similarity index 95% rename from core/src/test/java/org/elasticsearch/rest/util/RestUtilsTests.java rename to core/src/test/java/org/elasticsearch/rest/RestUtilsTests.java index a2f9e42fc3c..578abb3a391 100644 --- a/core/src/test/java/org/elasticsearch/rest/util/RestUtilsTests.java +++ b/core/src/test/java/org/elasticsearch/rest/RestUtilsTests.java @@ -17,9 +17,8 @@ * under the License. */ -package org.elasticsearch.rest.util; +package org.elasticsearch.rest; -import org.elasticsearch.rest.support.RestUtils; import org.elasticsearch.test.ESTestCase; import java.util.HashMap; @@ -31,9 +30,6 @@ import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.nullValue; -/** - * - */ public class RestUtilsTests extends ESTestCase { static char randomDelimiter() { @@ -130,8 +126,10 @@ public class RestUtilsTests extends ESTestCase { assertCorsSettingRegex("/foo/", Pattern.compile("foo")); assertCorsSettingRegex("/.*/", Pattern.compile(".*")); assertCorsSettingRegex("/https?:\\/\\/localhost(:[0-9]+)?/", Pattern.compile("https?:\\/\\/localhost(:[0-9]+)?")); - assertCorsSettingRegexMatches("/https?:\\/\\/localhost(:[0-9]+)?/", true, "http://localhost:9200", "http://localhost:9215", "https://localhost:9200", "https://localhost"); - assertCorsSettingRegexMatches("/https?:\\/\\/localhost(:[0-9]+)?/", false, "htt://localhost:9200", "http://localhost:9215/foo", "localhost:9215"); + assertCorsSettingRegexMatches("/https?:\\/\\/localhost(:[0-9]+)?/", true, "http://localhost:9200", "http://localhost:9215", + "https://localhost:9200", "https://localhost"); + assertCorsSettingRegexMatches("/https?:\\/\\/localhost(:[0-9]+)?/", false, "htt://localhost:9200", "http://localhost:9215/foo", + "localhost:9215"); assertCorsSettingRegexIsNull("//"); assertCorsSettingRegexIsNull("/"); assertCorsSettingRegexIsNull("/foo"); @@ -140,12 +138,13 @@ public class RestUtilsTests extends ESTestCase { } public void testCrazyURL() { + String host = "example.com"; Map params = new HashMap<>(); // This is a valid URL String uri = String.format( Locale.ROOT, - "example.com/:@-._~!$%c'()*+,=;:@-._~!$%c'()*+,=:@-._~!$%c'()*+,==?/?:@-._~!$'()*+,=/?:@-._~!$'()*+,==#/?:@-._~!$%c'()*+,;=", + host + "/:@-._~!$%c'()*+,=;:@-._~!$%c'()*+,=:@-._~!$%c'()*+,==?/?:@-._~!$'()*+,=/?:@-._~!$'()*+,==#/?:@-._~!$%c'()*+,;=", randomDelimiter(), randomDelimiter(), randomDelimiter(), diff --git a/core/src/test/java/org/elasticsearch/snapshots/DedicatedClusterSnapshotRestoreIT.java b/core/src/test/java/org/elasticsearch/snapshots/DedicatedClusterSnapshotRestoreIT.java index 96f30a1a0a6..39e26f382ca 100644 --- a/core/src/test/java/org/elasticsearch/snapshots/DedicatedClusterSnapshotRestoreIT.java +++ b/core/src/test/java/org/elasticsearch/snapshots/DedicatedClusterSnapshotRestoreIT.java @@ -57,8 +57,8 @@ import org.elasticsearch.repositories.RepositoryMissingException; import org.elasticsearch.rest.AbstractRestChannel; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestResponse; -import org.elasticsearch.rest.action.admin.cluster.repositories.get.RestGetRepositoriesAction; -import org.elasticsearch.rest.action.admin.cluster.state.RestClusterStateAction; +import org.elasticsearch.rest.action.admin.cluster.RestClusterStateAction; +import org.elasticsearch.rest.action.admin.cluster.RestGetRepositoriesAction; import org.elasticsearch.snapshots.mockstore.MockRepository; import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.test.ESIntegTestCase.ClusterScope; diff --git a/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestDeleteSearchTemplateAction.java b/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestDeleteSearchTemplateAction.java index ed4506686d8..a6ea92e2818 100644 --- a/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestDeleteSearchTemplateAction.java +++ b/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestDeleteSearchTemplateAction.java @@ -22,7 +22,7 @@ import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.admin.cluster.storedscripts.RestDeleteStoredScriptAction; +import org.elasticsearch.rest.action.admin.cluster.RestDeleteStoredScriptAction; import static org.elasticsearch.rest.RestRequest.Method.DELETE; diff --git a/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestGetSearchTemplateAction.java b/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestGetSearchTemplateAction.java index 47ab373b261..16ab14bc6c8 100644 --- a/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestGetSearchTemplateAction.java +++ b/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestGetSearchTemplateAction.java @@ -22,7 +22,7 @@ import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.admin.cluster.storedscripts.RestGetStoredScriptAction; +import org.elasticsearch.rest.action.admin.cluster.RestGetStoredScriptAction; import static org.elasticsearch.rest.RestRequest.Method.GET; diff --git a/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestPutSearchTemplateAction.java b/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestPutSearchTemplateAction.java index 71530eb4409..718afb608e6 100644 --- a/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestPutSearchTemplateAction.java +++ b/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestPutSearchTemplateAction.java @@ -22,7 +22,7 @@ import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.admin.cluster.storedscripts.RestPutStoredScriptAction; +import org.elasticsearch.rest.action.admin.cluster.RestPutStoredScriptAction; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.rest.RestRequest.Method.PUT; diff --git a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestRethrottleAction.java b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestRethrottleAction.java index f35225452bd..909fe68ed94 100644 --- a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestRethrottleAction.java +++ b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/RestRethrottleAction.java @@ -33,7 +33,7 @@ import org.elasticsearch.rest.action.support.RestToXContentListener; import org.elasticsearch.tasks.TaskId; import static org.elasticsearch.rest.RestRequest.Method.POST; -import static org.elasticsearch.rest.action.admin.cluster.node.tasks.RestListTasksAction.nodeSettingListener; +import static org.elasticsearch.rest.action.admin.cluster.RestListTasksAction.nodeSettingListener; public class RestRethrottleAction extends BaseRestHandler { private final ClusterService clusterService; diff --git a/modules/transport-netty3/src/main/java/org/elasticsearch/http/netty3/Netty3HttpRequest.java b/modules/transport-netty3/src/main/java/org/elasticsearch/http/netty3/Netty3HttpRequest.java index abf23563b8a..2d17a12090d 100644 --- a/modules/transport-netty3/src/main/java/org/elasticsearch/http/netty3/Netty3HttpRequest.java +++ b/modules/transport-netty3/src/main/java/org/elasticsearch/http/netty3/Netty3HttpRequest.java @@ -23,7 +23,7 @@ import org.elasticsearch.common.bytes.BytesArray; import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.transport.netty3.Netty3Utils; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.support.RestUtils; +import org.elasticsearch.rest.RestUtils; import org.jboss.netty.channel.Channel; import org.jboss.netty.handler.codec.http.HttpMethod; import org.jboss.netty.handler.codec.http.HttpRequest; diff --git a/modules/transport-netty3/src/main/java/org/elasticsearch/http/netty3/Netty3HttpServerTransport.java b/modules/transport-netty3/src/main/java/org/elasticsearch/http/netty3/Netty3HttpServerTransport.java index 25884d14b70..b7934da00e9 100644 --- a/modules/transport-netty3/src/main/java/org/elasticsearch/http/netty3/Netty3HttpServerTransport.java +++ b/modules/transport-netty3/src/main/java/org/elasticsearch/http/netty3/Netty3HttpServerTransport.java @@ -51,7 +51,7 @@ import org.elasticsearch.http.netty3.pipelining.HttpPipeliningHandler; import org.elasticsearch.monitor.jvm.JvmInfo; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.support.RestUtils; +import org.elasticsearch.rest.RestUtils; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.BindTransportException; import org.elasticsearch.transport.netty3.Netty3OpenChannelsHandler; diff --git a/modules/transport-netty4/src/main/java/org/elasticsearch/http/netty4/Netty4HttpRequest.java b/modules/transport-netty4/src/main/java/org/elasticsearch/http/netty4/Netty4HttpRequest.java index 949faa848e7..7825e3ebe1c 100644 --- a/modules/transport-netty4/src/main/java/org/elasticsearch/http/netty4/Netty4HttpRequest.java +++ b/modules/transport-netty4/src/main/java/org/elasticsearch/http/netty4/Netty4HttpRequest.java @@ -25,7 +25,8 @@ import org.elasticsearch.common.bytes.BytesArray; import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.transport.netty4.Netty4Utils; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.support.RestUtils; +import org.elasticsearch.rest.RestUtils; + import io.netty.channel.Channel; import io.netty.handler.codec.http.HttpMethod; diff --git a/modules/transport-netty4/src/main/java/org/elasticsearch/http/netty4/Netty4HttpServerTransport.java b/modules/transport-netty4/src/main/java/org/elasticsearch/http/netty4/Netty4HttpServerTransport.java index 910a499a194..0d4a6ab5ee1 100644 --- a/modules/transport-netty4/src/main/java/org/elasticsearch/http/netty4/Netty4HttpServerTransport.java +++ b/modules/transport-netty4/src/main/java/org/elasticsearch/http/netty4/Netty4HttpServerTransport.java @@ -74,7 +74,7 @@ import org.elasticsearch.http.netty4.pipelining.HttpPipeliningHandler; import org.elasticsearch.monitor.jvm.JvmInfo; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.support.RestUtils; +import org.elasticsearch.rest.RestUtils; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.BindTransportException; import org.elasticsearch.transport.netty4.Netty4OpenChannelsHandler; diff --git a/plugins/repository-gcs/src/test/java/org/elasticsearch/common/blobstore/gcs/MockHttpTransport.java b/plugins/repository-gcs/src/test/java/org/elasticsearch/common/blobstore/gcs/MockHttpTransport.java index 196fcf12f87..ffb9c8a910f 100644 --- a/plugins/repository-gcs/src/test/java/org/elasticsearch/common/blobstore/gcs/MockHttpTransport.java +++ b/plugins/repository-gcs/src/test/java/org/elasticsearch/common/blobstore/gcs/MockHttpTransport.java @@ -34,7 +34,7 @@ import org.elasticsearch.common.util.Callback; import org.elasticsearch.common.util.concurrent.ConcurrentCollections; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.rest.RestStatus; -import org.elasticsearch.rest.support.RestUtils; +import org.elasticsearch.rest.RestUtils; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream;