TyrantLucifer commented on code in PR #4016:
URL: 
https://github.com/apache/incubator-seatunnel/pull/4016#discussion_r1091870212


##########
seatunnel-api/src/main/java/org/apache/seatunnel/api/configuration/ConfigAdapterSpi.java:
##########
@@ -0,0 +1,44 @@
+/*
+ * 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.seatunnel.api.configuration;
+
+import java.nio.file.Path;
+import java.util.Map;
+
+/**
+ * Adapter mode to support convert other config to HOCON.
+ */
+public interface ConfigAdapterSpi {

Review Comment:
   ```suggestion
   public interface ConfigAdapter {
   ```



##########
seatunnel-api/src/main/java/org/apache/seatunnel/api/configuration/ConfigAdapterSpi.java:
##########
@@ -0,0 +1,44 @@
+/*
+ * 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.seatunnel.api.configuration;
+
+import java.nio.file.Path;
+import java.util.Map;
+
+/**
+ * Adapter mode to support convert other config to HOCON.
+ */
+public interface ConfigAdapterSpi {
+
+    /**
+     * Use the converter adapter with a file extension.
+     *
+     * @param fileExtension config file extension
+     * @return enable use this SPI
+     */
+    boolean checkFileExtension(String fileExtension);

Review Comment:
   ```suggestion
       String extensionIdentifier();
   ```
   Use the identifier to verify this spi is nor not support extension is 
better. What do you think about it?



##########
seatunnel-core/seatunnel-core-starter/src/main/java/org/apache/seatunnel/core/starter/utils/ConfigBuilder.java:
##########
@@ -47,12 +51,15 @@ public static Config of(@NonNull String filePath) {
 
     public static Config of(@NonNull Path filePath) {
         log.info("Loading config file from path: {}", filePath);
-        Config config = ConfigFactory
-                .parseFile(filePath.toFile())
-                
.resolve(ConfigResolveOptions.defaults().setAllowUnresolved(true))
-                .resolveWith(ConfigFactory.systemProperties(),
-                        
ConfigResolveOptions.defaults().setAllowUnresolved(true));
+        Optional<ConfigAdapterSpi> adapterSpiSupplier = 
ConfigAdapterUtils.selectAdapter(filePath);

Review Comment:
   It is better to use line breaks to distinguish between chained calls.



-- 
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]

Reply via email to