Class DfRemoteRegistry

java.lang.Object
com.documentum.registry.DfRegistry
com.documentum.registry.DfRemoteRegistry
All Implemented Interfaces:
IDfRegistry

public class DfRemoteRegistry extends DfRegistry implements IDfRegistry
This class provides basic functionality for a platform independent registry storage and retrieval mechanisms. This class provides an array of values abstraction on top of the subclass simple (key,value) mechanism.

The basic structure of the registry framework is a nested heirarchy of keys with values. A key can have sub-keys or children keys. Each key has values which consist of pairs of names and data. Each value can have an associated type (e.g. String, binary, or integer) but it is not enforced directly.

This class is not exposed via COM since DfRegistryIniFile is not exposed via COM. Please see DfRegistryIniFile for more details.

Notes:

  • All functions, except openKey( ) and isValidKey( ), operate on the current open key. It can be set by calling openKey( ). All names and sub-keys are relative to the open key.
  • To set the open key to the root key, call openKey( "" ).
  • All values and sub-keys are case insensitive and whitespace characters are allowed. The registry delimiter is not allowed as a valid key name character. Here is an example of setting data with beginning and trailing whitespace: setStringValue( "somevalue", "\" this is some data \"")
  • Binary value operations use integer lists (arrays) instead of byte arrays due to the Java/COM data type mappings. When used each integer element will be truncated to the size of a byte.
  • Field Details

    • m_registryInfo

      protected HashMap m_registryInfo
    • m_openKey

      protected String m_openKey
    • m_rootKey

      protected String m_rootKey
  • Constructor Details

    • DfRemoteRegistry

      public DfRemoteRegistry(String rootKey)
  • Method Details

    • openRegistry

      public void openRegistry()
    • closeRegistry

      public void closeRegistry()
    • createKey

      public void createKey() throws DfException
      Specified by:
      createKey in interface IDfRegistry
      Specified by:
      createKey in class DfRegistry
      Throws:
      DfException
    • openKey

      public void openKey(String subKey) throws DfException
      Set the open key. The key is created if it does not exist. If there is an open key it is closed prior to opening a the new key.
      Specified by:
      openKey in interface IDfRegistry
      Specified by:
      openKey in class DfRegistry
      Parameters:
      subKey - a new or existing key in the registry storage.
      Throws:
      DfException - if the operation failed.
    • isSubKey

      public boolean isSubKey(String subKey) throws DfException
      Returns a flag specifying if the given sub-key is a sub-key of the open key.
      Specified by:
      isSubKey in interface IDfRegistry
      Specified by:
      isSubKey in class DfRegistry
      Parameters:
      subKey - the key to be found.
      Returns:
      a flag specifying if the given sub-key is an actual sub-key.
      Throws:
      DfException - if the operation failed.
    • deleteValue

      public void deleteValue(String name) throws DfException
      Deletes a value and the value's data under the open key.
      Specified by:
      deleteValue in interface IDfRegistry
      Specified by:
      deleteValue in class DfRegistry
      Parameters:
      name - the value to be deleted.
      Throws:
      DfException - if the operation failed.
    • deleteSubKey

      public void deleteSubKey(String subKey) throws DfException
      Deletes a sub-key of the open key.
      Specified by:
      deleteSubKey in interface IDfRegistry
      Specified by:
      deleteSubKey in class DfRegistry
      Parameters:
      subKey - the key to be deleted.
      Throws:
      DfException - if the operation failed.
    • deleteSubKeys

      public void deleteSubKeys() throws DfException
      Deletes the sub-keys under the open key. The open key is not deleted.
      Specified by:
      deleteSubKeys in interface IDfRegistry
      Specified by:
      deleteSubKeys in class DfRegistry
      Throws:
      DfException - if the operation failed.
    • closeKey

      public void closeKey() throws DfException
      Closes an open key freeing system resources.
      Specified by:
      closeKey in interface IDfRegistry
      Specified by:
      closeKey in class DfRegistry
      Throws:
      DfException - if the operation failed.
    • values

      public IDfList values() throws DfException
      Returns the value names of the open key. To get the value's data, call get[TYPE]Value( ).
      Specified by:
      values in interface IDfRegistry
      Specified by:
      values in class DfRegistry
      Returns:
      a list of String value names of the top-level key.
      Throws:
      DfException - if the operation failed.
    • subKeys

      public IDfList subKeys() throws DfException
      Returns the sub-keys of the open key.
      Specified by:
      subKeys in interface IDfRegistry
      Specified by:
      subKeys in class DfRegistry
      Returns:
      a list of String sub-key names of the top-level key.
      Throws:
      DfException - if the operation failed.
    • getIntValue

      public int getIntValue(String name) throws DfException
      Returns an integer representation of the data at the given value.
      Specified by:
      getIntValue in interface IDfRegistry
      Specified by:
      getIntValue in class DfRegistry
      Parameters:
      name - the value to lookup.
      Returns:
      an integer representation of the data at the given value.
      Throws:
      DfException - if the operation failed.
    • setIntValue

      public void setIntValue(String name, int data) throws DfException
      Sets the data field of the given value with integer data.
      Specified by:
      setIntValue in interface IDfRegistry
      Specified by:
      setIntValue in class DfRegistry
      Parameters:
      name - the value whose data is to be set.
      data - the data to set.
      Throws:
      DfException - if the operation failed.
    • getStringValue

      public String getStringValue(String name) throws DfException
      Returns a String representation of the data at the given value.
      Specified by:
      getStringValue in interface IDfRegistry
      Specified by:
      getStringValue in class DfRegistry
      Parameters:
      name - the value to lookup.
      Returns:
      a String representation of the data at the given value.
      Throws:
      DfException - if the operation failed.
    • setStringValue

      public void setStringValue(String name, String data) throws DfException
      Sets the data field of the given value with String data.
      Specified by:
      setStringValue in interface IDfRegistry
      Specified by:
      setStringValue in class DfRegistry
      Parameters:
      name - the value whose data is to be set.
      data - the data to set.
      Throws:
      DfException - if the operation failed.
    • setStringValues

      protected void setStringValues(RegistryEntriesHolder holder) throws DfException
      Specified by:
      setStringValues in class DfRegistry
      Throws:
      DfException
    • getBinaryValue

      public IDfList getBinaryValue(String name) throws DfException
      Returns a binary representation of the data at the given value.
      Specified by:
      getBinaryValue in interface IDfRegistry
      Specified by:
      getBinaryValue in class DfRegistry
      Parameters:
      name - the value to lookup.
      Returns:
      a list with a binary representation of the data at the given value.
      Throws:
      DfException - if the operation failed.
    • setBinaryValue

      public void setBinaryValue(String name, IDfList data) throws DfException
      Sets the data field of the given value with binary data.
      Specified by:
      setBinaryValue in interface IDfRegistry
      Specified by:
      setBinaryValue in class DfRegistry
      Parameters:
      name - the value whose data is to be set.
      data - the data to set. This must be a list of integers of which each will be truncated to byte size.
      Throws:
      DfException - if the operation failed.
    • getIntValues

      public IDfList getIntValues(String name) throws DfException
      Returns an integer array of the data at the given value.
      Specified by:
      getIntValues in interface IDfRegistry
      Overrides:
      getIntValues in class DfRegistry
      Parameters:
      name - the value to lookup.
      Returns:
      an integer list of the data at the given value.
      Throws:
      DfException - if the operation failed.
    • setIntValues

      public void setIntValues(String name, IDfList data) throws DfException
      Sets the data field of the given value with integer values. The value can be previously a non-array value or non-existent.
      Specified by:
      setIntValues in interface IDfRegistry
      Overrides:
      setIntValues in class DfRegistry
      Parameters:
      name - the value whose data is to be set.
      data - the data to be set. This must be a list of integers.
      Throws:
      DfException - if the operation failed.
    • getIntValueAt

      public int getIntValueAt(String name, int index) throws DfException
      Gets an integer value at a given index of a given key.
      Specified by:
      getIntValueAt in interface IDfRegistry
      Overrides:
      getIntValueAt in class DfRegistry
      Parameters:
      name - the key to look up into.
      index - zero-based index into the values array.
      Returns:
      the integer value at the given index.
      Throws:
      DfException - if the index is out of range or the operation failed.
    • setIntValueAt

      public void setIntValueAt(String name, int index, int data) throws DfException
      Sets an integer value at a given index of a given key. The index must be 0 if the value is not an array or does not exist. The index may be 1 + the current array size of the value causing this function to act as an append.
      Specified by:
      setIntValueAt in interface IDfRegistry
      Overrides:
      setIntValueAt in class DfRegistry
      Parameters:
      name - the value to set.
      index - zero-based index into the values array.
      data - the data to be set.
      Throws:
      DfException - if the index is out of range or the operation failed.
    • getStringValues

      public IDfList getStringValues(String name) throws DfException
      Returns a String array of the data at the given value.
      Specified by:
      getStringValues in interface IDfRegistry
      Overrides:
      getStringValues in class DfRegistry
      Parameters:
      name - the value to lookup.
      Returns:
      a String list of the data at the given value.
      Throws:
      DfException - if the operation failed.
    • setStringValues

      public void setStringValues(String name, IDfList data) throws DfException
      Sets the data field of the given value with String values.
      Specified by:
      setStringValues in interface IDfRegistry
      Overrides:
      setStringValues in class DfRegistry
      Parameters:
      name - the value whose data is to be set.
      data - the data to be set. This must be a list of Strings.
      Throws:
      DfException - if the operation failed.
    • getStringValueAt

      public String getStringValueAt(String name, int index) throws DfException
      Gets a String value at a given index of a given key.
      Specified by:
      getStringValueAt in interface IDfRegistry
      Overrides:
      getStringValueAt in class DfRegistry
      Parameters:
      name - the key to look up into.
      index - zero-based index into the values array.
      Returns:
      the String value at the given index.
      Throws:
      DfException - if the index is out of range or the operation failed.
    • setStringValueAt

      public void setStringValueAt(String name, int index, String data) throws DfException
      Sets a String value at a given index of a given key. The index must be 0 if the value is not an array or does not exist. The index may be 1 + the current array size of the value causing this function to act as an append.
      Specified by:
      setStringValueAt in interface IDfRegistry
      Overrides:
      setStringValueAt in class DfRegistry
      Parameters:
      name - the value to set.
      index - zero-based index into the values array.
      data - the data to be set.
      Throws:
      DfException - if the index is out of range or the operation failed.
    • getBinaryValues

      public IDfList getBinaryValues(String name) throws DfException
      Returns a binary array of the data at the given value.
      Specified by:
      getBinaryValues in interface IDfRegistry
      Overrides:
      getBinaryValues in class DfRegistry
      Parameters:
      name - the value to lookup.
      Returns:
      an integer list of integer lists each of which represent the binary data at the given value.
      Throws:
      DfException - if the operation failed.
    • setBinaryValues

      public void setBinaryValues(String name, IDfList data) throws DfException
      Sets the data field of the given value with binary values.
      Specified by:
      setBinaryValues in interface IDfRegistry
      Overrides:
      setBinaryValues in class DfRegistry
      Parameters:
      name - the value whose data is to be set.
      data - the data to be set. This must be a list of lists of integers.
      Throws:
      DfException - if the operation failed.
    • getBinaryValueAt

      public IDfList getBinaryValueAt(String name, int index) throws DfException
      Gets a binary value at a given index of a given key.
      Specified by:
      getBinaryValueAt in interface IDfRegistry
      Overrides:
      getBinaryValueAt in class DfRegistry
      Parameters:
      name - the key to look up into.
      index - zero-based index into the values array.
      Returns:
      a list representing the binary (byte) value at the given index.
      Throws:
      DfException - if the index is out of range or the operation failed.
    • setBinaryValueAt

      public void setBinaryValueAt(String name, int index, IDfList data) throws DfException
      Sets a binary value at a given index of a given key. The index must be 0 if the value is not an array or does not exist. The index may be 1 + the current array size of the value causing this function to act as an append.
      Specified by:
      setBinaryValueAt in interface IDfRegistry
      Overrides:
      setBinaryValueAt in class DfRegistry
      Parameters:
      name - the value to set.
      index - zero-based index into the values array.
      data - the data to be set. This must be a list of integers each of which will be truncated to a byte.
      Throws:
      DfException - if the index is out of range or the operation failed.
    • getValuesSize

      public int getValuesSize(String name) throws DfException
      Returns the number of elements in a key with an array of values.
      Specified by:
      getValuesSize in interface IDfRegistry
      Overrides:
      getValuesSize in class DfRegistry
      Parameters:
      name - the array name to get the size of.
      Returns:
      the number of elements in an array.
      Throws:
      DfException - if the name is not an array.
    • setValuesSize

      public void setValuesSize(String name, int size) throws DfException
      Set the size of an array name.
      Specified by:
      setValuesSize in interface IDfRegistry
      Overrides:
      setValuesSize in class DfRegistry
      Parameters:
      name - the array name to set the size of.
      size - the new size to set.
      Throws:
      DfException - if the operation failed.
    • isValueNamePresent

      public boolean isValueNamePresent(String name) throws DfException
      Specified by:
      isValueNamePresent in interface IDfRegistry
      Throws:
      DfException
    • assertFunc

      protected void assertFunc(String param) throws DfException
      Used to check for valid parameters to functions.
      Overrides:
      assertFunc in class DfRegistry
      Parameters:
      param - the string to test.
      Throws:
      DfException - if the parameter is invalid.
    • constructNewKeyStack

      protected String constructNewKeyStack(String subKey, Stack subKeyStack) throws DfException
      Throws:
      DfException
    • getValues

      protected IDfList getValues(String name) throws DfException
      Throws:
      DfException
    • setValues

      protected void setValues(String name, IDfList data) throws DfException
      Throws:
      DfException
    • recursiveRemoveSubKeys

      protected void recursiveRemoveSubKeys(String key) throws DfException
      Throws:
      DfException
    • acquireInterProcessLock

      public int acquireInterProcessLock()
      Description copied from class: DfRegistry
      Acquires the inter-process lock. Inter-process lock will be acquired only if the OS in not Windows.
      Overrides:
      acquireInterProcessLock in class DfRegistry
    • releaseInterProcessLock

      public int releaseInterProcessLock()
      Description copied from class: DfRegistry
      Releases the inter-process lock. Inter-process lock will be released only if the OS in not Windows.
      Overrides:
      releaseInterProcessLock in class DfRegistry
    • closeRootKey

      protected void closeRootKey() throws DfException
      Specified by:
      closeRootKey in class DfRegistry
      Throws:
      DfException