commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ebo...@apache.org
Subject cvs commit: jakarta-commons/configuration/xdocs changes.xml
Date Tue, 19 Oct 2004 11:44:31 GMT
ebourg      2004/10/19 04:44:31

  Modified:    configuration/src/java/org/apache/commons/configuration
                        AbstractFileConfiguration.java
                        PropertiesConfiguration.java XMLConfiguration.java
               configuration/xdocs changes.xml
  Log:
  Moved the constructors implementations from PropertiesConfiguration and XMLConfiguration
to AbstractFileConfiguration.
  
  Revision  Changes    Path
  1.7       +67 -1     jakarta-commons/configuration/src/java/org/apache/commons/configuration/AbstractFileConfiguration.java
  
  Index: AbstractFileConfiguration.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/configuration/src/java/org/apache/commons/configuration/AbstractFileConfiguration.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- AbstractFileConfiguration.java	18 Oct 2004 15:45:10 -0000	1.6
  +++ AbstractFileConfiguration.java	19 Oct 2004 11:44:31 -0000	1.7
  @@ -53,9 +53,75 @@
       protected ReloadingStrategy strategy;
       private Object reloadLock = new Object();
   
  +    /**
  +     * Default constructor
  +     *
  +     * @since 1.1
  +     */
       public AbstractFileConfiguration()
       {
           setReloadingStrategy(new InvariantReloadingStrategy());
  +    }
  +
  +    /**
  +     * Creates and loads the configuration from the specified file.
  +     *
  +     * @param fileName The name of the file to load.
  +     *
  +     * @throws ConfigurationException Error while loading the file
  +     * @since 1.1
  +     */
  +    public AbstractFileConfiguration(String fileName) throws ConfigurationException
  +    {
  +        this();
  +
  +        // store the file name
  +        this.fileName = fileName;
  +
  +        // locate the file
  +        url = ConfigurationUtils.locate(fileName);
  +
  +        // update the base path
  +        setBasePath(ConfigurationUtils.getBasePath(url));
  +
  +        // load the file
  +        load();
  +    }
  +
  +    /**
  +     * Creates and loads the configuration from the specified file.
  +     *
  +     * @param file The file to load.
  +     * @throws ConfigurationException Error while loading the file
  +     * @since 1.1
  +     */
  +    public AbstractFileConfiguration(File file) throws ConfigurationException
  +    {
  +        this();
  +
  +        // set the file and update the url, the base path and the file name
  +        setFile(file);
  +
  +        // load the file
  +        load();
  +    }
  +
  +    /**
  +     * Creates and loads the configuration from the specified URL.
  +     *
  +     * @param url The location of the file to load.
  +     * @throws ConfigurationException Error while loading the file
  +     * @since 1.1
  +     */
  +    public AbstractFileConfiguration(URL url) throws ConfigurationException
  +    {
  +        this();
  +        
  +        // set the URL and update the base path and the file name
  +        setURL(url);
  +
  +        // load the file
  +        load();
       }
   
       /**
  
  
  
  1.16      +5 -32     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.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- PropertiesConfiguration.java	23 Sep 2004 11:45:07 -0000	1.15
  +++ PropertiesConfiguration.java	19 Oct 2004 11:44:31 -0000	1.16
  @@ -139,7 +139,7 @@
       static String include = "include";
   
       /** Allow file inclusion or not */
  -    private boolean includesAllowed;
  +    private boolean includesAllowed = true;
   
       /**
        * Creates an empty PropertyConfiguration object which can be
  @@ -163,20 +163,7 @@
        */
       public PropertiesConfiguration(String fileName) throws ConfigurationException
       {
  -        // enable includes
  -        setIncludesAllowed(true);
  -
  -        // store the file name
  -        this.fileName = fileName;
  -
  -        // locate the resource
  -        url = ConfigurationUtils.locate(fileName);
  -
  -        // update the base path
  -        setBasePath(ConfigurationUtils.getBasePath(url));
  -
  -        // load the file
  -        load();
  +        super(fileName);
       }
   
       /**
  @@ -189,14 +176,7 @@
        */
       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();
  +        super(file);
       }
   
       /**
  @@ -209,14 +189,7 @@
        */
       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();
  +        super(url);
       }
   
       /**
  
  
  
  1.19      +7 -11     jakarta-commons/configuration/src/java/org/apache/commons/configuration/XMLConfiguration.java
  
  Index: XMLConfiguration.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/configuration/src/java/org/apache/commons/configuration/XMLConfiguration.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- XMLConfiguration.java	18 Oct 2004 11:12:08 -0000	1.18
  +++ XMLConfiguration.java	19 Oct 2004 11:44:31 -0000	1.19
  @@ -101,17 +101,15 @@
       }
   
       /**
  -     * Creates and loads the XML configuration from the specified resource.
  +     * Creates and loads the XML configuration from the specified file.
        *
  -     * @param resource The name of the resource to load.
  +     * @param fileName The name of the file to load.
        *
        * @throws ConfigurationException Error while loading the XML file
        */
  -    public XMLConfiguration(String resource) throws ConfigurationException
  +    public XMLConfiguration(String fileName) throws ConfigurationException
       {
  -        this.fileName = resource;
  -        url = ConfigurationUtils.locate(resource);
  -        load();
  +        super(fileName);
       }
   
       /**
  @@ -122,8 +120,7 @@
        */
       public XMLConfiguration(File file) throws ConfigurationException
       {
  -        setFile(file);
  -        load();
  +        super(file);
       }
   
       /**
  @@ -134,8 +131,7 @@
        */
       public XMLConfiguration(URL url) throws ConfigurationException
       {
  -        setURL(url);
  -        load();
  +        super(url);
       }
   
       /**
  
  
  
  1.65      +4 -0      jakarta-commons/configuration/xdocs/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/configuration/xdocs/changes.xml,v
  retrieving revision 1.64
  retrieving revision 1.65
  diff -u -r1.64 -r1.65
  --- changes.xml	19 Oct 2004 08:50:22 -0000	1.64
  +++ changes.xml	19 Oct 2004 11:44:31 -0000	1.65
  @@ -8,6 +8,10 @@
     <body>
   
       <release version="1.1-dev" date="in CVS">
  +      <action dev="ebourg" type="update">
  +        Moved the constructors implementations from PropertiesConfiguration and
  +        XMLConfiguration to AbstractFileConfiguration.
  +      </action>
         <action dev="epugh" type="remove">
           Remove deprecated getVector() implementations. 
         </action>        
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message