com.jogamp.common.jvm
Class JNILibLoaderBase

java.lang.Object
  extended by com.jogamp.common.jvm.JNILibLoaderBase

public class JNILibLoaderBase
extends Object


Nested Class Summary
static interface JNILibLoaderBase.LoaderAction
           
 
Field Summary
static boolean DEBUG
           
 
Constructor Summary
JNILibLoaderBase()
           
 
Method Summary
static void addLoaded(String libName)
           
static boolean addNativeJarLibs(Class<?> classFromJavaJar, String nativeJarBaseName)
           
static boolean addNativeJarLibs(Class<?> classFromJavaJar, String allNativeJarBaseName, String[] atomicNativeJarBaseNames)
           
static void disableLoading()
           
static void enableLoading()
           
static boolean isLoaded(String libName)
           
protected static boolean loadLibrary(String libname, boolean ignoreError, ClassLoader cl)
          Loads the library specified by libname, using the JNILibLoaderBase.LoaderAction set by setLoadingAction(LoaderAction).
The implementation should ignore, if the library has been loaded already.
protected static void loadLibrary(String libname, String[] preload, boolean preloadIgnoreError, ClassLoader cl)
          Loads the library specified by libname, using the JNILibLoaderBase.LoaderAction set by setLoadingAction(LoaderAction).
Optionally preloads the libraries specified by preload.
The implementation should ignore, if any library has been loaded already.
static void setLoadingAction(JNILibLoaderBase.LoaderAction action)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

public static final boolean DEBUG
Constructor Detail

JNILibLoaderBase

public JNILibLoaderBase()
Method Detail

isLoaded

public static boolean isLoaded(String libName)

addLoaded

public static void addLoaded(String libName)

disableLoading

public static void disableLoading()

enableLoading

public static void enableLoading()

setLoadingAction

public static void setLoadingAction(JNILibLoaderBase.LoaderAction action)

addNativeJarLibs

public static final boolean addNativeJarLibs(Class<?> classFromJavaJar,
                                             String nativeJarBaseName)
Parameters:
classFromJavaJar - GLProfile
nativeJarBaseName - jogl-all
Returns:
true if the native JAR file loaded successful or were loaded already, false in case of an error

addNativeJarLibs

public static boolean addNativeJarLibs(Class<?> classFromJavaJar,
                                       String allNativeJarBaseName,
                                       String[] atomicNativeJarBaseNames)
Parameters:
classFromJavaJar - A class file to determine the base URL of the native JAR files, eg.: GLProfile.class
allNativeJarBaseName - Attempt to use the 'all' native JAR variant first, if exists. Eg. "jogl-all"
atomicNativeJarBaseNames - Fallback to use all the atomic native JAR files, eg. [ "nativewindow", "jogl", "newt" ]
Returns:
true if either the 'all' native JAR or all of the atomic native JARs loaded successful or were loaded already, false in case of an error

loadLibrary

protected static boolean loadLibrary(String libname,
                                     boolean ignoreError,
                                     ClassLoader cl)
Loads the library specified by libname, using the JNILibLoaderBase.LoaderAction set by setLoadingAction(LoaderAction).
The implementation should ignore, if the library has been loaded already.

Parameters:
libname - the library to load
ignoreError - if true, errors during loading the library should be ignored
cl - optional ClassLoader, used to locate the library
Returns:
true if library loaded successful

loadLibrary

protected static void loadLibrary(String libname,
                                  String[] preload,
                                  boolean preloadIgnoreError,
                                  ClassLoader cl)
Loads the library specified by libname, using the JNILibLoaderBase.LoaderAction set by setLoadingAction(LoaderAction).
Optionally preloads the libraries specified by preload.
The implementation should ignore, if any library has been loaded already.

Parameters:
libname - the library to load
preload - the libraries to load before loading the main library if not null
preloadIgnoreError - if true, errors during loading the preload-libraries should be ignored
cl - optional ClassLoader, used to locate the library