Class ComponentConfiguration
- java.lang.Object
-
- org.apache.bookkeeper.common.conf.ComponentConfiguration
-
- All Implemented Interfaces:
org.apache.commons.configuration.Configuration
- Direct Known Subclasses:
BookieConfiguration
public abstract class ComponentConfiguration extends java.lang.Object implements org.apache.commons.configuration.Configuration
Component Configuration.
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.String
DELIMITER
-
Constructor Summary
Constructors Modifier Constructor Description protected
ComponentConfiguration(org.apache.commons.configuration.CompositeConfiguration underlyingConf, java.lang.String componentPrefix)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addProperty(java.lang.String key, java.lang.Object value)
java.lang.String
asJson()
returns the string representation of json format of this config.void
clear()
void
clearProperty(java.lang.String key)
boolean
containsKey(java.lang.String key)
java.math.BigDecimal
getBigDecimal(java.lang.String key)
java.math.BigDecimal
getBigDecimal(java.lang.String key, java.math.BigDecimal defaultValue)
java.math.BigInteger
getBigInteger(java.lang.String key)
java.math.BigInteger
getBigInteger(java.lang.String key, java.math.BigInteger defaultValue)
boolean
getBoolean(java.lang.String key)
boolean
getBoolean(java.lang.String key, boolean defaultValue)
java.lang.Boolean
getBoolean(java.lang.String key, java.lang.Boolean defaultValue)
byte
getByte(java.lang.String key)
byte
getByte(java.lang.String key, byte defaultValue)
java.lang.Byte
getByte(java.lang.String key, java.lang.Byte defaultValue)
double
getDouble(java.lang.String key)
double
getDouble(java.lang.String key, double defaultValue)
java.lang.Double
getDouble(java.lang.String key, java.lang.Double defaultValue)
float
getFloat(java.lang.String key)
float
getFloat(java.lang.String key, float defaultValue)
java.lang.Float
getFloat(java.lang.String key, java.lang.Float defaultValue)
int
getInt(java.lang.String key)
int
getInt(java.lang.String key, int defaultValue)
java.lang.Integer
getInteger(java.lang.String key, java.lang.Integer defaultValue)
protected java.lang.String
getKeyName(java.lang.String name)
java.util.Iterator<java.lang.String>
getKeys()
java.util.Iterator<java.lang.String>
getKeys(java.lang.String prefix)
java.util.List<java.lang.Object>
getList(java.lang.String key)
java.util.List<java.lang.Object>
getList(java.lang.String key, java.util.List<?> defaultValue)
long
getLong(java.lang.String key)
long
getLong(java.lang.String key, long defaultValue)
java.lang.Long
getLong(java.lang.String key, java.lang.Long defaultValue)
java.util.Properties
getProperties(java.lang.String key)
java.lang.Object
getProperty(java.lang.String key)
short
getShort(java.lang.String key)
short
getShort(java.lang.String key, short defaultValue)
java.lang.Short
getShort(java.lang.String key, java.lang.Short defaultValue)
java.lang.String
getString(java.lang.String key)
java.lang.String
getString(java.lang.String key, java.lang.String defaultValue)
java.lang.String[]
getStringArray(java.lang.String key)
org.apache.commons.configuration.CompositeConfiguration
getUnderlyingConf()
boolean
isEmpty()
void
loadConf(java.net.URL confURL)
Load configuration from a givenconfURL
.protected void
loadConf(org.apache.commons.configuration.Configuration loadedConf)
void
setProperty(java.lang.String key, java.lang.Object value)
org.apache.commons.configuration.Configuration
subset(java.lang.String prefix)
void
validate()
-
-
-
Field Detail
-
DELIMITER
protected static final java.lang.String DELIMITER
- See Also:
- Constant Field Values
-
-
Method Detail
-
getKeyName
protected java.lang.String getKeyName(java.lang.String name)
-
getUnderlyingConf
public org.apache.commons.configuration.CompositeConfiguration getUnderlyingConf()
-
loadConf
public void loadConf(java.net.URL confURL) throws org.apache.commons.configuration.ConfigurationException
Load configuration from a givenconfURL
.- Parameters:
confURL
- the url points to the configuration.- Throws:
org.apache.commons.configuration.ConfigurationException
- when failed to load configuration.
-
loadConf
protected void loadConf(org.apache.commons.configuration.Configuration loadedConf)
-
validate
public void validate() throws org.apache.commons.configuration.ConfigurationException
- Throws:
org.apache.commons.configuration.ConfigurationException
-
subset
public org.apache.commons.configuration.Configuration subset(java.lang.String prefix)
- Specified by:
subset
in interfaceorg.apache.commons.configuration.Configuration
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interfaceorg.apache.commons.configuration.Configuration
-
containsKey
public boolean containsKey(java.lang.String key)
- Specified by:
containsKey
in interfaceorg.apache.commons.configuration.Configuration
-
addProperty
public void addProperty(java.lang.String key, java.lang.Object value)
- Specified by:
addProperty
in interfaceorg.apache.commons.configuration.Configuration
-
setProperty
public void setProperty(java.lang.String key, java.lang.Object value)
- Specified by:
setProperty
in interfaceorg.apache.commons.configuration.Configuration
-
clearProperty
public void clearProperty(java.lang.String key)
- Specified by:
clearProperty
in interfaceorg.apache.commons.configuration.Configuration
-
clear
public void clear()
- Specified by:
clear
in interfaceorg.apache.commons.configuration.Configuration
-
getProperty
public java.lang.Object getProperty(java.lang.String key)
- Specified by:
getProperty
in interfaceorg.apache.commons.configuration.Configuration
-
getKeys
public java.util.Iterator<java.lang.String> getKeys(java.lang.String prefix)
- Specified by:
getKeys
in interfaceorg.apache.commons.configuration.Configuration
-
getKeys
public java.util.Iterator<java.lang.String> getKeys()
- Specified by:
getKeys
in interfaceorg.apache.commons.configuration.Configuration
-
getProperties
public java.util.Properties getProperties(java.lang.String key)
- Specified by:
getProperties
in interfaceorg.apache.commons.configuration.Configuration
-
getBoolean
public boolean getBoolean(java.lang.String key)
- Specified by:
getBoolean
in interfaceorg.apache.commons.configuration.Configuration
-
getBoolean
public boolean getBoolean(java.lang.String key, boolean defaultValue)
- Specified by:
getBoolean
in interfaceorg.apache.commons.configuration.Configuration
-
getBoolean
public java.lang.Boolean getBoolean(java.lang.String key, java.lang.Boolean defaultValue)
- Specified by:
getBoolean
in interfaceorg.apache.commons.configuration.Configuration
-
getByte
public byte getByte(java.lang.String key)
- Specified by:
getByte
in interfaceorg.apache.commons.configuration.Configuration
-
getByte
public byte getByte(java.lang.String key, byte defaultValue)
- Specified by:
getByte
in interfaceorg.apache.commons.configuration.Configuration
-
getByte
public java.lang.Byte getByte(java.lang.String key, java.lang.Byte defaultValue)
- Specified by:
getByte
in interfaceorg.apache.commons.configuration.Configuration
-
getDouble
public double getDouble(java.lang.String key)
- Specified by:
getDouble
in interfaceorg.apache.commons.configuration.Configuration
-
getDouble
public double getDouble(java.lang.String key, double defaultValue)
- Specified by:
getDouble
in interfaceorg.apache.commons.configuration.Configuration
-
getDouble
public java.lang.Double getDouble(java.lang.String key, java.lang.Double defaultValue)
- Specified by:
getDouble
in interfaceorg.apache.commons.configuration.Configuration
-
getFloat
public float getFloat(java.lang.String key)
- Specified by:
getFloat
in interfaceorg.apache.commons.configuration.Configuration
-
getFloat
public float getFloat(java.lang.String key, float defaultValue)
- Specified by:
getFloat
in interfaceorg.apache.commons.configuration.Configuration
-
getFloat
public java.lang.Float getFloat(java.lang.String key, java.lang.Float defaultValue)
- Specified by:
getFloat
in interfaceorg.apache.commons.configuration.Configuration
-
getInt
public int getInt(java.lang.String key)
- Specified by:
getInt
in interfaceorg.apache.commons.configuration.Configuration
-
getInt
public int getInt(java.lang.String key, int defaultValue)
- Specified by:
getInt
in interfaceorg.apache.commons.configuration.Configuration
-
getInteger
public java.lang.Integer getInteger(java.lang.String key, java.lang.Integer defaultValue)
- Specified by:
getInteger
in interfaceorg.apache.commons.configuration.Configuration
-
getLong
public long getLong(java.lang.String key)
- Specified by:
getLong
in interfaceorg.apache.commons.configuration.Configuration
-
getLong
public long getLong(java.lang.String key, long defaultValue)
- Specified by:
getLong
in interfaceorg.apache.commons.configuration.Configuration
-
getLong
public java.lang.Long getLong(java.lang.String key, java.lang.Long defaultValue)
- Specified by:
getLong
in interfaceorg.apache.commons.configuration.Configuration
-
getShort
public short getShort(java.lang.String key)
- Specified by:
getShort
in interfaceorg.apache.commons.configuration.Configuration
-
getShort
public short getShort(java.lang.String key, short defaultValue)
- Specified by:
getShort
in interfaceorg.apache.commons.configuration.Configuration
-
getShort
public java.lang.Short getShort(java.lang.String key, java.lang.Short defaultValue)
- Specified by:
getShort
in interfaceorg.apache.commons.configuration.Configuration
-
getBigDecimal
public java.math.BigDecimal getBigDecimal(java.lang.String key)
- Specified by:
getBigDecimal
in interfaceorg.apache.commons.configuration.Configuration
-
getBigDecimal
public java.math.BigDecimal getBigDecimal(java.lang.String key, java.math.BigDecimal defaultValue)
- Specified by:
getBigDecimal
in interfaceorg.apache.commons.configuration.Configuration
-
getBigInteger
public java.math.BigInteger getBigInteger(java.lang.String key)
- Specified by:
getBigInteger
in interfaceorg.apache.commons.configuration.Configuration
-
getBigInteger
public java.math.BigInteger getBigInteger(java.lang.String key, java.math.BigInteger defaultValue)
- Specified by:
getBigInteger
in interfaceorg.apache.commons.configuration.Configuration
-
getString
public java.lang.String getString(java.lang.String key)
- Specified by:
getString
in interfaceorg.apache.commons.configuration.Configuration
-
getString
public java.lang.String getString(java.lang.String key, java.lang.String defaultValue)
- Specified by:
getString
in interfaceorg.apache.commons.configuration.Configuration
-
getStringArray
public java.lang.String[] getStringArray(java.lang.String key)
- Specified by:
getStringArray
in interfaceorg.apache.commons.configuration.Configuration
-
getList
public java.util.List<java.lang.Object> getList(java.lang.String key)
- Specified by:
getList
in interfaceorg.apache.commons.configuration.Configuration
-
getList
public java.util.List<java.lang.Object> getList(java.lang.String key, java.util.List<?> defaultValue)
- Specified by:
getList
in interfaceorg.apache.commons.configuration.Configuration
-
asJson
public java.lang.String asJson()
returns the string representation of json format of this config.- Returns:
- Throws:
JsonUtil.ParseJsonException
-
-