From 791a2749886f02ec7b8db25bf8862e8269b96da5 Mon Sep 17 00:00:00 2001
From: Harvey Harrison
* 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
+ * @param ignoreError if true, errors during loading the library should be ignored
* @param cl optional ClassLoader, used to locate the library
* @return true if library loaded successful
*/
@@ -81,12 +81,12 @@ public class JNILibLoaderBase {
* 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 if true, errors during loading the preload-libraries should be ignored
+ * @param preloadIgnoreError if true, errors during loading the preload-libraries should be ignored
* @param cl optional ClassLoader, used to locate the library
*/
void loadLibrary(String libname, String[] preload, boolean preloadIgnoreError, ClassLoader cl);
}
-
+
private static class DefaultAction implements LoaderAction {
public boolean loadLibrary(String libname, boolean ignoreError, ClassLoader cl) {
boolean res = true;
@@ -143,13 +143,13 @@ public class JNILibLoaderBase {
public static void enableLoading() {
setLoadingAction(new DefaultAction());
}
-
+
public static synchronized void setLoadingAction(LoaderAction action) {
loaderAction = action;
}
/**
- *
+ *
* @param classFromJavaJar
* @param classJarURI
* @param jarBasename jar basename w/ suffix
@@ -170,16 +170,16 @@ public class JNILibLoaderBase {
if(TempJarCache.isInitialized()) {
final URI jarSubURI = JarUtil.getJarSubURI( classJarURI );
if(null == jarSubURI) {
- throw new IllegalArgumentException("JarSubURI is null of: "+classJarURI);
+ throw new IllegalArgumentException("JarSubURI is null of: "+classJarURI);
}
final String jarUriRoot_s = IOUtil.getURIDirname( jarSubURI.toString() );
msg.append("[ ").append(jarSubURI.toString()).append(" -> ").append(jarUriRoot_s).append(" ] + ");
-
+
final String nativeLibraryPath = "natives/"+PlatformPropsImpl.os_and_arch+"/";
final ClassLoader cl = classFromJavaJar.getClassLoader();
final URL nativeLibraryURI = cl.getResource(nativeLibraryPath);
if( null != nativeLibraryURI ) {
- // We probably have one big-fat jar file, containing java classes
+ // We probably have one big-fat jar file, containing java classes
// and all native platform libraries under 'natives/os.and.arch'!
final URI nativeJarURI = JarUtil.getJarFileURI(jarUriRoot_s+jarBasename);
if( TempJarCache.addNativeLibs(classFromJavaJar, nativeJarURI, nativeLibraryPath) ) {
@@ -188,7 +188,7 @@ public class JNILibLoaderBase {
}
}
if( !ok ) {
- // We assume one slim native jar file per 'os.and.arch'!
+ // We assume one slim native jar file per 'os.and.arch'!
final URI nativeJarURI = JarUtil.getJarFileURI(jarUriRoot_s+nativeJarBasename);
msg.append(nativeJarBasename).append(" -> slim: ").append(nativeJarURI);
ok = TempJarCache.addNativeLibs(classFromJavaJar, nativeJarURI, null /* nativeLibraryPath */);
@@ -201,22 +201,22 @@ public class JNILibLoaderBase {
}
return ok;
}
-
+
/**
* Loads and adds a JAR file's native library to the TempJarCache.
* The native library JAR file's URI is derived as follows:
*
- *
+ *
* Where:
* GLProfile.class
-> GLProfile.class
-> http://lala/
-> http://lala/'nativeJarBaseName'-'os.and.arch'.jar
*
- *
+ *
* @param classFromJavaJar GLProfile
* @param nativeJarBasename jogl-all
* @return true if the native JAR file loaded successful or were loaded already, false in case of an error
@@ -234,15 +234,15 @@ public class JNILibLoaderBase {
if(DEBUG) {
e0.printStackTrace();
}
- }
+ }
} else if(DEBUG) {
System.err.println("JNILibLoaderBase: addNativeJarLibs1: disabled due to uninitialized TempJarCache");
}
return false;
}
-
+
/**
- * Loads and adds a JAR file's native library to the TempJarCache,
+ * Loads and adds a JAR file's native library to the TempJarCache,
* calling {@link JNILibLoaderBase#addNativeJarLibs(Class[], String, String[])}
* with default JOGL deployment configuration:
* classFromJavaJar
@@ -258,7 +258,7 @@ public class JNILibLoaderBase {
*
* The native library JAR file's URI is derived as follows:
*
- *
+ *
* Where:
* GLProfile.class
-> GLProfile.class
-> http://lala/gluegen-rt.jar
-> http://lala/gluegen-rt
-> http://lala/gluegen-rt-natives-'os.and.arch'.jar
*
classesFromJavaJars
*
- * Otherwise the native JAR files will be resolved for each class's JAR file:
- *
+ * Otherwise the native JAR files will be resolved for each class's JAR file:
+ *
*
*
+ *
* Examples: @@ -309,7 +309,7 @@ public class JNILibLoaderBase { // only: jocl.jar -> jocl-natives-os.and.arch.jar addNativeJarLibs(new Class>[] { JOCLJNILibLoader.class }, null, null ); * - * + * * Newt Only: *
// either: [jogl-all.jar, jogl-all-noawt.jar, jogl-all-mobile.jar, jogl-all-android.jar] -> jogl-all-natives-os.and.arch.jar @@ -334,12 +334,12 @@ public class JNILibLoaderBase { JNILibLoaderBase.addNativeJarLibs(classesFromJavaJars, "-all", new String[] { "-noawt", "-mobile", "-core", "-android" } ); ** - * + * * @param classesFromJavaJars For each given Class, load the native library JAR. * @param singleJarMarker Optional string marker like "-all" to identify the single 'all-in-one' JAR file * after which processing of the class array shall stop. * @param stripBasenameSuffixes Optional substrings to be stripped of the base URI - * + * * @return true if either the 'all-in-one' native JAR or all native JARs loaded successful or were loaded already, * false in case of an error */ @@ -351,7 +351,7 @@ public class JNILibLoaderBase { if(TempJarCache.isInitialized()) { final StringBuilder msg = new StringBuilder(); int count = 0; - try { + try { boolean done = false; ok = true; for(int i=0; !done && ok && i