org.apache.tomcat.jni

Class Registry

public class Registry extends Object

Windows Registy support

Version: $Revision: 832187 $, $Date: 2009-11-03 00:23:20 +0100 (Tue, 03 Nov 2009) $

Author: Mladen Turk

Field Summary
static intHKEY_CLASSES_ROOT
static intHKEY_CURRENT_CONFIG
static intHKEY_CURRENT_USER
static intHKEY_LOCAL_MACHINE
static intHKEY_USERS
static intKEY_ALL_ACCESS
static intKEY_CREATE_LINK
static intKEY_CREATE_SUB_KEY
static intKEY_ENUMERATE_SUB_KEYS
static intKEY_EXECUTE
static intKEY_NOTIFY
static intKEY_QUERY_VALUE
static intKEY_READ
static intKEY_SET_VALUE
static intKEY_WOW64_32KEY
static intKEY_WOW64_64KEY
static intKEY_WRITE
static intREG_BINARY
static intREG_DWORD
static intREG_EXPAND_SZ
static intREG_MULTI_SZ
static intREG_QWORD
static intREG_SZ
Method Summary
static intclose(long key)
Close the specified Registry key.
static longcreate(int root, String name, int sam, long pool)
Create or open a Registry Key.
static intdeleteKey(int root, String name, boolean onlyIfEmpty)
Delete the Registry subkey
static intdeleteValue(long key, String name)
Delete the Registry value
static String[]enumKeys(long key)
Enumerate the Registry subkeys
static String[]enumValues(long key)
Enumerate the Registry values
static intgetSize(long key, String name)
Get the Registry key length.
static intgetType(long key, String name)
Get the Registry key type.
static String[]getValueA(long key, String name)
Get the Registry value for REG_MULTI_SZ
static byte[]getValueB(long key, String name)
Get the Registry value for REG_BINARY
static intgetValueI(long key, String name)
Get the Registry value for REG_DWORD
static longgetValueJ(long key, String name)
Get the Registry value for REG_QWORD or REG_DWORD
static StringgetValueS(long key, String name)
Get the Registry value for REG_SZ or REG_EXPAND_SZ
static longopen(int root, String name, int sam, long pool)
Opens the specified Registry Key.
static intsetValueA(long key, String name, String[] val)
Set the Registry value for REG_MULTI_SZ
static intsetValueB(long key, String name, byte[] val)
Set the Registry value for REG_BINARY
static intsetValueE(long key, String name, String val)
Set the Registry value for REG_EXPAND_SZ
static intsetValueI(long key, String name, int val)
Set the Registry value for REG_DWORD
static intsetValueJ(long key, String name, long val)
Set the Registry value for REG_QWORD
static intsetValueS(long key, String name, String val)
Set the Registry value for REG_SZ

Field Detail

HKEY_CLASSES_ROOT

public static final int HKEY_CLASSES_ROOT

HKEY_CURRENT_CONFIG

public static final int HKEY_CURRENT_CONFIG

HKEY_CURRENT_USER

public static final int HKEY_CURRENT_USER

HKEY_LOCAL_MACHINE

public static final int HKEY_LOCAL_MACHINE

HKEY_USERS

public static final int HKEY_USERS

KEY_ALL_ACCESS

public static final int KEY_ALL_ACCESS

KEY_CREATE_LINK

public static final int KEY_CREATE_LINK

KEY_CREATE_SUB_KEY

public static final int KEY_CREATE_SUB_KEY

KEY_ENUMERATE_SUB_KEYS

public static final int KEY_ENUMERATE_SUB_KEYS

KEY_EXECUTE

public static final int KEY_EXECUTE

KEY_NOTIFY

public static final int KEY_NOTIFY

KEY_QUERY_VALUE

public static final int KEY_QUERY_VALUE

KEY_READ

public static final int KEY_READ

KEY_SET_VALUE

public static final int KEY_SET_VALUE

KEY_WOW64_32KEY

public static final int KEY_WOW64_32KEY

KEY_WOW64_64KEY

public static final int KEY_WOW64_64KEY

KEY_WRITE

public static final int KEY_WRITE

REG_BINARY

public static final int REG_BINARY

REG_DWORD

public static final int REG_DWORD

REG_EXPAND_SZ

public static final int REG_EXPAND_SZ

REG_MULTI_SZ

public static final int REG_MULTI_SZ

REG_QWORD

public static final int REG_QWORD

REG_SZ

public static final int REG_SZ

Method Detail

close

public static int close(long key)
Close the specified Registry key.

Parameters: key The Registry key descriptor to close.

create

public static long create(int root, String name, int sam, long pool)
Create or open a Registry Key.

Parameters: name Registry Subkey to open root Root key, one of HKEY_* sam Access mask that specifies the access rights for the key. pool Pool used for native memory allocation

Returns: Opened Registry key

deleteKey

public static int deleteKey(int root, String name, boolean onlyIfEmpty)
Delete the Registry subkey

Parameters: root Root key, one of HKEY_* name Subkey to delete onlyIfEmpty If true will not delete a key if it contains any subkeys or values

Returns: If the function succeeds, the return value is 0

deleteValue

public static int deleteValue(long key, String name)
Delete the Registry value

Parameters: key The Registry key descriptor to use. name The name of the value to delete

Returns: If the function succeeds, the return value is 0

enumKeys

public static String[] enumKeys(long key)
Enumerate the Registry subkeys

Parameters: key The Registry key descriptor to use.

Returns: Array of all subkey names

enumValues

public static String[] enumValues(long key)
Enumerate the Registry values

Parameters: key The Registry key descriptor to use.

Returns: Array of all value names

getSize

public static int getSize(long key, String name)
Get the Registry key length.

Parameters: key The Registry key descriptor to use. name The name of the value to query

Returns: Value size or negative error value

getType

public static int getType(long key, String name)
Get the Registry key type.

Parameters: key The Registry key descriptor to use. name The name of the value to query

Returns: Value type or negative error value

getValueA

public static String[] getValueA(long key, String name)
Get the Registry value for REG_MULTI_SZ

Parameters: key The Registry key descriptor to use. name The name of the value to query

Returns: Registry key value

getValueB

public static byte[] getValueB(long key, String name)
Get the Registry value for REG_BINARY

Parameters: key The Registry key descriptor to use. name The name of the value to query

Returns: Registry key value

getValueI

public static int getValueI(long key, String name)
Get the Registry value for REG_DWORD

Parameters: key The Registry key descriptor to use. name The name of the value to query

Returns: Registry key value

getValueJ

public static long getValueJ(long key, String name)
Get the Registry value for REG_QWORD or REG_DWORD

Parameters: key The Registry key descriptor to use. name The name of the value to query

Returns: Registry key value

getValueS

public static String getValueS(long key, String name)
Get the Registry value for REG_SZ or REG_EXPAND_SZ

Parameters: key The Registry key descriptor to use. name The name of the value to query

Returns: Registry key value

open

public static long open(int root, String name, int sam, long pool)
Opens the specified Registry Key.

Parameters: name Registry Subkey to open root Root key, one of HKEY_* sam Access mask that specifies the access rights for the key. pool Pool used for native memory allocation

Returns: Opened Registry key

setValueA

public static int setValueA(long key, String name, String[] val)
Set the Registry value for REG_MULTI_SZ

Parameters: key The Registry key descriptor to use. name The name of the value to set val The the value to set

Returns: If the function succeeds, the return value is 0

setValueB

public static int setValueB(long key, String name, byte[] val)
Set the Registry value for REG_BINARY

Parameters: key The Registry key descriptor to use. name The name of the value to set val The the value to set

Returns: If the function succeeds, the return value is 0

setValueE

public static int setValueE(long key, String name, String val)
Set the Registry value for REG_EXPAND_SZ

Parameters: key The Registry key descriptor to use. name The name of the value to set val The the value to set

Returns: If the function succeeds, the return value is 0

setValueI

public static int setValueI(long key, String name, int val)
Set the Registry value for REG_DWORD

Parameters: key The Registry key descriptor to use. name The name of the value to set val The the value to set

Returns: If the function succeeds, the return value is 0

setValueJ

public static int setValueJ(long key, String name, long val)
Set the Registry value for REG_QWORD

Parameters: key The Registry key descriptor to use. name The name of the value to set val The the value to set

Returns: If the function succeeds, the return value is 0

setValueS

public static int setValueS(long key, String name, String val)
Set the Registry value for REG_SZ

Parameters: key The Registry key descriptor to use. name The name of the value to set val The the value to set

Returns: If the function succeeds, the return value is 0

Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.