dimas-b commented on code in PR #3960: URL: https://github.com/apache/polaris/pull/3960#discussion_r2931851029
########## persistence/relational-jdbc/src/main/java/org/apache/polaris/persistence/relational/jdbc/DefaultDataSourceResolver.java: ########## @@ -0,0 +1,57 @@ +/* + * 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.quarkus.common.config.jdbc; + +import io.quarkus.arc.DefaultBean; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.enterprise.inject.Instance; +import jakarta.inject.Inject; +import javax.sql.DataSource; +import org.apache.polaris.core.context.RealmContext; +import org.apache.polaris.persistence.relational.jdbc.DataSourceResolver; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Default implementation of {@link DataSourceResolver} that routes all realms and store types to a + * single default {@link DataSource}. This implementation acts as a fallback; downstream users can + * provide their own {@link DataSourceResolver} bean to implement custom routing logic. + */ +@ApplicationScoped +@DefaultBean +public class DefaultDataSourceResolver implements DataSourceResolver { Review Comment: Only "general principles" kind of reason :slightly_smiling_face: I tend to think it valuable to isolate runtime / CDI concerns from the basic code / logic of a particular component like JDBC persistence. In that regard, ideally, `polaris-relational-jdbc` could be reused in any runtime env. (Quarkus or something else). `polaris-relational-jdbc-runtime` would have the code specific to the way Polaris uses Quarkus. I believe the NoSQL Persistence impl and the OPA Authorizer follow similar principles (perhaps varying in degree, but similar in essence). I also proposed a similar refactoring for the Admin tool in #3947. I do not really know whether this matters for downstream Polaris users right now :thinking: :shrug: In my personal experience, I find that it is much easier to include another module into a build than struggle with excluding intruding dependencies :sweat_smile: I know some concerns were raised about module proliferation in Polaris, but from my POV, Gradle is able to deal with a large number of modules very well, so I personally do not see it as an issue. -- 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]
