ebourg      2004/09/23 04:45:08

  Modified:    configuration/src/java/org/apache/commons/configuration
                        PropertiesConfiguration.java
  Log:
  Added 2 constructors using a File and an URL
  
  Revision  Changes    Path
  1.15      +44 -2     
jakarta-commons/configuration/src/java/org/apache/commons/configuration/PropertiesConfiguration.java
  
  Index: PropertiesConfiguration.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/configuration/src/java/org/apache/commons/configuration/PropertiesConfiguration.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- PropertiesConfiguration.java      22 Sep 2004 17:17:30 -0000      1.14
  +++ PropertiesConfiguration.java      23 Sep 2004 11:45:07 -0000      1.15
  @@ -16,11 +16,13 @@
   
   package org.apache.commons.configuration;
   
  +import java.io.File;
   import java.io.FilterWriter;
   import java.io.IOException;
   import java.io.LineNumberReader;
   import java.io.Reader;
   import java.io.Writer;
  +import java.net.URL;
   import java.util.Date;
   import java.util.Iterator;
   import java.util.List;
  @@ -156,7 +158,7 @@
        * The specified file can contain "include = " properties which then
        * are loaded and merged into the properties.
        *
  -     * @param fileName The name of the Properties File to load.
  +     * @param fileName The name of the properties file to load.
        * @throws ConfigurationException Error while loading the properties file
        */
       public PropertiesConfiguration(String fileName) throws ConfigurationException
  @@ -172,6 +174,46 @@
   
           // update the base path
           setBasePath(ConfigurationUtils.getBasePath(url));
  +
  +        // load the file
  +        load();
  +    }
  +
  +    /**
  +     * Creates and loads the extended properties from the specified file.
  +     * The specified file can contain "include = " properties which then
  +     * are loaded and merged into the properties.
  +     *
  +     * @param file The properties file to load.
  +     * @throws ConfigurationException Error while loading the properties file
  +     */
  +    public PropertiesConfiguration(File file) throws ConfigurationException
  +    {
  +        // enable includes
  +        setIncludesAllowed(true);
  +
  +        // set the file and update the url, the base path and the file name
  +        setFile(file);
  +
  +        // load the file
  +        load();
  +    }
  +
  +    /**
  +     * Creates and loads the extended properties from the specified URL.
  +     * The specified file can contain "include = " properties which then
  +     * are loaded and merged into the properties.
  +     *
  +     * @param url The location of the properties file to load.
  +     * @throws ConfigurationException Error while loading the properties file
  +     */
  +    public PropertiesConfiguration(URL url) throws ConfigurationException
  +    {
  +        // enable includes
  +        setIncludesAllowed(true);
  +
  +        // set the URL and update the base path and the file name
  +        setURL(url);
   
           // load the file
           load();
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to