diff --git a/legend-engine-config/legend-engine-server/legend-engine-server-http-server/src/main/java/org/finos/legend/engine/server/Server.java b/legend-engine-config/legend-engine-server/legend-engine-server-http-server/src/main/java/org/finos/legend/engine/server/Server.java
index a60c3fda324..cdc3b2cd142 100644
--- a/legend-engine-config/legend-engine-server/legend-engine-server-http-server/src/main/java/org/finos/legend/engine/server/Server.java
+++ b/legend-engine-config/legend-engine-server/legend-engine-server-http-server/src/main/java/org/finos/legend/engine/server/Server.java
@@ -88,6 +88,7 @@
import org.finos.legend.engine.plan.execution.service.api.ServiceModelingApi;
import org.finos.legend.engine.plan.execution.stores.elasticsearch.v7.plugin.ElasticsearchV7StoreExecutor;
import org.finos.legend.engine.plan.execution.stores.elasticsearch.v7.plugin.ElasticsearchV7StoreExecutorBuilder;
+import org.finos.legend.engine.plan.execution.stores.elasticsearch.v7.plugin.ElasticsearchV7StoreExecutorConfiguration;
import org.finos.legend.engine.plan.execution.stores.inMemory.plugin.InMemory;
import org.finos.legend.engine.plan.execution.stores.mongodb.plugin.MongoDBStoreExecutor;
import org.finos.legend.engine.plan.execution.stores.mongodb.plugin.MongoDBStoreExecutorBuilder;
@@ -283,9 +284,10 @@ public void run(T serverConfiguration, Environment environment)
ServiceStoreExecutor serviceStoreExecutor = (ServiceStoreExecutor) new ServiceStoreExecutorBuilder().build(serviceStoreExecutionConfiguration);
MongoDBStoreExecutorConfiguration mongoDBExecutorConfiguration = MongoDBStoreExecutorConfiguration.newInstance().withCredentialProviderProvider(credentialProviderProvider).build();
- MongoDBStoreExecutor mongoDBStoreExecutor = (MongoDBStoreExecutor) new MongoDBStoreExecutorBuilder().build(mongoDBExecutorConfiguration);
+ MongoDBStoreExecutor mongoDBStoreExecutor = new MongoDBStoreExecutorBuilder().build(mongoDBExecutorConfiguration);
- ElasticsearchV7StoreExecutor elasticsearchV7StoreExecutor = (ElasticsearchV7StoreExecutor) new ElasticsearchV7StoreExecutorBuilder().build();
+ ElasticsearchV7StoreExecutorConfiguration elasticsearchV7StoreExecutorConfiguration = ElasticsearchV7StoreExecutorConfiguration.newInstance().withCredentialProviderProvider(credentialProviderProvider).build();
+ ElasticsearchV7StoreExecutor elasticsearchV7StoreExecutor = (ElasticsearchV7StoreExecutor) new ElasticsearchV7StoreExecutorBuilder().build(elasticsearchV7StoreExecutorConfiguration);
PlanExecutor planExecutor;
ParallelGraphFetchExecutionExecutorPool parallelGraphFetchExecutionExecutorPool = null;
diff --git a/legend-engine-core/legend-engine-core-base/legend-engine-core-executionPlan-execution/legend-engine-executionPlan-execution/pom.xml b/legend-engine-core/legend-engine-core-base/legend-engine-core-executionPlan-execution/legend-engine-executionPlan-execution/pom.xml
index 87c388214fa..c169f009acd 100644
--- a/legend-engine-core/legend-engine-core-base/legend-engine-core-executionPlan-execution/legend-engine-executionPlan-execution/pom.xml
+++ b/legend-engine-core/legend-engine-core-base/legend-engine-core-executionPlan-execution/legend-engine-executionPlan-execution/pom.xml
@@ -74,10 +74,6 @@
org.finos.legend.engine
legend-engine-executionPlan-dependencies
-
- org.finos.legend.engine
- legend-engine-xt-authentication-implementation-core
-
diff --git a/legend-engine-core/legend-engine-core-base/legend-engine-core-executionPlan-execution/legend-engine-executionPlan-execution/src/main/java/org/finos/legend/engine/plan/execution/PlanExecutor.java b/legend-engine-core/legend-engine-core-base/legend-engine-core-executionPlan-execution/legend-engine-executionPlan-execution/src/main/java/org/finos/legend/engine/plan/execution/PlanExecutor.java
index f092089ecd8..199e1853ece 100644
--- a/legend-engine-core/legend-engine-core-base/legend-engine-core-executionPlan-execution/legend-engine-executionPlan-execution/src/main/java/org/finos/legend/engine/plan/execution/PlanExecutor.java
+++ b/legend-engine-core/legend-engine-core-base/legend-engine-core-executionPlan-execution/legend-engine-executionPlan-execution/src/main/java/org/finos/legend/engine/plan/execution/PlanExecutor.java
@@ -22,7 +22,6 @@
import org.eclipse.collections.impl.factory.Maps;
import org.eclipse.collections.impl.utility.Iterate;
import org.eclipse.collections.impl.utility.internal.IterableIterate;
-import org.finos.legend.authentication.credentialprovider.CredentialProviderProvider;
import org.finos.legend.engine.plan.execution.concurrent.ConcurrentExecutionNodeExecutorPool;
import org.finos.legend.engine.plan.execution.concurrent.ParallelGraphFetchExecutionExecutorPool;
import org.finos.legend.engine.plan.execution.graphFetch.GraphFetchExecutionConfiguration;
@@ -78,17 +77,15 @@ public class PlanExecutor
private ParallelGraphFetchExecutionExecutorPool graphFetchExecutionNodeExecutorPool;
private GraphFetchExecutionConfiguration graphFetchExecutionConfiguration;
private BiFunction executionNodeExecutorBuilder;
- private final CredentialProviderProvider credentialProviderProvider;
private final boolean logSQLWithParamValues;
- private PlanExecutor(boolean isJavaCompilationAllowed, ImmutableList extraExecutors, CredentialProviderProvider credentialProviderProvider, GraphFetchExecutionConfiguration graphFetchExecutionConfiguration, boolean logSQLWithParamValues)
+ private PlanExecutor(boolean isJavaCompilationAllowed, ImmutableList extraExecutors, GraphFetchExecutionConfiguration graphFetchExecutionConfiguration, boolean logSQLWithParamValues)
{
EngineUrlStreamHandlerFactory.initialize();
this.isJavaCompilationAllowed = isJavaCompilationAllowed;
this.extraExecutors = extraExecutors;
this.planExecutorInfo = PlanExecutorInfo.fromStoreExecutors(this.extraExecutors);
- this.credentialProviderProvider = credentialProviderProvider;
this.graphFetchExecutionConfiguration = graphFetchExecutionConfiguration;
this.logSQLWithParamValues = logSQLWithParamValues;
}
@@ -373,7 +370,7 @@ public ExecutionState buildDefaultExecutionState(SingleExecutionPlan executionPl
private ExecutionState buildDefaultExecutionState(SingleExecutionPlan executionPlan, Map vars, PlanExecutionContext planExecutionContext)
{
- ExecutionState executionState = new ExecutionState(vars, executionPlan.templateFunctions, this.extraExecutors.collect(StoreExecutor::buildStoreExecutionState), this.isJavaCompilationAllowed, null, this.credentialProviderProvider, this.graphFetchExecutionConfiguration, this.logSQLWithParamValues);
+ ExecutionState executionState = new ExecutionState(vars, executionPlan.templateFunctions, this.extraExecutors.collect(StoreExecutor::buildStoreExecutionState), this.isJavaCompilationAllowed, null, this.graphFetchExecutionConfiguration, this.logSQLWithParamValues);
if (planExecutionContext != null)
{
@@ -435,7 +432,6 @@ public static class Builder
private boolean isJavaCompilationAllowed = DEFAULT_IS_JAVA_COMPILATION_ALLOWED;
private final MutableList storeExecutors = Lists.mutable.empty();
private GraphFetchExecutionConfiguration graphFetchExecutionConfiguration = new GraphFetchExecutionConfiguration();
- private CredentialProviderProvider credentialProviderProvider = CredentialProviderProvider.defaultProviderProvider();
private boolean logSQLWithParamValues = true;
private Builder()
@@ -474,12 +470,6 @@ public Builder withAvailableStoreExecutors()
return this;
}
- public Builder withCredentialProviderProvider(CredentialProviderProvider credentialProviderProvider)
- {
- this.credentialProviderProvider = credentialProviderProvider;
- return this;
- }
-
public Builder logSQLWithParamValues(boolean value)
{
this.logSQLWithParamValues = value;
@@ -488,7 +478,7 @@ public Builder logSQLWithParamValues(boolean value)
public PlanExecutor build()
{
- return new PlanExecutor(this.isJavaCompilationAllowed, this.storeExecutors.toImmutable(), this.credentialProviderProvider, this.graphFetchExecutionConfiguration, this.logSQLWithParamValues);
+ return new PlanExecutor(this.isJavaCompilationAllowed, this.storeExecutors.toImmutable(), this.graphFetchExecutionConfiguration, this.logSQLWithParamValues);
}
}
diff --git a/legend-engine-core/legend-engine-core-base/legend-engine-core-executionPlan-execution/legend-engine-executionPlan-execution/src/main/java/org/finos/legend/engine/plan/execution/nodes/state/ExecutionState.java b/legend-engine-core/legend-engine-core-base/legend-engine-core-executionPlan-execution/legend-engine-executionPlan-execution/src/main/java/org/finos/legend/engine/plan/execution/nodes/state/ExecutionState.java
index c613abcd2fc..f778953a596 100644
--- a/legend-engine-core/legend-engine-core-base/legend-engine-core-executionPlan-execution/legend-engine-executionPlan-execution/src/main/java/org/finos/legend/engine/plan/execution/nodes/state/ExecutionState.java
+++ b/legend-engine-core/legend-engine-core-base/legend-engine-core-executionPlan-execution/legend-engine-executionPlan-execution/src/main/java/org/finos/legend/engine/plan/execution/nodes/state/ExecutionState.java
@@ -20,7 +20,6 @@
import org.eclipse.collections.impl.factory.Lists;
import org.eclipse.collections.impl.factory.Maps;
import org.eclipse.collections.impl.utility.ListIterate;
-import org.finos.legend.authentication.credentialprovider.CredentialProviderProvider;
import org.finos.legend.engine.plan.execution.concurrent.ParallelGraphFetchExecutionExecutorPool;
import org.finos.legend.engine.plan.execution.graphFetch.GraphFetchExecutionConfiguration;
import org.finos.legend.engine.plan.execution.cache.graphFetch.GraphFetchCache;
@@ -80,7 +79,6 @@ public class ExecutionState
public final List> extraNodeExecutors;
public final List> extraSequenceNodeExecutors;
public RequestContext requestContext;
- private final CredentialProviderProvider credentialProviderProvider;
public ExecutionState(ExecutionState state)
{
@@ -108,44 +106,43 @@ public ExecutionState(ExecutionState state)
this.extraNodeExecutors = ListIterate.flatCollect(extensions, ExecutionExtension::getExtraNodeExecutors);
this.extraSequenceNodeExecutors = ListIterate.flatCollect(extensions, ExecutionExtension::getExtraSequenceNodeExecutors);
this.requestContext = state.requestContext;
- this.credentialProviderProvider = state.credentialProviderProvider;
this.logSQLWithParamValues = state.logSQLWithParamValues;
}
@Deprecated
public ExecutionState(Map res, List extends String> templateFunctions, Iterable extends StoreExecutionState> extraStates, boolean isJavaCompilationAllowed, long graphFetchBatchMemoryLimit)
{
- this(res, templateFunctions, extraStates, isJavaCompilationAllowed, graphFetchBatchMemoryLimit, new RequestContext(), null);
+ this(res, templateFunctions, extraStates, isJavaCompilationAllowed, graphFetchBatchMemoryLimit, new RequestContext());
}
public ExecutionState(Map res, List extends String> templateFunctions, Iterable extends StoreExecutionState> extraStates, boolean isJavaCompilationAllowed, GraphFetchExecutionConfiguration graphFetchExecutionConfiguration)
{
- this(res, templateFunctions, extraStates, isJavaCompilationAllowed, new RequestContext(), null, graphFetchExecutionConfiguration);
+ this(res, templateFunctions, extraStates, isJavaCompilationAllowed, new RequestContext(), graphFetchExecutionConfiguration);
}
- public ExecutionState(Map res, List extends String> templateFunctions, Iterable extends StoreExecutionState> extraStates, boolean isJavaCompilationAllowed, RequestContext requestContext, CredentialProviderProvider credentialProviderProvider)
+ public ExecutionState(Map res, List extends String> templateFunctions, Iterable extends StoreExecutionState> extraStates, boolean isJavaCompilationAllowed, RequestContext requestContext)
{
- this(res, templateFunctions, extraStates, isJavaCompilationAllowed, requestContext, credentialProviderProvider, new GraphFetchExecutionConfiguration());
+ this(res, templateFunctions, extraStates, isJavaCompilationAllowed, requestContext, new GraphFetchExecutionConfiguration());
}
@Deprecated
- public ExecutionState(Map res, List extends String> templateFunctions, Iterable extends StoreExecutionState> extraStates, boolean isJavaCompilationAllowed, long graphFetchBatchMemoryLimit, RequestContext requestContext, CredentialProviderProvider credentialProviderProvider)
+ public ExecutionState(Map res, List extends String> templateFunctions, Iterable extends StoreExecutionState> extraStates, boolean isJavaCompilationAllowed, long graphFetchBatchMemoryLimit, RequestContext requestContext)
{
- this(res, templateFunctions, extraStates, isJavaCompilationAllowed, graphFetchBatchMemoryLimit, requestContext, credentialProviderProvider, true);
+ this(res, templateFunctions, extraStates, isJavaCompilationAllowed, graphFetchBatchMemoryLimit, requestContext, true);
}
- public ExecutionState(Map res, List extends String> templateFunctions, Iterable extends StoreExecutionState> extraStates, boolean isJavaCompilationAllowed, RequestContext requestContext, CredentialProviderProvider credentialProviderProvider, GraphFetchExecutionConfiguration graphFetchExecutionConfiguration)
+ public ExecutionState(Map res, List extends String> templateFunctions, Iterable extends StoreExecutionState> extraStates, boolean isJavaCompilationAllowed, RequestContext requestContext, GraphFetchExecutionConfiguration graphFetchExecutionConfiguration)
{
- this(res, templateFunctions, extraStates, isJavaCompilationAllowed, requestContext, credentialProviderProvider, graphFetchExecutionConfiguration, true);
+ this(res, templateFunctions, extraStates, isJavaCompilationAllowed, requestContext, graphFetchExecutionConfiguration, true);
}
@Deprecated
- public ExecutionState(Map res, List extends String> templateFunctions, Iterable extends StoreExecutionState> extraStates, boolean isJavaCompilationAllowed, long graphFetchBatchMemoryLimit, RequestContext requestContext, CredentialProviderProvider credentialProviderProvider, boolean logSQLWithParamValues)
+ public ExecutionState(Map res, List extends String> templateFunctions, Iterable extends StoreExecutionState> extraStates, boolean isJavaCompilationAllowed, long graphFetchBatchMemoryLimit, RequestContext requestContext, boolean logSQLWithParamValues)
{
- this(res, templateFunctions, extraStates, isJavaCompilationAllowed, requestContext, credentialProviderProvider, new GraphFetchExecutionConfiguration(graphFetchBatchMemoryLimit), logSQLWithParamValues);
+ this(res, templateFunctions, extraStates, isJavaCompilationAllowed, requestContext, new GraphFetchExecutionConfiguration(graphFetchBatchMemoryLimit), logSQLWithParamValues);
}
- public ExecutionState(Map res, List extends String> templateFunctions, Iterable extends StoreExecutionState> extraStates, boolean isJavaCompilationAllowed, RequestContext requestContext, CredentialProviderProvider credentialProviderProvider, GraphFetchExecutionConfiguration graphFetchExecutionConfiguration, boolean logSQLWithParamValues)
+ public ExecutionState(Map res, List extends String> templateFunctions, Iterable extends StoreExecutionState> extraStates, boolean isJavaCompilationAllowed, RequestContext requestContext, GraphFetchExecutionConfiguration graphFetchExecutionConfiguration, boolean logSQLWithParamValues)
{
this.inAllocation = false;
this.inLake = false;
@@ -160,7 +157,6 @@ public ExecutionState(Map res, List extends String> templateFu
this.extraNodeExecutors = ListIterate.flatCollect(extensions, ExecutionExtension::getExtraNodeExecutors);
this.extraSequenceNodeExecutors = ListIterate.flatCollect(extensions, ExecutionExtension::getExtraSequenceNodeExecutors);
this.requestContext = requestContext;
- this.credentialProviderProvider = credentialProviderProvider;
this.logSQLWithParamValues = logSQLWithParamValues;
}
@@ -179,7 +175,7 @@ public ExecutionState copy()
Map resCopy = Maps.mutable.ofMap(this.res);
List extends String> templateFunctionsCopy = Lists.mutable.ofAll(this.templateFunctions);
List extends StoreExecutionState> extraStatesCopy = this.states.values().stream().map(StoreExecutionState::copy).collect(Collectors.toList());
- ExecutionState copy = new ExecutionState(resCopy, templateFunctionsCopy, extraStatesCopy, this.isJavaCompilationAllowed, this.requestContext, this.credentialProviderProvider, this.graphFetchExecutionConfiguration, this.logSQLWithParamValues);
+ ExecutionState copy = new ExecutionState(resCopy, templateFunctionsCopy, extraStatesCopy, this.isJavaCompilationAllowed, this.requestContext, this.graphFetchExecutionConfiguration, this.logSQLWithParamValues);
copy.activities = Lists.mutable.withAll(this.activities);
copy.allocationNodeName = this.allocationNodeName;
@@ -358,11 +354,6 @@ public void setRequestContext(RequestContext requestContext)
this.requestContext = requestContext;
}
- public CredentialProviderProvider getCredentialProviderProvider()
- {
- return this.credentialProviderProvider;
- }
-
public boolean logSQLWithParamValues()
{
return this.logSQLWithParamValues;
diff --git a/legend-engine-core/legend-engine-core-base/legend-engine-core-executionPlan-execution/legend-engine-executionPlan-execution/src/test/java/org/finos/legend/engine/plan/execution/TestPlanExecutor.java b/legend-engine-core/legend-engine-core-base/legend-engine-core-executionPlan-execution/legend-engine-executionPlan-execution/src/test/java/org/finos/legend/engine/plan/execution/TestPlanExecutor.java
index 8a2fab5132a..6ae3ac005cb 100644
--- a/legend-engine-core/legend-engine-core-base/legend-engine-core-executionPlan-execution/legend-engine-executionPlan-execution/src/test/java/org/finos/legend/engine/plan/execution/TestPlanExecutor.java
+++ b/legend-engine-core/legend-engine-core-base/legend-engine-core-executionPlan-execution/legend-engine-executionPlan-execution/src/test/java/org/finos/legend/engine/plan/execution/TestPlanExecutor.java
@@ -40,17 +40,17 @@ public void testStateWithReferralHeaderPlaceHolder()
res.put("userId", new ConstantResult("anumam"));
Identity identity = IdentityFactoryProvider.getInstance().getAnonymousIdentity();
- ExecutionState state1 = new ExecutionState(res, Lists.mutable.empty(), Lists.mutable.empty(), false, 52_428_800L, new RequestContext(session, "https://allo'y'.site.gs.com/"), null);
+ ExecutionState state1 = new ExecutionState(res, Lists.mutable.empty(), Lists.mutable.empty(), false, 52_428_800L, new RequestContext(session, "https://allo'y'.site.gs.com/"));
PlanExecutor.setUpState(new SingleExecutionPlan(), state1, identity, "anumam");
String sqlQuery1 = FreeMarkerExecutor.process("ALTER SESSION SET QUERY_TAG = '{\"executionTraceID\" : \"${execID}\", \"engineUser\" : \"${userId}\", \"referer\" : \"${referer}\"}';", state1, "snowflake", null);
Assert.assertEquals("ALTER SESSION SET QUERY_TAG = '{\"executionTraceID\" : \"b26973f8-8857-4ece-bfdc-107176c9da8b\", \"engineUser\" : \"anumam\", \"referer\" : \"https://allo''y''.site.gs.com/\"}';", sqlQuery1);
- ExecutionState state2 = new ExecutionState(res, Lists.mutable.empty(), Lists.mutable.empty(), false, 52_428_800L, new RequestContext(session, null), null);
+ ExecutionState state2 = new ExecutionState(res, Lists.mutable.empty(), Lists.mutable.empty(), false, 52_428_800L, new RequestContext(session, null));
PlanExecutor.setUpState(new SingleExecutionPlan(), state2, identity, "anumam");
String sqlQuery2 = FreeMarkerExecutor.process("ALTER SESSION SET QUERY_TAG = '{\"executionTraceID\" : \"${execID}\", \"engineUser\" : \"${userId}\", \"referer\" : \"${referer}\"}';", state2, "snowflake", null);
Assert.assertEquals("ALTER SESSION SET QUERY_TAG = '{\"executionTraceID\" : \"b26973f8-8857-4ece-bfdc-107176c9da8b\", \"engineUser\" : \"anumam\", \"referer\" : \"null\"}';", sqlQuery2);
- ExecutionState state3 = new ExecutionState(res, Lists.mutable.empty(), Lists.mutable.empty(), false, 52_428_800L, null, null);
+ ExecutionState state3 = new ExecutionState(res, Lists.mutable.empty(), Lists.mutable.empty(), false, 52_428_800L, null);
PlanExecutor.setUpState(new SingleExecutionPlan(), state3, identity, "anumam");
String sqlQuery3 = FreeMarkerExecutor.process("ALTER SESSION SET QUERY_TAG = '{\"executionTraceID\" : \"${execID}\", \"engineUser\" : \"${userId}\", \"referer\" : \"${referer}\"}';", state3, "snowflake", null);
Assert.assertEquals("ALTER SESSION SET QUERY_TAG = '{\"executionTraceID\" : \"b26973f8-8857-4ece-bfdc-107176c9da8b\", \"engineUser\" : \"anumam\", \"referer\" : \"null\"}';", sqlQuery3);
diff --git a/legend-engine-xts-elasticsearch/legend-engine-xt-elasticsearch-V7-executionPlan/src/main/java/org/finos/legend/engine/plan/execution/stores/elasticsearch/v7/plugin/ElasticsearchV7ExecutionNodeExecutor.java b/legend-engine-xts-elasticsearch/legend-engine-xt-elasticsearch-V7-executionPlan/src/main/java/org/finos/legend/engine/plan/execution/stores/elasticsearch/v7/plugin/ElasticsearchV7ExecutionNodeExecutor.java
index b1e6d084b64..50aee992272 100644
--- a/legend-engine-xts-elasticsearch/legend-engine-xt-elasticsearch-V7-executionPlan/src/main/java/org/finos/legend/engine/plan/execution/stores/elasticsearch/v7/plugin/ElasticsearchV7ExecutionNodeExecutor.java
+++ b/legend-engine-xts-elasticsearch/legend-engine-xt-elasticsearch-V7-executionPlan/src/main/java/org/finos/legend/engine/plan/execution/stores/elasticsearch/v7/plugin/ElasticsearchV7ExecutionNodeExecutor.java
@@ -19,6 +19,7 @@
import org.apache.http.client.protocol.HttpClientContext;
import org.finos.legend.engine.plan.execution.nodes.state.ExecutionState;
import org.finos.legend.engine.plan.execution.result.Result;
+import org.finos.legend.engine.plan.execution.stores.StoreType;
import org.finos.legend.engine.plan.execution.stores.elasticsearch.v7.connection.ElasticsearchHttpContextUtil;
import org.finos.legend.engine.plan.execution.stores.elasticsearch.v7.result.ExecutionRequestVisitor;
import org.finos.legend.engine.protocol.pure.v1.model.executionPlan.nodes.ExecutionNode;
@@ -51,8 +52,7 @@ public Result visit(ExecutionNode executionNode)
Elasticsearch7RequestExecutionNode esNode = (Elasticsearch7RequestExecutionNode) executionNode;
Elasticsearch7StoreConnection connection = esNode.connection;
- HttpClientContext httpClientContext = ElasticsearchHttpContextUtil.authToHttpContext(this.identity, this.executionState.getCredentialProviderProvider(), connection.authSpec, this.state.getProviders());
-
+ HttpClientContext httpClientContext = ElasticsearchHttpContextUtil.authToHttpContext(this.identity, ((ElasticsearchV7StoreExecutionState)this.executionState.getStoreExecutionState(StoreType.ESv7)).getStoreExecutionConfiguration().getCredentialProviderProvider(), connection.authSpec, this.state.getProviders());
RequestBase request = null;
try
{
diff --git a/legend-engine-xts-elasticsearch/legend-engine-xt-elasticsearch-V7-executionPlan/src/main/java/org/finos/legend/engine/plan/execution/stores/elasticsearch/v7/plugin/ElasticsearchV7StoreExecutionState.java b/legend-engine-xts-elasticsearch/legend-engine-xt-elasticsearch-V7-executionPlan/src/main/java/org/finos/legend/engine/plan/execution/stores/elasticsearch/v7/plugin/ElasticsearchV7StoreExecutionState.java
index bdac98f19e7..e22d5212fa8 100644
--- a/legend-engine-xts-elasticsearch/legend-engine-xt-elasticsearch-V7-executionPlan/src/main/java/org/finos/legend/engine/plan/execution/stores/elasticsearch/v7/plugin/ElasticsearchV7StoreExecutionState.java
+++ b/legend-engine-xts-elasticsearch/legend-engine-xt-elasticsearch-V7-executionPlan/src/main/java/org/finos/legend/engine/plan/execution/stores/elasticsearch/v7/plugin/ElasticsearchV7StoreExecutionState.java
@@ -25,9 +25,17 @@ public class ElasticsearchV7StoreExecutionState implements StoreExecutionState
{
private final ElasticsearchV7StoreState state;
- public ElasticsearchV7StoreExecutionState(ElasticsearchV7StoreState state)
+ private final ElasticsearchV7StoreExecutorConfiguration elasticsearchV7StoreExecutorConfiguration;
+
+ public ElasticsearchV7StoreExecutionState(ElasticsearchV7StoreState state, ElasticsearchV7StoreExecutorConfiguration elasticsearchV7StoreExecutorConfiguration)
{
this.state = state;
+ this.elasticsearchV7StoreExecutorConfiguration = elasticsearchV7StoreExecutorConfiguration;
+ }
+
+ public ElasticsearchV7StoreExecutorConfiguration getStoreExecutionConfiguration()
+ {
+ return this.elasticsearchV7StoreExecutorConfiguration;
}
@Override
diff --git a/legend-engine-xts-elasticsearch/legend-engine-xt-elasticsearch-V7-executionPlan/src/main/java/org/finos/legend/engine/plan/execution/stores/elasticsearch/v7/plugin/ElasticsearchV7StoreExecutor.java b/legend-engine-xts-elasticsearch/legend-engine-xt-elasticsearch-V7-executionPlan/src/main/java/org/finos/legend/engine/plan/execution/stores/elasticsearch/v7/plugin/ElasticsearchV7StoreExecutor.java
index 21e9bd940b9..445e30619b8 100644
--- a/legend-engine-xts-elasticsearch/legend-engine-xt-elasticsearch-V7-executionPlan/src/main/java/org/finos/legend/engine/plan/execution/stores/elasticsearch/v7/plugin/ElasticsearchV7StoreExecutor.java
+++ b/legend-engine-xts-elasticsearch/legend-engine-xt-elasticsearch-V7-executionPlan/src/main/java/org/finos/legend/engine/plan/execution/stores/elasticsearch/v7/plugin/ElasticsearchV7StoreExecutor.java
@@ -22,10 +22,17 @@ public class ElasticsearchV7StoreExecutor implements StoreExecutor
{
private final ElasticsearchV7StoreState state = new ElasticsearchV7StoreState();
+ private final ElasticsearchV7StoreExecutorConfiguration elasticsearchV7StoreExecutorConfiguration;
+
+ public ElasticsearchV7StoreExecutor(ElasticsearchV7StoreExecutorConfiguration elasticsearchV7StoreExecutorConfiguration)
+ {
+ this.elasticsearchV7StoreExecutorConfiguration = elasticsearchV7StoreExecutorConfiguration;
+ }
+
@Override
public StoreExecutionState buildStoreExecutionState()
{
- return new ElasticsearchV7StoreExecutionState(this.state);
+ return new ElasticsearchV7StoreExecutionState(this.state, this.elasticsearchV7StoreExecutorConfiguration);
}
@Override
diff --git a/legend-engine-xts-elasticsearch/legend-engine-xt-elasticsearch-V7-executionPlan/src/main/java/org/finos/legend/engine/plan/execution/stores/elasticsearch/v7/plugin/ElasticsearchV7StoreExecutorBuilder.java b/legend-engine-xts-elasticsearch/legend-engine-xt-elasticsearch-V7-executionPlan/src/main/java/org/finos/legend/engine/plan/execution/stores/elasticsearch/v7/plugin/ElasticsearchV7StoreExecutorBuilder.java
index 03873c9d641..071f609b288 100644
--- a/legend-engine-xts-elasticsearch/legend-engine-xt-elasticsearch-V7-executionPlan/src/main/java/org/finos/legend/engine/plan/execution/stores/elasticsearch/v7/plugin/ElasticsearchV7StoreExecutorBuilder.java
+++ b/legend-engine-xts-elasticsearch/legend-engine-xt-elasticsearch-V7-executionPlan/src/main/java/org/finos/legend/engine/plan/execution/stores/elasticsearch/v7/plugin/ElasticsearchV7StoreExecutorBuilder.java
@@ -38,12 +38,12 @@ public StoreType getStoreType()
@Override
public StoreExecutor build()
{
- return new ElasticsearchV7StoreExecutor();
+ return build(ElasticsearchV7StoreExecutorConfiguration.newInstance().build());
}
@Override
public StoreExecutor build(StoreExecutorConfiguration storeExecutorConfiguration)
{
- return this.build();
+ return new ElasticsearchV7StoreExecutor((ElasticsearchV7StoreExecutorConfiguration)storeExecutorConfiguration);
}
}
diff --git a/legend-engine-xts-elasticsearch/legend-engine-xt-elasticsearch-V7-executionPlan/src/main/java/org/finos/legend/engine/plan/execution/stores/elasticsearch/v7/plugin/ElasticsearchV7StoreExecutorConfiguration.java b/legend-engine-xts-elasticsearch/legend-engine-xt-elasticsearch-V7-executionPlan/src/main/java/org/finos/legend/engine/plan/execution/stores/elasticsearch/v7/plugin/ElasticsearchV7StoreExecutorConfiguration.java
new file mode 100644
index 00000000000..abfbd0c6827
--- /dev/null
+++ b/legend-engine-xts-elasticsearch/legend-engine-xt-elasticsearch-V7-executionPlan/src/main/java/org/finos/legend/engine/plan/execution/stores/elasticsearch/v7/plugin/ElasticsearchV7StoreExecutorConfiguration.java
@@ -0,0 +1,59 @@
+// Copyright 2023 Goldman Sachs
+//
+// Licensed 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.
+
+package org.finos.legend.engine.plan.execution.stores.elasticsearch.v7.plugin;
+
+import org.finos.legend.authentication.credentialprovider.CredentialProviderProvider;
+import org.finos.legend.engine.plan.execution.stores.StoreExecutorConfiguration;
+import org.finos.legend.engine.plan.execution.stores.StoreType;
+
+public class ElasticsearchV7StoreExecutorConfiguration implements StoreExecutorConfiguration
+{
+ private CredentialProviderProvider credentialProviderProvider;
+
+ @Override
+ public StoreType getStoreType()
+ {
+ return StoreType.NonRelational_MongoDB;
+ }
+
+ public CredentialProviderProvider getCredentialProviderProvider()
+ {
+ return credentialProviderProvider;
+ }
+
+ public static Builder newInstance()
+ {
+ return new Builder();
+ }
+
+ public static class Builder
+ {
+ private CredentialProviderProvider credentialProviderProvider = CredentialProviderProvider.defaultProviderProvider();
+
+ public Builder withCredentialProviderProvider(CredentialProviderProvider credentialProviderProvider)
+ {
+ this.credentialProviderProvider = credentialProviderProvider;
+ return this;
+ }
+
+ public ElasticsearchV7StoreExecutorConfiguration build()
+ {
+ ElasticsearchV7StoreExecutorConfiguration elasticsearchV7StoreExecutorConfiguration = new ElasticsearchV7StoreExecutorConfiguration();
+ elasticsearchV7StoreExecutorConfiguration.credentialProviderProvider = credentialProviderProvider;
+ return elasticsearchV7StoreExecutorConfiguration;
+ }
+ }
+
+}
diff --git a/legend-engine-xts-mongodb/legend-engine-xt-nonrelationalStore-mongodb-executionPlan/src/main/java/org/finos/legend/engine/plan/execution/stores/mongodb/MongoDBExecutor.java b/legend-engine-xts-mongodb/legend-engine-xt-nonrelationalStore-mongodb-executionPlan/src/main/java/org/finos/legend/engine/plan/execution/stores/mongodb/MongoDBExecutor.java
index 1ced6a6ffe8..adddff7adc6 100644
--- a/legend-engine-xts-mongodb/legend-engine-xt-nonrelationalStore-mongodb-executionPlan/src/main/java/org/finos/legend/engine/plan/execution/stores/mongodb/MongoDBExecutor.java
+++ b/legend-engine-xts-mongodb/legend-engine-xt-nonrelationalStore-mongodb-executionPlan/src/main/java/org/finos/legend/engine/plan/execution/stores/mongodb/MongoDBExecutor.java
@@ -19,7 +19,6 @@
import org.bson.Document;
import org.eclipse.collections.api.tuple.Pair;
import org.finos.legend.authentication.credentialprovider.CredentialProviderProvider;
-import org.finos.legend.engine.plan.execution.stores.mongodb.auth.MongoDBConnectionSpecification;
import org.finos.legend.engine.plan.execution.stores.mongodb.auth.MongoDBStoreConnectionProvider;
import org.finos.legend.engine.plan.execution.stores.mongodb.result.MongoDBResult;
import org.finos.legend.engine.protocol.mongodb.schema.metamodel.pure.MongoDBConnection;
@@ -31,7 +30,6 @@
public class MongoDBExecutor
{
-
private final CredentialProviderProvider credentialProviderProvider;
public MongoDBExecutor(CredentialProviderProvider credentialProviderProvider)
@@ -43,8 +41,7 @@ public MongoDBResult executeMongoDBQuery(String dbCommand, MongoDBConnection dbC
{
try
{
- MongoDBStoreConnectionProvider mongoDBConnectionProvider = getMongoDBConnectionProvider();
- MongoDBConnectionSpecification mongoDBConnectionSpec = new MongoDBConnectionSpecification(dbConnection.dataSourceSpecification);
+ MongoDBStoreConnectionProvider mongoDBConnectionProvider = new MongoDBStoreConnectionProvider(this.credentialProviderProvider);
try
{
Document bsonCmd = Document.parse(dbCommand);
@@ -67,10 +64,4 @@ public MongoDBResult executeMongoDBQuery(String dbCommand, MongoDBConnection dbC
ExceptionCategory.SERVER_EXECUTION_ERROR);
}
}
-
- private MongoDBStoreConnectionProvider getMongoDBConnectionProvider()
- {
- MongoDBStoreConnectionProvider connectionProvider = new MongoDBStoreConnectionProvider(this.credentialProviderProvider);
- return connectionProvider;
- }
}
diff --git a/legend-engine-xts-mongodb/legend-engine-xt-nonrelationalStore-mongodb-executionPlan/src/main/java/org/finos/legend/engine/plan/execution/stores/mongodb/plugin/MongoDBExecutionNodeExecutor.java b/legend-engine-xts-mongodb/legend-engine-xt-nonrelationalStore-mongodb-executionPlan/src/main/java/org/finos/legend/engine/plan/execution/stores/mongodb/plugin/MongoDBExecutionNodeExecutor.java
index 3680ba85c50..92f42166419 100644
--- a/legend-engine-xts-mongodb/legend-engine-xt-nonrelationalStore-mongodb-executionPlan/src/main/java/org/finos/legend/engine/plan/execution/stores/mongodb/plugin/MongoDBExecutionNodeExecutor.java
+++ b/legend-engine-xts-mongodb/legend-engine-xt-nonrelationalStore-mongodb-executionPlan/src/main/java/org/finos/legend/engine/plan/execution/stores/mongodb/plugin/MongoDBExecutionNodeExecutor.java
@@ -106,7 +106,7 @@ public Result executeMongoDBExecutionNode(MongoDBExecutionNode mongoDBExecutionN
String composedDbCommand = mongoDBQueryJsonComposer.parseDatabaseCommand(dbCommand);
String placeholderReplacedDbCommand = FreeMarkerExecutor.process(composedDbCommand, this.executionState);
- CredentialProviderProvider credentialProviderProvider = this.executionState.getCredentialProviderProvider();
+ CredentialProviderProvider credentialProviderProvider = ((MongoDBStoreExecutionState) this.executionState.getStoreExecutionState(StoreType.NonRelational_MongoDB)).getStoreExecutionConfiguration().getCredentialProviderProvider();
return new MongoDBExecutor(credentialProviderProvider).executeMongoDBQuery(placeholderReplacedDbCommand, mongoDBConnection, identity);
}
diff --git a/legend-engine-xts-mongodb/legend-engine-xt-nonrelationalStore-mongodb-executionPlan/src/main/java/org/finos/legend/engine/plan/execution/stores/mongodb/plugin/MongoDBStoreExecutionState.java b/legend-engine-xts-mongodb/legend-engine-xt-nonrelationalStore-mongodb-executionPlan/src/main/java/org/finos/legend/engine/plan/execution/stores/mongodb/plugin/MongoDBStoreExecutionState.java
index 2f6c02b6a28..4ae82e58eb8 100644
--- a/legend-engine-xts-mongodb/legend-engine-xt-nonrelationalStore-mongodb-executionPlan/src/main/java/org/finos/legend/engine/plan/execution/stores/mongodb/plugin/MongoDBStoreExecutionState.java
+++ b/legend-engine-xts-mongodb/legend-engine-xt-nonrelationalStore-mongodb-executionPlan/src/main/java/org/finos/legend/engine/plan/execution/stores/mongodb/plugin/MongoDBStoreExecutionState.java
@@ -25,18 +25,19 @@ public class MongoDBStoreExecutionState implements StoreExecutionState
{
private final MongoDBStoreState state;
- private RuntimeContext runtimeContext;
+ private RuntimeContext runtimeContext = RuntimeContext.empty();
+ private MongoDBStoreExecutorConfiguration storeExecutionConfiguration;
- public MongoDBStoreExecutionState(MongoDBStoreState state, RuntimeContext runtimeContext)
+ public MongoDBStoreExecutionState(MongoDBStoreState state, MongoDBStoreExecutorConfiguration storeExecutionConfiguration)
{
this.state = state;
- this.runtimeContext = runtimeContext;
+ this.storeExecutionConfiguration = storeExecutionConfiguration;
}
- public MongoDBStoreExecutionState(MongoDBStoreState state)
+ public MongoDBStoreExecutorConfiguration getStoreExecutionConfiguration()
{
- this(state, RuntimeContext.empty());
+ return storeExecutionConfiguration;
}
@Override
@@ -54,7 +55,7 @@ public ExecutionNodeVisitor getVisitor(Identity identity, ExecutionState
@Override
public StoreExecutionState copy()
{
- return new MongoDBStoreExecutionState(this.state, this.runtimeContext);
+ return new MongoDBStoreExecutionState(this.state, this.storeExecutionConfiguration);
}
@Override
diff --git a/legend-engine-xts-mongodb/legend-engine-xt-nonrelationalStore-mongodb-executionPlan/src/main/java/org/finos/legend/engine/plan/execution/stores/mongodb/plugin/MongoDBStoreExecutor.java b/legend-engine-xts-mongodb/legend-engine-xt-nonrelationalStore-mongodb-executionPlan/src/main/java/org/finos/legend/engine/plan/execution/stores/mongodb/plugin/MongoDBStoreExecutor.java
index b64a6a2b631..465468428c4 100644
--- a/legend-engine-xts-mongodb/legend-engine-xt-nonrelationalStore-mongodb-executionPlan/src/main/java/org/finos/legend/engine/plan/execution/stores/mongodb/plugin/MongoDBStoreExecutor.java
+++ b/legend-engine-xts-mongodb/legend-engine-xt-nonrelationalStore-mongodb-executionPlan/src/main/java/org/finos/legend/engine/plan/execution/stores/mongodb/plugin/MongoDBStoreExecutor.java
@@ -28,11 +28,10 @@ public MongoDBStoreExecutor(MongoDBStoreState state, MongoDBStoreExecutorConfigu
this.storeExecutionConfiguration = storeExecutionConfiguration;
}
-
@Override
public MongoDBStoreExecutionState buildStoreExecutionState()
{
- return new MongoDBStoreExecutionState(this.state);
+ return new MongoDBStoreExecutionState(this.state, this.storeExecutionConfiguration);
}
@Override
diff --git a/legend-engine-xts-mongodb/legend-engine-xt-nonrelationalStore-mongodb-executionPlan/src/main/java/org/finos/legend/engine/plan/execution/stores/mongodb/plugin/MongoDBStoreExecutorBuilder.java b/legend-engine-xts-mongodb/legend-engine-xt-nonrelationalStore-mongodb-executionPlan/src/main/java/org/finos/legend/engine/plan/execution/stores/mongodb/plugin/MongoDBStoreExecutorBuilder.java
index aee8535ad8d..1dce42da9f3 100644
--- a/legend-engine-xts-mongodb/legend-engine-xt-nonrelationalStore-mongodb-executionPlan/src/main/java/org/finos/legend/engine/plan/execution/stores/mongodb/plugin/MongoDBStoreExecutorBuilder.java
+++ b/legend-engine-xts-mongodb/legend-engine-xt-nonrelationalStore-mongodb-executionPlan/src/main/java/org/finos/legend/engine/plan/execution/stores/mongodb/plugin/MongoDBStoreExecutorBuilder.java
@@ -41,14 +41,12 @@ public MongoDBStoreExecutor build()
}
@Override
- public StoreExecutor build(StoreExecutorConfiguration storeExecutorConfiguration)
+ public MongoDBStoreExecutor build(StoreExecutorConfiguration storeExecutorConfiguration)
{
if (!(storeExecutorConfiguration instanceof MongoDBStoreExecutorConfiguration))
{
throw new IllegalStateException("Incorrect store execution configuration, expected MongoDBStoreExecutorConfiguration. Please reach out to dev team");
}
- MongoDBStoreExecutorConfiguration mongoDBStoreExecutorConfiguration = (MongoDBStoreExecutorConfiguration) storeExecutorConfiguration;
- MongoDBStoreState state = new MongoDBStoreState();
- return new MongoDBStoreExecutor(state, mongoDBStoreExecutorConfiguration);
+ return new MongoDBStoreExecutor(new MongoDBStoreState(), (MongoDBStoreExecutorConfiguration) storeExecutorConfiguration);
}
}
diff --git a/legend-engine-xts-mongodb/legend-engine-xt-nonrelationalStore-mongodb-executionPlan/src/main/java/org/finos/legend/engine/plan/execution/stores/mongodb/plugin/MongoDBStoreExecutorConfiguration.java b/legend-engine-xts-mongodb/legend-engine-xt-nonrelationalStore-mongodb-executionPlan/src/main/java/org/finos/legend/engine/plan/execution/stores/mongodb/plugin/MongoDBStoreExecutorConfiguration.java
index c18791c1a39..79050812c2a 100644
--- a/legend-engine-xts-mongodb/legend-engine-xt-nonrelationalStore-mongodb-executionPlan/src/main/java/org/finos/legend/engine/plan/execution/stores/mongodb/plugin/MongoDBStoreExecutorConfiguration.java
+++ b/legend-engine-xts-mongodb/legend-engine-xt-nonrelationalStore-mongodb-executionPlan/src/main/java/org/finos/legend/engine/plan/execution/stores/mongodb/plugin/MongoDBStoreExecutorConfiguration.java
@@ -40,7 +40,7 @@ public static Builder newInstance()
public static class Builder
{
- private CredentialProviderProvider credentialProviderProvider = CredentialProviderProvider.builder().build();
+ private CredentialProviderProvider credentialProviderProvider = CredentialProviderProvider.defaultProviderProvider();
public Builder withCredentialProviderProvider(CredentialProviderProvider credentialProviderProvider)
{
@@ -51,7 +51,7 @@ public Builder withCredentialProviderProvider(CredentialProviderProvider credent
public MongoDBStoreExecutorConfiguration build()
{
MongoDBStoreExecutorConfiguration mongoDBStoreExecutionConfiguration = new MongoDBStoreExecutorConfiguration();
- mongoDBStoreExecutionConfiguration.credentialProviderProvider = credentialProviderProvider;
+ mongoDBStoreExecutionConfiguration.credentialProviderProvider = this.credentialProviderProvider;
return mongoDBStoreExecutionConfiguration;
}
}