Commit 385c57d4 authored by Julien Lacoste's avatar Julien Lacoste Committed by Jørgen Lind
Browse files

Java Bindings / AWSOpenOptions

parent 17c1da90
Pipeline #71352 passed with stages
in 37 minutes and 43 seconds
......@@ -47,17 +47,30 @@ jlong openVDSOrThrowJavaIOException(JNIEnv *env, const OpenVDS::OpenOptions &ope
/*
* Class: org_opengroup_openvds_OpenVDS
* Method: cpOpenAWS
* Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)J
* Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;IIZ)J
*/
jlong JNICALL Java_org_opengroup_openvds_OpenVDS_cpOpenAWS
(JNIEnv *env, jclass, jstring jbucket, jstring jkey, jstring jregion, jstring jEndPointOverride)
JNIEXPORT jlong JNICALL Java_org_opengroup_openvds_OpenVDS_cpOpenAWS
(JNIEnv * env, jclass,
jstring jBucket, jstring jKey, jstring jRegion, jstring jEndpointOverride,
jstring jAccessKeyID, jstring jSecretKeyID,
jstring jSessionToken, jstring jExpiration, jstring jLogFilenamePrefix, jstring jLogLevel,
jint jConnectionTimeOutMs, jint jRequestTimeOutMs, jboolean jDisableInitAPI)
{
OpenVDS::AWSOpenOptions openOptions;
openOptions.key = JStringToString(env, jkey);
openOptions.bucket = JStringToString(env, jbucket);
openOptions.region = JStringToString(env, jregion);
openOptions.endpointOverride = JStringToString(env, jEndPointOverride);
openOptions.key = JStringToString(env, jKey);
openOptions.bucket = JStringToString(env, jBucket);
openOptions.region = JStringToString(env, jRegion);
openOptions.endpointOverride = JStringToString(env, jEndpointOverride);
openOptions.accessKeyId = JStringToString(env, jAccessKeyID);
openOptions.secretKey = JStringToString(env, jSecretKeyID);
openOptions.sessionToken = JStringToString(env, jSessionToken);
openOptions.expiration = JStringToString(env, jExpiration);
openOptions.logFilenamePrefix = JStringToString(env, jLogFilenamePrefix);
openOptions.loglevel = JStringToString(env, jLogLevel);
openOptions.connectionTimeoutMs = jConnectionTimeOutMs;
openOptions.requestTimeoutMs = jRequestTimeOutMs;
openOptions.disableInitApi = jDisableInitAPI;
return openVDSOrThrowJavaIOException(env, openOptions);
}
......@@ -382,23 +395,35 @@ JNIEXPORT jlong JNICALL Java_org_opengroup_openvds_OpenVDS_cpCreateVDSFile
return createVDSOrThrowJavaIOException(env, openOptions, ld, vda, vdc, md, compressionMethod, compressionTolerance);
}
jlong JNICALL
Java_org_opengroup_openvds_OpenVDS_cpCreateAws(JNIEnv *env, jclass,
jstring jbucket, jstring jkey, jstring jregion, jstring jendpointoverhide, jstring jaccessKeyId, jstring jsecretKey, jstring jsessionToken, jstring jexpiration,
jobject ld, jobjectArray vda, jobjectArray vdc, jobject md, jint compressionMethod, jfloat compressionTolerance)
/*
* Class: org_opengroup_openvds_OpenVDS
* Method: cpCreateAws
* Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;IIZLorg/opengroup/openvds/VolumeDataLayoutDescriptor;[Lorg/opengroup/openvds/VolumeDataAxisDescriptor;[Lorg/opengroup/openvds/VolumeDataChannelDescriptor;Lorg/opengroup/openvds/MetadataReadAccess;IF)J
*/
JNIEXPORT jlong JNICALL Java_org_opengroup_openvds_OpenVDS_cpCreateAws
(JNIEnv * env, jclass,
jstring jBucket, jstring jKey, jstring jRegion, jstring jEndpointOverride,
jstring jAccessKeyId, jstring jSecretKey, jstring jSessionToken, jstring jExpiration,
jstring jLogFilenamePrefix, jstring jLogLevel, jint jConnectionTimeOutMs, jint jRequestTimeOutMs, jboolean jDisableInitAPI,
jobject ld, jobjectArray vda, jobjectArray vdc, jobject md, jint compressionMethod, jfloat compressionTolerance)
{
OpenVDS::AWSOpenOptions openOptions;
OpenVDS::AWSOpenOptions openOptions;
openOptions.bucket = JStringToString(env, jbucket);
openOptions.key = JStringToString(env, jkey);
openOptions.region = JStringToString(env, jregion);
openOptions.endpointOverride = JStringToString(env, jendpointoverhide);
openOptions.accessKeyId = JStringToString(env, jaccessKeyId);
openOptions.secretKey = JStringToString(env, jsecretKey);
openOptions.sessionToken = JStringToString(env, jsessionToken);
openOptions.expiration = JStringToString(env, jexpiration);
openOptions.bucket = JStringToString(env, jBucket);
openOptions.key = JStringToString(env, jKey);
openOptions.region = JStringToString(env, jRegion);
openOptions.endpointOverride = JStringToString(env, jEndpointOverride);
openOptions.accessKeyId = JStringToString(env, jAccessKeyId);
openOptions.secretKey = JStringToString(env, jSecretKey);
openOptions.sessionToken = JStringToString(env, jSessionToken);
openOptions.expiration = JStringToString(env, jExpiration);
openOptions.logFilenamePrefix = JStringToString(env, jLogFilenamePrefix);
openOptions.loglevel = JStringToString(env, jLogLevel);
openOptions.connectionTimeoutMs = jConnectionTimeOutMs;
openOptions.requestTimeoutMs = jRequestTimeOutMs;
openOptions.disableInitApi = jDisableInitAPI;
return createVDSOrThrowJavaIOException(env, openOptions, ld, vda, vdc, md, compressionMethod, compressionTolerance);
return createVDSOrThrowJavaIOException(env, openOptions, ld, vda, vdc, md, compressionMethod, compressionTolerance);
}
jlong JNICALL
......
......@@ -23,7 +23,19 @@ package org.opengroup.openvds;
*/
public class AWSOpenOptions extends OpenOptions {
public String bucket, key, region, endpointoverhide, accessKeyId, secretKey, sessionToken, expiration;
public String bucket;
public String key;
public String region;
public String endPointOverride;
public String accessKeyId;
public String secretKey;
public String sessionToken;
public String expiration;
public String logFilenamePrefix;
public String logLevel;
public int connectionTimeoutMs = 3000;
public int requestTimeoutMs = 6000;
public boolean disableInitApi = false;
/**
* Default constructor.
......@@ -45,7 +57,7 @@ public class AWSOpenOptions extends OpenOptions {
bucket = pBucket;
key = pKey;
region = pRegion;
endpointoverhide = pEndpointOverride;
endPointOverride = pEndpointOverride;
}
/**
......@@ -59,3 +71,4 @@ public class AWSOpenOptions extends OpenOptions {
this(pBucket, pKey, pRegion, null);
}
}
......@@ -18,10 +18,11 @@
package org.opengroup.openvds;
import java.io.IOException;
import java.util.List;
public class OpenVDS extends VdsHandle {
private static native long cpOpenAWS(String bucket, String key, String region, String endpointoverhide) throws IOException;
private static native long cpOpenAWS(String bucket, String key, String region, String endPointOverride, String accessKeyId, String secretKey,
String sessionToken, String expiration,
String logFilenamePrefix, String loglevel, int connectionTimeoutMs, int requestTimeoutMs, boolean disableInitApi) throws IOException;
private static native long cpOpenAzure(String pConnectionString, String pContainer, String pBlob,
int pParallelismFactor, int pMaxExecutionTime) throws IOException;
......@@ -50,7 +51,8 @@ public class OpenVDS extends VdsHandle {
VolumeDataLayoutDescriptor ld, VolumeDataAxisDescriptor[] vda,
VolumeDataChannelDescriptor[] vdc, MetadataReadAccess md, int compressionMethod, float compressionTolerance) throws IOException;
private static native long cpCreateAws(String bucket, String key, String region, String endpointoverhide, String accessKeyId, String secretKey, String sessionToken, String expiration,
private static native long cpCreateAws(String bucket, String key, String region, String endPointOverride, String accessKeyId, String secretKey, String sessionToken, String expiration,
String logFilenamePrefix, String loglevel, int connectionTimeoutMs, int requestTimeoutMs, boolean disableInitApi,
VolumeDataLayoutDescriptor ld, VolumeDataAxisDescriptor[] vda,
VolumeDataChannelDescriptor[] vdc, MetadataReadAccess md, int compressionMethod, float compressionTolerance) throws IOException;
......@@ -79,7 +81,8 @@ public class OpenVDS extends VdsHandle {
public static OpenVDS open(AWSOpenOptions o) throws IOException {
if (o == null) throw new IllegalArgumentException("open option can't be null");
return new OpenVDS(cpOpenAWS(o.bucket, o.key, o.region, o.endpointoverhide), true);
return new OpenVDS(cpOpenAWS(o.bucket, o.key, o.region, o.endPointOverride, o.accessKeyId, o.secretKey, o.sessionToken, o.expiration,
o.logFilenamePrefix, o.logLevel, o.connectionTimeoutMs, o.requestTimeoutMs, o.disableInitApi), true);
}
public static OpenVDS open(AzureOpenOptions o) throws IOException {
......@@ -101,7 +104,7 @@ public class OpenVDS extends VdsHandle {
if (o == null) throw new IllegalArgumentException("open option can't be null");
return new OpenVDS(cpOpenVDSFile(o.filePath), true);
}
private static void validateCreateArguments(VolumeDataLayoutDescriptor ld,
VolumeDataAxisDescriptor[] vda, VolumeDataChannelDescriptor[] vdc,
MetadataReadAccess md) throws IllegalArgumentException {
......@@ -176,7 +179,8 @@ public class OpenVDS extends VdsHandle {
MetadataReadAccess md) throws IOException {
validateCreateArguments(o, ld, vda, vdc, md);
return new OpenVDS(cpCreateAws(o.bucket, o.key, o.region, o.endpointoverhide, o.accessKeyId, o.secretKey, o.sessionToken, o.expiration,
return new OpenVDS(cpCreateAws(o.bucket, o.key, o.region, o.endPointOverride, o.accessKeyId, o.secretKey, o.sessionToken, o.expiration,
o.logFilenamePrefix, o.logLevel, o.connectionTimeoutMs, o.requestTimeoutMs, o.disableInitApi,
ld, vda, vdc, md, 0, 0), true);
}
......@@ -185,8 +189,9 @@ public class OpenVDS extends VdsHandle {
MetadataReadAccess md, CompressionMethod compressionMethod, float compressionTolerance) throws IOException {
validateCreateArguments(o, ld, vda, vdc, md);
return new OpenVDS(cpCreateAws(o.bucket, o.key, o.region, o.endpointoverhide, o.accessKeyId, o.secretKey, o.sessionToken, o.expiration,
ld, vda, vdc, md, compressionMethod.ordinal(), compressionTolerance), true);
return new OpenVDS(cpCreateAws(o.bucket, o.key, o.region, o.endPointOverride, o.accessKeyId, o.secretKey, o.sessionToken, o.expiration,
o.logFilenamePrefix, o.logLevel, o.connectionTimeoutMs, o.requestTimeoutMs, o.disableInitApi,
ld, vda, vdc, md, compressionMethod.ordinal(), compressionTolerance), true);
}
public static OpenVDS create(GoogleOpenOptions o, VolumeDataLayoutDescriptor ld,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment