|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcgl.narada.wsinfra.util.ConfigurationParamsReader
Responsible for loading the configuration parameters specified in a configuration file.
| Field Summary | |
protected Configuration |
defaults
|
String |
DELIMITER
|
String |
FILE_SEPARATOR
|
protected Hashtable |
store
|
| Constructor Summary | |
ConfigurationParamsReader()
|
|
ConfigurationParamsReader(Configuration defaults)
|
|
ConfigurationParamsReader(String file)
|
|
| Method Summary | |
void |
addProperty(String key,
Object token)
Add a property to the configuration. |
protected void |
addPropertyDirect(String key,
Object obj)
|
void |
clearProperty(String key)
Clear a property in the configuration. |
boolean |
containsKey(String key)
Check if the configuration contains the key. |
String |
getBasePath()
|
boolean |
getBoolean(String key)
Get a boolean associated with the given configuration key. |
boolean |
getBoolean(String key,
boolean defaultValue)
Get a boolean associated with the given configuration key. |
Boolean |
getBoolean(String key,
Boolean defaultValue)
Get a boolean associated with the given configuration key. |
byte |
getByte(String key)
Get a byte associated with the given configuration key. |
byte |
getByte(String key,
byte defaultValue)
Get a byte associated with the given configuration key. |
Byte |
getByte(String key,
Byte defaultValue)
Get a byte associated with the given configuration key. |
double |
getDouble(String key)
Get a double associated with the given configuration key. |
double |
getDouble(String key,
double defaultValue)
Get a double associated with the given configuration key. |
Double |
getDouble(String key,
Double defaultValue)
Get a double associated with the given configuration key. |
float |
getFloat(String key)
Get a float associated with the given configuration key. |
float |
getFloat(String key,
float defaultValue)
Get a float associated with the given configuration key. |
Float |
getFloat(String key,
Float defaultValue)
Get a float associated with the given configuration key. |
int |
getInt(String key)
Get a int associated with the given configuration key. |
int |
getInt(String key,
int defaultValue)
Get a int associated with the given configuration key. |
Integer |
getInteger(String key,
Integer defaultValue)
Get a int associated with the given configuration key. |
Iterator |
getKeys()
Get the list of the keys contained in the configuration repository. |
Iterator |
getKeys(String prefix)
Get the list of the keys contained in the configuration repository that match the specified prefix. |
long |
getLong(String key)
Get a long associated with the given configuration key. |
long |
getLong(String key,
long defaultValue)
Get a long associated with the given configuration key. |
Long |
getLong(String key,
Long defaultValue)
Get a long associated with the given configuration key. |
Properties |
getProperties(Properties _defaults)
Returns all the properties that have been read from the specified configuration file |
Properties |
getProperties(String key)
Get a list of properties associated with the given configuration key. |
Properties |
getProperties(String key,
Properties defaults)
|
String |
getProperty(String key)
Gets a property from the configuration. |
InputStream |
getPropertyStream(String resourceName)
|
short |
getShort(String key)
Get a short associated with the given configuration key. |
short |
getShort(String key,
short defaultValue)
Get a short associated with the given configuration key. |
Short |
getShort(String key,
Short defaultValue)
Get a short associated with the given configuration key. |
String |
getString(String key)
Get a string associated with the given configuration key. |
String |
getString(String key,
String defaultValue)
Get a string associated with the given configuration key. |
String[] |
getStringArray(String key)
Get an array of strings associated with the given configuration key. |
Vector |
getVector(String key)
Get a Vector of strings associated with the given configuration key. |
Vector |
getVector(String key,
Vector defaultValue)
Get a Vector of strings associated with the given configuration key. |
boolean |
isEmpty()
Check if the configuration is empty. |
void |
load(InputStream input)
Load the properties from the given input stream. |
void |
load(InputStream input,
String enc)
Load the properties from the given input stream and using the specified encoding. |
void |
load(String file)
Load the properties from the given file |
protected List |
processString(String token)
|
void |
setBasePath(String path)
|
void |
setProperty(String key,
Object value)
Set a property, this will replace any previously set values. |
Configuration |
subset(String prefix)
Create an Configuration object that is a subset of this one. |
String |
testBoolean(String value)
Map true , on , yes
to true; false , off , no
to false. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public final String FILE_SEPARATOR
public final String DELIMITER
protected Configuration defaults
protected Hashtable store
| Constructor Detail |
public ConfigurationParamsReader()
public ConfigurationParamsReader(String file)
public ConfigurationParamsReader(Configuration defaults)
| Method Detail |
public void load(String file)
throws IOException
file - The properties file to load
IOException
public void load(InputStream input)
throws IOException
input - An InputStream on the properties file
IOException
public void load(InputStream input,
String enc)
throws IOException
input - An InputStream.enc - An encoding.
IOException
public InputStream getPropertyStream(String resourceName)
throws IOException
resourceName - The file name with which to get InputStream
IOException
public void addProperty(String key,
Object token)
Configuration
addProperty in interface Configurationkey - The Key to add the property to.token - The Value to add.Configurationprotected List processString(String token)
token - A String token
protected void addPropertyDirect(String key,
Object obj)
key - key to use for mappingobj - object to storepublic String testBoolean(String value)
true , on , yes
to true; false , off , no
to false.
value - The value to test for boolean state.
public Configuration subset(String prefix)
Configuration
subset in interface Configurationprefix - The prefix used to select the properties.Configurationpublic boolean isEmpty()
Configuration
isEmpty in interface ConfigurationConfiguration.isEmpty()public boolean containsKey(String key)
Configuration
containsKey in interface ConfigurationConfiguration
public void setProperty(String key,
Object value)
Configuration
setProperty in interface Configurationkey - The key of the property to changevalue - The new valueConfigurationpublic void clearProperty(String key)
Configuration
clearProperty in interface Configurationkey - the key to remove along with corresponding value.Configurationpublic Iterator getKeys()
Configuration
getKeys in interface ConfigurationConfigurationpublic Iterator getKeys(String prefix)
Configuration
getKeys in interface Configurationprefix - The prefix to test against.
Configurationpublic Properties getProperties(Properties _defaults)
public Properties getProperties(String key)
Configuration
getProperties in interface Configurationkey - The configuration key.
Configuration,
getProperties(String, Properties)
public Properties getProperties(String key,
Properties defaults)
Configurationpublic String getProperty(String key)
Configuration
getProperty in interface Configurationkey - property to retrieve
Configurationpublic boolean getBoolean(String key)
Configuration
getBoolean in interface Configurationkey - The configuration key.
Configuration
public boolean getBoolean(String key,
boolean defaultValue)
Configuration
getBoolean in interface Configurationkey - The configuration key.defaultValue - The default value.
Configuration
public Boolean getBoolean(String key,
Boolean defaultValue)
Configuration
getBoolean in interface Configurationkey - The configuration key.defaultValue - The default value.
Configurationpublic byte getByte(String key)
Configuration
getByte in interface Configurationkey - The configuration key.
Configuration
public byte getByte(String key,
byte defaultValue)
Configuration
getByte in interface Configurationkey - The configuration key.defaultValue - The default value.
Configuration
public Byte getByte(String key,
Byte defaultValue)
Configuration
getByte in interface Configurationkey - The configuration key.defaultValue - The default value.
Configurationpublic double getDouble(String key)
Configuration
getDouble in interface Configurationkey - The configuration key.
Configuration
public double getDouble(String key,
double defaultValue)
Configuration
getDouble in interface Configurationkey - The configuration key.defaultValue - The default value.
Configuration
public Double getDouble(String key,
Double defaultValue)
Configuration
getDouble in interface Configurationkey - The configuration key.defaultValue - The default value.
Configurationpublic float getFloat(String key)
Configuration
getFloat in interface Configurationkey - The configuration key.
Configuration
public float getFloat(String key,
float defaultValue)
Configuration
getFloat in interface Configurationkey - The configuration key.defaultValue - The default value.
Configuration
public Float getFloat(String key,
Float defaultValue)
Configuration
getFloat in interface Configurationkey - The configuration key.defaultValue - The default value.
Configurationpublic int getInt(String key)
Configuration
getInt in interface Configurationkey - The configuration key.
Configuration
public int getInt(String key,
int defaultValue)
Configuration
getInt in interface Configurationkey - The configuration key.defaultValue - The default value.
Configuration
public Integer getInteger(String key,
Integer defaultValue)
Configuration
getInteger in interface Configurationkey - The configuration key.defaultValue - The default value.
Configurationpublic long getLong(String key)
Configuration
getLong in interface Configurationkey - The configuration key.
Configuration
public long getLong(String key,
long defaultValue)
Configuration
getLong in interface Configurationkey - The configuration key.defaultValue - The default value.
Configuration
public Long getLong(String key,
Long defaultValue)
Configuration
getLong in interface Configurationkey - The configuration key.defaultValue - The default value.
Configurationpublic short getShort(String key)
Configuration
getShort in interface Configurationkey - The configuration key.
Configuration
public short getShort(String key,
short defaultValue)
Configuration
getShort in interface Configurationkey - The configuration key.defaultValue - The default value.
Configuration
public Short getShort(String key,
Short defaultValue)
Configuration
getShort in interface Configurationkey - The configuration key.defaultValue - The default value.
Configurationpublic String getString(String key)
Configuration
getString in interface Configurationkey - The configuration key.
Configuration
public String getString(String key,
String defaultValue)
Configuration
getString in interface Configurationkey - The configuration key.defaultValue - The default value.
Configurationpublic String[] getStringArray(String key)
Configuration
getStringArray in interface Configurationkey - The configuration key.
Configurationpublic Vector getVector(String key)
Configuration
getVector in interface Configurationkey - The configuration key.
Configuration
public Vector getVector(String key,
Vector defaultValue)
Configuration
getVector in interface Configurationkey - The configuration key.defaultValue - The default value.
Configurationpublic String getBasePath()
public void setBasePath(String path)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||