commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject svn commit: r1612691 - in /commons/proper/configuration/trunk/src/site/xdoc/userguide: howto_events.xml user_guide.xml
Date Tue, 22 Jul 2014 20:12:32 GMT
Author: oheger
Date: Tue Jul 22 20:12:32 2014
New Revision: 1612691

Added a section about reloading events.

Fixed some typos, some minor improvements.


Modified: commons/proper/configuration/trunk/src/site/xdoc/userguide/howto_events.xml
--- commons/proper/configuration/trunk/src/site/xdoc/userguide/howto_events.xml (original)
+++ commons/proper/configuration/trunk/src/site/xdoc/userguide/howto_events.xml Tue Jul 22
20:12:32 2014
@@ -110,7 +110,7 @@
       <code><a href="../apidocs/org/apache/commons/configuration/event/Event.html">
       Event</a></code> class. This base class is pretty simple. It has a
       property for the source - inherited from the <code>java.util.EventObject</code>
-      super class and an event type. The event type can be used for instance
+      super class - and an event type. The event type can be used for instance
       in an event listener that has been registered for multiple events to
       find out what actually happened.
@@ -260,6 +260,7 @@ import org.apache.commons.configuration.
 public class ConfigurationLogListener implements EventListener<ConfigurationEvent>
+    @Override
     public void onEvent(ConfigurationEvent event)
         if (!event.isBeforeUpdate())
@@ -465,7 +466,7 @@ config.clearProperty("removedProperty");
       As an example of how to use event listeners for builders we are going to
-      make use of the <em>RESULT_CREATED</em> event time: every time a managed
+      make use of the <em>RESULT_CREATED</em> event type: every time a managed
       configuration is created, a special property is set with the creation
       date. This information can then be evaluated by client code. To achieve
       this, a special event listener class is created:
@@ -474,6 +475,7 @@ config.clearProperty("removedProperty");
 public class NewConfigurationInitListener
     implements EventListener<ConfigurationBuilderResultCreatedEvent>
+    @Override
     public void onEvent(ConfigurationBuilderResultCreatedEvent event)
         event.getConfiguration().addProperty("creationDate", new Date());
@@ -516,12 +518,12 @@ builder.addEventListener(ConfigurationEv
     new ConfigurationLogListener());
-      As can be seen, the same pattern is always used for all kind of event
+      As can be seen, the same pattern is always used for all kinds of event
       listeners. Configuration builders offer a fluent API for setting up
       builder objects and setting required initialization parameters. This
       also includes the registration of event listeners. For this purpose the
       <code><a href="../apidocs/org/apache/commons/configuration/builder/EventListenerParameters.html">
-      EventListenerParameters</a></code> has been created. It allows setting
+      EventListenerParameters</a></code> class has been created. It allows setting
       arbitrary number of event listeners using method chaining. An instance
       configured with the event listeners to be registered can then be passed
       to the configuration builder's <code>configure()</code> method like
@@ -544,13 +546,39 @@ FileBasedConfigurationBuilder<Configurat
 Configuration config = builder.getConfiguration();
-      Here the feature is used that the <code>configure()</code> takes an
+      Here the feature is used that the <code>configure()</code> method takes
       arbitrary number of initialization parameter objects.
       <code>EventListenerParameters()</code> is a special parameters
       implementation which takes care of event listener registrations, but does
       not set any other initialization properties.
+    <subsection name="Reloading Events">
+    <p>
+      Another source of events is the
+      <code><a href="../apidocs/org/apache/commons/configuration/reloading/ReloadingController.html">
+      ReloadingController</a></code> class which was introduced in the chapter
+      <a href="howto_reloading.html">Automatic Reloading of Configuration Sources</a>.
+      A reloading controller generates events of type
+      <code><a href="../apidocs/org/apache/commons/configuration/reloading/ReloadingEvent.html">
+      ReloadingEvent</a></code> whenever it detects the need for a reloading
+      operation. Currently, there is only a single event type for reloading
+      events: <em>ReloadingEvent.ANY</em> which is directly derived from the
+      base type <em>Event.ANY</em>. The usage for registering listeners for
+      this event is analogous to the other event sources covered so far. 
+    </p>
+    <p>
+      In a typical usage scenario a mechanism is set up which periodically
+      triggers a reloading controller to perform a reloading check. If one of
+      these checks detects a change in a monitored configuration source, a
+      <code>ReloadingEvent</code> is fired to all registered listeners. The
+      message of this event is basically, that updated configuration information
+      is now available. An event listener for reloading events may react
+      accordingly, e.g. obtain the updated configuration object from its
+      builder and trigger some updates.
+    </p>
+    </subsection>

Modified: commons/proper/configuration/trunk/src/site/xdoc/userguide/user_guide.xml
--- commons/proper/configuration/trunk/src/site/xdoc/userguide/user_guide.xml (original)
+++ commons/proper/configuration/trunk/src/site/xdoc/userguide/user_guide.xml Tue Jul 22 20:12:32
@@ -162,6 +162,7 @@
         <li><a href="howto_events.html#Configuration_Update_Events">Configuration
Update Events</a></li>
         <li><a href="howto_events.html#Configuration_Error_Events">Configuration
Error Events</a></li>
         <li><a href="howto_events.html#Configuration_Builders_and_Events">Configuration
Builders and Events</a></li>
+        <li><a href="howto_events.html#Reloading_Events">Reloading Events</a></li>
       <li><a href="howto_utilities.html#Utility_classes_and_Tips_and_Tricks">Utility
classes and Tips and Tricks</a></li>

View raw message