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 2013/03/26 16:10:42 UTC
svn commit: r1461170 - in /commons/proper/configuration/trunk/src:
main/java/org/apache/commons/configuration/builder/
test/java/org/apache/commons/configuration/builder/
Author: oheger
Date: Tue Mar 26 15:10:42 2013
New Revision: 1461170
URL: http://svn.apache.org/r1461170
Log:
Added a property for a ReloadingDetectorFactory to FileBasedBuilderParametersImpl.
Modified:
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/FileBasedBuilderParametersImpl.java
commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/FileBasedBuilderProperties.java
commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/TestFileBasedBuilderParameters.java
Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/FileBasedBuilderParametersImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/FileBasedBuilderParametersImpl.java?rev=1461170&r1=1461169&r2=1461170&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/FileBasedBuilderParametersImpl.java (original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/FileBasedBuilderParametersImpl.java Tue Mar 26 15:10:42 2013
@@ -57,6 +57,9 @@ public class FileBasedBuilderParametersI
*/
private FileHandler fileHandler;
+ /** The factory for reloading detectors. */
+ private ReloadingDetectorFactory reloadingDetectorFactory;
+
/** The refresh delay for reloading support. */
private long reloadingRefreshDelay;
@@ -148,6 +151,24 @@ public class FileBasedBuilderParametersI
return this;
}
+ /**
+ * Returns the {@code ReloadingDetectorFactory}. Result may be <b>null</b>
+ * which means that the default factory is to be used.
+ *
+ * @return the {@code ReloadingDetectorFactory}
+ */
+ public ReloadingDetectorFactory getReloadingDetectorFactory()
+ {
+ return reloadingDetectorFactory;
+ }
+
+ public FileBasedBuilderParametersImpl setReloadingDetectorFactory(
+ ReloadingDetectorFactory reloadingDetectorFactory)
+ {
+ this.reloadingDetectorFactory = reloadingDetectorFactory;
+ return this;
+ }
+
public FileBasedBuilderParametersImpl setFile(File file)
{
getFileHandler().setFile(file);
Modified: 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=1461170&r1=1461169&r2=1461170&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/FileBasedBuilderProperties.java (original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/FileBasedBuilderProperties.java Tue Mar 26 15:10:42 2013
@@ -44,6 +44,17 @@ public interface FileBasedBuilderPropert
T setReloadingRefreshDelay(long reloadingRefreshDelay);
/**
+ * Sets the factory for creating {@code ReloadingDetector} objects. With
+ * this method a custom factory for reloading detectors can be installed.
+ * Per default, a factory creating {@code FileHandlerReloadingDetector}
+ * objects is used.
+ *
+ * @param factory the {@code ReloadingDetectorFactory}
+ * @return a reference to this object for method chaining
+ */
+ T setReloadingDetectorFactory(ReloadingDetectorFactory factory);
+
+ /**
* Sets the location of the associated {@code FileHandler} as a {@code File}
* object.
*
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=1461170&r1=1461169&r2=1461170&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 Tue Mar 26 15:10:42 2013
@@ -82,6 +82,24 @@ public class TestFileBasedBuilderParamet
}
/**
+ * Tests whether a factory for reloading detectors can be set.
+ */
+ @Test
+ public void testSetReloadingDetectorFactory()
+ {
+ ReloadingDetectorFactory factory =
+ EasyMock.createMock(ReloadingDetectorFactory.class);
+ EasyMock.replay(factory);
+ FileBasedBuilderParametersImpl params =
+ new FileBasedBuilderParametersImpl();
+ assertNull("Got a factory", params.getReloadingDetectorFactory());
+ assertSame("Wrong result", params,
+ params.setReloadingDetectorFactory(factory));
+ assertSame("Factory not set", factory,
+ params.getReloadingDetectorFactory());
+ }
+
+ /**
* Tests whether a file can be set.
*/
@Test