utils
Class NativeLibraryManager

java.lang.Object
  extended by utils.NativeLibraryManager

public class NativeLibraryManager
extends java.lang.Object

User: lyon Date: Jul 21, 2006 Time: 8:36:59 AM Copyright DocJava, Inc. 2005.


Constructor Summary
NativeLibraryManager(NativeLibraryBean nlb)
           
 
Method Summary
static void appendJavaLibraryPath(java.io.File path)
          Append directories to the path if you want System.loadlib to find it.
static void appendNativeLibraryDirectory()
          Append the native library directory to the java.library.path, using my byte code hack.
static void fixDriver(java.net.URL resourceUrl, java.lang.String nativeLibraryName)
           
static java.lang.String getLibraryPath()
           
static java.lang.String[] getLibraryPaths()
           
static NativeLibraryBean getNativeLibraryBeanFromFile(java.lang.String libraryName)
           
static java.io.File getNativeLibraryDirectory()
          Store all the native libraries in the ~/.nativeLibrary directory
static java.io.File getNativeLibraryFile(java.lang.String nativeLibraryName)
           
static java.lang.String getPathToLib(java.lang.String libName)
           
static boolean isDateGood(java.io.File canonicalFile, java.net.URL resourceUrl)
           
static boolean isItTimeToBeamOverTheLibrary(java.lang.String nativeLibraryName, java.net.URL resourceUrl)
           
static boolean isLibLoadable(java.lang.String libName)
          Test to see if you can load this library
 void loadLibrary()
           
static void loadLibrary(java.lang.String libraryName)
           
static void main(java.lang.String[] args)
           
static java.lang.String mapLibraryName(java.lang.String s)
           
static void pathHack()
           
static void print(java.lang.String[] libraryPaths)
           
static void printLibraryPaths()
           
static void promptUserToLocateLibrary(java.lang.String libraryName)
           
static void testMapLibName()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NativeLibraryManager

public NativeLibraryManager(NativeLibraryBean nlb)
Method Detail

main

public static void main(java.lang.String[] args)
                 throws java.io.IOException
Throws:
java.io.IOException

loadLibrary

public static void loadLibrary(java.lang.String libraryName)
                        throws java.io.IOException
Throws:
java.io.IOException

loadLibrary

public void loadLibrary()
                 throws java.io.IOException
Throws:
java.io.IOException

getLibraryPath

public static java.lang.String getLibraryPath()

getLibraryPaths

public static java.lang.String[] getLibraryPaths()

pathHack

public static void pathHack()
                     throws java.lang.NoSuchFieldException,
                            java.lang.IllegalAccessException
Throws:
java.lang.NoSuchFieldException
java.lang.IllegalAccessException

mapLibraryName

public static java.lang.String mapLibraryName(java.lang.String s)

printLibraryPaths

public static void printLibraryPaths()

print

public static void print(java.lang.String[] libraryPaths)

getPathToLib

public static java.lang.String getPathToLib(java.lang.String libName)

testMapLibName

public static void testMapLibName()

getNativeLibraryBeanFromFile

public static NativeLibraryBean getNativeLibraryBeanFromFile(java.lang.String libraryName)

promptUserToLocateLibrary

public static void promptUserToLocateLibrary(java.lang.String libraryName)

getNativeLibraryDirectory

public static java.io.File getNativeLibraryDirectory()
Store all the native libraries in the ~/.nativeLibrary directory

Returns:
a directory in the user home. Every user can have their own native lib.

getNativeLibraryFile

public static java.io.File getNativeLibraryFile(java.lang.String nativeLibraryName)

appendJavaLibraryPath

public static void appendJavaLibraryPath(java.io.File path)
Append directories to the path if you want System.loadlib to find it.

Parameters:
path -

fixDriver

public static void fixDriver(java.net.URL resourceUrl,
                             java.lang.String nativeLibraryName)
                      throws java.io.IOException
Throws:
java.io.IOException

isItTimeToBeamOverTheLibrary

public static boolean isItTimeToBeamOverTheLibrary(java.lang.String nativeLibraryName,
                                                   java.net.URL resourceUrl)
                                            throws java.io.IOException
Throws:
java.io.IOException

appendNativeLibraryDirectory

public static void appendNativeLibraryDirectory()
Append the native library directory to the java.library.path, using my byte code hack.


isDateGood

public static boolean isDateGood(java.io.File canonicalFile,
                                 java.net.URL resourceUrl)
                          throws java.io.IOException
Throws:
java.io.IOException

isLibLoadable

public static boolean isLibLoadable(java.lang.String libName)
Test to see if you can load this library

Parameters:
libName - to load
Returns:
true if loadable and loaded