Class VeniceProperties

java.lang.Object
com.linkedin.venice.utils.VeniceProperties
All Implemented Interfaces:
Serializable

public class VeniceProperties extends Object implements Serializable
See Also:
  • Constructor Details

  • Method Details

    • empty

      public static VeniceProperties empty()
    • getPropertiesCopy

      public Properties getPropertiesCopy()
    • keySet

      public Set<String> keySet()
    • containsKey

      public boolean containsKey(String k)
    • clipAndFilterNamespace

      public VeniceProperties clipAndFilterNamespace(String nameSpace)
      Extracts properties that begin with the specified namespace.

      This method identifies all properties that start with the given namespace, removes the namespace prefix, and returns the filtered properties.

      This enables support for dynamic configurations (e.g., required by Pub/Sub clients). All properties following a namespace-based convention can be extracted and used by various adapters, such as Pub/Sub Producers or Consumers.

      Parameters:
      nameSpace - The namespace to filter properties by.
      Returns:
      A VeniceProperties instance containing properties with the namespace removed.
    • clipAndFilterNamespace

      public VeniceProperties clipAndFilterNamespace(Set<String> namespaces)
      Extracts properties that begin with any of the specified namespaces.

      This method identifies all properties that start with one of the provided namespaces, removes the matching namespace prefix, and returns the filtered properties.

      This supports dynamic configurations for various use cases, including Pub/Sub clients, messaging systems, and other configurable components. By following a namespace-based convention, different configurations can be extracted and supplied to respective adapters.

      Example structure:

      
       "pubsub.kafka.bootstrap.servers"
       "pubsub.pulsar.service.url"
       "pubsub.warpstream.bucket.url"
       

      Using this method with namespaces {"pubsub.kafka.", "pubsub.pulsar."} would result in:

      
       "bootstrap.servers"
       "service.url"
       
      Parameters:
      namespaces - A set of namespaces to filter properties by.
      Returns:
      A VeniceProperties instance containing properties with the matching namespaces removed.
    • getStoreProperties

      public VeniceProperties getStoreProperties(String storeName)
      Get store related properties. properties that do not begin with store- are considered common to all stores. out of properties that begins with store- , only properties that matches the store name are related to current store. These matching properties override the base properties if they are present.
      Parameters:
      storeName - name of the store
      Returns:
      Properties for the current store.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toString

      public String toString(boolean prettyPrint)
    • storeFlattened

      public void storeFlattened(File file) throws IOException
      Store all properties in a file
      Parameters:
      file - to store into
      Throws:
      IOException - If there is an error writing
    • storeFlattened

      public void storeFlattened(OutputStream out) throws IOException
      Store all properties to an OutputStream
      Parameters:
      out - The stream to write to
      Throws:
      IOException - If there is an error writing
    • getString

      public String getString(String key, Supplier<String> defaultValue)
    • getString

      public String getString(String key, String defaultValue)
    • getStringWithAlternative

      public String getStringWithAlternative(String preferredKey, String altKey, String defaultValue)
    • getString

      public String getString(String key)
    • getStringWithAlternative

      public String getStringWithAlternative(String preferredKey, String altKey)
    • getBoolean

      public boolean getBoolean(String key, boolean defaultValue)
    • getBooleanWithAlternative

      public boolean getBooleanWithAlternative(String preferredKey, String altKey, boolean defaultValue)
    • getBoolean

      public boolean getBoolean(String key)
    • getLong

      public long getLong(String name, long defaultValue)
    • getLong

      public long getLong(String name)
    • getInt

      public int getInt(String name, int defaultValue)
    • getInt

      public int getInt(String name)
    • getOptionalInt

      public Optional<Integer> getOptionalInt(String name)
    • getDouble

      public double getDouble(String name, double defaultValue)
    • getDouble

      public double getDouble(String name)
    • getSizeInBytes

      public long getSizeInBytes(String name, long defaultValue)
    • getSizeInBytes

      public long getSizeInBytes(String name)
    • convertSizeFromLiteral

      public static long convertSizeFromLiteral(String size)
    • getList

      public List<String> getList(String key, List<String> defaultValue)
    • getListWithAlternative

      public List<String> getListWithAlternative(String preferredKey, String altKey, List<String> defaultValue)
    • getList

      public List<String> getList(String key)
    • getMap

      public Map<String,String> getMap(String key, Map<String,String> defaultValue)
    • getMap

      public Map<String,String> getMap(String key)
    • toProperties

      public Properties toProperties()
    • isEmpty

      public boolean isEmpty()
    • getAsMap

      public Map<String,String> getAsMap()