File tree Expand file tree Collapse file tree 2 files changed +19
-12
lines changed
polaris-core/src/main/java/org/apache/polaris/core/rest
service/common/src/main/java/org/apache/polaris/service/catalog/iceberg Expand file tree Collapse file tree 2 files changed +19
-12
lines changed Original file line number Diff line number Diff line change 2121import com .google .common .collect .ImmutableSet ;
2222import java .util .Set ;
2323import org .apache .iceberg .rest .Endpoint ;
24+ import org .apache .polaris .core .config .FeatureConfiguration ;
25+ import org .apache .polaris .core .context .CallContext ;
2426
2527public class PolarisEndpoints {
2628 public static final Endpoint V1_LIST_GENERIC_TABLES =
@@ -39,4 +41,20 @@ public class PolarisEndpoints {
3941 .add (V1_DELETE_GENERIC_TABLE )
4042 .add (V1_LOAD_GENERIC_TABLE )
4143 .build ();
44+
45+ /**
46+ * Get the generic table endpoints. Returns GENERIC_TABLE_ENDPOINTS if ENABLE_GENERIC_TABLES is
47+ * set to true, otherwise, returns an empty set.
48+ */
49+ public static Set <Endpoint > getSupportedGenericTableEndpoints (CallContext callContext ) {
50+ // add the generic table endpoints as supported endpoints if generic table feature is enabled.
51+ boolean genericTableEnabled =
52+ callContext
53+ .getPolarisCallContext ()
54+ .getConfigurationStore ()
55+ .getConfiguration (
56+ callContext .getPolarisCallContext (), FeatureConfiguration .ENABLE_GENERIC_TABLES );
57+
58+ return genericTableEnabled ? PolarisEndpoints .GENERIC_TABLE_ENDPOINTS : ImmutableSet .of ();
59+ }
4260}
Original file line number Diff line number Diff line change 5959import org .apache .iceberg .rest .responses .LoadTableResponse ;
6060import org .apache .polaris .core .auth .AuthenticatedPolarisPrincipal ;
6161import org .apache .polaris .core .auth .PolarisAuthorizer ;
62- import org .apache .polaris .core .config .FeatureConfiguration ;
6362import org .apache .polaris .core .context .CallContext ;
6463import org .apache .polaris .core .context .RealmContext ;
6564import org .apache .polaris .core .entity .PolarisEntity ;
@@ -705,16 +704,6 @@ public Response getConfig(
705704
706705 String prefix = prefixParser .catalogNameToPrefix (realmContext , warehouse );
707706
708- // add the generic table endpoints as supported endpoints if generic table feature is enabled.
709- boolean genericTableEnabled =
710- callContext
711- .getPolarisCallContext ()
712- .getConfigurationStore ()
713- .getConfiguration (
714- callContext .getPolarisCallContext (), FeatureConfiguration .ENABLE_GENERIC_TABLES );
715- Set <Endpoint > supportedGenericTableEndpoints =
716- genericTableEnabled ? PolarisEndpoints .GENERIC_TABLE_ENDPOINTS : ImmutableSet .of ();
717-
718707 return Response .ok (
719708 ConfigResponse .builder ()
720709 .withDefaults (properties ) // catalog properties are defaults
@@ -724,7 +713,7 @@ public Response getConfig(
724713 .addAll (DEFAULT_ENDPOINTS )
725714 .addAll (VIEW_ENDPOINTS )
726715 .addAll (COMMIT_ENDPOINT )
727- .addAll (supportedGenericTableEndpoints )
716+ .addAll (PolarisEndpoints . getSupportedGenericTableEndpoints ( callContext ) )
728717 .build ())
729718 .build ())
730719 .build ();
You can’t perform that action at this time.
0 commit comments