KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > eaio > nativecall > Verifier


1 /*
2  * Verifier.java
3  *
4  * Created on 07.09.2004.
5  *
6  * eaio: NativeCall - calling operating system methods from Java
7  * Copyright (c) 2004-2006 Johann Burkard (<mailto:jb@eaio.com>)
8  * <http://eaio.com>
9  *
10  * Permission is hereby granted, free of charge, to any person obtaining a
11  * copy of this software and associated documentation files (the "Software"),
12  * to deal in the Software without restriction, including without limitation
13  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
14  * and/or sell copies of the Software, and to permit persons to whom the
15  * Software is furnished to do so, subject to the following conditions:
16  *
17  * The above copyright notice and this permission notice shall be included
18  * in all copies or substantial portions of the Software.
19  *
20  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
23  * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
24  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
25  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
26  * USE OR OTHER DEALINGS IN THE SOFTWARE.
27  *
28  */

29 package com.eaio.nativecall;
30
31 /**
32  * A Verifier implements method and module name checking for one given
33  * operating system. Classes implementing Verifier must be public and have
34  * a public no-argument constructor.
35  *
36  * @author <a HREF="mailto:jb@eaio.com">Johann Burkard</a>
37  * @version $Id: Verifier.java,v 1.1 2006/01/05 20:02:44 grnull Exp $
38  */

39 public interface Verifier {
40
41     /**
42      * If there is a default module that system functions are stored in, the
43      * module's name may be returned here.
44      *
45      * @return the name of a default module or <code>null</code>
46      * @see NativeCall#NativeCall(String)
47      */

48     String JavaDoc getDefaultModule();
49
50     /**
51      * Returns if this Verifier supports the given operating system.
52      *
53      * @return if this operating system is supported
54      * @throws SecurityException because {@link java.lang.System} properties
55      * may be queried
56      */

57     boolean supports() throws SecurityException JavaDoc;
58
59     /**
60      * Verifies that the given module name is correct.
61      *
62      * @param module the module name, may be <code>null</code>
63      * @return a module name, possibly modified, never <code>null</code>
64      * @throws NullPointerException if the module name is <code>null</code>
65      * and there is no default module defined
66      * @throws IllegalArgumentException if the module is illegal in the
67      * operating system
68      * @see #getDefaultModule()
69      */

70     String JavaDoc verifyModuleName(String JavaDoc module)
71         throws NullPointerException JavaDoc, IllegalArgumentException JavaDoc;
72
73     /**
74      * Verifies that the given function name is correct.
75      *
76      * @param function the function name, may be <code>null</code>
77      * @return a function name, possibly modified, never <code>null</code>
78      * @throws NullPointerException if the function name is <code>null</code>
79      * @throws IllegalArgumentException if the function is illegal in the
80      * operating system
81      */

82     String JavaDoc verifyFunctionName(String JavaDoc function)
83         throws NullPointerException JavaDoc, IllegalArgumentException JavaDoc;
84
85     /**
86      * Converts the given String to one of the following data types, based on the
87      * module and the function name:
88      * <br>
89      * <ul>
90      * <li>a <code>byte</code> array</li>
91      * <li>a <code>char</code> array</li>
92      * </ul>
93      *
94      * @param val the String, never <code>null</code>
95      * @param module the module name, never <code>null</code>
96      * @param function the function name, never <code>null</code>
97      * @return the String converted, never <code>null</code>
98      */

99     Object JavaDoc handleString(String JavaDoc val, String JavaDoc module, String JavaDoc function);
100
101 }
102
Popular Tags