cvs commit: jakarta-commons/configuration/xdocs changes.xml

2004-12-23 Thread oheger
oheger  2004/12/23 11:18:12

  Modified:configuration/xdocs changes.xml
  Log:
  Updated changes log after work on the XML configurations
  
  Revision  ChangesPath
  1.77  +10 -0 jakarta-commons/configuration/xdocs/changes.xml
  
  Index: changes.xml
  ===
  RCS file: /home/cvs/jakarta-commons/configuration/xdocs/changes.xml,v
  retrieving revision 1.76
  retrieving revision 1.77
  diff -u -r1.76 -r1.77
  --- changes.xml   14 Dec 2004 17:03:51 -  1.76
  +++ changes.xml   23 Dec 2004 19:18:12 -  1.77
  @@ -8,6 +8,16 @@
 body
   
   release version=1.1-dev date=in CVS
  +   action dev=oheger type=add issue=31136
  + Access to the top leven element of the XML document is now 
provided. For
  + newly created configurations this element can be changed before 
the
  + document is written.
  +   /action
  +   action dev=oheger type=update issue=31429
  + Merged the two XML related configuration classes into one new 
class
  + XMLConfiguration. This new class should provide the best of its
  + ancestors.
  +   /action
 action dev=ebourg type=update
   Replaced the PropertyTokenizer inner class in AbstractConfiguration
   with the split method in PropertyConverter. Also moved the method
  
  
  

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



cvs commit: jakarta-commons/configuration/xdocs changes.xml

2004-12-14 Thread ebourg
ebourg  2004/12/14 09:03:51

  Modified:configuration/src/java/org/apache/commons/configuration
AbstractConfiguration.java
HierarchicalConfiguration.java
MapConfiguration.java PropertyConverter.java
   configuration/src/test/org/apache/commons/configuration
TestBaseConfiguration.java
TestBaseNullConfiguration.java
   configuration/xdocs changes.xml
  Added:   configuration/src/test/org/apache/commons/configuration
TestPropertyConverter.java
  Removed: configuration/src/test/org/apache/commons/configuration
TestPropertiesTokenizer.java
  Log:
  Replaced the PropertyTokenizer inner class in AbstractConfiguration with the 
split method in PropertyConverter.
  Also moved the method building an iterator on the elements of a composite 
value in PropertyConverter as toIterator().
  
  Revision  ChangesPath
  1.31  +4 -144
jakarta-commons/configuration/src/java/org/apache/commons/configuration/AbstractConfiguration.java
  
  Index: AbstractConfiguration.java
  ===
  RCS file: 
/home/cvs/jakarta-commons/configuration/src/java/org/apache/commons/configuration/AbstractConfiguration.java,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- AbstractConfiguration.java13 Dec 2004 16:40:14 -  1.30
  +++ AbstractConfiguration.java14 Dec 2004 17:03:49 -  1.31
  @@ -19,18 +19,13 @@
   import java.math.BigDecimal;
   import java.math.BigInteger;
   import java.util.ArrayList;
  -import java.util.Collection;
   import java.util.Iterator;
   import java.util.List;
   import java.util.NoSuchElementException;
   import java.util.Properties;
  -import java.util.StringTokenizer;
   
  -import org.apache.commons.collections.IteratorUtils;
   import org.apache.commons.collections.Predicate;
   import org.apache.commons.collections.iterators.FilterIterator;
  -import org.apache.commons.collections.iterators.IteratorChain;
  -import org.apache.commons.collections.iterators.SingletonIterator;
   import org.apache.commons.lang.BooleanUtils;
   
   /**
  @@ -55,9 +50,6 @@
   /** The property delimiter used while parsing (a comma). */
   private static char DELIMITER = ',';
   
  -/** how big the initial arraylist for splitting up name value pairs */
  -private static final int INITIAL_LIST_SIZE = 2;
  -
   /**
* Whether the configuration should throw NoSuchElementExceptions or 
simply
* return null when a property does not exist. Defaults to return null.
  @@ -108,69 +100,16 @@
   /**
* [EMAIL PROTECTED]
*/
  -public void addProperty(String key, Object token)
  +public void addProperty(String key, Object value)
   {
  -for (Iterator it = fetchInsertIterator(token); it.hasNext();)
  +Iterator it = PropertyConverter.toIterator(value, DELIMITER);
  +while (it.hasNext())
   {
   addPropertyDirect(key, it.next());
   }
   }
   
   /**
  - * Determines all properties to be added to this configuration. This 
method
  - * is called by codeaddProperty()/code and codesetProperty()/code
  - * to obtain all values to be inserted. The passed in token is specially
  - * treated depending on its type: ulliStrings are checked for
  - * enumeration characters and splitted if necessary./liliFor
  - * collections the single elements are checked./liliArrays are
  - * treated like collections./liliAll other types are directly
  - * inserted./liliRecursive combinations are supported, e.g. a
  - * collection containing array that contain strings./li/ul
  - * 
  - * @param token the token to be checked
  - * @return an iterator for the values to be inserted
  - */
  -protected Iterator fetchInsertIterator(Object token)
  -{
  -if (token == null)
  -{
  -return IteratorUtils.emptyIterator();
  -}
  -if (token instanceof String)
  -{
  -return split((String) token).iterator();
  -}
  -else if (token instanceof Collection)
  -{
  -return fetchInsertIterator(((Collection) token).iterator());
  -}
  -else if (token.getClass().isArray())
  -{
  -return fetchInsertIterator(IteratorUtils.arrayIterator(token));
  -}
  -else
  -{
  -return new SingletonIterator(token);
  -}
  -}
  -
  -/**
  - * Recursivle fetches an insert iterator if the token itself is a 
composite.
  - * 
  - * @param iterator the iterator to be processed
  - * @return a chain iterator for all elements
  - */
  -private Iterator fetchInsertIterator(Iterator 

cvs commit: jakarta-commons/configuration/xdocs changes.xml

2004-12-04 Thread oheger
oheger  2004/12/04 07:54:07

  Modified:configuration/xdocs changes.xml
  Log:
  Fix for Bug 30858, including some cleanup for file based configurations
  
  Revision  ChangesPath
  1.75  +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.74
  retrieving revision 1.75
  diff -u -r1.74 -r1.75
  --- changes.xml   3 Dec 2004 02:07:18 -   1.74
  +++ changes.xml   4 Dec 2004 15:54:07 -   1.75
  @@ -8,6 +8,10 @@
 body
   
   release version=1.1-dev date=in CVS
  +   action dev=oheger type=fix issue=30858
  + Some cleanup of the handling of the base path in file based 
configurations.
  + The base path is now always taken into account.
  +   /action
 action dev=ebourg type=fix
   Calling getProperties on a JNDIConfiguration no longer throws an
   UnsupportedOperationException.
  
  
  

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



cvs commit: jakarta-commons/configuration/xdocs changes.xml

2004-12-02 Thread ebourg
ebourg  2004/12/02 14:06:21

  Modified:configuration/xdocs changes.xml
  Log:
  Removed the getPropertyDirect method from AbstractConfiguration, concrete 
configurations now implement directly the getProperty method from the 
Configuration interface.
  
  Revision  ChangesPath
  1.73  +5 -0  jakarta-commons/configuration/xdocs/changes.xml
  
  Index: changes.xml
  ===
  RCS file: /home/cvs/jakarta-commons/configuration/xdocs/changes.xml,v
  retrieving revision 1.72
  retrieving revision 1.73
  diff -u -r1.72 -r1.73
  --- changes.xml   19 Nov 2004 19:26:47 -  1.72
  +++ changes.xml   2 Dec 2004 22:06:21 -   1.73
  @@ -8,6 +8,11 @@
 body
   
   release version=1.1-dev date=in CVS
  +  action dev=ebourg type=remove
  +Removed the getPropertyDirect method from AbstractConfiguration,
  +concrete configurations now implement directly the getProperty method
  +from the Configuration interface.
  +  /action
  action dev=oheger type=add issue=31130
Added implementation of a save() method for 
HierarchicalXMLConfiguration.
  /action
  
  
  

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



cvs commit: jakarta-commons/configuration/xdocs changes.xml

2004-12-02 Thread ebourg
ebourg  2004/12/02 18:07:18

  Modified:configuration/src/java/org/apache/commons/configuration
JNDIConfiguration.java
   configuration/xdocs changes.xml
  Log:
  Removed the getProperties implementation in JNDIConfiguration, there was no 
reason to throw an UnsupportedOperationException here.
  addProperty has been removed as well since the implementation in 
AbstractConfiguration will call addPropertyDirect in JNDIConfiguration and 
result in the same exception.
  
  Revision  ChangesPath
  1.23  +1 -23 
jakarta-commons/configuration/src/java/org/apache/commons/configuration/JNDIConfiguration.java
  
  Index: JNDIConfiguration.java
  ===
  RCS file: 
/home/cvs/jakarta-commons/configuration/src/java/org/apache/commons/configuration/JNDIConfiguration.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- JNDIConfiguration.java2 Dec 2004 22:05:52 -   1.22
  +++ JNDIConfiguration.java3 Dec 2004 02:07:18 -   1.23
  @@ -108,17 +108,6 @@
   }
   
   /**
  - * pstrongThis operation is not supported and will throw an
  - * UnsupportedOperationException./strong/p
  - *
  - * @throws UnsupportedOperationException
  - */
  -public void addProperty(String key, Object token)
  -{
  -throw new UnsupportedOperationException(This operation is not 
supported);
  -}
  -
  -/**
* This method recursive traverse the JNDI tree, looking for Context 
objects.
* When it finds them, it traverses them as well.  Otherwise it just 
adds the
* values to the list of keys found.
  @@ -274,17 +263,6 @@
   }
   
   return null;
  -}
  -
  -/**
  - * pstrongThis operation is not supported and will throw an
  - * UnsupportedOperationException./strong/p
  - *
  - * @throws UnsupportedOperationException
  - */
  -public Properties getProperties(String key)
  -{
  -throw new UnsupportedOperationException(This operation is not 
supported);
   }
   
   /**
  
  
  
  1.74  +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.73
  retrieving revision 1.74
  diff -u -r1.73 -r1.74
  --- changes.xml   2 Dec 2004 22:06:21 -   1.73
  +++ changes.xml   3 Dec 2004 02:07:18 -   1.74
  @@ -8,6 +8,10 @@
 body
   
   release version=1.1-dev date=in CVS
  +  action dev=ebourg type=fix
  +Calling getProperties on a JNDIConfiguration no longer throws an
  +UnsupportedOperationException.
  +  /action
 action dev=ebourg type=remove
   Removed the getPropertyDirect method from AbstractConfiguration,
   concrete configurations now implement directly the getProperty method
  
  
  

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



cvs commit: jakarta-commons/configuration/xdocs changes.xml

2004-10-19 Thread epugh
epugh   2004/10/19 01:50:23

  Modified:configuration/xdocs changes.xml
  Log:
  take blame (or credit) for change!
  
  Revision  ChangesPath
  1.64  +1 -1  jakarta-commons/configuration/xdocs/changes.xml
  
  Index: changes.xml
  ===
  RCS file: /home/cvs/jakarta-commons/configuration/xdocs/changes.xml,v
  retrieving revision 1.63
  retrieving revision 1.64
  diff -u -r1.63 -r1.64
  --- changes.xml   18 Oct 2004 21:38:45 -  1.63
  +++ changes.xml   19 Oct 2004 08:50:22 -  1.64
  @@ -8,7 +8,7 @@
 body
   
   release version=1.1-dev date=in CVS
  -  action dev=ebourg type=remove
  +  action dev=epugh type=remove
   Remove deprecated getVector() implementations. 
 /action
 action dev=ebourg type=add issue=25661
  
  
  

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



cvs commit: jakarta-commons/configuration/xdocs changes.xml

2004-10-19 Thread ebourg
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  ChangesPath
  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.java18 Oct 2004 15:45:10 -  1.6
  +++ AbstractFileConfiguration.java19 Oct 2004 11:44:31 -  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 -  1.15
  +++ PropertiesConfiguration.java  19 Oct 2004 11:44:31 -  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 @@
*/

cvs commit: jakarta-commons/configuration/xdocs changes.xml

2004-10-18 Thread ebourg
ebourg  2004/10/18 04:12:09

  Modified:configuration/src/java/org/apache/commons/configuration
AbstractFileConfiguration.java
FileConfiguration.java
HierarchicalXMLConfiguration.java
XMLConfiguration.java
   configuration/xdocs changes.xml
  Log:
  Moved the auto save logic from XMLConfiguration to AbstractFileConfiguration
  
  Revision  ChangesPath
  1.5   +43 -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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- AbstractFileConfiguration.java4 Oct 2004 21:45:10 -   1.4
  +++ AbstractFileConfiguration.java18 Oct 2004 11:12:08 -  1.5
  @@ -45,6 +45,7 @@
   protected String fileName;
   protected String basePath;
   protected URL url;
  +protected boolean autoSave;
   
   /**
* Load the configuration from the underlying URL. If the URL is not
  @@ -430,5 +431,46 @@
   
   // update the file name
   fileName = ConfigurationUtils.getFileName(url);
  +}
  +
  +public void setAutoSave(boolean autoSave)
  +{
  +this.autoSave = autoSave;
  +}
  +
  +public boolean isAutoSave()
  +{
  +return autoSave;
  +}
  +
  +/**
  + * Save the configuration if the automatic persistence is enabled
  + * and if a file is specified.
  + */
  +protected void possiblySave()
  +{
  +if (autoSave  fileName != null)
  +{
  +try
  +{
  +save();
  +}
  +catch (ConfigurationException e)
  +{
  +throw new ConfigurationRuntimeException(Failed to auto-save, e);
  +}
  +}
  +}
  +
  +protected void addPropertyDirect(String key, Object obj)
  +{
  +super.addPropertyDirect(key, obj);
  +possiblySave();
  +}
  +
  +public void clearProperty(String key)
  +{
  +super.clearProperty(key);
  +possiblySave();
   }
   }
  
  
  
  1.2   +17 -1 
jakarta-commons/configuration/src/java/org/apache/commons/configuration/FileConfiguration.java
  
  Index: FileConfiguration.java
  ===
  RCS file: 
/home/cvs/jakarta-commons/configuration/src/java/org/apache/commons/configuration/FileConfiguration.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FileConfiguration.java22 Sep 2004 17:17:30 -  1.1
  +++ FileConfiguration.java18 Oct 2004 11:12:08 -  1.2
  @@ -207,4 +207,20 @@
*/
   void setURL(URL url);
   
  +/**
  + * Enable of disable the automatical saving of modified properties to the disk.
  + *
  + * @param autoSave codetrue/code to enable, codefalse/code to disable
  + * @since 1.1
  + */
  +void setAutoSave(boolean autoSave);
  +
  +/**
  + * Tells if properties are automatically saved to the disk.
  + *
  + * @return codetrue/code if auto-saving is enabled, codefalse/code 
otherwise
  + * @since 1.1
  + */
  +boolean isAutoSave();
  +
   }
  
  
  
  1.4   +11 -1 
jakarta-commons/configuration/src/java/org/apache/commons/configuration/HierarchicalXMLConfiguration.java
  
  Index: HierarchicalXMLConfiguration.java
  ===
  RCS file: 
/home/cvs/jakarta-commons/configuration/src/java/org/apache/commons/configuration/HierarchicalXMLConfiguration.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- HierarchicalXMLConfiguration.java 22 Sep 2004 17:17:30 -  1.3
  +++ HierarchicalXMLConfiguration.java 18 Oct 2004 11:12:08 -  1.4
  @@ -239,6 +239,16 @@
   delegate.setURL(url);
   }
   
  +public void setAutoSave(boolean autoSave)
  +{
  +delegate.setAutoSave(autoSave);
  +}
  +
  +public boolean isAutoSave()
  +{
  +return delegate.isAutoSave();
  +}
  +
   private class FileConfigurationDelegate extends AbstractFileConfiguration {
   
   public void load(Reader in) throws ConfigurationException
  
  
  
  1.18  +7 -46 
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.17
  

cvs commit: jakarta-commons/configuration/xdocs changes.xml

2004-10-14 Thread ebourg
ebourg  2004/10/14 02:54:36

  Modified:configuration project.xml
   configuration/xdocs changes.xml
  Added:   configuration/src/java/org/apache/commons/configuration/web
AppletConfiguration.java package.html
ServletConfiguration.java
ServletContextConfiguration.java
ServletFilterConfiguration.java
ServletRequestConfiguration.java
   configuration/src/test/org/apache/commons/configuration
TestAbstractConfiguration.java
   configuration/src/test/org/apache/commons/configuration/web
TestAppletConfiguration.java
TestServletConfiguration.java
TestServletContextConfiguration.java
TestServletFilterConfiguration.java
TestServletRequestConfiguration.java
  Log:
  Added web configurations
  
  Revision  ChangesPath
  1.39  +20 -4 jakarta-commons/configuration/project.xml
  
  Index: project.xml
  ===
  RCS file: /home/cvs/jakarta-commons/configuration/project.xml,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- project.xml   12 Oct 2004 12:29:08 -  1.38
  +++ project.xml   14 Oct 2004 09:54:35 -  1.39
  @@ -68,17 +68,17 @@
 id1.0-rc1/id
 name1.0-rc1/name
 tagCONFIGURATION_1_0_RC1/tag
  -/version  
  +/version
   version
 id1.0-rc2/id
 name1.0-rc2/name
 tagCONFIGURATION_1_0_RC2/tag
  -/version
  +/version
   version
 id1.0/id
 name1.0/name
 tagCONFIGURATION_1_0/tag
  -/version
  +/version
 /versions
 mailingLists
   mailingList
  @@ -264,6 +264,11 @@
 /properties
   /dependency
   
  +dependency
  +  idservletapi/id
  +  version2.3/version
  +/dependency
  +
   !-- Needed for testing --
   
   dependency
  @@ -308,6 +313,16 @@
 version1.4/version
   /dependency
   
  +dependency
  +  idmockobjects:mockobjects-core/id
  +  version0.09/version
  +/dependency
  +
  +dependency
  +  idmockobjects:mockobjects-jdk1.4-j2ee1.3/id
  +  version0.09/version
  +/dependency
  +
   !-- Fake dependency to test loading configuration files from a JAR --
   dependency
 idresources/id
  @@ -348,6 +363,7 @@
 excludes
   exclude**/TestBasePropertiesConfiguration.java/exclude
   exclude**/NonStringTestHolder.java/exclude
  +exclude**/TestAbstractConfiguration.java/exclude
 /excludes
 resources
   resource
  
  
  
  1.1  
jakarta-commons/configuration/src/java/org/apache/commons/configuration/web/AppletConfiguration.java
  
  Index: AppletConfiguration.java
  ===
  /*
   * Copyright 2004 The Apache Software Foundation.
   *
   * Licensed under the Apache License, Version 2.0 (the License)
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   * http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an AS IS BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  package org.apache.commons.configuration.web;
  
  import java.applet.Applet;
  import java.util.Iterator;
  
  import org.apache.commons.collections.iterators.ArrayIterator;
  import org.apache.commons.configuration.AbstractConfiguration;
  
  /**
   * A configuration wrapper to read applet parameters. This configuration is
   * read only, adding or removing a property will throw an
   * UnsupportedOperationException.
   *
   * @author a href=mailto:[EMAIL PROTECTED]Emmanuel Bourg/a
   * @version $Revision: 1.1 $, $Date: 2004/10/14 09:54:35 $
   */
  public class AppletConfiguration extends AbstractConfiguration
  {
  protected Applet applet;
  
  /**
   * Create an AppletConfiguration using the initialization parameters of
   * the specified Applet.
   *
   * @param applet
   */
  public AppletConfiguration(Applet applet)
  {
  this.applet = applet;
  }
  
  protected Object getPropertyDirect(String key)
  {
  return applet.getParameter(key);
  }
  
  protected void addPropertyDirect(String key, Object obj)
  {
  throw new UnsupportedOperationException(Read only configuration);
  }
  
  public boolean isEmpty()
  {
  return !getKeys().hasNext();
  

cvs commit: jakarta-commons/configuration/xdocs changes.xml

2004-10-11 Thread henning
henning 2004/10/11 03:07:30

  Modified:configuration/xdocs changes.xml
  Log:
  Move on to 1.0.1-dev
  
  Revision  ChangesPath
  1.54  +5 -2  jakarta-commons/configuration/xdocs/changes.xml
  
  Index: changes.xml
  ===
  RCS file: /home/cvs/jakarta-commons/configuration/xdocs/changes.xml,v
  retrieving revision 1.53
  retrieving revision 1.54
  diff -u -r1.53 -r1.54
  --- changes.xml   5 Oct 2004 22:56:58 -   1.53
  +++ changes.xml   11 Oct 2004 10:07:30 -  1.54
  @@ -6,9 +6,12 @@
 /properties
   
 body
  -release version=1.0 date=IN CVS
  +release version=1.0.1-dev date=in CVS
  +/release
  +
  +release version=1.0 date=2004-10-11
 action dev=ebourg type=fix issue=29616
  -The getStringArray() method in CompositeConfiguration now interpotales
  +The getStringArray() method in CompositeConfiguration now interpolates
   the strings.
 /action
 action dev=ebourg type=fix issue=31540
  
  
  

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



cvs commit: jakarta-commons/configuration/xdocs changes.xml

2004-10-05 Thread ebourg
ebourg  2004/10/05 14:17:25

  Modified:configuration/src/java/org/apache/commons/configuration
AbstractConfiguration.java SubsetConfiguration.java
   configuration/src/test/org/apache/commons/configuration
TestSubsetConfiguration.java
   configuration/xdocs changes.xml
  Log:
  SubsetConfiguration now shares the throwExceptionOnMissing property with its 
parent.
  
  Revision  ChangesPath
  1.25  +8 -6  
jakarta-commons/configuration/src/java/org/apache/commons/configuration/AbstractConfiguration.java
  
  Index: AbstractConfiguration.java
  ===
  RCS file: 
/home/cvs/jakarta-commons/configuration/src/java/org/apache/commons/configuration/AbstractConfiguration.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- AbstractConfiguration.java21 Sep 2004 17:58:10 -  1.24
  +++ AbstractConfiguration.java5 Oct 2004 21:17:25 -   1.25
  @@ -56,14 +56,15 @@
   private static final int INITIAL_LIST_SIZE = 2;
   
   /**
  - * Whether the configuration should throw NoSuchElementExceptions or simply 
return null
  - * when a property does not exist. Defaults to return null.
  + * Whether the configuration should throw NoSuchElementExceptions or simply
  + * return null when a property does not exist. Defaults to return null.
*/
   private boolean throwExceptionOnMissing = false;
   
   /**
* For configurations extending AbstractConfiguration, allow them to
* change the delimiter from the default comma (,).
  + *
* @param delimiter The new delimiter
*/
   public static void setDelimiter(char delimiter)
  @@ -73,6 +74,7 @@
   
   /**
* Retrieve the current delimiter.  By default this is a comma (,).
  + * 
* @return The delimiter in use
*/
   public static char getDelimiter()
  @@ -832,7 +834,7 @@
   {
   return number;
   }
  -else if (throwExceptionOnMissing)
  +else if (isThrowExceptionOnMissing())
   {
   throw new NoSuchElementException(
   '\'' + key + ' doesn't map to an existing object);
  @@ -886,7 +888,7 @@
   {
   return number;
   }
  -else if (throwExceptionOnMissing)
  +else if (isThrowExceptionOnMissing())
   {
   throw new NoSuchElementException(
   '\'' + key + ' doesn't map to an existing object);
  @@ -941,7 +943,7 @@
   {
   return s;
   }
  -else if (throwExceptionOnMissing)
  +else if (isThrowExceptionOnMissing())
   {
   throw new NoSuchElementException(
   '\'' + key + ' doesn't map to an existing object);
  
  
  
  1.6   +35 -1 
jakarta-commons/configuration/src/java/org/apache/commons/configuration/SubsetConfiguration.java
  
  Index: SubsetConfiguration.java
  ===
  RCS file: 
/home/cvs/jakarta-commons/configuration/src/java/org/apache/commons/configuration/SubsetConfiguration.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- SubsetConfiguration.java  24 Jun 2004 14:01:03 -  1.5
  +++ SubsetConfiguration.java  5 Oct 2004 21:17:25 -   1.6
  @@ -238,4 +238,38 @@
   return config.interpolate(base);
   }
   }
  +
  +/**
  + * [EMAIL PROTECTED]
  + *
  + * Change the behaviour of the parent configuration if it supports this feature.
  + */
  +public void setThrowExceptionOnMissing(boolean throwExceptionOnMissing)
  +{
  +if (parent instanceof AbstractConfiguration)
  +{
  +((AbstractConfiguration) 
parent).setThrowExceptionOnMissing(throwExceptionOnMissing);
  +}
  +else
  +{
  +super.setThrowExceptionOnMissing(throwExceptionOnMissing);
  +}
  +}
  +
  +/**
  + * [EMAIL PROTECTED]
  + *
  + * The subset inherits this feature from its parent if it supports this feature.
  + */
  +public boolean isThrowExceptionOnMissing()
  +{
  +if (parent instanceof AbstractConfiguration)
  +{
  +return ((AbstractConfiguration) parent).isThrowExceptionOnMissing();
  +}
  +else
  +{
  +return super.isThrowExceptionOnMissing();
  +}
  +}
   }
  
  
  
  1.6   +36 -1 
jakarta-commons/configuration/src/test/org/apache/commons/configuration/TestSubsetConfiguration.java
  
  Index: TestSubsetConfiguration.java
  ===
  RCS file: 

cvs commit: jakarta-commons/configuration/xdocs changes.xml

2004-10-05 Thread ebourg
ebourg  2004/10/05 15:56:58

  Modified:configuration/src/java/org/apache/commons/configuration
CompositeConfiguration.java
   configuration/src/test/org/apache/commons/configuration
TestCompositeConfiguration.java
   configuration/xdocs changes.xml
  Log:
  The getStringArray() method in CompositeConfiguration now interpotales the strings.
  
  Revision  ChangesPath
  1.19  +12 -11
jakarta-commons/configuration/src/java/org/apache/commons/configuration/CompositeConfiguration.java
  
  Index: CompositeConfiguration.java
  ===
  RCS file: 
/home/cvs/jakarta-commons/configuration/src/java/org/apache/commons/configuration/CompositeConfiguration.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- CompositeConfiguration.java   19 Sep 2004 22:01:50 -  1.18
  +++ CompositeConfiguration.java   5 Oct 2004 22:56:58 -   1.19
  @@ -312,15 +312,7 @@
*/
   public Vector getVector(String key, Vector defaultValue)
   {
  -List list = getList(key, defaultValue);
  -Vector vector = new Vector(list.size());
  -
  -for (Iterator it = list.iterator(); it.hasNext();)
  -{
  -vector.add(it.next());
  -}
  -
  -return vector;
  +return new Vector(getList(key, defaultValue));
   }
   
   /**
  @@ -329,7 +321,16 @@
   public String[] getStringArray(String key)
   {
   List list = getList(key);
  -return (String []) list.toArray(new String [0]);
  +
  +// interpolate the strings
  +String[] tokens = new String[list.size()];
  +
  +for (int i = 0; i  tokens.length; i++)
  +{
  +tokens[i] = interpolate(String.valueOf(list.get(i)));
  +}
  +
  +return tokens;
   }
   
   /**
  
  
  
  1.14  +69 -52
jakarta-commons/configuration/src/test/org/apache/commons/configuration/TestCompositeConfiguration.java
  
  Index: TestCompositeConfiguration.java
  ===
  RCS file: 
/home/cvs/jakarta-commons/configuration/src/test/org/apache/commons/configuration/TestCompositeConfiguration.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- TestCompositeConfiguration.java   22 Sep 2004 17:17:30 -  1.13
  +++ TestCompositeConfiguration.java   5 Oct 2004 22:56:58 -   1.14
  @@ -37,7 +37,9 @@
   protected XMLConfiguration xmlConf;
   protected CompositeConfiguration cc;
   
  -/** The File that we test with */
  +/**
  + * The File that we test with
  + */
   private String testProperties = new 
File(conf/test.properties).getAbsolutePath();
   private String testProperties2 = new 
File(conf/test2.properties).getAbsolutePath();
   private String testPropertiesXML = new File(conf/test.xml).getAbsolutePath();
  @@ -81,7 +83,7 @@
   Vector v = cc.getVector(packages);
   assertTrue(v.contains(packagea));
   }
  -
  +
   public void testGetProperty() throws Exception
   {
   cc.addConfiguration(conf1);
  @@ -103,24 +105,24 @@
   cc.removeConfiguration(internal);
   
   assertEquals(1, cc.getNumberOfConfigurations());
  -
   }
   
   public void testGetPropertyMissing() throws Exception
   {
   cc.addConfiguration(conf1);
   cc.addConfiguration(conf2);
  -try{
  +try
  +{
   assertNull(cc.getString(bogus.property));
   fail(Should have thrown a NoSuchElementException);
   }
  -catch(NoSuchElementException nsee){
  -assertTrue(nsee.getMessage().indexOf(bogus.property)-1);
  +catch (NoSuchElementException nsee)
  +{
  +assertTrue(nsee.getMessage().indexOf(bogus.property)  -1);
   }
   
   assertTrue(Should be false, !cc.getBoolean(test.missing.boolean, 
false));
   assertTrue(Should be true, cc.getBoolean(test.missing.boolean.true, 
true));
  -
   }
   
   /**
  @@ -251,8 +253,8 @@
   }
   
   /**
  -  * Tests codeList/code parsing.
  -  */
  + * Tests codeList/code parsing.
  + */
   public void testList() throws Exception
   {
   cc.addConfiguration(conf1);
  @@ -284,8 +286,8 @@
   }
   
   /**
  -  * Tests codeString/code array parsing.
  -  */
  + * Tests codeString/code array parsing.
  + */
   public void testStringArray() throws Exception
   {
   cc.addConfiguration(conf1);
  @@ -356,19 +358,17 @@
   cc.addProperty(array, value5);
   
   List list = cc.getList(array);
  -
  -for (Iterator it = list.iterator(); it.hasNext(); )
  +
  +for (Iterator it = list.iterator(); 

cvs commit: jakarta-commons/configuration/xdocs changes.xml

2004-10-04 Thread ebourg
ebourg  2004/10/04 13:06:09

  Modified:configuration/src/java/org/apache/commons/configuration
JNDIConfiguration.java
   configuration/xdocs changes.xml
  Log:
  All NamingEnumerations in JNDIConfiguraiton are now properly closed (Suggested by 
Eric Jung)
  
  Revision  ChangesPath
  1.19  +75 -36
jakarta-commons/configuration/src/java/org/apache/commons/configuration/JNDIConfiguration.java
  
  Index: JNDIConfiguration.java
  ===
  RCS file: 
/home/cvs/jakarta-commons/configuration/src/java/org/apache/commons/configuration/JNDIConfiguration.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- JNDIConfiguration.java21 Sep 2004 17:18:27 -  1.18
  +++ JNDIConfiguration.java4 Oct 2004 20:06:09 -   1.19
  @@ -132,33 +132,47 @@
*/
   private void recursiveGetKeys(Set keys, Context context, String prefix) throws 
NamingException
   {
  -// iterates through the context's elements
  -NamingEnumeration elements = context.list();
  -while (elements.hasMore())
  -{
  -NameClassPair nameClassPair = (NameClassPair) elements.next();
  -String name = nameClassPair.getName();
  -Object object = context.lookup(name);
  +NamingEnumeration elements = null;
   
  -// build the key
  -StringBuffer key = new StringBuffer();
  -key.append(prefix);
  -if (key.length()  0)
  -{
  -key.append(.);
  -}
  -key.append(name);
  +try
  +{
  +elements = context.list();
   
  -if (object instanceof Context)
  +// iterates through the context's elements
  +while (elements.hasMore())
   {
  -// add the keys of the sub context
  -Context subcontext = (Context) object;
  -recursiveGetKeys(keys, subcontext, key.toString());
  +NameClassPair nameClassPair = (NameClassPair) elements.next();
  +String name = nameClassPair.getName();
  +Object object = context.lookup(name);
  +
  +// build the key
  +StringBuffer key = new StringBuffer();
  +key.append(prefix);
  +if (key.length()  0)
  +{
  +key.append(.);
  +}
  +key.append(name);
  +
  +if (object instanceof Context)
  +{
  +// add the keys of the sub context
  +Context subcontext = (Context) object;
  +recursiveGetKeys(keys, subcontext, key.toString());
  +}
  +else
  +{
  +// add the key
  +keys.add(key.toString());
  +}
   }
  -else
  +}
  +finally
  +{
  +// close the enumeration
  +if (elements != null)
   {
  -// add the key
  -keys.add(key.toString());
  +elements.close();
   }
   }
   }
  @@ -232,19 +246,31 @@
   String key = (String) path.get(0);
   
   // search a context matching the key in the context's elements
  -NamingEnumeration elements = context.list();
  -while (elements.hasMore())
  -{
  -NameClassPair nameClassPair = (NameClassPair) elements.next();
  -String name = nameClassPair.getName();
  -Object object = context.lookup(name);
  +NamingEnumeration elements = null;
   
  -if (object instanceof Context  name.equals(key))
  +try
  +{
  +elements = context.list();
  +while (elements.hasMore())
   {
  -Context subcontext = (Context) object;
  +NameClassPair nameClassPair = (NameClassPair) elements.next();
  +String name = nameClassPair.getName();
  +Object object = context.lookup(name);
   
  -// recursive search in the sub context
  -return getContext(path.subList(1, path.size()), subcontext);
  +if (object instanceof Context  name.equals(key))
  +{
  +Context subcontext = (Context) object;
  +
  +// recursive search in the sub context
  +return getContext(path.subList(1, path.size()), subcontext);
  +}
  +}
  +}
  +finally
  +{
  +if (elements != null)
  +{
  +elements.close();
   }
   }
   
  @@ -268,8 +294,21 @@
   

cvs commit: jakarta-commons/configuration/xdocs changes.xml

2004-10-04 Thread ebourg
ebourg  2004/10/04 14:45:11

  Modified:configuration/src/java/org/apache/commons/configuration
AbstractFileConfiguration.java
   configuration/src/test/org/apache/commons/configuration
TestXMLConfiguration.java
   configuration/xdocs changes.xml
  Added:   configuration/src/test/org/apache/commons/configuration
TestFileConfiguration.java
  Log:
  Removed file: at the beginning of the base path when calling setFile() on a 
FileConfiguration. This prevented auto saving an XMLConfiguration loaded from a File 
(issue reported by Mark Roth).
  
  Revision  ChangesPath
  1.4   +5 -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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AbstractFileConfiguration.java23 Sep 2004 11:49:45 -  1.3
  +++ AbstractFileConfiguration.java4 Oct 2004 21:45:10 -   1.4
  @@ -423,6 +423,10 @@
   
   // update the base path
   basePath = ConfigurationUtils.getBasePath(url);
  +if (basePath != null  basePath.startsWith(file:))
  +{
  +basePath = basePath.substring(5);
  +}
   
   // update the file name
   fileName = ConfigurationUtils.getFileName(url);
  
  
  
  1.13  +13 -2 
jakarta-commons/configuration/src/test/org/apache/commons/configuration/TestXMLConfiguration.java
  
  Index: TestXMLConfiguration.java
  ===
  RCS file: 
/home/cvs/jakarta-commons/configuration/src/test/org/apache/commons/configuration/TestXMLConfiguration.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- TestXMLConfiguration.java 4 Oct 2004 18:14:59 -   1.12
  +++ TestXMLConfiguration.java 4 Oct 2004 21:45:11 -   1.13
  @@ -18,8 +18,8 @@
   
   import java.io.File;
   import java.io.IOException;
  -import java.util.List;
   import java.util.Iterator;
  +import java.util.List;
   import java.util.Vector;
   
   import junit.framework.TestCase;
  @@ -394,6 +394,17 @@
assertTrue(The saved configuration doesn't contain the key ' + key + 
', checkConfig.containsKey(key));
assertEquals(Value of the ' + key + ' property, 
conf.getProperty(key), checkConfig.getProperty(key));
   }
  +}
  +
  +public void testAutoSave() throws Exception
  +{
  +conf.setFile(new File(target/testsave.xml));
  +conf.setAutoSave(true);
  +conf.setProperty(autosave, ok);
  +
  +// reload the configuration
  +XMLConfiguration conf2 = new XMLConfiguration(conf.getFile());
  +assertEquals('autosave' property, ok, conf2.getString(autosave));
   }
   
   public void testParseElementsNames()
  
  
  
  1.1  
jakarta-commons/configuration/src/test/org/apache/commons/configuration/TestFileConfiguration.java
  
  Index: TestFileConfiguration.java
  ===
  /*
   * Copyright 2004 The Apache Software Foundation.
   *
   * Licensed under the Apache License, Version 2.0 (the License)
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   * http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an AS IS BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  package org.apache.commons.configuration;
  
  import java.net.URL;
  
  import junit.framework.TestCase;
  
  /**
   * @author Emmanuel Bourg
   * @version $Revision: 1.1 $, $Date: 2004/10/04 21:45:11 $
   */
  public class TestFileConfiguration extends TestCase
  {
  public void testSetURL() throws Exception
  {
  // http URL
  FileConfiguration config = new PropertiesConfiguration();
  config.setURL(new 
URL(http://jakarta.apache.org/commons/configuration/index.html;));
  
  assertEquals(base path, 
http://jakarta.apache.org/commons/configuration/;, config.getBasePath());
  assertEquals(file name, index.html, config.getFileName());
  
  // file URL
  config.setURL(new URL(file:/temp/test.properties));
  assertEquals(base path, /temp/, config.getBasePath());
  assertEquals(file name, test.properties, config.getFileName());
  }
  }
  
  
  
  

cvs commit: jakarta-commons/configuration/xdocs changes.xml

2004-09-03 Thread ebourg
ebourg  2004/09/03 09:36:21

  Modified:configuration/src/java/org/apache/commons/configuration
XMLConfiguration.java
   configuration/src/test/org/apache/commons/configuration
TestXMLConfiguration.java
   configuration/xdocs changes.xml
  Log:
  Fixed Bug 30839 (ClassCastException in XMLConfiguration)
  
  Revision  ChangesPath
  1.11  +4 -4  
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.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- XMLConfiguration.java 14 Aug 2004 11:32:06 -  1.10
  +++ XMLConfiguration.java 3 Sep 2004 16:36:20 -   1.11
  @@ -374,7 +374,7 @@
   }
   
   if (attName == null) {
  -CharacterData data = document.createTextNode((String) value);
  +CharacterData data = document.createTextNode(String.valueOf(value));
   element.appendChild(data);
   } else {
   element.setAttribute(attName, (String) value);
  @@ -427,10 +427,10 @@
   Element child = document.createElement(nodes[nodes.length - 1]);
   parent.appendChild(child);
   if (attName == null) {
  -CharacterData data = document.createTextNode((String) value);
  +CharacterData data = document.createTextNode(String.valueOf(value));
   child.appendChild(data);
   } else {
  -child.setAttribute(attName, (String) value);
  +child.setAttribute(attName, String.valueOf(value));
   }
   }
   
  
  
  
  1.9   +37 -24
jakarta-commons/configuration/src/test/org/apache/commons/configuration/TestXMLConfiguration.java
  
  Index: TestXMLConfiguration.java
  ===
  RCS file: 
/home/cvs/jakarta-commons/configuration/src/test/org/apache/commons/configuration/TestXMLConfiguration.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- TestXMLConfiguration.java 16 Aug 2004 22:16:31 -  1.8
  +++ TestXMLConfiguration.java 3 Sep 2004 16:36:21 -   1.9
  @@ -44,7 +44,7 @@
   conf = new XMLConfiguration(new File(testProperties));
   }
   
  -public void testGetProperty() throws Exception
  +public void testGetProperty()
   {
   assertEquals(value, conf.getProperty(element));
   }
  @@ -66,7 +66,7 @@
   conf.clearProperty(key);
   assertNull(key, conf.getProperty(key));
   assertNull(key, conf.getXmlProperty(key));
  -
  +
   // test single element
   conf.load();
   key = clear.element;
  @@ -83,21 +83,21 @@
   key = [EMAIL PROTECTED];
   assertNotNull(key, conf.getProperty(key));
   assertNotNull(key, conf.getXmlProperty(key));
  -
  +
   // test non-text/cdata element
   conf.load();
   key = clear.comment;
   conf.clearProperty(key);
   assertNull(key, conf.getProperty(key));
   assertNull(key, conf.getXmlProperty(key));
  -
  +
   // test cdata element
   conf.load();
   key = clear.cdata;
   conf.clearProperty(key);
   assertNull(key, conf.getProperty(key));
   assertNull(key, conf.getXmlProperty(key));
  -
  +
   // test multiple sibling elements
   conf.load();
   key = clear.list.item;
  @@ -107,7 +107,7 @@
   key = [EMAIL PROTECTED];
   assertNotNull(key, conf.getProperty(key));
   assertNotNull(key, conf.getXmlProperty(key));
  -
  +
   // test multiple, disjoined elements
   conf.load();
   key = list.item;
  @@ -120,7 +120,7 @@
   // test non-leaf element
   Object property = conf.getXmlProperty(clear);
   assertNull(property);
  -
  +
   // test non-existent element
   property = conf.getXmlProperty(e);
   assertNull(property);
  @@ -128,29 +128,29 @@
   // test non-existent element
   property = conf.getXmlProperty([EMAIL PROTECTED]);
   assertNull(property);
  -
  +
   // test single element
   property = conf.getXmlProperty(element);
   assertNotNull(property);
   assertTrue(property instanceof String);
   assertEquals(value, property);
  -
  +
   // test single attribute
   property = conf.getXmlProperty([EMAIL PROTECTED]);
   assertNotNull(property);
   assertTrue(property instanceof String);
   assertEquals(foo, property);
  -
  +
   // 

cvs commit: jakarta-commons/configuration/xdocs changes.xml

2004-08-16 Thread henning
henning 2004/08/16 15:16:33

  Modified:configuration project.xml
   configuration/src/java/org/apache/commons/configuration
AbstractConfiguration.java
CompositeConfiguration.java Configuration.java
   configuration/src/test/org/apache/commons/configuration
BaseNonStringProperties.java
NonStringTestHolder.java TestBaseConfiguration.java
TestBasePropertiesConfiguration.java
TestCompositeConfiguration.java
TestConfigurationConverter.java
TestDatabaseConfiguration.java
TestEqualBehaviour.java
TestSubsetConfiguration.java
TestXMLConfiguration.java
   configuration/xdocs changes.xml
  Log:
  bring back the getVector() methods in the Configuration interface,
  making it possible to use 1.0-rc1 and beyond as drop-in replacement
  for older commons-configuration snapshots as used by e.g. Turbine-2.3
  and Torque-3.1
  
  Without this patch, these fail miserably due to missing method errors.
  
  The methods are deprecated and should be removed in 1.1
  
  Unit tests and change message are included.
  
  Revision  ChangesPath
  1.26  +2 -1  jakarta-commons/configuration/project.xml
  
  Index: project.xml
  ===
  RCS file: /home/cvs/jakarta-commons/configuration/project.xml,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- project.xml   14 Aug 2004 12:22:50 -  1.25
  +++ project.xml   16 Aug 2004 22:16:30 -  1.26
  @@ -116,6 +116,7 @@
 idhenning/id
 email[EMAIL PROTECTED]/email
 organizationINTERMETA - Gesellschaft fuer Mehrwertdienste mbH/organization
  +  timezone2/timezone
   /developer
   
   developer
  
  
  
  1.20  +51 -1 
jakarta-commons/configuration/src/java/org/apache/commons/configuration/AbstractConfiguration.java
  
  Index: AbstractConfiguration.java
  ===
  RCS file: 
/home/cvs/jakarta-commons/configuration/src/java/org/apache/commons/configuration/AbstractConfiguration.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- AbstractConfiguration.java12 Aug 2004 15:45:58 -  1.19
  +++ AbstractConfiguration.java16 Aug 2004 22:16:30 -  1.20
  @@ -25,6 +25,7 @@
   import java.util.NoSuchElementException;
   import java.util.Properties;
   import java.util.StringTokenizer;
  +import java.util.Vector;
   
   import org.apache.commons.collections.Predicate;
   import org.apache.commons.collections.iterators.FilterIterator;
  @@ -37,6 +38,7 @@
*
* @author a href=mailto:[EMAIL PROTECTED]Konstantin Shaposhnikov/a
* @author a href=mailto:[EMAIL PROTECTED]Oliver Heger/a
  + * @author a href=mailto:[EMAIL PROTECTED]Henning P. Schmiedehausen/a
* @version $Id$
*/
   public abstract class AbstractConfiguration implements Configuration
  @@ -991,6 +993,54 @@
   + value.getClass().getName());
   }
   return list;
  +}
  +
  +/**
  + * [EMAIL PROTECTED]
  + */
  +public Vector getVector(String key)
  +{
  +return getVector(key, new Vector());
  +}
  +
  +/**
  + * [EMAIL PROTECTED]
  + */
  +public Vector getVector(String key, Vector defaultValue)
  +{
  +Object value = getPropertyDirect(key);
  +Vector vector = null;
  +
  +if (value instanceof String)
  +{
  +vector = new Vector(1);
  +vector.add(value);
  +}
  +else if (value instanceof List)
  +{
  +vector = new Vector(((List) value).size());
  +
  +for (Iterator it = ((List) value).iterator(); it.hasNext(); )
  +{
  +Object obj = it.next();
  +vector.add(obj);
  +}
  +}
  +else if (value == null)
  +{
  +vector = defaultValue;
  +}
  +else
  +{
  +throw new ConversionException(
  +'\''
  ++ key
  ++ ' doesn't map to a Vector object: 
  ++ value
  ++ , a 
  ++ value.getClass().getName());
  +}
  +return vector;
   }
   
   /**
  
  
  
  1.17  +18 -1 
jakarta-commons/configuration/src/java/org/apache/commons/configuration/CompositeConfiguration.java
  
  Index: CompositeConfiguration.java
  ===
  RCS file: 

cvs commit: jakarta-commons/configuration/xdocs changes.xml

2004-08-14 Thread epugh
epugh   2004/08/14 06:06:13

  Modified:configuration/xdocs changes.xml
  Log:
  update date of release
  
  Revision  ChangesPath
  1.34  +1 -1  jakarta-commons/configuration/xdocs/changes.xml
  
  Index: changes.xml
  ===
  RCS file: /home/cvs/jakarta-commons/configuration/xdocs/changes.xml,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- changes.xml   14 Aug 2004 11:21:26 -  1.33
  +++ changes.xml   14 Aug 2004 13:06:13 -  1.34
  @@ -6,7 +6,7 @@
 /properties
   
 body
  -release version=1.0-rc1 date=2004-06-??
  +release version=1.0-rc1 date=2004-08-14
 action dev=epugh type=add due-to=Oliver Heger 
issue=30597HierarchicalConfigurationXMLReader stores comments as text 
nodes/action
 action dev=epugh type=add due-to=Ricardo Gladwell 
issue=30648project.xml contains bad dependencies/action
 action dev=epugh type=add due-to=Brent Worden issue=30234 
clearXmlProperty doesn't remove list properties completely/action
  
  
  

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



cvs commit: jakarta-commons/configuration/xdocs changes.xml

2004-07-21 Thread ebourg
ebourg  2004/07/21 05:44:41

  Modified:configuration/xdocs changes.xml
  Log:
  Fixed bugs 30074, 30205, 30209 and 30212
  
  Revision  ChangesPath
  1.26  +9 -0  jakarta-commons/configuration/xdocs/changes.xml
  
  Index: changes.xml
  ===
  RCS file: /home/cvs/jakarta-commons/configuration/xdocs/changes.xml,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- changes.xml   13 Jul 2004 14:08:47 -  1.25
  +++ changes.xml   21 Jul 2004 12:44:41 -  1.26
  @@ -7,6 +7,15 @@
   
 body
   release version=1.0rc1 date=2004-06-??
  +  action dev=ebourg type=fix
  +Fixed several bugs related to XMLConfiguration:
  +ul
  +  li30074 - Can't add a new property as an attribute in 
XMLConfiguration/li
  +  li30205 - XMLConfiguration doesn't support attribute names with a 
dot/li
  +  li30209 - XMLConfiguration doesn't ignore comments/li
  +  li30212 - XMLConfiguration.save() doesn't escape reserved 
characters/li
  +/ul
  +  /action
 action dev=ebourg type=add
   Added save methods in XMLConfiguration similar to PropertiesConfiguration
   to save the configuration to another file (bug 29721).
  
  
  

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



cvs commit: jakarta-commons/configuration/xdocs changes.xml

2004-06-21 Thread ebourg
ebourg  2004/06/21 10:45:29

  Modified:configuration/src/java/org/apache/commons/configuration
BasePropertiesConfiguration.java
PropertiesConfiguration.java
   configuration/xdocs changes.xml
  Log:
  Added a save() method to PropertiesConfiguration and save(Writer out), 
save(OutputStream out), save(OutputStream out, String encoding) to 
BasePropertiesConfiguration.
  
  Revision  ChangesPath
  1.12  +86 -44
jakarta-commons/configuration/src/java/org/apache/commons/configuration/BasePropertiesConfiguration.java
  
  Index: BasePropertiesConfiguration.java
  ===
  RCS file: 
/home/cvs/jakarta-commons/configuration/src/java/org/apache/commons/configuration/BasePropertiesConfiguration.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- BasePropertiesConfiguration.java  16 Jun 2004 18:13:53 -  1.11
  +++ BasePropertiesConfiguration.java  21 Jun 2004 17:45:29 -  1.12
  @@ -16,14 +16,17 @@
   
   package org.apache.commons.configuration;
   
  -import java.io.File;
   import java.io.FileWriter;
  +import java.io.FilterWriter;
   import java.io.IOException;
   import java.io.InputStream;
   import java.io.InputStreamReader;
   import java.io.LineNumberReader;
  +import java.io.OutputStream;
  +import java.io.OutputStreamWriter;
   import java.io.Reader;
   import java.io.UnsupportedEncodingException;
  +import java.io.Writer;
   import java.util.Date;
   import java.util.Iterator;
   import java.util.List;
  @@ -139,8 +142,7 @@
*
* @throws ConfigurationException
*/
  -public void load(InputStream input)
  -throws ConfigurationException
  +public void load(InputStream input) throws ConfigurationException
   {
   load(input, null);
   }
  @@ -165,7 +167,7 @@
   }
   catch (UnsupportedEncodingException e)
   {
  -throw new ConfigurationException(Should look up and use default 
encoding.,e);
  +throw new ConfigurationException(Should look up and use default 
encoding., e);
   }
   }
   
  @@ -174,7 +176,8 @@
   reader = new PropertiesReader(new InputStreamReader(input));
   }
   
  -try {
  +try
  +{
   while (true)
   {
   String line = reader.readProperty();
  @@ -214,58 +217,98 @@
   }
   }
   }
  -catch (IOException ioe){
  +catch (IOException ioe)
  +{
throw new ConfigurationException(Could not load configuration from 
input stream.,ioe);
   }
   }
   
   /**
  - * save properties to a file.
  - * properties with multiple values are saved comma seperated.
  + * Save the configuration to a file. Properties with multiple values are
  + * saved on multiple lines, one value per line.
*
  - * @param filename name of the properties file
  + * @param filename the name of the properties file
*
* @throws ConfigurationException
*/
   public void save(String filename) throws ConfigurationException
   {
  -PropertiesWriter out = null;
  -File file = new File(filename);
  -try {
  - out = new PropertiesWriter(file);
  -
  - out.writeComment(written by PropertiesConfiguration);
  - out.writeComment(new Date().toString());
  -
  - for (Iterator i = this.getKeys(); i.hasNext();)
  - {
  - String key = (String) i.next();
  -Object value = getProperty(key);
  +FileWriter writer = null;
   
  -if (value instanceof List)
  -{
  -out.writeProperty(key, (List) value);
  -}
  -else
  -{
  -out.writeProperty(key, value);
  -}
  - }
  - out.flush();
  - out.close();
  +try
  +{
  +writer = new FileWriter(filename);
  +save(writer);
   }
  -catch (IOException ioe)
  +catch (IOException e)
   {
  -try {
  -if (out != null){
  -out.close();
  + throw new ConfigurationException(Could not save to file  + filename, 
e);
  +}
  +finally
  +{
  +// close the writer
  +try
  +{
  +if (writer != null)
  +{
  +writer.close();
   }
   }
  -catch (IOException ioe2){
  +catch (IOException ioe2) { }
  +}
  +}
  +
  +/**
  + * Save the configuration to the specified stream.

cvs commit: jakarta-commons/configuration/xdocs changes.xml

2004-06-16 Thread ebourg
ebourg  2004/06/16 08:17:09

  Modified:configuration/src/java/org/apache/commons/configuration
ConfigurationConverter.java
   configuration/src/test/org/apache/commons/configuration
TestConfigurationConverter.java
   configuration/xdocs changes.xml
  Log:
  List values are now properly stored as comma separated values in the Properties 
object returned by ConfigurationConverter.getProperties() (Bug 29607)
  
  Revision  ChangesPath
  1.5   +57 -32
jakarta-commons/configuration/src/java/org/apache/commons/configuration/ConfigurationConverter.java
  
  Index: ConfigurationConverter.java
  ===
  RCS file: 
/home/cvs/jakarta-commons/configuration/src/java/org/apache/commons/configuration/ConfigurationConverter.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ConfigurationConverter.java   2 Jun 2004 16:42:24 -   1.4
  +++ ConfigurationConverter.java   16 Jun 2004 15:17:09 -  1.5
  @@ -1,5 +1,3 @@
  -package org.apache.commons.configuration;
  -
   /*
* Copyright 2001-2004 The Apache Software Foundation.
*
  @@ -16,71 +14,83 @@
* limitations under the License.
*/
   
  +package org.apache.commons.configuration;
  +
   import java.util.Enumeration;
   import java.util.Iterator;
  -import java.util.Properties;
   import java.util.List;
  +import java.util.Properties;
   import java.util.Vector;
   
   import org.apache.commons.collections.ExtendedProperties;
   
  -
   /**
  - * Configuration converter. br
  - * Helper class to convert between Configuration, ExtendedProperties and
  - * standard Properties.
  + * Configuration converter. Helper class to convert between Configuration,
  + * ExtendedProperties and standard Properties.
*
  - * @version $Id$
  + * @author a href=mailto:[EMAIL PROTECTED]Martin Poeschl/a
  + * @version $Revision$, $Date$
*/
   public class ConfigurationConverter
   {
   /**
* Convert a ExtendedProperties class into a Configuration class.
*
  - * @param ep ExtendedProperties object to convert
  + * @param eprops ExtendedProperties object to convert
* @return Configuration created from the ExtendedProperties
*/
  -public static Configuration getConfiguration(ExtendedProperties ep)
  +public static Configuration getConfiguration(ExtendedProperties eprops)
   {
   Configuration config = new BaseConfiguration();
  -for (Iterator i = ep.getKeys(); i.hasNext();)
  +
  +Iterator keys = eprops.getKeys();
  +
  +while (keys.hasNext())
   {
  -String key = (String) i.next();
  -config.setProperty(key, ep.getProperty(key));
  +String key = (String) keys.next();
  +config.setProperty(key, eprops.getProperty(key));
   }
  +
   return config;
   }
   
   /**
  - * Convert a standard properties class into a configuration class.
  + * Convert a standard Properties class into a configuration class.
*
  - * @param p properties object to convert
  + * @param props properties object to convert
* @return Configuration configuration created from the Properties
*/
  -public static Configuration getConfiguration(Properties p)
  +public static Configuration getConfiguration(Properties props)
   {
   Configuration config = new BaseConfiguration();
  -for (Enumeration e = p.keys(); e.hasMoreElements();)
  +
  +Enumeration keys = props.keys();
  +
  +while (keys.hasMoreElements())
   {
  -String key = (String) e.nextElement();
  -config.setProperty(key, p.getProperty(key));
  +String key = (String) keys.nextElement();
  +config.setProperty(key, props.getProperty(key));
   }
  +
   return config;
   }
   
   /**
* Convert a Configuration class into a ExtendedProperties class.
*
  - * @param c Configuration object to convert
  + * @param config Configuration object to convert
* @return ExtendedProperties created from the Configuration
*/
  -public static ExtendedProperties getExtendedProperties(Configuration c)
  +public static ExtendedProperties getExtendedProperties(Configuration config)
   {
   ExtendedProperties props = new ExtendedProperties();
  -for (Iterator i = c.getKeys(); i.hasNext();)
  +
  +Iterator keys = config.getKeys();
  +
  +while (keys.hasNext())
   {
  -String key = (String) i.next();
  -Object property = c.getProperty(key);
  +String key = (String) keys.next();
  +Object property = config.getProperty(key);
   
   // turn lists into vectors
   if (property instanceof 

cvs commit: jakarta-commons/configuration/xdocs changes.xml

2004-03-28 Thread epugh
epugh   2004/03/28 06:43:20

  Modified:configuration/xdocs changes.xml
  Log:
  Update changes
  
  Revision  ChangesPath
  1.16  +3 -0  jakarta-commons/configuration/xdocs/changes.xml
  
  Index: changes.xml
  ===
  RCS file: /home/cvs/jakarta-commons/configuration/xdocs/changes.xml,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- changes.xml   9 Mar 2004 10:31:31 -   1.15
  +++ changes.xml   28 Mar 2004 14:43:20 -  1.16
  @@ -8,6 +8,9 @@
 body
   release version=1.0-dev-4 date=  
 action dev=ebourg type=update
  +Refactored JNDIConfiguration to use AbstractConfiguration.
  + /action  
  +  action dev=ebourg type=update
   Fixed bug 27427 by refactoring out the subset logic into a 
SubsetConfiguration.
/action   
action dev=oheger type=fix
  
  
  

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



cvs commit: jakarta-commons/configuration/xdocs changes.xml

2004-02-27 Thread epugh
epugh   2004/02/27 09:41:36

  Modified:configuration/src/test/org/apache/commons/configuration
TestConfigurationFactory.java
TestClassPropertiesConfiguration.java
TestJNDIConfiguration.java
BaseNonStringProperties.java
TestCompositeConfiguration.java
TestNonStringProperties.java
TestBaseConfiguration.java
TestBasePropertiesConfiguration.java
TestBaseConfigurationXMLReader.java
TestDatabaseConfiguration.java
NonStringTestHolder.java
TestPropertiesSequence.java
TestJNDIEnvironmentValues.java
TestHierarchicalConfigurationXMLReader.java
TestStrictConfigurationComparator.java
TestCompositeConfigurationNonStringProperties.java
TestConfigurationConverter.java
TestConfigurationUtils.java TestEqualsProperty.java
TestPropertiesConfiguration.java
TestConfigurationKey.java TestEqualBehaviour.java
TestDOM4JConfiguration.java
TestHierarchicalConfiguration.java
TestHierarchicalDOM4JConfiguration.java
   configuration/src/java/org/apache/commons/configuration
DOM4JConfiguration.java CompositeConfiguration.java
ConfigurationXMLReader.java
PropertiesConfiguration.java JNDIConfiguration.java
DatabaseConfiguration.java ConfigurationKey.java
ConfigurationException.java
ConfigurationComparator.java BaseConfiguration.java
ConfigurationConverter.java
BasePropertiesConfiguration.java Configuration.java
XMLConfiguration.java BasePathConfiguration.java
HierarchicalConfiguration.java
StrictConfigurationComparator.java
HierarchicalConfigurationConverter.java
ConfigurationFactory.java
HierarchicalDOM4JConfiguration.java
ConfigurationUtils.java
BaseConfigurationXMLReader.java
HierarchicalConfigurationXMLReader.java
ClassPropertiesConfiguration.java
AbstractConfiguration.java BasePathLoader.java
   configuration/src/test-cactus/org/apache/commons/configuration
TestJNDIAndCompositeConfiguration.java
TestConfigurationFactoryWithJNDI.java
   configuration/xdocs changes.xml
  Log:
  Update to ASL 2.0 License.  Thanks to Jeff painter for script
  
  Revision  ChangesPath
  1.9   +14 -53
jakarta-commons/configuration/src/test/org/apache/commons/configuration/TestConfigurationFactory.java
  
  
http://cvs.apache.org/viewcvs/jakarta-commons/configuration/src/test/org/apache/commons/configuration/TestConfigurationFactory.java.diff?r1=1.8r2=1.9
  
  
  1.3   +14 -55
jakarta-commons/configuration/src/test/org/apache/commons/configuration/TestClassPropertiesConfiguration.java
  
  
http://cvs.apache.org/viewcvs/jakarta-commons/configuration/src/test/org/apache/commons/configuration/TestClassPropertiesConfiguration.java.diff?r1=1.2r2=1.3
  
  
  1.5   +14 -53
jakarta-commons/configuration/src/test/org/apache/commons/configuration/TestJNDIConfiguration.java
  
  
http://cvs.apache.org/viewcvs/jakarta-commons/configuration/src/test/org/apache/commons/configuration/TestJNDIConfiguration.java.diff?r1=1.4r2=1.5
  
  
  1.5   +14 -53
jakarta-commons/configuration/src/test/org/apache/commons/configuration/BaseNonStringProperties.java
  
  
http://cvs.apache.org/viewcvs/jakarta-commons/configuration/src/test/org/apache/commons/configuration/BaseNonStringProperties.java.diff?r1=1.4r2=1.5
  
  
  1.5   +14 -53
jakarta-commons/configuration/src/test/org/apache/commons/configuration/TestCompositeConfiguration.java
  
  
http://cvs.apache.org/viewcvs/jakarta-commons/configuration/src/test/org/apache/commons/configuration/TestCompositeConfiguration.java.diff?r1=1.4r2=1.5
  
  
  1.3   +14 -53
jakarta-commons/configuration/src/test/org/apache/commons/configuration/TestNonStringProperties.java
  
  
http://cvs.apache.org/viewcvs/jakarta-commons/configuration/src/test/org/apache/commons/configuration/TestNonStringProperties.java.diff?r1=1.2r2=1.3
  
  
  1.7   +14 -55
jakarta-commons/configuration/src/test/org/apache/commons/configuration/TestBaseConfiguration.java
  
  

cvs commit: jakarta-commons/configuration/xdocs changes.xml

2004-01-30 Thread epugh
epugh   2004/01/30 06:53:11

  Modified:configuration/xdocs changes.xml
  Log:
  Update changes
  
  Revision  ChangesPath
  1.7   +5 -4  jakarta-commons/configuration/xdocs/changes.xml
  
  Index: changes.xml
  ===
  RCS file: /home/cvs/jakarta-commons/configuration/xdocs/changes.xml,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- changes.xml   30 Jan 2004 14:05:00 -  1.6
  +++ changes.xml   30 Jan 2004 14:53:11 -  1.7
  @@ -7,13 +7,14 @@
   
 body
   release version=1.0-dev-4 date=
  +  action dev=epugh type=add
  + ConfigurationException is now thrown by public methods instead of 
Exception or
  + IOException or whatnot.
  + /action   
 action dev=ebourg type=add
For configuration based on properties files, allow characters like \n 
etc
to be escaped and unescaped.
  - /action  
  -  action dev=epugh type=add
  - ConfigurationFactory now throws ConfigurationLoadException.
  - /action   
  + /action   
 action dev=ebourg type=add
New DatabaseConfiguration that uses a database to store the 
properties. It supports 2 table structures :
ul
  
  
  

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