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/06/24 16:01:04 UTC
cvs commit: jakarta-commons/configuration/src/java/org/apache/commons/configuration AbstractConfiguration.java BasePathConfiguration.java BasePropertiesConfiguration.java ClassPropertiesConfiguration.java CompositeConfiguration.java ConfigurationException.java ConfigurationFactory.java ConfigurationRuntimeException.java ConfigurationXMLDocument.java ConversionException.java DatabaseConfiguration.java JNDIConfiguration.java PropertiesConfiguration.java SubsetConfiguration.java
ebourg 2004/06/24 07:01:04
Modified: configuration/conf checkstyle.xml
configuration/src/java/org/apache/commons/configuration
AbstractConfiguration.java
BasePathConfiguration.java
BasePropertiesConfiguration.java
ClassPropertiesConfiguration.java
CompositeConfiguration.java
ConfigurationException.java
ConfigurationFactory.java
ConfigurationRuntimeException.java
ConfigurationXMLDocument.java
ConversionException.java DatabaseConfiguration.java
JNDIConfiguration.java PropertiesConfiguration.java
SubsetConfiguration.java
Log:
code formatting
Revision Changes Path
1.3 +16 -6 jakarta-commons/configuration/conf/checkstyle.xml
Index: checkstyle.xml
===================================================================
RCS file: /home/cvs/jakarta-commons/configuration/conf/checkstyle.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- checkstyle.xml 24 Jun 2004 12:35:14 -0000 1.2
+++ checkstyle.xml 24 Jun 2004 14:01:03 -0000 1.3
@@ -111,13 +111,10 @@
<!-- Checks for common coding problems -->
<!-- See http://checkstyle.sf.net/config_coding.html -->
- <module name="DoubleCheckedLocking"/> <!-- MY FAVOURITE -->
+ <module name="CovariantEquals"/>
+ <module name="DoubleCheckedLocking"/>
<module name="EmptyStatement"/>
<module name="EqualsHashCode"/>
- <module name="HiddenField">
- <property name="ignoreConstructorParameter" value="true"/>
- <property name="ignoreSetter" value="true"/>
- </module>
<module name="IllegalInstantiation"/>
<module name="InnerAssignment"/>
<module name="MagicNumber"/>
@@ -125,13 +122,26 @@
<module name="RedundantThrows"/>
<module name="SimplifyBooleanExpression"/>
<module name="SimplifyBooleanReturn"/>
+ <module name="StringLiteralEquality"/>
+ <module name="SuperClone"/>
+ <module name="SuperFinalize"/>
+ <module name="IllegalType"/>
+ <module name="DeclarationOrder"/>
+ <module name="ExplicitInitialization"/>
+ <module name="DefaultComesLast"/>
+ <module name="FallThrough"/>
+ <module name="MultipleVariableDeclarations"/>
+ <module name="UnnecessaryParentheses"/>
<!-- Checks for class design -->
<!-- See http://checkstyle.sf.net/config_design.html -->
<module name="FinalClass"/>
<module name="HideUtilityClassConstructor"/>
<module name="InterfaceIsType"/>
- <module name="VisibilityModifier"/>
+ <module name="VisibilityModifier">
+ <property name="protectedAllowed" value="true"/>
+ </module>
+
<!-- Miscellaneous other checks. -->
1.16 +56 -322 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.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- AbstractConfiguration.java 24 Jun 2004 12:35:14 -0000 1.15
+++ AbstractConfiguration.java 24 Jun 2004 14:01:03 -0000 1.16
@@ -41,33 +41,20 @@
*/
public abstract class AbstractConfiguration implements Configuration
{
- /** how big the initial arraylist for splitting up name value pairs */
- private static final int INITIAL_LIST_SIZE = 2;
-
/** start token */
protected static final String START_TOKEN = "${";
+
/** end token */
protected static final String END_TOKEN = "}";
/** The property delimiter used while parsing (a comma). */
protected static final char DELIMITER = ',';
+ /** how big the initial arraylist for splitting up name value pairs */
+ private static final int INITIAL_LIST_SIZE = 2;
+
/**
- * Add a property to the configuration. If it already exists then the value
- * stated here will be added to the configuration entry. For example, if
- *
- * resource.loader = file
- *
- * is already present in the configuration and you
- *
- * addProperty("resource.loader", "classpath")
- *
- * Then you will end up with a List like the following:
- *
- * ["file", "classpath"]
- *
- * @param key The Key to add the property to.
- * @param token The Value to add.
+ * {@inheritDoc}
*/
public void addProperty(String key, Object token)
{
@@ -121,8 +108,7 @@
*/
protected String interpolate(String base)
{
- String result = interpolateHelper(base, null);
- return (result);
+ return interpolateHelper(base, null);
}
/**
@@ -259,13 +245,7 @@
}
/**
- * Create an BaseConfiguration object that is a subset
- * of this one.
- *
- * @param prefix prefix string for keys
- *
- * @return subset of configuration if there is keys, that match
- * given prefix, or <code>null</code> if there is no such keys.
+ * {@inheritDoc}
*/
public Configuration subset(String prefix)
{
@@ -273,30 +253,17 @@
}
/**
- * Check if the configuration is empty
- *
- * @return <code>true</code> if Configuration is empty,
- * <code>false</code> otherwise.
+ * {@inheritDoc}
*/
public abstract boolean isEmpty();
/**
- * check if the configuration contains the key
- *
- * @param key the configuration key
- *
- * @return <code>true</code> if Configuration contain given key,
- * <code>false</code> otherwise.
+ * {@inheritDoc}
*/
public abstract boolean containsKey(String key);
/**
- * Set a property, this will replace any previously
- * set values. Set values is implicitly a call
- * to clearProperty(key), addProperty(key,value).
- *
- * @param key the configuration key
- * @param value the property value
+ * {@inheritDoc}
*/
public void setProperty(String key, Object value)
{
@@ -305,27 +272,17 @@
}
/**
- * Clear a property in the configuration.
- *
- * @param key the key to remove along with corresponding value.
+ * {@inheritDoc}
*/
public abstract void clearProperty(String key);
/**
- * Get the list of the keys contained in the configuration
- * repository.
- *
- * @return An Iterator.
+ * {@inheritDoc}
*/
public abstract Iterator getKeys();
/**
- * Get the list of the keys contained in the configuration
- * repository that match the specified prefix.
- *
- * @param prefix The prefix to test against.
- *
- * @return An Iterator of keys that match the prefix.
+ * {@inheritDoc}
*/
public Iterator getKeys(final String prefix)
{
@@ -347,19 +304,7 @@
}
/**
- * Get a list of properties associated with the given
- * configuration key.
- *
- * @param key The configuration key.
- *
- * @return The associated properties if key is found.
- *
- * @throws ConversionException is thrown if the key maps to an
- * 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)
+ * {@inheritDoc}
*/
public Properties getProperties(String key)
{
@@ -391,8 +336,7 @@
/*
* Each token is of the form 'key=value'.
*/
- Properties props =
- (defaults == null ? new Properties() : new Properties(defaults));
+ Properties props = defaults == null ? new Properties() : new Properties(defaults);
for (int i = 0; i < tokens.length; i++)
{
String token = tokens[i];
@@ -419,11 +363,7 @@
}
/**
- * Gets a property from the configuration.
- *
- * @param key property to retrieve
- * @return value as object. Will return user value if exists,
- * if not then default value if exists, otherwise null
+ * {@inheritDoc}
*/
public Object getProperty(String key)
{
@@ -444,16 +384,7 @@
}
/**
- * Get a boolean associated with the given configuration key.
- *
- * @param key The configuration key.
- *
- * @return The associated boolean.
- *
- * @throws NoSuchElementException is thrown if the key doesn't
- * map to an existing object.
- * @throws ConversionException is thrown if the key maps to an
- * object that is not a Boolean.
+ * {@inheritDoc}
*/
public boolean getBoolean(String key)
{
@@ -470,15 +401,7 @@
}
/**
- * Get a boolean associated with the given configuration key.
- *
- * @param key The configuration key.
- * @param defaultValue The default value.
- *
- * @return The associated boolean.
- *
- * @throws ConversionException is thrown if the key maps to an
- * object that is not a Boolean.
+ * {@inheritDoc}
*/
public boolean getBoolean(String key, boolean defaultValue)
{
@@ -486,16 +409,7 @@
}
/**
- * Get a boolean associated with the given configuration key.
- *
- * @param key The configuration key.
- * @param defaultValue The default value.
- *
- * @return The associated boolean if key is found and has valid
- * format, default value otherwise.
- *
- * @throws ConversionException is thrown if the key maps to an
- * object that is not a Boolean.
+ * {@inheritDoc}
*/
public Boolean getBoolean(String key, Boolean defaultValue)
{
@@ -526,16 +440,7 @@
}
/**
- * Get a byte associated with the given configuration key.
- *
- * @param key The configuration key.
- *
- * @return The associated byte.
- *
- * @throws NoSuchElementException is thrown if the key doesn't
- * map to an existing object.
- * @throws ConversionException is thrown if the key maps to an
- * object that is not a Byte.
+ * {@inheritDoc}
*/
public byte getByte(String key)
{
@@ -552,15 +457,7 @@
}
/**
- * Get a byte associated with the given configuration key.
- *
- * @param key The configuration key.
- * @param defaultValue The default value.
- *
- * @return The associated byte.
- *
- * @throws ConversionException is thrown if the key maps to an
- * object that is not a Byte.
+ * {@inheritDoc}
*/
public byte getByte(String key, byte defaultValue)
{
@@ -568,16 +465,7 @@
}
/**
- * Get a byte associated with the given configuration key.
- *
- * @param key The configuration key.
- * @param defaultValue The default value.
- *
- * @return The associated byte if key is found and has valid format, default
- * value otherwise.
- *
- * @throws ConversionException is thrown if the key maps to an object that
- * is not a Byte.
+ * {@inheritDoc}
*/
public Byte getByte(String key, Byte defaultValue)
{
@@ -610,16 +498,7 @@
}
/**
- * Get a double associated with the given configuration key.
- *
- * @param key The configuration key.
- *
- * @return The associated double.
- *
- * @throws NoSuchElementException is thrown if the key doesn't
- * map to an existing object.
- * @throws ConversionException is thrown if the key maps to an
- * object that is not a Double.
+ * {@inheritDoc}
*/
public double getDouble(String key)
{
@@ -636,15 +515,7 @@
}
/**
- * Get a double associated with the given configuration key.
- *
- * @param key The configuration key.
- * @param defaultValue The default value.
- *
- * @return The associated double.
- *
- * @throws ConversionException is thrown if the key maps to an
- * object that is not a Double.
+ * {@inheritDoc}
*/
public double getDouble(String key, double defaultValue)
{
@@ -652,16 +523,7 @@
}
/**
- * Get a double associated with the given configuration key.
- *
- * @param key The configuration key.
- * @param defaultValue The default value.
- *
- * @return The associated double if key is found and has valid
- * format, default value otherwise.
- *
- * @throws ConversionException is thrown if the key maps to an
- * object that is not a Double.
+ * {@inheritDoc}
*/
public Double getDouble(String key, Double defaultValue)
{
@@ -694,16 +556,7 @@
}
/**
- * Get a float associated with the given configuration key.
- *
- * @param key The configuration key.
- * @return The associated float.
- *
- * @throws NoSuchElementException is thrown if the key doesn't
- * map to an existing object.
- *
- * @throws ConversionException is thrown if the key maps to an
- * object that is not a Float.
+ * {@inheritDoc}
*/
public float getFloat(String key)
{
@@ -720,14 +573,7 @@
}
/**
- * Get a float associated with the given configuration key.
- *
- * @param key The configuration key.
- * @param defaultValue The default value.
- * @return The associated float.
- *
- * @throws ConversionException is thrown if the key maps to an
- * object that is not a Float.
+ * {@inheritDoc}
*/
public float getFloat(String key, float defaultValue)
{
@@ -735,15 +581,7 @@
}
/**
- * Get a float associated with the given configuration key.
- *
- * @param key The configuration key.
- * @param defaultValue The default value.
- * @return The associated float if key is found and has valid
- * format, default value otherwise.
- *
- * @throws ConversionException is thrown if the key maps to an
- * object that is not a Float.
+ * {@inheritDoc}
*/
public Float getFloat(String key, Float defaultValue)
{
@@ -776,16 +614,7 @@
}
/**
- * Get a int associated with the given configuration key.
- *
- * @param key The configuration key.
- * @return The associated int.
- *
- * @throws NoSuchElementException is thrown if the key doesn't
- * map to an existing object.
- *
- * @throws ConversionException is thrown if the key maps to an
- * object that is not a Integer.
+ * {@inheritDoc}
*/
public int getInt(String key)
{
@@ -802,14 +631,7 @@
}
/**
- * Get a int associated with the given configuration key.
- *
- * @param key The configuration key.
- * @param defaultValue The default value.
- * @return The associated int.
- *
- * @throws ConversionException is thrown if the key maps to an
- * object that is not a Integer.
+ * {@inheritDoc}
*/
public int getInt(String key, int defaultValue)
{
@@ -824,16 +646,7 @@
}
/**
- * Get a int associated with the given configuration key.
- *
- * @param key The configuration key.
- * @param defaultValue The default value.
- *
- * @return The associated int if key is found and has valid format, default
- * value otherwise.
- *
- * @throws ConversionException is thrown if the key maps to an object that
- * is not a Integer.
+ * {@inheritDoc}
*/
public Integer getInteger(String key, Integer defaultValue)
{
@@ -866,17 +679,7 @@
}
/**
- * Get a long associated with the given configuration key.
- *
- * @param key The configuration key.
- *
- * @return The associated long.
- *
- * @throws NoSuchElementException is thrown if the key doesn't
- * map to an existing object.
- *
- * @throws ConversionException is thrown if the key maps to an
- * object that is not a Long.
+ * {@inheritDoc}
*/
public long getLong(String key)
{
@@ -893,15 +696,7 @@
}
/**
- * Get a long associated with the given configuration key.
- *
- * @param key The configuration key.
- * @param defaultValue The default value.
- *
- * @return The associated long.
- *
- * @throws ConversionException is thrown if the key maps to an
- * object that is not a Long.
+ * {@inheritDoc}
*/
public long getLong(String key, long defaultValue)
{
@@ -909,16 +704,7 @@
}
/**
- * Get a long associated with the given configuration key.
- *
- * @param key The configuration key.
- * @param defaultValue The default value.
- *
- * @return The associated long if key is found and has valid
- * format, default value otherwise.
- *
- * @throws ConversionException is thrown if the key maps to an
- * object that is not a Long.
+ * {@inheritDoc}
*/
public Long getLong(String key, Long defaultValue)
{
@@ -951,16 +737,7 @@
}
/**
- * Get a short associated with the given configuration key.
- *
- * @param key The configuration key.
- *
- * @return The associated short.
- *
- * @throws NoSuchElementException is thrown if the key doesn't
- * map to an existing object.
- * @throws ConversionException is thrown if the key maps to an
- * object that is not a Short.
+ * {@inheritDoc}
*/
public short getShort(String key)
{
@@ -977,15 +754,7 @@
}
/**
- * Get a short associated with the given configuration key.
- *
- * @param key The configuration key.
- * @param defaultValue The default value.
- *
- * @return The associated short.
- *
- * @throws ConversionException is thrown if the key maps to an
- * object that is not a Short.
+ * {@inheritDoc}
*/
public short getShort(String key, short defaultValue)
{
@@ -993,16 +762,7 @@
}
/**
- * Get a short associated with the given configuration key.
- *
- * @param key The configuration key.
- * @param defaultValue The default value.
- *
- * @return The associated short if key is found and has valid
- * format, default value otherwise.
- *
- * @throws ConversionException is thrown if the key maps to an
- * object that is not a Short.
+ * {@inheritDoc}
*/
public Short getShort(String key, Short defaultValue)
{
@@ -1034,6 +794,9 @@
}
}
+ /**
+ * {@inheritDoc}
+ */
public BigDecimal getBigDecimal(String key)
{
BigDecimal number = getBigDecimal(key, null);
@@ -1048,6 +811,9 @@
}
}
+ /**
+ * {@inheritDoc}
+ */
public BigDecimal getBigDecimal(String key, BigDecimal defaultValue)
{
Object value = resolveContainerStore(key);
@@ -1078,6 +844,9 @@
}
}
+ /**
+ * {@inheritDoc}
+ */
public BigInteger getBigInteger(String key)
{
BigInteger number = getBigInteger(key, null);
@@ -1092,6 +861,9 @@
}
}
+ /**
+ * {@inheritDoc}
+ */
public BigInteger getBigInteger(String key, BigInteger defaultValue)
{
Object value = resolveContainerStore(key);
@@ -1124,17 +896,7 @@
}
/**
- * Get a string associated with the given configuration key.
- *
- * @param key The configuration key.
- *
- * @return The associated string.
- *
- * @throws ConversionException is thrown if the key maps to an object that
- * is not a String.
- *
- * @throws NoSuchElementException is thrown if the key doesn't
- * map to an existing object.
+ * {@inheritDoc}
*/
public String getString(String key)
{
@@ -1151,15 +913,7 @@
}
/**
- * Get a string associated with the given configuration key.
- *
- * @param key The configuration key.
- * @param defaultValue The default value.
- *
- * @return The associated string if key is found, default value otherwise.
- *
- * @throws ConversionException is thrown if the key maps to an object that
- * is not a String.
+ * {@inheritDoc}
*/
public String getString(String key, String defaultValue)
{
@@ -1181,14 +935,7 @@
}
/**
- * Get an array of strings associated with the given configuration key.
- *
- * @param key The configuration key.
- *
- * @return The associated string array if key is found.
- *
- * @throws ConversionException is thrown if the key maps to an
- * object that is not a String/List of Strings.
+ * {@inheritDoc}
*/
public String[] getStringArray(String key)
{
@@ -1224,13 +971,7 @@
}
/**
- * Get a List of strings associated with the given configuration key.
- *
- * @param key The configuration key.
- * @return The associated List.
- *
- * @throws ConversionException is thrown if the key maps to an
- * object that is not a List.
+ * {@inheritDoc}
*/
public List getList(String key)
{
@@ -1238,14 +979,7 @@
}
/**
- * Get a List of strings associated with the given configuration key.
- *
- * @param key The configuration key.
- * @param defaultValue The default value.
- * @return The associated List.
- *
- * @throws ConversionException is thrown if the key maps to an
- * object that is not a List.
+ * {@inheritDoc}
*/
public List getList(String key, List defaultValue)
{
@@ -1353,7 +1087,7 @@
static class Container
{
/** We're wrapping a List object (A List) */
- private List list = null;
+ private List list;
/**
* Constructor
1.5 +2 -2 jakarta-commons/configuration/src/java/org/apache/commons/configuration/BasePathConfiguration.java
Index: BasePathConfiguration.java
===================================================================
RCS file: /home/cvs/jakarta-commons/configuration/src/java/org/apache/commons/configuration/BasePathConfiguration.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- BasePathConfiguration.java 24 Jun 2004 12:35:14 -0000 1.4
+++ BasePathConfiguration.java 24 Jun 2004 14:01:03 -0000 1.5
@@ -32,7 +32,7 @@
* "synthetic" PropertyConfiguration has been created which
* is not loaded from a file
*/
- private String basePath = null;
+ private String basePath;
/**
* Returns the Base path from which this Configuration Factory operates.
1.15 +4 -4 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.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- BasePropertiesConfiguration.java 24 Jun 2004 12:35:14 -0000 1.14
+++ BasePropertiesConfiguration.java 24 Jun 2004 14:01:03 -0000 1.15
@@ -127,14 +127,14 @@
*/
public abstract class BasePropertiesConfiguration extends BasePathConfiguration
{
- /** Allow file inclusion or not */
- private boolean includesAllowed = false;
-
/**
* This is the name of the property that can point to other
* properties file for including other properties files.
*/
protected static String include = "include";
+
+ /** Allow file inclusion or not */
+ private boolean includesAllowed;
/**
* Implementations of this class must implement this method.
1.9 +3 -3 jakarta-commons/configuration/src/java/org/apache/commons/configuration/ClassPropertiesConfiguration.java
Index: ClassPropertiesConfiguration.java
===================================================================
RCS file: /home/cvs/jakarta-commons/configuration/src/java/org/apache/commons/configuration/ClassPropertiesConfiguration.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ClassPropertiesConfiguration.java 24 Jun 2004 12:35:14 -0000 1.8
+++ ClassPropertiesConfiguration.java 24 Jun 2004 14:01:03 -0000 1.9
@@ -37,10 +37,10 @@
public class ClassPropertiesConfiguration extends BasePropertiesConfiguration implements Configuration
{
/** Base class, which is used to load all relative class references */
- private Class baseClass = null;
+ private Class baseClass;
/** Class Loader which we will use to load the resources */
- private ClassLoader classLoader = null;
+ private ClassLoader classLoader;
/**
* Creates and loads an extended properties file from the Class
1.16 +39 -39 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.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- CompositeConfiguration.java 24 Jun 2004 12:35:14 -0000 1.15
+++ CompositeConfiguration.java 24 Jun 2004 14:01:03 -0000 1.16
@@ -54,8 +54,10 @@
/**
* Creates an CompositeConfiguration object with a specified InMemory
- * configuration. This configuration will store any changes made to
+ * configuration. This configuration will store any changes made to
* the CompositeConfiguration.
+ *
+ * @param inMemoryConfiguration the in memory configuration to use
*/
public CompositeConfiguration(Configuration inMemoryConfiguration)
{
@@ -64,6 +66,11 @@
configList.add(inMemoryConfiguration);
}
+ /**
+ * Add a configuration.
+ *
+ * @param config the configuration to add
+ */
public void addConfiguration(Configuration config)
{
if (!configList.contains(config))
@@ -76,6 +83,11 @@
}
}
+ /**
+ * Remove a configuration. The in memory configuration cannot be removed.
+ *
+ * @param config The configuration to remove
+ */
public void removeConfiguration(Configuration config)
{
// Make sure that you can't remove the inMemoryConfiguration from
@@ -86,11 +98,19 @@
}
}
+ /**
+ * Return the number of configurations.
+ *
+ * @return the number of configuration
+ */
public int getNumberOfConfigurations()
{
return configList.size();
}
+ /**
+ * Remove all configuration reinitialize the in memory configuration.
+ */
public void clear()
{
configList.clear();
@@ -141,10 +161,7 @@
}
/**
- * Get the list of the keys contained in the configuration
- * repository.
- *
- * @return An Iterator.
+ * {@inheritDoc}
*/
public Iterator getKeys()
{
@@ -168,10 +185,7 @@
}
/**
- * Get the list of the keys contained in the configuration
- * repository.
- *
- * @return An Iterator.
+ * {@inheritDoc}
*/
public Iterator getKeys(String key)
{
@@ -194,6 +208,9 @@
return keys.iterator();
}
+ /**
+ * {@inheritDoc}
+ */
public boolean isEmpty()
{
boolean isEmpty = true;
@@ -210,11 +227,7 @@
}
/**
- * Gets a property from the configuration.
- *
- * @param key property to retrieve
- * @return value as object. Will return user value if exists,
- * if not then default value if exists, otherwise null
+ * {@inheritDoc}
*/
public Object getProperty(String key)
{
@@ -222,12 +235,7 @@
}
/**
- * Set a property, this will replace any previously
- * set values. Set values is implicitly a call
- * to clearProperty(key), addProperty(key,value).
- *
- * @param key
- * @param value
+ * {@inheritDoc}
*/
public void setProperty(String key, Object value)
{
@@ -236,9 +244,7 @@
}
/**
- * Clear a property in the configuration.
- *
- * @param key the key to remove along with corresponding value.
+ * {@inheritDoc}
*/
public void clearProperty(String key)
{
@@ -250,7 +256,7 @@
}
/**
- * Check if the configuration contains the key
+ * {@inheritDoc}
*/
public boolean containsKey(String key)
{
@@ -266,11 +272,7 @@
}
/**
- * Get a List of strings associated with the given configuration key.
- *
- * @param key The configuration key.
- * @param defaultValue The default value.
- * @return The associated List.
+ * {@inheritDoc}
*/
public List getList(String key, List defaultValue)
{
@@ -299,13 +301,7 @@
}
/**
- * Get an array of strings associated with the given configuration key.
- *
- * @param key The configuration key.
- * @return The associated string array if key is found.
- *
- * @throws ConversionException is thrown if the key maps to an
- * object that is not a String/List of Strings.
+ * {@inheritDoc}
*/
public String[] getStringArray(String key)
{
@@ -313,14 +309,18 @@
return (String []) list.toArray(new String [0]);
}
-
+ /**
+ * Return the configuration at the specified index.
+ *
+ * @param index The index of the configuration to retrieve
+ */
public Configuration getConfiguration(int index)
{
return (Configuration) configList.get(index);
}
/**
- * @return Returns the inMemoryConfiguration.
+ * {@inheritDoc}
*/
public Configuration getInMemoryConfiguration()
{
1.5 +5 -2 jakarta-commons/configuration/src/java/org/apache/commons/configuration/ConfigurationException.java
Index: ConfigurationException.java
===================================================================
RCS file: /home/cvs/jakarta-commons/configuration/src/java/org/apache/commons/configuration/ConfigurationException.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ConfigurationException.java 15 Jun 2004 10:40:54 -0000 1.4
+++ ConfigurationException.java 24 Jun 2004 14:01:03 -0000 1.5
@@ -31,7 +31,10 @@
* Constructs a new <code>ConfigurationException</code> without specified
* detail message.
*/
- public ConfigurationException() { }
+ public ConfigurationException()
+ {
+ super();
+ }
/**
* Constructs a new <code>ConfigurationException</code> with specified
1.13 +11 -8 jakarta-commons/configuration/src/java/org/apache/commons/configuration/ConfigurationFactory.java
Index: ConfigurationFactory.java
===================================================================
RCS file: /home/cvs/jakarta-commons/configuration/src/java/org/apache/commons/configuration/ConfigurationFactory.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- ConfigurationFactory.java 23 Jun 2004 11:15:45 -0000 1.12
+++ ConfigurationFactory.java 24 Jun 2004 14:01:03 -0000 1.13
@@ -64,6 +64,9 @@
/** Constant for the default base path (points to actual directory).*/
private static final String DEF_BASE_PATH = ".";
+ /** static logger */
+ private static Log log = LogFactory.getLog(ConfigurationFactory.class);
+
/** The XML file with the details about the configuration to load */
private String configurationFileName;
@@ -80,9 +83,6 @@
/** The basePath to prefix file paths for file based property files. */
private String basePath;
- /** static logger */
- private static Log log = LogFactory.getLog(ConfigurationFactory.class);
-
/** URL for xml digester rules file */
private URL digesterRules;
@@ -387,6 +387,7 @@
}
digester.setValidating(false);
}
+
/**
* Returns the Base path from which this Configuration Factory operates.
* This is never null. If you set the BasePath to null, then a base path
@@ -396,8 +397,7 @@
*/
public String getBasePath()
{
- String path = StringUtils.isEmpty(basePath) ?
- implicitBasePath : basePath;
+ String path = StringUtils.isEmpty(basePath) ? implicitBasePath : basePath;
return StringUtils.isEmpty(path) ? "." : path;
}
@@ -513,6 +513,7 @@
/**
* Returns the value of the <code>at</code> attribute.
+ *
* @return the at attribute
*/
public String getAt()
@@ -522,6 +523,7 @@
/**
* Sets the value of the <code>at</code> attribute.
+ *
* @param string the attribute value
*/
public void setAt(String string)
@@ -531,6 +533,7 @@
/**
* Returns the configuration object.
+ *
* @return the configuration
*/
public Configuration getConfiguration()
@@ -543,6 +546,7 @@
* named <code>setConfiguration()</code>, but the name
* <code>addConfiguration()</code> is required by some of the digester
* rules.
+ *
* @param config the configuration to set
*/
public void addConfiguration(Configuration config)
@@ -645,8 +649,7 @@
* @param cdata the configuration data object
* @return a root node for this configuration
*/
- private HierarchicalConfiguration.Node createRootNode(
- AdditionalConfigurationData cdata)
+ private HierarchicalConfiguration.Node createRootNode(AdditionalConfigurationData cdata)
{
if (cdata.getConfiguration() instanceof HierarchicalConfiguration)
{
1.3 +5 -2 jakarta-commons/configuration/src/java/org/apache/commons/configuration/ConfigurationRuntimeException.java
Index: ConfigurationRuntimeException.java
===================================================================
RCS file: /home/cvs/jakarta-commons/configuration/src/java/org/apache/commons/configuration/ConfigurationRuntimeException.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ConfigurationRuntimeException.java 15 Jun 2004 11:48:09 -0000 1.2
+++ ConfigurationRuntimeException.java 24 Jun 2004 14:01:03 -0000 1.3
@@ -32,7 +32,10 @@
* Constructs a new <code>ConfigurationRuntimeException</code> without
* specified detail message.
*/
- public ConfigurationRuntimeException() { }
+ public ConfigurationRuntimeException()
+ {
+ super();
+ }
/**
* Constructs a new <code>ConfigurationRuntimeException</code> with
1.6 +2 -2 jakarta-commons/configuration/src/java/org/apache/commons/configuration/ConfigurationXMLDocument.java
Index: ConfigurationXMLDocument.java
===================================================================
RCS file: /home/cvs/jakarta-commons/configuration/src/java/org/apache/commons/configuration/ConfigurationXMLDocument.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ConfigurationXMLDocument.java 24 Jun 2004 12:35:15 -0000 1.5
+++ ConfigurationXMLDocument.java 24 Jun 2004 14:01:03 -0000 1.6
@@ -352,7 +352,7 @@
public void write(Writer out, String prefix, String root, boolean pretty) throws IOException, DocumentException
{
OutputFormat format =
- (pretty)
+ pretty
? OutputFormat.createPrettyPrint()
: OutputFormat.createCompactFormat();
1.3 +5 -2 jakarta-commons/configuration/src/java/org/apache/commons/configuration/ConversionException.java
Index: ConversionException.java
===================================================================
RCS file: /home/cvs/jakarta-commons/configuration/src/java/org/apache/commons/configuration/ConversionException.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ConversionException.java 15 Jun 2004 11:48:09 -0000 1.2
+++ ConversionException.java 24 Jun 2004 14:01:03 -0000 1.3
@@ -30,7 +30,10 @@
* Constructs a new <code>ConversionException</code> without specified
* detail message.
*/
- public ConversionException() { }
+ public ConversionException()
+ {
+ super();
+ }
/**
* Constructs a new <code>ConversionException</code> with specified
1.7 +34 -7 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.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- DatabaseConfiguration.java 24 Jun 2004 12:35:15 -0000 1.6
+++ DatabaseConfiguration.java 24 Jun 2004 14:01:03 -0000 1.7
@@ -39,6 +39,10 @@
*/
public class DatabaseConfiguration extends AbstractConfiguration
{
+ /** Logger */
+ private static Log log = LogFactory.getLog(DatabaseConfiguration.class);
+
+ /** The datasource to connect to the database. */
private DataSource datasource;
/** The name of the table containing the configurations. */
@@ -56,8 +60,6 @@
/** The name of the configuration. */
private String name;
- private static Log log = LogFactory.getLog(DatabaseConfiguration.class);
-
/**
* Build a configuration from a table containing multiple configurations.
*
@@ -68,7 +70,8 @@
* @param valueColumn the column containing the values of the configuration
* @param name the name of the configuration
*/
- public DatabaseConfiguration(DataSource datasource, String table, String nameColumn, String keyColumn, String valueColumn, String name)
+ public DatabaseConfiguration(DataSource datasource, String table, String nameColumn,
+ String keyColumn, String valueColumn, String name)
{
this.datasource = datasource;
this.table = table;
@@ -91,6 +94,9 @@
this(datasource, table, null, keyColumn, valueColumn, null);
}
+ /**
+ * {@inheritDoc}
+ */
protected Object getPropertyDirect(String key)
{
Object result = null;
@@ -136,6 +142,9 @@
return result;
}
+ /**
+ * {@inheritDoc}
+ */
protected void addPropertyDirect(String key, Object obj)
{
// build the query
@@ -179,6 +188,9 @@
}
}
+ /**
+ * {@inheritDoc}
+ */
public boolean isEmpty()
{
boolean empty = false;
@@ -208,7 +220,7 @@
if (rs.next())
{
- empty = (rs.getInt(1) == 0);
+ empty = rs.getInt(1) == 0;
}
}
catch (SQLException e)
@@ -224,6 +236,9 @@
return empty;
}
+ /**
+ * {@inheritDoc}
+ */
public boolean containsKey(String key)
{
boolean found = false;
@@ -267,6 +282,9 @@
return found;
}
+ /**
+ * {@inheritDoc}
+ */
public void clearProperty(String key)
{
// build the query
@@ -304,6 +322,9 @@
}
}
+ /**
+ * {@inheritDoc}
+ */
public Iterator getKeys()
{
Collection keys = new ArrayList();
@@ -360,8 +381,14 @@
{
try
{
- if (stmt != null) { stmt.close(); }
- if (conn != null) { conn.close(); }
+ if (stmt != null)
+ {
+ stmt.close();
+ }
+ if (conn != null)
+ {
+ conn.close();
+ }
}
catch (SQLException e)
{
1.16 +25 -25 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.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- JNDIConfiguration.java 24 Jun 2004 12:35:15 -0000 1.15
+++ JNDIConfiguration.java 24 Jun 2004 14:01:03 -0000 1.16
@@ -45,6 +45,7 @@
*/
public class JNDIConfiguration extends AbstractConfiguration
{
+ /** Logger. */
private static Log log = LogFactory.getLog(JNDIConfiguration.class);
/** The prefix of the context. */
@@ -108,9 +109,7 @@
}
/**
- * Get the list of the keys contained in the configuration repository.
- *
- * @return An Iterator.
+ * {@inheritDoc}
*/
public Iterator getKeys()
{
@@ -118,11 +117,7 @@
}
/**
- * Get the list of the keys contained in the configuration
- * repository that match a passed in beginning pattern.
- *
- * @param key the key pattern to match on.
- * @return An Iterator.
+ * {@inheritDoc}
*/
public Iterator getKeys(String key)
{
@@ -164,7 +159,9 @@
* tree, till we find the Context specified by the key to start from.
* Otherwise return null.
*
- * @param The key (or name) of the Context we are looking to start from.
+ * @param keys
+ * @param parentContext
+ * @param enumeration
* @return The context at that key's location in the JNDI tree, or null if not found
* @throws NamingException if JNDI has an issue
*/
@@ -201,11 +198,19 @@
return null;
}
+ /**
+ * {@inheritDoc}
+ *
+ * <b>This operation is not supported</b>
+ */
public Properties getProperties(String key)
{
throw new UnsupportedOperationException("This operation is not supported");
}
+ /**
+ * {@inheritDoc}
+ */
public boolean isEmpty()
{
try
@@ -221,11 +226,7 @@
}
/**
- * Gets a property from the configuration.
- *
- * @param key property to retrieve
- * @return value as object. Will return user value if exists,
- * if not then default value if exists, otherwise null
+ * {@inheritDoc}
*/
public Object getProperty(String key)
{
@@ -233,11 +234,7 @@
}
/**
- * Set a property, this will replace any previously set values. Set values
- * is implicitly a call to clearProperty(key), addProperty(key,value).
- *
- * @param key
- * @param value
+ * {@inheritDoc}
*/
public void setProperty(String key, Object value)
{
@@ -245,10 +242,7 @@
}
/**
- * Clear a property in the configuration. Just marks it as cleared,
- * doesn't change the underlying JNDI data source.
- *
- * @param key the key to remove along with corresponding value.
+ * {@inheritDoc}
*/
public void clearProperty(String key)
{
@@ -256,7 +250,7 @@
}
/**
- * Check if the configuration contains the key, or the key has been removed.
+ * {@inheritDoc}
*/
public boolean containsKey(String key)
{
@@ -295,6 +289,9 @@
this.prefix = prefix;
}
+ /**
+ * {@inheritDoc}
+ */
protected Object getPropertyDirect(String key)
{
if (clearedProperties.contains(key))
@@ -318,6 +315,9 @@
}
}
+ /**
+ * {@inheritDoc}
+ */
protected void addPropertyDirect(String key, Object obj)
{
throw new UnsupportedOperationException("This operation is not supported");
1.12 +2 -2 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.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- PropertiesConfiguration.java 24 Jun 2004 12:35:15 -0000 1.11
+++ PropertiesConfiguration.java 24 Jun 2004 14:01:03 -0000 1.12
@@ -61,7 +61,7 @@
* The name of the file to be loaded. This is used in conjuction with
* the load method.
*/
- protected String fileName = null;
+ protected String fileName;
/**
* Creates an empty PropertyConfiguration object which can be
1.5 +38 -3 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.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- SubsetConfiguration.java 23 Jun 2004 11:15:45 -0000 1.4
+++ SubsetConfiguration.java 24 Jun 2004 14:01:03 -0000 1.5
@@ -33,15 +33,20 @@
*/
public class SubsetConfiguration extends AbstractConfiguration
{
+ /** The parent configuration. */
protected Configuration parent;
+
+ /** The prefix used to select the properties. */
protected String prefix;
+
+ /** The prefix delimiter */
protected String delimiter;
/**
* Create a subset of the specified configuration
*
* @param parent The parent configuration
- * @param prefix The prefix used to select the properties.
+ * @param prefix The prefix used to select the properties
*/
public SubsetConfiguration(Configuration parent, String prefix)
{
@@ -53,7 +58,7 @@
* Create a subset of the specified configuration
*
* @param parent The parent configuration
- * @param prefix The prefix used to select the properties.
+ * @param prefix The prefix used to select the properties
* @param delimiter The prefix delimiter
*/
public SubsetConfiguration(Configuration parent, String prefix, String delimiter)
@@ -134,41 +139,65 @@
this.prefix = prefix;
}
+ /**
+ * {@inheritDoc}
+ */
public Configuration subset(String prefix)
{
return parent.subset(getParentKey(prefix));
}
+ /**
+ * {@inheritDoc}
+ */
public boolean isEmpty()
{
return !getKeys().hasNext();
}
+ /**
+ * {@inheritDoc}
+ */
public boolean containsKey(String key)
{
return parent.containsKey(getParentKey(key));
}
+ /**
+ * {@inheritDoc}
+ */
public void addPropertyDirect(String key, Object value)
{
parent.addProperty(getParentKey(key), value);
}
+ /**
+ * {@inheritDoc}
+ */
public void setProperty(String key, Object value)
{
parent.setProperty(getParentKey(key), value);
}
+ /**
+ * {@inheritDoc}
+ */
public void clearProperty(String key)
{
parent.clearProperty(getParentKey(key));
}
+ /**
+ * {@inheritDoc}
+ */
public Object getPropertyDirect(String key)
{
return parent.getProperty(getParentKey(key));
}
+ /**
+ * {@inheritDoc}
+ */
public Iterator getKeys(String prefix)
{
return new TransformIterator(parent.getKeys(getParentKey(prefix)), new Transformer()
@@ -180,6 +209,9 @@
});
}
+ /**
+ * {@inheritDoc}
+ */
public Iterator getKeys()
{
return new TransformIterator(parent.getKeys(prefix), new Transformer()
@@ -191,6 +223,9 @@
});
}
+ /**
+ * {@inheritDoc}
+ */
protected String interpolate(String base)
{
if (delimiter == null && "".equals(prefix))
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org