Commit bf965fbf authored by Jørgen Lind's avatar Jørgen Lind
Browse files

Merge branch feature/camille.perin/javaFixes with refs/heads/master into...

Merge branch feature/camille.perin/javaFixes with refs/heads/master into refs/merge-requests/134/train
parents a11c93a0 b3ae8f6e
Pipeline #1565 passed with stages
in 2 minutes and 57 seconds
......@@ -18,5 +18,6 @@ python/tools/WrapperReport.txt
/**/.ipynb_checkpoints
/python/openvds.egg-info
.idea
*.iml
java/cpp/generated
cmake-build*
......@@ -41,12 +41,13 @@ jlong openVDSOrThrowJavaIOException(JNIEnv *env, const OpenVDS::OpenOptions &ope
* Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)J
*/
jlong JNICALL Java_org_opengroup_openvds_OpenVDS_cpOpenAWS
(JNIEnv *env, jclass, jstring jbucket, jstring jkey, jstring jregion) {
(JNIEnv *env, jclass, jstring jbucket, jstring jkey, jstring jregion, jstring jEndPointOverride) {
OpenVDS::AWSOpenOptions openOptions;
openOptions.key = JStringToString(env, jkey);
openOptions.bucket = JStringToString(env, jbucket);
openOptions.region = JStringToString(env, jregion);
openOptions.endpointOverride = JStringToString(env, jEndPointOverride);
return openVDSOrThrowJavaIOException(env, openOptions);
}
......
......@@ -144,25 +144,25 @@ extern "C" {
jclass cls = env->FindClass( "Lorg/opengroup/openvds/VolumeDataChannelDescriptor;" );
jobject result = env->NewObject( cls, env->GetMethodID( cls, "<init>", "()V" ) );
env->SetIntField( result, env->GetFieldID( cls, "m_format", "I" ), descr.GetFormat() );
env->SetIntField( result, env->GetFieldID( cls, "m_components", "I" ), descr.GetComponents() );
env->SetObjectField( result, env->GetFieldID( cls, "m_name", StringClassId ), NewJString( env, descr.GetName() ) );
env->SetObjectField( result, env->GetFieldID( cls, "m_unit", StringClassId ), NewJString( env, descr.GetUnit() ) );
env->SetFloatField( result, env->GetFieldID( cls, "m_valueRangeMin", "F" ), descr.GetValueRangeMin() );
env->SetFloatField( result, env->GetFieldID( cls, "m_valueRangeMax", "F" ), descr.GetValueRangeMax() );
env->SetLongField( result, env->GetFieldID( cls, "m_mapping", "J" ), (jlong)descr.GetMapping() );
env->SetIntField( result, env->GetFieldID( cls, "m_mappedValueCount", "I" ), descr.GetMappedValueCount() );
env->SetIntField( result, env->GetFieldID( cls, "format", "I" ), descr.GetFormat() );
env->SetIntField( result, env->GetFieldID( cls, "components", "I" ), descr.GetComponents() );
env->SetObjectField( result, env->GetFieldID( cls, "name", StringClassId ), NewJString( env, descr.GetName() ) );
env->SetObjectField( result, env->GetFieldID( cls, "unit", StringClassId ), NewJString( env, descr.GetUnit() ) );
env->SetFloatField( result, env->GetFieldID( cls, "valueRangeMin", "F" ), descr.GetValueRangeMin() );
env->SetFloatField( result, env->GetFieldID( cls, "valueRangeMax", "F" ), descr.GetValueRangeMax() );
env->SetLongField( result, env->GetFieldID( cls, "mapping", "J" ), (jlong)descr.GetMapping() );
env->SetIntField( result, env->GetFieldID( cls, "mappedValueCount", "I" ), descr.GetMappedValueCount() );
// bits of m_flags
env->SetBooleanField( result, env->GetFieldID( cls, "m_isDiscrete", "Z" ), descr.IsDiscrete() );
env->SetBooleanField( result, env->GetFieldID( cls, "m_isRenderable", "Z" ), descr.IsRenderable() );
env->SetBooleanField( result, env->GetFieldID( cls, "m_isAllowLossyCompression", "Z" ), descr.IsAllowLossyCompression() );
env->SetBooleanField( result, env->GetFieldID( cls, "m_isUseZipForLosslessCompression", "Z" ), descr.IsUseZipForLosslessCompression() );
env->SetBooleanField( result, env->GetFieldID( cls, "isDiscrete", "Z" ), descr.IsDiscrete() );
env->SetBooleanField( result, env->GetFieldID( cls, "isRenderable", "Z" ), descr.IsRenderable() );
env->SetBooleanField( result, env->GetFieldID( cls, "isAllowLossyCompression", "Z" ), descr.IsAllowLossyCompression() );
env->SetBooleanField( result, env->GetFieldID( cls, "isUseZipForLosslessCompression", "Z" ), descr.IsUseZipForLosslessCompression() );
env->SetBooleanField( result, env->GetFieldID( cls, "m_useNoValue", "Z" ), descr.IsUseNoValue() );
env->SetFloatField( result, env->GetFieldID( cls, "m_noValue", "F" ), descr.GetNoValue() );
env->SetFloatField( result, env->GetFieldID( cls, "m_integerScale", "F" ), descr.GetIntegerScale() );
env->SetFloatField( result, env->GetFieldID( cls, "m_integerOffset", "F" ), descr.GetIntegerOffset() );
env->SetBooleanField( result, env->GetFieldID( cls, "useNoValue", "Z" ), descr.IsUseNoValue() );
env->SetFloatField( result, env->GetFieldID( cls, "noValue", "F" ), descr.GetNoValue() );
env->SetFloatField( result, env->GetFieldID( cls, "integerScale", "F" ), descr.GetIntegerScale() );
env->SetFloatField( result, env->GetFieldID( cls, "integerOffset", "F" ), descr.GetIntegerOffset() );
return result;
}
......@@ -183,11 +183,11 @@ extern "C" {
jclass cls = env->FindClass( "Lorg/opengroup/openvds/VolumeDataAxisDescriptor;" );
jobject result = env->NewObject( cls, env->GetMethodID( cls, "<init>", "()V" ) );
env->SetIntField( result, env->GetFieldID( cls, "m_numSamples", "I" ), descr.GetNumSamples() );
env->SetObjectField( result, env->GetFieldID( cls, "m_name", StringClassId ), NewJString( env, descr.GetName() ) );
env->SetObjectField( result, env->GetFieldID( cls, "m_unit", StringClassId ), NewJString( env, descr.GetUnit() ) );
env->SetFloatField( result, env->GetFieldID( cls, "m_coordinateMin", "F" ), descr.GetCoordinateMin() );
env->SetFloatField( result, env->GetFieldID( cls, "m_coordinateMax", "F" ), descr.GetCoordinateMax() );
env->SetIntField( result, env->GetFieldID( cls, "numSamples", "I" ), descr.GetNumSamples() );
env->SetObjectField( result, env->GetFieldID( cls, "name", StringClassId ), NewJString( env, descr.GetName() ) );
env->SetObjectField( result, env->GetFieldID( cls, "unit", StringClassId ), NewJString( env, descr.GetUnit() ) );
env->SetFloatField( result, env->GetFieldID( cls, "coordinateMin", "F" ), descr.GetCoordinateMin() );
env->SetFloatField( result, env->GetFieldID( cls, "coordinateMax", "F" ), descr.GetCoordinateMax() );
return result;
}
......
......@@ -20,7 +20,6 @@ import org.opengroup.openvds.*;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.awt.image.Raster;
import java.io.File;
import java.io.FileOutputStream;
import java.nio.FloatBuffer;
......@@ -274,31 +273,31 @@ public class AWSSliceDumpDemo {
static void printChannelDescriptor(String title, VolumeDataChannelDescriptor descr) {
System.out.println("\nVolumeDataChannelDescriptor " + title);
System.out.println("m_format = " + descr.m_format);
System.out.println("m_components = " + descr.m_components);
System.out.println("m_name = " + descr.m_name);
System.out.println("m_unit = " + descr.m_unit);
System.out.println("m_valueRangeMin = " + descr.m_valueRangeMin);
System.out.println("m_valueRangeMax = " + descr.m_valueRangeMax);
System.out.println("m_mapping = " + descr.m_mapping);
System.out.println("m_mappedValueCount = " + descr.m_mappedValueCount);
System.out.println("m_isDiscrete = " + descr.m_isDiscrete);
System.out.println("m_isRenderable = " + descr.m_isRenderable);
System.out.println("m_isAllowLossyCompression = " + descr.m_isAllowLossyCompression);
System.out.println("m_isUseZipForLosslessCompression = " + descr.m_isUseZipForLosslessCompression);
System.out.println("m_useNoValue = " + descr.m_useNoValue);
System.out.println("m_noValue = " + descr.m_noValue);
System.out.println("m_integerScale = " + descr.m_integerScale);
System.out.println("m_integerOffset = " + descr.m_integerOffset);
System.out.println("m_format = " + descr.getFormat());
System.out.println("m_components = " + descr.getComponents());
System.out.println("m_name = " + descr.getName());
System.out.println("m_unit = " + descr.getUnit());
System.out.println("m_valueRangeMin = " + descr.getValueRangeMin());
System.out.println("m_valueRangeMax = " + descr.getValueRangeMax());
System.out.println("m_mapping = " + descr.getMapping());
System.out.println("m_mappedValueCount = " + descr.getMappedValueCount());
System.out.println("m_isDiscrete = " + descr.isDiscrete());
System.out.println("m_isRenderable = " + descr.isRenderable());
System.out.println("m_isAllowLossyCompression = " + descr.isAllowLossyCompression());
System.out.println("m_isUseZipForLosslessCompression = " + descr.isUseZipForLosslessCompression());
System.out.println("m_useNoValue = " + descr.isUseNoValue());
System.out.println("m_noValue = " + descr.getNoValue());
System.out.println("m_integerScale = " + descr.getIntegerScale());
System.out.println("m_integerOffset = " + descr.getIntegerOffset());
}
static void printAxisDescriptor(String title, VolumeDataAxisDescriptor descr) {
System.out.println("\nVolumeDataAxisDescriptor " + title);
System.out.println("m_numSamples = " + descr.m_numSamples);
System.out.println("m_name = " + descr.m_name);
System.out.println("m_unit = " + descr.m_unit);
System.out.println("m_coordinateMin = " + descr.m_coordinateMin);
System.out.println("m_coordinateMax = " + descr.m_coordinateMax);
System.out.println("m_numSamples = " + descr.getNumSamples());
System.out.println("m_name = " + descr.getName());
System.out.println("m_unit = " + descr.getUnit());
System.out.println("m_coordinateMin = " + descr.getCoordinateMin());
System.out.println("m_coordinateMax = " + descr.getCoordinateMax());
}
private static double interpolate(double a, double b, double ratio) {
......
......@@ -257,31 +257,31 @@ public class OpenVdsDemo {
static void printChannelDescriptor(String title, VolumeDataChannelDescriptor descr) {
System.out.println("\nVolumeDataChannelDescriptor " + title);
System.out.println("m_format = " + descr.m_format);
System.out.println("m_components = " + descr.m_components);
System.out.println("m_name = " + descr.m_name);
System.out.println("m_unit = " + descr.m_unit);
System.out.println("m_valueRangeMin = " + descr.m_valueRangeMin);
System.out.println("m_valueRangeMax = " + descr.m_valueRangeMax);
System.out.println("m_mapping = " + descr.m_mapping);
System.out.println("m_mappedValueCount = " + descr.m_mappedValueCount);
System.out.println("m_isDiscrete = " + descr.m_isDiscrete);
System.out.println("m_isRenderable = " + descr.m_isRenderable);
System.out.println("m_isAllowLossyCompression = " + descr.m_isAllowLossyCompression);
System.out.println("m_isUseZipForLosslessCompression = " + descr.m_isUseZipForLosslessCompression);
System.out.println("m_useNoValue = " + descr.m_useNoValue);
System.out.println("m_noValue = " + descr.m_noValue);
System.out.println("m_integerScale = " + descr.m_integerScale);
System.out.println("m_integerOffset = " + descr.m_integerOffset);
System.out.println("m_format = " + descr.getFormat());
System.out.println("m_components = " + descr.getComponents());
System.out.println("m_name = " + descr.getName());
System.out.println("m_unit = " + descr.getUnit());
System.out.println("m_valueRangeMin = " + descr.getValueRangeMin());
System.out.println("m_valueRangeMax = " + descr.getValueRangeMax());
System.out.println("m_mapping = " + descr.getMapping());
System.out.println("m_mappedValueCount = " + descr.getMappedValueCount());
System.out.println("m_isDiscrete = " + descr.isDiscrete());
System.out.println("m_isRenderable = " + descr.isRenderable());
System.out.println("m_isAllowLossyCompression = " + descr.isAllowLossyCompression());
System.out.println("m_isUseZipForLosslessCompression = " + descr.isUseZipForLosslessCompression());
System.out.println("m_useNoValue = " + descr.isUseNoValue());
System.out.println("m_noValue = " + descr.getNoValue());
System.out.println("m_integerScale = " + descr.getIntegerScale());
System.out.println("m_integerOffset = " + descr.getIntegerOffset());
}
static void printAxisDescriptor(String title, VolumeDataAxisDescriptor descr) {
System.out.println("\nVolumeDataAxisDescriptor " + title);
System.out.println("m_numSamples = " + descr.m_numSamples);
System.out.println("m_name = " + descr.m_name);
System.out.println("m_unit = " + descr.m_unit);
System.out.println("m_coordinateMin = " + descr.m_coordinateMin);
System.out.println("m_coordinateMax = " + descr.m_coordinateMax);
System.out.println("m_numSamples = " + descr.getNumSamples());
System.out.println("m_name = " + descr.getName());
System.out.println("m_unit = " + descr.getUnit());
System.out.println("m_coordinateMin = " + descr.getCoordinateMin());
System.out.println("m_coordinateMax = " + descr.getCoordinateMax());
}
static void writeBitmap(String fileName, VolumeDataLayout layout,
......
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/demo" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/experimental" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="org.testng:testng:6.14.3" level="project" />
</component>
</module>
\ No newline at end of file
......@@ -23,7 +23,7 @@ package org.opengroup.openvds;
*/
public class AWSOpenOptions extends OpenOptions {
public String bucket, key, region;
public String bucket, key, region, endpointoverhide;
/**
* Default constructor.
......@@ -35,14 +35,27 @@ public class AWSOpenOptions extends OpenOptions {
/**
* Constructor.
*
* @param pBucket the bucket of the VDS
* @param pKey the key prefix of the VDS
* @param pRegion the region of the bucket of the VDS
* @param pBucket the bucket of the VDS
* @param pKey the key prefix of the VDS
* @param pRegion the region of the bucket of the VDS
* @param pEndpointOverride This parameter allows to override the endpoint url
*/
public AWSOpenOptions(String pBucket, String pKey, String pRegion) {
public AWSOpenOptions(String pBucket, String pKey, String pRegion, String pEndpointOverride) {
super(ConnectionType.AWS);
bucket = pBucket;
key = pKey;
region = pRegion;
endpointoverhide = pEndpointOverride;
}
/**
* Constructor.
*
* @param pBucket the bucket of the VDS
* @param pKey the key prefix of the VDS
* @param pRegion the region of the bucket of the VDS
*/
public AWSOpenOptions(String pBucket, String pKey, String pRegion) {
this(pBucket, pKey, pRegion, null);
}
}
......@@ -20,7 +20,7 @@ package org.opengroup.openvds;
import java.io.IOException;
public class OpenVDS extends VdsHandle{
private static native long cpOpenAWS(String bucket, String key, String region) throws IOException;
private static native long cpOpenAWS(String bucket, String key, String region, String endpointoverhide) throws IOException;
private static native long cpOpenAzure(String pConnectionString, String pContainer, String pBlob,
int pParallelismFactor, int pMaxExecutionTime) throws IOException;
......@@ -33,7 +33,7 @@ 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), true);
return new OpenVDS(cpOpenAWS(o.bucket, o.key, o.region, o.endpointoverhide), true);
}
public static OpenVDS open(AzureOpenOptions o) throws IOException {
......
......@@ -22,10 +22,29 @@ package org.opengroup.openvds;
*/
public class VolumeDataAxisDescriptor {
public int m_numSamples;
public String m_name;
public String m_unit;
public float m_coordinateMin;
public float m_coordinateMax;
private int numSamples;
private String name;
private String unit;
private float coordinateMin;
private float coordinateMax;
public int getNumSamples() {
return numSamples;
}
public String getName() {
return name;
}
public String getUnit() {
return unit;
}
public float getCoordinateMin() {
return coordinateMin;
}
public float getCoordinateMax() {
return coordinateMax;
}
}
......@@ -106,87 +106,87 @@ public class VolumeDataChannelDescriptor {
}
}
public int m_format;
public int m_components;
public String m_name;
public String m_unit;
public float m_valueRangeMin;
public float m_valueRangeMax;
public long m_mapping;
public int m_mappedValueCount;
private int format;
private int components;
private String name;
private String unit;
private float valueRangeMin;
private float valueRangeMax;
private long mapping;
private int mappedValueCount;
// bits of m_flags
public boolean m_isDiscrete;
public boolean m_isRenderable;
public boolean m_isAllowLossyCompression;
public boolean m_isUseZipForLosslessCompression;
private boolean isDiscrete;
private boolean isRenderable;
private boolean isAllowLossyCompression;
private boolean isUseZipForLosslessCompression;
public boolean m_useNoValue;
public float m_noValue;
public float m_integerScale;
public float m_integerOffset;
private boolean useNoValue;
private float noValue;
private float integerScale;
private float integerOffset;
public int getFormat() {
return m_format;
return format;
}
public int getComponents() {
return m_components;
return components;
}
public String getName() {
return m_name;
return name;
}
public String getUnit() {
return m_unit;
return unit;
}
public float getValueRangeMin() {
return m_valueRangeMin;
return valueRangeMin;
}
public float getValueRangeMax() {
return m_valueRangeMax;
return valueRangeMax;
}
public long getMapping() {
return m_mapping;
return mapping;
}
public int getMappedValueCount() {
return m_mappedValueCount;
return mappedValueCount;
}
public boolean isDiscrete() {
return m_isDiscrete;
return isDiscrete;
}
public boolean isRenderable() {
return m_isRenderable;
return isRenderable;
}
public boolean isAllowLossyCompression() {
return m_isAllowLossyCompression;
return isAllowLossyCompression;
}
public boolean isUseZipForLosslessCompression() {
return m_isUseZipForLosslessCompression;
return isUseZipForLosslessCompression;
}
public boolean isUseNoValue() {
return m_useNoValue;
return useNoValue;
}
public float getNoValue() {
return m_noValue;
return noValue;
}
public float getIntegerScale() {
return m_integerScale;
return integerScale;
}
public float getIntegerOffset() {
return m_integerOffset;
return integerOffset;
}
}
......@@ -21,10 +21,8 @@ import org.testng.annotations.Test;
import java.io.IOException;
import java.nio.FloatBuffer;
import java.text.NumberFormat;
import java.util.stream.IntStream;
import static org.opengroup.openvds.VolumeDataChannelDescriptor.Format.FORMAT_R32;
import static org.testng.Assert.*;
public class AmazonS3Test {
......
......@@ -25,13 +25,15 @@ import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import java.util.LinkedList;
import java.util.Random;
import java.util.concurrent.*;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.stream.IntStream;
import static org.opengroup.openvds.Dimensionality.DIMENSIONALITY_MAX;
import static org.opengroup.openvds.VolumeDataChannelDescriptor.Format.*;
import static org.opengroup.openvds.VolumeDataLayoutDescriptor.BrickSize.BRICK_SIZE_32;
import static org.opengroup.openvds.VolumeDataLayoutDescriptor.LODLevels.LOD_LEVELS_1;
import static org.opengroup.openvds.VolumeDataLayoutDescriptor.LODLevels.LOD_LEVELS_NONE;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
......
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