public class Config
extends java.lang.Object
Config files are properties, with /usr/share/rhn/config-defaults/rhn.conf setting defaults that can be overridden by /etc/rhn/rhn.conf.
Constructor and Description |
---|
Config()
public constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addPath(java.lang.String path)
Add a path to the config object for parsing
|
boolean |
containsKey(java.lang.String name) |
static Config |
get()
static method to get the singleton Config option
|
boolean |
getBoolean(java.lang.String s)
get the config entry for string s
|
static java.lang.String |
getDefaultConfigFilePath()
Get the path to the rhn.conf file we use.
|
int |
getInt(java.lang.String s)
get the config entry for string s
|
int |
getInt(java.lang.String s,
int defaultValue)
get the config entry for string s, if no value is found
return the defaultValue specified.
|
java.lang.Integer |
getInteger(java.lang.String s)
get the config entry for string s
|
java.util.List<java.lang.String> |
getList(java.lang.String name)
Parses a comma-delimited list of values as a java.util.List
|
java.util.Properties |
getNamespaceProperties(java.lang.String namespace)
Returns a subset of the properties for the given namespace.
|
java.lang.String |
getString(java.lang.String value)
get the config entry for string s
|
java.lang.String |
getString(java.lang.String name,
java.lang.String defValue)
Get the configuration entry for the given string name.
|
java.lang.String[] |
getStringArray(java.lang.String s)
get the config entry for string s
|
void |
parseFiles()
Parse all of the added files.
|
void |
remove(java.lang.String name)
remove the config entry for key
|
void |
setBoolean(java.lang.String s,
java.lang.String b)
set the config entry for string name
|
java.lang.String |
setString(java.lang.String name,
java.lang.String value)
get the config entry for string name
|
public Config() throws ConfigException
ConfigException
- error from the Configuration layers. the jakarta
commons conf system just throws Exception, which makes it hard to react.
sometioes it is an IOExceptions, sometimes a SAXParserException,
sometimes a VindictiveException. so we just turn them into our own
exception type and toss them up. as we discover ones we might
meaningfully want to react to, we can specilize ConfigException and catch
thosepublic void addPath(java.lang.String path)
path
- The path to addpublic static Config get()
public static java.lang.String getDefaultConfigFilePath()
public java.lang.String getString(java.lang.String name, java.lang.String defValue)
name
- name of propertydefValue
- default value for property if it is null.public boolean containsKey(java.lang.String name)
name
- Key to check forpublic java.lang.String getString(java.lang.String value)
value
- string to get the value ofpublic int getInt(java.lang.String s)
s
- string to get the value ofpublic int getInt(java.lang.String s, int defaultValue)
s
- string to get the value ofdefaultValue
- Default value if entry is not found.public java.lang.Integer getInteger(java.lang.String s)
s
- string to get the value ofpublic java.util.List<java.lang.String> getList(java.lang.String name)
name
- config entry namepublic java.lang.String[] getStringArray(java.lang.String s)
s
- string to get the value ofpublic java.lang.String setString(java.lang.String name, java.lang.String value)
name
- string to set the value ofvalue
- new valuepublic void remove(java.lang.String name)
name
- key to removepublic boolean getBoolean(java.lang.String s)
s
- string to get the value ofpublic void setBoolean(java.lang.String s, java.lang.String b)
s
- string to set the value ofb
- new valuepublic void parseFiles()
public java.util.Properties getNamespaceProperties(java.lang.String namespace)
namespace
- Namespace of properties to be returned.