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 2014/04/13 17:59:14 UTC

svn commit: r1587012 - in /commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/tree: InMemoryNodeModel.java NodeModel.java TrackedNodeModel.java

Author: oheger
Date: Sun Apr 13 15:59:14 2014
New Revision: 1587012

URL: http://svn.apache.org/r1587012
Log:
Extended NodeModel interface for querying an in-memory representation.

A method was added for converting the data of the model into a structure of
ImmutableNode objects. This is necessary when multiple configuration sources
with different model implementations are to be combined.

Modified:
    commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/tree/InMemoryNodeModel.java
    commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/tree/NodeModel.java
    commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/tree/TrackedNodeModel.java

Modified: commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/tree/InMemoryNodeModel.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/tree/InMemoryNodeModel.java?rev=1587012&r1=1587011&r2=1587012&view=diff
==============================================================================
--- commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/tree/InMemoryNodeModel.java (original)
+++ commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/tree/InMemoryNodeModel.java Sun Apr 13 15:59:14 2014
@@ -364,6 +364,13 @@ public class InMemoryNodeModel implement
         setRootNode(newRoot);
     }
 
+    @Override
+    public ImmutableNode getInMemoryRepresentation()
+    {
+        // TODO implementation
+        throw new UnsupportedOperationException("Not yet implemented!");
+    }
+
     /**
      * {@inheritDoc} All tracked nodes and reference objects managed by this
      * model are cleared.Care has to be taken when this method is used and the

Modified: commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/tree/NodeModel.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/tree/NodeModel.java?rev=1587012&r1=1587011&r2=1587012&view=diff
==============================================================================
--- commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/tree/NodeModel.java (original)
+++ commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/tree/NodeModel.java Sun Apr 13 15:59:14 2014
@@ -132,4 +132,20 @@ public interface NodeModel<T>
      * @param resolver the {@code NodeKeyResolver}
      */
     void clear(NodeKeyResolver<T> resolver);
+
+    /**
+     * Returns a representation of the data stored in this model in form of a
+     * nodes hierarchy of {@code ImmutableNode} objects. A concrete model
+     * implementation can use an arbitrary means to store its data. When a
+     * model's data is to be used together with other functionality of the
+     * <em>Configuration</em> library (e.g. when combining multiple
+     * configuration sources) it has to be transformed into a common format.
+     * This is done by this method. {@code ImmutableNode} is a generic
+     * representation of a hierarchical structure. Thus, it should be possible
+     * to generate a corresponding structure from arbitrary model data.
+     *
+     * @return the root node of an in-memory hierarchy representing the data
+     *         stored in this model
+     */
+    ImmutableNode getInMemoryRepresentation();
 }

Modified: commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/tree/TrackedNodeModel.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/tree/TrackedNodeModel.java?rev=1587012&r1=1587011&r2=1587012&view=diff
==============================================================================
--- commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/tree/TrackedNodeModel.java (original)
+++ commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/tree/TrackedNodeModel.java Sun Apr 13 15:59:14 2014
@@ -196,6 +196,13 @@ public class TrackedNodeModel implements
         getParentModel().clearTree(null, getSelector(), resolver);
     }
 
+    @Override
+    public ImmutableNode getInMemoryRepresentation()
+    {
+        // TODO implementation
+        throw new UnsupportedOperationException("Not yet implemented!");
+    }
+
     /**
      * Closes this model. This causes the tracked node this model is based upon
      * to be released (i.e. {@link InMemoryNodeModel#untrackNode(NodeSelector)}