public class ZKConfig extends Object
setProperty(String, String)
.Modifier and Type | Field and Description |
---|---|
static String |
JGSS_NATIVE |
static String |
JUTE_MAXBUFFER |
static String |
KINIT_COMMAND
Path to a kinit binary: "zookeeper.kinit".
|
Constructor and Description |
---|
ZKConfig()
properties, which are common to both client and server, are initialized
from system properties
|
ZKConfig(File configFile) |
ZKConfig(String configPath) |
Modifier and Type | Method and Description |
---|---|
void |
addConfiguration(File configFile)
Add a configuration resource.
|
void |
addConfiguration(String configPath)
Add a configuration resource.
|
boolean |
getBoolean(String key)
Returns
true if and only if the property named by the argument
exists and is equal to the string "true" . |
boolean |
getBoolean(String key,
boolean defaultValue)
Get the value of the
key property as a boolean . |
int |
getInt(String key,
int defaultValue)
Get the value of the
key property as an int . |
String |
getJaasConfKey()
Return the value of "java.security.auth.login.config" system property
|
String |
getProperty(String key)
Get the property value
|
String |
getProperty(String key,
String defaultValue)
Get the property value, if it is null return default value
|
protected void |
handleBackwardCompatibility()
Now onwards client code will use properties from this class but older
clients still be setting properties through system properties.
|
void |
setProperty(String key,
String value)
Maps the specified
key to the specified value . |
public static final String JUTE_MAXBUFFER
public static final String KINIT_COMMAND
"/usr/bin/kinit"
public static final String JGSS_NATIVE
public ZKConfig()
public ZKConfig(String configPath) throws QuorumPeerConfig.ConfigException
configPath
- Configuration file pathQuorumPeerConfig.ConfigException
- if failed to load configuration propertiespublic ZKConfig(File configFile) throws QuorumPeerConfig.ConfigException
configFile
- Configuration fileQuorumPeerConfig.ConfigException
- if failed to load configuration propertiesprotected void handleBackwardCompatibility()
public String getProperty(String key)
key
- public String getProperty(String key, String defaultValue)
key
- property keydefaultValue
- public String getJaasConfKey()
public void setProperty(String key, String value)
key
to the specified value
.
key can not be null
. If key is already mapped then the old
value of the key
is replaced by the specified
value
.key
- value
- public void addConfiguration(File configFile) throws QuorumPeerConfig.ConfigException
configFile
- Configuration file.QuorumPeerConfig.ConfigException
public void addConfiguration(String configPath) throws QuorumPeerConfig.ConfigException
configPath
- Configuration file path.QuorumPeerConfig.ConfigException
public boolean getBoolean(String key)
true
if and only if the property named by the argument
exists and is equal to the string "true"
.public boolean getBoolean(String key, boolean defaultValue)
key
property as a boolean
. Returns
true
if and only if the property named by the argument exists and is equal
to the string "true"
. If the property is not set, the provided
defaultValue
is returned.key
- property key.defaultValue
- default value.boolean
, or
defaultValue
public int getInt(String key, int defaultValue)
key
property as an int
. If
property is not set, the provided defaultValue
is returnedkey
- property key.defaultValue
- default value.int
, or
defaultValue
NumberFormatException
- when the value is invalidCopyright © 2008–2020 The Apache Software Foundation. All rights reserved.