Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import org.apache.polaris.core.admin.model.AuthenticationParameters;
import org.apache.polaris.core.admin.model.StorageConfigInfo;
import org.apache.polaris.core.connection.ConnectionType;
import org.apache.polaris.core.context.CallContext;
import org.apache.polaris.core.persistence.cache.EntityWeigher;

/**
Expand All @@ -48,8 +47,8 @@ protected FeatureConfiguration(
* we want to throw an UnsupportedOperationException if it's not enabled.
*/
public static void enforceFeatureEnabledOrThrow(
CallContext callContext, FeatureConfiguration<Boolean> featureConfig) {
boolean enabled = callContext.getRealmConfig().getConfig(featureConfig);
RealmConfig realmConfig, FeatureConfiguration<Boolean> featureConfig) {
boolean enabled = realmConfig.getConfig(featureConfig);
if (!enabled) {
throw new UnsupportedOperationException("Feature not enabled: " + featureConfig.key());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,7 @@ public PolarisEntity createCatalog(CreateCatalogRequest catalogRequest) {
.addKeyValue("catalogName", entity.getName())
.log("Creating a federated catalog");
FeatureConfiguration.enforceFeatureEnabledOrThrow(
callContext, FeatureConfiguration.ENABLE_CATALOG_FEDERATION);
callContext.getRealmConfig(), FeatureConfiguration.ENABLE_CATALOG_FEDERATION);
Map<String, UserSecretReference> processedSecretReferences = Map.of();
List<String> supportedAuthenticationTypes =
callContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public GenericTableCatalogAdapter(
private GenericTableCatalogHandler newHandlerWrapper(
SecurityContext securityContext, String prefix) {
FeatureConfiguration.enforceFeatureEnabledOrThrow(
callContext, FeatureConfiguration.ENABLE_GENERIC_TABLES);
callContext.getRealmConfig(), FeatureConfiguration.ENABLE_GENERIC_TABLES);
validatePrincipal(securityContext);

return new GenericTableCatalogHandler(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ protected void initializeCatalog() {
.addKeyValue("remoteUrl", connectionConfigInfoDpo.getUri())
.log("Initializing federated catalog");
FeatureConfiguration.enforceFeatureEnabledOrThrow(
callContext, FeatureConfiguration.ENABLE_CATALOG_FEDERATION);
callContext.getRealmConfig(), FeatureConfiguration.ENABLE_CATALOG_FEDERATION);

Catalog federatedCatalog;
ConnectionType connectionType =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public PolicyCatalogAdapter(

private PolicyCatalogHandler newHandlerWrapper(SecurityContext securityContext, String prefix) {
FeatureConfiguration.enforceFeatureEnabledOrThrow(
callContext, FeatureConfiguration.ENABLE_POLICY_STORE);
callContext.getRealmConfig(), FeatureConfiguration.ENABLE_POLICY_STORE);
validatePrincipal(securityContext);

return new PolicyCatalogHandler(
Expand Down