com.moyosoft.connector.registry
Class RegistryKey

java.lang.Object
  |
  +--com.moyosoft.connector.registry.RegistryKey

public class RegistryKey
extends java.lang.Object


Method Summary
 void close()
          Closes this registry key.
 RegistryKey createKey(java.lang.String subKey)
          Creates the specified sub-key in this registry key.
 void deleteKey(java.lang.String subKey)
          Deletes the specified sub-key from this registry key.
 void deleteValue(java.lang.String valueName)
          Deletes the specified value from this registry key.
 void deleteValue(java.lang.String subKey, java.lang.String valueName)
          Deletes the specified value in the specified sub-key of this registry key.
 void finalize()
           
 void flush()
          Writes all the attributes of this registry key into the registry.
 byte[] getBinaryValue(java.lang.String valueName)
          Returns the specified Binary value from this registry key.
 int getIntegerValue(java.lang.String valueName)
          Returns the specified Integer value from this registry key.
 java.lang.String getStringValue(java.lang.String valueName)
          Returns the specified String value from this registry key.
 java.util.Iterator getSubKeys()
          Returns an iterator of all sub keys' names.
 RegistryValue getValue(java.lang.String valueName)
          Returns the specified value from this registry key.
 RegistryValue getValue(java.lang.String subKey, java.lang.String valueName)
          Returns the specified value from the specified sub-key of this registry key.
 java.lang.String getValueAsString(java.lang.String valueName)
          Returns the specified value from this registry key formatted as a string.
 java.util.Iterator getValues()
          Returns an iterator of all values' names in this registry key.
 RegistryKey openKey(java.lang.String subKey)
          Opens the specified sub-key of this registry key.
 void setValue(java.lang.String valueName, byte[] binaryData)
          Sets the specified Binary data value in this registry key.
 void setValue(java.lang.String valueName, int value)
          Sets the specified Integer value in this registry key.
 void setValue(java.lang.String valueName, RegistryValue value)
          Sets the specified value in this registry key.
 void setValue(java.lang.String valueName, java.lang.String value)
          Sets the specified String value in this registry key.
 void setValue(java.lang.String subKey, java.lang.String valueName, RegistryValue value)
          Sets the specified value in the specified sub-key of this registry key.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

openKey

public RegistryKey openKey(java.lang.String subKey)
                    throws RegistryException
Opens the specified sub-key of this registry key. If this method returns successfully, the returned RegistryKey object has to be closed using the method RegistryKey.close().

Parameters:
subKey - the sub-key to be opened.
Throws:
RegistryException - if this key has been closed or the specified sub-key doens't exist or any other unexpected error occurs.

createKey

public RegistryKey createKey(java.lang.String subKey)
                      throws RegistryException
Creates the specified sub-key in this registry key. If the sub-key already exists, it is simply opened. If this method returns successfully, the returned RegistryKey object has to be closed using the method RegistryKey.close().

Parameters:
subKey - the sub-key to be created or opened.
Throws:
RegistryException - if this key has been closed or any other error occurs.

deleteKey

public void deleteKey(java.lang.String subKey)
               throws RegistryException
Deletes the specified sub-key from this registry key.

Parameters:
subKey - the sub-key to be deleted.
Throws:
RegistryException - if this key has been closed or any other error occurs.

deleteValue

public void deleteValue(java.lang.String subKey,
                        java.lang.String valueName)
                 throws RegistryException
Deletes the specified value in the specified sub-key of this registry key.

Is equivalent to:
openKey(subKey).deleteValue(valueName);

Parameters:
subKey - the sub-key where the value is stored.
valueName - the value name to be deleted.
Throws:
RegistryException - if this key has been closed or any other error occurs.

deleteValue

public void deleteValue(java.lang.String valueName)
                 throws RegistryException
Deletes the specified value from this registry key.

Parameters:
valueName - the value name to be deleted.
Throws:
RegistryException - if this key has been closed or any other error occurs.

getSubKeys

public java.util.Iterator getSubKeys()
                              throws RegistryException
Returns an iterator of all sub keys' names. The iterator returns java.lang.String objects.

Throws:
RegistryException - if this key has been closed or any other error occurs.

getValues

public java.util.Iterator getValues()
                             throws RegistryException
Returns an iterator of all values' names in this registry key. The iterator returns java.lang.String objects.

Throws:
RegistryException - if this key has been closed or any other error occurs.

getValue

public RegistryValue getValue(java.lang.String subKey,
                              java.lang.String valueName)
                       throws RegistryException
Returns the specified value from the specified sub-key of this registry key.

Is equivalent to:
openKey(subKey).getValue(valueName);

Parameters:
subKey - the sub-key where the value is stored.
valueName - the name of the value to be returned.
Throws:
RegistryException - if this key has been closed or any other error occurs.

getValue

public RegistryValue getValue(java.lang.String valueName)
                       throws RegistryException
Returns the specified value from this registry key.

Parameters:
valueName - the name of the value to be returned.
Throws:
RegistryException - if this key has been closed or any other error occurs.

getValueAsString

public java.lang.String getValueAsString(java.lang.String valueName)
                                  throws RegistryException
Returns the specified value from this registry key formatted as a string.

Is equivalent to:
getValue(valueName).getAsString();

Parameters:
valueName - the name of the value to be returned.
Throws:
RegistryException - if this key has been closed or any other error occurs.

getStringValue

public java.lang.String getStringValue(java.lang.String valueName)
                                throws RegistryException
Returns the specified String value from this registry key. The value type has to be REG_SZ, otherwise this method returns null.

Is equivalent to:
getValue(valueName).getString();

Parameters:
valueName - the name of the value to be returned.
Throws:
RegistryException - if this key has been closed or any other error occurs.

getIntegerValue

public int getIntegerValue(java.lang.String valueName)
                    throws RegistryException
Returns the specified Integer value from this registry key. The value type has to be REG_DWORD, otherwise this method returns 0.

Is equivalent to:
getValue(valueName).getInteger();

Parameters:
valueName - the name of the value to be returned.
Throws:
RegistryException - if this key has been closed or any other error occurs.

getBinaryValue

public byte[] getBinaryValue(java.lang.String valueName)
                      throws RegistryException
Returns the specified Binary value from this registry key. The value type has to be REG_BINARY, otherwise this method returns null.

Is equivalent to:
getValue(valueName).getBinaryData();

Parameters:
valueName - the name of the value to be returned.
Throws:
RegistryException - if this key has been closed or any other error occurs.

setValue

public void setValue(java.lang.String valueName,
                     RegistryValue value)
              throws RegistryException
Sets the specified value in this registry key.

Parameters:
valueName - the name of the value to be set.
value - the value to be set.
Throws:
RegistryException - if this key has been closed or any other error occurs.

setValue

public void setValue(java.lang.String subKey,
                     java.lang.String valueName,
                     RegistryValue value)
              throws RegistryException
Sets the specified value in the specified sub-key of this registry key.

Is equivalent to:
openKey(subKey).setValue(valueName, value);

Parameters:
subKey - the sub-key where the value will be stored.
valueName - the name of the value to be set.
value - the value to be set.
Throws:
RegistryException - if this key has been closed or any other error occurs.

setValue

public void setValue(java.lang.String valueName,
                     java.lang.String value)
              throws RegistryException
Sets the specified String value in this registry key. The type of the value is set to REG_SZ.

Parameters:
valueName - the name of the value to be set.
value - the value to be set.
Throws:
RegistryException - if this key has been closed or any other error occurs.

setValue

public void setValue(java.lang.String valueName,
                     int value)
              throws RegistryException
Sets the specified Integer value in this registry key. The type of the value is set to REG_DWORD.

Parameters:
valueName - the name of the value to be set.
value - the value to be set.
Throws:
RegistryException - if this key has been closed or any other error occurs.

setValue

public void setValue(java.lang.String valueName,
                     byte[] binaryData)
              throws RegistryException
Sets the specified Binary data value in this registry key. The type of the value is set to REG_BINARY.

Parameters:
valueName - the name of the value to be set.
binaryData - the value to be set.
Throws:
RegistryException - if this key has been closed or any other error occurs.

flush

public void flush()
           throws RegistryException
Writes all the attributes of this registry key into the registry.

Throws:
RegistryException - if this key has been closed or any other error occurs.

close

public void close()
           throws RegistryException
Closes this registry key.

RegistryException

finalize

public void finalize()
Overrides:
finalize in class java.lang.Object