Class PropertyStore


  • public class PropertyStore
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String TABLE_PREFIX  
    • Constructor Summary

      Constructors 
      Constructor Description
      PropertyStore​(java.lang.String identifier)
      Initializes this object with a connection to the property store table named name.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void closeStore()
      Closes all resources open by this object.
      java.lang.Object getProperty​(java.lang.String key)
      Returns a value in the property store.
      java.util.List<java.lang.String> keys()
      Returns an Enumeration of the keys in the store.
      java.lang.Object removeProperty​(java.lang.String key)
      Removes a value in the property store.
      java.lang.Object setProperty​(java.lang.String key, java.lang.Object obj)
      Adds or updates a value in the property store.
      void updateProperty​(java.lang.String key, java.lang.Object obj, boolean createIfMissing)
      Update property value.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PropertyStore

        public PropertyStore​(java.lang.String identifier)
                      throws java.lang.Exception
        Initializes this object with a connection to the property store table named name.
        Parameters:
        identifier - The table name
        Throws:
        java.lang.Exception
    • Method Detail

      • closeStore

        public void closeStore()
                        throws java.lang.Exception
        Closes all resources open by this object.
        Throws:
        java.lang.Exception
      • setProperty

        public java.lang.Object setProperty​(java.lang.String key,
                                            java.lang.Object obj)
                                     throws java.lang.Exception
        Adds or updates a value in the property store. If an update is performed the old value is returned.
        Parameters:
        key - The unique identifier
        obj - The value
        Returns:
        The old value in case of an update
        Throws:
        java.lang.Exception
      • updateProperty

        public void updateProperty​(java.lang.String key,
                                   java.lang.Object obj,
                                   boolean createIfMissing)
                            throws java.lang.Exception
        Update property value. Can create the property if missing. This method is supposed to be faster than setProperty(String, Object) in cases where it is much more likely for the property to exist.
        Parameters:
        key - The unique identifier
        obj - The value
        createIfMissing - If true and the property is missing, it will be created.
        Throws:
        java.lang.Exception - If the value is null or an error occurs in the underlying store.
      • getProperty

        public java.lang.Object getProperty​(java.lang.String key)
                                     throws java.lang.Exception
        Returns a value in the property store.
        Parameters:
        key - The unique identifier
        Returns:
        Value in the store or NULL if not found.
        Throws:
        java.lang.Exception
      • removeProperty

        public java.lang.Object removeProperty​(java.lang.String key)
                                        throws java.lang.Exception
        Removes a value in the property store.
        Parameters:
        key - The unique identifier to remove.
        Returns:
        The old value or NULL if key were not in the table
        Throws:
        java.lang.Exception
      • keys

        public java.util.List<java.lang.String> keys()
                                              throws java.lang.Exception
        Returns an Enumeration of the keys in the store.
        Throws:
        java.lang.Exception