Package net.sourceforge.jnlp.cache
Class NativeLibraryStorage
- java.lang.Object
-
- net.sourceforge.jnlp.cache.NativeLibraryStorage
-
public class NativeLibraryStorage extends java.lang.ObjectHandles loading and access of native code loading through a JNLP application or applet. Stores native code in a temporary folder. Be sure to callcleanupTemporaryFolder()when finished with the object.
-
-
Field Summary
Fields Modifier and Type Field Description private java.io.FilejarEntryDirectoryTemporary directory to store native jar entries, added to our search pathprivate static LoggerLOGstatic java.lang.StringNATIVE_LIB_EXT_DYLIBstatic java.lang.StringNATIVE_LIB_EXT_JNILIB(package private) static java.lang.String[]NATIVE_LIBRARY_EXTENSIONSprivate java.util.List<java.io.File>nativeSearchDirectoriesprivate static java.util.RandomRANDOMprivate ResourceTrackertracker
-
Constructor Summary
Constructors Constructor Description NativeLibraryStorage(ResourceTracker tracker)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddSearchDirectories(java.util.List<java.io.File> directories)Adds theFiles to the search path of thisNativeLibraryStoragewhen trying to find a native libraryvoidaddSearchJar(java.net.URL jarLocation)Search for and enable any native code contained in a JAR by copying the native files into the filesystem.voidcleanupTemporaryFolder()Clean up our temporary folder if we created one.private static java.io.FilecreateNativeStoreDirectory()Create a random base directory to store native code files in.java.io.FilefindLibrary(java.lang.String fileName)Looks in the search directories for 'fileName', returning a path to the found file if it exists.(package private) java.io.FilegetNativeStoreDirectory()java.util.List<java.io.File>getSearchDirectories()
-
-
-
Field Detail
-
LOG
private static final Logger LOG
-
RANDOM
private static final java.util.Random RANDOM
-
NATIVE_LIB_EXT_DYLIB
public static final java.lang.String NATIVE_LIB_EXT_DYLIB
- See Also:
- Constant Field Values
-
NATIVE_LIB_EXT_JNILIB
public static final java.lang.String NATIVE_LIB_EXT_JNILIB
- See Also:
- Constant Field Values
-
NATIVE_LIBRARY_EXTENSIONS
static final java.lang.String[] NATIVE_LIBRARY_EXTENSIONS
-
tracker
private final ResourceTracker tracker
-
nativeSearchDirectories
private final java.util.List<java.io.File> nativeSearchDirectories
-
jarEntryDirectory
private java.io.File jarEntryDirectory
Temporary directory to store native jar entries, added to our search path
-
-
Constructor Detail
-
NativeLibraryStorage
public NativeLibraryStorage(ResourceTracker tracker)
-
-
Method Detail
-
cleanupTemporaryFolder
public void cleanupTemporaryFolder()
Clean up our temporary folder if we created one.
-
addSearchDirectories
public void addSearchDirectories(java.util.List<java.io.File> directories)
Adds theFiles to the search path of thisNativeLibraryStoragewhen trying to find a native library- Parameters:
directories- directories to be added
-
getSearchDirectories
public java.util.List<java.io.File> getSearchDirectories()
-
findLibrary
public java.io.File findLibrary(java.lang.String fileName)
Looks in the search directories for 'fileName', returning a path to the found file if it exists.- Parameters:
fileName- name of library to be found- Returns:
- path to library if found, null otherwise.
-
addSearchJar
public void addSearchJar(java.net.URL jarLocation)
Search for and enable any native code contained in a JAR by copying the native files into the filesystem. Called in the security context of the classloader.- Parameters:
jarLocation- location of jar to be searched
-
getNativeStoreDirectory
java.io.File getNativeStoreDirectory()
-
createNativeStoreDirectory
private static java.io.File createNativeStoreDirectory()
Create a random base directory to store native code files in.
-
-