You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by eb...@apache.org on 2004/12/02 23:05:53 UTC
cvs commit: jakarta-commons/configuration/src/test/org/apache/commons/configuration TestAbstractConfiguration.java TestDatabaseConfiguration.java
ebourg 2004/12/02 14:05:53
Modified: configuration/src/java/org/apache/commons/configuration
AbstractConfiguration.java
AbstractFileConfiguration.java
BaseConfiguration.java CompositeConfiguration.java
DatabaseConfiguration.java DataConfiguration.java
HierarchicalConfiguration.java
JNDIConfiguration.java MapConfiguration.java
SubsetConfiguration.java
configuration/src/java/org/apache/commons/configuration/web
AppletConfiguration.java ServletConfiguration.java
ServletContextConfiguration.java
ServletFilterConfiguration.java
ServletRequestConfiguration.java
configuration/src/test/org/apache/commons/configuration
TestAbstractConfiguration.java
TestDatabaseConfiguration.java
Log:
Removed the getPropertyDirect method from AbstractConfiguration, concrete configurations now implement directly the getProperty method from the Configuration interface.
Revision Changes Path
1.29 +6 -27 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.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- AbstractConfiguration.java 18 Oct 2004 21:38:45 -0000 1.28
+++ AbstractConfiguration.java 2 Dec 2004 22:05:52 -0000 1.29
@@ -130,16 +130,6 @@
}
/**
- * Read property. Should return <code>null</code> if the key doesn't
- * map to an existing object.
- *
- * @param key key to use for mapping
- *
- * @return object associated with the given configuration key.
- */
- protected abstract Object getPropertyDirect(String key);
-
- /**
* Adds a key/value pair to the Configuration. Override this method to
* provide write acces to underlying Configuration store.
*
@@ -233,7 +223,6 @@
priorVariables.add(variable);
}
- //QUESTION: getProperty or getPropertyDirect
Object value = getProperty(variable);
if (value != null)
{
@@ -409,8 +398,7 @@
}
else
{
- throw new IllegalArgumentException(
- '\'' + token + "' does not contain an equals sign");
+ throw new IllegalArgumentException('\'' + token + "' does not contain an equals sign");
}
}
return props;
@@ -419,14 +407,6 @@
/**
* {@inheritDoc}
*/
- public Object getProperty(String key)
- {
- return getPropertyDirect(key);
- }
-
- /**
- * {@inheritDoc}
- */
public boolean getBoolean(String key)
{
Boolean b = getBoolean(key, null);
@@ -436,8 +416,7 @@
}
else
{
- throw new NoSuchElementException(
- '\'' + key + "' doesn't map to an existing object");
+ throw new NoSuchElementException('\'' + key + "' doesn't map to an existing object");
}
}
@@ -902,7 +881,7 @@
*/
public String[] getStringArray(String key)
{
- Object value = getPropertyDirect(key);
+ Object value = getProperty(key);
String[] array;
@@ -946,7 +925,7 @@
*/
public List getList(String key, List defaultValue)
{
- Object value = getPropertyDirect(key);
+ Object value = getProperty(key);
List list = null;
if (value instanceof String)
@@ -985,7 +964,7 @@
*/
protected Object resolveContainerStore(String key)
{
- Object value = getPropertyDirect(key);
+ Object value = getProperty(key);
if (value != null && value instanceof List)
{
List list = (List) value;
1.11 +3 -3 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.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- AbstractFileConfiguration.java 19 Nov 2004 13:19:50 -0000 1.10
+++ AbstractFileConfiguration.java 2 Dec 2004 22:05:52 -0000 1.11
@@ -597,10 +597,10 @@
}
}
- protected Object getPropertyDirect(String key)
+ public Object getProperty(String key)
{
reload();
- return super.getPropertyDirect(key);
+ return super.getProperty(key);
}
public boolean isEmpty()
1.10 +3 -3 jakarta-commons/configuration/src/java/org/apache/commons/configuration/BaseConfiguration.java
Index: BaseConfiguration.java
===================================================================
RCS file: /home/cvs/jakarta-commons/configuration/src/java/org/apache/commons/configuration/BaseConfiguration.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- BaseConfiguration.java 18 Oct 2004 14:05:23 -0000 1.9
+++ BaseConfiguration.java 2 Dec 2004 22:05:52 -0000 1.10
@@ -69,7 +69,7 @@
*/
protected void addPropertyDirect(String key, Object obj)
{
- Object o = getPropertyDirect(key);
+ Object o = getProperty(key);
Object objAdd = null;
if (o == null)
@@ -111,7 +111,7 @@
*
* @return object associated with the given configuration key.
*/
- protected Object getPropertyDirect(String key)
+ public Object getProperty(String key)
{
return store.get(key);
}
1.23 +2 -2 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.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- CompositeConfiguration.java 2 Dec 2004 17:34:18 -0000 1.22
+++ CompositeConfiguration.java 2 Dec 2004 22:05:52 -0000 1.23
@@ -143,7 +143,7 @@
*
* @return object associated with the given configuration key.
*/
- protected Object getPropertyDirect(String key)
+ public Object getProperty(String key)
{
Configuration firstMatchingConfiguration = null;
for (Iterator i = configList.iterator(); i.hasNext();)
1.13 +2 -2 jakarta-commons/configuration/src/java/org/apache/commons/configuration/DatabaseConfiguration.java
Index: DatabaseConfiguration.java
===================================================================
RCS file: /home/cvs/jakarta-commons/configuration/src/java/org/apache/commons/configuration/DatabaseConfiguration.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- DatabaseConfiguration.java 21 Oct 2004 18:02:09 -0000 1.12
+++ DatabaseConfiguration.java 2 Dec 2004 22:05:52 -0000 1.13
@@ -99,7 +99,7 @@
/**
* {@inheritDoc}
*/
- protected Object getPropertyDirect(String key)
+ public Object getProperty(String key)
{
Object result = null;
1.2 +23 -23 jakarta-commons/configuration/src/java/org/apache/commons/configuration/DataConfiguration.java
Index: DataConfiguration.java
===================================================================
RCS file: /home/cvs/jakarta-commons/configuration/src/java/org/apache/commons/configuration/DataConfiguration.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DataConfiguration.java 18 Oct 2004 09:54:37 -0000 1.1
+++ DataConfiguration.java 2 Dec 2004 22:05:52 -0000 1.2
@@ -67,7 +67,7 @@
return configuration;
}
- protected Object getPropertyDirect(String key)
+ public Object getProperty(String key)
{
return configuration.getProperty(key);
}
@@ -127,7 +127,7 @@
*/
public List getBooleanList(String key, List defaultValue)
{
- Object value = getPropertyDirect(key);
+ Object value = getProperty(key);
List list = null;
@@ -203,7 +203,7 @@
*/
public boolean[] getBooleanArray(String key, boolean[] defaultValue)
{
- Object value = getPropertyDirect(key);
+ Object value = getProperty(key);
boolean[] array;
@@ -277,7 +277,7 @@
*/
public List getByteList(String key, List defaultValue)
{
- Object value = getPropertyDirect(key);
+ Object value = getProperty(key);
List list = null;
@@ -352,7 +352,7 @@
*/
public byte[] getByteArray(String key, byte[] defaultValue)
{
- Object value = getPropertyDirect(key);
+ Object value = getProperty(key);
byte[] array;
@@ -426,7 +426,7 @@
*/
public List getShortList(String key, List defaultValue)
{
- Object value = getPropertyDirect(key);
+ Object value = getProperty(key);
List list = null;
@@ -501,7 +501,7 @@
*/
public short[] getShortArray(String key, short[] defaultValue)
{
- Object value = getPropertyDirect(key);
+ Object value = getProperty(key);
short[] array;
@@ -576,7 +576,7 @@
*/
public List getIntegerList(String key, List defaultValue)
{
- Object value = getPropertyDirect(key);
+ Object value = getProperty(key);
List list = null;
@@ -651,7 +651,7 @@
*/
public int[] getIntArray(String key, int[] defaultValue)
{
- Object value = getPropertyDirect(key);
+ Object value = getProperty(key);
int[] array;
@@ -725,7 +725,7 @@
*/
public List getLongList(String key, List defaultValue)
{
- Object value = getPropertyDirect(key);
+ Object value = getProperty(key);
List list = null;
@@ -800,7 +800,7 @@
*/
public long[] getLongArray(String key, long[] defaultValue)
{
- Object value = getPropertyDirect(key);
+ Object value = getProperty(key);
long[] array;
@@ -874,7 +874,7 @@
*/
public List getFloatList(String key, List defaultValue)
{
- Object value = getPropertyDirect(key);
+ Object value = getProperty(key);
List list = null;
@@ -949,7 +949,7 @@
*/
public float[] getFloatArray(String key, float[] defaultValue)
{
- Object value = getPropertyDirect(key);
+ Object value = getProperty(key);
float[] array;
@@ -1024,7 +1024,7 @@
*/
public List getDoubleList(String key, List defaultValue)
{
- Object value = getPropertyDirect(key);
+ Object value = getProperty(key);
List list = null;
@@ -1099,7 +1099,7 @@
*/
public double[] getDoubleArray(String key, double[] defaultValue)
{
- Object value = getPropertyDirect(key);
+ Object value = getProperty(key);
double[] array;
@@ -1173,7 +1173,7 @@
*/
public List getBigIntegerList(String key, List defaultValue)
{
- Object value = getPropertyDirect(key);
+ Object value = getProperty(key);
List list = null;
@@ -1283,7 +1283,7 @@
*/
public List getBigDecimalList(String key, List defaultValue)
{
- Object value = getPropertyDirect(key);
+ Object value = getProperty(key);
List list = null;
@@ -1440,7 +1440,7 @@
*/
public List getURLList(String key, List defaultValue)
{
- Object value = getPropertyDirect(key);
+ Object value = getProperty(key);
List list = null;
@@ -1678,7 +1678,7 @@
*/
public List getDateList(String key, List defaultValue, String format)
{
- Object value = getPropertyDirect(key);
+ Object value = getProperty(key);
List list = null;
@@ -1970,7 +1970,7 @@
*/
public List getCalendarList(String key, List defaultValue, String format)
{
- Object value = getPropertyDirect(key);
+ Object value = getProperty(key);
List list = null;
@@ -2189,7 +2189,7 @@
*/
public List getLocaleList(String key, List defaultValue)
{
- Object value = getPropertyDirect(key);
+ Object value = getProperty(key);
List list = null;
@@ -2346,7 +2346,7 @@
*/
public List getColorList(String key, List defaultValue)
{
- Object value = getPropertyDirect(key);
+ Object value = getProperty(key);
List list = null;
1.14 +3 -3 jakarta-commons/configuration/src/java/org/apache/commons/configuration/HierarchicalConfiguration.java
Index: HierarchicalConfiguration.java
===================================================================
RCS file: /home/cvs/jakarta-commons/configuration/src/java/org/apache/commons/configuration/HierarchicalConfiguration.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- HierarchicalConfiguration.java 13 Nov 2004 17:02:51 -0000 1.13
+++ HierarchicalConfiguration.java 2 Dec 2004 22:05:52 -0000 1.14
@@ -137,7 +137,7 @@
* @param key the key to be looked up
* @return the found value
*/
- protected Object getPropertyDirect(String key)
+ public Object getProperty(String key)
{
List nodes = fetchNodeList(key);
@@ -346,7 +346,7 @@
*/
public boolean containsKey(String key)
{
- return getPropertyDirect(key) != null;
+ return getProperty(key) != null;
}
/**
1.22 +2 -2 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.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- JNDIConfiguration.java 2 Dec 2004 15:50:09 -0000 1.21
+++ JNDIConfiguration.java 2 Dec 2004 22:05:52 -0000 1.22
@@ -383,7 +383,7 @@
/**
* {@inheritDoc}
*/
- protected Object getPropertyDirect(String key)
+ public Object getProperty(String key)
{
if (clearedProperties.contains(key))
{
1.2 +2 -2 jakarta-commons/configuration/src/java/org/apache/commons/configuration/MapConfiguration.java
Index: MapConfiguration.java
===================================================================
RCS file: /home/cvs/jakarta-commons/configuration/src/java/org/apache/commons/configuration/MapConfiguration.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- MapConfiguration.java 18 Oct 2004 12:50:41 -0000 1.1
+++ MapConfiguration.java 2 Dec 2004 22:05:52 -0000 1.2
@@ -52,7 +52,7 @@
return map;
}
- protected Object getPropertyDirect(String key)
+ public Object getProperty(String key)
{
Object value = map.get(key);
if (value instanceof String)
1.7 +2 -2 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.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- SubsetConfiguration.java 5 Oct 2004 21:17:25 -0000 1.6
+++ SubsetConfiguration.java 2 Dec 2004 22:05:52 -0000 1.7
@@ -190,7 +190,7 @@
/**
* {@inheritDoc}
*/
- public Object getPropertyDirect(String key)
+ public Object getProperty(String key)
{
return parent.getProperty(getParentKey(key));
}
1.4 +3 -3 jakarta-commons/configuration/src/java/org/apache/commons/configuration/web/AppletConfiguration.java
Index: AppletConfiguration.java
===================================================================
RCS file: /home/cvs/jakarta-commons/configuration/src/java/org/apache/commons/configuration/web/AppletConfiguration.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- AppletConfiguration.java 21 Oct 2004 18:42:09 -0000 1.3
+++ AppletConfiguration.java 2 Dec 2004 22:05:52 -0000 1.4
@@ -46,7 +46,7 @@
this.applet = applet;
}
- protected Object getPropertyDirect(String key)
+ public Object getProperty(String key)
{
return applet.getParameter(key);
}
@@ -69,7 +69,7 @@
public boolean containsKey(String key)
{
- return getPropertyDirect(key) != null;
+ return getProperty(key) != null;
}
/**
1.4 +3 -3 jakarta-commons/configuration/src/java/org/apache/commons/configuration/web/ServletConfiguration.java
Index: ServletConfiguration.java
===================================================================
RCS file: /home/cvs/jakarta-commons/configuration/src/java/org/apache/commons/configuration/web/ServletConfiguration.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ServletConfiguration.java 21 Oct 2004 18:42:09 -0000 1.3
+++ ServletConfiguration.java 2 Dec 2004 22:05:52 -0000 1.4
@@ -57,7 +57,7 @@
this.config = config;
}
- protected Object getPropertyDirect(String key)
+ public Object getProperty(String key)
{
return config.getInitParameter(key);
}
@@ -80,7 +80,7 @@
public boolean containsKey(String key)
{
- return getPropertyDirect(key) != null;
+ return getProperty(key) != null;
}
/**
1.4 +3 -3 jakarta-commons/configuration/src/java/org/apache/commons/configuration/web/ServletContextConfiguration.java
Index: ServletContextConfiguration.java
===================================================================
RCS file: /home/cvs/jakarta-commons/configuration/src/java/org/apache/commons/configuration/web/ServletContextConfiguration.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ServletContextConfiguration.java 21 Oct 2004 18:42:09 -0000 1.3
+++ ServletContextConfiguration.java 2 Dec 2004 22:05:52 -0000 1.4
@@ -58,7 +58,7 @@
this.context = context;
}
- protected Object getPropertyDirect(String key)
+ public Object getProperty(String key)
{
return context.getInitParameter(key);
}
@@ -81,7 +81,7 @@
public boolean containsKey(String key)
{
- return getPropertyDirect(key) != null;
+ return getProperty(key) != null;
}
/**
1.4 +3 -3 jakarta-commons/configuration/src/java/org/apache/commons/configuration/web/ServletFilterConfiguration.java
Index: ServletFilterConfiguration.java
===================================================================
RCS file: /home/cvs/jakarta-commons/configuration/src/java/org/apache/commons/configuration/web/ServletFilterConfiguration.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ServletFilterConfiguration.java 21 Oct 2004 18:42:09 -0000 1.3
+++ ServletFilterConfiguration.java 2 Dec 2004 22:05:52 -0000 1.4
@@ -43,7 +43,7 @@
this.config = config;
}
- protected Object getPropertyDirect(String key)
+ public Object getProperty(String key)
{
return config.getInitParameter(key);
}
@@ -66,7 +66,7 @@
public boolean containsKey(String key)
{
- return getPropertyDirect(key) != null;
+ return getProperty(key) != null;
}
/**
1.4 +3 -3 jakarta-commons/configuration/src/java/org/apache/commons/configuration/web/ServletRequestConfiguration.java
Index: ServletRequestConfiguration.java
===================================================================
RCS file: /home/cvs/jakarta-commons/configuration/src/java/org/apache/commons/configuration/web/ServletRequestConfiguration.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ServletRequestConfiguration.java 21 Oct 2004 18:42:09 -0000 1.3
+++ ServletRequestConfiguration.java 2 Dec 2004 22:05:52 -0000 1.4
@@ -45,7 +45,7 @@
this.request = request;
}
- protected Object getPropertyDirect(String key)
+ public Object getProperty(String key)
{
return request.getParameter(key);
}
@@ -68,7 +68,7 @@
public boolean containsKey(String key)
{
- return getPropertyDirect(key) != null;
+ return getProperty(key) != null;
}
/**
1.2 +6 -6 jakarta-commons/configuration/src/test/org/apache/commons/configuration/TestAbstractConfiguration.java
Index: TestAbstractConfiguration.java
===================================================================
RCS file: /home/cvs/jakarta-commons/configuration/src/test/org/apache/commons/configuration/TestAbstractConfiguration.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TestAbstractConfiguration.java 14 Oct 2004 09:54:35 -0000 1.1
+++ TestAbstractConfiguration.java 2 Dec 2004 22:05:52 -0000 1.2
@@ -42,19 +42,19 @@
*/
protected abstract AbstractConfiguration getEmptyConfiguration();
- public void testGetPropertyDirect()
+ public void testGetProperty()
{
AbstractConfiguration config = getConfiguration();
- assertEquals("key1", "value1", config.getPropertyDirect("key1"));
- assertEquals("key2", "value2", config.getPropertyDirect("key2"));
- assertNull("key3", config.getPropertyDirect("key3"));
+ assertEquals("key1", "value1", config.getProperty("key1"));
+ assertEquals("key2", "value2", config.getProperty("key2"));
+ assertNull("key3", config.getProperty("key3"));
}
public void testAddPropertyDirect()
{
AbstractConfiguration config = getConfiguration();
config.addPropertyDirect("key3", "value3");
- assertEquals("key3", "value3", config.getPropertyDirect("key3"));
+ assertEquals("key3", "value3", config.getProperty("key3"));
}
public void testIsEmpty()
1.12 +4 -4 jakarta-commons/configuration/src/test/org/apache/commons/configuration/TestDatabaseConfiguration.java
Index: TestDatabaseConfiguration.java
===================================================================
RCS file: /home/cvs/jakarta-commons/configuration/src/test/org/apache/commons/configuration/TestDatabaseConfiguration.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- TestDatabaseConfiguration.java 18 Oct 2004 21:38:45 -0000 1.11
+++ TestDatabaseConfiguration.java 2 Dec 2004 22:05:52 -0000 1.12
@@ -120,9 +120,9 @@
{
DatabaseConfiguration config = new DatabaseConfiguration(datasource, "configuration", "key", "value");
- assertEquals("property1", "value1", config.getPropertyDirect("key1"));
- assertEquals("property2", "value2", config.getPropertyDirect("key2"));
- assertEquals("unknown property", null, config.getPropertyDirect("key3"));
+ assertEquals("property1", "value1", config.getProperty("key1"));
+ assertEquals("property2", "value2", config.getProperty("key2"));
+ assertEquals("unknown property", null, config.getProperty("key3"));
}
public void testGetPropertyDirectMultiple()
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org