jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1341216 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak: api/Root.java core/RootImpl.java core/TreeImpl.java
Date Mon, 21 May 2012 21:46:05 GMT
Author: mduerig
Date: Mon May 21 21:46:05 2012
New Revision: 1341216

URL: http://svn.apache.org/viewvc?rev=1341216&view=rev
Log:
OAK-106: Use NodeStateBuilder instances to record changes in TreeImpl
- clarify contract for refresh/rebase/commit

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Root.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Root.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Root.java?rev=1341216&r1=1341215&r2=1341216&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Root.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Root.java Mon
May 21 21:46:05 2012
@@ -59,19 +59,23 @@ public interface Root {
     Tree getTree(String path);
 
     /**
-     * Rebase this root to the latest revision.
+     * Rebase this root to the latest revision.  After a call to this method,
+     * all trees obtained through {@link #getTree(String)} become invalid and fresh
+     * instances must be obtained.
      */
     void rebase();
 
     /**
-     * Reverts all changes made to this root and refreshed to the latest trunk
+     * Reverts all changes made to this root and refreshed to the latest trunk.
+     * After a call to this method, all trees obtained through {@link #getTree(String)}
+     * become invalid and fresh instances must be obtained.
      */
     void refresh();
 
     /**
      * Atomically apply all changes made to the tree beneath this root to the
      * underlying store and refreshes this root. After a call to this method,
-     * all trees obtained through {@link #getTree(String)} are invalid and fresh
+     * all trees obtained through {@link #getTree(String)} become invalid and fresh
      * instances must be obtained.
      *
      * @throws CommitFailedException TODO: add description and clarify how JCR exception
can be generated from this generic exception

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java?rev=1341216&r1=1341215&r2=1341216&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java
Mon May 21 21:46:05 2012
@@ -55,7 +55,7 @@ public class RootImpl implements Root {
     private final String workspaceName;
 
     /** Actual root element of the {@code Tree} */
-    private final TreeImpl root;
+    private TreeImpl root;
 
     /** Current branch this root operates on */
     private NodeStoreBranch branch;
@@ -145,25 +145,23 @@ public class RootImpl implements Root {
         NodeState base = getWorkspaceBaseState();
         NodeState head = getWorkspaceRootState();
         branch = store.branch();
+        root = TreeImpl.createRoot(this);
         merge(base, head, getRoot());
     }
 
     @Override
     public void refresh() {
-        root.revert();
         workspaceBuilder = null;
         branch = store.branch();
+        root = TreeImpl.createRoot(this);
     }
 
     @Override
     public void commit() throws CommitFailedException {
         purgePendingChanges();
-        NodeState base = getWorkspaceRootState();
         branch.merge();
         branch = store.branch();
-        root.saved();
-        NodeState head = getWorkspaceRootState();
-        merge(base, head, getRoot());
+        root = TreeImpl.createRoot(this);
     }
 
     @Override

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl.java?rev=1341216&r1=1341215&r2=1341216&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/TreeImpl.java
Mon May 21 21:46:05 2012
@@ -328,32 +328,6 @@ public class TreeImpl implements Tree, P
         return true;
     }
 
-    //------------------------------------------------------------< internal >---
-
-    /**
-     * Revert all changes to this instance and its child instances.
-     */
-    public void revert() {
-        for (TreeImpl child : children) {
-            // TODO revert changes done to this instance
-            child.revert();
-        }
-        nodeStateBuilder = null;
-        children.clear();
-    }
-
-    /**
-     * Remove revert info for this instance and all its child instances.
-     */
-    public void saved() {
-        for (TreeImpl child : children) {
-            // TODO clear records of changes done to this instance
-            child.saved();
-        }
-        nodeStateBuilder = null;
-        children.clear();
-    }
-
     //------------------------------------------------------------< RootImpl.Listener
>---
 
     @Override



Mime
View raw message