public class RegistryImpl extends Object
Modifier and Type | Field and Description |
---|---|
private int |
currentRoot |
private static String |
DEFAULT_PLACEHOLDER |
private boolean |
doLogging |
static int |
HKEY_CLASSES_ROOT |
static int |
HKEY_CURRENT_CONFIG |
static int |
HKEY_CURRENT_USER |
static int |
HKEY_DYN_DATA |
static int |
HKEY_LOCAL_MACHINE |
static int |
HKEY_PERFORMANCE_DATA |
static int |
HKEY_USERS |
private List |
logging |
Constructor and Description |
---|
RegistryImpl()
Creates a new empty RegistryImpl object.
|
Modifier and Type | Method and Description |
---|---|
void |
activateLogging()
Activates logging.
|
void |
addLoggingInfo(List info)
Adds copies of the contents of the given list of RegistryLogItems to the existent internal
logging list.
|
void |
createKey(int root,
String key)
Creates the given key under the given root.
|
void |
createKey(String key)
Creates the given key under the current root.
|
private void |
createKeyN(int root,
String key) |
void |
deleteKey(String key)
Deletes a key under the current root if exist and it is empty, else throw an exception.
|
void |
deleteKeyIfEmpty(int root,
String key)
Deletes a key if it is empty, else do nothing.
|
void |
deleteKeyIfEmpty(String key)
Deletes a key under the current root if it is empty, else do nothing.
|
private void |
deleteKeyL(int root,
String key)
Deletes a key with logging.
|
private void |
deleteKeyN(int root,
String key) |
void |
deleteValue(String key,
String value)
Deletes a value.
|
private void |
deleteValueL(int root,
String key,
String value)
Deletes a value with logging.
|
private void |
deleteValueN(int root,
String key,
String value) |
private boolean |
exist(int root,
String key) |
List |
getLoggingInfo()
Returns a copy of the colected logging informations.
|
int |
getRoot()
Returns current root.
|
private int |
getSubkeyCount(int root,
String key) |
private String |
getSubkeyName(int root,
String key,
int index) |
private String[] |
getSubkeyNames(int root,
String key) |
String[] |
getSubkeys(String key)
Returns all sub keys under the given key which is under the current root.
|
private RegDataContainer |
getValue(int root,
String key,
String value) |
RegDataContainer |
getValue(String key,
String value)
Returns the value of the given value name as RegDataContainer.
|
Object |
getValueAsObject(String key,
String value)
Returns the value of the given value name as Object.
|
private int |
getValueCount(int root,
String key) |
private String |
getValueName(int root,
String key,
int index) |
private String[] |
getValueNames(int root,
String key) |
String[] |
getValueNames(String key)
Returns all value names under the given key which is under the current root.
|
private int |
getValueType(int root,
String key,
String value) |
private boolean |
isKeyEmpty(int root,
String key) |
boolean |
keyExist(int root,
String key)
Returns whether the given key under the given root exist or not.
|
boolean |
keyExist(String key)
Returns whether the given key under the current root exist or not.
|
private void |
log(RegistryLogItem item)
Adds the given item to the beginning of the logging list if logging is enabled, else do
nothing.
|
private void |
logAtEnd(RegistryLogItem item)
Adds the given item to the end of the logging list if logging is enabled, else do nothing.
|
void |
resetLogging()
Creates a new (empty) logging list and activates logging.
|
void |
rewind()
Rewinds all logged actions.
|
void |
setLoggingInfo(List info)
Copies the contents of the given list of RegistryLogItems to a newly created internal logging
list.
|
void |
setRoot(int i)
Sets the root id to the given value.
|
void |
setValue(int root,
String key,
String value,
RegDataContainer contents)
Sets the given contents to the given registry value.
|
void |
setValue(String key,
String value,
byte[] contents)
Sets the given contents to the given registry value.
|
void |
setValue(String key,
String value,
long contents)
Sets the given contents to the given registry value.
|
void |
setValue(String key,
String value,
RegDataContainer contents)
Sets the given contents to the given registry value under current root.
|
void |
setValue(String key,
String value,
String contents)
Sets the given contents to the given registry value.
|
void |
setValue(String key,
String value,
String[] contents)
Sets the given contents to the given registry value.
|
private void |
setValueN(int root,
String key,
String value,
RegDataContainer contents) |
private void |
setValueR(int root,
String key,
String value,
RegDataContainer contents)
Sets the given contents to the given registry value.
|
void |
suspendLogging()
Suspends logging.
|
boolean |
valueExist(String key,
String value)
Returns whether the given value exist under the current root or not.
|
public static final int HKEY_CLASSES_ROOT
public static final int HKEY_CURRENT_USER
public static final int HKEY_LOCAL_MACHINE
public static final int HKEY_USERS
public static final int HKEY_PERFORMANCE_DATA
public static final int HKEY_CURRENT_CONFIG
public static final int HKEY_DYN_DATA
private static final String DEFAULT_PLACEHOLDER
private int currentRoot
private boolean doLogging
public RegistryImpl()
public int getRoot()
public void setRoot(int i)
i
- root id to be setpublic RegDataContainer getValue(String key, String value) throws NativeLibException
key
- key of the registry entryvalue
- value name of the registry entryNativeLibException
public Object getValueAsObject(String key, String value) throws NativeLibException
key
- key of the registry entryvalue
- value name of the registry entryNativeLibException
public String[] getSubkeys(String key) throws NativeLibException
key
- key for which the sub keys should be detectedNativeLibException
public String[] getValueNames(String key) throws NativeLibException
key
- key for which the values should be detectedNativeLibException
public void createKey(String key) throws NativeLibException
key
- key to be createdNativeLibException
public void createKey(int root, String key) throws NativeLibException
key
- key to be createdNativeLibException
public boolean keyExist(String key) throws NativeLibException
key
- key to be testedNativeLibException
public boolean keyExist(int root, String key) throws NativeLibException
root
- to be usedkey
- key to be testedNativeLibException
public boolean valueExist(String key, String value) throws NativeLibException
key
- key of the value for which should be testedvalue
- value to be testedNativeLibException
public void setValue(String key, String value, String contents) throws NativeLibException
key
- the registry key which should be used or createdvalue
- the registry value into which the contents should be setcontents
- the contents for the valueNativeLibException
public void setValue(String key, String value, String[] contents) throws NativeLibException
key
- the registry key which should be used or createdvalue
- the registry value into which the contents should be setcontents
- the contents for the valueNativeLibException
public void setValue(String key, String value, byte[] contents) throws NativeLibException
key
- the registry key which should be used or createdvalue
- the registry value into which the contents should be setcontents
- the contents for the valueNativeLibException
public void setValue(String key, String value, long contents) throws NativeLibException
key
- the registry key which should be used or createdvalue
- the registry value into which the contents should be setcontents
- the contents for the valueNativeLibException
public void setValue(String key, String value, RegDataContainer contents) throws NativeLibException
key
- the registry key which should be used or createdvalue
- the registry value into which the contents should be setcontents
- the contents for the valueNativeLibException
public void setValue(int root, String key, String value, RegDataContainer contents) throws NativeLibException
root
- id for the root of the keykey
- the registry key which should be used or createdvalue
- the registry value into which the contents should be setcontents
- the contents for the valueNativeLibException
public void deleteKey(String key) throws NativeLibException
key
- key to be deletedNativeLibException
public void deleteKeyIfEmpty(String key) throws NativeLibException
key
- key to be deletedNativeLibException
public void deleteKeyIfEmpty(int root, String key) throws NativeLibException
root
- id for the root of the keykey
- key to be deletedNativeLibException
public void deleteValue(String key, String value) throws NativeLibException
key
- key of the value which should be deletedvalue
- value name to be deletedNativeLibException
private void deleteKeyL(int root, String key) throws NativeLibException
root
- id for the root of the keykey
- key to be deletedNativeLibException
private void deleteValueL(int root, String key, String value) throws NativeLibException
root
- id for the root of the keykey
- key of the value which should be deletedvalue
- value name to be deletedNativeLibException
public void rewind() throws IllegalArgumentException, NativeLibException
private void setValueR(int root, String key, String value, RegDataContainer contents) throws NativeLibException
root
- id for the root of the keykey
- the registry key which should be used or createdvalue
- the registry value into which the contents should be setcontents
- the contents for the valueNativeLibException
private boolean exist(int root, String key) throws NativeLibException
NativeLibException
private void createKeyN(int root, String key) throws NativeLibException
NativeLibException
private void setValueN(int root, String key, String value, RegDataContainer contents) throws NativeLibException
NativeLibException
private int getValueType(int root, String key, String value) throws NativeLibException
NativeLibException
private RegDataContainer getValue(int root, String key, String value) throws NativeLibException
NativeLibException
private void deleteValueN(int root, String key, String value) throws NativeLibException
NativeLibException
private void deleteKeyN(int root, String key) throws NativeLibException
NativeLibException
private boolean isKeyEmpty(int root, String key) throws NativeLibException
NativeLibException
private int getSubkeyCount(int root, String key) throws NativeLibException
NativeLibException
private int getValueCount(int root, String key) throws NativeLibException
NativeLibException
private String getSubkeyName(int root, String key, int index) throws NativeLibException
NativeLibException
private String getValueName(int root, String key, int index) throws NativeLibException
NativeLibException
private String[] getSubkeyNames(int root, String key) throws NativeLibException
NativeLibException
private String[] getValueNames(int root, String key) throws NativeLibException
NativeLibException
public void resetLogging()
public void suspendLogging()
public void activateLogging()
public List getLoggingInfo()
public void setLoggingInfo(List info)
public void addLoggingInfo(List info)
private void log(RegistryLogItem item)
item
- private void logAtEnd(RegistryLogItem item)
item
- WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses