ActionModule.java 47 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701
  1. /*
  2. * Licensed to Elasticsearch under one or more contributor
  3. * license agreements. See the NOTICE file distributed with
  4. * this work for additional information regarding copyright
  5. * ownership. Elasticsearch licenses this file to you under
  6. * the Apache License, Version 2.0 (the "License"); you may
  7. * not use this file except in compliance with the License.
  8. * You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing,
  13. * software distributed under the License is distributed on an
  14. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  15. * KIND, either express or implied. See the License for the
  16. * specific language governing permissions and limitations
  17. * under the License.
  18. */
  19. package org.elasticsearch.action;
  20. import org.apache.logging.log4j.Logger;
  21. import org.elasticsearch.action.admin.cluster.allocation.ClusterAllocationExplainAction;
  22. import org.elasticsearch.action.admin.cluster.allocation.TransportClusterAllocationExplainAction;
  23. import org.elasticsearch.action.admin.cluster.health.ClusterHealthAction;
  24. import org.elasticsearch.action.admin.cluster.health.TransportClusterHealthAction;
  25. import org.elasticsearch.action.admin.cluster.node.hotthreads.NodesHotThreadsAction;
  26. import org.elasticsearch.action.admin.cluster.node.hotthreads.TransportNodesHotThreadsAction;
  27. import org.elasticsearch.action.admin.cluster.node.info.NodesInfoAction;
  28. import org.elasticsearch.action.admin.cluster.node.info.TransportNodesInfoAction;
  29. import org.elasticsearch.action.admin.cluster.node.liveness.TransportLivenessAction;
  30. import org.elasticsearch.action.admin.cluster.node.stats.NodesStatsAction;
  31. import org.elasticsearch.action.admin.cluster.node.stats.TransportNodesStatsAction;
  32. import org.elasticsearch.action.admin.cluster.node.tasks.cancel.CancelTasksAction;
  33. import org.elasticsearch.action.admin.cluster.node.tasks.cancel.TransportCancelTasksAction;
  34. import org.elasticsearch.action.admin.cluster.node.tasks.get.GetTaskAction;
  35. import org.elasticsearch.action.admin.cluster.node.tasks.get.TransportGetTaskAction;
  36. import org.elasticsearch.action.admin.cluster.node.tasks.list.ListTasksAction;
  37. import org.elasticsearch.action.admin.cluster.node.tasks.list.TransportListTasksAction;
  38. import org.elasticsearch.action.admin.cluster.node.usage.NodesUsageAction;
  39. import org.elasticsearch.action.admin.cluster.node.usage.TransportNodesUsageAction;
  40. import org.elasticsearch.action.admin.cluster.remote.RemoteInfoAction;
  41. import org.elasticsearch.action.admin.cluster.remote.TransportRemoteInfoAction;
  42. import org.elasticsearch.action.admin.cluster.repositories.delete.DeleteRepositoryAction;
  43. import org.elasticsearch.action.admin.cluster.repositories.delete.TransportDeleteRepositoryAction;
  44. import org.elasticsearch.action.admin.cluster.repositories.get.GetRepositoriesAction;
  45. import org.elasticsearch.action.admin.cluster.repositories.get.TransportGetRepositoriesAction;
  46. import org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryAction;
  47. import org.elasticsearch.action.admin.cluster.repositories.put.TransportPutRepositoryAction;
  48. import org.elasticsearch.action.admin.cluster.repositories.verify.TransportVerifyRepositoryAction;
  49. import org.elasticsearch.action.admin.cluster.repositories.verify.VerifyRepositoryAction;
  50. import org.elasticsearch.action.admin.cluster.reroute.ClusterRerouteAction;
  51. import org.elasticsearch.action.admin.cluster.reroute.TransportClusterRerouteAction;
  52. import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsAction;
  53. import org.elasticsearch.action.admin.cluster.settings.TransportClusterUpdateSettingsAction;
  54. import org.elasticsearch.action.admin.cluster.shards.ClusterSearchShardsAction;
  55. import org.elasticsearch.action.admin.cluster.shards.TransportClusterSearchShardsAction;
  56. import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotAction;
  57. import org.elasticsearch.action.admin.cluster.snapshots.create.TransportCreateSnapshotAction;
  58. import org.elasticsearch.action.admin.cluster.snapshots.delete.DeleteSnapshotAction;
  59. import org.elasticsearch.action.admin.cluster.snapshots.delete.TransportDeleteSnapshotAction;
  60. import org.elasticsearch.action.admin.cluster.snapshots.get.GetSnapshotsAction;
  61. import org.elasticsearch.action.admin.cluster.snapshots.get.TransportGetSnapshotsAction;
  62. import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotAction;
  63. import org.elasticsearch.action.admin.cluster.snapshots.restore.TransportRestoreSnapshotAction;
  64. import org.elasticsearch.action.admin.cluster.snapshots.status.SnapshotsStatusAction;
  65. import org.elasticsearch.action.admin.cluster.snapshots.status.TransportSnapshotsStatusAction;
  66. import org.elasticsearch.action.admin.cluster.state.ClusterStateAction;
  67. import org.elasticsearch.action.admin.cluster.state.TransportClusterStateAction;
  68. import org.elasticsearch.action.admin.cluster.stats.ClusterStatsAction;
  69. import org.elasticsearch.action.admin.cluster.stats.TransportClusterStatsAction;
  70. import org.elasticsearch.action.admin.cluster.storedscripts.DeleteStoredScriptAction;
  71. import org.elasticsearch.action.admin.cluster.storedscripts.GetStoredScriptAction;
  72. import org.elasticsearch.action.admin.cluster.storedscripts.PutStoredScriptAction;
  73. import org.elasticsearch.action.admin.cluster.storedscripts.TransportDeleteStoredScriptAction;
  74. import org.elasticsearch.action.admin.cluster.storedscripts.TransportGetStoredScriptAction;
  75. import org.elasticsearch.action.admin.cluster.storedscripts.TransportPutStoredScriptAction;
  76. import org.elasticsearch.action.admin.cluster.tasks.PendingClusterTasksAction;
  77. import org.elasticsearch.action.admin.cluster.tasks.TransportPendingClusterTasksAction;
  78. import org.elasticsearch.action.admin.indices.alias.IndicesAliasesAction;
  79. import org.elasticsearch.action.admin.indices.alias.TransportIndicesAliasesAction;
  80. import org.elasticsearch.action.admin.indices.alias.exists.AliasesExistAction;
  81. import org.elasticsearch.action.admin.indices.alias.exists.TransportAliasesExistAction;
  82. import org.elasticsearch.action.admin.indices.alias.get.GetAliasesAction;
  83. import org.elasticsearch.action.admin.indices.alias.get.TransportGetAliasesAction;
  84. import org.elasticsearch.action.admin.indices.analyze.AnalyzeAction;
  85. import org.elasticsearch.action.admin.indices.analyze.TransportAnalyzeAction;
  86. import org.elasticsearch.action.admin.indices.cache.clear.ClearIndicesCacheAction;
  87. import org.elasticsearch.action.admin.indices.cache.clear.TransportClearIndicesCacheAction;
  88. import org.elasticsearch.action.admin.indices.close.CloseIndexAction;
  89. import org.elasticsearch.action.admin.indices.close.TransportCloseIndexAction;
  90. import org.elasticsearch.action.admin.indices.create.CreateIndexAction;
  91. import org.elasticsearch.action.admin.indices.create.TransportCreateIndexAction;
  92. import org.elasticsearch.action.admin.indices.delete.DeleteIndexAction;
  93. import org.elasticsearch.action.admin.indices.delete.TransportDeleteIndexAction;
  94. import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsAction;
  95. import org.elasticsearch.action.admin.indices.exists.indices.TransportIndicesExistsAction;
  96. import org.elasticsearch.action.admin.indices.exists.types.TransportTypesExistsAction;
  97. import org.elasticsearch.action.admin.indices.exists.types.TypesExistsAction;
  98. import org.elasticsearch.action.admin.indices.flush.FlushAction;
  99. import org.elasticsearch.action.admin.indices.flush.SyncedFlushAction;
  100. import org.elasticsearch.action.admin.indices.flush.TransportFlushAction;
  101. import org.elasticsearch.action.admin.indices.flush.TransportSyncedFlushAction;
  102. import org.elasticsearch.action.admin.indices.forcemerge.ForceMergeAction;
  103. import org.elasticsearch.action.admin.indices.forcemerge.TransportForceMergeAction;
  104. import org.elasticsearch.action.admin.indices.get.GetIndexAction;
  105. import org.elasticsearch.action.admin.indices.get.TransportGetIndexAction;
  106. import org.elasticsearch.action.admin.indices.mapping.get.GetFieldMappingsAction;
  107. import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsAction;
  108. import org.elasticsearch.action.admin.indices.mapping.get.TransportGetFieldMappingsAction;
  109. import org.elasticsearch.action.admin.indices.mapping.get.TransportGetFieldMappingsIndexAction;
  110. import org.elasticsearch.action.admin.indices.mapping.get.TransportGetMappingsAction;
  111. import org.elasticsearch.action.admin.indices.mapping.put.PutMappingAction;
  112. import org.elasticsearch.action.admin.indices.mapping.put.TransportPutMappingAction;
  113. import org.elasticsearch.action.admin.indices.open.OpenIndexAction;
  114. import org.elasticsearch.action.admin.indices.open.TransportOpenIndexAction;
  115. import org.elasticsearch.action.admin.indices.recovery.RecoveryAction;
  116. import org.elasticsearch.action.admin.indices.recovery.TransportRecoveryAction;
  117. import org.elasticsearch.action.admin.indices.refresh.RefreshAction;
  118. import org.elasticsearch.action.admin.indices.refresh.TransportRefreshAction;
  119. import org.elasticsearch.action.admin.indices.rollover.RolloverAction;
  120. import org.elasticsearch.action.admin.indices.rollover.TransportRolloverAction;
  121. import org.elasticsearch.action.admin.indices.segments.IndicesSegmentsAction;
  122. import org.elasticsearch.action.admin.indices.segments.TransportIndicesSegmentsAction;
  123. import org.elasticsearch.action.admin.indices.settings.get.GetSettingsAction;
  124. import org.elasticsearch.action.admin.indices.settings.get.TransportGetSettingsAction;
  125. import org.elasticsearch.action.admin.indices.settings.put.TransportUpdateSettingsAction;
  126. import org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsAction;
  127. import org.elasticsearch.action.admin.indices.shards.IndicesShardStoresAction;
  128. import org.elasticsearch.action.admin.indices.shards.TransportIndicesShardStoresAction;
  129. import org.elasticsearch.action.admin.indices.shrink.ResizeAction;
  130. import org.elasticsearch.action.admin.indices.shrink.ShrinkAction;
  131. import org.elasticsearch.action.admin.indices.shrink.TransportResizeAction;
  132. import org.elasticsearch.action.admin.indices.shrink.TransportShrinkAction;
  133. import org.elasticsearch.action.admin.indices.stats.IndicesStatsAction;
  134. import org.elasticsearch.action.admin.indices.stats.TransportIndicesStatsAction;
  135. import org.elasticsearch.action.admin.indices.template.delete.DeleteIndexTemplateAction;
  136. import org.elasticsearch.action.admin.indices.template.delete.TransportDeleteIndexTemplateAction;
  137. import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesAction;
  138. import org.elasticsearch.action.admin.indices.template.get.TransportGetIndexTemplatesAction;
  139. import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateAction;
  140. import org.elasticsearch.action.admin.indices.template.put.TransportPutIndexTemplateAction;
  141. import org.elasticsearch.action.admin.indices.upgrade.get.TransportUpgradeStatusAction;
  142. import org.elasticsearch.action.admin.indices.upgrade.get.UpgradeStatusAction;
  143. import org.elasticsearch.action.admin.indices.upgrade.post.TransportUpgradeAction;
  144. import org.elasticsearch.action.admin.indices.upgrade.post.TransportUpgradeSettingsAction;
  145. import org.elasticsearch.action.admin.indices.upgrade.post.UpgradeAction;
  146. import org.elasticsearch.action.admin.indices.upgrade.post.UpgradeSettingsAction;
  147. import org.elasticsearch.action.admin.indices.validate.query.TransportValidateQueryAction;
  148. import org.elasticsearch.action.admin.indices.validate.query.ValidateQueryAction;
  149. import org.elasticsearch.action.bulk.BulkAction;
  150. import org.elasticsearch.action.bulk.TransportBulkAction;
  151. import org.elasticsearch.action.bulk.TransportShardBulkAction;
  152. import org.elasticsearch.action.delete.DeleteAction;
  153. import org.elasticsearch.action.delete.TransportDeleteAction;
  154. import org.elasticsearch.action.explain.ExplainAction;
  155. import org.elasticsearch.action.explain.TransportExplainAction;
  156. import org.elasticsearch.action.fieldcaps.FieldCapabilitiesAction;
  157. import org.elasticsearch.action.fieldcaps.TransportFieldCapabilitiesAction;
  158. import org.elasticsearch.action.fieldcaps.TransportFieldCapabilitiesIndexAction;
  159. import org.elasticsearch.action.get.GetAction;
  160. import org.elasticsearch.action.get.MultiGetAction;
  161. import org.elasticsearch.action.get.TransportGetAction;
  162. import org.elasticsearch.action.get.TransportMultiGetAction;
  163. import org.elasticsearch.action.get.TransportShardMultiGetAction;
  164. import org.elasticsearch.action.index.IndexAction;
  165. import org.elasticsearch.action.index.TransportIndexAction;
  166. import org.elasticsearch.action.ingest.DeletePipelineAction;
  167. import org.elasticsearch.action.ingest.DeletePipelineTransportAction;
  168. import org.elasticsearch.action.ingest.GetPipelineAction;
  169. import org.elasticsearch.action.ingest.GetPipelineTransportAction;
  170. import org.elasticsearch.action.ingest.PutPipelineAction;
  171. import org.elasticsearch.action.ingest.PutPipelineTransportAction;
  172. import org.elasticsearch.action.ingest.SimulatePipelineAction;
  173. import org.elasticsearch.action.ingest.SimulatePipelineTransportAction;
  174. import org.elasticsearch.action.main.MainAction;
  175. import org.elasticsearch.action.main.TransportMainAction;
  176. import org.elasticsearch.action.search.ClearScrollAction;
  177. import org.elasticsearch.action.search.MultiSearchAction;
  178. import org.elasticsearch.action.search.SearchAction;
  179. import org.elasticsearch.action.search.SearchScrollAction;
  180. import org.elasticsearch.action.search.TransportClearScrollAction;
  181. import org.elasticsearch.action.search.TransportMultiSearchAction;
  182. import org.elasticsearch.action.search.TransportSearchAction;
  183. import org.elasticsearch.action.search.TransportSearchScrollAction;
  184. import org.elasticsearch.action.support.ActionFilters;
  185. import org.elasticsearch.action.support.AutoCreateIndex;
  186. import org.elasticsearch.action.support.DestructiveOperations;
  187. import org.elasticsearch.action.support.TransportAction;
  188. import org.elasticsearch.action.termvectors.MultiTermVectorsAction;
  189. import org.elasticsearch.action.termvectors.TermVectorsAction;
  190. import org.elasticsearch.action.termvectors.TransportMultiTermVectorsAction;
  191. import org.elasticsearch.action.termvectors.TransportShardMultiTermsVectorAction;
  192. import org.elasticsearch.action.termvectors.TransportTermVectorsAction;
  193. import org.elasticsearch.action.update.TransportUpdateAction;
  194. import org.elasticsearch.action.update.UpdateAction;
  195. import org.elasticsearch.client.node.NodeClient;
  196. import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
  197. import org.elasticsearch.cluster.node.DiscoveryNodes;
  198. import org.elasticsearch.common.NamedRegistry;
  199. import org.elasticsearch.common.inject.AbstractModule;
  200. import org.elasticsearch.common.inject.multibindings.MapBinder;
  201. import org.elasticsearch.common.logging.ESLoggerFactory;
  202. import org.elasticsearch.common.settings.ClusterSettings;
  203. import org.elasticsearch.common.settings.IndexScopedSettings;
  204. import org.elasticsearch.common.settings.Settings;
  205. import org.elasticsearch.common.settings.SettingsFilter;
  206. import org.elasticsearch.indices.breaker.CircuitBreakerService;
  207. import org.elasticsearch.plugins.ActionPlugin;
  208. import org.elasticsearch.plugins.ActionPlugin.ActionHandler;
  209. import org.elasticsearch.rest.RestController;
  210. import org.elasticsearch.rest.RestHandler;
  211. import org.elasticsearch.rest.action.RestFieldCapabilitiesAction;
  212. import org.elasticsearch.rest.action.RestMainAction;
  213. import org.elasticsearch.rest.action.admin.cluster.RestCancelTasksAction;
  214. import org.elasticsearch.rest.action.admin.cluster.RestClusterAllocationExplainAction;
  215. import org.elasticsearch.rest.action.admin.cluster.RestClusterGetSettingsAction;
  216. import org.elasticsearch.rest.action.admin.cluster.RestClusterHealthAction;
  217. import org.elasticsearch.rest.action.admin.cluster.RestClusterRerouteAction;
  218. import org.elasticsearch.rest.action.admin.cluster.RestClusterSearchShardsAction;
  219. import org.elasticsearch.rest.action.admin.cluster.RestClusterStateAction;
  220. import org.elasticsearch.rest.action.admin.cluster.RestClusterStatsAction;
  221. import org.elasticsearch.rest.action.admin.cluster.RestClusterUpdateSettingsAction;
  222. import org.elasticsearch.rest.action.admin.cluster.RestCreateSnapshotAction;
  223. import org.elasticsearch.rest.action.admin.cluster.RestDeleteRepositoryAction;
  224. import org.elasticsearch.rest.action.admin.cluster.RestDeleteSnapshotAction;
  225. import org.elasticsearch.rest.action.admin.cluster.RestDeleteStoredScriptAction;
  226. import org.elasticsearch.rest.action.admin.cluster.RestGetRepositoriesAction;
  227. import org.elasticsearch.rest.action.admin.cluster.RestGetSnapshotsAction;
  228. import org.elasticsearch.rest.action.admin.cluster.RestGetStoredScriptAction;
  229. import org.elasticsearch.rest.action.admin.cluster.RestGetTaskAction;
  230. import org.elasticsearch.rest.action.admin.cluster.RestListTasksAction;
  231. import org.elasticsearch.rest.action.admin.cluster.RestNodesHotThreadsAction;
  232. import org.elasticsearch.rest.action.admin.cluster.RestNodesInfoAction;
  233. import org.elasticsearch.rest.action.admin.cluster.RestNodesStatsAction;
  234. import org.elasticsearch.rest.action.admin.cluster.RestNodesUsageAction;
  235. import org.elasticsearch.rest.action.admin.cluster.RestPendingClusterTasksAction;
  236. import org.elasticsearch.rest.action.admin.cluster.RestPutRepositoryAction;
  237. import org.elasticsearch.rest.action.admin.cluster.RestPutStoredScriptAction;
  238. import org.elasticsearch.rest.action.admin.cluster.RestRemoteClusterInfoAction;
  239. import org.elasticsearch.rest.action.admin.cluster.RestRestoreSnapshotAction;
  240. import org.elasticsearch.rest.action.admin.cluster.RestSnapshotsStatusAction;
  241. import org.elasticsearch.rest.action.admin.cluster.RestVerifyRepositoryAction;
  242. import org.elasticsearch.rest.action.admin.indices.RestResizeHandler;
  243. import org.elasticsearch.rest.action.admin.indices.RestAnalyzeAction;
  244. import org.elasticsearch.rest.action.admin.indices.RestClearIndicesCacheAction;
  245. import org.elasticsearch.rest.action.admin.indices.RestCloseIndexAction;
  246. import org.elasticsearch.rest.action.admin.indices.RestCreateIndexAction;
  247. import org.elasticsearch.rest.action.admin.indices.RestDeleteIndexAction;
  248. import org.elasticsearch.rest.action.admin.indices.RestDeleteIndexTemplateAction;
  249. import org.elasticsearch.rest.action.admin.indices.RestFlushAction;
  250. import org.elasticsearch.rest.action.admin.indices.RestForceMergeAction;
  251. import org.elasticsearch.rest.action.admin.indices.RestGetAliasesAction;
  252. import org.elasticsearch.rest.action.admin.indices.RestGetAllAliasesAction;
  253. import org.elasticsearch.rest.action.admin.indices.RestGetAllMappingsAction;
  254. import org.elasticsearch.rest.action.admin.indices.RestGetAllSettingsAction;
  255. import org.elasticsearch.rest.action.admin.indices.RestGetFieldMappingAction;
  256. import org.elasticsearch.rest.action.admin.indices.RestGetIndexTemplateAction;
  257. import org.elasticsearch.rest.action.admin.indices.RestGetIndicesAction;
  258. import org.elasticsearch.rest.action.admin.indices.RestGetMappingAction;
  259. import org.elasticsearch.rest.action.admin.indices.RestGetSettingsAction;
  260. import org.elasticsearch.rest.action.admin.indices.RestIndexDeleteAliasesAction;
  261. import org.elasticsearch.rest.action.admin.indices.RestIndexPutAliasAction;
  262. import org.elasticsearch.rest.action.admin.indices.RestIndicesAliasesAction;
  263. import org.elasticsearch.rest.action.admin.indices.RestIndicesSegmentsAction;
  264. import org.elasticsearch.rest.action.admin.indices.RestIndicesShardStoresAction;
  265. import org.elasticsearch.rest.action.admin.indices.RestIndicesStatsAction;
  266. import org.elasticsearch.rest.action.admin.indices.RestOpenIndexAction;
  267. import org.elasticsearch.rest.action.admin.indices.RestPutIndexTemplateAction;
  268. import org.elasticsearch.rest.action.admin.indices.RestPutMappingAction;
  269. import org.elasticsearch.rest.action.admin.indices.RestRecoveryAction;
  270. import org.elasticsearch.rest.action.admin.indices.RestRefreshAction;
  271. import org.elasticsearch.rest.action.admin.indices.RestRolloverIndexAction;
  272. import org.elasticsearch.rest.action.admin.indices.RestSyncedFlushAction;
  273. import org.elasticsearch.rest.action.admin.indices.RestUpdateSettingsAction;
  274. import org.elasticsearch.rest.action.admin.indices.RestUpgradeAction;
  275. import org.elasticsearch.rest.action.admin.indices.RestUpgradeStatusAction;
  276. import org.elasticsearch.rest.action.admin.indices.RestValidateQueryAction;
  277. import org.elasticsearch.rest.action.cat.AbstractCatAction;
  278. import org.elasticsearch.rest.action.cat.RestAliasAction;
  279. import org.elasticsearch.rest.action.cat.RestAllocationAction;
  280. import org.elasticsearch.rest.action.cat.RestCatAction;
  281. import org.elasticsearch.rest.action.cat.RestFielddataAction;
  282. import org.elasticsearch.rest.action.cat.RestHealthAction;
  283. import org.elasticsearch.rest.action.cat.RestIndicesAction;
  284. import org.elasticsearch.rest.action.cat.RestMasterAction;
  285. import org.elasticsearch.rest.action.cat.RestNodeAttrsAction;
  286. import org.elasticsearch.rest.action.cat.RestNodesAction;
  287. import org.elasticsearch.rest.action.cat.RestPluginsAction;
  288. import org.elasticsearch.rest.action.cat.RestRepositoriesAction;
  289. import org.elasticsearch.rest.action.cat.RestSegmentsAction;
  290. import org.elasticsearch.rest.action.cat.RestShardsAction;
  291. import org.elasticsearch.rest.action.cat.RestSnapshotAction;
  292. import org.elasticsearch.rest.action.cat.RestTasksAction;
  293. import org.elasticsearch.rest.action.cat.RestTemplatesAction;
  294. import org.elasticsearch.rest.action.cat.RestThreadPoolAction;
  295. import org.elasticsearch.rest.action.document.RestBulkAction;
  296. import org.elasticsearch.rest.action.document.RestDeleteAction;
  297. import org.elasticsearch.rest.action.document.RestGetAction;
  298. import org.elasticsearch.rest.action.document.RestGetSourceAction;
  299. import org.elasticsearch.rest.action.document.RestIndexAction;
  300. import org.elasticsearch.rest.action.document.RestMultiGetAction;
  301. import org.elasticsearch.rest.action.document.RestMultiTermVectorsAction;
  302. import org.elasticsearch.rest.action.document.RestTermVectorsAction;
  303. import org.elasticsearch.rest.action.document.RestUpdateAction;
  304. import org.elasticsearch.rest.action.ingest.RestDeletePipelineAction;
  305. import org.elasticsearch.rest.action.ingest.RestGetPipelineAction;
  306. import org.elasticsearch.rest.action.ingest.RestPutPipelineAction;
  307. import org.elasticsearch.rest.action.ingest.RestSimulatePipelineAction;
  308. import org.elasticsearch.rest.action.search.RestClearScrollAction;
  309. import org.elasticsearch.rest.action.search.RestExplainAction;
  310. import org.elasticsearch.rest.action.search.RestMultiSearchAction;
  311. import org.elasticsearch.rest.action.search.RestSearchAction;
  312. import org.elasticsearch.rest.action.search.RestSearchScrollAction;
  313. import org.elasticsearch.threadpool.ThreadPool;
  314. import org.elasticsearch.usage.UsageService;
  315. import org.elasticsearch.persistent.CompletionPersistentTaskAction;
  316. import org.elasticsearch.persistent.RemovePersistentTaskAction;
  317. import org.elasticsearch.persistent.StartPersistentTaskAction;
  318. import org.elasticsearch.persistent.UpdatePersistentTaskStatusAction;
  319. import java.util.ArrayList;
  320. import java.util.Collections;
  321. import java.util.List;
  322. import java.util.Map;
  323. import java.util.Set;
  324. import java.util.function.Consumer;
  325. import java.util.function.Supplier;
  326. import java.util.function.UnaryOperator;
  327. import java.util.stream.Collectors;
  328. import java.util.stream.Stream;
  329. import static java.util.Collections.unmodifiableMap;
  330. /**
  331. * Builds and binds the generic action map, all {@link TransportAction}s, and {@link ActionFilters}.
  332. */
  333. public class ActionModule extends AbstractModule {
  334. private static final Logger logger = ESLoggerFactory.getLogger(ActionModule.class);
  335. private final boolean transportClient;
  336. private final Settings settings;
  337. private final IndexNameExpressionResolver indexNameExpressionResolver;
  338. private final IndexScopedSettings indexScopedSettings;
  339. private final ClusterSettings clusterSettings;
  340. private final SettingsFilter settingsFilter;
  341. private final List<ActionPlugin> actionPlugins;
  342. private final Map<String, ActionHandler<?, ?>> actions;
  343. private final ActionFilters actionFilters;
  344. private final AutoCreateIndex autoCreateIndex;
  345. private final DestructiveOperations destructiveOperations;
  346. private final RestController restController;
  347. public ActionModule(boolean transportClient, Settings settings, IndexNameExpressionResolver indexNameExpressionResolver,
  348. IndexScopedSettings indexScopedSettings, ClusterSettings clusterSettings, SettingsFilter settingsFilter,
  349. ThreadPool threadPool, List<ActionPlugin> actionPlugins, NodeClient nodeClient,
  350. CircuitBreakerService circuitBreakerService, UsageService usageService) {
  351. this.transportClient = transportClient;
  352. this.settings = settings;
  353. this.indexNameExpressionResolver = indexNameExpressionResolver;
  354. this.indexScopedSettings = indexScopedSettings;
  355. this.clusterSettings = clusterSettings;
  356. this.settingsFilter = settingsFilter;
  357. this.actionPlugins = actionPlugins;
  358. actions = setupActions(actionPlugins);
  359. actionFilters = setupActionFilters(actionPlugins);
  360. autoCreateIndex = transportClient ? null : new AutoCreateIndex(settings, clusterSettings, indexNameExpressionResolver);
  361. destructiveOperations = new DestructiveOperations(settings, clusterSettings);
  362. Set<String> headers = Stream.concat(
  363. actionPlugins.stream().flatMap(p -> p.getRestHeaders().stream()),
  364. Stream.of("X-Opaque-Id")
  365. ).collect(Collectors.toSet());
  366. UnaryOperator<RestHandler> restWrapper = null;
  367. for (ActionPlugin plugin : actionPlugins) {
  368. UnaryOperator<RestHandler> newRestWrapper = plugin.getRestHandlerWrapper(threadPool.getThreadContext());
  369. if (newRestWrapper != null) {
  370. logger.debug("Using REST wrapper from plugin " + plugin.getClass().getName());
  371. if (restWrapper != null) {
  372. throw new IllegalArgumentException("Cannot have more than one plugin implementing a REST wrapper");
  373. }
  374. restWrapper = newRestWrapper;
  375. }
  376. }
  377. if (transportClient) {
  378. restController = null;
  379. } else {
  380. restController = new RestController(settings, headers, restWrapper, nodeClient, circuitBreakerService, usageService);
  381. }
  382. }
  383. public Map<String, ActionHandler<?, ?>> getActions() {
  384. return actions;
  385. }
  386. static Map<String, ActionHandler<?, ?>> setupActions(List<ActionPlugin> actionPlugins) {
  387. // Subclass NamedRegistry for easy registration
  388. class ActionRegistry extends NamedRegistry<ActionHandler<?, ?>> {
  389. ActionRegistry() {
  390. super("action");
  391. }
  392. public void register(ActionHandler<?, ?> handler) {
  393. register(handler.getAction().name(), handler);
  394. }
  395. public <Request extends ActionRequest, Response extends ActionResponse> void register(
  396. GenericAction<Request, Response> action, Class<? extends TransportAction<Request, Response>> transportAction,
  397. Class<?>... supportTransportActions) {
  398. register(new ActionHandler<>(action, transportAction, supportTransportActions));
  399. }
  400. }
  401. ActionRegistry actions = new ActionRegistry();
  402. actions.register(MainAction.INSTANCE, TransportMainAction.class);
  403. actions.register(NodesInfoAction.INSTANCE, TransportNodesInfoAction.class);
  404. actions.register(RemoteInfoAction.INSTANCE, TransportRemoteInfoAction.class);
  405. actions.register(NodesStatsAction.INSTANCE, TransportNodesStatsAction.class);
  406. actions.register(NodesUsageAction.INSTANCE, TransportNodesUsageAction.class);
  407. actions.register(NodesHotThreadsAction.INSTANCE, TransportNodesHotThreadsAction.class);
  408. actions.register(ListTasksAction.INSTANCE, TransportListTasksAction.class);
  409. actions.register(GetTaskAction.INSTANCE, TransportGetTaskAction.class);
  410. actions.register(CancelTasksAction.INSTANCE, TransportCancelTasksAction.class);
  411. actions.register(ClusterAllocationExplainAction.INSTANCE, TransportClusterAllocationExplainAction.class);
  412. actions.register(ClusterStatsAction.INSTANCE, TransportClusterStatsAction.class);
  413. actions.register(ClusterStateAction.INSTANCE, TransportClusterStateAction.class);
  414. actions.register(ClusterHealthAction.INSTANCE, TransportClusterHealthAction.class);
  415. actions.register(ClusterUpdateSettingsAction.INSTANCE, TransportClusterUpdateSettingsAction.class);
  416. actions.register(ClusterRerouteAction.INSTANCE, TransportClusterRerouteAction.class);
  417. actions.register(ClusterSearchShardsAction.INSTANCE, TransportClusterSearchShardsAction.class);
  418. actions.register(PendingClusterTasksAction.INSTANCE, TransportPendingClusterTasksAction.class);
  419. actions.register(PutRepositoryAction.INSTANCE, TransportPutRepositoryAction.class);
  420. actions.register(GetRepositoriesAction.INSTANCE, TransportGetRepositoriesAction.class);
  421. actions.register(DeleteRepositoryAction.INSTANCE, TransportDeleteRepositoryAction.class);
  422. actions.register(VerifyRepositoryAction.INSTANCE, TransportVerifyRepositoryAction.class);
  423. actions.register(GetSnapshotsAction.INSTANCE, TransportGetSnapshotsAction.class);
  424. actions.register(DeleteSnapshotAction.INSTANCE, TransportDeleteSnapshotAction.class);
  425. actions.register(CreateSnapshotAction.INSTANCE, TransportCreateSnapshotAction.class);
  426. actions.register(RestoreSnapshotAction.INSTANCE, TransportRestoreSnapshotAction.class);
  427. actions.register(SnapshotsStatusAction.INSTANCE, TransportSnapshotsStatusAction.class);
  428. actions.register(IndicesStatsAction.INSTANCE, TransportIndicesStatsAction.class);
  429. actions.register(IndicesSegmentsAction.INSTANCE, TransportIndicesSegmentsAction.class);
  430. actions.register(IndicesShardStoresAction.INSTANCE, TransportIndicesShardStoresAction.class);
  431. actions.register(CreateIndexAction.INSTANCE, TransportCreateIndexAction.class);
  432. actions.register(ShrinkAction.INSTANCE, TransportShrinkAction.class);
  433. actions.register(ResizeAction.INSTANCE, TransportResizeAction.class);
  434. actions.register(RolloverAction.INSTANCE, TransportRolloverAction.class);
  435. actions.register(DeleteIndexAction.INSTANCE, TransportDeleteIndexAction.class);
  436. actions.register(GetIndexAction.INSTANCE, TransportGetIndexAction.class);
  437. actions.register(OpenIndexAction.INSTANCE, TransportOpenIndexAction.class);
  438. actions.register(CloseIndexAction.INSTANCE, TransportCloseIndexAction.class);
  439. actions.register(IndicesExistsAction.INSTANCE, TransportIndicesExistsAction.class);
  440. actions.register(TypesExistsAction.INSTANCE, TransportTypesExistsAction.class);
  441. actions.register(GetMappingsAction.INSTANCE, TransportGetMappingsAction.class);
  442. actions.register(GetFieldMappingsAction.INSTANCE, TransportGetFieldMappingsAction.class,
  443. TransportGetFieldMappingsIndexAction.class);
  444. actions.register(PutMappingAction.INSTANCE, TransportPutMappingAction.class);
  445. actions.register(IndicesAliasesAction.INSTANCE, TransportIndicesAliasesAction.class);
  446. actions.register(UpdateSettingsAction.INSTANCE, TransportUpdateSettingsAction.class);
  447. actions.register(AnalyzeAction.INSTANCE, TransportAnalyzeAction.class);
  448. actions.register(PutIndexTemplateAction.INSTANCE, TransportPutIndexTemplateAction.class);
  449. actions.register(GetIndexTemplatesAction.INSTANCE, TransportGetIndexTemplatesAction.class);
  450. actions.register(DeleteIndexTemplateAction.INSTANCE, TransportDeleteIndexTemplateAction.class);
  451. actions.register(ValidateQueryAction.INSTANCE, TransportValidateQueryAction.class);
  452. actions.register(RefreshAction.INSTANCE, TransportRefreshAction.class);
  453. actions.register(FlushAction.INSTANCE, TransportFlushAction.class);
  454. actions.register(SyncedFlushAction.INSTANCE, TransportSyncedFlushAction.class);
  455. actions.register(ForceMergeAction.INSTANCE, TransportForceMergeAction.class);
  456. actions.register(UpgradeAction.INSTANCE, TransportUpgradeAction.class);
  457. actions.register(UpgradeStatusAction.INSTANCE, TransportUpgradeStatusAction.class);
  458. actions.register(UpgradeSettingsAction.INSTANCE, TransportUpgradeSettingsAction.class);
  459. actions.register(ClearIndicesCacheAction.INSTANCE, TransportClearIndicesCacheAction.class);
  460. actions.register(GetAliasesAction.INSTANCE, TransportGetAliasesAction.class);
  461. actions.register(AliasesExistAction.INSTANCE, TransportAliasesExistAction.class);
  462. actions.register(GetSettingsAction.INSTANCE, TransportGetSettingsAction.class);
  463. actions.register(IndexAction.INSTANCE, TransportIndexAction.class);
  464. actions.register(GetAction.INSTANCE, TransportGetAction.class);
  465. actions.register(TermVectorsAction.INSTANCE, TransportTermVectorsAction.class);
  466. actions.register(MultiTermVectorsAction.INSTANCE, TransportMultiTermVectorsAction.class,
  467. TransportShardMultiTermsVectorAction.class);
  468. actions.register(DeleteAction.INSTANCE, TransportDeleteAction.class);
  469. actions.register(UpdateAction.INSTANCE, TransportUpdateAction.class);
  470. actions.register(MultiGetAction.INSTANCE, TransportMultiGetAction.class,
  471. TransportShardMultiGetAction.class);
  472. actions.register(BulkAction.INSTANCE, TransportBulkAction.class,
  473. TransportShardBulkAction.class);
  474. actions.register(SearchAction.INSTANCE, TransportSearchAction.class);
  475. actions.register(SearchScrollAction.INSTANCE, TransportSearchScrollAction.class);
  476. actions.register(MultiSearchAction.INSTANCE, TransportMultiSearchAction.class);
  477. actions.register(ExplainAction.INSTANCE, TransportExplainAction.class);
  478. actions.register(ClearScrollAction.INSTANCE, TransportClearScrollAction.class);
  479. actions.register(RecoveryAction.INSTANCE, TransportRecoveryAction.class);
  480. //Indexed scripts
  481. actions.register(PutStoredScriptAction.INSTANCE, TransportPutStoredScriptAction.class);
  482. actions.register(GetStoredScriptAction.INSTANCE, TransportGetStoredScriptAction.class);
  483. actions.register(DeleteStoredScriptAction.INSTANCE, TransportDeleteStoredScriptAction.class);
  484. actions.register(FieldCapabilitiesAction.INSTANCE, TransportFieldCapabilitiesAction.class,
  485. TransportFieldCapabilitiesIndexAction.class);
  486. actions.register(PutPipelineAction.INSTANCE, PutPipelineTransportAction.class);
  487. actions.register(GetPipelineAction.INSTANCE, GetPipelineTransportAction.class);
  488. actions.register(DeletePipelineAction.INSTANCE, DeletePipelineTransportAction.class);
  489. actions.register(SimulatePipelineAction.INSTANCE, SimulatePipelineTransportAction.class);
  490. actionPlugins.stream().flatMap(p -> p.getActions().stream()).forEach(actions::register);
  491. // Persistent tasks:
  492. actions.register(StartPersistentTaskAction.INSTANCE, StartPersistentTaskAction.TransportAction.class);
  493. actions.register(UpdatePersistentTaskStatusAction.INSTANCE, UpdatePersistentTaskStatusAction.TransportAction.class);
  494. actions.register(CompletionPersistentTaskAction.INSTANCE, CompletionPersistentTaskAction.TransportAction.class);
  495. actions.register(RemovePersistentTaskAction.INSTANCE, RemovePersistentTaskAction.TransportAction.class);
  496. return unmodifiableMap(actions.getRegistry());
  497. }
  498. private ActionFilters setupActionFilters(List<ActionPlugin> actionPlugins) {
  499. return new ActionFilters(
  500. Collections.unmodifiableSet(actionPlugins.stream().flatMap(p -> p.getActionFilters().stream()).collect(Collectors.toSet())));
  501. }
  502. public void initRestHandlers(Supplier<DiscoveryNodes> nodesInCluster) {
  503. List<AbstractCatAction> catActions = new ArrayList<>();
  504. Consumer<RestHandler> registerHandler = a -> {
  505. if (a instanceof AbstractCatAction) {
  506. catActions.add((AbstractCatAction) a);
  507. }
  508. };
  509. registerHandler.accept(new RestMainAction(settings, restController));
  510. registerHandler.accept(new RestNodesInfoAction(settings, restController, settingsFilter));
  511. registerHandler.accept(new RestRemoteClusterInfoAction(settings, restController));
  512. registerHandler.accept(new RestNodesStatsAction(settings, restController));
  513. registerHandler.accept(new RestNodesUsageAction(settings, restController));
  514. registerHandler.accept(new RestNodesHotThreadsAction(settings, restController));
  515. registerHandler.accept(new RestClusterAllocationExplainAction(settings, restController));
  516. registerHandler.accept(new RestClusterStatsAction(settings, restController));
  517. registerHandler.accept(new RestClusterStateAction(settings, restController, settingsFilter));
  518. registerHandler.accept(new RestClusterHealthAction(settings, restController));
  519. registerHandler.accept(new RestClusterUpdateSettingsAction(settings, restController));
  520. registerHandler.accept(new RestClusterGetSettingsAction(settings, restController, clusterSettings, settingsFilter));
  521. registerHandler.accept(new RestClusterRerouteAction(settings, restController, settingsFilter));
  522. registerHandler.accept(new RestClusterSearchShardsAction(settings, restController));
  523. registerHandler.accept(new RestPendingClusterTasksAction(settings, restController));
  524. registerHandler.accept(new RestPutRepositoryAction(settings, restController));
  525. registerHandler.accept(new RestGetRepositoriesAction(settings, restController, settingsFilter));
  526. registerHandler.accept(new RestDeleteRepositoryAction(settings, restController));
  527. registerHandler.accept(new RestVerifyRepositoryAction(settings, restController));
  528. registerHandler.accept(new RestGetSnapshotsAction(settings, restController));
  529. registerHandler.accept(new RestCreateSnapshotAction(settings, restController));
  530. registerHandler.accept(new RestRestoreSnapshotAction(settings, restController));
  531. registerHandler.accept(new RestDeleteSnapshotAction(settings, restController));
  532. registerHandler.accept(new RestSnapshotsStatusAction(settings, restController));
  533. registerHandler.accept(new RestGetAllAliasesAction(settings, restController));
  534. registerHandler.accept(new RestGetAllMappingsAction(settings, restController));
  535. registerHandler.accept(new RestGetAllSettingsAction(settings, restController, indexScopedSettings, settingsFilter));
  536. registerHandler.accept(new RestGetIndicesAction(settings, restController, indexScopedSettings, settingsFilter));
  537. registerHandler.accept(new RestIndicesStatsAction(settings, restController));
  538. registerHandler.accept(new RestIndicesSegmentsAction(settings, restController));
  539. registerHandler.accept(new RestIndicesShardStoresAction(settings, restController));
  540. registerHandler.accept(new RestGetAliasesAction(settings, restController));
  541. registerHandler.accept(new RestIndexDeleteAliasesAction(settings, restController));
  542. registerHandler.accept(new RestIndexPutAliasAction(settings, restController));
  543. registerHandler.accept(new RestIndicesAliasesAction(settings, restController));
  544. registerHandler.accept(new RestCreateIndexAction(settings, restController));
  545. registerHandler.accept(new RestResizeHandler.RestShrinkIndexAction(settings, restController));
  546. registerHandler.accept(new RestResizeHandler.RestSplitIndexAction(settings, restController));
  547. registerHandler.accept(new RestRolloverIndexAction(settings, restController));
  548. registerHandler.accept(new RestDeleteIndexAction(settings, restController));
  549. registerHandler.accept(new RestCloseIndexAction(settings, restController));
  550. registerHandler.accept(new RestOpenIndexAction(settings, restController));
  551. registerHandler.accept(new RestUpdateSettingsAction(settings, restController));
  552. registerHandler.accept(new RestGetSettingsAction(settings, restController));
  553. registerHandler.accept(new RestAnalyzeAction(settings, restController));
  554. registerHandler.accept(new RestGetIndexTemplateAction(settings, restController));
  555. registerHandler.accept(new RestPutIndexTemplateAction(settings, restController));
  556. registerHandler.accept(new RestDeleteIndexTemplateAction(settings, restController));
  557. registerHandler.accept(new RestPutMappingAction(settings, restController));
  558. registerHandler.accept(new RestGetMappingAction(settings, restController));
  559. registerHandler.accept(new RestGetFieldMappingAction(settings, restController));
  560. registerHandler.accept(new RestRefreshAction(settings, restController));
  561. registerHandler.accept(new RestFlushAction(settings, restController));
  562. registerHandler.accept(new RestSyncedFlushAction(settings, restController));
  563. registerHandler.accept(new RestForceMergeAction(settings, restController));
  564. registerHandler.accept(new RestUpgradeAction(settings, restController));
  565. registerHandler.accept(new RestUpgradeStatusAction(settings, restController));
  566. registerHandler.accept(new RestClearIndicesCacheAction(settings, restController));
  567. registerHandler.accept(new RestIndexAction(settings, restController));
  568. registerHandler.accept(new RestGetAction(settings, restController));
  569. registerHandler.accept(new RestGetSourceAction(settings, restController));
  570. registerHandler.accept(new RestMultiGetAction(settings, restController));
  571. registerHandler.accept(new RestDeleteAction(settings, restController));
  572. registerHandler.accept(new org.elasticsearch.rest.action.document.RestCountAction(settings, restController));
  573. registerHandler.accept(new RestTermVectorsAction(settings, restController));
  574. registerHandler.accept(new RestMultiTermVectorsAction(settings, restController));
  575. registerHandler.accept(new RestBulkAction(settings, restController));
  576. registerHandler.accept(new RestUpdateAction(settings, restController));
  577. registerHandler.accept(new RestSearchAction(settings, restController));
  578. registerHandler.accept(new RestSearchScrollAction(settings, restController));
  579. registerHandler.accept(new RestClearScrollAction(settings, restController));
  580. registerHandler.accept(new RestMultiSearchAction(settings, restController));
  581. registerHandler.accept(new RestValidateQueryAction(settings, restController));
  582. registerHandler.accept(new RestExplainAction(settings, restController));
  583. registerHandler.accept(new RestRecoveryAction(settings, restController));
  584. // Scripts API
  585. registerHandler.accept(new RestGetStoredScriptAction(settings, restController));
  586. registerHandler.accept(new RestPutStoredScriptAction(settings, restController));
  587. registerHandler.accept(new RestDeleteStoredScriptAction(settings, restController));
  588. registerHandler.accept(new RestFieldCapabilitiesAction(settings, restController));
  589. // Tasks API
  590. registerHandler.accept(new RestListTasksAction(settings, restController, nodesInCluster));
  591. registerHandler.accept(new RestGetTaskAction(settings, restController));
  592. registerHandler.accept(new RestCancelTasksAction(settings, restController, nodesInCluster));
  593. // Ingest API
  594. registerHandler.accept(new RestPutPipelineAction(settings, restController));
  595. registerHandler.accept(new RestGetPipelineAction(settings, restController));
  596. registerHandler.accept(new RestDeletePipelineAction(settings, restController));
  597. registerHandler.accept(new RestSimulatePipelineAction(settings, restController));
  598. // CAT API
  599. registerHandler.accept(new RestAllocationAction(settings, restController));
  600. registerHandler.accept(new RestShardsAction(settings, restController));
  601. registerHandler.accept(new RestMasterAction(settings, restController));
  602. registerHandler.accept(new RestNodesAction(settings, restController));
  603. registerHandler.accept(new RestTasksAction(settings, restController, nodesInCluster));
  604. registerHandler.accept(new RestIndicesAction(settings, restController, indexNameExpressionResolver));
  605. registerHandler.accept(new RestSegmentsAction(settings, restController));
  606. // Fully qualified to prevent interference with rest.action.count.RestCountAction
  607. registerHandler.accept(new org.elasticsearch.rest.action.cat.RestCountAction(settings, restController));
  608. // Fully qualified to prevent interference with rest.action.indices.RestRecoveryAction
  609. registerHandler.accept(new org.elasticsearch.rest.action.cat.RestRecoveryAction(settings, restController));
  610. registerHandler.accept(new RestHealthAction(settings, restController));
  611. registerHandler.accept(new org.elasticsearch.rest.action.cat.RestPendingClusterTasksAction(settings, restController));
  612. registerHandler.accept(new RestAliasAction(settings, restController));
  613. registerHandler.accept(new RestThreadPoolAction(settings, restController));
  614. registerHandler.accept(new RestPluginsAction(settings, restController));
  615. registerHandler.accept(new RestFielddataAction(settings, restController));
  616. registerHandler.accept(new RestNodeAttrsAction(settings, restController));
  617. registerHandler.accept(new RestRepositoriesAction(settings, restController));
  618. registerHandler.accept(new RestSnapshotAction(settings, restController));
  619. registerHandler.accept(new RestTemplatesAction(settings, restController));
  620. for (ActionPlugin plugin : actionPlugins) {
  621. for (RestHandler handler : plugin.getRestHandlers(settings, restController, clusterSettings, indexScopedSettings,
  622. settingsFilter, indexNameExpressionResolver, nodesInCluster)) {
  623. registerHandler.accept(handler);
  624. }
  625. }
  626. registerHandler.accept(new RestCatAction(settings, restController, catActions));
  627. }
  628. @Override
  629. protected void configure() {
  630. bind(ActionFilters.class).toInstance(actionFilters);
  631. bind(DestructiveOperations.class).toInstance(destructiveOperations);
  632. if (false == transportClient) {
  633. // Supporting classes only used when not a transport client
  634. bind(AutoCreateIndex.class).toInstance(autoCreateIndex);
  635. bind(TransportLivenessAction.class).asEagerSingleton();
  636. // register GenericAction -> transportAction Map used by NodeClient
  637. @SuppressWarnings("rawtypes")
  638. MapBinder<GenericAction, TransportAction> transportActionsBinder
  639. = MapBinder.newMapBinder(binder(), GenericAction.class, TransportAction.class);
  640. for (ActionHandler<?, ?> action : actions.values()) {
  641. // bind the action as eager singleton, so the map binder one will reuse it
  642. bind(action.getTransportAction()).asEagerSingleton();
  643. transportActionsBinder.addBinding(action.getAction()).to(action.getTransportAction()).asEagerSingleton();
  644. for (Class<?> supportAction : action.getSupportTransportActions()) {
  645. bind(supportAction).asEagerSingleton();
  646. }
  647. }
  648. }
  649. }
  650. public ActionFilters getActionFilters() {
  651. return actionFilters;
  652. }
  653. public RestController getRestController() {
  654. return restController;
  655. }
  656. }