From 555091d37a9a44fb7c35479ddecfee358a559e90 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 10 Jun 2010 06:13:06 +0200 Subject: Adding DynamicLibraryBundle utility to bundle Tool and JNI native library loading and lookup Add JNILibLoaderBase.loadLibrary(String libname, boolean ignoreError); DynamicLibraryBundle provides Tool and JNI native library loading and lookup New classes: com.jogamp.common.os.DynamicLibraryBundle com.jogamp.common.os.DynamicLibraryBundleInfo com.jogamp.common.util.MiscUtils.java Change: DEBUG/VERBOSE properties 'gluegen' -> 'jogamp' --- .../com/jogamp/common/jvm/JNILibLoaderBase.java | 89 +++++++++++++--------- 1 file changed, 53 insertions(+), 36 deletions(-) (limited to 'src/java/com/jogamp/common/jvm') diff --git a/src/java/com/jogamp/common/jvm/JNILibLoaderBase.java b/src/java/com/jogamp/common/jvm/JNILibLoaderBase.java index be5b1de..8d26bf4 100644 --- a/src/java/com/jogamp/common/jvm/JNILibLoaderBase.java +++ b/src/java/com/jogamp/common/jvm/JNILibLoaderBase.java @@ -45,7 +45,6 @@ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.security.AccessController; import java.security.AccessControlContext; -import java.security.PrivilegedAction; import java.util.HashSet; import com.jogamp.common.impl.Debug; @@ -55,43 +54,56 @@ public class JNILibLoaderBase { public interface LoaderAction { /** - * Loads the library specified by libname. Optionally preloads the libraries specified by - * preload. The implementation should ignore, if the preload-libraries have already been - * loaded. + * Loads the library specified by libname.
+ * The implementation should ignore, if the library has been loaded already.
+ * @param libname the library to load + * @param ignoreError if true, errors during loading the library should be ignored + * @return true if library loaded successful + */ + boolean loadLibrary(String libname, boolean ignoreError); + + /** + * Loads the library specified by libname.
+ * Optionally preloads the libraries specified by preload.
+ * The implementation should ignore, if any library has been loaded already.
* @param libname the library to load * @param preload the libraries to load before loading the main library if not null - * @param preloadIgnoreError true, if errors during loading the preload-libraries should be ignored + * @param preloadIgnoreError if true, errors during loading the preload-libraries should be ignored */ - void loadLibrary(String libname, String[] preload, - boolean preloadIgnoreError); + void loadLibrary(String libname, String[] preload, boolean preloadIgnoreError); } private static class DefaultAction implements LoaderAction { - public void loadLibrary(String libname, String[] preload, boolean preloadIgnoreError) { - if (null!=preload) { - for (int i=0; i