From 0cf9f2581302d581a7a37ea5e97a080d86823d1d Mon Sep 17 00:00:00 2001 From: Rik Veenboer Date: Sat, 19 Feb 2011 15:59:57 +0000 Subject: [PATCH] --- cpp/nativecall/msvc/nativecall.suo | Bin 8704 -> 9728 bytes java/native/nativecall.dll | Bin 11776 -> 0 bytes java/src/com/eaio/nativecall/Holder.java | 133 ------- java/src/com/eaio/nativecall/IntCall.java | 143 ------- java/src/com/eaio/nativecall/NativeCall.java | 355 ------------------ java/src/com/eaio/nativecall/Verifier.java | 101 ----- java/src/com/eaio/nativecall/Verifiers.java | 83 ---- java/src/com/eaio/nativecall/VoidCall.java | 99 ----- .../com/eaio/nativecall/Win32Verifier.java | 122 ------ java/src/com/eaio/nativecall/package.html | 15 - 10 files changed, 1051 deletions(-) delete mode 100644 java/native/nativecall.dll delete mode 100644 java/src/com/eaio/nativecall/Holder.java delete mode 100644 java/src/com/eaio/nativecall/IntCall.java delete mode 100644 java/src/com/eaio/nativecall/NativeCall.java delete mode 100644 java/src/com/eaio/nativecall/Verifier.java delete mode 100644 java/src/com/eaio/nativecall/Verifiers.java delete mode 100644 java/src/com/eaio/nativecall/VoidCall.java delete mode 100644 java/src/com/eaio/nativecall/Win32Verifier.java delete mode 100644 java/src/com/eaio/nativecall/package.html diff --git a/cpp/nativecall/msvc/nativecall.suo b/cpp/nativecall/msvc/nativecall.suo index ad73bc079eeddd72616752822b8f1f7211a0e6c4..6386fe5dfa12071f5bd1c3eab6ab78a75b69268c 100644 GIT binary patch delta 1458 zcmcgsO=uHQ5T2K8nzl)5QcY8hA&QEiY}x#_>5nGeM6`rf+eT3qB*uVgw`tm@A#GDy z@SunYcJSiGdee)jds8SC3xbO1*@Jo##G@W^G0v;8Mh_lToX592e>-nx-t1e9F2?V6 z>l&;8U?Y6dBD#lcNr*E8?iAcj;ntOAIW|~fDk0K6FLYXLMP$7Ur&`kNbfM`uO6%1uNU;Jga*@;eGI0c04Y$U*4 z;G;&LwrbKd3*$MP3AAGcUkSSnT)2p3bDw2hXRNVldCPzv9}6D*WIbxOlf_hH#k}ps zfqoqTgF7tRDbbn>`sGN#Cq=}FM~aF5$f1B33Hc>4CP_ZO9Fs}gK3~cv^O-_Al~lFG z<~3$+qM(g6f$O%CFs#GbEk{tc_AJ?D3u_>irN+mwjfAW=V^1&}*AGIP3Qa?j%1`6# zmL!H90$WC-X~I}-37$4N@U5f8z6>&TRDlHdg-LoUFo+dL)B-%Jqh=e-w;na~qoy){ zv}_Lv!&2(-Td5lJN#B3|7d;B4Xlb0yw^M+_WYbX zl;8wpAPYX=WAlS}23M$_E?jkiH z(~T>xpy2>%?_=40VL@#xq>8!8@sX0;sU)V-lT*rIW>gs}WEHMWr}AUdYCbcTKATA@ z`N`?*sFKR%l#RhqmHzb^k&~+0MwU`(E-J-5k$@Z&dwqeB=#Tk5VyHJLi9TO25b}Cu zZ^Y}JXTW%O7YL9E|LIu%b@mH?oPPA5tY_`Z9!yr$lz`>@+8-Qra_crEg1rx7vK?;9B%*(KPonqz`<^s zOioK~7B|#!=VbJ;^q4%AoX~5Yf=y;4Kz|QW+gEgQfua0>n*Yrq^8$eM;9AtRzzbTA zP|sl>VBrO71hX=lPP5I7r*^PF&tguBG1$}Vp*8fFu_|mq1x{dxKEj(cD+FaC0-NMe z4y_MVlpr-?0S~gb39GOK8?Z)3M3vFY$j@WN*P=ydgqOY^kj7Z->z$|r$){BRWyPo& z%TQU0Ud;;JrdFU3S^j$loWVNm!T~J6Jl(oV^f-8Ky?cuD(o~NZgsWFU?f3;AQ9Y5f a3@OHTy_4X=udqtvNsT9cJ*?@)q=w%D2ZuHQ diff --git a/java/native/nativecall.dll b/java/native/nativecall.dll deleted file mode 100644 index 6f54b0bba3ef910698a5ca94ce8a24d01482e719..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 11776 zcmeHN4RjmTm43G6pnz-(8c_oQjB#?pUo2}R*^c~+EfTj;BHOVYlQ^mQ zWXq1>gzoM+yFHzA-kW*%-gn=9_wU^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%1Gs* z$|oz|sEk*ht-PeFu*zSxqiT26!&T2z{d3i;Rl`+3ts1Mktoo|z<<+-TH&)+Sy}de8 z{b2Rist2oItd3P5uRdM9l=%a5p5-=6t!1_4Nz1dA7c4PY=ckr;EV-vP;AuK(j2_%DlP BZv+4U diff --git a/java/src/com/eaio/nativecall/Holder.java b/java/src/com/eaio/nativecall/Holder.java deleted file mode 100644 index 6c1ee68..0000000 --- a/java/src/com/eaio/nativecall/Holder.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Holder.java - * - * Created on 14.09.2004. - * - * eaio: NativeCall - calling operating system methods from Java - * Copyright (c) 2004-2006 Johann Burkard () - * - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN - * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - * USE OR OTHER DEALINGS IN THE SOFTWARE. - * - */ -package com.eaio.nativecall; - -/** - * Holder is a class that encapsulates another Object. Use this class for output - * parameters. - * - * @author Johann Burkard - * @version $Id: Holder.java,v 1.3 2006/04/19 20:54:58 grnull Exp $ - */ -public class Holder { - - /** - * The encapsulated object. - *

- * Accessed by native code. DO NOT RENAME THIS FIELD. - */ - private Object o; - - /** - * Constructor for Holder. - * - * @param o the Object to encapsulate, may be null, but cannot - * be of type Holder - * @throws ClassCastException if o is of type Holder - */ - public Holder(Object o) { - if (o instanceof Holder) { - throw new ClassCastException(); - } - else if (o == null) { - o = new Integer(0); - } - this.o = o; - } - - /** - * Returns the referenced Object. - * - * @return an Object - */ - public final Object get() { - return o; - } - - /** - * Returns the hashCode of the encapsulated Object or - * {@link java.lang.Object#hashCode()} if the Object is null. - * - * @return the hashCode - * @see java.lang.Object#hashCode() - */ - public int hashCode() { - return getClass().getName().hashCode() ^ (o == null ? 0 : o.hashCode()); - } - - /** - * Returns if this Object is equal to another Object. - * - * @param obj the other Object, may be null - * @return if both Objects are equal - * @see java.lang.Object#equals(java.lang.Object) - */ - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (!(obj instanceof Holder)) { - return false; - } - Holder h = (Holder) obj; - return o == null ? h.o == null : o.equals(h.o); - } - - /** - * Returns a String representation of this Object. - * - * @return a String, never null - * @see java.lang.Object#toString() - * @see #toStringBuffer(StringBuffer) - */ - public final String toString() { - return toStringBuffer(null).toString(); - } - - /** - * Appends a String representation of this Object to the given - * {@link StringBuffer} or creates a new one if none is given. - * - * @param in the StringBuffer to append to, may be null - * @return a StringBuffer, never null - */ - public StringBuffer toStringBuffer(StringBuffer in) { - if (in == null) { - in = new StringBuffer(32); - } - else { - in.ensureCapacity(in.length() + 32); - } - in.append("{ Holder: o = "); - in.append(o); - in.append(" }"); - return in; - } - -} diff --git a/java/src/com/eaio/nativecall/IntCall.java b/java/src/com/eaio/nativecall/IntCall.java deleted file mode 100644 index 97c6362..0000000 --- a/java/src/com/eaio/nativecall/IntCall.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * IntCall.java - * - * Created on 07.09.2004. - * - * eaio: NativeCall - calling operating system methods from Java - * Copyright (c) 2004-2006 Johann Burkard () - * - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN - * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - * USE OR OTHER DEALINGS IN THE SOFTWARE. - * - */ -package com.eaio.nativecall; - -/** - * An IntCall instance encapsulates an operating system method that returns - * an integer. - * - * @author Johann Burkard - * @version $Id: IntCall.java,v 1.1 2006/01/05 20:02:44 grnull Exp $ - */ -public class IntCall extends NativeCall { - - /** - * Constructor for IntCall. - * - * @see NativeCall#NativeCall(String) - */ - public IntCall(String function) throws SecurityException, - IllegalArgumentException, NullPointerException { - super(function); - } - - /** - * Constructor for IntCall. - * - * @see NativeCall#NativeCall(String, String) - */ - public IntCall(String module, String function) throws SecurityException, - IllegalArgumentException, NullPointerException { - super(module, function); - } - - /** - * Returns false if calling {@link #executeCall()} returned - * 0, true otherwise. - *

- * Updates the error code field. See {@link #getLastError()}. - * - * @return true or false - */ - public boolean executeBooleanCall() { - return executeCall() == 0 ? false : true; - } - - /** - * Returns false if calling {@link #executeCall(Object)} - * returned 0, true otherwise. - *

- * Updates the error code field. See {@link #getLastError()}. - * - * @param param the parameter, may be null - * @return true or false - * @see #executeBooleanCall(Object[]) - */ - public boolean executeBooleanCall(Object param) { - return executeCall(param) == 0 ? false : true; - } - - /** - * Returns false if calling - * {@link #executeCall(Object[])} returned 0, true otherwise. - *

- * Updates the error code field. See {@link #getLastError()}. - *

- * During this operation, the contents of the array might be changed. - * - * @param params the parameter array, may be null - * @return true or false - */ - public boolean executeBooleanCall(Object[] params) { - return executeCall(params) == 0 ? false : true; - } - - /** - * Calls the function, returning its output. - *

- * Updates the error code field. See {@link #getLastError()}. - * - * @return an int - */ - public native int executeCall(); - - /** - * Calls the function using the given parameter. - *

- * Updates the error code field. See {@link #getLastError()}. - * - * @param param the parameter, may be null - * @return an int - * @see #executeCall(Object[]) - */ - public int executeCall(Object param) { - return executeCall(new Object[] { param }); - } - - /** - * Calls the function using the given parameters. - *

- * Updates the error code field. See {@link #getLastError()}. - *

- * During this operation, the contents of the array might be changed. - * - * @param params the parameter array, may be null - * @return an int - */ - public int executeCall(Object[] params) { - if (params == null || params.length == 0) { - return executeCall(); - } - check(params); - return executeCall0(params); - } - - private native int executeCall0(Object[] params); - -} diff --git a/java/src/com/eaio/nativecall/NativeCall.java b/java/src/com/eaio/nativecall/NativeCall.java deleted file mode 100644 index ce1c820..0000000 --- a/java/src/com/eaio/nativecall/NativeCall.java +++ /dev/null @@ -1,355 +0,0 @@ -/* - * NativeCall.java - * - * Created on 07.09.2004. - * - * eaio: NativeCall - calling operating system methods from Java - * Copyright (c) 2004-2006 Johann Burkard () - * - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN - * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - * USE OR OTHER DEALINGS IN THE SOFTWARE. - * - */ -package com.eaio.nativecall; - -import java.io.IOException; - -import sun.misc.ServiceConfigurationError; - -import com.eaio.util.lang.NativeLoader; - -/** - * NativeCall loads the native library and prepares the matching - * {@link com.eaio.nativecall.Verifier}. - *

- * Before being able to use NativeCall, the {@link #init()} method must have - * been called: - *

- * try {
- *     NativeCall.init();
- * }
- * catch (IOException ex) { ... }
- * catch (SecurityException ex) { ... }
- * catch (UnsatisfiedLinkError er) { ... }
- * catch (sun.misc.ServiceConfigurationError) { ... }
- * catch (UnsupportedOperationException) { ... }
- * 
- * After usage, each NativeCall object must be destroyed to release - * resources. This is done by calling the {@link #destroy()} method. Failure - * to call this method might result in memory leaks. - * - * @see #destroy() - * @see #init() - * @author Johann Burkard - * @version $Id: NativeCall.java,v 1.3 2006/04/19 20:54:58 grnull Exp $ - */ -public abstract class NativeCall { - - /** - * The error code of the last call. - *

- * Accessed by native code. DO NOT RENAME THIS FIELD. - */ - private int lastErrorCode; - - /** - * The internal handle to the function and the module. - *

- * These are set in native code, so ignore any warnings. - *

- * Accessed by native code. DO NOT RENAME THIS FIELD. - */ - private int functionHandle, moduleHandle; - - /** - * The name of the function to call. - *

- * Accessed by native code. DO NOT RENAME THIS FIELD. - */ - private String function; - - /** - * The name of the module to call. - *

- * Accessed by native code. DO NOT RENAME THIS FIELD. - */ - private String module; - - /** - * Initialize JNI field and method IDs - */ - private static native void initIDs(); - - /** - * Whether the class has been initialized properly. - */ - private static boolean initialized = false; - - /** - * Before NativeCall may be used, this method must be called. - * It loads the native library, prepares JNI field and method IDs and loads - * the matching {@link Verifier}. - *

- * Multiple calls are ignored. - * - * @throws IOException if an IOException occured during unpacking of - * the native library - * @throws SecurityException if accessing system properties was forbidden - * by the {@link SecurityManager} - * @throws UnsatisfiedLinkError if the NativeCall.dll could - * not be found - * @throws sun.misc.ServiceConfigurationError - * @throws UnsupportedOperationException if no matching - * {@link Verifier} could be found - */ - public static synchronized void init() - throws - IOException, - SecurityException, - UnsatisfiedLinkError, - ServiceConfigurationError, - UnsupportedOperationException { - if (!initialized) { - Verifiers.init(); - if (Verifiers.getInstance() == null) { - throw new UnsupportedOperationException(); - } - new NativeLoader("NativeCall").load(); - initIDs(); - initialized = true; - } - } - - /** - * Constructor for NativeCall. - * - * @param function the name of the function to use, may not be - * null - * @throws IllegalArgumentException if the function could not be found - * @throws NullPointerException if function is null - * @see Verifier#getDefaultModule() - * @see NativeCall#NativeCall(String, String) - */ - public NativeCall(String function) - throws IllegalArgumentException, NullPointerException { - this(Verifiers.getInstance().getDefaultModule(), function); - } - - /** - * Constructor for NativeCall. - * - * @param module the name of the module the function is stored in, may be - * null - * @param function the name of the function to use, may not be - * null - * @throws IllegalArgumentException if the function could not be found - * @throws NullPointerException if function is null - */ - public NativeCall(String module, String function) - throws IllegalArgumentException, NullPointerException { - Verifier v = Verifiers.getInstance(); - this.function = v.verifyFunctionName(function); - this.module = v.verifyModuleName(module); - if (!initHandles()) { - if (lastErrorCode != 0) { - throw new IllegalArgumentException(getLastError()); - } - throw new IllegalArgumentException(); - } - } - - /** - * Attempts to acquire handles to the functions. Returns if these could be - * acquired. - * - * @return if the handles could be acquired - */ - private native boolean initHandles(); - - /** - * Returns the error code that was returned during the last method call or - * 0 if the last method call did not produce an error. - * - * @see #getLastError() - * @return the last error code or 0 - */ - public final int getLastErrorCode() { - return lastErrorCode; - } - - /** - * Returns a formatted String containing the last error code or - * null if the last call did not produce an error. - * - * @see #getLastErrorCode() - * @return a String or null if the last error code is 0 - */ - public final native String getLastError(); - - /** - * Releases acquired module handles. This method must be called if the - * instance is not used anymore. After this method is called, methods of this - * NativeCall Object cannot be called anymore. - *

- * Failure to call this method might result in memory leaks. - *

- * Updates the error code field. See {@link #getLastError()}. - */ - public native synchronized void destroy(); - - /** - * Checks the supplied Object array for illegal/unsupported types. - *

- * During the verification, the contents of the array might be - * changed. - * - * @param params the Object array, may be null - * @throws ClassCastException if the type of one argument is not supported - */ - protected void check(Object[] params) throws ClassCastException { - if (params == null) { - return; - } - for (int i = 0; i < params.length; ++i) { - checkParam(params[i]); - if (params[i] instanceof String) { - params[i] = - Verifiers.getInstance().handleString( - (String) params[i], - module, - function); - } - } - } - - /** - * Checks one Object for illegal/unsupported types. - * - * @param o the Object, may be null - * @throws ClassCastException if the type of one argument is not supported - */ - protected void checkParam(Object o) throws ClassCastException { - if (o == null - || o instanceof Boolean - || o instanceof Integer - || o instanceof byte[] - || o instanceof char[] - || o instanceof String) { - return; - } - if (o instanceof Holder) { - checkParam(((Holder) o).get()); - return; - } - throw new ClassCastException(o.getClass().getName()); - } - - /** - * Returns if this Object is equal to another Object. The other Object must - * be an instance of the same type as this Object. Also, both the module - * and the function field must be equal. - * - * @param obj the other Object - * @return if this and the other Object are equal - * @see java.lang.Object#equals(java.lang.Object) - */ - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (!(obj instanceof NativeCall)) { - return false; - } - if (!getClass().getName().equals(obj.getClass().getName())) { - return false; - } - NativeCall c = (NativeCall) obj; - return module.equals(c.module) && function.equals(c.function); - } - - /** - * Returns the hashCode of this Object. The hashCode is computed by XOR'ing - * the hash codes of the function and the module names. - * - * @return the hashCode - * @see java.lang.Object#hashCode() - */ - public int hashCode() { - int out = function.hashCode(); - out ^= module.hashCode(); - return out; - } - - /** - * Calls {@link #destroy()}. - * - * @see java.lang.Object#finalize() - */ - protected void finalize() throws Throwable { - try { - destroy(); - } - finally { - super.finalize(); - // in case NativeCall is a subclass of a class other than Object - } - } - - /** - * Returns a String representation of this Object. - * - * @return a String, never null - * @see java.lang.Object#toString() - * @see #toStringBuffer(StringBuffer) - */ - public final String toString() { - return toStringBuffer(null).toString(); - } - - /** - * Appends a String representation of this Object to the given - * {@link StringBuffer} or creates a new one if none is given. - * - * @param in the StringBuffer to append to, may be null - * @return a StringBuffer, never null - */ - public StringBuffer toStringBuffer(StringBuffer in) { - if (in == null) { - in = new StringBuffer(64); - } - else { - in.ensureCapacity(in.length() + 64); - } - in.append("{ "); - int idx = getClass().getName().lastIndexOf("."); - if (idx > -1) { - in.append(getClass().getName().substring(++idx)); - } - else { - in.append(getClass().getName()); - } - in.append(": module = "); - in.append(module); - in.append(", function = "); - in.append(function); - in.append(" }"); - return in; - } - -} diff --git a/java/src/com/eaio/nativecall/Verifier.java b/java/src/com/eaio/nativecall/Verifier.java deleted file mode 100644 index 1780cfc..0000000 --- a/java/src/com/eaio/nativecall/Verifier.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Verifier.java - * - * Created on 07.09.2004. - * - * eaio: NativeCall - calling operating system methods from Java - * Copyright (c) 2004-2006 Johann Burkard () - * - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN - * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - * USE OR OTHER DEALINGS IN THE SOFTWARE. - * - */ -package com.eaio.nativecall; - -/** - * A Verifier implements method and module name checking for one given - * operating system. Classes implementing Verifier must be public and have - * a public no-argument constructor. - * - * @author Johann Burkard - * @version $Id: Verifier.java,v 1.1 2006/01/05 20:02:44 grnull Exp $ - */ -public interface Verifier { - - /** - * If there is a default module that system functions are stored in, the - * module's name may be returned here. - * - * @return the name of a default module or null - * @see NativeCall#NativeCall(String) - */ - String getDefaultModule(); - - /** - * Returns if this Verifier supports the given operating system. - * - * @return if this operating system is supported - * @throws SecurityException because {@link java.lang.System} properties - * may be queried - */ - boolean supports() throws SecurityException; - - /** - * Verifies that the given module name is correct. - * - * @param module the module name, may be null - * @return a module name, possibly modified, never null - * @throws NullPointerException if the module name is null - * and there is no default module defined - * @throws IllegalArgumentException if the module is illegal in the - * operating system - * @see #getDefaultModule() - */ - String verifyModuleName(String module) - throws NullPointerException, IllegalArgumentException; - - /** - * Verifies that the given function name is correct. - * - * @param function the function name, may be null - * @return a function name, possibly modified, never null - * @throws NullPointerException if the function name is null - * @throws IllegalArgumentException if the function is illegal in the - * operating system - */ - String verifyFunctionName(String function) - throws NullPointerException, IllegalArgumentException; - - /** - * Converts the given String to one of the following data types, based on the - * module and the function name: - *
- *

    - *
  • a byte array
  • - *
  • a char array
  • - *
- * - * @param val the String, never null - * @param module the module name, never null - * @param function the function name, never null - * @return the String converted, never null - */ - Object handleString(String val, String module, String function); - -} diff --git a/java/src/com/eaio/nativecall/Verifiers.java b/java/src/com/eaio/nativecall/Verifiers.java deleted file mode 100644 index 5fc674b..0000000 --- a/java/src/com/eaio/nativecall/Verifiers.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Verifiers.java - * - * Created on 07.09.2004. - * - * eaio: NativeCall - calling operating system methods from Java - * Copyright (c) 2004-2006 Johann Burkard () - * - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN - * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - * USE OR OTHER DEALINGS IN THE SOFTWARE. - * - */ -package com.eaio.nativecall; - -import java.util.Iterator; - -import sun.misc.Service; -import sun.misc.ServiceConfigurationError; - -/** - * Verifiers instantiates the matching {@link com.eaio.nativecall.Verifier} for - * the current operating system. - * - * @author Johann Burkard - * @version $Id: Verifiers.java,v 1.2 2006/01/06 10:58:33 grnull Exp $ - */ -final class Verifiers { - - /** - * No instances needed. - */ - private Verifiers() {} - - /** - * The Verifier. - */ - private static Verifier v = null; - - /** - * Find the matching Verifier. - * - * @throws ServiceConfigurationError - * @throws SecurityException - */ - static void init() throws ServiceConfigurationError, SecurityException { - Iterator i = - Service.providers(Verifier.class, Verifier.class.getClassLoader()); - Verifier ver = null; - while (i.hasNext()) { - ver = (Verifier) i.next(); - if (ver.supports()) { - v = ver; - break; - } - } - } - - /** - * Returns the Verifier. - * - * @return a Verifier or null - */ - static Verifier getInstance() { - return v; - } - -} diff --git a/java/src/com/eaio/nativecall/VoidCall.java b/java/src/com/eaio/nativecall/VoidCall.java deleted file mode 100644 index 21ea7a0..0000000 --- a/java/src/com/eaio/nativecall/VoidCall.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * VoidCall.java - * - * Created on 16.09.2004 - * - * eaio: NativeCall - calling operating system methods from Java - * Copyright (c) 2004-2006 Johann Burkard () - * - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN - * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - * USE OR OTHER DEALINGS IN THE SOFTWARE. - * - */ -package com.eaio.nativecall; - -/** - * A VoidCall instance encapsulates an operating system method that returns - * nothing. - * - * @author Johann Burkard - * @version $Id: VoidCall.java,v 1.1 2006/01/05 20:02:44 grnull Exp $ - */ -public class VoidCall extends NativeCall { - - /** - * Constructor for VoidCall. - * - * @see NativeCall#NativeCall(String) - */ - public VoidCall(String function) throws SecurityException, - IllegalArgumentException, NullPointerException { - super(function); - } - - /** - * Constructor for VoidCall. - * - * @see NativeCall#NativeCall(String, String) - */ - public VoidCall(String module, String function) throws SecurityException, - IllegalArgumentException, NullPointerException { - super(module, function); - } - - /** - * Calls the function. - *

- * Updates the error code field. See {@link #getLastError()}. - */ - public native void executeCall(); - - /** - * Calls the function using the given parameter. - *

- * Updates the error code field. See {@link #getLastError()}. - * - * @param param the parameter, may be null - * @see #executeCall(Object[]) - */ - public void executeCall(Object param) { - executeCall(new Object[] { param }); - } - - /** - * Calls the function using the given parameters. - *

- * Updates the error code field. See {@link #getLastError()}. - *

- * During this operation, the contents of the array might be changed. - * - * @param params the parameter array, may be null - */ - public void executeCall(Object[] params) { - if (params == null || params.length == 0) { - executeCall(); - return; - } - check(params); - executeCall0(params); - } - - private native void executeCall0(Object[] params); - -} diff --git a/java/src/com/eaio/nativecall/Win32Verifier.java b/java/src/com/eaio/nativecall/Win32Verifier.java deleted file mode 100644 index b07f2cc..0000000 --- a/java/src/com/eaio/nativecall/Win32Verifier.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Win32Verifier.java - * - * Created on 08.09.2004. - * - * eaio: NativeCall - calling operating system methods from Java - * Copyright (c) 2004-2006 Johann Burkard () - * - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN - * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - * USE OR OTHER DEALINGS IN THE SOFTWARE. - * - */ -package com.eaio.nativecall; - -/** - * A {@link com.eaio.nativecall.Verifier} for the Windows environment. - * - * @author Johann Burkard - * @version $Id: Win32Verifier.java,v 1.3 2006/04/19 20:54:58 grnull Exp $ - */ -public class Win32Verifier implements Verifier { - - /** - * Constructor for Win32Verifier. Does nothing. - */ - public Win32Verifier() {} - - /** - * Verifies that the {@link java.lang.System} property "os.name" starts - * with "Windows". - * - * @see Verifier#supports() - */ - public boolean supports() throws SecurityException { - return System.getProperty("os.name").startsWith("Windows"); - } - - /** - * Returns the default module name if the module name is null - * or an empty String. If the module name contains forward slashes (/), they - * are converted to backward slashes (\). - * - * @see - * http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/loadlibrary.asp - * - * @see com.eaio.nativecall.Verifier#verifyModuleName(java.lang.String) - */ - public String verifyModuleName(String module) { - if (module == null || module.length() == 0) { - return getDefaultModule(); - } - if (module.indexOf('/') != -1) { - module = module.replace('/', '\\'); - } - return module; - } - - /** - * Throws a {@link java.lang.NullPointerException} if the function - * name is null or an empty String. No further processing is - * done. - * - * @see com.eaio.nativecall.Verifier#verifyFunctionName(java.lang.String) - */ - public String verifyFunctionName(String function) { - if (function == null || function.length() == 0) { - throw new NullPointerException(); - } - return function; - } - - /** - * Returns "kernel32". - * - * @return "kernel32" - * @see com.eaio.nativecall.Verifier#getDefaultModule() - */ - public String getDefaultModule() { - return "kernel32"; - } - - /** - * If the function name ends on 'W' (Windows' Unicode functions), a - * char array is returned, otherwise a byte array - * is returned. - *

- * The arrays are always null-terminated. - * - * @see com.eaio.nativecall.Verifier#handleString(java.lang.String, - * java.lang.String, - * java.lang.String) - */ - public Object handleString(String val, String module, String function) { - if (function.charAt(function.length() - 1) == 'W') { - char[] buf = new char[val.length() + 1]; - val.getChars(0, val.length(), buf, 0); - return buf; - } - byte[] buf = new byte[val.length() + 1]; - val.getBytes(0, val.length(), buf, 0); - return buf; - } - -} diff --git a/java/src/com/eaio/nativecall/package.html b/java/src/com/eaio/nativecall/package.html deleted file mode 100644 index ebbd694..0000000 --- a/java/src/com/eaio/nativecall/package.html +++ /dev/null @@ -1,15 +0,0 @@ - - - -Untitled Document - - -

Contains the main NativeCall classes.

-

For instant API information, see:

-
    -
  • {@link com.eaio.nativecall.NativeCall}
  • -
  • {@link com.eaio.nativecall.IntCall}
  • -
  • {@link com.eaio.nativecall.VoidCall}
  • -
- -