You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by oh...@apache.org on 2012/12/08 21:09:39 UTC
svn commit: r1418746 - in /commons/proper/configuration/trunk/src:
main/java/org/apache/commons/configuration/builder/
main/java/org/apache/commons/configuration/builder/combined/
test/java/org/apache/commons/configuration/ test/java/org/apache/commons...
Author: oheger
Date: Sat Dec 8 20:09:37 2012
New Revision: 1418746
URL: http://svn.apache.org/viewvc?rev=1418746&view=rev
Log:
Builder parameters now use inheritance.
Added:
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/BasicBuilderProperties.java (with props)
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/FileBasedBuilderParametersImpl.java
- copied, changed from r1415862, commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/FileBasedBuilderParameters.java
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/FileBasedBuilderParametersImplBeanInfo.java
- copied, changed from r1416264, commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/FileBasedBuilderParametersBeanInfo.java
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/FileBasedBuilderProperties.java (with props)
Removed:
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/FileBasedBuilderParameters.java
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/FileBasedBuilderParametersBeanInfo.java
Modified:
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/BasicBuilderParameters.java
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/FileBasedConfigurationBuilder.java
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/ReloadingFileBasedConfigurationBuilder.java
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/combined/BaseConfigurationBuilderProvider.java
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/combined/CombinedConfigurationBuilder.java
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/combined/FileExtensionConfigurationBuilderProvider.java
commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestImmutableConfiguration.java
commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/TestFileBasedBuilderParameters.java
commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/TestFileBasedConfigurationBuilder.java
commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/TestReloadingFileBasedConfigurationBuilder.java
commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/combined/TestBaseConfigurationBuilderProvider.java
commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/combined/TestFileExtensionConfigurationBuilderProvider.java
Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/BasicBuilderParameters.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/BasicBuilderParameters.java?rev=1418746&r1=1418745&r2=1418746&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/BasicBuilderParameters.java (original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/BasicBuilderParameters.java Sat Dec 8 20:09:37 2012
@@ -41,7 +41,8 @@ import org.apache.commons.logging.Log;
* @version $Id$
* @since 2.0
*/
-public class BasicBuilderParameters implements BuilderParameters
+public class BasicBuilderParameters implements BuilderParameters,
+ BasicBuilderProperties<BasicBuilderParameters>
{
/** The key of the <em>throwExceptionOnMissing</em> property. */
private static final String PROP_THROW_EXCEPTION_ON_MISSING =
Added: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/BasicBuilderProperties.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/BasicBuilderProperties.java?rev=1418746&view=auto
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/BasicBuilderProperties.java (added)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/BasicBuilderProperties.java Sat Dec 8 20:09:37 2012
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.configuration.builder;
+
+import org.apache.commons.logging.Log;
+
+/**
+ * <p>
+ * Definition of a properties interface for basic parameters which are supported
+ * by all {@link ConfigurationBuilder} implementations derived from
+ * {@link BasicConfigurationBuilder}.
+ * </p>
+ * <p>
+ * This interface defines the single properties supported by a parameters
+ * object. Properties can be set using a fluent API making it convenient for
+ * client code to specify concrete property values in a single statement.
+ * </p>
+ *
+ * @version $Id$
+ * @since 2.0
+ * @param <T> the type of the result of all set methods for method chaining
+ */
+public interface BasicBuilderProperties<T>
+{
+ /**
+ * Sets the <em>logger</em> property. With this property a concrete
+ * {@code Log} object can be set for the configuration. Thus logging
+ * behavior can be controlled.
+ *
+ * @param log the {@code Log} for the configuration produced by this builder
+ * @return a reference to this object for method chaining
+ */
+ T setLogger(Log log);
+
+ /**
+ * Sets the value of the <em>delimiterParsingDisabled</em> property. This
+ * property controls whether the configuration should look for list
+ * delimiter characters in the values of newly added properties. If the
+ * property value is <b>true</b> and such characters are encountered,
+ * multiple values are stored for the affected property.
+ *
+ * @param b the value of the property
+ * @return a reference to this object for method chaining
+ */
+ T setDelimiterParsingDisabled(boolean b);
+
+ /**
+ * Sets the value of the <em>throwExceptionOnMissing</em> property. This
+ * property controls the configuration's behavior if missing properties are
+ * queried: a value of <b>true</b> causes the configuration to throw an
+ * exception, for a value of <b>false</b> it will return <b>null</b> values.
+ * (Note: Methods returning a primitive data type will always throw an
+ * exception if the property is not defined.)
+ *
+ * @param b the value of the property
+ * @return a reference to this object for method chaining
+ */
+ T setThrowExceptionOnMissing(boolean b);
+
+ /**
+ * Sets the value of the <em>listDelimiter</em> property. This property
+ * defines the list delimiter character. It is evaluated only if the
+ * <em>delimiterParsingDisabled</em> property is set to <b>false</b>.
+ *
+ * @param c the list delimiter character
+ * @return a reference to this object for method chaining
+ * @see #setDelimiterParsingDisabled(boolean)
+ */
+ T setListDelimiter(char c);
+}
Propchange: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/BasicBuilderProperties.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/BasicBuilderProperties.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/BasicBuilderProperties.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Copied: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/FileBasedBuilderParametersImpl.java (from r1415862, commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/FileBasedBuilderParameters.java)
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/FileBasedBuilderParametersImpl.java?p2=commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/FileBasedBuilderParametersImpl.java&p1=commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/FileBasedBuilderParameters.java&r1=1415862&r2=1418746&rev=1418746&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/FileBasedBuilderParameters.java (original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/FileBasedBuilderParametersImpl.java Sat Dec 8 20:09:37 2012
@@ -18,7 +18,6 @@ package org.apache.commons.configuration
import java.io.File;
import java.net.URL;
-import java.util.Collections;
import java.util.Map;
import org.apache.commons.configuration.FileSystem;
@@ -46,12 +45,13 @@ import org.apache.commons.configuration.
* @version $Id$
* @since 2.0
*/
-public class FileBasedBuilderParameters implements BuilderParameters
+public class FileBasedBuilderParametersImpl extends BasicBuilderParameters
+ implements FileBasedBuilderProperties<FileBasedBuilderParametersImpl>
{
/** Constant for the key in the parameters map used by this class. */
private static final String PARAM_KEY =
BasicConfigurationBuilder.RESERVED_PARAMETER
- + FileBasedBuilderParameters.class.getName();
+ + FileBasedBuilderParametersImpl.class.getName();
/**
* Stores the associated file handler for the location of the configuration.
@@ -62,22 +62,22 @@ public class FileBasedBuilderParameters
private long reloadingRefreshDelay;
/**
- * Creates a new instance of {@code FileBasedBuilderParameters} with an
+ * Creates a new instance of {@code FileBasedBuilderParametersImpl} with an
* uninitialized {@code FileHandler} object.
*/
- public FileBasedBuilderParameters()
+ public FileBasedBuilderParametersImpl()
{
this(null);
}
/**
- * Creates a new instance of {@code FileBasedBuilderParameters} and
+ * Creates a new instance of {@code FileBasedBuilderParametersImpl} and
* associates it with the given {@code FileHandler} object. If the handler
* is <b>null</b>, a new handler instance is created.
*
* @param handler the associated {@code FileHandler} (can be <b>null</b>)
*/
- public FileBasedBuilderParameters(FileHandler handler)
+ public FileBasedBuilderParametersImpl(FileHandler handler)
{
fileHandler = (handler != null) ? handler : new FileHandler();
}
@@ -90,7 +90,7 @@ public class FileBasedBuilderParameters
* @return the instance obtained from the map or <b>null</b>
* @throws NullPointerException if the map is <b>null</b>
*/
- public static FileBasedBuilderParameters fromParameters(
+ public static FileBasedBuilderParametersImpl fromParameters(
Map<String, Object> params)
{
return fromParameters(params, false);
@@ -109,22 +109,23 @@ public class FileBasedBuilderParameters
* @return the instance obtained from the map or <b>null</b>
* @throws NullPointerException if the map is <b>null</b>
*/
- public static FileBasedBuilderParameters fromParameters(
+ public static FileBasedBuilderParametersImpl fromParameters(
Map<String, Object> params, boolean createIfMissing)
{
- FileBasedBuilderParameters instance =
- (FileBasedBuilderParameters) params.get(PARAM_KEY);
+ FileBasedBuilderParametersImpl instance =
+ (FileBasedBuilderParametersImpl) params.get(PARAM_KEY);
if (instance == null && createIfMissing)
{
- instance = new FileBasedBuilderParameters();
+ instance = new FileBasedBuilderParametersImpl();
}
return instance;
}
/**
- * Returns the {@code FileHandler} associated with this parameters object.
+ * Returns the {@code FileHandler} managed by this object. This object is
+ * updated every time the file location is changed.
*
- * @return the {@code FileHandler}
+ * @return the managed {@code FileHandler}
*/
public FileHandler getFileHandler()
{
@@ -132,110 +133,59 @@ public class FileBasedBuilderParameters
}
/**
- * Returns the refresh delay for reloading support.
+ * Returns the refresh delay for reload operations.
*
- * @return the refresh delay (in milliseconds)
+ * @return the reloading refresh delay
*/
public long getReloadingRefreshDelay()
{
return reloadingRefreshDelay;
}
- /**
- * Sets the refresh delay for reloading support
- *
- * @param reloadingRefreshDelay the refresh delay (in milliseconds)
- * @return a reference to this object for method chaining
- */
- public FileBasedBuilderParameters setReloadingRefreshDelay(
+ public FileBasedBuilderParametersImpl setReloadingRefreshDelay(
long reloadingRefreshDelay)
{
this.reloadingRefreshDelay = reloadingRefreshDelay;
return this;
}
- /**
- * Sets the location of the associated {@code FileHandler} as a {@code File}
- * object.
- *
- * @param file the {@code File} location
- * @return a reference to this object for method chaining
- */
- public FileBasedBuilderParameters setFile(File file)
+ public FileBasedBuilderParametersImpl setFile(File file)
{
getFileHandler().setFile(file);
return this;
}
- /**
- * Sets the location of the associated {@code FileHandler} as a {@code URL}
- * object.
- *
- * @param url the {@code URL} location
- * @return a reference to this object for method chaining
- */
- public FileBasedBuilderParameters setURL(URL url)
+ public FileBasedBuilderParametersImpl setURL(URL url)
{
getFileHandler().setURL(url);
return this;
}
- /**
- * Sets the location of the associated {@code FileHandler} as an absolute
- * file path.
- *
- * @param path the path location
- * @return a reference to this object for method chaining
- */
- public FileBasedBuilderParameters setPath(String path)
+ public FileBasedBuilderParametersImpl setPath(String path)
{
getFileHandler().setPath(path);
return this;
}
- /**
- * Sets the file name of the associated {@code FileHandler}.
- *
- * @param name the file name
- * @return a reference to this object for method chaining
- */
- public FileBasedBuilderParameters setFileName(String name)
+ public FileBasedBuilderParametersImpl setFileName(String name)
{
getFileHandler().setFileName(name);
return this;
}
- /**
- * Sets the base path of the associated {@code FileHandler}.
- *
- * @param path the base path
- * @return a reference to this object for method chaining
- */
- public FileBasedBuilderParameters setBasePath(String path)
+ public FileBasedBuilderParametersImpl setBasePath(String path)
{
getFileHandler().setBasePath(path);
return this;
}
- /**
- * Sets the {@code FileSystem} of the associated {@code FileHandler}.
- *
- * @param fs the {@code FileSystem}
- * @return a reference to this object for method chaining
- */
- public FileBasedBuilderParameters setFileSystem(FileSystem fs)
+ public FileBasedBuilderParametersImpl setFileSystem(FileSystem fs)
{
getFileHandler().setFileSystem(fs);
return this;
}
- /**
- * Sets the encoding of the associated {@code FileHandler}.
- *
- * @param enc the encoding
- * @return a reference to this object for method chaining
- */
- public FileBasedBuilderParameters setEncoding(String enc)
+ public FileBasedBuilderParametersImpl setEncoding(String enc)
{
getFileHandler().setEncoding(enc);
return this;
@@ -244,10 +194,15 @@ public class FileBasedBuilderParameters
/**
* {@inheritDoc} This implementation returns a map which contains this
* object itself under a specific key. The static {@code fromParameters()}
- * method can be used to extract an instance from a parameters map.
+ * method can be used to extract an instance from a parameters map. Of
+ * course, the properties inherited from the base class are also added to
+ * the result map.
*/
+ @Override
public Map<String, Object> getParameters()
{
- return Collections.singletonMap(PARAM_KEY, (Object) this);
+ Map<String, Object> params = super.getParameters();
+ params.put(PARAM_KEY, this);
+ return params;
}
}
Copied: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/FileBasedBuilderParametersImplBeanInfo.java (from r1416264, commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/FileBasedBuilderParametersBeanInfo.java)
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/FileBasedBuilderParametersImplBeanInfo.java?p2=commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/FileBasedBuilderParametersImplBeanInfo.java&p1=commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/FileBasedBuilderParametersBeanInfo.java&r1=1416264&r2=1418746&rev=1418746&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/FileBasedBuilderParametersBeanInfo.java (original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/FileBasedBuilderParametersImplBeanInfo.java Sat Dec 8 20:09:37 2012
@@ -17,19 +17,19 @@
package org.apache.commons.configuration.builder;
/**
- * An additional {@code BeanInfo} class for {@link FileBasedBuilderParameters}.
+ * An additional {@code BeanInfo} class for {@link FileBasedBuilderParametersImpl}.
*
* @version $Id$
* @since 2.0
*/
-public class FileBasedBuilderParametersBeanInfo extends
+public class FileBasedBuilderParametersImplBeanInfo extends
BuilderParametersBeanInfo
{
/**
- * Creates a new instance of {@code FileBasedBuilderParametersBeanInfo}.
+ * Creates a new instance of {@code FileBasedBuilderParametersImplBeanInfo}.
*/
- public FileBasedBuilderParametersBeanInfo()
+ public FileBasedBuilderParametersImplBeanInfo()
{
- super(FileBasedBuilderParameters.class);
+ super(FileBasedBuilderParametersImpl.class);
}
}
Added: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/FileBasedBuilderProperties.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/FileBasedBuilderProperties.java?rev=1418746&view=auto
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/FileBasedBuilderProperties.java (added)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/FileBasedBuilderProperties.java Sat Dec 8 20:09:37 2012
@@ -0,0 +1,104 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.configuration.builder;
+
+import java.io.File;
+import java.net.URL;
+
+import org.apache.commons.configuration.FileSystem;
+
+/**
+ * <p>
+ * Definition of a properties interface for parameters of file-based configurations.
+ * </p>
+ * <p>
+ * This interface defines a set of properties which can be used to specify the
+ * location of a configuration source.
+ * </p>
+ *
+ * @version $Id$
+ * @param <T> the type of the result of all set methods for method chaining
+ */
+public interface FileBasedBuilderProperties<T>
+{
+ /**
+ * Sets the refresh delay for reloading support
+ *
+ * @param reloadingRefreshDelay the refresh delay (in milliseconds)
+ * @return a reference to this object for method chaining
+ */
+ T setReloadingRefreshDelay(long reloadingRefreshDelay);
+
+ /**
+ * Sets the location of the associated {@code FileHandler} as a {@code File}
+ * object.
+ *
+ * @param file the {@code File} location
+ * @return a reference to this object for method chaining
+ */
+ T setFile(File file);
+
+ /**
+ * Sets the location of the associated {@code FileHandler} as a {@code URL}
+ * object.
+ *
+ * @param url the {@code URL} location
+ * @return a reference to this object for method chaining
+ */
+ T setURL(URL url);
+
+ /**
+ * Sets the location of the associated {@code FileHandler} as an absolute
+ * file path.
+ *
+ * @param path the path location
+ * @return a reference to this object for method chaining
+ */
+ T setPath(String path);
+
+ /**
+ * Sets the file name of the associated {@code FileHandler}.
+ *
+ * @param name the file name
+ * @return a reference to this object for method chaining
+ */
+ T setFileName(String name);
+
+ /**
+ * Sets the base path of the associated {@code FileHandler}.
+ *
+ * @param path the base path
+ * @return a reference to this object for method chaining
+ */
+ T setBasePath(String path);
+
+ /**
+ * Sets the {@code FileSystem} of the associated {@code FileHandler}.
+ *
+ * @param fs the {@code FileSystem}
+ * @return a reference to this object for method chaining
+ */
+ T setFileSystem(FileSystem fs);
+
+ /**
+ * Sets the encoding of the associated {@code FileHandler}.
+ *
+ * @param enc the encoding
+ * @return a reference to this object for method chaining
+ */
+ T setEncoding(String enc);
+}
Propchange: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/FileBasedBuilderProperties.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/FileBasedBuilderProperties.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/FileBasedBuilderProperties.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/FileBasedConfigurationBuilder.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/FileBasedConfigurationBuilder.java?rev=1418746&r1=1418745&r2=1418746&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/FileBasedConfigurationBuilder.java (original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/FileBasedConfigurationBuilder.java Sat Dec 8 20:09:37 2012
@@ -29,7 +29,7 @@ import org.apache.commons.configuration.
* </p>
* <p>
* This class extends its base class by the support of a
- * {@link FileBasedBuilderParameters} object, and especially of the
+ * {@link FileBasedBuilderParametersImpl} object, and especially of the
* {@link FileHandler} contained in this object. When the builder creates a new
* object the resulting {@code Configuration} instance is associated with the
* {@code FileHandler}. If the {@code FileHandler} has a location set, the
@@ -174,7 +174,7 @@ public class FileBasedConfigurationBuild
*/
private FileHandler fetchFileHandlerFromParameters()
{
- return FileBasedBuilderParameters.fromParameters(getParameters(), true)
+ return FileBasedBuilderParametersImpl.fromParameters(getParameters(), true)
.getFileHandler();
}
}
Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/ReloadingFileBasedConfigurationBuilder.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/ReloadingFileBasedConfigurationBuilder.java?rev=1418746&r1=1418745&r2=1418746&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/ReloadingFileBasedConfigurationBuilder.java (original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/ReloadingFileBasedConfigurationBuilder.java Sat Dec 8 20:09:37 2012
@@ -149,7 +149,7 @@ public class ReloadingFileBasedConfigura
* @return a {@code ReloadingDetector} for this {@code FileHandler}
*/
protected ReloadingDetector createReloadingDetector(FileHandler handler,
- FileBasedBuilderParameters fbparams)
+ FileBasedBuilderParametersImpl fbparams)
{
return new FileHandlerReloadingDetector(handler,
fbparams.getReloadingRefreshDelay());
@@ -170,7 +170,7 @@ public class ReloadingFileBasedConfigura
resultReloadingDetector =
createReloadingDetector(handler,
- FileBasedBuilderParameters.fromParameters(
+ FileBasedBuilderParametersImpl.fromParameters(
getParameters(), true));
getReloadingController().resetReloadingState();
}
Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/combined/BaseConfigurationBuilderProvider.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/combined/BaseConfigurationBuilderProvider.java?rev=1418746&r1=1418745&r2=1418746&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/combined/BaseConfigurationBuilderProvider.java (original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/combined/BaseConfigurationBuilderProvider.java Sat Dec 8 20:09:37 2012
@@ -26,7 +26,6 @@ import org.apache.commons.configuration.
import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.ConfigurationUtils;
import org.apache.commons.configuration.beanutils.BeanHelper;
-import org.apache.commons.configuration.builder.BasicBuilderParameters;
import org.apache.commons.configuration.builder.BasicConfigurationBuilder;
import org.apache.commons.configuration.builder.BuilderParameters;
import org.apache.commons.configuration.builder.ConfigurationBuilder;
@@ -97,11 +96,7 @@ public class BaseConfigurationBuilderPro
* support is required (<b>null</b> if reloading is not supported)
* @param configCls the name of the configuration class (must not be
* <b>null</b>)
- * @param paramCls a collection with the names of parameters classes; an
- * instance of {@link BasicBuilderParameters} is created
- * automatically and does not need to be contained in this list; the
- * collection can be <b>null</b> if no additional parameter objects
- * are needed
+ * @param paramCls a collection with the names of parameters classes
* @throws IllegalArgumentException if a required parameter is missing
*/
public BaseConfigurationBuilderProvider(String bldrCls,
@@ -213,8 +208,7 @@ public class BaseConfigurationBuilderPro
/**
* Creates a collection of parameter objects to be used for configuring the
* builder. This method creates instances of the parameter classes passed to
- * the constructor. An instance of {@link BasicBuilderParameters} is added
- * automatically.
+ * the constructor.
*
* @return a collection with parameter objects for the builder
* @throws Exception if an error occurs while creating parameter objects via
@@ -225,8 +219,7 @@ public class BaseConfigurationBuilderPro
{
Collection<BuilderParameters> params =
new ArrayList<BuilderParameters>(
- getParameterClasses().size() + 1);
- params.add(new BasicBuilderParameters());
+ getParameterClasses().size());
for (String paramcls : getParameterClasses())
{
params.add(createParameterObject(paramcls));
Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/combined/CombinedConfigurationBuilder.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/combined/CombinedConfigurationBuilder.java?rev=1418746&r1=1418745&r2=1418746&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/combined/CombinedConfigurationBuilder.java (original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/combined/CombinedConfigurationBuilder.java Sat Dec 8 20:09:37 2012
@@ -39,7 +39,7 @@ import org.apache.commons.configuration.
import org.apache.commons.configuration.builder.BasicConfigurationBuilder;
import org.apache.commons.configuration.builder.BuilderListener;
import org.apache.commons.configuration.builder.ConfigurationBuilder;
-import org.apache.commons.configuration.builder.FileBasedBuilderParameters;
+import org.apache.commons.configuration.builder.FileBasedBuilderParametersImpl;
import org.apache.commons.configuration.builder.FileBasedConfigurationBuilder;
import org.apache.commons.configuration.tree.DefaultExpressionEngine;
import org.apache.commons.configuration.tree.OverrideCombiner;
@@ -378,7 +378,7 @@ public class CombinedConfigurationBuilde
/** Constant for the name of the file-based builder parameters class. */
private static final String FILE_PARAMS =
- "org.apache.commons.configuration.builder.FileBasedBuilderParameters";
+ "org.apache.commons.configuration.builder.FileBasedBuilderParametersImpl";
/** Constant for the provider for properties files. */
private static final ConfigurationBuilderProvider PROPERTIES_PROVIDER =
@@ -583,19 +583,24 @@ public class CombinedConfigurationBuilde
}
/**
- * Returns the configuration builder with the given name. With this method
- * a builder of a child configuration which was given a name in the
+ * Returns the configuration builder with the given name. With this method a
+ * builder of a child configuration which was given a name in the
* configuration definition file can be accessed directly.
+ *
* @param name the name of the builder in question
* @return the child configuration builder with this name
- * @throws ConfigurationException if an error occurs setting up the definition configuration or no builder with this name exists
+ * @throws ConfigurationException if an error occurs setting up the
+ * definition configuration or no builder with this name exists
*/
- public synchronized ConfigurationBuilder<? extends Configuration> getNamedBuilder(String name) throws ConfigurationException
+ public synchronized ConfigurationBuilder<? extends Configuration> getNamedBuilder(
+ String name) throws ConfigurationException
{
- ConfigurationBuilder<? extends Configuration> builder = getSourceData().getNamedBuilder(name);
- if(builder == null)
+ ConfigurationBuilder<? extends Configuration> builder =
+ getSourceData().getNamedBuilder(name);
+ if (builder == null)
{
- throw new ConfigurationException("Builder cannot be resolved: " + name);
+ throw new ConfigurationException("Builder cannot be resolved: "
+ + name);
}
return builder;
}
@@ -603,14 +608,17 @@ public class CombinedConfigurationBuilde
/**
* Returns a set with the names of all child configuration builders. A tag
* defining a configuration source in the configuration definition file can
- * have the {@code config-name} attribute. If this attribute is present,
- * the corresponding builder is assigned this name and can be directly
- * accessed through the {@link #getNamedBuilder(String)} method. This
- * method returns a collection with all available builder names.
+ * have the {@code config-name} attribute. If this attribute is present, the
+ * corresponding builder is assigned this name and can be directly accessed
+ * through the {@link #getNamedBuilder(String)} method. This method returns
+ * a collection with all available builder names.
+ *
* @return a collection with the names of all builders
- * @throws ConfigurationException if an error occurs setting up the definition configuration
+ * @throws ConfigurationException if an error occurs setting up the
+ * definition configuration
*/
- public synchronized Set<String> builderNames() throws ConfigurationException
+ public synchronized Set<String> builderNames()
+ throws ConfigurationException
{
return Collections.unmodifiableSet(getSourceData().builderNames());
}
@@ -625,6 +633,7 @@ public class CombinedConfigurationBuilde
super.resetParameters();
definitionBuilder = null;
definitionConfiguration = null;
+ currentParameters = null;
if (sourceData != null)
{
@@ -660,8 +669,8 @@ public class CombinedConfigurationBuilde
}
}
- FileBasedBuilderParameters fileParams =
- FileBasedBuilderParameters.fromParameters(params);
+ FileBasedBuilderParametersImpl fileParams =
+ FileBasedBuilderParametersImpl.fromParameters(params);
if (fileParams != null)
{
return new FileBasedConfigurationBuilder<XMLConfiguration>(
@@ -729,9 +738,10 @@ public class CombinedConfigurationBuilde
result.setNodeCombiner(new OverrideCombiner());
}
- ConfigurationSourceData data = getSourceData();
+ setUpCurrentParameters();
initNodeCombinerListNodes(result, config, KEY_OVERRIDE_LIST);
registerConfiguredProviders(config);
+ ConfigurationSourceData data = getSourceData();
createAndAddConfigurations(result, data.getOverrideBuilders(), data);
if (!data.getUnionBuilders().isEmpty())
@@ -895,6 +905,10 @@ public class CombinedConfigurationBuilde
{
if (sourceData == null)
{
+ if (currentParameters == null)
+ {
+ setUpCurrentParameters();
+ }
sourceData = createSourceData();
}
return sourceData;
@@ -910,7 +924,6 @@ public class CombinedConfigurationBuilde
private ConfigurationSourceData createSourceData()
throws ConfigurationException
{
- setUpCurrentParameters();
ConfigurationSourceData result = new ConfigurationSourceData();
result.initFromDefinitionConfiguration(getDefinitionConfiguration());
return result;
@@ -932,8 +945,7 @@ public class CombinedConfigurationBuilde
XMLBeanDeclaration decl = new XMLBeanDeclaration(config);
String key = config.getString(KEY_PROVIDER_KEY);
currentParameters.registerProvider(key,
- (BaseConfigurationBuilderProvider) BeanHelper
- .createBean(decl));
+ (ConfigurationBuilderProvider) BeanHelper.createBean(decl));
}
}
Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/combined/FileExtensionConfigurationBuilderProvider.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/combined/FileExtensionConfigurationBuilderProvider.java?rev=1418746&r1=1418745&r2=1418746&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/combined/FileExtensionConfigurationBuilderProvider.java (original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/combined/FileExtensionConfigurationBuilderProvider.java Sat Dec 8 20:09:37 2012
@@ -19,9 +19,8 @@ package org.apache.commons.configuration
import java.util.Collection;
import org.apache.commons.configuration.ConfigurationException;
-import org.apache.commons.configuration.builder.BasicBuilderParameters;
import org.apache.commons.configuration.builder.BuilderParameters;
-import org.apache.commons.configuration.builder.FileBasedBuilderParameters;
+import org.apache.commons.configuration.builder.FileBasedBuilderParametersImpl;
/**
* <p>
@@ -75,7 +74,7 @@ public class FileExtensionConfigurationB
* @param ext the file extension to select the configuration class (must not
* be <b>null</b>)
* @param paramCls a collection with the names of parameters classes; an
- * instance of {@link BasicBuilderParameters} is created
+ * instance of {@link BasicBuilderParametersImpl} is created
* automatically and does not need to be contained in this list; the
* collection can be <b>null</b> if no additional parameter objects
* are needed
@@ -124,7 +123,7 @@ public class FileExtensionConfigurationB
/**
* {@inheritDoc} This implementation tries to find a
- * {@link FileBasedBuilderParameters} object in the parameter objects. If
+ * {@link FileBasedBuilderParametersImpl} object in the parameter objects. If
* one is found, the extension of the file name is obtained and compared
* against the stored file extension. In case of a match, the matching
* configuration class is selected, otherwise the default one.
@@ -150,9 +149,9 @@ public class FileExtensionConfigurationB
{
for (BuilderParameters p : params)
{
- if (p instanceof FileBasedBuilderParameters)
+ if (p instanceof FileBasedBuilderParametersImpl)
{
- FileBasedBuilderParameters fp = (FileBasedBuilderParameters) p;
+ FileBasedBuilderParametersImpl fp = (FileBasedBuilderParametersImpl) p;
return fp.getFileHandler().getFileName();
}
}
Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestImmutableConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestImmutableConfiguration.java?rev=1418746&r1=1418745&r2=1418746&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestImmutableConfiguration.java (original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestImmutableConfiguration.java Sat Dec 8 20:09:37 2012
@@ -24,7 +24,7 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
-import org.apache.commons.configuration.builder.FileBasedBuilderParameters;
+import org.apache.commons.configuration.builder.FileBasedBuilderParametersImpl;
import org.apache.commons.configuration.builder.FileBasedConfigurationBuilder;
import org.junit.Test;
@@ -58,7 +58,7 @@ public class TestImmutableConfiguration
{
return new FileBasedConfigurationBuilder<PropertiesConfiguration>(
PropertiesConfiguration.class).configure(
- new FileBasedBuilderParameters().setFile(ConfigurationAssert
+ new FileBasedBuilderParametersImpl().setFile(ConfigurationAssert
.getTestFile(TEST_FILE))).getConfiguration();
}
Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/TestFileBasedBuilderParameters.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/TestFileBasedBuilderParameters.java?rev=1418746&r1=1418745&r2=1418746&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/TestFileBasedBuilderParameters.java (original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/TestFileBasedBuilderParameters.java Sat Dec 8 20:09:37 2012
@@ -27,6 +27,7 @@ import java.net.URL;
import java.util.HashMap;
import java.util.Map;
+import org.apache.commons.beanutils.PropertyUtils;
import org.apache.commons.configuration.ConfigurationAssert;
import org.apache.commons.configuration.FileSystem;
import org.apache.commons.configuration.io.FileHandler;
@@ -34,7 +35,7 @@ import org.easymock.EasyMock;
import org.junit.Test;
/**
- * Test class for {@code FileBasedBuilderParameters}.
+ * Test class for {@code FileBasedBuilderParametersImpl}.
*
* @version $Id$
*/
@@ -46,7 +47,7 @@ public class TestFileBasedBuilderParamet
@Test
public void testInitDefaults()
{
- FileBasedBuilderParameters params = new FileBasedBuilderParameters();
+ FileBasedBuilderParametersImpl params = new FileBasedBuilderParametersImpl();
assertFalse("Got a location", params.getFileHandler()
.isLocationDefined());
assertEquals("Got a refresh delay", 0,
@@ -60,8 +61,8 @@ public class TestFileBasedBuilderParamet
public void testInitFileHandler()
{
FileHandler handler = new FileHandler();
- FileBasedBuilderParameters params =
- new FileBasedBuilderParameters(handler);
+ FileBasedBuilderParametersImpl params =
+ new FileBasedBuilderParametersImpl(handler);
assertSame("Wrong handler", handler, params.getFileHandler());
}
@@ -71,7 +72,7 @@ public class TestFileBasedBuilderParamet
@Test
public void testSetReloadingRefreshDelay()
{
- FileBasedBuilderParameters params = new FileBasedBuilderParameters();
+ FileBasedBuilderParametersImpl params = new FileBasedBuilderParametersImpl();
final int delay = 10000;
assertSame("Wrong result", params,
params.setReloadingRefreshDelay(delay));
@@ -87,7 +88,7 @@ public class TestFileBasedBuilderParamet
File file =
ConfigurationAssert.getTestFile("test.properties")
.getAbsoluteFile();
- FileBasedBuilderParameters params = new FileBasedBuilderParameters();
+ FileBasedBuilderParametersImpl params = new FileBasedBuilderParametersImpl();
assertSame("Wrong result", params, params.setFile(file));
assertEquals("Wrong file", file, params.getFileHandler().getFile());
}
@@ -99,7 +100,7 @@ public class TestFileBasedBuilderParamet
public void testSetURL()
{
URL url = ConfigurationAssert.getTestURL("test.properties");
- FileBasedBuilderParameters params = new FileBasedBuilderParameters();
+ FileBasedBuilderParametersImpl params = new FileBasedBuilderParametersImpl();
assertSame("Wrong result", params, params.setURL(url));
assertEquals("Wrong URL", url.toExternalForm(), params.getFileHandler()
.getURL().toExternalForm());
@@ -114,7 +115,7 @@ public class TestFileBasedBuilderParamet
String path =
ConfigurationAssert.getTestFile("test.properties")
.getAbsolutePath();
- FileBasedBuilderParameters params = new FileBasedBuilderParameters();
+ FileBasedBuilderParametersImpl params = new FileBasedBuilderParametersImpl();
assertSame("Wrong result", params, params.setPath(path));
assertEquals("Wrong path", path, params.getFileHandler().getPath());
}
@@ -126,7 +127,7 @@ public class TestFileBasedBuilderParamet
public void testSetFileName()
{
String name = "testConfig.xml";
- FileBasedBuilderParameters params = new FileBasedBuilderParameters();
+ FileBasedBuilderParametersImpl params = new FileBasedBuilderParametersImpl();
assertSame("Wrong result", params, params.setFileName(name));
assertEquals("Wrong name", name, params.getFileHandler().getFileName());
}
@@ -140,7 +141,7 @@ public class TestFileBasedBuilderParamet
String path =
ConfigurationAssert.getTestFile("test.properties").getParentFile()
.getAbsolutePath();
- FileBasedBuilderParameters params = new FileBasedBuilderParameters();
+ FileBasedBuilderParametersImpl params = new FileBasedBuilderParametersImpl();
assertSame("Wrong result", params, params.setBasePath(path));
assertEquals("Wrong path", path, params.getFileHandler().getBasePath());
}
@@ -153,7 +154,7 @@ public class TestFileBasedBuilderParamet
{
FileSystem fs = EasyMock.createMock(FileSystem.class);
EasyMock.replay(fs);
- FileBasedBuilderParameters params = new FileBasedBuilderParameters();
+ FileBasedBuilderParametersImpl params = new FileBasedBuilderParametersImpl();
assertSame("Wrong result", params, params.setFileSystem(fs));
assertSame("Wrong file system", fs, params.getFileHandler()
.getFileSystem());
@@ -166,7 +167,7 @@ public class TestFileBasedBuilderParamet
public void testSetEncoding()
{
String enc = "ISO-8859-1";
- FileBasedBuilderParameters params = new FileBasedBuilderParameters();
+ FileBasedBuilderParametersImpl params = new FileBasedBuilderParametersImpl();
assertSame("Wrong result", params, params.setEncoding(enc));
assertSame("Wrong encoding", enc, params.getFileHandler().getEncoding());
}
@@ -177,11 +178,16 @@ public class TestFileBasedBuilderParamet
@Test
public void testGetParameters()
{
- FileBasedBuilderParameters params =
- new FileBasedBuilderParameters().setReloadingRefreshDelay(1000);
+ FileBasedBuilderParametersImpl params =
+ new FileBasedBuilderParametersImpl()
+ .setReloadingRefreshDelay(1000);
+ params.setListDelimiter('*');
Map<String, Object> map = params.getParameters();
- assertEquals("Wrong number of items", 1, map.size());
assertTrue("Object not stored", map.values().contains(params));
+ assertEquals("Wrong delimiter parsing flag", Boolean.TRUE,
+ map.get("delimiterParsingDisabled"));
+ assertEquals("Wrong delimiter", Character.valueOf('*'), params
+ .getParameters().get("listDelimiter"));
}
/**
@@ -191,7 +197,7 @@ public class TestFileBasedBuilderParamet
public void testFromParametersNotFound()
{
assertNull("Got an instance",
- FileBasedBuilderParameters
+ FileBasedBuilderParametersImpl
.fromParameters(new HashMap<String, Object>()));
}
@@ -202,8 +208,8 @@ public class TestFileBasedBuilderParamet
@Test
public void testFromParametersDefaultInstance()
{
- FileBasedBuilderParameters params =
- FileBasedBuilderParameters.fromParameters(
+ FileBasedBuilderParametersImpl params =
+ FileBasedBuilderParametersImpl.fromParameters(
new HashMap<String, Object>(), true);
assertFalse("Got a location", params.getFileHandler()
.isLocationDefined());
@@ -215,9 +221,28 @@ public class TestFileBasedBuilderParamet
@Test
public void testFromParametersExtract()
{
- FileBasedBuilderParameters params = new FileBasedBuilderParameters();
+ FileBasedBuilderParametersImpl params = new FileBasedBuilderParametersImpl();
Map<String, Object> map = params.getParameters();
assertSame("Wrong parameters", params,
- FileBasedBuilderParameters.fromParameters(map));
+ FileBasedBuilderParametersImpl.fromParameters(map));
+ }
+
+ /**
+ * Tests whether reflection-based property access through BeanUtils is
+ * possible.
+ */
+ @Test
+ public void testBeanPropertiesAccess() throws Exception
+ {
+ FileBasedBuilderParametersImpl params =
+ new FileBasedBuilderParametersImpl();
+ PropertyUtils.setProperty(params, "throwExceptionOnMissing",
+ Boolean.TRUE);
+ PropertyUtils.setProperty(params, "fileName", "test.xml");
+ assertEquals("File name not set", "test.xml", params.getFileHandler()
+ .getFileName());
+ Map<String, Object> map = params.getParameters();
+ assertEquals("Property not stored", Boolean.TRUE,
+ map.get("throwExceptionOnMissing"));
}
}
Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/TestFileBasedConfigurationBuilder.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/TestFileBasedConfigurationBuilder.java?rev=1418746&r1=1418745&r2=1418746&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/TestFileBasedConfigurationBuilder.java (original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/TestFileBasedConfigurationBuilder.java Sat Dec 8 20:09:37 2012
@@ -116,7 +116,7 @@ public class TestFileBasedConfigurationB
FileBasedConfigurationBuilder<PropertiesConfiguration> builder =
new FileBasedConfigurationBuilder<PropertiesConfiguration>(
PropertiesConfiguration.class);
- builder.configure(new FileBasedBuilderParameters().setFile(file));
+ builder.configure(new FileBasedBuilderParametersImpl().setFile(file));
PropertiesConfiguration config = builder.getConfiguration();
assertEquals("Not read from file", 1, config.getInt(PROP));
assertSame("FileHandler not initialized", config, builder
@@ -134,7 +134,7 @@ public class TestFileBasedConfigurationB
FileBasedConfigurationBuilder<PropertiesConfiguration> builder =
new FileBasedConfigurationBuilder<PropertiesConfiguration>(
PropertiesConfiguration.class);
- builder.configure(new FileBasedBuilderParameters().setFile(file));
+ builder.configure(new FileBasedBuilderParametersImpl().setFile(file));
PropertiesConfiguration config = builder.getConfiguration();
builder.resetResult();
PropertiesConfiguration config2 = builder.getConfiguration();
@@ -154,7 +154,7 @@ public class TestFileBasedConfigurationB
FileBasedConfigurationBuilder<PropertiesConfiguration> builder =
new FileBasedConfigurationBuilder<PropertiesConfiguration>(
PropertiesConfiguration.class);
- builder.configure(new FileBasedBuilderParameters().setFile(file1));
+ builder.configure(new FileBasedBuilderParametersImpl().setFile(file1));
builder.getConfiguration();
builder.getFileHandler().setFile(file2);
builder.resetResult();
@@ -173,7 +173,7 @@ public class TestFileBasedConfigurationB
FileBasedConfigurationBuilder<PropertiesConfiguration> builder =
new FileBasedConfigurationBuilder<PropertiesConfiguration>(
PropertiesConfiguration.class);
- builder.configure(new FileBasedBuilderParameters().setFile(file));
+ builder.configure(new FileBasedBuilderParametersImpl().setFile(file));
builder.getConfiguration();
builder.reset();
PropertiesConfiguration config = builder.getConfiguration();
@@ -194,11 +194,11 @@ public class TestFileBasedConfigurationB
FileBasedConfigurationBuilder<PropertiesConfiguration> builder =
new FileBasedConfigurationBuilder<PropertiesConfiguration>(
PropertiesConfiguration.class);
- builder.configure(new FileBasedBuilderParameters().setFile(file1));
+ builder.configure(new FileBasedBuilderParametersImpl().setFile(file1));
builder.getConfiguration();
builder.getFileHandler().setFile(file2);
builder.reset();
- builder.configure(new FileBasedBuilderParameters().setFile(file1));
+ builder.configure(new FileBasedBuilderParametersImpl().setFile(file1));
PropertiesConfiguration config = builder.getConfiguration();
assertEquals("Not read from file 1", 1, config.getInt(PROP));
builder.getFileHandler().setFile(file2);
Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/TestReloadingFileBasedConfigurationBuilder.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/TestReloadingFileBasedConfigurationBuilder.java?rev=1418746&r1=1418745&r2=1418746&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/TestReloadingFileBasedConfigurationBuilder.java (original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/TestReloadingFileBasedConfigurationBuilder.java Sat Dec 8 20:09:37 2012
@@ -67,7 +67,7 @@ public class TestReloadingFileBasedConfi
new ReloadingFileBasedConfigurationBuilder<PropertiesConfiguration>(
PropertiesConfiguration.class);
FileHandler handler = new FileHandler();
- FileBasedBuilderParameters params = new FileBasedBuilderParameters();
+ FileBasedBuilderParametersImpl params = new FileBasedBuilderParametersImpl();
long refreshDelay = 60000L;
params.setReloadingRefreshDelay(refreshDelay);
FileHandlerReloadingDetector detector =
@@ -241,7 +241,7 @@ public class TestReloadingFileBasedConfi
*/
@Override
protected ReloadingDetector createReloadingDetector(
- FileHandler handler, FileBasedBuilderParameters fbparams)
+ FileHandler handler, FileBasedBuilderParametersImpl fbparams)
{
handlerForDetector = handler;
return mockDetector;
Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/combined/TestBaseConfigurationBuilderProvider.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/combined/TestBaseConfigurationBuilderProvider.java?rev=1418746&r1=1418745&r2=1418746&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/combined/TestBaseConfigurationBuilderProvider.java (original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/combined/TestBaseConfigurationBuilderProvider.java Sat Dec 8 20:09:37 2012
@@ -30,7 +30,7 @@ import org.apache.commons.configuration.
import org.apache.commons.configuration.builder.BasicBuilderParameters;
import org.apache.commons.configuration.builder.BasicConfigurationBuilder;
import org.apache.commons.configuration.builder.ConfigurationBuilder;
-import org.apache.commons.configuration.builder.FileBasedBuilderParameters;
+import org.apache.commons.configuration.builder.FileBasedBuilderParametersImpl;
import org.apache.commons.configuration.builder.FileBasedConfigurationBuilder;
import org.apache.commons.configuration.builder.ReloadingFileBasedConfigurationBuilder;
import org.junit.Test;
@@ -93,7 +93,7 @@ public class TestBaseConfigurationBuilde
FileBasedConfigurationBuilder.class.getName(),
ReloadingFileBasedConfigurationBuilder.class.getName(),
PropertiesConfiguration.class.getName(),
- Arrays.asList(FileBasedBuilderParameters.class.getName()));
+ Arrays.asList(FileBasedBuilderParametersImpl.class.getName()));
}
/**
@@ -180,7 +180,7 @@ public class TestBaseConfigurationBuilde
new BaseConfigurationBuilderProvider(
FileBasedConfigurationBuilder.class.getName(), null,
PropertiesConfiguration.class.getName(),
- Arrays.asList(FileBasedBuilderParameters.class
+ Arrays.asList(FileBasedBuilderParametersImpl.class
.getName()));
HierarchicalConfiguration declConfig = setUpConfig(true);
ConfigurationDeclaration decl = createDeclaration(declConfig);
Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/combined/TestFileExtensionConfigurationBuilderProvider.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/combined/TestFileExtensionConfigurationBuilderProvider.java?rev=1418746&r1=1418745&r2=1418746&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/combined/TestFileExtensionConfigurationBuilderProvider.java (original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/combined/TestFileExtensionConfigurationBuilderProvider.java Sat Dec 8 20:09:37 2012
@@ -27,7 +27,7 @@ import org.apache.commons.configuration.
import org.apache.commons.configuration.XMLPropertiesConfiguration;
import org.apache.commons.configuration.builder.BasicConfigurationBuilder;
import org.apache.commons.configuration.builder.BuilderParameters;
-import org.apache.commons.configuration.builder.FileBasedBuilderParameters;
+import org.apache.commons.configuration.builder.FileBasedBuilderParametersImpl;
import org.apache.commons.configuration.builder.ReloadingFileBasedConfigurationBuilder;
import org.easymock.EasyMock;
import org.junit.Test;
@@ -156,7 +156,7 @@ public class TestFileExtensionConfigurat
{
ConfigurationDeclaration decl = setUpDecl();
BuilderParameters params =
- new FileBasedBuilderParameters()
+ new FileBasedBuilderParametersImpl()
.setPath("C:\\Test\\someTestConfiguration");
FileExtensionConfigurationBuilderProvider provider = setUpProvider();
assertEquals(
@@ -176,7 +176,7 @@ public class TestFileExtensionConfigurat
{
ConfigurationDeclaration decl = setUpDecl();
BuilderParameters params =
- new FileBasedBuilderParameters()
+ new FileBasedBuilderParametersImpl()
.setPath("C:\\Test\\someTestConfiguration.properties");
FileExtensionConfigurationBuilderProvider provider = setUpProvider();
assertEquals(
@@ -195,7 +195,7 @@ public class TestFileExtensionConfigurat
throws ConfigurationException
{
ConfigurationDeclaration decl = setUpDecl();
- BuilderParameters params = new FileBasedBuilderParameters();
+ BuilderParameters params = new FileBasedBuilderParametersImpl();
FileExtensionConfigurationBuilderProvider provider = setUpProvider();
assertEquals(
"Wrong class",
@@ -214,7 +214,7 @@ public class TestFileExtensionConfigurat
{
ConfigurationDeclaration decl = setUpDecl();
BuilderParameters params =
- new FileBasedBuilderParameters()
+ new FileBasedBuilderParametersImpl()
.setPath("C:\\Test\\someTestConfiguration." + EXT);
FileExtensionConfigurationBuilderProvider provider = setUpProvider();
assertEquals(
@@ -233,7 +233,7 @@ public class TestFileExtensionConfigurat
{
ConfigurationDeclaration decl = setUpDecl();
BuilderParameters params =
- new FileBasedBuilderParameters()
+ new FileBasedBuilderParametersImpl()
.setPath("C:\\Test\\someTestConfiguration."
+ EXT.toUpperCase(Locale.ENGLISH));
FileExtensionConfigurationBuilderProvider provider = setUpProvider();