summaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorM. Scot Breitenfeld <brtnfld@hdfgroup.org>2018-01-05 15:57:48 (GMT)
committerM. Scot Breitenfeld <brtnfld@hdfgroup.org>2018-01-05 15:57:48 (GMT)
commit8712f3e231a93b6b68822be8ffb2e4fdbf12565f (patch)
treead87ef377e55d4136ffc1610059313974cb14af9 /java
parent3b02f2d03f5c349e341a776af488dfa033902f0a (diff)
parent994611a2d4320358dc5a1c0c721633670ad4833c (diff)
downloadhdf5-8712f3e231a93b6b68822be8ffb2e4fdbf12565f.zip
hdf5-8712f3e231a93b6b68822be8ffb2e4fdbf12565f.tar.gz
hdf5-8712f3e231a93b6b68822be8ffb2e4fdbf12565f.tar.bz2
synced with develop
Diffstat (limited to 'java')
-rw-r--r--java/src/hdf/hdf5lib/H5.java62
-rw-r--r--java/src/jni/h5pImp.c67
-rw-r--r--java/src/jni/h5pImp.h18
-rw-r--r--java/test/JUnit-interface.txt5
-rw-r--r--java/test/TestH5Pvirtual.java33
5 files changed, 184 insertions, 1 deletions
diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java
index 17be736..732cdfc 100644
--- a/java/src/hdf/hdf5lib/H5.java
+++ b/java/src/hdf/hdf5lib/H5.java
@@ -6097,6 +6097,36 @@ public class H5 implements java.io.Serializable {
**/
public synchronized static native String H5Pget_virtual_dsetname(long dcpl_id, long index) throws HDF5LibraryException, IllegalArgumentException;
+// ///// unimplemented /////
+// /**
+// * H5Pget_vds_file_cache_size retrieves the size of the vds link open file cache.
+// *
+// * @param fapl_id
+// * IN: File access property list identifier
+// *
+// * @return VDS link open file cache size in number of files.
+// *
+// * @exception HDF5LibraryException
+// * - Error from the HDF-5 Library.
+// *
+// **/
+// public synchronized static native int H5Pget_vds_file_cache_size(long fapl_id) throws HDF5LibraryException;
+//
+// /**
+// * H5Pset_vds_file_cache_size sets the number of files that can be held open in an vds link open file cache.
+// *
+// * @param fapl_id
+// * IN: File access property list identifier
+// * @param efc_size
+// * IN: VDS link open file cache size in number of files.
+// *
+// * @exception HDF5LibraryException
+// * - Error from the HDF-5 Library.
+// *
+// **/
+// public synchronized static native void H5Pset_vds_file_cache_size(long fapl_id, int efc_size)
+// throws HDF5LibraryException;
+
/**
* H5Pget_external returns information about an external file.
*
@@ -6450,6 +6480,38 @@ public class H5 implements java.io.Serializable {
public synchronized static native long H5Pget_virtual_printf_gap(long dapl_id) throws HDF5LibraryException;
/**
+ * H5Pget_virtual_prefix Retrieves prefix applied to virtual file paths.
+ *
+ * @param dapl_id
+ * IN: Link access property list identifier
+ *
+ * @return the prefix to be applied to virtual file paths.
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ *
+ **/
+ public synchronized static native String H5Pget_virtual_prefix(long dapl_id)
+ throws HDF5LibraryException;
+
+ /**
+ * H5Pset_virtual_prefix Sets prefix to be applied to virtual file paths.
+ *
+ * @param dapl_id
+ * IN: Dataset access property list identifier
+ * @param prefix
+ * IN: Prefix to be applied to virtual file paths
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ * @exception NullPointerException
+ * - prefix is null.
+ *
+ **/
+ public synchronized static native void H5Pset_virtual_prefix(long dapl_id, String prefix)
+ throws HDF5LibraryException, NullPointerException;
+
+ /**
* H5Pget_efile_prefix Retrieves prefix applied to external file paths.
*
* @param dapl_id
diff --git a/java/src/jni/h5pImp.c b/java/src/jni/h5pImp.c
index 2b73266..cf27341 100644
--- a/java/src/jni/h5pImp.c
+++ b/java/src/jni/h5pImp.c
@@ -5733,6 +5733,73 @@ Java_hdf_hdf5lib_H5_H5Pset_1metadata_1read_1attempts
} /* end else */
} /* end Java_hdf_hdf5lib_H5_H5Pset_1metadata_1read_1attempts */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_virtual_prefix
+ * Signature: (JLjava/lang/String;)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1virtual_1prefix
+ (JNIEnv *env, jclass clss, jlong dapl_id, jstring prefix)
+{
+ herr_t retVal = -1;
+ const char *aName;
+
+ PIN_JAVA_STRING(prefix, aName);
+ if (aName != NULL) {
+ retVal = H5Pset_virtual_prefix((hid_t)dapl_id, aName);
+
+ UNPIN_JAVA_STRING(prefix, aName);
+
+ if(retVal < 0)
+ h5libraryError(env);
+ }
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1virtual_1prefix */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_virtual_prefix
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1virtual_1prefix
+ (JNIEnv *env, jclass clss, jlong dapl_id)
+{
+ size_t size = 0;
+ char *pre;
+ jlong prefix_size = -1;
+ jstring str = NULL;
+
+ prefix_size = (jlong)H5Pget_virtual_prefix((hid_t)dapl_id, (char*)NULL, size);
+ if(prefix_size < 0) {
+ h5libraryError(env);
+ } /* end if */
+ else {
+ size = (size_t)prefix_size + 1;/* add extra space for the null terminator */
+ pre = (char*)HDmalloc(sizeof(char)*size);
+ if (pre == NULL) {
+ h5outOfMemory(env, "H5Pget_virtual_prefix: malloc failed ");
+ } /* end if */
+ else {
+ prefix_size = (jlong)H5Pget_virtual_prefix((hid_t)dapl_id, (char*)pre, size);
+
+ if (prefix_size >= 0) {
+ str = ENVPTR->NewStringUTF(ENVPAR pre);
+ HDfree(pre);
+ if (str == NULL)
+ h5JNIFatalError( env, "H5Pget_virtual_prefix: return string not allocated");
+ } /* end if */
+ else {
+ HDfree(pre);
+ h5libraryError(env);
+ } /* end else */
+ } /* end else */
+ } /* end else */
+
+ return (jstring)str;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1virtual_1prefix */
+
/*
* Class: hdf_hdf5lib_H5
* Method: H5Pset_efile_prefix
diff --git a/java/src/jni/h5pImp.h b/java/src/jni/h5pImp.h
index f5dba6b..1d12e3d 100644
--- a/java/src/jni/h5pImp.h
+++ b/java/src/jni/h5pImp.h
@@ -1544,6 +1544,24 @@ Java_hdf_hdf5lib_H5_H5Pset_1metadata_1read_1attempts
/*
* Class: hdf_hdf5lib_H5
+ * Method: H5Pset_virtual_prefix
+ * Signature: (JLjava/lang/String;)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1virtual_1prefix
+(JNIEnv *, jclass, jlong, jstring);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_virtual_prefix
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1virtual_1prefix
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
* Method: H5Pset_efile_prefix
* Signature: (JLjava/lang/String;)V
*/
diff --git a/java/test/JUnit-interface.txt b/java/test/JUnit-interface.txt
index 6d2754f..91ea286 100644
--- a/java/test/JUnit-interface.txt
+++ b/java/test/JUnit-interface.txt
@@ -534,11 +534,14 @@ JUnit version 4.11
.testH5Pget_source_datasetname
.testH5Pvirtual_storage
.testH5Pget_selection_source_dataset
+.testH5Pget_virtual_prefix
.testH5Pget_source_filename
.testH5Pset_get_virtual_printf_gap
.testH5Pget_virtual_count
+.testH5Pset_virtual_prefix
.testH5Pset_get_virtual_view
.testH5Pget_mapping_parameters
+.testH5Pset_virtual_prefix_null
.testH5P_genprop_basic_class
.testH5P_genprop_class_iter
.testH5P_genprop_basic_class_prop
@@ -644,7 +647,7 @@ JUnit version 4.11
Time: XXXX
-OK (642 tests)
+OK (645 tests)
HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
#000: (file name) line (number) in H5Fopen(): can't set access and transfer property lists
diff --git a/java/test/TestH5Pvirtual.java b/java/test/TestH5Pvirtual.java
index 40cfbac..ff2e4dc 100644
--- a/java/test/TestH5Pvirtual.java
+++ b/java/test/TestH5Pvirtual.java
@@ -429,4 +429,37 @@ public class TestH5Pvirtual {
try {H5.H5Dclose(H5did);} catch (Exception ex) {}
}
}
+
+ @Test
+ public void testH5Pset_virtual_prefix() {
+ String prefix = "tmp";
+ try {
+ H5.H5Pset_virtual_prefix(H5dapl_id, prefix);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5Pset_virtual_prefix: " + err);
+ }
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void testH5Pset_virtual_prefix_null() throws Throwable{
+ H5.H5Pset_virtual_prefix(H5dapl_id, null);
+ }
+
+ @Test
+ public void testH5Pget_virtual_prefix() {
+ String prefix = "tmp";
+ String pre = "";
+
+ try {
+ H5.H5Pset_virtual_prefix(H5dapl_id, prefix);
+ pre = H5.H5Pget_virtual_prefix(H5dapl_id);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5Pget_virtual_prefix: " + err);
+ }
+ assertTrue("The prefix: ", prefix.equals(pre));
+ }
}