|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.norther.tammi.core.base.Adaptee
org.norther.tammi.core.external.DefaultLibrary
public abstract class DefaultLibrary
An abstract implementation of native Library. A set of native methods with different return values are provided. The per-thread specific JNI environment pointer may be optionally included as the first argument (or the second one if the first one is reserved for the result) in all native calls.
| Field Summary |
|---|
| Fields inherited from class org.norther.tammi.core.base.Adaptee |
|---|
ADAPTEE_NOTIF_DESCRIPTION, ADAPTEE_NOTIFICATIONS |
| Fields inherited from interface org.norther.tammi.core.base.MBeanDelegate |
|---|
ARRAY_TYPE, OBJECT_TYPE, PRIMITIVE_TYPE, STRING_TYPE |
| Constructor Summary | |
|---|---|
DefaultLibrary()
Constructs a new library. |
|
DefaultLibrary(String library)
Constructs a new library with a native library. |
|
| Method Summary | |
|---|---|
protected void |
freeLibrary()
Frees the native library. |
String |
getBinKey()
Gets the path finder key for resolving binary paths. |
protected int |
getLibrary()
Gets the library code. |
String |
getLibraryPath()
Gets the path to the native library. |
String |
getLoaderPath()
Gets the static path to the loader library. |
protected void |
invoke(String name,
boolean env)
Invokes a void library function. |
protected void |
invoke(String name,
boolean env,
Object args)
Invokes a void library function with arguments. |
protected byte |
invokeByte(String name,
boolean env)
Invokes a byte library function. |
protected byte |
invokeByte(String name,
boolean env,
Object args)
Invokes a byte library function with arguments. |
protected byte[] |
invokeBytes(String name,
boolean env)
Invokes a byte array library function. |
protected byte[] |
invokeBytes(String name,
boolean env,
Object args)
Invokes a byte array library function with arguments. |
protected byte[] |
invokeConstBytes(String name,
boolean env)
Invokes a constant byte array library function. |
protected byte[] |
invokeConstBytes(String name,
boolean env,
Object args)
Invokes a constant byte array library function with arguments. |
protected String |
invokeConstString(String name,
boolean env)
Invokes a constant string library function. |
protected String |
invokeConstString(String name,
boolean env,
Object args)
Invokes a constant string library function with arguments. |
protected String[] |
invokeConstStrings(String name,
boolean env)
Invokes a constant string array library function. |
protected String[] |
invokeConstStrings(String name,
boolean env,
Object args)
Invokes a constant string array library function with arguments. |
protected double |
invokeDouble(String name,
boolean env)
Invokes a double library function. |
protected double |
invokeDouble(String name,
boolean env,
Object args)
Invokes a double library function with arguments. |
protected float |
invokeFloat(String name,
boolean env)
Invokes a float library function. |
protected float |
invokeFloat(String name,
boolean env,
Object args)
Invokes a float library function with arguments. |
protected int |
invokeInt(String name,
boolean env)
Invokes an integer library function. |
protected int |
invokeInt(String name,
boolean env,
Object args)
Invokes an integer library function with arguments. |
protected long |
invokeLong(String name,
boolean env)
Invokes a long library function. |
protected long |
invokeLong(String name,
boolean env,
Object args)
Invokes a long integer library function with arguments. |
protected short |
invokeShort(String name,
boolean env)
Invokes a short library function. |
protected short |
invokeShort(String name,
boolean env,
Object args)
Invokes a short library function with arguments. |
protected String |
invokeString(String name,
boolean env)
Invokes a string library function. |
protected String |
invokeString(String name,
boolean env,
Object args)
Invokes a string library function with arguments. |
protected String[] |
invokeStrings(String name,
boolean env)
Invokes a string array library function. |
protected String[] |
invokeStrings(String name,
boolean env,
Object args)
Invokes a string array library function with arguments. |
void |
setBinKey(String key)
Sets the path finder key for resolving binary paths. |
void |
setLibraryPath(String path)
Sets the path to the native library. |
void |
setLoaderPath(String path)
Sets the static path to the loader library. |
void |
unmanaged()
This method is called when the implementing adaptee is unmanaged either during pre-deregistration of the corresponding adapter MBean or just before it is explicitly removed from the adapter MBean during run-time. |
| Methods inherited from class org.norther.tammi.core.base.Adaptee |
|---|
addAdaptee, addNotificationListener, getAttributeSupport, getBroker, getCanonicalName, getDomain, getFactory, getLoader, getLog, getLog, getMBean, getMBeanServer, getNotificationInfo, getObjectName, getRegistrationTime, getSequenceNumber, hasListeners, isRegistered, postmanaged, premanaged, removeNotificationListener, removeNotificationListener, sendNotification, sendNotification, sendNotification, sendNotification, unregister |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DefaultLibrary()
public DefaultLibrary(String library)
library - the path to the native library.| Method Detail |
|---|
public void unmanaged()
throws Exception
Manageable
unmanaged in interface Manageableunmanaged in class AdapteeException - if the adaptee refused to be unmanaged.public String getBinKey()
Library
getBinKey in interface Librarypublic void setBinKey(String key)
Library
setBinKey in interface Librarykey - the path finder key.public String getLoaderPath()
Library
getLoaderPath in interface Library
public void setLoaderPath(String path)
throws LogException
Library
setLoaderPath in interface Librarypath - the path to the loader library.
LogException - if the library cannot be set.public String getLibraryPath()
Library
getLibraryPath in interface Librarypublic void setLibraryPath(String path)
Library
setLibraryPath in interface Librarypath - the path to the native library.protected int getLibrary()
UnsatisfiedLinkError - if no loader.
NullPointerException - if no library.
IllegalArgumentException - if not available.
UnsupportedOperationException - if failed to initialize.protected void freeLibrary()
protected void invoke(String name,
boolean env)
name - the name of the method.env - if true, include the enviroment.
UnsatisfiedLinkError - if no loader.
NullPointerException - if no library.
IllegalArgumentException - if not available.
UnsupportedOperationException - if failed to initialize.
protected void invoke(String name,
boolean env,
Object args)
name - the name of the method.env - if true, include the enviroment.args - primitive, string and array arguments.
UnsatisfiedLinkError - if no loader.
NullPointerException - if no library.
IllegalArgumentException - if not available.
UnsupportedOperationException - if failed to initialize.
protected byte invokeByte(String name,
boolean env)
name - the name of the method.env - if true, include the enviroment.
UnsatisfiedLinkError - if no loader.
NullPointerException - if no library.
IllegalArgumentException - if not available.
UnsupportedOperationException - if failed to initialize.
protected byte invokeByte(String name,
boolean env,
Object args)
name - the name of the method.env - if true, include the enviroment.args - primitive, string and array arguments.
UnsatisfiedLinkError - if no loader.
NullPointerException - if no library.
IllegalArgumentException - if not available.
UnsupportedOperationException - if failed to initialize.
protected short invokeShort(String name,
boolean env)
name - the name of the method.env - if true, include the enviroment.
UnsatisfiedLinkError - if no loader.
NullPointerException - if no library.
IllegalArgumentException - if not available.
UnsupportedOperationException - if failed to initialize.
protected short invokeShort(String name,
boolean env,
Object args)
name - the name of the method.env - if true, include the enviroment.args - primitive, string and array arguments.
UnsatisfiedLinkError - if no loader.
NullPointerException - if no library.
IllegalArgumentException - if not available.
UnsupportedOperationException - if failed to initialize.
protected int invokeInt(String name,
boolean env)
name - the name of the method.env - if true, include the enviroment.
UnsatisfiedLinkError - if no loader.
NullPointerException - if no library.
IllegalArgumentException - if not available.
UnsupportedOperationException - if failed to initialize.
protected int invokeInt(String name,
boolean env,
Object args)
name - the name of the method.env - if true, include the enviroment.args - primitive, string and array arguments.
UnsatisfiedLinkError - if no loader.
NullPointerException - if no library.
IllegalArgumentException - if not available.
UnsupportedOperationException - if failed to initialize.
protected long invokeLong(String name,
boolean env)
name - the name of the method.env - if true, include the enviroment.
UnsatisfiedLinkError - if no loader.
NullPointerException - if no library.
IllegalArgumentException - if not available.
UnsupportedOperationException - if failed to initialize.
protected long invokeLong(String name,
boolean env,
Object args)
name - the name of the method.env - if true, include the enviroment.args - primitive, string and array arguments.
UnsatisfiedLinkError - if no loader.
NullPointerException - if no library.
IllegalArgumentException - if not available.
UnsupportedOperationException - if failed to initialize.
protected float invokeFloat(String name,
boolean env)
name - the name of the method.env - if true, include the enviroment.
UnsatisfiedLinkError - if no loader.
NullPointerException - if no library.
IllegalArgumentException - if not available.
UnsupportedOperationException - if failed to initialize.
protected float invokeFloat(String name,
boolean env,
Object args)
name - the name of the method.env - if true, include the enviroment.args - primitive, string and array arguments.
UnsatisfiedLinkError - if no loader.
NullPointerException - if no library.
IllegalArgumentException - if not available.
UnsupportedOperationException - if failed to initialize.
protected double invokeDouble(String name,
boolean env)
name - the name of the method.env - if true, include the enviroment.
UnsatisfiedLinkError - if no loader.
NullPointerException - if no library.
IllegalArgumentException - if not available.
UnsupportedOperationException - if failed to initialize.
protected double invokeDouble(String name,
boolean env,
Object args)
name - the name of the method.env - if true, include the enviroment.args - primitive, string and array arguments.
UnsatisfiedLinkError - if no loader.
NullPointerException - if no library.
IllegalArgumentException - if not available.
UnsupportedOperationException - if failed to initialize.
protected String invokeString(String name,
boolean env)
The native result string will be freed by the invoker.
name - the name of the method.env - if true, include the enviroment.
UnsatisfiedLinkError - if no loader.
NullPointerException - if no library.
IllegalArgumentException - if not available.
UnsupportedOperationException - if failed to initialize.
protected String invokeString(String name,
boolean env,
Object args)
The native result string will be freed by the invoker.
name - the name of the method.env - if true, include the enviroment.args - primitive, string and array arguments.
UnsatisfiedLinkError - if no loader.
NullPointerException - if no library.
IllegalArgumentException - if not available.
UnsupportedOperationException - if failed to initialize.
protected String invokeConstString(String name,
boolean env)
The native result string will not be freed by the invoker.
name - the name of the method.env - if true, include the enviroment.
UnsatisfiedLinkError - if no loader.
NullPointerException - if no library.
IllegalArgumentException - if not available.
UnsupportedOperationException - if failed to initialize.
protected String invokeConstString(String name,
boolean env,
Object args)
The native result string will not be freed by the invoker.
name - the name of the method.env - if true, include the enviroment.args - primitive, string and array arguments.
UnsatisfiedLinkError - if no loader.
NullPointerException - if no library.
IllegalArgumentException - if not available.
UnsupportedOperationException - if failed to initialize.
protected byte[] invokeBytes(String name,
boolean env)
The native result array will be freed by the invoker.
name - the name of the method.env - if true, include the enviroment.
UnsatisfiedLinkError - if no loader.
NullPointerException - if no library.
IllegalArgumentException - if not available.
UnsupportedOperationException - if failed to initialize.
protected byte[] invokeBytes(String name,
boolean env,
Object args)
The native result array will be freed by the invoker.
The result parameter must not be included in the argument array.
name - the name of the method.env - if true, include the enviroment.args - primitive, string and array arguments.
UnsatisfiedLinkError - if no loader.
NullPointerException - if no library.
IllegalArgumentException - if not available.
UnsupportedOperationException - if failed to initialize.
protected byte[] invokeConstBytes(String name,
boolean env)
The native result array will not be freed by the invoker.
name - the name of the method.env - if true, include the enviroment.
UnsatisfiedLinkError - if no loader.
NullPointerException - if no library.
IllegalArgumentException - if not available.
UnsupportedOperationException - if failed to initialize.
protected byte[] invokeConstBytes(String name,
boolean env,
Object args)
The native result array will be freed by the invoker.
The result parameter must not be included in the argument array.
name - the name of the method.env - if true, include the enviroment.args - primitive, string and array arguments.
UnsatisfiedLinkError - if no loader.
NullPointerException - if no library.
IllegalArgumentException - if not available.
UnsupportedOperationException - if failed to initialize.
protected String[] invokeStrings(String name,
boolean env)
The native result array and array elements will be freed by the invoker.
name - the name of the method.env - if true, include the enviroment.
UnsatisfiedLinkError - if no loader.
NullPointerException - if no library.
IllegalArgumentException - if not available.
UnsupportedOperationException - if failed to initialize.
protected String[] invokeStrings(String name,
boolean env,
Object args)
The native result array and array elements will be freed by the invoker.
The result parameter must not be included in the argument array.
name - the name of the method.env - if true, include the enviroment.args - primitive, string and array arguments.
UnsatisfiedLinkError - if no loader.
NullPointerException - if no library.
IllegalArgumentException - if not available.
UnsupportedOperationException - if failed to initialize.
protected String[] invokeConstStrings(String name,
boolean env)
The native result array will be freed by the invoker, but array elements will not be freed.
name - the name of the method.env - if true, include the enviroment.
UnsatisfiedLinkError - if no loader.
NullPointerException - if no library.
IllegalArgumentException - if not available.
UnsupportedOperationException - if failed to initialize.
protected String[] invokeConstStrings(String name,
boolean env,
Object args)
The native result array will be freed by the invoker, but array elements will not be freed.
The result parameter must not be included in the argument array.
name - the name of the method.env - if true, include the enviroment.args - primitive, string and array arguments.
UnsatisfiedLinkError - if no loader.
NullPointerException - if no library.
IllegalArgumentException - if not available.
UnsupportedOperationException - if failed to initialize.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||