Emmanuel Bourg
Index: src/java/org/apache/commons/configuration/AbstractConfiguration.java
===================================================================
RCS file:
/home/cvspublic/jakarta-commons/configuration/src/java/org/apache/commons/configuration/AbstractConfiguration.java,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 AbstractConfiguration.java
--- src/java/org/apache/commons/configuration/AbstractConfiguration.java 23 Dec
2003 15:09:05 -0000 1.1.1.1
+++ src/java/org/apache/commons/configuration/AbstractConfiguration.java 23 Dec
2003 16:28:39 -0000
@@ -61,7 +61,6 @@
import java.util.NoSuchElementException;
import java.util.Properties;
import java.util.StringTokenizer;
-import java.util.Vector;
/**
* Abstract configuration class. Provide basic functionality but does not
@@ -116,7 +115,7 @@
*
* addProperty("resource.loader", "classpath")
*
- * Then you will end up with a Vector like the following:
+ * Then you will end up with a List like the following:
*
* ["file", "classpath"]
*
@@ -281,9 +280,9 @@
}
/**
- * Returns a Vector of Strings built from the supplied
+ * Returns a List of Strings built from the supplied
* String. Splits up CSV lists. If no commas are in the
- * String, simply returns a Vector with the String as its
+ * String, simply returns a List with the String as its
* first element
*
* @param token The String to tokenize
@@ -500,7 +499,7 @@
* @return The associated properties if key is found.
*
* @throws ClassCastException is thrown if the key maps to an
- * object that is not a String/Vector.
+ * object that is not a String/List.
* @throws IllegalArgumentException if one of the tokens is
* malformed (does not contain an equals sign).
*
@@ -522,7 +521,7 @@
* @return The associated properties if key is found.
*
* @throws ClassCastException is thrown if the key maps to an
- * object that is not a String/Vector of Strings.
+ * object that is not a String/List of Strings.
* @throws IllegalArgumentException if one of the tokens is
* malformed (does not contain an equals sign).
*/
@@ -588,11 +587,11 @@
//
// We must never give a Container Object out. So if the
// Return Value is a Container, we fix it up to be a
- // Vector
+ // List
//
if (o instanceof Container)
{
- o = ((Container) o).asVector();
+ o = ((Container) o).asList();
}
return o;
}
@@ -1306,7 +1305,7 @@
* @return The associated string array if key is found.
*
* @throws ClassCastException is thrown if the key maps to an
- * object that is not a String/Vector of Strings.
+ * object that is not a String/List of Strings.
*/
public String[] getStringArray(String key)
{
@@ -1343,29 +1342,29 @@
else
{
throw new ClassCastException(
- '\'' + key + "' doesn't map to a String/Vector object");
+ '\'' + key + "' doesn't map to a String/List object");
}
return tokens;
}
/**
- * Get a Vector of strings associated with the given configuration key.
+ * Get a List of strings associated with the given configuration key.
*
* @param key The configuration key.
*
- * @return The associated Vector.
+ * @return The associated List.
*
* @throws ClassCastException is thrown if the key maps to an
- * object that is not a Vector.
+ * object that is not a List.
* @throws NoSuchElementException is thrown if the key doesn't
* map to an existing object.
*/
- public Vector getVector(String key)
+ public List getList(String key)
{
- Vector v = getVector(key, null);
- if (v != null)
+ List list = getList(key, null);
+ if (list != null)
{
- return v;
+ return list;
}
else
{
@@ -1375,39 +1374,39 @@
}
/**
- * Get a Vector of strings associated with the given configuration key.
+ * Get a List of strings associated with the given configuration key.
*
* @param key The configuration key.
* @param defaultValue The default value.
*
- * @return The associated Vector.
+ * @return The associated List.
*
* @throws ClassCastException is thrown if the key maps to an
- * object that is not a Vector.
+ * object that is not a List.
*/
- public Vector getVector(String key, Vector defaultValue)
+ public List getList(String key, List defaultValue)
{
Object value = getPropertyDirect(key);
- Vector v = null;
+ List list = null;
if (value instanceof String)
{
- v = new Vector(1);
- v.addElement((String) value);
+ list = new ArrayList(1);
+ list.add(value);
}
else if (value instanceof Container)
{
- v = ((Container) value).asVector();
+ list = ((Container) value).asList();
}
else if (value == null)
{
if (defaults != null)
{
- v = defaults.getVector(key, defaultValue);
+ list = defaults.getList(key, defaultValue);
}
else
{
- v = ((defaultValue == null) ? new Vector() : defaultValue);
+ list = ((defaultValue == null) ? new ArrayList() : defaultValue);
}
}
else
@@ -1415,12 +1414,12 @@
throw new ClassCastException(
'\''
+ key
- + "' doesn't map to a Vector object: "
+ + "' doesn't map to a List object: "
+ value
+ ", a "
+ value.getClass().getName());
}
- return v;
+ return list;
}
/**
@@ -1501,20 +1500,20 @@
} // class PropertiesTokenizer
/**
- * Private Wrapper class for Vector, so we can distinguish between
- * Vector objects and our container
+ * Private Wrapper class for List, so we can distinguish between
+ * List objects and our container
*/
static class Container
{
- /** We're wrapping a List object (A vector) */
- private List l = null;
+ /** We're wrapping a List object (A List) */
+ private List list = null;
/**
* C'tor
*/
public Container()
{
- l = new Vector(INITIAL_LIST_SIZE);
+ list = new ArrayList(INITIAL_LIST_SIZE);
}
/**
@@ -1524,7 +1523,7 @@
*/
public void add(Object o)
{
- l.add(o);
+ list.add(o);
}
/**
@@ -1534,7 +1533,7 @@
*/
public int size()
{
- return l.size();
+ return list.size();
}
/**
@@ -1545,7 +1544,7 @@
*/
public Object get(int index)
{
- return l.get(index);
+ return list.get(index);
}
/**
@@ -1555,27 +1554,21 @@
*/
public Iterator iterator()
{
- return l.iterator();
+ return list.iterator();
}
/**
* Returns the Elements of the Container as
- * a Vector. This is not the internal vector
+ * a List. This is not the internal list
* element but a shallow copy of the internal
* list. You may modify the returned list without
* modifying the container.
*
- * @return A Vector containing the elements of the Container.
+ * @return A List containing the elements of the Container.
*/
- public Vector asVector()
+ public List asList()
{
- Vector v = new Vector(l.size());
-
- for (Iterator it = l.iterator(); it.hasNext();)
- {
- v.add(it.next());
- }
- return v;
+ return new ArrayList(list);
}
}
}
Index: src/java/org/apache/commons/configuration/CompositeConfiguration.java
===================================================================
RCS file:
/home/cvspublic/jakarta-commons/configuration/src/java/org/apache/commons/configuration/CompositeConfiguration.java,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 CompositeConfiguration.java
--- src/java/org/apache/commons/configuration/CompositeConfiguration.java 23 Dec
2003 15:09:05 -0000 1.1.1.1
+++ src/java/org/apache/commons/configuration/CompositeConfiguration.java 23 Dec
2003 16:28:40 -0000
@@ -60,7 +60,6 @@
import java.util.ListIterator;
import java.util.NoSuchElementException;
import java.util.Properties;
-import java.util.Vector;
/**
* This Configuration class allows you to add multiple different types of
Configuration
@@ -187,7 +186,7 @@
* @param key The configuration key.
* @return The associated properties if key is found.
* @exception ClassCastException is thrown if the key maps to an
- * object that is not a String/Vector.
+ * object that is not a String/List.
* @exception IllegalArgumentException if one of the tokens is
* malformed (does not contain an equals sign).
* @see #getProperties(String, Properties)
@@ -698,52 +697,52 @@
* @param key The configuration key.
* @return The associated string array if key is found.
* @exception ClassCastException is thrown if the key maps to an
- * object that is not a String/Vector of Strings.
+ * object that is not a String/List of Strings.
*/
public String[] getStringArray(String key)
{
- Vector v = getVector(key);
- return (String []) v.toArray(new String [0]);
+ List list = getList(key);
+ return (String []) list.toArray(new String [0]);
}
/**
- * Get a Vector of strings associated with the given configuration key.
+ * Get a List of strings associated with the given configuration key.
*
* @param key The configuration key.
- * @return The associated Vector.
+ * @return The associated List.
* @exception ClassCastException is thrown if the key maps to an
- * object that is not a Vector.
+ * object that is not a List.
*/
- public Vector getVector(String key)
+ public List getList(String key)
{
- Vector v = new Vector();
+ List list = new ArrayList();
for (ListIterator li = configList.listIterator(); li.hasNext();)
{
Configuration config = (Configuration) li.next();
if (config.containsKey(key))
{
- v.addAll(config.getVector(key));
+ list.addAll(config.getList(key));
}
}
- return v;
+ return list;
}
/**
- * Get a Vector of strings associated with the given configuration key.
+ * Get a List of strings associated with the given configuration key.
*
* @param key The configuration key.
* @param defaultValue The default value.
- * @return The associated Vector.
+ * @return The associated List.
* @exception ClassCastException is thrown if the key maps to an
- * object that is not a Vector.
+ * object that is not a List.
*/
- public Vector getVector(String key, Vector defaultValue)
+ public List getList(String key, List defaultValue)
{
- Vector v = getVector(key);
+ List list = getList(key);
- return (v.size() == 0) ? defaultValue : v;
+ return (list.size() == 0) ? defaultValue : list;
}
private Configuration getFirstMatchingConfig(String key)
Index: src/java/org/apache/commons/configuration/Configuration.java
===================================================================
RCS file:
/home/cvspublic/jakarta-commons/configuration/src/java/org/apache/commons/configuration/Configuration.java,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 Configuration.java
--- src/java/org/apache/commons/configuration/Configuration.java 23 Dec 2003
15:09:05 -0000 1.1.1.1
+++ src/java/org/apache/commons/configuration/Configuration.java 23 Dec 2003
16:28:41 -0000
@@ -55,8 +55,8 @@
*/
import java.util.Iterator;
+import java.util.List;
import java.util.Properties;
-import java.util.Vector;
/**
* Configuration interface.
@@ -104,7 +104,7 @@
*
* addProperty("resource.loader", "classpath")
*
- * Then you will end up with a Vector like the following:
+ * Then you will end up with a List like the following:
*
* ["file", "classpath"]
*
@@ -163,7 +163,7 @@
* @param key The configuration key.
* @return The associated properties if key is found.
* @exception ClassCastException is thrown if the key maps to an
- * object that is not a String/Vector.
+ * object that is not a String/List.
* @exception IllegalArgumentException if one of the tokens is
* malformed (does not contain an equals sign).
*/
@@ -486,28 +486,28 @@
* @param key The configuration key.
* @return The associated string array if key is found.
* @exception ClassCastException is thrown if the key maps to an
- * object that is not a String/Vector of Strings.
+ * object that is not a String/List of Strings.
*/
String[] getStringArray(String key);
/**
- * Get a Vector of strings associated with the given configuration key.
+ * Get a List of strings associated with the given configuration key.
*
* @param key The configuration key.
- * @return The associated Vector.
+ * @return The associated List.
* @exception ClassCastException is thrown if the key maps to an
- * object that is not a Vector.
+ * object that is not a List.
*/
- Vector getVector(String key);
+ List getList(String key);
/**
- * Get a Vector of strings associated with the given configuration key.
+ * Get a List of strings associated with the given configuration key.
*
* @param key The configuration key.
* @param defaultValue The default value.
- * @return The associated Vector.
+ * @return The associated List.
* @exception ClassCastException is thrown if the key maps to an
- * object that is not a Vector.
+ * object that is not a List.
*/
- Vector getVector(String key, Vector defaultValue);
+ List getList(String key, List defaultValue);
}
Index: src/java/org/apache/commons/configuration/ConfigurationConverter.java
===================================================================
RCS file:
/home/cvspublic/jakarta-commons/configuration/src/java/org/apache/commons/configuration/ConfigurationConverter.java,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 ConfigurationConverter.java
--- src/java/org/apache/commons/configuration/ConfigurationConverter.java 23 Dec
2003 15:09:05 -0000 1.1.1.1
+++ src/java/org/apache/commons/configuration/ConfigurationConverter.java 23 Dec
2003 16:28:41 -0000
@@ -57,6 +57,9 @@
import java.util.Enumeration;
import java.util.Iterator;
import java.util.Properties;
+import java.util.List;
+import java.util.Vector;
+
import org.apache.commons.collections.ExtendedProperties;
@@ -116,7 +119,15 @@
for (Iterator i = c.getKeys(); i.hasNext();)
{
String key = (String) i.next();
- props.setProperty(key, c.getProperty(key));
+ Object property = c.getProperty(key);
+
+ // turn lists into vectors
+ if (property instanceof List)
+ {
+ property = new Vector((List) property);
+ }
+
+ props.setProperty(key, property);
}
return props;
}
Index: src/java/org/apache/commons/configuration/ConfigurationFactory.java
===================================================================
RCS file:
/home/cvspublic/jakarta-commons/configuration/src/java/org/apache/commons/configuration/ConfigurationFactory.java,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 ConfigurationFactory.java
--- src/java/org/apache/commons/configuration/ConfigurationFactory.java 23 Dec 2003
15:09:05 -0000 1.1.1.1
+++ src/java/org/apache/commons/configuration/ConfigurationFactory.java 23 Dec 2003
16:28:42 -0000
@@ -633,7 +633,7 @@
AdditionalConfigurationData cdata =
(AdditionalConfigurationData) it.next();
result.addNodes(cdata.getAt(),
- createRootNode(cdata).getChildren().asVector());
+ createRootNode(cdata).getChildren().asList());
} /* for */
return (result.isEmpty()) ? null : result;
Index: src/java/org/apache/commons/configuration/JNDIConfiguration.java
===================================================================
RCS file:
/home/cvspublic/jakarta-commons/configuration/src/java/org/apache/commons/configuration/JNDIConfiguration.java,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 JNDIConfiguration.java
--- src/java/org/apache/commons/configuration/JNDIConfiguration.java 23 Dec 2003
15:09:05 -0000 1.1.1.1
+++ src/java/org/apache/commons/configuration/JNDIConfiguration.java 23 Dec 2003
16:28:43 -0000
@@ -57,7 +57,6 @@
import java.util.List;
import java.util.NoSuchElementException;
import java.util.Properties;
-import java.util.Vector;
import javax.naming.Binding;
import javax.naming.Context;
import javax.naming.InitialContext;
@@ -66,6 +65,7 @@
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+
/**
* This Configuration class allows you to interface with a JNDI datasource.
*
@@ -236,7 +236,7 @@
* @param key The configuration key.
* @return The associated properties if key is found.
* @throws ClassCastException is thrown if the key maps to an
- * object that is not a String/Vector.
+ * object that is not a String/List.
* @throws IllegalArgumentException if one of the tokens is
* malformed (does not contain an equals sign).
* @see #getProperties(String, Properties)
@@ -660,7 +660,7 @@
* @param key The configuration key.
* @return The associated string array if key is found.
* @throws ClassCastException is thrown if the key maps to an
- * object that is not a String/Vector of Strings.
+ * object that is not a String/List of Strings.
*/
public String[] getStringArray(String key)
{
@@ -686,36 +686,36 @@
else
{
throw new ClassCastException(
- '\'' + key + "' doesn't map to a String/Vector object");
+ '\'' + key + "' doesn't map to a String/List object");
}
return tokens;
}
/**
- * Get a Vector of strings associated with the given configuration key.
+ * Get a List of strings associated with the given configuration key.
* Typically this will be just a single item, as you can't have multiple
* properties with the same name.
*
* @param key The configuration key.
* @param defaultValue The default value.
- * @return The associated Vector.
+ * @return The associated List.
*/
- public Vector getVector(String key, Vector defaultValue)
+ public List getList(String key, List defaultValue)
{
try
{
Object value = this.getValueFromJNDI(key);
if (value != null)
{
- Vector v = new Vector(1);
- v.add(value.toString());
- return v;
+ List list = new ArrayList(1);
+ list.add(value.toString());
+ return list;
}
else
{
if (defaultValue == null)
{
- defaultValue = new Vector();
+ defaultValue = new ArrayList();
}
return defaultValue;
}
Index: src/test/org/apache/commons/configuration/BaseNonStringProperties.java
===================================================================
RCS file:
/home/cvspublic/jakarta-commons/configuration/src/test/org/apache/commons/configuration/BaseNonStringProperties.java,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 BaseNonStringProperties.java
--- src/test/org/apache/commons/configuration/BaseNonStringProperties.java 23 Dec
2003 15:09:05 -0000 1.1.1.1
+++ src/test/org/apache/commons/configuration/BaseNonStringProperties.java 23 Dec
2003 16:28:43 -0000
@@ -91,7 +91,7 @@
{
boolean booleanValue = conf.getBoolean("test.boolean.array");
assertEquals(false, booleanValue);
- assertEquals(2, conf.getVector("test.boolean.array").size());
+ assertEquals(2, conf.getList("test.boolean.array").size());
}
public void testByte() throws Exception
@@ -104,7 +104,7 @@
byte testValue = 20;
byte byteValue = conf.getByte("test.byte.array");
assertEquals(testValue, byteValue);
- assertEquals(2, conf.getVector("test.byte.array").size());
+ assertEquals(2, conf.getList("test.byte.array").size());
}
public void testDouble() throws Exception
@@ -122,7 +122,7 @@
double testValue = 20.35;
double doubleValue = conf.getDouble("test.double.array");
assertEquals(testValue, doubleValue, 0.01);
- assertEquals(2, conf.getVector("test.double.array").size());
+ assertEquals(2, conf.getList("test.double.array").size());
}
public void testFloat() throws Exception
@@ -141,7 +141,7 @@
float testValue = (float) 30.35;
float floatValue = conf.getFloat("test.float.array");
assertEquals(testValue, floatValue, 0.01);
- assertEquals(2, conf.getVector("test.float.array").size());
+ assertEquals(2, conf.getList("test.float.array").size());
}
public void testInteger() throws Exception
@@ -158,7 +158,7 @@
{
int intValue = conf.getInt("test.integer.array");
assertEquals(20, intValue);
- assertEquals(2, conf.getVector("test.integer.array").size());
+ assertEquals(2, conf.getList("test.integer.array").size());
}
public void testLong() throws Exception
@@ -173,7 +173,7 @@
{
long longValue = conf.getLong("test.long.array");
assertEquals(2000000, longValue);
- assertEquals(2, conf.getVector("test.long.array").size());
+ assertEquals(2, conf.getList("test.long.array").size());
}
public void testShort() throws Exception
@@ -189,12 +189,12 @@
{
short shortValue = conf.getShort("test.short.array");
assertEquals(2, shortValue);
- assertEquals(2, conf.getVector("test.short.array").size());
+ assertEquals(2, conf.getList("test.short.array").size());
}
- public void testVectorMissing() throws Exception
+ public void testListMissing() throws Exception
{
- nonStringTestHolder.testVectorMissing();
+ nonStringTestHolder.testListMissing();
}
public void testSubset() throws Exception
Index: src/test/org/apache/commons/configuration/NonStringTestHolder.java
===================================================================
RCS file:
/home/cvspublic/jakarta-commons/configuration/src/test/org/apache/commons/configuration/NonStringTestHolder.java,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 NonStringTestHolder.java
--- src/test/org/apache/commons/configuration/NonStringTestHolder.java 23 Dec 2003
15:09:05 -0000 1.1.1.1
+++ src/test/org/apache/commons/configuration/NonStringTestHolder.java 23 Dec 2003
16:28:43 -0000
@@ -72,7 +72,7 @@
{
boolean booleanValue = configuration.getBoolean("test.boolean");
Assert.assertEquals(true, booleanValue);
- Assert.assertEquals(1, configuration.getVector("test.boolean").size());
+ Assert.assertEquals(1, configuration.getList("test.boolean").size());
}
public void testBooleanDefaultValue() throws Exception
@@ -91,7 +91,7 @@
byte testValue = 10;
byte byteValue = configuration.getByte("test.byte");
Assert.assertEquals(testValue, byteValue);
- Assert.assertEquals(1, configuration.getVector("test.byte").size());
+ Assert.assertEquals(1, configuration.getList("test.byte").size());
}
public void testDouble() throws Exception
@@ -99,7 +99,7 @@
double testValue = 10.25;
double doubleValue = configuration.getDouble("test.double");
Assert.assertEquals(testValue, doubleValue, 0.01);
- Assert.assertEquals(1, configuration.getVector("test.double").size());
+ Assert.assertEquals(1, configuration.getList("test.double").size());
}
public void testDoubleDefaultValue() throws Exception
@@ -116,7 +116,7 @@
float testValue = (float) 20.25;
float floatValue = configuration.getFloat("test.float");
Assert.assertEquals(testValue, floatValue, 0.01);
- Assert.assertEquals(1, configuration.getVector("test.float").size());
+ Assert.assertEquals(1, configuration.getList("test.float").size());
}
public void testFloatDefaultValue() throws Exception
@@ -132,7 +132,7 @@
{
int intValue = configuration.getInt("test.integer");
Assert.assertEquals(10, intValue);
- Assert.assertEquals(1, configuration.getVector("test.integer").size());
+ Assert.assertEquals(1, configuration.getList("test.integer").size());
}
public void testIntegerDefaultValue() throws Exception
@@ -145,7 +145,7 @@
{
long longValue = configuration.getLong("test.long");
Assert.assertEquals(1000000, longValue);
- Assert.assertEquals(1, configuration.getVector("test.long").size());
+ Assert.assertEquals(1, configuration.getList("test.long").size());
}
public void testLongDefaultValue() throws Exception
{
@@ -157,7 +157,7 @@
{
short shortValue = configuration.getShort("test.short");
Assert.assertEquals(1, shortValue);
- Assert.assertEquals(1, configuration.getVector("test.short").size());
+ Assert.assertEquals(1, configuration.getList("test.short").size());
}
public void testShortDefaultValue() throws Exception
@@ -167,12 +167,12 @@
Assert.assertEquals(1, shortValue);
}
- public void testVectorMissing() throws Exception
+ public void testListMissing() throws Exception
{
Assert.assertEquals(
0,
- configuration.getVector("missing.vector").size());
+ configuration.getList("missing.list").size());
}
public void testSubset() throws Exception
Index: src/test/org/apache/commons/configuration/TestBaseConfiguration.java
===================================================================
RCS file:
/home/cvspublic/jakarta-commons/configuration/src/test/org/apache/commons/configuration/TestBaseConfiguration.java,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 TestBaseConfiguration.java
--- src/test/org/apache/commons/configuration/TestBaseConfiguration.java 23 Dec
2003 15:09:05 -0000 1.1.1.1
+++ src/test/org/apache/commons/configuration/TestBaseConfiguration.java 23 Dec
2003 16:28:44 -0000
@@ -186,15 +186,15 @@
new Boolean(boolT));
/*
- * now add another and get a Vector
+ * now add another and get a List
*/
eprop.addProperty("number", "2");
- assertTrue("This returns array", ( eprop.getVector("number")
- instanceof java.util.Vector ) );
+ assertTrue("This returns array", ( eprop.getList("number")
+ instanceof java.util.List ) );
/*
* now test dan's new fix where we get the first scalar
- * when we access a vector valued property
+ * when we access a list valued property
*/
assertTrue("This returns scalar", ( eprop.getString("number")
instanceof String ) );
@@ -204,8 +204,8 @@
*/
String prop = "hey, that's a test";
eprop.setProperty("prop.string", prop);
- assertTrue("This returns vector", ( eprop.getVector("prop.string")
- instanceof java.util.Vector ) );
+ assertTrue("This returns list", ( eprop.getList("prop.string")
+ instanceof java.util.List ) );
String prop2 = "hey\\, that's a test";
eprop.clearProperty("prop.string");
@@ -241,7 +241,7 @@
assertTrue("This returns string for subset", ( subEprop
.getString("string") instanceof java.lang.String) );
assertTrue("This returns array for subset", ( subEprop
- .getVector("string") instanceof java.util.Vector) );
+ .getList("string") instanceof java.util.List) );
}
Index: src/test/org/apache/commons/configuration/TestBasePropertiesConfiguration.java
===================================================================
RCS file:
/home/cvspublic/jakarta-commons/configuration/src/test/org/apache/commons/configuration/TestBasePropertiesConfiguration.java,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 TestBasePropertiesConfiguration.java
--- src/test/org/apache/commons/configuration/TestBasePropertiesConfiguration.java
23 Dec 2003 15:09:05 -0000 1.1.1.1
+++ src/test/org/apache/commons/configuration/TestBasePropertiesConfiguration.java
23 Dec 2003 16:28:44 -0000
@@ -54,7 +54,7 @@
* <http://www.apache.org/>.
*/
-import java.util.Vector;
+import java.util.List;
import junit.framework.TestCase;
@@ -125,12 +125,11 @@
}
/**
- * Tests <code>Vector</code> parsing.
+ * Tests <code>List</code> parsing.
*/
- public void testVector()
- throws Exception
+ public void testList() throws Exception
{
- Vector packages = conf.getVector("packages");
+ List packages = conf.getList("packages");
// we should get 3 packages here
assertEquals(3, packages.size());
}
Index: src/test/org/apache/commons/configuration/TestCompositeConfiguration.java
===================================================================
RCS file:
/home/cvspublic/jakarta-commons/configuration/src/test/org/apache/commons/configuration/TestCompositeConfiguration.java,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 TestCompositeConfiguration.java
--- src/test/org/apache/commons/configuration/TestCompositeConfiguration.java 23 Dec
2003 15:09:05 -0000 1.1.1.1
+++ src/test/org/apache/commons/configuration/TestCompositeConfiguration.java 23 Dec
2003 16:28:45 -0000
@@ -55,7 +55,6 @@
*/
import java.io.File;
-import java.util.Vector;
import java.util.Iterator;
import java.util.List;
import java.util.ArrayList;
@@ -145,7 +144,7 @@
}
/**
- * Tests <code>Vector</code> parsing.
+ * Tests <code>List</code> parsing.
*/
public void testMultipleTypesOfConfigs() throws Exception
{
@@ -160,7 +159,7 @@
}
/**
- * Tests <code>Vector</code> parsing.
+ * Tests <code>List</code> parsing.
*/
public void testPropertyExistsInOnlyOneConfig() throws Exception
{
@@ -182,7 +181,7 @@
}
/**
- * Tests <code>Vector</code> parsing.
+ * Tests <code>List</code> parsing.
*/
public void testGettingConfiguration() throws Exception
{
@@ -263,22 +262,22 @@
}
/**
- * Tests <code>Vector</code> parsing.
+ * Tests <code>List</code> parsing.
*/
- public void testVector() throws Exception
+ public void testList() throws Exception
{
cc.addConfiguration(conf1);
cc.addConfiguration(dom4jConf);
- Vector packages = cc.getVector("packages");
+ List packages = cc.getList("packages");
// we should get 3 packages here
assertEquals(3, packages.size());
- Vector defaultVector = new Vector();
- defaultVector.add("1");
- defaultVector.add("2");
+ List defaultList = new ArrayList();
+ defaultList.add("1");
+ defaultList.add("2");
- packages = cc.getVector("packages.which.dont.exist", defaultVector);
+ packages = cc.getList("packages.which.dont.exist", defaultList);
// we should get 2 packages here
assertEquals(2, packages.size());
}
Index: src/test/org/apache/commons/configuration/TestConfigurationConverter.java
===================================================================
RCS file:
/home/cvspublic/jakarta-commons/configuration/src/test/org/apache/commons/configuration/TestConfigurationConverter.java,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 TestConfigurationConverter.java
--- src/test/org/apache/commons/configuration/TestConfigurationConverter.java 23 Dec
2003 15:09:05 -0000 1.1.1.1
+++ src/test/org/apache/commons/configuration/TestConfigurationConverter.java 23 Dec
2003 16:28:45 -0000
@@ -54,11 +54,13 @@
* <http://www.apache.org/>.
*/
+import java.util.ArrayList;
+import java.util.List;
+
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.apache.commons.collections.ExtendedProperties;
-import java.util.Vector;
/**
@@ -91,10 +93,10 @@
{
config.setProperty("string", "teststring");
config.setProperty("int", "123");
- Vector vec = new Vector();
- vec.add("item 1");
- vec.add("item 2");
- config.setProperty("vector", vec);
+ List list = new ArrayList();
+ list.add("item 1");
+ list.add("item 2");
+ config.setProperty("list", list);
ExtendedProperties ep = ConfigurationConverter
.getExtendedProperties(config);
@@ -102,7 +104,7 @@
assertEquals("This returns 'teststring'", ep.getString("string"),
"teststring");
- Vector v = ep.getVector("vector");
+ List v = ep.getVector("list");
assertEquals("This returns 'item 1'", (String) v.get(0), "item 1");
assertEquals("This returns 123", ep.getInt("int"), 123);
@@ -111,7 +113,7 @@
assertEquals("This returns 'teststring'", c.getString("string"),
"teststring");
- Vector v1 = c.getVector("vector");
+ List v1 = c.getList("list");
assertEquals("This returns 'item 1'", (String) v1.get(0), "item 1");
assertEquals("This returns 123", c.getInt("int"), 123);
}
Index: src/test/org/apache/commons/configuration/TestEqualBehaviour.java
===================================================================
RCS file:
/home/cvspublic/jakarta-commons/configuration/src/test/org/apache/commons/configuration/TestEqualBehaviour.java,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 TestEqualBehaviour.java
--- src/test/org/apache/commons/configuration/TestEqualBehaviour.java 23 Dec 2003
15:09:05 -0000 1.1.1.1
+++ src/test/org/apache/commons/configuration/TestEqualBehaviour.java 23 Dec 2003
16:28:45 -0000
@@ -57,7 +57,7 @@
import java.io.File;
import java.util.Iterator;
-import java.util.Vector;
+import java.util.List;
import junit.framework.Test;
import junit.framework.TestCase;
@@ -134,19 +134,19 @@
assertEquals(msg + ", String Array: ", s1[i], s2[i]);
}
- Vector v1 = c1.getVector(key);
- Vector v2 = c2.getVector(key);
+ List list1 = c1.getList(key);
+ List list2 = c2.getList(key);
- assertEquals(msg + ", Size: ", v1.size(), v2.size());
+ assertEquals(msg + ", Size: ", list1.size(), list2.size());
- Iterator it1 = v1.iterator();
- Iterator it2 = v2.iterator();
+ Iterator it1 = list1.iterator();
+ Iterator it2 = list2.iterator();
while(it1.hasNext() && it2.hasNext())
{
String val1 = (String) it1.next();
String val2 = (String) it2.next();
- assertEquals(msg + ", Vector: ", val1, val2);
+ assertEquals(msg + ", List: ", val1, val2);
}
assertEquals(msg + ", Iterator End: ", it1.hasNext(), it2.hasNext());
}
Index: src/test/org/apache/commons/configuration/TestPropertiesConfiguration.java
===================================================================
RCS file:
/home/cvspublic/jakarta-commons/configuration/src/test/org/apache/commons/configuration/TestPropertiesConfiguration.java,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 TestPropertiesConfiguration.java
--- src/test/org/apache/commons/configuration/TestPropertiesConfiguration.java 23 Dec
2003 15:09:05 -0000 1.1.1.1
+++ src/test/org/apache/commons/configuration/TestPropertiesConfiguration.java 23 Dec
2003 16:28:45 -0000
@@ -55,7 +55,8 @@
*/
import java.io.File;
-import java.util.Vector;
+import java.util.ArrayList;
+import java.util.List;
/**
* test for loading and saving properties files
@@ -87,12 +88,12 @@
{
PropertiesConfiguration toSave = new PropertiesConfiguration();
toSave.addProperty("string", "value1");
- Vector vec = new Vector();
+ List list = new ArrayList();
for (int i = 1; i < 5; i++)
{
- vec.add("value" + i);
+ list.add("value" + i);
}
- toSave.addProperty("array", vec);
+ toSave.addProperty("array", list);
String filename = "STRING0";
toSave.save(filename);
Index: xdocs/examples.xml
===================================================================
RCS file: /home/cvspublic/jakarta-commons/configuration/xdocs/examples.xml,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 examples.xml
--- xdocs/examples.xml 23 Dec 2003 15:09:05 -0000 1.1.1.1
+++ xdocs/examples.xml 23 Dec 2003 16:28:48 -0000
@@ -391,10 +391,10 @@
]]>
</source>
<p>
- An alternative to this code would be the
<code>getVector()</code>
+ An alternative to this code would be the
<code>getList()</code>
method of <code>Configuration</code>. If a property is
known to
have multiple values (as is the table name property in
this example),
- <code>getVector()</code> allows to retrieve all values
at once.
+ <code>getList()</code> allows to retrieve all values
at once.
By the way, it is completely legal to call
<code>getString()</code>
or one of the other getter methods on a property with
multiple
values; in this case only the first value is returned.
@@ -402,11 +402,11 @@
</subsection>
<subsection name="Accessing structured properties">
<p>
- Okay, we can obtain a vector with the name of all
defined
- tables. In the same way we can retrieve a vector with
the names
+ Okay, we can obtain a list with the name of all defined
+ tables. In the same way we can retrieve a list with
the names
of all table fields: just pass the key
<code>tables.table.fields.field.name</code> to the
- <code>getVector()</code> method. In our example this
vector
+ <code>getList()</code> method. In our example this list
would contain 10 elements, the names of all fields of
all tables.
This is fine, but how do we know, which field belongs
to
which table?
smime.p7s
Description: S/MIME Cryptographic Signature
