Class NativeLibraryStorage


  • public class NativeLibraryStorage
    extends java.lang.Object
    Handles loading and access of native code loading through a JNLP application or applet. Stores native code in a temporary folder. Be sure to call cleanupTemporaryFolder() when finished with the object.
    • 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
      • 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 the Files to the search path of this NativeLibraryStorage when 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.