adutra commented on code in PR #1482:
URL: https://github.com/apache/polaris/pull/1482#discussion_r2069380735


##########
polaris-core/src/main/java/org/apache/polaris/core/config/RelationalJdbcConfiguration.java:
##########
@@ -0,0 +1,35 @@
+/*
+ * 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.core.config;
+
+import io.smallrye.config.ConfigMapping;
+import java.util.Map;
+import java.util.Optional;
+
+@ConfigMapping(prefix = "polaris.relation.jdbc.datasource")

Review Comment:
   I would rather remove the annotation here and create a sub-interface in a 
Quarkus module with the annotation.



##########
quarkus/service/src/main/java/org/apache/polaris/service/quarkus/config/QuarkusProducers.java:
##########
@@ -258,6 +265,13 @@ public ActiveRolesProvider activeRolesProvider(
     return 
activeRolesProviders.select(Identifier.Literal.of(persistenceType)).get();
   }
 
+  @Produces
+  public DatasourceSupplier datasourceSupplier(
+      @Any RelationalJdbcConfiguration relationalJdbcConfiguration,
+      @All List<InstanceHandle<DataSource>> datasources) {
+    return new QuarkusDatasourceSupplier(relationalJdbcConfiguration, 
datasources);

Review Comment:
   This is just doing a regular bean construction injection, so it's likely 
possible to get rid of this and inject into `QuarkusDatasourceSupplier` 
directly.



##########
polaris-core/src/main/java/org/apache/polaris/core/config/RelationalJdbcConfiguration.java:
##########
@@ -0,0 +1,35 @@
+/*
+ * 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.core.config;
+
+import io.smallrye.config.ConfigMapping;
+import java.util.Map;
+import java.util.Optional;
+
+@ConfigMapping(prefix = "polaris.relation.jdbc.datasource")

Review Comment:
   Hmm in fact, this interface is only used in Quarkus modules, so I'd suggest 
moving it to `quarkus-commons`.



##########
quarkus/commons/build.gradle.kts:
##########
@@ -0,0 +1,42 @@
+/*
+ * 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.
+ */
+
+plugins {
+  alias(libs.plugins.jandex)

Review Comment:
   I feel we are missing   
   
   ```
   alias(libs.plugins.quarkus)
   id("polaris-quarkus")
   ```
   
   But indeed adding those doesn't work. Let's investigate later.



##########
quarkus/commons/build.gradle.kts:
##########
@@ -0,0 +1,42 @@
+/*
+ * 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.
+ */
+
+plugins {
+  alias(libs.plugins.jandex)
+  id("java-test-fixtures")
+}
+
+configurations.all {
+  exclude(group = "org.antlr", module = "antlr4-runtime")
+  exclude(group = "org.scala-lang", module = "scala-library")
+  exclude(group = "org.scala-lang", module = "scala-reflect")
+}
+
+java {
+  sourceCompatibility = JavaVersion.VERSION_21
+  targetCompatibility = JavaVersion.VERSION_21
+}
+
+dependencies {
+  implementation(project(":polaris-core"))
+  implementation(enforcedPlatform(libs.quarkus.bom))
+  implementation(enforcedPlatform(libs.quarkus.bom))

Review Comment:
   ```suggestion
     implementation(enforcedPlatform(libs.quarkus.bom))
   ```



##########
gradle/projects.main.properties:
##########
@@ -30,6 +30,7 @@ polaris-quarkus-service=quarkus/service
 polaris-quarkus-server=quarkus/server
 polaris-quarkus-spark-tests=quarkus/spark-tests
 polaris-quarkus-admin=quarkus/admin
+polaris-quarkus-commons=quarkus/commons

Review Comment:
   nit: we already have `service/common` ("common" in the singular), any reason 
to have `quarkus/commons` ("commons" in the plural)?



##########
quarkus/admin/src/main/java/org/apache/polaris/admintool/config/QuarkusProducers.java:
##########
@@ -76,4 +83,11 @@ public PolarisConfigurationStore configurationStore() {
     // A configuration store is not required when running the admin tool.
     return new PolarisConfigurationStore() {};
   }
+
+  @Produces
+  public DatasourceSupplier datasourceSupplier(
+      @Any RelationalJdbcConfiguration relationalJdbcConfiguration,
+      @All List<InstanceHandle<DataSource>> datasources) {
+    return new QuarkusDatasourceSupplier(relationalJdbcConfiguration, 
datasources);

Review Comment:
   You are missing `@All` I guess:
   
   ```java
   @Inject 
   public QuarkusDatasourceSupplier(
     RelationalJdbcConfiguration relationalJdbcConfiguration, 
     @All List<InstanceHandle<DataSource>> dataSources) { 
   ```
   



##########
quarkus/commons/build.gradle.kts:
##########
@@ -0,0 +1,42 @@
+/*
+ * 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.
+ */
+
+plugins {
+  alias(libs.plugins.jandex)
+  id("java-test-fixtures")
+}
+
+configurations.all {

Review Comment:
   This is really surprising, but indeed we need this. There is some serious 
Gradle snafu going on.



##########
polaris-core/src/main/java/org/apache/polaris/core/config/RelationalJdbcConfiguration.java:
##########
@@ -0,0 +1,35 @@
+/*
+ * 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.core.config;
+
+import io.smallrye.config.ConfigMapping;
+import java.util.Map;
+import java.util.Optional;
+
+@ConfigMapping(prefix = "polaris.relation.jdbc.datasource")
+public interface RelationalJdbcConfiguration {
+  /** realmId to configured Datasource name mapping. */
+  Map<String, String> realm();

Review Comment:
   ```suggestion
     Map<String, String> realms();
   ```
   
   Also, you probably need to annotate this with `@WithParentName` and maybe 
`@WithUnnamedKey`, depending on how you want to handle the "default" Jdbc 
configuration.



-- 
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: issues-unsubscr...@polaris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to