jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1330340 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel: KernelNodeStateBuilder.java KernelNodeStore.java KernelRoot.java
Date Wed, 25 Apr 2012 15:22:04 GMT
Author: mduerig
Date: Wed Apr 25 15:22:03 2012
New Revision: 1330340

URL: http://svn.apache.org/viewvc?rev=1330340&view=rev
Log:
OAK-9: Internal tree builder
- cleanup

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateBuilder.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStore.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelRoot.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateBuilder.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateBuilder.java?rev=1330340&r1=1330339&r2=1330340&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateBuilder.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStateBuilder.java
Wed Apr 25 15:22:03 2012
@@ -28,18 +28,24 @@ public class KernelNodeStateBuilder impl
     private final MicroKernel kernel;
     private final CoreValueFactory valueFactory;
     private final String path;
+    private final String[] revision;
 
-    private String[] revision;  // FIXME: refactor
-
-    public KernelNodeStateBuilder(MicroKernel kernel, CoreValueFactory valueFactory, String
path,
+    private KernelNodeStateBuilder(MicroKernel kernel, CoreValueFactory valueFactory, String
path,
             String[] revision) {
 
         this.kernel = kernel;
         this.valueFactory = valueFactory;
         this.path = path;
-
         this.revision = revision;
     }
+    
+    public static NodeStateBuilder create(MicroKernel kernel, CoreValueFactory valueFactory,
+            String path, String revision) {
+
+        String[] r = new String[1];
+        r[0] = revision;
+        return new KernelNodeStateBuilder(kernel, valueFactory, path, r);
+    }
 
     @Override
     public NodeState getNodeState() {
@@ -156,7 +162,7 @@ public class KernelNodeStateBuilder impl
 
         try {
             kernel.merge(revision[0], null);
-            revision = null;
+            revision[0] = null;
         }
         catch (MicroKernelException e) {
             throw new CommitFailedException(e);
@@ -166,7 +172,7 @@ public class KernelNodeStateBuilder impl
     //------------------------------------------------------------< private >---
 
     private void assertNotStale() {
-        if (revision == null) {
+        if (revision[0] == null) {
             throw new IllegalStateException("This branch has been merged already");
         }
     }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStore.java?rev=1330340&r1=1330339&r2=1330340&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStore.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelNodeStore.java
Wed Apr 25 15:22:03 2012
@@ -52,9 +52,7 @@ public class KernelNodeStore implements 
         KernelNodeState kernelNodeState = (KernelNodeState) nodeState;
         String branchRevision = kernel.branch(kernelNodeState.getRevision());
         String path = kernelNodeState.getPath();
-        String[] br = new String[1];  // FIXME refactor
-        br[0] = branchRevision;
-        return new KernelNodeStateBuilder(kernel, valueFactory, path, br);
+        return KernelNodeStateBuilder.create(kernel, valueFactory, path, branchRevision);
     }
 
     @Override

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelRoot.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelRoot.java?rev=1330340&r1=1330339&r2=1330340&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelRoot.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelRoot.java
Wed Apr 25 15:22:03 2012
@@ -102,7 +102,7 @@ public class KernelRoot implements Root 
 
     @Override
     public void refresh() {
-        // TODO implement base = store.getRoot().getChildNode(workspaceName);
+        // TODO implement refresh base = store.getRoot().getChildNode(workspaceName);
     }
 
     @Override
@@ -139,18 +139,6 @@ public class KernelRoot implements Root 
         return state;
     }
 
-    /**
-     * Path of the item {@code name} of the given {@code state}
-     *
-     * @param state
-     * @param name The item name.
-     * @return relative path of the item {@code name}
-     */
-    private static String path(Tree state, String name) {
-        String path = state.getPath();
-        return path.isEmpty() ? name : path + '/' + name;
-    }
-
     private class TreeListener implements Listener {
         private boolean isDirty;
         



Mime
View raw message