Package alluxio.conf

Class AlluxioProperties


  • @NotThreadSafe
    public class AlluxioProperties
    extends java.lang.Object
    Provides the source of truth of property values and a unified abstraction to put and get properties, hiding the difference of accessing user-specified properties, the default properties (known at construction time) and the extension properties (known at runtime). This class is supposed to handle the ordering and priority of properties from different sources, whereas the Configuration class is supposed to handle the type conversion on top of the source of truth of the properties. For a given property key, the order of preference of its value is (from highest to lowest) (1) runtime config (2) system properties, (3) properties in the specified file (site-properties), (4) default property values.
    • Constructor Detail

      • AlluxioProperties

        public AlluxioProperties()
        Constructs a new instance of Alluxio properties.
      • AlluxioProperties

        public AlluxioProperties​(AlluxioProperties alluxioProperties)
        Parameters:
        alluxioProperties - properties to copy
    • Method Detail

      • get

        @Nullable
        public java.lang.Object get​(PropertyKey key)
        Parameters:
        key - the key to query
        Returns:
        the value, or null if the key has no value set
      • clear

        public void clear()
        Clears all existing user-specified properties.
      • put

        public void put​(PropertyKey key,
                        java.lang.Object value,
                        Source source)
        Puts the key value pair specified by users.
        Parameters:
        key - key to put
        value - value to put
        source - the source of this value for the key
      • set

        public void set​(PropertyKey key,
                        java.lang.Object value)
        Puts the key value pair specified by users.
        Parameters:
        key - key to put
        value - value to put
      • merge

        public void merge​(java.util.Map<?,​?> properties,
                          Source source)
        Merges the current configuration properties with new properties. If a property exists both in the new and current configuration, the one from the new configuration wins if its priority is higher or equal than the existing one.
        Parameters:
        properties - the source Properties to be merged
        source - the source of the the properties (e.g., system property, default and etc)
      • remove

        public void remove​(PropertyKey key)
        Remove the value set for key.
        Parameters:
        key - key to remove
      • isSet

        public boolean isSet​(PropertyKey key)
        Checks if there is a value set for the given key.
        Parameters:
        key - the key to check
        Returns:
        true if there is value for the key, false otherwise
      • isSetByUser

        public boolean isSetByUser​(PropertyKey key)
        Parameters:
        key - the key to check
        Returns:
        true if there is a value for the key set by user, false otherwise even when there is a default value for the key
      • entrySet

        public java.util.Set<java.util.Map.Entry<PropertyKey,​java.lang.Object>> entrySet()
        Returns:
        the entry set of all Alluxio property key and value pairs (value can be null)
      • keySet

        public java.util.Set<PropertyKey> keySet()
        Returns:
        the key set of all Alluxio property
      • userKeySet

        public java.util.Set<PropertyKey> userKeySet()
        Returns:
        the key set of user set properties
      • forEach

        public void forEach​(java.util.function.BiConsumer<? super PropertyKey,​? super java.lang.Object> action)
        Iterates over all the key value pairs and performs the given action.
        Parameters:
        action - the operation to perform on each key value pair
      • copy

        public AlluxioProperties copy()
        Makes a copy of the backing properties and returns them in a new object.
        Returns:
        a copy of the current properties
      • setSource

        public void setSource​(PropertyKey key,
                              Source source)
        Sets the source for a given key.
        Parameters:
        key - property key
        source - the source
      • getSource

        public Source getSource​(PropertyKey key)
        Parameters:
        key - property key
        Returns:
        the source of the key
      • hash

        public java.lang.String hash()
        Returns:
        the current hash of the properties