Return-Path:
Partial implementation of the FileConfiguration
interface.
* Developpers of file based configuration may want to extend this class,
* the two methods left to implement are {@link FileConfiguration#load(Reader)}
- * and {@link FileConfiguration#save(Writer)}.
{@link FileConfiguration#save(Writer)}
.
This base class already implements a couple of ways to specify the location
* of the file this configuration is based on. The following possibilities
* exist:
@@ -548,6 +548,7 @@
* Return the base path.
*
* @return the base path
+ * @see FileConfiguration#getBasePath()
*/
public String getBasePath()
{
@@ -555,8 +556,18 @@
}
/**
- * Set the base path. Relative configurations are loaded from this path. The
- * base path can be either a path to a directory or a URL.
+ * Sets the base path. The base path is typically either a path to a
+ * directory or a URL. Together with the value passed to the
+ * setFileName()
method it defines the location of the
+ * configuration file to be loaded. The strategies for locating the file are
+ * quite tolerant. For instance if the file name is already an absolute path
+ * or a fully defined URL, the base path will be ignored. The base path can
+ * also be a URL, in which case the file name is interpreted in this URL's
+ * context. Because the base path is used by some of the derived classes for
+ * resolving relative file names it should contain a meaningful value. If
+ * other methods are used for determining the location of the configuration
+ * file (e.g. setFile()
or setURL()
), the
+ * base path is automatically set.
*
* @param basePath the base path.
*/
Modified: jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/FileConfiguration.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/FileConfiguration.java?view=diff&rev=492234&r1=492233&r2=492234
==============================================================================
--- jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/FileConfiguration.java (original)
+++ jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/FileConfiguration.java Wed Jan 3 09:39:39 2007
@@ -178,14 +178,28 @@
void setFileName(String fileName);
/**
- * Return the base path.
+ * Returns the base path. One way to specify the location of a configuration
+ * source is by setting its base path and its file name. This method returns
+ * this base path. The concrete value returned by this method depends on the
+ * way the location of the configuration file was set. If methods like
+ * setFile()
or setURL()
were used, the base
+ * path typically points to the parent directory of the configuration file
+ * (e.g. for the URL file:/temp/test.properties
the base path
+ * will be file:/temp/
). If the base path was explictly set
+ * using setBasePath()
, this method will return the exact
+ * value specified here without further modifications.
*
* @return the base path
+ * @see AbstractFileConfiguration#setBasePath(String)
*/
String getBasePath();
/**
- * Set the base path. Relative configurations are loaded from this path.
+ * Sets the base path. The methods setBasePath()
and
+ * setFileName()
can be used together to specify the location
+ * of the configuration file to be loaded. If relative file names are to
+ * be resolved (e.g. for the include files supported by
+ * PropertiesConfiguration
), this base path will be used.
*
* @param basePath the base path.
*/
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org