Package com.linkedin.venice.utils
Class VeniceProperties
- java.lang.Object
-
- com.linkedin.venice.utils.VeniceProperties
-
- All Implemented Interfaces:
java.io.Serializable
public class VeniceProperties extends java.lang.Object implements java.io.Serializable
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description VeniceProperties()
Deprecated.Useempty()
VeniceProperties(java.util.Map<java.lang.CharSequence,java.lang.CharSequence> properties)
VeniceProperties(java.util.Properties properties)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description VeniceProperties
clipAndFilterNamespace(java.lang.String nameSpace)
This method looks for all properties that begins with the given namespace.boolean
containsKey(java.lang.String k)
static long
convertSizeFromLiteral(java.lang.String size)
static VeniceProperties
empty()
boolean
equals(java.lang.Object o)
java.util.Map<java.lang.String,java.lang.String>
getAsMap()
boolean
getBoolean(java.lang.String key)
boolean
getBoolean(java.lang.String key, boolean defaultValue)
boolean
getBooleanWithAlternative(java.lang.String preferredKey, java.lang.String altKey, boolean defaultValue)
double
getDouble(java.lang.String name)
double
getDouble(java.lang.String name, double defaultValue)
int
getInt(java.lang.String name)
int
getInt(java.lang.String name, int defaultValue)
java.util.List<java.lang.String>
getList(java.lang.String key)
java.util.List<java.lang.String>
getList(java.lang.String key, java.util.List<java.lang.String> defaultValue)
java.util.List<java.lang.String>
getListWithAlternative(java.lang.String preferredKey, java.lang.String altKey, java.util.List<java.lang.String> defaultValue)
long
getLong(java.lang.String name)
long
getLong(java.lang.String name, long defaultValue)
java.util.Map<java.lang.String,java.lang.String>
getMap(java.lang.String key)
java.util.Map<java.lang.String,java.lang.String>
getMap(java.lang.String key, java.util.Map<java.lang.String,java.lang.String> defaultValue)
java.util.Optional<java.lang.Integer>
getOptionalInt(java.lang.String name)
java.util.Properties
getPropertiesCopy()
long
getSizeInBytes(java.lang.String name)
long
getSizeInBytes(java.lang.String name, long defaultValue)
VeniceProperties
getStoreProperties(java.lang.String storeName)
Get store related properties.java.lang.String
getString(java.lang.String key)
java.lang.String
getString(java.lang.String key, java.lang.String defaultValue)
java.lang.String
getString(java.lang.String key, java.util.function.Supplier<java.lang.String> defaultValue)
java.lang.String
getStringWithAlternative(java.lang.String preferredKey, java.lang.String altKey)
java.lang.String
getStringWithAlternative(java.lang.String preferredKey, java.lang.String altKey, java.lang.String defaultValue)
int
hashCode()
boolean
isEmpty()
java.util.Set<java.lang.String>
keySet()
void
storeFlattened(java.io.File file)
Store all properties in a filevoid
storeFlattened(java.io.OutputStream out)
Store all properties to anOutputStream
java.util.Properties
toProperties()
java.lang.String
toString()
java.lang.String
toString(boolean prettyPrint)
-
-
-
Constructor Detail
-
VeniceProperties
@Deprecated public VeniceProperties()
Deprecated.Useempty()
-
VeniceProperties
public VeniceProperties(java.util.Properties properties)
-
VeniceProperties
public VeniceProperties(java.util.Map<java.lang.CharSequence,java.lang.CharSequence> properties)
-
-
Method Detail
-
empty
public static VeniceProperties empty()
-
getPropertiesCopy
public java.util.Properties getPropertiesCopy()
-
keySet
public java.util.Set<java.lang.String> keySet()
-
containsKey
public boolean containsKey(java.lang.String k)
-
clipAndFilterNamespace
public VeniceProperties clipAndFilterNamespace(java.lang.String nameSpace)
This method looks for all properties that begins with the given namespace. Once those properties are identified it removes the namespace and returns the properties. This enables support of dynamic kafka configurations. All Kafka Properties can follow an convention of namespace and the properties are extracted and supplied to the Kafka Producer/Consumer.- Parameters:
nameSpace
- namespace to look for- Returns:
- properties matches a namespace, but after removing the namespace.
-
getStoreProperties
public VeniceProperties getStoreProperties(java.lang.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(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
toString
public java.lang.String toString(boolean prettyPrint)
-
storeFlattened
public void storeFlattened(java.io.File file) throws java.io.IOException
Store all properties in a file- Parameters:
file
- to store into- Throws:
java.io.IOException
- If there is an error writing
-
storeFlattened
public void storeFlattened(java.io.OutputStream out) throws java.io.IOException
Store all properties to anOutputStream
- Parameters:
out
- The stream to write to- Throws:
java.io.IOException
- If there is an error writing
-
getString
public java.lang.String getString(java.lang.String key, java.util.function.Supplier<java.lang.String> defaultValue)
-
getString
public java.lang.String getString(java.lang.String key, java.lang.String defaultValue)
-
getStringWithAlternative
public java.lang.String getStringWithAlternative(java.lang.String preferredKey, java.lang.String altKey, java.lang.String defaultValue)
-
getString
public java.lang.String getString(java.lang.String key)
-
getStringWithAlternative
public java.lang.String getStringWithAlternative(java.lang.String preferredKey, java.lang.String altKey)
-
getBoolean
public boolean getBoolean(java.lang.String key, boolean defaultValue)
-
getBooleanWithAlternative
public boolean getBooleanWithAlternative(java.lang.String preferredKey, java.lang.String altKey, boolean defaultValue)
-
getBoolean
public boolean getBoolean(java.lang.String key)
-
getLong
public long getLong(java.lang.String name, long defaultValue)
-
getLong
public long getLong(java.lang.String name)
-
getInt
public int getInt(java.lang.String name, int defaultValue)
-
getInt
public int getInt(java.lang.String name)
-
getOptionalInt
public java.util.Optional<java.lang.Integer> getOptionalInt(java.lang.String name)
-
getDouble
public double getDouble(java.lang.String name, double defaultValue)
-
getDouble
public double getDouble(java.lang.String name)
-
getSizeInBytes
public long getSizeInBytes(java.lang.String name, long defaultValue)
-
getSizeInBytes
public long getSizeInBytes(java.lang.String name)
-
convertSizeFromLiteral
public static long convertSizeFromLiteral(java.lang.String size)
-
getList
public java.util.List<java.lang.String> getList(java.lang.String key, java.util.List<java.lang.String> defaultValue)
-
getListWithAlternative
public java.util.List<java.lang.String> getListWithAlternative(java.lang.String preferredKey, java.lang.String altKey, java.util.List<java.lang.String> defaultValue)
-
getList
public java.util.List<java.lang.String> getList(java.lang.String key)
-
getMap
public java.util.Map<java.lang.String,java.lang.String> getMap(java.lang.String key, java.util.Map<java.lang.String,java.lang.String> defaultValue)
-
getMap
public java.util.Map<java.lang.String,java.lang.String> getMap(java.lang.String key)
-
toProperties
public java.util.Properties toProperties()
-
isEmpty
public boolean isEmpty()
-
getAsMap
public java.util.Map<java.lang.String,java.lang.String> getAsMap()
-
-