ruanwenjun commented on code in PR #1783:
URL: 
https://github.com/apache/incubator-seatunnel/pull/1783#discussion_r863574088


##########
seatunnel-core/seatunnel-core-flink-sql/src/main/java/org/apache/seatunnel/core/sql/FlinkSqlStarter.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.seatunnel.core.sql;
+
+import org.apache.seatunnel.common.config.Common;
+import org.apache.seatunnel.core.base.Starter;
+import org.apache.seatunnel.core.flink.args.FlinkCommandArgs;
+import org.apache.seatunnel.core.flink.config.FlinkJobStarter;
+import org.apache.seatunnel.core.flink.utils.CommandLineUtils;
+
+import java.util.List;
+
+public class FlinkSqlStarter implements Starter {
+
+    private static final String APP_JAR_NAME = "seatunnel-core-flink-sql.jar";
+    private static final String CLASS_NAME = SeatunnelSql.class.getName();
+
+
+    private final FlinkCommandArgs flinkCommandArgs;
+    /**
+     * SeaTunnel flink sql job jar.
+     */
+    private final String appJar;
+
+    public FlinkSqlStarter(String[] args) {

Review Comment:
   Public is not needed here? If you want to use this class in UT, default is 
ok enough.
   ```suggestion
       FlinkSqlStarter(String[] args) {
   ```



##########
seatunnel-core/seatunnel-core-flink/src/main/java/org/apache/seatunnel/core/flink/utils/CommandLineUtils.java:
##########
@@ -35,4 +42,44 @@ public static FlinkCommandArgs parseFlinkArgs(String[] args) 
{
             .parse(args);
         return flinkCommandArgs;
     }
+
+    public static FlinkCommandArgs parseCommandArgs(String[] args, 
FlinkJobStarter starter) {

Review Comment:
   You should directly enhance the method in line 37, now you can remove the 
method in line 37.



##########
seatunnel-core/seatunnel-core-flink/src/main/java/org/apache/seatunnel/core/flink/config/FlinkJobStarter.java:
##########
@@ -0,0 +1,34 @@
+/*
+ * 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.core.flink.config;
+
+public enum FlinkJobStarter {

Review Comment:
   How about rename to FlinkJobType.



##########
seatunnel-core/seatunnel-core-flink-sql/src/main/java/org/apache/seatunnel/core/sql/FlinkSqlStarter.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.seatunnel.core.sql;
+
+import org.apache.seatunnel.common.config.Common;
+import org.apache.seatunnel.core.base.Starter;
+import org.apache.seatunnel.core.flink.args.FlinkCommandArgs;
+import org.apache.seatunnel.core.flink.config.FlinkJobStarter;
+import org.apache.seatunnel.core.flink.utils.CommandLineUtils;
+
+import java.util.List;
+
+public class FlinkSqlStarter implements Starter {
+
+    private static final String APP_JAR_NAME = "seatunnel-core-flink-sql.jar";
+    private static final String CLASS_NAME = SeatunnelSql.class.getName();
+
+

Review Comment:
   Remove the extra empty line.



##########
seatunnel-core/seatunnel-core-flink-sql/src/main/java/org/apache/seatunnel/core/sql/FlinkSqlStarter.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.seatunnel.core.sql;
+
+import org.apache.seatunnel.common.config.Common;
+import org.apache.seatunnel.core.base.Starter;
+import org.apache.seatunnel.core.flink.args.FlinkCommandArgs;
+import org.apache.seatunnel.core.flink.config.FlinkJobStarter;
+import org.apache.seatunnel.core.flink.utils.CommandLineUtils;
+
+import java.util.List;
+
+public class FlinkSqlStarter implements Starter {
+
+    private static final String APP_JAR_NAME = "seatunnel-core-flink-sql.jar";
+    private static final String CLASS_NAME = SeatunnelSql.class.getName();
+
+
+    private final FlinkCommandArgs flinkCommandArgs;
+    /**
+     * SeaTunnel flink sql job jar.
+     */
+    private final String appJar;
+
+    public FlinkSqlStarter(String[] args) {
+        this.flinkCommandArgs = CommandLineUtils.parseCommandArgs(args, 
FlinkJobStarter.SQL);
+        // set the deployment mode, used to get the job jar path.
+        Common.setDeployMode(flinkCommandArgs.getDeployMode().getName());
+        this.appJar = Common.appLibDir().resolve(APP_JAR_NAME).toString();
+    }
+
+    @Override
+    public List<String> buildCommands() {
+        return CommandLineUtils.buildFlinkCommand(flinkCommandArgs, 
CLASS_NAME, appJar);
+    }
+
+    @SuppressWarnings("checkstyle:RegexpSingleline")

Review Comment:
   ```suggestion
   ```
   Maybe this suppress is not needed here?



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