henning 2003/06/07 12:30:44
Modified: configuration/src/java/org/apache/commons/configuration
BasePathConfiguration.java
BasePropertiesConfiguration.java
ClassPropertiesConfiguration.java
CompositeConfiguration.java
ConfigurationFactory.java ConfigurationUtils.java
DOM4JConfiguration.java JNDIConfiguration.java
configuration/src/test-cactus/org/apache/commons/configuration
TestJNDIAndCompositeConfiguration.java
configuration/xdocs tasks.xml
Log:
Style fixes.
Revision Changes Path
1.2 +7 -5
jakarta-commons-sandbox/configuration/src/java/org/apache/commons/configuration/BasePathConfiguration.java
Index: BasePathConfiguration.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/configuration/src/java/org/apache/commons/configuration/BasePathConfiguration.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- BasePathConfiguration.java 7 Jun 2003 18:24:00 -0000 1.1
+++ BasePathConfiguration.java 7 Jun 2003 19:30:43 -0000 1.2
@@ -70,11 +70,12 @@
* "synthetic" PropertyConfiguration has been created which
* is not loaded from a file
*/
- protected String basePath = null;
+ private String basePath = null;
/**
* Returns the Base path from which this Configuration Factory operates.
- * This is never null. If you set the BasePath to null, then "." is returned.
+ * This is never null. If you set the BasePath to null, then "."
+ * is returned.
*
* @return The base Path of this configuration factory.
*/
@@ -84,8 +85,9 @@
}
/**
- * Sets the basePath for all file references from this Configuration Factory.
- * If you pass null in, this is interpreted as "current directory".
+ * Sets the basePath for all file references from this Configuration
+ * Factory. If you pass null in, this is interpreted as "current
+ * directory".
*
* @param basePath The new basePath to set.
*/
1.7 +4 -4
jakarta-commons-sandbox/configuration/src/java/org/apache/commons/configuration/BasePropertiesConfiguration.java
Index: BasePropertiesConfiguration.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/configuration/src/java/org/apache/commons/configuration/BasePropertiesConfiguration.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- BasePropertiesConfiguration.java 7 Jun 2003 18:24:00 -0000 1.6
+++ BasePropertiesConfiguration.java 7 Jun 2003 19:30:43 -0000 1.7
@@ -142,7 +142,7 @@
* # properties can reference other properties
* base.prop = /base
* first.prop = ${base.prop}/first
- * second.prop = ${first.prop}/second
+ * second.prop = ${first.prop}/second
* </pre>
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a>
@@ -279,7 +279,7 @@
out.writeComment("written by PropertiesConfiguration");
out.writeComment(new Date().toString());
- for (Iterator i = this.getKeys(); i.hasNext(); )
+ for (Iterator i = this.getKeys(); i.hasNext();)
{
String key = (String) i.next();
String value = StringUtils.join(this.getStringArray(key), ", ");
@@ -316,7 +316,7 @@
* statement or not. Base rule is, that objects created by the empty
* C'tor can not have included files.
*
- * @param boolean includesAllowed True if Includes are allowed.
+ * @param includesAllowed includesAllowed True if Includes are allowed.
*/
protected void setIncludesAllowed(boolean includesAllowed)
{
1.3 +3 -3
jakarta-commons-sandbox/configuration/src/java/org/apache/commons/configuration/ClassPropertiesConfiguration.java
Index: ClassPropertiesConfiguration.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/configuration/src/java/org/apache/commons/configuration/ClassPropertiesConfiguration.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ClassPropertiesConfiguration.java 7 Jan 2003 22:53:36 -0000 1.2
+++ ClassPropertiesConfiguration.java 7 Jun 2003 19:30:43 -0000 1.3
@@ -78,10 +78,10 @@
implements Configuration
{
/** Base class, which is used to load all relative class references */
- protected Class baseClass = null;
+ private Class baseClass = null;
/** Class Loader which we will use to load the resources */
- protected ClassLoader classLoader = null;
+ private ClassLoader classLoader = null;
/**
* Creates and loads an extended properties file from the Class
1.10 +5 -5
jakarta-commons-sandbox/configuration/src/java/org/apache/commons/configuration/CompositeConfiguration.java
Index: CompositeConfiguration.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/configuration/src/java/org/apache/commons/configuration/CompositeConfiguration.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- CompositeConfiguration.java 7 Jun 2003 17:57:29 -0000 1.9
+++ CompositeConfiguration.java 7 Jun 2003 19:30:43 -0000 1.10
@@ -698,7 +698,7 @@
public String getString(String key)
{
- return getString(key,null);
+ return getString(key, null);
}
/**
@@ -756,9 +756,9 @@
*/
public Vector getVector(String key)
{
- try {
-
- return getFirstMatchingConfig(key).getVector(key);
+ try
+ {
+ return getFirstMatchingConfig(key).getVector(key);
}
catch (NoSuchElementException nsee)
{
1.6 +7 -6
jakarta-commons-sandbox/configuration/src/java/org/apache/commons/configuration/ConfigurationFactory.java
Index: ConfigurationFactory.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/configuration/src/java/org/apache/commons/configuration/ConfigurationFactory.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ConfigurationFactory.java 7 Jun 2003 18:24:00 -0000 1.5
+++ ConfigurationFactory.java 7 Jun 2003 19:30:43 -0000 1.6
@@ -60,9 +60,8 @@
import java.net.URL;
import org.apache.commons.digester.AbstractObjectCreationFactory;
-import org.apache.commons.digester.ObjectCreationFactory;
import org.apache.commons.digester.Digester;
-import org.apache.commons.digester.ObjectParamRule;
+import org.apache.commons.digester.ObjectCreationFactory;
import org.apache.commons.digester.xmlrules.DigesterLoader;
import org.apache.commons.lang.StringUtils;
@@ -238,13 +237,15 @@
}
/**
- * Sets up a configuration instance that can directly construct a new object.
+ * Sets up a configuration instance that can directly construct a new
+ * object.
*
* @param digester The current digester
* @param matchString The pattern to match with this Rule
- * @param factory A Class object that describes the wanted class.
+ * @param clazz A Class object that describes the wanted class.
*/
- protected void setupDigesterInstance(Digester digester, String matchString,
Class clazz)
+ protected void setupDigesterInstance(Digester digester,
+ String matchString, Class clazz)
{
digester.addFactoryCreate(matchString, clazz);
digester.addSetProperties(matchString);
1.3 +132 -124
jakarta-commons-sandbox/configuration/src/java/org/apache/commons/configuration/ConfigurationUtils.java
Index: ConfigurationUtils.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/configuration/src/java/org/apache/commons/configuration/ConfigurationUtils.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ConfigurationUtils.java 11 Mar 2003 17:38:12 -0000 1.2
+++ ConfigurationUtils.java 7 Jun 2003 19:30:43 -0000 1.3
@@ -1,124 +1,132 @@
-package org.apache.commons.configuration;
-
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 1999-2002 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowlegement may appear in the software itself,
- * if and wherever such third-party acknowlegements normally appear.
- *
- * 4. The names "The Jakarta Project", "Commons", and "Apache Software
- * Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
- * permission, please contact [EMAIL PROTECTED]
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Group.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-import java.io.PrintStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Iterator;
-
-/**
- * Miscellaneous utility methods for configurations.
- *
- * @author <a href="mailto:[EMAIL PROTECTED]">Herve Quiroz</a>
- */
-public class ConfigurationUtils
-{
- private ConfigurationUtils()
- {
- // to prevent instanciation...
- }
-
- /**
- * Dump the configuration key/value mappings to some ouput stream.
- *
- * @param configuration the configuration
- * @param out the output stream to dump the configuration to
- */
- public static void dump(Configuration configuration, PrintStream out)
- {
- for (Iterator i=configuration.getKeys(); i.hasNext(); )
- {
- String key=(String)i.next();
- Object value=configuration.getProperty(key);
- out.print(key);
- out.print("=");
- out.print(value);
- if (i.hasNext())
- out.println();
- }
- }
-
- /**
- * Dump the configuration key/value mappings to some writer.
- *
- * @param configuration the configuration
- * @param out the writer to dump the configuration to
- */
- public static void dump(Configuration configuration, PrintWriter out)
- {
- for (Iterator i=configuration.getKeys(); i.hasNext(); )
- {
- String key=(String)i.next();
- Object value=configuration.getProperty(key);
- out.print(key);
- out.print("=");
- out.print(value);
- if (i.hasNext())
- out.println();
- }
- }
-
- /**
- * Get a string representation of the key/value mappings of a
- * configuration.
- *
- * @param configuration the configuration
- * @return a string representation of the configuration
- */
- public static String toString(Configuration configuration)
- {
- StringWriter writer=new StringWriter();
- dump(configuration, new PrintWriter(writer));
- return writer.toString();
- }
-}
+package org.apache.commons.configuration;
+
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 1999-2002 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Commons", and "Apache Software
+ * Foundation" must not be used to endorse or promote products derived
+ * from this software without prior written permission. For written
+ * permission, please contact [EMAIL PROTECTED]
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
+import java.io.PrintStream;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.Iterator;
+
+/**
+ * Miscellaneous utility methods for configurations.
+ *
+ * @author <a href="mailto:[EMAIL PROTECTED]">Herve Quiroz</a>
+ */
+public class ConfigurationUtils
+{
+ private ConfigurationUtils()
+ {
+ // to prevent instanciation...
+ }
+
+ /**
+ * Dump the configuration key/value mappings to some ouput stream.
+ *
+ * @param configuration the configuration
+ * @param out the output stream to dump the configuration to
+ */
+ public static void dump(Configuration configuration, PrintStream out)
+ {
+ for (Iterator i = configuration.getKeys(); i.hasNext(); )
+ {
+ String key = (String) i.next();
+ Object value = configuration.getProperty(key);
+ out.print(key);
+ out.print("=");
+ out.print(value);
+ if (i.hasNext())
+ {
+ out.println();
+ }
+ }
+ }
+
+ /**
+ * Dump the configuration key/value mappings to some writer.
+ *
+ * @param configuration the configuration
+ * @param out the writer to dump the configuration to
+ */
+ public static void dump(Configuration configuration, PrintWriter out)
+ {
+ for (Iterator i = configuration.getKeys(); i.hasNext();)
+ {
+ String key = (String) i.next();
+ Object value = configuration.getProperty(key);
+ out.print(key);
+ out.print("=");
+ out.print(value);
+
+ if (i.hasNext())
+ {
+ out.println();
+ }
+ }
+ }
+
+ /**
+ * Get a string representation of the key/value mappings of a
+ * configuration.
+ *
+ * @param configuration the configuration
+ * @return a string representation of the configuration
+ */
+ public static String toString(Configuration configuration)
+ {
+ StringWriter writer = new StringWriter();
+ dump(configuration, new PrintWriter(writer));
+ return writer.toString();
+ }
+}
1.5 +2 -1
jakarta-commons-sandbox/configuration/src/java/org/apache/commons/configuration/DOM4JConfiguration.java
Index: DOM4JConfiguration.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/configuration/src/java/org/apache/commons/configuration/DOM4JConfiguration.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- DOM4JConfiguration.java 7 Jun 2003 18:24:00 -0000 1.4
+++ DOM4JConfiguration.java 7 Jun 2003 19:30:43 -0000 1.5
@@ -123,7 +123,8 @@
*
*/
public DOM4JConfiguration()
- {}
+ {
+ }
/**
* Attempts to load the XML file as a resource from the
1.6 +10 -9
jakarta-commons-sandbox/configuration/src/java/org/apache/commons/configuration/JNDIConfiguration.java
Index: JNDIConfiguration.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/configuration/src/java/org/apache/commons/configuration/JNDIConfiguration.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- JNDIConfiguration.java 24 Mar 2003 07:23:47 -0000 1.5
+++ JNDIConfiguration.java 7 Jun 2003 19:30:43 -0000 1.6
@@ -55,10 +55,11 @@
*/
import java.util.Iterator;
+import java.util.HashMap;
+import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Properties;
import java.util.Vector;
-import java.util.*;
import javax.naming.Context;
import javax.naming.InitialContext;
@@ -73,7 +74,6 @@
*/
public class JNDIConfiguration implements Configuration
{
-
private String prefix;
private Context envCtx;
private Map clearedProperties = new HashMap();
@@ -83,7 +83,8 @@
* be added some other Configuration files
*/
public JNDIConfiguration()
- {}
+ {
+ }
/**
* JNDIConfigurations can not be added to
@@ -184,14 +185,14 @@
*/
public boolean containsKey(String key)
{
- if (clearedProperties.containsKey(key)){
+ if (clearedProperties.containsKey(key))
+ {
return false;
}
key = StringUtils.replace(key, ".", "/");
try
{
-
if (envCtx == null)
{
Context initCtx = new InitialContext();
@@ -574,8 +575,7 @@
*/
public String getString(String key)
{
-
- return getString(key,null);
+ return getString(key, null);
}
/**
@@ -592,7 +592,8 @@
try {
return getValueFromJNDI(key);
}
- catch (NoSuchElementException nsee){
+ catch (NoSuchElementException nsee)
+ {
return defaultValue;
}
}
1.3 +1 -3
jakarta-commons-sandbox/configuration/src/test-cactus/org/apache/commons/configuration/TestJNDIAndCompositeConfiguration.java
Index: TestJNDIAndCompositeConfiguration.java
===================================================================
RCS file:
/home/cvs/jakarta-commons-sandbox/configuration/src/test-cactus/org/apache/commons/configuration/TestJNDIAndCompositeConfiguration.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TestJNDIAndCompositeConfiguration.java 19 Mar 2003 10:33:00 -0000 1.2
+++ TestJNDIAndCompositeConfiguration.java 7 Jun 2003 19:30:43 -0000 1.3
@@ -127,9 +127,7 @@
*/
public void testSettingMissingProperty() throws Exception
{
-
cc.setProperty("my.new.property", "supernew");
assertEquals("supernew", cc.getString("my.new.property"));
-
}
-}
\ No newline at end of file
+}
1.3 +1 -0 jakarta-commons-sandbox/configuration/xdocs/tasks.xml
Index: tasks.xml
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/configuration/xdocs/tasks.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- tasks.xml 7 Jun 2003 17:57:17 -0000 1.2
+++ tasks.xml 7 Jun 2003 19:30:44 -0000 1.3
@@ -31,6 +31,7 @@
already added when configureNamespace() is called on the
digester. This might even be a bug in the Digester itself.
</li>
+ </ul>
</subsection>
<subsection name="Medium priority">
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]