|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.configuration.AbstractConfiguration
org.apache.commons.configuration.BaseConfiguration
org.apache.commons.configuration.BasePathConfiguration
org.apache.commons.configuration.BasePropertiesConfiguration
org.apache.commons.configuration.PropertiesConfiguration
This is the "classic" Properties loader which loads the values from a single or multiple files (which can be chained with "include =". All given path references are either absolute or relative to the file name supplied in the Constructor.
In this class, empty PropertyConfigurations can be built, properties added and later saved. include statements are (obviously) not supported if you don't construct a PropertyConfiguration from a file.
If you want to use the getResourceAsStream() trick to load your resources without an absolute path, please take a look at the ClassPropertiesConfiguration which is intended to be used for this.
Nested Class Summary |
Nested classes inherited from class org.apache.commons.configuration.BasePropertiesConfiguration |
BasePropertiesConfiguration.PropertiesReader, BasePropertiesConfiguration.PropertiesWriter |
Nested classes inherited from class org.apache.commons.configuration.AbstractConfiguration |
AbstractConfiguration.Container, AbstractConfiguration.PropertiesTokenizer |
Field Summary | |
protected java.lang.String |
fileName
The name of the file to be loaded. |
protected java.lang.String |
fileSeparator
File separator. |
(package private) org.apache.commons.logging.Log |
log
Static logger |
Fields inherited from class org.apache.commons.configuration.BasePropertiesConfiguration |
include |
Fields inherited from class org.apache.commons.configuration.BasePathConfiguration |
|
Fields inherited from class org.apache.commons.configuration.BaseConfiguration |
|
Fields inherited from class org.apache.commons.configuration.AbstractConfiguration |
defaults, END_TOKEN, START_TOKEN |
Constructor Summary | |
PropertiesConfiguration()
Creates an empty PropertyConfiguration object which can be used to synthesize a new Properties file by adding values and then saving(). |
|
PropertiesConfiguration(Configuration defaults)
Creates an empty PropertyConfiguration object with a Super-Object which is queries for every key. |
|
PropertiesConfiguration(java.lang.String fileName)
Creates and loads the extended properties from the specified file. |
|
PropertiesConfiguration(java.lang.String file,
Configuration defaults)
Creates and loads the extended properties from the specified file. |
|
PropertiesConfiguration(java.lang.String file,
java.lang.String defaultFile)
Creates and loads the extended properties from the specified file. |
Method Summary | |
java.lang.String |
getFileName()
Returns the fileName. |
java.io.InputStream |
getPropertyStream(java.lang.String resourceName)
Gets a resource relative to the supplied base path. |
void |
load()
Load the properties from the fileName set by setFileName |
void |
load(java.lang.String fileName)
Load the properties from the given fileName |
void |
setBasePath(java.lang.String basePath)
Extend the setBasePath method to turn includes on and off based on the existence of a base path. |
void |
setFileName(java.lang.String fileName)
Sets the fileName. |
Methods inherited from class org.apache.commons.configuration.BasePropertiesConfiguration |
getInclude, getIncludesAllowed, load, load, save, setInclude, setIncludesAllowed |
Methods inherited from class org.apache.commons.configuration.BasePathConfiguration |
getBasePath |
Methods inherited from class org.apache.commons.configuration.BaseConfiguration |
addPropertyDirect, clearProperty, containsKey, getKeys, getPropertyDirect, isEmpty |
Methods inherited from class org.apache.commons.configuration.AbstractConfiguration |
addProperty, getBoolean, getBoolean, getBoolean, getByte, getByte, getByte, getDouble, getDouble, getDouble, getFloat, getFloat, getFloat, getInt, getInt, getInteger, getKeys, getList, getList, getLong, getLong, getLong, getProperties, getProperties, getProperty, getShort, getShort, getShort, getString, getString, getStringArray, interpolate, interpolateHelper, processString, setProperty, subset, testBoolean |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.commons.configuration.Configuration |
addProperty, clearProperty, containsKey, getBoolean, getBoolean, getBoolean, getByte, getByte, getByte, getDouble, getDouble, getDouble, getFloat, getFloat, getFloat, getInt, getInt, getInteger, getKeys, getKeys, getList, getList, getLong, getLong, getLong, getProperties, getProperty, getShort, getShort, getShort, getString, getString, getStringArray, isEmpty, setProperty, subset |
Field Detail |
org.apache.commons.logging.Log log
protected java.lang.String fileSeparator
protected java.lang.String fileName
Constructor Detail |
public PropertiesConfiguration()
public PropertiesConfiguration(Configuration defaults) throws java.io.IOException
defaults
- Configuration defaults to use if key not in file
java.io.IOException
- Error while loading the properties filepublic PropertiesConfiguration(java.lang.String fileName) throws java.io.IOException
fileName
- The name of the Properties File to load.
java.io.IOException
- Error while loading the properties filepublic PropertiesConfiguration(java.lang.String file, Configuration defaults) throws java.io.IOException
file
- The name of the Properties File to load.defaults
- Configuration defaults to use if key not in file
java.io.IOException
- Error while loading the properties filepublic PropertiesConfiguration(java.lang.String file, java.lang.String defaultFile) throws java.io.IOException
file
- The name of the Properties File to load.defaultFile
- The name of a properties file whose values
should be used if a key is not in the file.
java.io.IOException
- Error while loading the properties fileMethod Detail |
public void load() throws java.io.IOException
java.io.IOException
public void load(java.lang.String fileName) throws java.io.IOException
fileName
- A properties file to load
java.io.IOException
public java.io.InputStream getPropertyStream(java.lang.String resourceName) throws java.io.IOException
getPropertyStream
in class BasePropertiesConfiguration
resourceName
- The resource Name
java.io.IOException
- Error while loading the properties filepublic java.lang.String getFileName()
public void setFileName(java.lang.String fileName)
fileName
- The fileName to setpublic void setBasePath(java.lang.String basePath)
setBasePath
in interface BasePathLoader
setBasePath
in class BasePathConfiguration
basePath
- The new basePath to set.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |