jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1556371 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core: AbstractRoot.java MutableTree.java
Date Tue, 07 Jan 2014 21:51:45 GMT
Author: jukka
Date: Tue Jan  7 21:51:44 2014
New Revision: 1556371

URL: http://svn.apache.org/r1556371
Log:
OAK-659: Move purge logic for transient changes below the NodeBuilder interface

No more need to explicitly track the base state in AbstractTree

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/AbstractRoot.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/MutableTree.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/AbstractRoot.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/AbstractRoot.java?rev=1556371&r1=1556370&r2=1556371&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/AbstractRoot.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/AbstractRoot.java
Tue Jan  7 21:51:44 2014
@@ -103,11 +103,6 @@ public abstract class AbstractRoot imple
     private final SecureNodeBuilder secureBuilder;
 
     /**
-     * Base state of the root tree
-     */
-    private NodeState base;
-
-    /**
      * Sentinel for the next move operation to take place on the this root
      */
     private Move lastMove = new Move();
@@ -161,8 +156,7 @@ public abstract class AbstractRoot imple
         this.securityProvider = checkNotNull(securityProvider);
         this.indexProvider = indexProvider;
 
-        base = store.getRoot();
-        builder = base.builder();
+        builder = store.getRoot().builder();
         secureBuilder = new SecureNodeBuilder(builder, permissionProvider, getAcContext());
         rootTree = new MutableTree(this, secureBuilder, lastMove);
     }
@@ -243,7 +237,7 @@ public abstract class AbstractRoot imple
     @Override
     public void rebase() {
         checkLive();
-        if (!store.getRoot().equals(getBaseState())) {
+        if (!store.getRoot().equals(getBaseState())) { // TODO: do we need this?
             store.rebase(builder);
             secureBuilder.baseChanged();
             if (permissionProvider.hasValue()) {
@@ -255,7 +249,7 @@ public abstract class AbstractRoot imple
     @Override
     public final void refresh() {
         checkLive();
-        base = store.reset(builder);
+        store.reset(builder);
         secureBuilder.baseChanged();
         modCount = 0;
         if (permissionProvider.hasValue()) {
@@ -275,7 +269,7 @@ public abstract class AbstractRoot imple
         ContentSession session = getContentSession();
         CommitInfo info = new CommitInfo(
                 session.toString(), session.getAuthInfo().getUserID(), message);
-        base = store.merge(builder, getCommitHook(path), info);
+        store.merge(builder, getCommitHook(path), info);
         secureBuilder.baseChanged();
         modCount = 0;
         if (permissionProvider.hasValue()) {
@@ -366,16 +360,7 @@ public abstract class AbstractRoot imple
      */
     @Nonnull
     NodeState getBaseState() {
-        return base;
-    }
-
-    /**
-     * Returns the secure view of this root's base state.
-     *
-     * @return secure base node state
-     */
-    NodeState getSecureBase() {
-        return new SecureNodeState(base, permissionProvider.get(), getAcContext());
+        return builder.getBaseState();
     }
 
     void updated() {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/MutableTree.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/MutableTree.java?rev=1556371&r1=1556370&r2=1556371&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/MutableTree.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/MutableTree.java
Tue Jan  7 21:51:44 2014
@@ -44,7 +44,6 @@ import org.apache.jackrabbit.oak.api.Typ
 import org.apache.jackrabbit.oak.core.AbstractRoot.Move;
 import org.apache.jackrabbit.oak.plugins.memory.MultiGenericPropertyState;
 import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
-import org.apache.jackrabbit.oak.spi.state.NodeState;
 import org.apache.jackrabbit.oak.util.PropertyBuilder;
 
 public class MutableTree extends AbstractTree {
@@ -441,19 +440,6 @@ public class MutableTree extends Abstrac
         return !isHidden(name) && nodeBuilder.exists();
     }
 
-    /**
-     * The (possibly non-existent) node state this tree is based on.
-     * @return the base node state of this tree
-     */
-    @Nonnull
-    private NodeState getSecureBase() {
-        if (parent == null) {
-            return root.getSecureBase();
-        } else {
-            return parent.getSecureBase().getChildNode(name);
-        }
-    }
-
     private boolean applyPendingMoves() {
         boolean movesApplied = false;
         if (parent != null) {



Mime
View raw message