adutra commented on code in PR #4926: URL: https://github.com/apache/polaris/pull/4926#discussion_r3499419989
########## runtime/service/src/main/java/org/apache/polaris/service/catalog/generic/GenericTableConfigEndpoints.java: ########## @@ -0,0 +1,45 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.apache.polaris.service.catalog.generic; + +import com.google.common.collect.ImmutableSet; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.enterprise.inject.Produces; +import java.util.Set; +import org.apache.iceberg.rest.Endpoint; +import org.apache.polaris.core.config.FeatureConfiguration; +import org.apache.polaris.core.config.RealmConfig; +import org.apache.polaris.service.catalog.config.CatalogConfigEndpointContributor; + +@ApplicationScoped +public class GenericTableConfigEndpoints { + @Produces + public CatalogConfigEndpointContributor genericTableEndpoints() { Review Comment: When there is only one bean to produce the whole class could just implement `CatalogConfigEndpointContributor`. ########## runtime/service/src/main/java/org/apache/polaris/service/catalog/config/CatalogConfigEndpointContributor.java: ########## @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.apache.polaris.service.catalog.config; + +import java.util.Set; +import org.apache.iceberg.rest.Endpoint; +import org.apache.polaris.core.config.RealmConfig; + +/** Contributes endpoints advertised in catalog configuration responses. */ +@FunctionalInterface +public interface CatalogConfigEndpointContributor { Review Comment: You probably want this interface in polaris-core, so that contributors can be declared in extension modules. We did the same for `ProductionReadinessCheck`. ########## runtime/service/src/main/java/org/apache/polaris/service/catalog/config/CatalogConfigHandler.java: ########## @@ -0,0 +1,129 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.apache.polaris.service.catalog.config; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import jakarta.enterprise.context.RequestScoped; +import jakarta.enterprise.inject.Any; +import jakarta.enterprise.inject.Instance; +import jakarta.inject.Inject; +import java.util.LinkedHashSet; +import java.util.Map; +import java.util.Set; +import org.apache.iceberg.exceptions.NotFoundException; +import org.apache.iceberg.rest.Endpoint; +import org.apache.iceberg.rest.RESTCatalogProperties; +import org.apache.iceberg.rest.responses.ConfigResponse; +import org.apache.polaris.core.auth.PolarisPrincipal; +import org.apache.polaris.core.config.RealmConfig; +import org.apache.polaris.core.entity.PolarisEntity; +import org.apache.polaris.core.persistence.ResolvedPolarisEntity; +import org.apache.polaris.core.persistence.resolver.Resolver; +import org.apache.polaris.core.persistence.resolver.ResolverFactory; +import org.apache.polaris.core.persistence.resolver.ResolverStatus; +import org.apache.polaris.core.rest.NamespaceUtils; +import org.apache.polaris.service.catalog.CatalogPrefixParser; + +@RequestScoped +public class CatalogConfigHandler { + private static final Set<Endpoint> ICEBERG_REST_ENDPOINTS = Review Comment: For completeness, I would create two endpoint contributors for the ns+table and view endpoints. The can stay declared here, but I would transform these static sets into two CDI producer methods. ########## runtime/service/src/main/java/org/apache/polaris/service/catalog/config/CatalogConfigHandler.java: ########## @@ -0,0 +1,129 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.apache.polaris.service.catalog.config; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; +import jakarta.enterprise.context.RequestScoped; +import jakarta.enterprise.inject.Any; +import jakarta.enterprise.inject.Instance; +import jakarta.inject.Inject; +import java.util.LinkedHashSet; +import java.util.Map; +import java.util.Set; +import org.apache.iceberg.exceptions.NotFoundException; +import org.apache.iceberg.rest.Endpoint; +import org.apache.iceberg.rest.RESTCatalogProperties; +import org.apache.iceberg.rest.responses.ConfigResponse; +import org.apache.polaris.core.auth.PolarisPrincipal; +import org.apache.polaris.core.config.RealmConfig; +import org.apache.polaris.core.entity.PolarisEntity; +import org.apache.polaris.core.persistence.ResolvedPolarisEntity; +import org.apache.polaris.core.persistence.resolver.Resolver; +import org.apache.polaris.core.persistence.resolver.ResolverFactory; +import org.apache.polaris.core.persistence.resolver.ResolverStatus; +import org.apache.polaris.core.rest.NamespaceUtils; +import org.apache.polaris.service.catalog.CatalogPrefixParser; + +@RequestScoped +public class CatalogConfigHandler { + private static final Set<Endpoint> ICEBERG_REST_ENDPOINTS = Review Comment: Hmm maybe a producer method in a request-scoped bean is not a great design. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
