org.fusesource.hawtjni.runtime
Class Library

java.lang.Object
  extended by org.fusesource.hawtjni.runtime.Library

public class Library
extends java.lang.Object

Used to optionally extract and load a JNI library. It will search for the library in order at the following locations:

  1. in the custom library path: If the "library.${name}.path" System property is set to a directory
    1. "${name}-${version}" if the version can be determined.
    2. "${name}"
  2. system library path: This is where the JVM looks for JNI libraries by default.
    1. "${name}-${version}" if the version can be determined.
    2. "${name}"
  3. classpath path: If the JNI library can be found on the classpath, it will get extracted and and then loaded. This way you can embed your JNI libraries into your packaged JAR files. They are looked up as resources in this order:
    1. "META-INF/native/${platform}/${library}" : Store your library here if you want to embed more than one platform JNI library in the jar.
    2. "META-INF/native/${library}": Store your library here if your JAR is only going to embedding one platform library.
    The file extraction is attempted until it succeeds in the following directories.
    1. The directory pointed to by the "library.${name}.path" System property (if set)
    2. a temporary directory (uses the "java.io.tmpdir" System property)
where:


Constructor Summary
Library(java.lang.String name)
           
Library(java.lang.String name, java.lang.Class<?> clazz)
           
Library(java.lang.String name, java.lang.String version)
           
Library(java.lang.String name, java.lang.String version, java.lang.ClassLoader classLoader)
           
 
Method Summary
protected static int getBitModel()
           
 java.lang.String getLibraryFileName()
           
 java.lang.String getOperatingSystem()
           
 java.lang.String getOperatingSystemSpecifcResourcePath()
           
 java.lang.String getPlatform()
           
 java.lang.String getPlatformSpecifcResourcePath()
           
 java.lang.String getPlatformSpecifcResourcePath(java.lang.String platform)
           
 java.lang.String getResorucePath()
           
 void load()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Library

public Library(java.lang.String name)

Library

public Library(java.lang.String name,
               java.lang.Class<?> clazz)

Library

public Library(java.lang.String name,
               java.lang.String version)

Library

public Library(java.lang.String name,
               java.lang.String version,
               java.lang.ClassLoader classLoader)
Method Detail

getOperatingSystem

public java.lang.String getOperatingSystem()

getPlatform

public java.lang.String getPlatform()

getBitModel

protected static int getBitModel()

load

public void load()

getOperatingSystemSpecifcResourcePath

public final java.lang.String getOperatingSystemSpecifcResourcePath()

getPlatformSpecifcResourcePath

public final java.lang.String getPlatformSpecifcResourcePath()

getPlatformSpecifcResourcePath

public final java.lang.String getPlatformSpecifcResourcePath(java.lang.String platform)

getResorucePath

public final java.lang.String getResorucePath()

getLibraryFileName

public final java.lang.String getLibraryFileName()