Package com.jogamp.common.os
Class DynamicLibraryBundle
- java.lang.Object
-
- com.jogamp.common.os.DynamicLibraryBundle
-
- All Implemented Interfaces:
DynamicLookupHelper
public class DynamicLibraryBundle extends Object implements DynamicLookupHelper
Provides bundling of:
- The to-be-glued native library, eg OpenGL32.dll. From here on this is referred as the Tool.
- The JNI glue-code native library, eg jogl_desktop.dll. From here on this is referred as the Glue
An
An instance provides a completeDynamicLibraryBundleInfo
instance is being passed in the constructor, providing the required information about the tool and glue libraries. The ClassLoader of it's implementation is also being used to help locating the native libraries.DynamicLookupHelper
toreset
theProcAddressTable
.
At construction, it:- loads the Tool native library via
NativeLibrary's open method
- loads the
Glue native library
- resolves the Tool's
GetProcAddress
. (optional)
-
-
Field Summary
Fields Modifier and Type Field Description protected List<NativeLibrary>
nativeLibraries
-
Fields inherited from interface com.jogamp.common.os.DynamicLookupHelper
DEBUG, DEBUG_LOOKUP
-
-
Constructor Summary
Constructors Constructor Description DynamicLibraryBundle(DynamicLibraryBundleInfo info)
Instantiates and loads allNativeLibrary
s incl.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
claimAllLinkPermission()
void
destroy()
Unload allNativeLibrary
s, and remove all references.long
dynamicLookupFunction(String funcName)
Returns the function handle for function 'funcName'.DynamicLibraryBundleInfo
getBundleInfo()
static RunnableExecutor
getDefaultRunnableExecutor()
Returns an AWT-EDTRunnableExecutor
implementation if AWT is available, otherwiseRunnableExecutor.currentThreadExecutor
.int
getGlueLibLoadedNumber()
int
getGlueLibNumber()
protected long
getToolGetProcAddressHandle()
int
getToolLibLoadedNumber()
int
getToolLibNumber()
boolean
isFunctionAvailable(String funcName)
Queries whether function 'funcName' is available.boolean
isGlueLibComplete()
boolean
isGlueLibLoaded(int i)
boolean
isLibComplete()
boolean
isToolLibComplete()
boolean
isToolLibLoaded()
boolean
isToolLibLoaded(int i)
protected static NativeLibrary
loadFirstAvailable(List<String> libNames, boolean searchSystemPath, boolean searchSystemPathFirst, ClassLoader loader, boolean global)
void
releaseAllLinkPermission()
-
-
-
Field Detail
-
nativeLibraries
protected final List<NativeLibrary> nativeLibraries
-
-
Constructor Detail
-
DynamicLibraryBundle
public DynamicLibraryBundle(DynamicLibraryBundleInfo info)
Instantiates and loads allNativeLibrary
s incl. JNI libraries.The ClassLoader of the
DynamicLibraryBundleInfo
implementation class is being used to help locating the native libraries.
-
-
Method Detail
-
getDefaultRunnableExecutor
public static RunnableExecutor getDefaultRunnableExecutor()
Returns an AWT-EDTRunnableExecutor
implementation if AWT is available, otherwiseRunnableExecutor.currentThreadExecutor
.
-
destroy
public final void destroy()
Unload allNativeLibrary
s, and remove all references.
-
isLibComplete
public final boolean isLibComplete()
-
getToolLibNumber
public final int getToolLibNumber()
-
getToolLibLoadedNumber
public final int getToolLibLoadedNumber()
-
isToolLibComplete
public final boolean isToolLibComplete()
- Returns:
- true if all tool libraries are loaded, otherwise false.
- See Also:
DynamicLibraryBundleInfo.getToolLibNames()
-
isToolLibLoaded
public final boolean isToolLibLoaded()
-
isToolLibLoaded
public final boolean isToolLibLoaded(int i)
-
getGlueLibNumber
public final int getGlueLibNumber()
-
getGlueLibLoadedNumber
public final int getGlueLibLoadedNumber()
-
isGlueLibComplete
public final boolean isGlueLibComplete()
- Returns:
- true if the last entry has been loaded, while ignoring the preload dependencies. Otherwise false.
- See Also:
DynamicLibraryBundleInfo.getGlueLibNames()
-
isGlueLibLoaded
public final boolean isGlueLibLoaded(int i)
-
getBundleInfo
public final DynamicLibraryBundleInfo getBundleInfo()
-
getToolGetProcAddressHandle
protected final long getToolGetProcAddressHandle() throws SecurityException
- Throws:
SecurityException
-
loadFirstAvailable
protected static final NativeLibrary loadFirstAvailable(List<String> libNames, boolean searchSystemPath, boolean searchSystemPathFirst, ClassLoader loader, boolean global) throws SecurityException
- Throws:
SecurityException
-
claimAllLinkPermission
public final void claimAllLinkPermission() throws SecurityException
- Specified by:
claimAllLinkPermission
in interfaceDynamicLookupHelper
- Throws:
SecurityException
- if user is not granted access for the library set.
-
releaseAllLinkPermission
public final void releaseAllLinkPermission() throws SecurityException
- Specified by:
releaseAllLinkPermission
in interfaceDynamicLookupHelper
- Throws:
SecurityException
- if user is not granted access for the library set.
-
dynamicLookupFunction
public final long dynamicLookupFunction(String funcName) throws SecurityException
Description copied from interface:DynamicLookupHelper
Returns the function handle for function 'funcName'.- Specified by:
dynamicLookupFunction
in interfaceDynamicLookupHelper
- Throws:
SecurityException
- if user is not granted access for the library set.
-
isFunctionAvailable
public final boolean isFunctionAvailable(String funcName) throws SecurityException
Description copied from interface:DynamicLookupHelper
Queries whether function 'funcName' is available.- Specified by:
isFunctionAvailable
in interfaceDynamicLookupHelper
- Throws:
SecurityException
- if user is not granted access for the library set.
-
-