Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
127 changes: 112 additions & 15 deletions paimon-filesystems/paimon-jindo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
<properties>
<fs.oss.sdk.version>3.17.4</fs.oss.sdk.version>
<jindodata.version>6.9.1</jindodata.version>
<oss.plugin.directory>paimon-plugin-jindo-oss</oss.plugin.directory>
</properties>

<repositories>
Expand All @@ -55,6 +56,12 @@
<groupId>org.apache.paimon</groupId>
<artifactId>paimon-oss-impl</artifactId>
<version>${project.version}</version>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand Down Expand Up @@ -160,6 +167,9 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<excludes>
<exclude>org/apache/paimon/jindo/JindoBlobPresigner*.class</exclude>
</excludes>
<archive>
<manifestEntries>
<Multi-Release>true</Multi-Release>
Expand All @@ -168,34 +178,121 @@
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-oss-presigner-implementation</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.outputDirectory}/${oss.plugin.directory}</outputDirectory>
<resources>
<resource>
<directory>${project.build.outputDirectory}</directory>
<includes>
<include>org/apache/paimon/jindo/JindoBlobPresigner*.class</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-oss-runtime</id>
<phase>prepare-package</phase>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<includeScope>runtime</includeScope>
<excludeArtifactIds>paimon-oss-impl,slf4j-api,jsr305</excludeArtifactIds>
<outputDirectory>${project.build.outputDirectory}/${oss.plugin.directory}</outputDirectory>
<excludes>META-INF/*.SF,META-INF/*.DSA,META-INF/*.RSA,META-INF/maven/**</excludes>
</configuration>
</execution>
<execution>
<id>unpack-oss-presigner</id>
<phase>prepare-package</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.apache.paimon</groupId>
<artifactId>paimon-oss-impl</artifactId>
<version>${project.version}</version>
<overWrite>true</overWrite>
<outputDirectory>${project.build.outputDirectory}/${oss.plugin.directory}</outputDirectory>
<includes>org/apache/paimon/oss/OSSBlobPresigner*.class</includes>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<executions>
<execution>
<id>integration-tests</id>
<configuration>
<systemPropertyVariables>
<jindo.plugin.jar>${project.build.directory}/${project.build.finalName}.jar</jindo.plugin.jar>
</systemPropertyVariables>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<configuration>
<artifactSet>
<includes combine.children="append">
<include>org.apache.paimon:paimon-oss-impl</include>
<include>com.aliyun.oss:aliyun-sdk-oss</include>
<include>com.aliyun:*</include>
<include>com.google.code.gson:gson</include>
<include>commons-codec:commons-codec</include>
<include>commons-logging:commons-logging</include>
<include>io.opentracing:*</include>
<include>org.apache.httpcomponents:*</include>
<include>org.codehaus.jettison:jettison</include>
<include>org.ini4j:ini4j</include>
<include>org.jdom:jdom2</include>
<include>stax:stax-api</include>
<include>*:*</include>
</includes>
<excludes>
<exclude>org.slf4j:slf4j-api</exclude>
<exclude>com.google.code.findbugs:jsr305</exclude>
</excludes>
</artifactSet>
<filters>
<filter>
<artifact>org.apache.paimon:paimon-oss-impl</artifact>
<artifact>*:*</artifact>
<includes>
<include>org/apache/paimon/oss/OSSBlobPresigner.class</include>
<include>META-INF/versions/11/**</include>
<include>org/apache/paimon/jindo/**</include>
<include>${oss.plugin.directory}/**</include>
<include>META-INF/MANIFEST.MF</include>
<include>META-INF/LICENSE*</include>
<include>META-INF/licenses/LICENSE.jdom</include>
<include>META-INF/licenses/LICENSE.jaxb</include>
<include>META-INF/NOTICE*</include>
<include>META-INF/DEPENDENCIES</include>
<include>META-INF/maven/**</include>
<include>META-INF/services/org.apache.paimon.fs.FileIOLoader</include>
<include>META-INF/versions/11/javax/xml/bind/**</include>
</includes>
</filter>
<filter>
<artifact>org.apache.paimon:paimon-oss-impl</artifact>
<excludes>
<exclude>META-INF/NOTICE*</exclude>
</excludes>
</filter>
</filters>
</configuration>
</plugin>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/*
* 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.paimon.jindo;

import org.apache.paimon.data.BlobDescriptor;
import org.apache.paimon.fs.Path;
import org.apache.paimon.options.Options;
import org.apache.paimon.oss.OSSBlobPresigner;
import org.apache.paimon.utils.StringUtils;

import com.aliyun.oss.OSSClient;
import com.aliyun.oss.OSSClientBuilder;

import java.io.IOException;
import java.time.Duration;

/** OSS presigning implementation loaded from the private plugin directory. */
public class JindoBlobPresigner implements JindoFileIO.BlobPresigner {

private OSSClient client;

public JindoBlobPresigner() {}

JindoBlobPresigner(OSSClient client) {
this.client = client;
}

@Override
public void configure(Options options) {
client = createBlobClient(options);
}

@Override
public String create(Path tableRoot, BlobDescriptor descriptor, Duration validity)
throws IOException {
return OSSBlobPresigner.create(client, tableRoot, descriptor, validity);
}

@Override
public void close() {
client.shutdown();
}

static OSSClient createBlobClient(Options options) {
String endpoint = options.get("fs.oss.endpoint");
if (!endpoint.contains("://")) {
endpoint = "https://" + endpoint;
}
String securityToken = options.get("fs.oss.securityToken");
OSSClientBuilder builder = new OSSClientBuilder();
OSSClient client =
(OSSClient)
(StringUtils.isNullOrWhitespaceOnly(securityToken)
? builder.build(
endpoint,
options.get("fs.oss.accessKeyId"),
options.get("fs.oss.accessKeySecret"))
: builder.build(
endpoint,
options.get("fs.oss.accessKeyId"),
options.get("fs.oss.accessKeySecret"),
securityToken));
String region = options.get("fs.oss.region");
if (!StringUtils.isNullOrWhitespaceOnly(region)) {
client.setRegion(region);
}
return client;
}
}
Loading
Loading