Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.greenstone.gatherer.util
Class WinRegistry  view WinRegistry download WinRegistry.java

java.lang.Object
  extended byorg.greenstone.gatherer.util.WinRegistry

public class WinRegistry
extends java.lang.Object

This class provides access to the Windows registry via the preferences modules of JDK1.4. But wouldn't you know it, it doesn't always read the windows key files correctly as they appear to have changed how they store keys between win98, win2000 and winNT. To combat this, this class will eventually be swallowed by the LauchProgramManager, and used only to attempt to determine the default launching commands.


Field Summary
private static int ERROR_CODE
          A constant used to interpret the return of a native function as an error.
private static int ERROR_SUCCESS
          Windows error codes.
private static int HKEY_LOCAL_MACHINE
          HKEY_LOCAL_MACHINE address.
private static int KEY_QUERY_VALUE
          Windows security mask
private static int NATIVE_HANDLE
          A constant used to interpret the return of a native function as successful.
 
Constructor Summary
WinRegistry()
           
 
Method Summary
private static java.lang.String byteArrayToString(byte[] array)
           
private static java.lang.String getValue(java.lang.String path)
          Attempts to retrieve the value at the location given from the registry using Reflection.
static java.lang.String openCommand(java.lang.String filename)
          Called to build a command string that will launch the given file in its associated program according to the windows registry.
static int[] openKey(int hkey, byte[] windowsAbsolutePath, int securityMask)
          Attempts to open a certain key-value pair from the windows registry, from within a certain region (or HKEY).
private static byte[] stringToByteArray(java.lang.String str)
          Converts a string to a byte array.
private static java.lang.String toJavaValueString(byte[] windowsNameArray)
           
private static byte[] toWindowsName(java.lang.String javaName)
          Magics the name of a certain path component from a Java String to the unique string windows requires.
static int WindowsRegCloseKey(int nativeHandle)
          Closes the reference (and hence the instantiated objects) to a certain entry within the registry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEY_QUERY_VALUE

private static final int KEY_QUERY_VALUE
Windows security mask

See Also:
Constant Field Values

NATIVE_HANDLE

private static final int NATIVE_HANDLE
A constant used to interpret the return of a native function as successful.

See Also:
Constant Field Values

ERROR_CODE

private static final int ERROR_CODE
A constant used to interpret the return of a native function as an error.

See Also:
Constant Field Values

ERROR_SUCCESS

private static final int ERROR_SUCCESS
Windows error codes.

See Also:
Constant Field Values

HKEY_LOCAL_MACHINE

private static final int HKEY_LOCAL_MACHINE
HKEY_LOCAL_MACHINE address.

See Also:
Constant Field Values
Constructor Detail

WinRegistry

public WinRegistry()
Method Detail

openCommand

public static java.lang.String openCommand(java.lang.String filename)
Called to build a command string that will launch the given file in its associated program according to the windows registry.


getValue

private static java.lang.String getValue(java.lang.String path)
                                  throws java.lang.ClassNotFoundException,
                                         java.lang.Exception,
                                         java.lang.NoSuchMethodException
Attempts to retrieve the value at the location given from the registry using Reflection.


WindowsRegCloseKey

public static int WindowsRegCloseKey(int nativeHandle)
                              throws java.lang.Exception
Closes the reference (and hence the instantiated objects) to a certain entry within the registry. Do this or suffer massive memory leaks.


openKey

public static int[] openKey(int hkey,
                            byte[] windowsAbsolutePath,
                            int securityMask)
                     throws java.lang.Exception
Attempts to open a certain key-value pair from the windows registry, from within a certain region (or HKEY).


stringToByteArray

private static byte[] stringToByteArray(java.lang.String str)
Converts a string to a byte array. Duh!


toJavaValueString

private static java.lang.String toJavaValueString(byte[] windowsNameArray)

byteArrayToString

private static java.lang.String byteArrayToString(byte[] array)

toWindowsName

private static byte[] toWindowsName(java.lang.String javaName)
Magics the name of a certain path component from a Java String to the unique string windows requires.