org.clearsilver.jni
Class JNI

java.lang.Object
  extended by org.clearsilver.jni.JNI

public final class JNI
extends Object

Loads the ClearSilver JNI library.

By default, it attempts to load the library 'clearsilver-jni' from the path specified in the 'java.library.path' system property. However, this can be overriden by calling setLibraryName(String) and setLibrarySearchPaths(String[]).

If this fails, the JVM exits with a code of 1. However, this strategy can be changed using setFailureCallback(Runnable).


Field Summary
static Runnable EXIT_JVM
          Failure callback strategy that writes a message to sysout, then calls System.exit(1).
static Runnable THROW_ERROR
          Failure callback strategy that throws an UnsatisfiedLinkError, which should be caught be client code.
 
Constructor Summary
JNI()
           
 
Method Summary
static void loadLibrary()
          Attempts to load the ClearSilver JNI library.
static void setFailureCallback(Runnable failureCallback)
          Sets a callback for what should happen if the JNI library cannot be loaded.
static void setLibraryName(String libraryName)
          Set name of JNI library to load.
static void setLibrarySearchPaths(String... paths)
          Sets locations where JNI library is searched.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EXIT_JVM

public static Runnable EXIT_JVM
Failure callback strategy that writes a message to sysout, then calls System.exit(1).


THROW_ERROR

public static Runnable THROW_ERROR
Failure callback strategy that throws an UnsatisfiedLinkError, which should be caught be client code.

Constructor Detail

JNI

public JNI()
Method Detail

loadLibrary

public static void loadLibrary()
Attempts to load the ClearSilver JNI library.

See Also:
setFailureCallback(Runnable)

setFailureCallback

public static void setFailureCallback(Runnable failureCallback)
Sets a callback for what should happen if the JNI library cannot be loaded. The default is EXIT_JVM.

See Also:
EXIT_JVM, THROW_ERROR

setLibraryName

public static void setLibraryName(String libraryName)
Set name of JNI library to load. Default is 'clearsilver-jni'.


setLibrarySearchPaths

public static void setLibrarySearchPaths(String... paths)
Sets locations where JNI library is searched.



Copyright © 2010-2012 Google. All Rights Reserved.