diff --git a/modules/analysis-common/src/main/java/org/opensearch/analysis/common/CommonAnalysisModulePlugin.java b/modules/analysis-common/src/main/java/org/opensearch/analysis/common/CommonAnalysisModulePlugin.java index cf2736a8583d2..dc0f84cea9ccf 100644 --- a/modules/analysis-common/src/main/java/org/opensearch/analysis/common/CommonAnalysisModulePlugin.java +++ b/modules/analysis-common/src/main/java/org/opensearch/analysis/common/CommonAnalysisModulePlugin.java @@ -125,7 +125,7 @@ import org.apache.lucene.analysis.tr.TurkishAnalyzer; import org.apache.lucene.analysis.util.ElisionFilter; import org.opensearch.Version; -import org.opensearch.client.Client; +import org.opensearch.client.node.PluginAwareNodeClient; import org.opensearch.cluster.metadata.IndexNameExpressionResolver; import org.opensearch.cluster.service.ClusterService; import org.opensearch.common.SetOnce; @@ -177,7 +177,7 @@ public class CommonAnalysisModulePlugin extends Plugin implements AnalysisPlugin @Override public Collection createComponents( - Client client, + PluginAwareNodeClient client, ClusterService clusterService, ThreadPool threadPool, ResourceWatcherService resourceWatcherService, diff --git a/modules/lang-painless/src/main/java/org/opensearch/painless/PainlessModulePlugin.java b/modules/lang-painless/src/main/java/org/opensearch/painless/PainlessModulePlugin.java index 55dc23f665d2e..246eb3fc68182 100644 --- a/modules/lang-painless/src/main/java/org/opensearch/painless/PainlessModulePlugin.java +++ b/modules/lang-painless/src/main/java/org/opensearch/painless/PainlessModulePlugin.java @@ -33,7 +33,7 @@ package org.opensearch.painless; import org.opensearch.action.ActionRequest; -import org.opensearch.client.Client; +import org.opensearch.client.node.PluginAwareNodeClient; import org.opensearch.cluster.metadata.IndexNameExpressionResolver; import org.opensearch.cluster.node.DiscoveryNodes; import org.opensearch.cluster.service.ClusterService; @@ -136,7 +136,7 @@ public ScriptEngine getScriptEngine(Settings settings, Collection createComponents( - Client client, + PluginAwareNodeClient client, ClusterService clusterService, ThreadPool threadPool, ResourceWatcherService resourceWatcherService, diff --git a/modules/reindex/src/main/java/org/opensearch/index/reindex/ReindexModulePlugin.java b/modules/reindex/src/main/java/org/opensearch/index/reindex/ReindexModulePlugin.java index aa48da4cb2421..92447d96dc051 100644 --- a/modules/reindex/src/main/java/org/opensearch/index/reindex/ReindexModulePlugin.java +++ b/modules/reindex/src/main/java/org/opensearch/index/reindex/ReindexModulePlugin.java @@ -35,7 +35,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.opensearch.action.ActionRequest; -import org.opensearch.client.Client; +import org.opensearch.client.node.PluginAwareNodeClient; import org.opensearch.cluster.metadata.IndexNameExpressionResolver; import org.opensearch.cluster.node.DiscoveryNodes; import org.opensearch.cluster.service.ClusterService; @@ -112,7 +112,7 @@ public List getRestHandlers( @Override public Collection createComponents( - Client client, + PluginAwareNodeClient client, ClusterService clusterService, ThreadPool threadPool, ResourceWatcherService resourceWatcherService, diff --git a/modules/reindex/src/test/java/org/opensearch/index/reindex/ReindexFromRemoteWithAuthTests.java b/modules/reindex/src/test/java/org/opensearch/index/reindex/ReindexFromRemoteWithAuthTests.java index 0d3cf208aabfb..4bc09cdc2ec36 100644 --- a/modules/reindex/src/test/java/org/opensearch/index/reindex/ReindexFromRemoteWithAuthTests.java +++ b/modules/reindex/src/test/java/org/opensearch/index/reindex/ReindexFromRemoteWithAuthTests.java @@ -40,7 +40,7 @@ import org.opensearch.action.support.ActionFilter; import org.opensearch.action.support.ActionFilterChain; import org.opensearch.action.support.WriteRequest.RefreshPolicy; -import org.opensearch.client.Client; +import org.opensearch.client.node.PluginAwareNodeClient; import org.opensearch.cluster.metadata.IndexNameExpressionResolver; import org.opensearch.cluster.service.ClusterService; import org.opensearch.common.SetOnce; @@ -176,7 +176,7 @@ public static class TestPlugin extends Plugin implements ActionPlugin { @Override public Collection createComponents( - Client client, + PluginAwareNodeClient client, ClusterService clusterService, ThreadPool threadPool, ResourceWatcherService resourceWatcherService, diff --git a/modules/systemd/src/main/java/org/opensearch/systemd/SystemdModulePlugin.java b/modules/systemd/src/main/java/org/opensearch/systemd/SystemdModulePlugin.java index 6e291027fa35f..a63b62c892741 100644 --- a/modules/systemd/src/main/java/org/opensearch/systemd/SystemdModulePlugin.java +++ b/modules/systemd/src/main/java/org/opensearch/systemd/SystemdModulePlugin.java @@ -34,7 +34,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.opensearch.client.Client; +import org.opensearch.client.node.PluginAwareNodeClient; import org.opensearch.cluster.metadata.IndexNameExpressionResolver; import org.opensearch.cluster.service.ClusterService; import org.opensearch.common.SetOnce; @@ -90,7 +90,7 @@ Scheduler.Cancellable extender() { @Override public Collection createComponents( - final Client client, + final PluginAwareNodeClient client, final ClusterService clusterService, final ThreadPool threadPool, final ResourceWatcherService resourceWatcherService, diff --git a/plugins/events-correlation-engine/src/main/java/org/opensearch/plugin/correlation/EventsCorrelationPlugin.java b/plugins/events-correlation-engine/src/main/java/org/opensearch/plugin/correlation/EventsCorrelationPlugin.java index 9637042974d03..0a95b8863bdd5 100644 --- a/plugins/events-correlation-engine/src/main/java/org/opensearch/plugin/correlation/EventsCorrelationPlugin.java +++ b/plugins/events-correlation-engine/src/main/java/org/opensearch/plugin/correlation/EventsCorrelationPlugin.java @@ -9,7 +9,7 @@ package org.opensearch.plugin.correlation; import org.opensearch.action.ActionRequest; -import org.opensearch.client.Client; +import org.opensearch.client.node.PluginAwareNodeClient; import org.opensearch.cluster.metadata.IndexNameExpressionResolver; import org.opensearch.cluster.node.DiscoveryNodes; import org.opensearch.cluster.service.ClusterService; @@ -77,7 +77,7 @@ public EventsCorrelationPlugin() {} @Override public Collection createComponents( - Client client, + PluginAwareNodeClient client, ClusterService clusterService, ThreadPool threadPool, ResourceWatcherService resourceWatcherService, diff --git a/plugins/query-insights/src/main/java/org/opensearch/plugin/insights/QueryInsightsPlugin.java b/plugins/query-insights/src/main/java/org/opensearch/plugin/insights/QueryInsightsPlugin.java index bba676436c39a..a1542d2146f4f 100644 --- a/plugins/query-insights/src/main/java/org/opensearch/plugin/insights/QueryInsightsPlugin.java +++ b/plugins/query-insights/src/main/java/org/opensearch/plugin/insights/QueryInsightsPlugin.java @@ -9,7 +9,7 @@ package org.opensearch.plugin.insights; import org.opensearch.action.ActionRequest; -import org.opensearch.client.Client; +import org.opensearch.client.node.PluginAwareNodeClient; import org.opensearch.cluster.metadata.IndexNameExpressionResolver; import org.opensearch.cluster.node.DiscoveryNodes; import org.opensearch.cluster.service.ClusterService; @@ -57,7 +57,7 @@ public QueryInsightsPlugin() {} @Override public Collection createComponents( - final Client client, + final PluginAwareNodeClient client, final ClusterService clusterService, final ThreadPool threadPool, final ResourceWatcherService resourceWatcherService, diff --git a/plugins/query-insights/src/test/java/org/opensearch/plugin/insights/QueryInsightsPluginTests.java b/plugins/query-insights/src/test/java/org/opensearch/plugin/insights/QueryInsightsPluginTests.java index 2efe9085a39ee..7260508f1ab9c 100644 --- a/plugins/query-insights/src/test/java/org/opensearch/plugin/insights/QueryInsightsPluginTests.java +++ b/plugins/query-insights/src/test/java/org/opensearch/plugin/insights/QueryInsightsPluginTests.java @@ -9,7 +9,7 @@ package org.opensearch.plugin.insights; import org.opensearch.action.ActionRequest; -import org.opensearch.client.Client; +import org.opensearch.client.node.PluginAwareNodeClient; import org.opensearch.cluster.service.ClusterService; import org.opensearch.common.settings.ClusterSettings; import org.opensearch.common.settings.Settings; @@ -37,7 +37,7 @@ public class QueryInsightsPluginTests extends OpenSearchTestCase { private QueryInsightsPlugin queryInsightsPlugin; - private final Client client = mock(Client.class); + private final PluginAwareNodeClient client = mock(PluginAwareNodeClient.class); private ClusterService clusterService; private final ThreadPool threadPool = mock(ThreadPool.class); diff --git a/plugins/repository-s3/src/main/java/org/opensearch/repositories/s3/S3RepositoryPlugin.java b/plugins/repository-s3/src/main/java/org/opensearch/repositories/s3/S3RepositoryPlugin.java index 110d91bfbd822..0099200e209ce 100644 --- a/plugins/repository-s3/src/main/java/org/opensearch/repositories/s3/S3RepositoryPlugin.java +++ b/plugins/repository-s3/src/main/java/org/opensearch/repositories/s3/S3RepositoryPlugin.java @@ -32,7 +32,7 @@ package org.opensearch.repositories.s3; -import org.opensearch.client.Client; +import org.opensearch.client.node.PluginAwareNodeClient; import org.opensearch.cluster.metadata.IndexNameExpressionResolver; import org.opensearch.cluster.metadata.RepositoryMetadata; import org.opensearch.cluster.service.ClusterService; @@ -201,7 +201,7 @@ private static int normalPoolCount(Settings settings) { @Override public Collection createComponents( - final Client client, + final PluginAwareNodeClient client, final ClusterService clusterService, final ThreadPool threadPool, final ResourceWatcherService resourceWatcherService, diff --git a/qa/smoke-test-http/src/test/java/org/opensearch/http/TestExecutionContextPlugin.java b/qa/smoke-test-http/src/test/java/org/opensearch/http/TestExecutionContextPlugin.java index a004d31cf4920..62e72a32b4b35 100644 --- a/qa/smoke-test-http/src/test/java/org/opensearch/http/TestExecutionContextPlugin.java +++ b/qa/smoke-test-http/src/test/java/org/opensearch/http/TestExecutionContextPlugin.java @@ -43,7 +43,7 @@ public class TestExecutionContextPlugin extends Plugin implements ActionPlugin { @Override public Collection createComponents( - Client client, + PluginAwareNodeClient client, ClusterService clusterService, ThreadPool threadPool, ResourceWatcherService resourceWatcherService, diff --git a/server/src/internalClusterTest/java/org/opensearch/action/ingest/AsyncIngestProcessorIT.java b/server/src/internalClusterTest/java/org/opensearch/action/ingest/AsyncIngestProcessorIT.java index aefabcb9bc14f..d124f2d8ab459 100644 --- a/server/src/internalClusterTest/java/org/opensearch/action/ingest/AsyncIngestProcessorIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/action/ingest/AsyncIngestProcessorIT.java @@ -36,7 +36,7 @@ import org.opensearch.action.get.GetRequest; import org.opensearch.action.get.GetResponse; import org.opensearch.action.index.IndexRequest; -import org.opensearch.client.Client; +import org.opensearch.client.node.PluginAwareNodeClient; import org.opensearch.cluster.metadata.IndexNameExpressionResolver; import org.opensearch.cluster.service.ClusterService; import org.opensearch.core.common.bytes.BytesArray; @@ -110,7 +110,7 @@ public static class TestPlugin extends Plugin implements IngestPlugin { @Override public Collection createComponents( - Client client, + PluginAwareNodeClient client, ClusterService clusterService, ThreadPool threadPool, ResourceWatcherService resourceWatcherService, diff --git a/server/src/internalClusterTest/java/org/opensearch/cluster/SimpleClusterStateIT.java b/server/src/internalClusterTest/java/org/opensearch/cluster/SimpleClusterStateIT.java index af5900b1cba6c..a07a82c9b1f45 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/SimpleClusterStateIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/SimpleClusterStateIT.java @@ -38,6 +38,7 @@ import org.opensearch.action.support.IndicesOptions; import org.opensearch.client.Client; import org.opensearch.client.Requests; +import org.opensearch.client.node.PluginAwareNodeClient; import org.opensearch.cluster.metadata.IndexMetadata; import org.opensearch.cluster.metadata.IndexNameExpressionResolver; import org.opensearch.cluster.metadata.MappingMetadata; @@ -459,7 +460,7 @@ public List getNamedWriteables() { @Override public Collection createComponents( - final Client client, + final PluginAwareNodeClient client, final ClusterService clusterService, final ThreadPool threadPool, final ResourceWatcherService resourceWatcherService, diff --git a/server/src/internalClusterTest/java/org/opensearch/cluster/metadata/TemplateUpgradeServiceIT.java b/server/src/internalClusterTest/java/org/opensearch/cluster/metadata/TemplateUpgradeServiceIT.java index ba1679d873bf4..9dc80210d6b7b 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/metadata/TemplateUpgradeServiceIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/metadata/TemplateUpgradeServiceIT.java @@ -34,7 +34,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.opensearch.client.Client; +import org.opensearch.client.node.PluginAwareNodeClient; import org.opensearch.cluster.service.ClusterService; import org.opensearch.common.settings.Setting; import org.opensearch.common.settings.Settings; @@ -87,7 +87,7 @@ public TestPlugin(Settings settings) { @Override public Collection createComponents( - Client client, + PluginAwareNodeClient client, ClusterService clusterService, ThreadPool threadPool, ResourceWatcherService resourceWatcherService, diff --git a/server/src/internalClusterTest/java/org/opensearch/index/FinalPipelineIT.java b/server/src/internalClusterTest/java/org/opensearch/index/FinalPipelineIT.java index 03b8fb5ff7afc..d5eef4209376f 100644 --- a/server/src/internalClusterTest/java/org/opensearch/index/FinalPipelineIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/index/FinalPipelineIT.java @@ -42,7 +42,7 @@ import org.opensearch.action.ingest.PutPipelineRequest; import org.opensearch.action.search.SearchResponse; import org.opensearch.action.support.WriteRequest; -import org.opensearch.client.Client; +import org.opensearch.client.node.PluginAwareNodeClient; import org.opensearch.cluster.metadata.IndexNameExpressionResolver; import org.opensearch.cluster.service.ClusterService; import org.opensearch.common.settings.Settings; @@ -363,7 +363,7 @@ public static class TestPlugin extends Plugin implements IngestPlugin { @Override public Collection createComponents( - final Client client, + final PluginAwareNodeClient client, final ClusterService clusterService, final ThreadPool threadPool, final ResourceWatcherService resourceWatcherService, diff --git a/server/src/main/java/org/opensearch/common/util/concurrent/PluginAwareThreadContextWrapper.java b/server/src/main/java/org/opensearch/common/util/concurrent/PluginAwareThreadContextWrapper.java index 46ea3a3038915..d66b05868c692 100644 --- a/server/src/main/java/org/opensearch/common/util/concurrent/PluginAwareThreadContextWrapper.java +++ b/server/src/main/java/org/opensearch/common/util/concurrent/PluginAwareThreadContextWrapper.java @@ -10,6 +10,10 @@ import org.opensearch.plugins.Plugin; +/** + * Wrapper class around the ThreadContext that is used within {@link org.opensearch.client.node.PluginAwareNodeClient} + * to enable retaining information about the plugin when switching out an authenticated user context + */ public class PluginAwareThreadContextWrapper { private final ThreadContext threadContext; diff --git a/server/src/main/java/org/opensearch/plugins/TelemetryAwarePlugin.java b/server/src/main/java/org/opensearch/plugins/TelemetryAwarePlugin.java index 42cab326f88bf..471b334846160 100644 --- a/server/src/main/java/org/opensearch/plugins/TelemetryAwarePlugin.java +++ b/server/src/main/java/org/opensearch/plugins/TelemetryAwarePlugin.java @@ -8,7 +8,7 @@ package org.opensearch.plugins; -import org.opensearch.client.Client; +import org.opensearch.client.node.PluginAwareNodeClient; import org.opensearch.cluster.metadata.IndexNameExpressionResolver; import org.opensearch.cluster.service.ClusterService; import org.opensearch.common.annotation.ExperimentalApi; @@ -61,7 +61,7 @@ public interface TelemetryAwarePlugin { * @param metricsRegistry the registry for metrics instrumentation. */ default Collection createComponents( - Client client, + PluginAwareNodeClient client, ClusterService clusterService, ThreadPool threadPool, ResourceWatcherService resourceWatcherService, diff --git a/server/src/test/java/org/opensearch/node/NodeTests.java b/server/src/test/java/org/opensearch/node/NodeTests.java index 0093091f61a1c..45328769d8b29 100644 --- a/server/src/test/java/org/opensearch/node/NodeTests.java +++ b/server/src/test/java/org/opensearch/node/NodeTests.java @@ -34,7 +34,7 @@ import org.apache.lucene.tests.util.LuceneTestCase; import org.opensearch.bootstrap.BootstrapCheck; import org.opensearch.bootstrap.BootstrapContext; -import org.opensearch.client.Client; +import org.opensearch.client.node.PluginAwareNodeClient; import org.opensearch.cluster.ClusterName; import org.opensearch.cluster.metadata.IndexNameExpressionResolver; import org.opensearch.cluster.node.DiscoveryNodeRole; @@ -466,7 +466,7 @@ public MetricsRegistry getMetricsRegistry() { public static class MockTelemetryAwarePlugin extends Plugin implements TelemetryAwarePlugin { @Override public Collection createComponents( - Client client, + PluginAwareNodeClient client, ClusterService clusterService, ThreadPool threadPool, ResourceWatcherService resourceWatcherService,