summaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
Diffstat (limited to 'java')
-rw-r--r--java/examples/datasets/runExample.sh.in2
-rw-r--r--java/examples/datatypes/runExample.sh.in2
-rw-r--r--java/examples/groups/runExample.sh.in2
-rw-r--r--java/examples/intro/runExample.sh.in2
-rw-r--r--java/src/hdf/hdf5lib/H5.java81
-rw-r--r--java/src/jni/h5fImp.c64
-rw-r--r--java/src/jni/h5fImp.h27
-rw-r--r--java/src/jni/h5pImp.c90
-rw-r--r--java/src/jni/h5pImp.h18
-rw-r--r--java/test/JUnit-interface.txt3
-rw-r--r--java/test/TestH5Pfapl.java56
-rw-r--r--java/test/junit.sh.in33
12 files changed, 372 insertions, 8 deletions
diff --git a/java/examples/datasets/runExample.sh.in b/java/examples/datasets/runExample.sh.in
index 83b06ec..440de33 100644
--- a/java/examples/datasets/runExample.sh.in
+++ b/java/examples/datasets/runExample.sh.in
@@ -38,7 +38,7 @@ nerrors=0
# where the libs exist
HDFLIB_HOME="$top_srcdir/java/lib"
-BLDLIBDIR="./lib"
+BLDLIBDIR="$top_builddir/hdf5/lib"
BLDDIR="."
HDFTEST_HOME="$top_srcdir/java/examples/datasets"
JARFILE=jar@PACKAGE_TARNAME@-@PACKAGE_VERSION@.jar
diff --git a/java/examples/datatypes/runExample.sh.in b/java/examples/datatypes/runExample.sh.in
index f80450e..1b02774 100644
--- a/java/examples/datatypes/runExample.sh.in
+++ b/java/examples/datatypes/runExample.sh.in
@@ -35,7 +35,7 @@ nerrors=0
# where the libs exist
HDFLIB_HOME="$top_srcdir/java/lib"
-BLDLIBDIR="./lib"
+BLDLIBDIR="$top_builddir/hdf5/lib"
BLDDIR="."
HDFTEST_HOME="$top_srcdir/java/examples/datatypes"
JARFILE=jar@PACKAGE_TARNAME@-@PACKAGE_VERSION@.jar
diff --git a/java/examples/groups/runExample.sh.in b/java/examples/groups/runExample.sh.in
index 7dddc6d..665b307 100644
--- a/java/examples/groups/runExample.sh.in
+++ b/java/examples/groups/runExample.sh.in
@@ -35,7 +35,7 @@ nerrors=0
# where the libs exist
HDFLIB_HOME="$top_srcdir/java/lib"
-BLDLIBDIR="./lib"
+BLDLIBDIR="$top_builddir/hdf5/lib"
BLDREFDIR="./groups"
BLDDIR="."
HDFTEST_HOME="$top_srcdir/java/examples/groups"
diff --git a/java/examples/intro/runExample.sh.in b/java/examples/intro/runExample.sh.in
index 60ea765..a8e65ff 100644
--- a/java/examples/intro/runExample.sh.in
+++ b/java/examples/intro/runExample.sh.in
@@ -35,7 +35,7 @@ nerrors=0
# where the libs exist
HDFLIB_HOME="$top_srcdir/java/lib"
-BLDLIBDIR="./lib"
+BLDLIBDIR="$top_builddir/hdf5/lib"
BLDDIR="."
HDFTEST_HOME="$top_srcdir/java/examples/intro"
JARFILE=jar@PACKAGE_TARNAME@-@PACKAGE_VERSION@.jar
diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java
index 50faa6d..cd5793d 100644
--- a/java/src/hdf/hdf5lib/H5.java
+++ b/java/src/hdf/hdf5lib/H5.java
@@ -2852,6 +2852,49 @@ public class H5 implements java.io.Serializable {
**/
public synchronized static native void H5Fclear_elink_file_cache(long file_id) throws HDF5LibraryException;
+ /**
+ /**
+ * H5Fstart_mdc_logging starts logging metadata cache events if logging was previously enabled.
+ *
+ * @param file_id
+ * IN: Identifier of the target file.
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ **/
+ public synchronized static native void H5Fstart_mdc_logging(long file_id) throws HDF5LibraryException;
+
+ /**
+ * H5Fstop_mdc_logging stops logging metadata cache events if logging was previously enabled and is currently ongoing.
+ *
+ * @param file_id
+ * IN: Identifier of the target file.
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ **/
+ public synchronized static native void H5Fstop_mdc_logging(long file_id) throws HDF5LibraryException;
+
+ /**
+ * H5Fget_mdc_logging_status gets the current metadata cache logging status.
+ *
+ * @param file_id
+ * IN: Identifier of the target file.
+ *
+ * @param mdc_logging_status, the status
+ * mdc_logging_status[0] = is_enabled, whether logging is enabled
+ * mdc_logging_status[1] = is_currently_logging, whether events are currently being logged
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ * @exception NullPointerException
+ * - mdc_logging_status is null.
+ **/
+ public synchronized static native void H5Fget_mdc_logging_status(long file_id, boolean[] mdc_logging_status)
+ throws HDF5LibraryException, NullPointerException;
+
+
+
// /////// unimplemented ////////
// ssize_t H5Fget_file_image(hid_t file_id, void * buf_ptr, size_t buf_len);
// herr_t H5Fget_metadata_read_retry_info(hid_t file_id, H5F_retry_info_t *info);
@@ -5674,6 +5717,44 @@ public class H5 implements java.io.Serializable {
throws HDF5LibraryException;
/**
+ * H5Pset_mdc_log_options sets metadata cache logging options.
+ *
+ * @param fapl_id
+ * IN: File access property list identifier
+ * @param is_enabled
+ * IN: Whether logging is enabled.
+ * @param location
+ * IN: Location of log in UTF-8/ASCII (file path/name) (On Windows, this must be ASCII).
+ * @param start_on_access
+ * IN: Whether the logging begins as soon as the file is opened or created.
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ * @exception NullPointerException
+ * - location is null.
+ *
+ **/
+ public synchronized static native void H5Pset_mdc_log_options(long fapl_id, boolean is_enabled, String location, boolean start_on_access)
+ throws HDF5LibraryException, NullPointerException;
+
+ /**
+ * H5Pget_mdc_log_options gets metadata cache logging options.
+ *
+ * @param fapl_id
+ * IN: File access property list identifier
+ * @param mdc_log_options, the options
+ * mdc_logging_options[0] = is_enabled, whether logging is enabled
+ * mdc_logging_options[1] = start_on_access, whether the logging begins as soon as the file is opened or created
+ *
+ * @return the location of log in UTF-8/ASCII (file path/name) (On Windows, this must be ASCII).
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ *
+ **/
+ public synchronized static native String H5Pget_mdc_log_options(long fapl_id, boolean[] mdc_log_options)
+ throws HDF5LibraryException;
+
/**
* H5Pget_metadata_read_attempts retrieves the number of read attempts that is set in the file access property list plist_id.
*
diff --git a/java/src/jni/h5fImp.c b/java/src/jni/h5fImp.c
index 5862ae7..d4b3a3c 100644
--- a/java/src/jni/h5fImp.c
+++ b/java/src/jni/h5fImp.c
@@ -536,6 +536,70 @@ Java_hdf_hdf5lib_H5_H5Fclear_1elink_1file_1cache
h5libraryError(env);
} /* end Java_hdf_hdf5lib_H5_H5Fclear_1elink_1file_1cache */
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Fstart_mdc_logging
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Fstart_1mdc_1logging
+ (JNIEnv *env, jclass cls, jlong file_id)
+{
+ if (H5Fstart_mdc_logging((hid_t)file_id) < 0)
+ h5libraryError(env);
+} /* end Java_hdf_hdf5lib_H5_H5Fstart_1mdc_1logging */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Fstop_mdc_logging
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Fstop_1mdc_1logging
+ (JNIEnv *env, jclass cls, jlong file_id)
+{
+ if (H5Fstop_mdc_logging((hid_t)file_id) < 0)
+ h5libraryError(env);
+} /* end Java_hdf_hdf5lib_H5_H5Fstop_1mdc_1logging */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Fget_mdc_logging_status
+ * Signature: (J[Z)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Fget_1mdc_1logging_1status
+ (JNIEnv *env, jclass cls, jlong file_id, jbooleanArray mdc_logging_status)
+{
+ hbool_t is_enabled;
+ hbool_t is_currently_logging;
+ jboolean *mdc_logging_status_ptr;
+ jint size;
+ jboolean isCopy;
+
+ if (mdc_logging_status == NULL) {
+ h5nullArgument(env, "H5Fget_mdc_logging_status: mdc_logging_status is NULL");
+ } /* end if */
+ else {
+ size = (int)ENVPTR->GetArrayLength(ENVPAR mdc_logging_status);
+ if (size < 2) {
+ h5badArgument(env, "H5Fget_mdc_logging_status: length of mdc_logging_status < 2.");
+ } /* end if */
+ else {
+ if (H5Fget_mdc_logging_status((hid_t)file_id, &is_enabled, &is_currently_logging) < 0) {
+ h5libraryError(env);
+ } /* end if */
+ else {
+ mdc_logging_status_ptr = ENVPTR->GetBooleanArrayElements(ENVPAR mdc_logging_status, &isCopy);
+ mdc_logging_status_ptr[0] = (jboolean)is_enabled;
+ mdc_logging_status_ptr[1] = (jboolean)is_currently_logging;
+ ENVPTR->ReleaseBooleanArrayElements(ENVPAR mdc_logging_status, mdc_logging_status_ptr, 0);
+ } /* end else */
+ } /* end else */
+ } /* end else */
+} /* end Java_hdf_hdf5lib_H5_H5Fget_1mdc_1logging_1status */
+
+
#ifdef __cplusplus
} /* end extern "C" */
diff --git a/java/src/jni/h5fImp.h b/java/src/jni/h5fImp.h
index a501b7e..b88e491 100644
--- a/java/src/jni/h5fImp.h
+++ b/java/src/jni/h5fImp.h
@@ -212,6 +212,33 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Fclear_1elink_1file_1cache
(JNIEnv *, jclass, jlong);
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Fstart_mdc_logging
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Fstart_1mdc_1logging
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Fstop_mdc_logging
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Fstop_1mdc_1logging
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Fget_mdc_logging_status
+ * Signature: (J[Z)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Fget_1mdc_1logging_1status
+ (JNIEnv *, jclass, jlong, jbooleanArray);
+
#ifdef __cplusplus
} /* end extern "C" */
#endif /* __cplusplus */
diff --git a/java/src/jni/h5pImp.c b/java/src/jni/h5pImp.c
index 01da210..1368139 100644
--- a/java/src/jni/h5pImp.c
+++ b/java/src/jni/h5pImp.c
@@ -5007,6 +5007,96 @@ H5P_cls_close_cb
return (herr_t)status;
} /* end H5P_cls_close_cb */
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_mdc_log_options
+ * Signature: (JZLjava/lang/String;Z)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1mdc_1log_1options
+ (JNIEnv *env, jclass clss, jlong fapl_id, jboolean is_enabled, jstring location, jboolean start_on_access)
+{
+ herr_t retVal = -1;
+ const char *lstr;
+
+ PIN_JAVA_STRING(location, lstr);
+
+ retVal = H5Pset_mdc_log_options((hid_t)fapl_id, (hbool_t)is_enabled, lstr, (hbool_t)start_on_access);
+
+ UNPIN_JAVA_STRING(location, lstr);
+
+ if (retVal < 0) {
+ h5libraryError(env);
+ }
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1mdc_1log_1options */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_mdc_log_options
+ * Signature: (J[Z)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1mdc_1log_1options
+ (JNIEnv *env, jclass clss, jlong fapl_id, jbooleanArray mdc_log_options)
+{
+ hbool_t is_enabled;
+ hbool_t start_on_access;
+ jboolean *mdc_log_options_ptr;
+ char *lname;
+ size_t location_size;
+ ssize_t status;
+ jstring str = NULL;
+ jint size;
+ jboolean isCopy;
+
+ if (mdc_log_options == NULL) {
+ h5nullArgument(env, "H5Fget_mdc_log_options: mdc_log_options is NULL");
+ } /* end if */
+ else {
+ size = (int)ENVPTR->GetArrayLength(ENVPAR mdc_log_options);
+ if (size < 2) {
+ h5badArgument(env, "H5Fget_mdc_log_options: length of mdc_log_options < 2.");
+ } /* end if */
+ else {
+ /* get the length of the filename */
+ H5Pget_mdc_log_options((hid_t)fapl_id, &is_enabled, NULL, &location_size, &start_on_access);
+ if (location_size < 0) {
+ h5badArgument(env, "H5Pget_mdc_log_options: location_size < 0");
+ }/* end if */
+ else if (location_size > 0) {
+ location_size++; /* add extra space for the null terminator */
+ lname = (char *)HDmalloc(sizeof(char) * location_size);
+ if (lname == NULL) {
+ h5outOfMemory(env, "H5Pget_mdc_log_options: malloc failed");
+ } /* end if */
+ else {
+ status = H5Pget_mdc_log_options((hid_t)fapl_id, &is_enabled, lname, &location_size, &start_on_access);
+
+ if (status < 0) {
+ HDfree(lname);
+ h5libraryError(env);
+ } /* end if */
+ else {
+ str = ENVPTR->NewStringUTF(ENVPAR lname);
+ HDfree(lname);
+ if (str == NULL) {
+ h5JNIFatalError(env, "H5Pget_mdc_log_options: return string not allocated");
+ } /* end if */
+ else {
+ mdc_log_options_ptr = ENVPTR->GetBooleanArrayElements(ENVPAR mdc_log_options, &isCopy);
+ mdc_log_options_ptr[0] = (jboolean)is_enabled;
+ mdc_log_options_ptr[1] = (jboolean)start_on_access;
+ ENVPTR->ReleaseBooleanArrayElements(ENVPAR mdc_log_options, mdc_log_options_ptr, 0);
+ } /* end else */
+ } /* end else */
+ } /* end else */
+ } /* end else if*/
+ } /* end else */
+ } /* end else */
+
+ return (jstring)str;
+} /* end if */
+
static herr_t
H5D_append_cb
(hid_t dataset_id, hsize_t *cur_dims, void *op_data)
diff --git a/java/src/jni/h5pImp.h b/java/src/jni/h5pImp.h
index d606b7a..927501e 100644
--- a/java/src/jni/h5pImp.h
+++ b/java/src/jni/h5pImp.h
@@ -1404,6 +1404,24 @@ Java_hdf_hdf5lib_H5_H5Pset_1file_1space
/*
* Class: hdf_hdf5lib_H5
+ * Method: H5Pset_mdc_log_options
+ * Signature: (JZLjava/lang/String;Z)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1mdc_1log_1options
+(JNIEnv *, jclass, jlong, jboolean, jstring, jboolean);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_mdc_log_options
+ * Signature: (J[Z)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1mdc_1log_1options
+(JNIEnv *, jclass, jlong, jbooleanArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
* Method: H5Pset_append_flush
* Signature: (JI[JLjava/lang/Object;Ljava/lang/Object;)V
*/
diff --git a/java/test/JUnit-interface.txt b/java/test/JUnit-interface.txt
index cbd93e0..05814cd 100644
--- a/java/test/JUnit-interface.txt
+++ b/java/test/JUnit-interface.txt
@@ -496,6 +496,7 @@ JUnit version 4.11
.testH5P_fapl_family
.testH5P_chunk_cache
.testH5P_meta_block_size
+.testH5Fmdc_logging
.testH5Pget_elink_fapl
.testH5Pset_mdc_config
.testH5P_small_data_block_size
@@ -634,7 +635,7 @@ JUnit version 4.11
Time: XXXX
-OK (632 tests)
+OK (633 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/TestH5Pfapl.java b/java/test/TestH5Pfapl.java
index 555afe0..e888e20 100644
--- a/java/test/TestH5Pfapl.java
+++ b/java/test/TestH5Pfapl.java
@@ -16,6 +16,7 @@
package test;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@@ -1322,4 +1323,59 @@ public class TestH5Pfapl {
}
}
}
+
+ @Test
+ public void testH5Fmdc_logging() {
+ boolean[] mdc_logging_status = {false, false};
+ boolean[] mdc_log_options = {false, false};
+
+ try {
+ boolean is_enabled = true;
+ boolean start_on_access = false;
+ H5.H5Pset_mdc_log_options(fapl_id, is_enabled, H5_LOG_FILE, start_on_access);
+
+ String location = H5.H5Pget_mdc_log_options(fapl_id, mdc_log_options);
+ assertTrue("H5.H5Pget_mdc_log_options: is_enabled", mdc_log_options[0]);
+ assertFalse("H5.H5Pget_mdc_log_options: start_on_access_out", mdc_log_options[1]);
+
+ H5.H5Pset_libver_bounds(fapl_id, HDF5Constants.H5F_LIBVER_LATEST, HDF5Constants.H5F_LIBVER_LATEST);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("mdc_log_option: " + err);
+ }
+ _createH5File(fapl_id);
+
+ try {
+ H5.H5Fget_mdc_logging_status(H5fid, mdc_logging_status);
+ }
+ catch (Throwable err) {
+ fail("H5.H5Fget_mdc_logging_status: " + err);
+ }
+ assertTrue("initial: is_enabled", mdc_logging_status[0]);
+ assertFalse("initial: is_currently_logging", mdc_logging_status[1]);
+
+ try {
+ H5.H5Fstart_mdc_logging(H5fid);
+ H5.H5Fget_mdc_logging_status(H5fid, mdc_logging_status);
+ }
+ catch (Throwable err) {
+ fail("start H5.H5Fget_mdc_logging_status: " + err);
+ }
+ assertTrue("start: is_enabled", mdc_logging_status[0]);
+ assertTrue("start: is_currently_logging", mdc_logging_status[1]);
+
+ try {
+ H5.H5Fstop_mdc_logging(H5fid);
+ H5.H5Fget_mdc_logging_status(H5fid, mdc_logging_status);
+ }
+ catch (Throwable err) {
+ fail("stop H5.H5Fget_mdc_logging_status: " + err);
+ }
+// assertFalse("stop: is_enabled", mdc_logging_status[0]);
+ assertFalse("stop: is_currently_logging", mdc_logging_status[1]);
+
+ deleteH5file();
+ _deleteLogFile();
+ }
}
diff --git a/java/test/junit.sh.in b/java/test/junit.sh.in
index 5001c32..a9a71cb 100644
--- a/java/test/junit.sh.in
+++ b/java/test/junit.sh.in
@@ -39,7 +39,7 @@ myos=`uname -s`
# where the libs exist
HDFLIB_HOME="$top_srcdir/java/lib"
-BLDLIBDIR="$top_builddir/java/lib"
+BLDLIBDIR="$top_builddir/hdf5/lib"
BLDDIR="."
HDFTEST_HOME="$top_srcdir/java/test"
JARFILE=jar@PACKAGE_TARNAME@-@PACKAGE_VERSION@.jar
@@ -55,12 +55,14 @@ test -d $BLDLIBDIR || mkdir -p $BLDLIBDIR
# Comment '#' without space can be used.
# --------------------------------------------------------------------
LIST_LIBRARY_FILES="
+$top_builddir/src/.libs/libhdf5.*
+$top_builddir/java/src/jni/.libs/libhdf5_java.*
+"
+LIST_JAR_FILES="
$HDFLIB_HOME/hamcrest-core.jar
$HDFLIB_HOME/junit.jar
$HDFLIB_HOME/slf4j-api-1.7.5.jar
$HDFLIB_HOME/ext/slf4j-simple-1.7.5.jar
-$top_builddir/src/.libs/libhdf5.*
-$top_builddir/java/src/jni/.libs/libhdf5_java.*
$top_builddir/java/src/$JARFILE
"
LIST_DATA_FILES="
@@ -77,6 +79,7 @@ actual_ext="JUnit-interface.ext"
# copy files from source dirs to test dir
#
COPY_LIBFILES="$LIST_LIBRARY_FILES"
+COPY_JARFILES="$LIST_JAR_FILES"
COPY_LIBFILES_TO_BLDLIBDIR()
{
@@ -104,6 +107,30 @@ COPY_LIBFILES_TO_BLDLIBDIR()
fi
fi
done
+ # copy jar files. Used -f to make sure get a new copy
+ for tstfile in $COPY_JARFILES
+ do
+ # ignore '#' comment
+ echo $tstfile | tr -d ' ' | grep '^#' > /dev/null
+ RET=$?
+ if [ $RET -eq 1 ]; then
+ # skip cp if srcdir is same as destdir
+ # this occurs when build/test performed in source dir and
+ # make cp fail
+ SDIR=`$DIRNAME $tstfile`
+ INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
+ INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'`
+ if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
+ $CP -f $tstfile $BLDLIBDIR
+ if [ $? -ne 0 ]; then
+ echo "Error: FAILED to copy $tstfile ."
+
+ # Comment out this to CREATE expected file
+ exit $EXIT_FAILURE
+ fi
+ fi
+ fi
+ done
}
CLEAN_LIBFILES_AND_BLDLIBDIR()