Class NativeLibraryStorage

java.lang.Object
net.sourceforge.jnlp.cache.NativeLibraryStorage

public class NativeLibraryStorage extends 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 Details

    • LOG

      private static final Logger LOG
    • RANDOM

      private static final Random RANDOM
    • NATIVE_LIB_EXT_DYLIB

      public static final String NATIVE_LIB_EXT_DYLIB
      See Also:
    • NATIVE_LIB_EXT_JNILIB

      public static final String NATIVE_LIB_EXT_JNILIB
      See Also:
    • NATIVE_LIBRARY_EXTENSIONS

      static final String[] NATIVE_LIBRARY_EXTENSIONS
    • tracker

      private final ResourceTracker tracker
    • nativeSearchDirectories

      private final List<File> nativeSearchDirectories
    • jarEntryDirectory

      private File jarEntryDirectory
      Temporary directory to store native jar entries, added to our search path
  • Constructor Details

    • NativeLibraryStorage

      public NativeLibraryStorage(ResourceTracker tracker)
  • Method Details

    • cleanupTemporaryFolder

      public void cleanupTemporaryFolder()
      Clean up our temporary folder if we created one.
    • addSearchDirectories

      public void addSearchDirectories(List<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 List<File> getSearchDirectories()
    • findLibrary

      public File findLibrary(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(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

      File getNativeStoreDirectory()
    • createNativeStoreDirectory

      private static File createNativeStoreDirectory()
      Create a random base directory to store native code files in.