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

Merge branch feature/jorgen.lind/JuliensJavaPatchesRebase with...

Merge branch feature/jorgen.lind/JuliensJavaPatchesRebase with refs/heads/master into refs/merge-requests/417/train
parents 917a1ff9 08613351
Pipeline #45909 passed with stages
in 29 minutes and 50 seconds
......@@ -28,6 +28,7 @@ set(JAVA_SOURCE_FILES
java/src/org/opengroup/openvds/JniPointer.java
java/src/org/opengroup/openvds/JniPointerWithoutDeletion.java
java/src/org/opengroup/openvds/MemoryVdsGenerator.java
java/src/org/opengroup/openvds/MetadataContainer.java
java/src/org/opengroup/openvds/MetadataKey.java
java/src/org/opengroup/openvds/MetadataReadAccess.java
java/src/org/opengroup/openvds/MetadataType.java
......@@ -36,7 +37,9 @@ set(JAVA_SOURCE_FILES
java/src/org/opengroup/openvds/OpenOptions.java
java/src/org/opengroup/openvds/OpenVDS.java
java/src/org/opengroup/openvds/QuantizingValueConverter_FloatToByte.java
java/src/org/opengroup/openvds/VdsError.java
java/src/org/opengroup/openvds/VdsHandle.java
java/src/org/opengroup/openvds/VDSFileOpenOptions.java
java/src/org/opengroup/openvds/VDSProduceStatus.java
java/src/org/opengroup/openvds/VolumeDataAccessManager.java
java/src/org/opengroup/openvds/VolumeDataAccessor.java
......@@ -47,8 +50,15 @@ set(JAVA_SOURCE_FILES
java/src/org/opengroup/openvds/VolumeDataMapping.java
java/src/org/opengroup/openvds/VolumeDataPage.java
java/src/org/opengroup/openvds/VolumeDataPageAccessor.java
java/src/org/opengroup/openvds/VolumeIndexerBase.java
java/src/org/opengroup/openvds/VolumeIndexer2D.java
java/src/org/opengroup/openvds/VolumeIndexer3D.java
java/src/org/opengroup/openvds/VolumeIndexer4D.java
java/src/org/opengroup/openvds/VolumeIndexer5D.java
java/src/org/opengroup/openvds/VolumeIndexer6D.java
java/demo/AWSSliceDumpDemo.java
java/demo/CreateVDS.java
java/demo/OpenVdsDemo.java
#java/experimental/OpenVdsDemoWithArrayIntoBuffers.java
......@@ -86,6 +96,8 @@ set(JAVA_TEST_SOURCES_FILES
java/test/org/opengroup/openvds/MemoryVdsGeneratorTest.java
java/test/org/opengroup/openvds/CreateVDSTest.java
java/test/org/opengroup/openvds/WriteDataTest.java
java/test/org/opengroup/openvds/MetaDataContainerTest.java
java/test/org/opengroup/openvds/PageAccessorTest.java
)
add_jar(openvds-java-test
......@@ -102,16 +114,24 @@ add_library(openvds-javacpp
cpp/src/CommonJni.cpp
cpp/src/JniPointer.cpp
cpp/src/MemoryVdsGenerator.cpp
cpp/src/MetadataContainer.cpp
cpp/src/MetadataReadAccess.cpp
cpp/src/OpenVDSJava.cpp
cpp/src/QuantizingValueConverter_FloatToByte.cpp
cpp/src/VariousJavaTests.cpp
cpp/src/VdsError.cpp
cpp/src/VdsHandle.cpp
cpp/src/VolumeDataAccessManager.cpp
cpp/src/VolumeDataAccessor.cpp
cpp/src/VolumeDataLayout.cpp
cpp/src/VolumeDataPage.cpp
cpp/src/VolumeDataPageAccessor.cpp
cpp/src/VolumeIndexerBase.cpp
cpp/src/VolumeIndexer2D.cpp
cpp/src/VolumeIndexer3D.cpp
cpp/src/VolumeIndexer4D.cpp
cpp/src/VolumeIndexer5D.cpp
cpp/src/VolumeIndexer6D.cpp
cpp/src/WriteVolumeData.cpp
)
......
......@@ -41,6 +41,7 @@ std::vector<char> JArrayToVector( JNIEnv* env, jbyteArray jArr, int start, int l
std::vector<short> JArrayToVector( JNIEnv* env, jshortArray jArr );
std::vector<int> JArrayToVector( JNIEnv* env, jintArray jArr );
std::vector<float> JArrayToVector( JNIEnv* env, jfloatArray jArr );
std::vector<double> JArrayToVector( JNIEnv* env, jdoubleArray jArr );
jbyteArray NewJByteArray( JNIEnv* env, const std::string& str );
jstring NewJString( JNIEnv* env, const char* str );
......
......@@ -117,6 +117,16 @@ std::vector<float> JArrayToVector( JNIEnv* env, jfloatArray jArr ) {
return arr;
}
std::vector<double> JArrayToVector( JNIEnv* env, jdoubleArray jArr ) {
if( !jArr )
return std::vector<double>();
if( sizeof( jdouble ) != sizeof( double ) )
ThrowJavaException( env, "sizeof(jdouble)!=sizeof(double)" );
jsize len = env->GetArrayLength( jArr );
std::vector<double> arr( len );
env->GetDoubleArrayRegion( jArr, 0, len, (jdouble*)arr.data() );
return arr;
}
jstring NewJString( JNIEnv* env, const char* str ) {
if( !str || !*str )
......
/*
* Copyright 2019 The Open Group
* Copyright 2019 INT, Inc.
*
* Licensed 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.
*/
#include <org_opengroup_openvds_MetadataContainer.h>
#include <CommonJni.h>
#include <OpenVDS/MetadataContainer.h>
using namespace OpenVDS;
#ifdef __cplusplus
extern "C" {
#endif
inline MetadataContainer* GetAccess( jlong handle ) {
return (MetadataContainer*)CheckHandle( handle );
}
/*
* Class: org_opengroup_openvds_MetadataContainer
* Method: cpCreateMetadataContainerHandle
* Signature: ()J
*/
JNIEXPORT jlong JNICALL Java_org_opengroup_openvds_MetadataContainer_cpCreateMetadataContainerHandle
(JNIEnv * env, jclass)
{
try {
MetadataContainer* container = new MetadataContainer();
return reinterpret_cast<jlong>(container);
}
CATCH_EXCEPTIONS_FOR_JAVA;
return -1L;
}
/*
* Class: org_opengroup_openvds_MetadataContainer
* Method: cpDeleteHandle
* Signature: (J)J
*/
JNIEXPORT void JNICALL Java_org_opengroup_openvds_MetadataContainer_cpDeleteHandle
(JNIEnv * env, jclass, jlong handle) {
try {
delete GetAccess( handle );
}
CATCH_EXCEPTIONS_FOR_JAVA;
}
/*
* Class: org_opengroup_openvds_MetadataContainer
* Method: cpSetMetadataInt
* Signature: (JLjava/lang/String;Ljava/lang/String;I)V
*/
JNIEXPORT void JNICALL Java_org_opengroup_openvds_MetadataContainer_cpSetMetadataInt
(JNIEnv * env, jclass, jlong handle, jstring category, jstring name, jint value)
{
try {
GetAccess( handle )->SetMetadataInt( JStringToString( env, category ).c_str(), JStringToString( env, name ).c_str(), value);
}
CATCH_EXCEPTIONS_FOR_JAVA;
}
/*
* Class: org_opengroup_openvds_MetadataContainer
* Method: cpSetMetadataIntVector2
* Signature: (JLjava/lang/String;Ljava/lang/String;[I)V
*/
JNIEXPORT void JNICALL Java_org_opengroup_openvds_MetadataContainer_cpSetMetadataIntVector2
(JNIEnv * env, jclass, jlong handle, jstring category, jstring name, jintArray vec2i)
{
try {
std::vector<int> vec = JArrayToVector(env, vec2i);
IntVector2 vdsVec;
vdsVec[0] = vec[0];
vdsVec[1] = vec[1];
GetAccess( handle )->SetMetadataIntVector2( JStringToString( env, category ).c_str(), JStringToString( env, name ).c_str(), vdsVec);
}
CATCH_EXCEPTIONS_FOR_JAVA;
}
/*
* Class: org_opengroup_openvds_MetadataContainer
* Method: cpSetMetadataIntVector3
* Signature: (JLjava/lang/String;Ljava/lang/String;[I)V
*/
JNIEXPORT void JNICALL Java_org_opengroup_openvds_MetadataContainer_cpSetMetadataIntVector3
(JNIEnv * env, jclass, jlong handle, jstring category, jstring name, jintArray vec3i)
{
try {
std::vector<int> vec = JArrayToVector(env, vec3i);
IntVector3 vdsVec;
vdsVec[0] = vec[0];
vdsVec[1] = vec[1];
vdsVec[2] = vec[2];
GetAccess( handle )->SetMetadataIntVector3( JStringToString( env, category ).c_str(), JStringToString( env, name ).c_str(), vdsVec);
}
CATCH_EXCEPTIONS_FOR_JAVA;
}
/*
* Class: org_opengroup_openvds_MetadataContainer
* Method: cpSetMetadataIntVector4
* Signature: (JLjava/lang/String;Ljava/lang/String;[I)V
*/
JNIEXPORT void JNICALL Java_org_opengroup_openvds_MetadataContainer_cpSetMetadataIntVector4
(JNIEnv * env, jclass, jlong handle, jstring category, jstring name, jintArray vec4i)
{
try {
std::vector<int> vec = JArrayToVector(env, vec4i);
IntVector4 vdsVec;
vdsVec[0] = vec[0];
vdsVec[1] = vec[1];
vdsVec[2] = vec[2];
vdsVec[3] = vec[3];
GetAccess( handle )->SetMetadataIntVector4( JStringToString( env, category ).c_str(), JStringToString( env, name ).c_str(), vdsVec);
}
CATCH_EXCEPTIONS_FOR_JAVA;
}
/*
* Class: org_opengroup_openvds_MetadataContainer
* Method: cpSetMetadataFloat
* Signature: (JLjava/lang/String;Ljava/lang/String;F)V
*/
JNIEXPORT void JNICALL Java_org_opengroup_openvds_MetadataContainer_cpSetMetadataFloat
(JNIEnv * env, jclass, jlong handle, jstring category, jstring name, jfloat value)
{
try {
GetAccess( handle )->SetMetadataFloat( JStringToString( env, category ).c_str(), JStringToString( env, name ).c_str(), value);
}
CATCH_EXCEPTIONS_FOR_JAVA;
}
/*
* Class: org_opengroup_openvds_MetadataContainer
* Method: cpSetMetadataFloatVector2
* Signature: (JLjava/lang/String;Ljava/lang/String;[F)V
*/
JNIEXPORT void JNICALL Java_org_opengroup_openvds_MetadataContainer_cpSetMetadataFloatVector2
(JNIEnv * env, jclass, jlong handle, jstring category, jstring name, jfloatArray vec2f)
{
try {
std::vector<float> vec = JArrayToVector(env, vec2f);
FloatVector2 vdsVec;
vdsVec[0] = vec[0];
vdsVec[1] = vec[1];
GetAccess( handle )->SetMetadataFloatVector2( JStringToString( env, category ).c_str(), JStringToString( env, name ).c_str(), vdsVec);
}
CATCH_EXCEPTIONS_FOR_JAVA;
}
/*
* Class: org_opengroup_openvds_MetadataContainer
* Method: cpSetMetadataFloatVector3
* Signature: (JLjava/lang/String;Ljava/lang/String;[F)V
*/
JNIEXPORT void JNICALL Java_org_opengroup_openvds_MetadataContainer_cpSetMetadataFloatVector3
(JNIEnv * env, jclass, jlong handle, jstring category, jstring name, jfloatArray vec3f)
{
try {
std::vector<float> vec = JArrayToVector(env, vec3f);
FloatVector3 vdsVec;
vdsVec[0] = vec[0];
vdsVec[1] = vec[1];
vdsVec[2] = vec[2];
GetAccess( handle )->SetMetadataFloatVector3( JStringToString( env, category ).c_str(), JStringToString( env, name ).c_str(), vdsVec);
}
CATCH_EXCEPTIONS_FOR_JAVA;
}
/*
* Class: org_opengroup_openvds_MetadataContainer
* Method: cpSetMetadataFloatVector4
* Signature: (JLjava/lang/String;Ljava/lang/String;[F)V
*/
JNIEXPORT void JNICALL Java_org_opengroup_openvds_MetadataContainer_cpSetMetadataFloatVector4
(JNIEnv * env, jclass, jlong handle, jstring category, jstring name, jfloatArray vec4f)
{
try {
std::vector<float> vec = JArrayToVector(env, vec4f);
FloatVector4 vdsVec;
vdsVec[0] = vec[0];
vdsVec[1] = vec[1];
vdsVec[2] = vec[2];
vdsVec[3] = vec[3];
GetAccess( handle )->SetMetadataFloatVector4( JStringToString( env, category ).c_str(), JStringToString( env, name ).c_str(), vdsVec);
}
CATCH_EXCEPTIONS_FOR_JAVA;
}
/*
* Class: org_opengroup_openvds_MetadataContainer
* Method: cpSetMetadataDouble
* Signature: (JLjava/lang/String;Ljava/lang/String;D)V
*/
JNIEXPORT void JNICALL Java_org_opengroup_openvds_MetadataContainer_cpSetMetadataDouble
(JNIEnv * env, jclass, jlong handle, jstring category, jstring name, jdouble value)
{
try {
GetAccess( handle )->SetMetadataDouble( JStringToString( env, category ).c_str(), JStringToString( env, name ).c_str(), value);
}
CATCH_EXCEPTIONS_FOR_JAVA;
}
/*
* Class: org_opengroup_openvds_MetadataContainer
* Method: cpSetMetadataDoubleVector2
* Signature: (JLjava/lang/String;Ljava/lang/String;[D)V
*/
JNIEXPORT void JNICALL Java_org_opengroup_openvds_MetadataContainer_cpSetMetadataDoubleVector2
(JNIEnv * env, jclass, jlong handle, jstring category, jstring name, jdoubleArray vec2d)
{
try {
std::vector<double> vec = JArrayToVector(env, vec2d);
DoubleVector2 vdsVec;
vdsVec[0] = vec[0];
vdsVec[1] = vec[1];
GetAccess( handle )->SetMetadataDoubleVector2( JStringToString( env, category ).c_str(), JStringToString( env, name ).c_str(), vdsVec);
}
CATCH_EXCEPTIONS_FOR_JAVA;
}
/*
* Class: org_opengroup_openvds_MetadataContainer
* Method: cpSetMetadataDoubleVector3
* Signature: (JLjava/lang/String;Ljava/lang/String;[D)V
*/
JNIEXPORT void JNICALL Java_org_opengroup_openvds_MetadataContainer_cpSetMetadataDoubleVector3
(JNIEnv * env, jclass, jlong handle, jstring category, jstring name, jdoubleArray vec3d)
{
try {
std::vector<double> vec = JArrayToVector(env, vec3d);
DoubleVector3 vdsVec;
vdsVec[0] = vec[0];
vdsVec[1] = vec[1];
vdsVec[2] = vec[2];
GetAccess( handle )->SetMetadataDoubleVector3( JStringToString( env, category ).c_str(), JStringToString( env, name ).c_str(), vdsVec);
}
CATCH_EXCEPTIONS_FOR_JAVA;
}
/*
* Class: org_opengroup_openvds_MetadataContainer
* Method: cpSetMetadataDoubleVector4
* Signature: (JLjava/lang/String;Ljava/lang/String;[D)V
*/
JNIEXPORT void JNICALL Java_org_opengroup_openvds_MetadataContainer_cpSetMetadataDoubleVector4
(JNIEnv * env, jclass, jlong handle, jstring category, jstring name, jdoubleArray vec4d)
{
try {
std::vector<double> vec = JArrayToVector(env, vec4d);
DoubleVector4 vdsVec;
vdsVec[0] = vec[0];
vdsVec[1] = vec[1];
vdsVec[2] = vec[2];
vdsVec[3] = vec[3];
GetAccess( handle )->SetMetadataDoubleVector4( JStringToString( env, category ).c_str(), JStringToString( env, name ).c_str(), vdsVec);
}
CATCH_EXCEPTIONS_FOR_JAVA;
}
/*
* Class: org_opengroup_openvds_MetadataContainer
* Method: cpSetMetadataString
* Signature: (JLjava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
*/
JNIEXPORT void JNICALL Java_org_opengroup_openvds_MetadataContainer_cpSetMetadataString
(JNIEnv * env, jclass, jlong handle, jstring category, jstring name, jstring value)
{
try {
GetAccess( handle )->SetMetadataString(JStringToString( env, category ).c_str(), JStringToString( env, name ).c_str(), JStringToString(env, value).c_str());
}
CATCH_EXCEPTIONS_FOR_JAVA;
}
#ifdef __cplusplus
}
#endif
......@@ -16,6 +16,7 @@
*/
#include <org_opengroup_openvds_OpenVDS.h>
#include <OpenVDS/MetadataContainer.h>
#include <OpenVDS/OpenVDS.h>
#include <OpenVDS/VolumeDataLayoutDescriptor.h>
#include <OpenVDS/VolumeDataChannelDescriptor.h>
......@@ -86,6 +87,20 @@ jlong JNICALL Java_org_opengroup_openvds_OpenVDS_cpOpenGoogle
return openVDSOrThrowJavaIOException(env, openOptions);
}
/*
* Class: org_opengroup_openvds_OpenVDS
* Method: cpOpenVDSFile
* Signature: (Ljava/lang/String;)J
*/
JNIEXPORT jlong JNICALL Java_org_opengroup_openvds_OpenVDS_cpOpenVDSFile
(JNIEnv *env, jclass, jstring jfilepath) {
OpenVDS::VDSFileOpenOptions openOptions;
openOptions.fileName = JStringToString(env, jfilepath);
return openVDSOrThrowJavaIOException(env, openOptions);
}
/*
* Class: org_opengroup_openvds_OpenVDS
* Method: cpOpenAzurePresigned
......@@ -163,6 +178,22 @@ getMetadata(JNIEnv *env, jobject md)
return reinterpret_cast<OpenVDS::MetadataReadAccess*>(CheckHandle(handle));
}
static OpenVDS::MetadataContainer*
getMetadataContainer(JNIEnv *env, jobject mdc)
{
jclass obj_class = env->GetObjectClass(mdc);
jlong handle = env->CallLongMethod(mdc, env->GetMethodID(obj_class, "handle", "()J"));
return reinterpret_cast<OpenVDS::MetadataContainer*>(CheckHandle(handle));
}
static OpenVDS::Error*
getError(JNIEnv *env, jobject err)
{
jclass obj_class = env->GetObjectClass(err);
jlong handle = env->CallLongMethod(err, env->GetMethodID(obj_class, "handle", "()J"));
return reinterpret_cast<OpenVDS::Error*>(CheckHandle(handle));
}
static std::vector<OpenVDS::VolumeDataAxisDescriptor>
getValueDataAxisDescriptors(JNIEnv *env, jobjectArray obj, std::multiset<std::string>& string_buffer)
{
......@@ -269,12 +300,19 @@ getDescriptor(JNIEnv *env, jobject obj)
int brickSize2DMultiplier = env->CallIntMethod(obj, env->GetMethodID(obj_class, "getBrickSizeMultiplier2D", "()I"));
auto lodLevels = getLODLevels(env, obj);
int fullResolutionDimension = env->CallBooleanMethod(obj, env->GetMethodID(obj_class, "isForceFullResolutionDimension", "()Z"));
int options = (env->CallBooleanMethod(obj, env->GetMethodID(obj_class, "isCreate2DLODs", "()Z")) << 1);
bool forceFullResolutionDimension = env->CallBooleanMethod(obj, env->GetMethodID(obj_class, "isForceFullResolutionDimension", "()Z"));
int fullResDim = env->CallIntMethod(obj, env->GetMethodID(obj_class, "getFullResolutionDimension", "()I"));
bool lod2D = env->CallBooleanMethod(obj, env->GetMethodID(obj_class, "isCreate2DLODs", "()Z"));
int optionsP = OpenVDS::VolumeDataLayoutDescriptor::Options::Options_None;
if (lod2D) {
optionsP |= OpenVDS::VolumeDataLayoutDescriptor::Options::Options_Create2DLODs;
}
if (forceFullResolutionDimension) {
optionsP |= OpenVDS::VolumeDataLayoutDescriptor::Options::Options_ForceFullResolutionDimension;
}
return OpenVDS::VolumeDataLayoutDescriptor(brickSize, negativeMargin, positiveMargin, brickSize2DMultiplier,
lodLevels, (OpenVDS::VolumeDataLayoutDescriptor::Options) options, fullResolutionDimension);
lodLevels, (OpenVDS::VolumeDataLayoutDescriptor::Options) optionsP, fullResDim);
}
jboolean JNICALL
......@@ -321,6 +359,21 @@ Java_org_opengroup_openvds_OpenVDS_cpCreateAzure(JNIEnv *env, jclass, jstring jC
return createVDSOrThrowJavaIOException(env, openOptions, ld, vda, vdc, md, compressionMethod, compressionTolerance);
}
/*
* Class: org_opengroup_openvds_OpenVDS
* Method: cpCreateVDSFile
* Signature: (Ljava/lang/String;Lorg/opengroup/openvds/VolumeDataLayoutDescriptor;[Lorg/opengroup/openvds/VolumeDataAxisDescriptor;[Lorg/opengroup/openvds/VolumeDataChannelDescriptor;Lorg/opengroup/openvds/MetadataReadAccess;)J
*/
JNIEXPORT jlong JNICALL Java_org_opengroup_openvds_OpenVDS_cpCreateVDSFile
(JNIEnv *env, jclass, jstring jVDSFilePath,
jobject ld, jobjectArray vda, jobjectArray vdc, jobject md, jint compressionMethod, jfloat compressionTolerance) {
OpenVDS::VDSFileOpenOptions openOptions;
openOptions.fileName = JStringToString(env, jVDSFilePath);
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,
......@@ -390,3 +443,4 @@ Java_org_opengroup_openvds_OpenVDS_cpCreateConnection(JNIEnv* env, jclass,
return (jlong)pVds;
}
/*
* Copyright 2019 The Open Group
* Copyright 2019 INT, Inc.
*
* Licensed 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.
*/
#include <org_opengroup_openvds_VdsError.h>
#include <CommonJni.h>
#include <OpenVDS/OpenVDS.h>
using namespace OpenVDS;
#ifdef __cplusplus
extern "C" {
#endif
inline Error* GetError( jlong handle ) {
return (Error*)CheckHandle( handle );
}
/*
* Class: org_opengroup_openvds_VdsError
* Method: cpCreateErrorHandle
* Signature: ()J
*/
JNIEXPORT jlong JNICALL Java_org_opengroup_openvds_VdsError_cpCreateErrorHandle
(JNIEnv * env, jclass)
{
try {
Error *error = new Error();
return reinterpret_cast<jlong>(error);
}
CATCH_EXCEPTIONS_FOR_JAVA;
return -1L;
}
/*
* Class: org_opengroup_openvds_VdsError
* Method: cpDeleteHandle
* Signature: (J)V
*/
JNIEXPORT void JNICALL Java_org_opengroup_openvds_VdsError_cpDeleteHandle
(JNIEnv * env, jclass, jlong handle)
{
try {
delete GetError( handle );
}
CATCH_EXCEPTIONS_FOR_JAVA;
}
/*
* Class: org_opengroup_openvds_VdsError
* Method: cpSetErrorCode
* Signature: (JI)V
*/
JNIEXPORT void JNICALL Java_org_opengroup_openvds_VdsError_cpSetErrorCode
(JNIEnv * env, jclass, jlong handle, jint errorCode)
{
try {
GetError( handle )->code = errorCode;
}
CATCH_EXCEPTIONS_FOR_JAVA;
}
/*
* Class: org_opengroup_openvds_VdsError
* Method: cpSetErrorMessage
* Signature: (JLjava/lang/String;)V
*/
JNIEXPORT void JNICALL Java_org_opengroup_openvds_VdsError_cpSetErrorMessage
(JNIEnv * env, jclass, jlong handle, jstring errorMsg)
{
try {
GetError( handle )->string = JStringToString( env, errorMsg ).c_str();
}
CATCH_EXCEPTIONS_FOR_JAVA;
}
/*
* Class: org_opengroup_openvds_VdsError
* Method: cpGetErrorCode
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_org_opengroup_openvds_VdsError_cpGetErrorCode
(JNIEnv * env, jclass, jlong handle)
{
try {
return GetError(handle)->code;
}
CATCH_EXCEPTIONS_FOR_JAVA;
return 0;
}
/*
* Class: org_opengroup_openvds_VdsError
* Method: cpGetErrorMessage
* Signature: (J)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_opengroup_openvds_VdsError_cpGetErrorMessage
(JNIEnv * env, jclass, jlong handle)
{
try {
return NewJString(env, GetError(handle)->string);
}
CATCH_EXCEPTIONS_FOR_JAVA;
return 0;
}