commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ohe...@apache.org
Subject svn commit: r806996 - /commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/base/FlatNodeHandler.java
Date Sun, 23 Aug 2009 18:12:17 GMT
Author: oheger
Date: Sun Aug 23 18:12:16 2009
New Revision: 806996

URL: http://svn.apache.org/viewvc?rev=806996&view=rev
Log:
Copied FlatNodeHandler from flat to base package and made it compatible with the ConfigurationSource
interface.

Added:
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/base/FlatNodeHandler.java
      - copied, changed from r800941, commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/flat/FlatNodeHandler.java

Copied: commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/base/FlatNodeHandler.java
(from r800941, commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/flat/FlatNodeHandler.java)
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/base/FlatNodeHandler.java?p2=commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/base/FlatNodeHandler.java&p1=commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/flat/FlatNodeHandler.java&r1=800941&r2=806996&rev=806996&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/flat/FlatNodeHandler.java
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/base/FlatNodeHandler.java
Sun Aug 23 18:12:16 2009
@@ -14,46 +14,42 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.configuration2.flat;
+package org.apache.commons.configuration2.base;
 
 import java.util.Collections;
 import java.util.List;
 
-import org.apache.commons.configuration2.Configuration;
 import org.apache.commons.configuration2.ConfigurationRuntimeException;
 import org.apache.commons.configuration2.expr.AbstractNodeHandler;
 import org.apache.commons.configuration2.expr.NodeHandler;
 
 /**
  * <p>
- * A <code>NodeHandler</code> implementation for dealing with the nodes of a
- * <code>{@link AbstractFlatConfiguration}</code>.
+ * A {@code NodeHandler} implementation for dealing with a hierarchy of
+ * {@link FlatNode} objects.
  * </p>
  * <p>
- * This class is used internally by a <code>AbstractFlatConfiguration</code>
- * to deal with its nodes. Note that a node structure is only constructed if the
- * configuration is treated as a hierarchical configuration, for instance if it
- * is added to a <code>CombinedConfiguration</code>.
+ * The implementation of the methods required by the {@link NodeHandler}
+ * interface is straight forward. In most cases, it is possible to simply
+ * delegate to the corresponding method of the {@link FlatNode} class.
+ * Attributes are not supported by flat nodes, so in this area there are only
+ * dummy implementations.
  * </p>
  * <p>
- * The implementation of the methods required by the
- * <code>{@link NodeHandler}</code> interface is straight forward. In most
- * cases, it is possible to simply delegate to the corresponding
- * <code>FlatNode</code> method. Attributes are not supported by flat nodes,
- * so in this area there are only dummy implementations.
- * </p>
- * <p>
- * Actions caused by this node handler may modify the associated configuration
- * and thus trigger change events. Per default the configuration will invalidate
- * its node structure if a change event is received. Because of that the node
- * handler has to keep track of the updated caused by itself to avoid
- * unnecessary invalidation of nodes. (The configuration asks the node handler
- * for each change event whether the node structure should be invalidated.) Note
- * that modifications of a configuration are not thread-safe. So no additional
- * synchronization is done in this class.
+ * Actions caused by this node handler may modify the associated
+ * {@link ConfigurationSource} and thus trigger change events. Per default a
+ * change of the {@link ConfigurationSource} causes the invalidation of the node
+ * structure. Because of that the node handler has to keep track of the updates
+ * caused by itself to avoid unnecessary invalidation of nodes. (The adapter
+ * implementation using this {@code NodeHandler} to simulate a hierarchical
+ * configuration source asks the node handler for each change event whether the
+ * node structure should be invalidated.) Note that modifications of a {@code
+ * ConfigurationSource} are not thread-safe. So no additional synchronization is
+ * done in this class.
  * </p>
  *
- * @author <a href="http://commons.apache.org/configuration/team-list.html">Commons
+ * @author <a
+ *         href="http://commons.apache.org/configuration/team-list.html">Commons
  *         Configuration team</a>
  * @version $Id$
  * @since 2.0
@@ -61,8 +57,8 @@
  */
 class FlatNodeHandler extends AbstractNodeHandler<FlatNode>
 {
-    /** Stores the associated configuration. */
-    private final Configuration configuration;
+    /** Stores the associated ConfigurationSource. */
+    private final ConfigurationSource configurationSource;
 
     /**
      * A flag whether an update of the configuration was caused by an operation
@@ -71,35 +67,37 @@
     private boolean internalUpdate;
 
     /**
-     * Creates a new instance of <code>FlatNodeHandler</code> and initializes
-     * it with the associated configuration.
+     * Creates a new instance of {@code FlatNodeHandler} and initializes it with
+     * the associated {@code ConfigurationSource}.
      *
-     * @param config the configuration
+     * @param config the {@code ConfigurationSource}
      */
-    public FlatNodeHandler(Configuration config)
+    public FlatNodeHandler(ConfigurationSource config)
     {
-        configuration = config;
+        configurationSource = config;
     }
 
     /**
-     * Returns the configuration associated with this node handler.
+     * Returns the {@code ConfigurationSource} associated with this node
+     * handler.
      *
-     * @return the associated configuration
+     * @return the associated {@code ConfigurationSource}
      */
-    public Configuration getConfiguration()
+    public ConfigurationSource getConfigurationSource()
     {
-        return configuration;
+        return configurationSource;
     }
 
     /**
-     * Returns a flag whether an update of the associated configuration was
-     * caused by this node handler. Whenever the configuration receives a change
-     * event, it asks the node hander whether it is responsible for this event.
-     * The result of this method determines whether the configuration's node
-     * structure has to be invalidated: if the event was caused by the node
-     * handler, the structure has already been updated and there is no need to
-     * invalidate it. Otherwise the configuration was directly manipulated, and
-     * the node structure is now out of sync.
+     * Returns a flag whether an update of the associated {@code
+     * ConfigurationSource} was caused by this node handler. Whenever the
+     * {@code ConfigurationSource} adapter receives a change event, it asks the
+     * node hander whether it is responsible for this event. The result of this
+     * method determines whether the adapter's node structure has to be
+     * invalidated: if the event was caused by the node handler, the structure
+     * has already been updated and there is no need to invalidate it. Otherwise
+     * the {@code ConfigurationSource} was directly manipulated, and the node
+     * structure is now out of sync.
      *
      * @return a flag whether an internal update was caused by this node handler
      */
@@ -138,7 +136,8 @@
 
     /**
      * Returns the value of an attribute of the specified node. Flat nodes do
-     * not support attributes, so this implementation always returns <b>null</b>.
+     * not support attributes, so this implementation always returns
+     * <b>null</b>.
      *
      * @param node the node
      * @param name the name of the attribute
@@ -229,7 +228,7 @@
      */
     public Object getValue(FlatNode node)
     {
-        return node.getValue(getConfiguration());
+        return node.getValue(getConfigurationSource());
     }
 
     /**
@@ -265,7 +264,7 @@
         internalUpdate = true;
         try
         {
-            node.removeChild(getConfiguration(), child);
+            node.removeChild(getConfigurationSource(), child);
         }
         finally
         {
@@ -300,7 +299,7 @@
         internalUpdate = true;
         try
         {
-            node.setValue(getConfiguration(), value);
+            node.setValue(getConfigurationSource(), value);
         }
         finally
         {



Mime
View raw message