com.ice.jni.registry
Class Registry

java.lang.Object
  extended by com.ice.jni.registry.Registry

public class Registry
extends java.lang.Object

The Registry class provides is used to load the native library DLL, as well as a placeholder for the top level keys, error codes, and utility methods.


Field Summary
 boolean debugLevel
          If true, debug the fv parameters and computation.
static int ERROR_ACCESS_DENIED
           
static int ERROR_BADDB
           
static int ERROR_BADKEY
           
static int ERROR_CALL_NOT_IMPLEMENTED
           
static int ERROR_CANTOPEN
           
static int ERROR_CANTREAD
           
static int ERROR_CANTWRITE
           
static int ERROR_FILE_NOT_FOUND
           
static int ERROR_INSUFFICIENT_BUFFER
           
static int ERROR_INVALID_HANDLE
           
static int ERROR_INVALID_PARAMETER
           
static int ERROR_KEY_DELETED
           
static int ERROR_LOCK_FAILED
           
static int ERROR_MORE_DATA
           
static int ERROR_NO_MORE_ITEMS
           
static int ERROR_NOT_REGISTRY_FILE
           
static int ERROR_REGISTRY_CORRUPT
           
static int ERROR_REGISTRY_IO_FAILED
           
static int ERROR_REGISTRY_RECOVERED
           
static int ERROR_SUCCESS
          These are the Registry API error codes, which can be returned via the RegistryException.
static int ERROR_TRANSFER_TOO_LONG
           
static RegistryKey HKEY_CLASSES_ROOT
          The following statics are the top level keys.
static RegistryKey HKEY_CURRENT_CONFIG
           
static RegistryKey HKEY_CURRENT_USER
           
static RegistryKey HKEY_DYN_DATA
           
static RegistryKey HKEY_LOCAL_MACHINE
           
static RegistryKey HKEY_PERFORMANCE_DATA
           
static RegistryKey HKEY_USERS
           
 
Constructor Summary
Registry()
           
 
Method Summary
static void dumpHexData(java.io.PrintStream out, java.lang.String title, byte[] buf, int numBytes)
           
static void dumpHexData(java.io.PrintWriter out, java.lang.String title, byte[] buf, int offset, int numBytes)
           
static void exportRegistryKey(java.lang.String pathName, RegistryKey key, boolean descend)
          Export the textual definition for a registry key to a file.
static java.lang.String getErrorMessage(int errCode)
          Get the description of a Registry error code.
static RegistryKey getTopLevelKey(java.lang.String keyName)
          Get a top level key by name using the top level key Hashtable.
static void main(java.lang.String[] argv)
          The main() method is used to test the Registry package.
static RegistryKey openSubkey(RegistryKey topKey, java.lang.String keyName, int access)
          Open a subkey of a given top level key.
static java.lang.String[] parseArgumentString(java.lang.String argStr)
           
static java.util.Vector parseArgumentVector(java.lang.String argStr)
           
static java.lang.String[] splitString(java.lang.String splitStr, java.lang.String delim)
          Split a string into a string array containing the substrings between the delimiters.
static void subMain(java.lang.String[] argv)
          The actual main method, which is called for each command.
static void usage(java.lang.String message)
          Print the usage/help information.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HKEY_CLASSES_ROOT

public static RegistryKey HKEY_CLASSES_ROOT
The following statics are the top level keys. Without these, there is no way to get "into" the registry, since the RegOpenSubkey() call requires an existing key which contains the subkey.


HKEY_CURRENT_USER

public static RegistryKey HKEY_CURRENT_USER

HKEY_LOCAL_MACHINE

public static RegistryKey HKEY_LOCAL_MACHINE

HKEY_USERS

public static RegistryKey HKEY_USERS

HKEY_PERFORMANCE_DATA

public static RegistryKey HKEY_PERFORMANCE_DATA

HKEY_CURRENT_CONFIG

public static RegistryKey HKEY_CURRENT_CONFIG

HKEY_DYN_DATA

public static RegistryKey HKEY_DYN_DATA

ERROR_SUCCESS

public static final int ERROR_SUCCESS
These are the Registry API error codes, which can be returned via the RegistryException.

See Also:
Constant Field Values

ERROR_FILE_NOT_FOUND

public static final int ERROR_FILE_NOT_FOUND
See Also:
Constant Field Values

ERROR_ACCESS_DENIED

public static final int ERROR_ACCESS_DENIED
See Also:
Constant Field Values

ERROR_INVALID_HANDLE

public static final int ERROR_INVALID_HANDLE
See Also:
Constant Field Values

ERROR_INVALID_PARAMETER

public static final int ERROR_INVALID_PARAMETER
See Also:
Constant Field Values

ERROR_CALL_NOT_IMPLEMENTED

public static final int ERROR_CALL_NOT_IMPLEMENTED
See Also:
Constant Field Values

ERROR_INSUFFICIENT_BUFFER

public static final int ERROR_INSUFFICIENT_BUFFER
See Also:
Constant Field Values

ERROR_LOCK_FAILED

public static final int ERROR_LOCK_FAILED
See Also:
Constant Field Values

ERROR_TRANSFER_TOO_LONG

public static final int ERROR_TRANSFER_TOO_LONG
See Also:
Constant Field Values

ERROR_MORE_DATA

public static final int ERROR_MORE_DATA
See Also:
Constant Field Values

ERROR_NO_MORE_ITEMS

public static final int ERROR_NO_MORE_ITEMS
See Also:
Constant Field Values

ERROR_BADDB

public static final int ERROR_BADDB
See Also:
Constant Field Values

ERROR_BADKEY

public static final int ERROR_BADKEY
See Also:
Constant Field Values

ERROR_CANTOPEN

public static final int ERROR_CANTOPEN
See Also:
Constant Field Values

ERROR_CANTREAD

public static final int ERROR_CANTREAD
See Also:
Constant Field Values

ERROR_CANTWRITE

public static final int ERROR_CANTWRITE
See Also:
Constant Field Values

ERROR_REGISTRY_RECOVERED

public static final int ERROR_REGISTRY_RECOVERED
See Also:
Constant Field Values

ERROR_REGISTRY_CORRUPT

public static final int ERROR_REGISTRY_CORRUPT
See Also:
Constant Field Values

ERROR_REGISTRY_IO_FAILED

public static final int ERROR_REGISTRY_IO_FAILED
See Also:
Constant Field Values

ERROR_NOT_REGISTRY_FILE

public static final int ERROR_NOT_REGISTRY_FILE
See Also:
Constant Field Values

ERROR_KEY_DELETED

public static final int ERROR_KEY_DELETED
See Also:
Constant Field Values

debugLevel

public boolean debugLevel
If true, debug the fv parameters and computation.

Constructor Detail

Registry

public Registry()
Method Detail

getTopLevelKey

public static RegistryKey getTopLevelKey(java.lang.String keyName)
Get a top level key by name using the top level key Hashtable.

Parameters:
keyName - The name of the top level key.
Returns:
The top level RegistryKey, or null if unknown keyName.

openSubkey

public static RegistryKey openSubkey(RegistryKey topKey,
                                     java.lang.String keyName,
                                     int access)
Open a subkey of a given top level key.

Parameters:
topKey - The top level key containing the subkey.
keyName - The subkey's name.
access - The access flag for the newly opened key.
Returns:
The newly opened RegistryKey.
See Also:
RegistryKey

getErrorMessage

public static java.lang.String getErrorMessage(int errCode)
Get the description of a Registry error code.

Parameters:
errCode - The error code from a RegistryException
Returns:
The description of the error code.

exportRegistryKey

public static void exportRegistryKey(java.lang.String pathName,
                                     RegistryKey key,
                                     boolean descend)
                              throws java.io.IOException,
                                     NoSuchKeyException,
                                     RegistryException
Export the textual definition for a registry key to a file. The resulting file can be re-loaded via RegEdit.

Parameters:
pathName - The pathname of the file into which to export.
key - The registry key definition to export.
descend - If true, descend and export all subkeys.
Throws:
NoSuchKeyException - Thrown by openSubKey().
RegistryException - Any other registry API error.
java.io.IOException

main

public static void main(java.lang.String[] argv)
The main() method is used to test the Registry package.


usage

public static void usage(java.lang.String message)
Print the usage/help information.


subMain

public static void subMain(java.lang.String[] argv)
The actual main method, which is called for each command.


dumpHexData

public static void dumpHexData(java.io.PrintStream out,
                               java.lang.String title,
                               byte[] buf,
                               int numBytes)

dumpHexData

public static void dumpHexData(java.io.PrintWriter out,
                               java.lang.String title,
                               byte[] buf,
                               int offset,
                               int numBytes)

splitString

public static java.lang.String[] splitString(java.lang.String splitStr,
                                             java.lang.String delim)
Split a string into a string array containing the substrings between the delimiters. NOTE This method WILL NOT return an empty token at the end of the array that is returned, if the string ends with the delimiter. If you wish to have a property string array that ends with the delimiter return an empty string at the end of the array, use vectorString().


parseArgumentString

public static java.lang.String[] parseArgumentString(java.lang.String argStr)

parseArgumentVector

public static java.util.Vector parseArgumentVector(java.lang.String argStr)