lianghuan-xatu commented on code in PR #5542: URL: https://github.com/apache/seatunnel/pull/5542#discussion_r1370765470
########## seatunnel-engine/seatunnel-engine-client/src/main/java/org/apache/seatunnel/engine/client/job/ConnectorPackageClient.java: ########## @@ -0,0 +1,149 @@ +/* + * 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.engine.client.job; + +import org.apache.seatunnel.engine.client.SeaTunnelHazelcastClient; +import org.apache.seatunnel.engine.common.utils.MDUtil; +import org.apache.seatunnel.engine.core.job.ConnectorJar; +import org.apache.seatunnel.engine.core.job.ConnectorJarIdentifier; +import org.apache.seatunnel.engine.core.job.ConnectorJarType; +import org.apache.seatunnel.engine.core.protocol.codec.SeaTunnelUploadConnectorJarCodec; + +import com.hazelcast.logging.ILogger; +import com.hazelcast.logging.Logger; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.security.MessageDigest; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import static org.apache.seatunnel.shade.com.google.common.base.Preconditions.checkNotNull; + +public class ConnectorPackageClient { + + private static final ILogger LOGGER = Logger.getLogger(ConnectorPackageClient.class); + + private final SeaTunnelHazelcastClient hazelcastClient; + + public ConnectorPackageClient(SeaTunnelHazelcastClient hazelcastClient) { + checkNotNull(hazelcastClient); + this.hazelcastClient = hazelcastClient; + } + + public Set<ConnectorJarIdentifier> uploadCommonPluginJars( + long jobId, List<URL> commonPluginJars) { + Set<ConnectorJarIdentifier> connectorJarIdentifiers = new HashSet<>(); + // Upload commonPluginJar + for (URL commonPluginJar : commonPluginJars) { + // handle the local file path + // origin path : /${SEATUNNEL_HOME}/plugins/Jdbc/lib/mysql-connector-java-5.1.32.jar -> + // handled path : ${SEATUNNEL_HOME}/plugins/Jdbc/lib/mysql-connector-java-5.1.32.jar + Path path = Paths.get(commonPluginJar.getPath().substring(1)); + // Obtain the directory name of the relative location of the file path. + // for example, The path is + // ${SEATUNNEL_HOME}/plugins/Jdbc/lib/mysql-connector-java-5.1.32.jar, so the name + // obtained here is the connector plugin name : JDBC Review Comment: I'm very sorry, I don't quite understand your previous description. I have made modifications to this part of the code. Could you please help me see if this logic is right? If not, I will make the necessary modifications. -- 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]
