Package org.apache.tomcat.jni
Class Registry
- java.lang.Object
-
- org.apache.tomcat.jni.Registry
-
public class Registry extends java.lang.Object
Windows Registry support- Author:
- Mladen Turk
-
-
Field Summary
Fields Modifier and Type Field Description static int
HKEY_CLASSES_ROOT
static int
HKEY_CURRENT_CONFIG
static int
HKEY_CURRENT_USER
static int
HKEY_LOCAL_MACHINE
static int
HKEY_USERS
static int
KEY_ALL_ACCESS
static int
KEY_CREATE_LINK
static int
KEY_CREATE_SUB_KEY
static int
KEY_ENUMERATE_SUB_KEYS
static int
KEY_EXECUTE
static int
KEY_NOTIFY
static int
KEY_QUERY_VALUE
static int
KEY_READ
static int
KEY_SET_VALUE
static int
KEY_WOW64_32KEY
static int
KEY_WOW64_64KEY
static int
KEY_WRITE
static int
REG_BINARY
static int
REG_DWORD
static int
REG_EXPAND_SZ
static int
REG_MULTI_SZ
static int
REG_QWORD
static int
REG_SZ
-
Constructor Summary
Constructors Constructor Description Registry()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static int
close(long key)
Close the specified Registry key.static long
create(int root, java.lang.String name, int sam, long pool)
Create or open a Registry Key.static int
deleteKey(int root, java.lang.String name, boolean onlyIfEmpty)
Delete the Registry subkeystatic int
deleteValue(long key, java.lang.String name)
Delete the Registry valuestatic java.lang.String[]
enumKeys(long key)
Enumerate the Registry subkeysstatic java.lang.String[]
enumValues(long key)
Enumerate the Registry valuesstatic int
getSize(long key, java.lang.String name)
Get the Registry key length.static int
getType(long key, java.lang.String name)
Get the Registry key type.static java.lang.String[]
getValueA(long key, java.lang.String name)
Get the Registry value for REG_MULTI_SZstatic byte[]
getValueB(long key, java.lang.String name)
Get the Registry value for REG_BINARYstatic int
getValueI(long key, java.lang.String name)
Get the Registry value for REG_DWORDstatic long
getValueJ(long key, java.lang.String name)
Get the Registry value for REG_QWORD or REG_DWORDstatic java.lang.String
getValueS(long key, java.lang.String name)
Get the Registry value for REG_SZ or REG_EXPAND_SZstatic long
open(int root, java.lang.String name, int sam, long pool)
Opens the specified Registry Key.static int
setValueA(long key, java.lang.String name, java.lang.String[] val)
Set the Registry value for REG_MULTI_SZstatic int
setValueB(long key, java.lang.String name, byte[] val)
Set the Registry value for REG_BINARYstatic int
setValueE(long key, java.lang.String name, java.lang.String val)
Set the Registry value for REG_EXPAND_SZstatic int
setValueI(long key, java.lang.String name, int val)
Set the Registry value for REG_DWORDstatic int
setValueJ(long key, java.lang.String name, long val)
Set the Registry value for REG_QWORDstatic int
setValueS(long key, java.lang.String name, java.lang.String val)
Set the Registry value for REG_SZ
-
-
-
Field Detail
-
HKEY_CLASSES_ROOT
public static final int HKEY_CLASSES_ROOT
- See Also:
- Constant Field Values
-
HKEY_CURRENT_CONFIG
public static final int HKEY_CURRENT_CONFIG
- See Also:
- Constant Field Values
-
HKEY_CURRENT_USER
public static final int HKEY_CURRENT_USER
- See Also:
- Constant Field Values
-
HKEY_LOCAL_MACHINE
public static final int HKEY_LOCAL_MACHINE
- See Also:
- Constant Field Values
-
HKEY_USERS
public static final int HKEY_USERS
- See Also:
- Constant Field Values
-
KEY_ALL_ACCESS
public static final int KEY_ALL_ACCESS
- See Also:
- Constant Field Values
-
KEY_CREATE_LINK
public static final int KEY_CREATE_LINK
- See Also:
- Constant Field Values
-
KEY_CREATE_SUB_KEY
public static final int KEY_CREATE_SUB_KEY
- See Also:
- Constant Field Values
-
KEY_ENUMERATE_SUB_KEYS
public static final int KEY_ENUMERATE_SUB_KEYS
- See Also:
- Constant Field Values
-
KEY_EXECUTE
public static final int KEY_EXECUTE
- See Also:
- Constant Field Values
-
KEY_NOTIFY
public static final int KEY_NOTIFY
- See Also:
- Constant Field Values
-
KEY_QUERY_VALUE
public static final int KEY_QUERY_VALUE
- See Also:
- Constant Field Values
-
KEY_READ
public static final int KEY_READ
- See Also:
- Constant Field Values
-
KEY_SET_VALUE
public static final int KEY_SET_VALUE
- See Also:
- Constant Field Values
-
KEY_WOW64_64KEY
public static final int KEY_WOW64_64KEY
- See Also:
- Constant Field Values
-
KEY_WOW64_32KEY
public static final int KEY_WOW64_32KEY
- See Also:
- Constant Field Values
-
KEY_WRITE
public static final int KEY_WRITE
- See Also:
- Constant Field Values
-
REG_BINARY
public static final int REG_BINARY
- See Also:
- Constant Field Values
-
REG_DWORD
public static final int REG_DWORD
- See Also:
- Constant Field Values
-
REG_EXPAND_SZ
public static final int REG_EXPAND_SZ
- See Also:
- Constant Field Values
-
REG_MULTI_SZ
public static final int REG_MULTI_SZ
- See Also:
- Constant Field Values
-
REG_QWORD
public static final int REG_QWORD
- See Also:
- Constant Field Values
-
REG_SZ
public static final int REG_SZ
- See Also:
- Constant Field Values
-
-
Method Detail
-
create
public static long create(int root, java.lang.String name, int sam, long pool) throws Error
Create or open a Registry Key.- Parameters:
name
- Registry Subkey to openroot
- 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
- Throws:
Error
- An error occurred
-
open
public static long open(int root, java.lang.String name, int sam, long pool) throws Error
Opens the specified Registry Key.- Parameters:
name
- Registry Subkey to openroot
- 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
- Throws:
Error
- An error occurred
-
close
public static int close(long key)
Close the specified Registry key.- Parameters:
key
- The Registry key descriptor to close.- Returns:
- the operation status
-
getType
public static int getType(long key, java.lang.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
-
getValueI
public static int getValueI(long key, java.lang.String name) throws Error
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
- Throws:
Error
- An error occurred
-
getValueJ
public static long getValueJ(long key, java.lang.String name) throws Error
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
- Throws:
Error
- An error occurred
-
getSize
public static int getSize(long key, java.lang.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
-
getValueS
public static java.lang.String getValueS(long key, java.lang.String name) throws Error
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
- Throws:
Error
- An error occurred
-
getValueA
public static java.lang.String[] getValueA(long key, java.lang.String name) throws Error
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
- Throws:
Error
- An error occurred
-
getValueB
public static byte[] getValueB(long key, java.lang.String name) throws Error
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
- Throws:
Error
- An error occurred
-
setValueI
public static int setValueI(long key, java.lang.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 setval
- The the value to set- Returns:
- If the function succeeds, the return value is 0
-
setValueJ
public static int setValueJ(long key, java.lang.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 setval
- The the value to set- Returns:
- If the function succeeds, the return value is 0
-
setValueS
public static int setValueS(long key, java.lang.String name, java.lang.String val)
Set the Registry value for REG_SZ- Parameters:
key
- The Registry key descriptor to use.name
- The name of the value to setval
- The the value to set- Returns:
- If the function succeeds, the return value is 0
-
setValueE
public static int setValueE(long key, java.lang.String name, java.lang.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 setval
- The the value to set- Returns:
- If the function succeeds, the return value is 0
-
setValueA
public static int setValueA(long key, java.lang.String name, java.lang.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 setval
- The the value to set- Returns:
- If the function succeeds, the return value is 0
-
setValueB
public static int setValueB(long key, java.lang.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 setval
- The the value to set- Returns:
- If the function succeeds, the return value is 0
-
enumKeys
public static java.lang.String[] enumKeys(long key) throws Error
Enumerate the Registry subkeys- Parameters:
key
- The Registry key descriptor to use.- Returns:
- Array of all subkey names
- Throws:
Error
- An error occurred
-
enumValues
public static java.lang.String[] enumValues(long key) throws Error
Enumerate the Registry values- Parameters:
key
- The Registry key descriptor to use.- Returns:
- Array of all value names
- Throws:
Error
- An error occurred
-
deleteValue
public static int deleteValue(long key, java.lang.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
-
deleteKey
public static int deleteKey(int root, java.lang.String name, boolean onlyIfEmpty)
Delete the Registry subkey- Parameters:
root
- Root key, one of HKEY_*name
- Subkey to deleteonlyIfEmpty
- If true will not delete a key if it contains any subkeys or values- Returns:
- If the function succeeds, the return value is 0
-
-