use of io.confluent.ksql.security.KsqlSecurityContext in project ksql by confluentinc.
the class RequestHandler method executeStatement.
@SuppressWarnings("unchecked")
private <T extends Statement> Optional<KsqlEntity> executeStatement(final KsqlSecurityContext securityContext, final PreparedStatement<T> prepared, final SessionProperties sessionProperties, final KsqlEntityList entities) {
final Class<? extends Statement> statementClass = prepared.getStatement().getClass();
commandQueueSync.waitFor(new KsqlEntityList(entities), statementClass);
final ConfiguredStatement<T> configured = ConfiguredStatement.of(prepared, SessionConfig.of(this.ksqlEngine.getKsqlConfig(), sessionProperties.getMutableScopedProperties()));
FeatureFlagChecker.throwOnDisabledFeatures(configured);
final StatementExecutor<T> executor = (StatementExecutor<T>) customExecutors.getOrDefault(statementClass, (stmt, props, ctx, svcCtx) -> distributor.execute(stmt, ctx, securityContext));
final StatementExecutorResponse response = executor.execute(configured, sessionProperties, ksqlEngine, securityContext.getServiceContext());
if (response.isHandled()) {
return response.getEntity();
} else {
return distributor.execute(configured, ksqlEngine, securityContext).getEntity();
}
}
Aggregations