jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1186701 - in /jackrabbit/sandbox/microkernel/src: main/java/org/apache/jackrabbit/mk/mem/ test/java/org/apache/jackrabbit/mk/ test/java/org/apache/jackrabbit/mk/index/ test/java/org/apache/jackrabbit/mk/json/
Date Thu, 20 Oct 2011 09:56:07 GMT
Author: thomasm
Date: Thu Oct 20 09:56:07 2011
New Revision: 1186701

URL: http://svn.apache.org/viewvc?rev=1186701&view=rev
Log:
Various smaller changes

Modified:
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/mem/MemoryKernelImpl.java
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/mem/NodeImpl.java
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/mem/NodeList.java
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/mem/NodeListLarge.java
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/mem/NodeListSmall.java
    jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/HelloWorld.java
    jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/MultiMkTestBase.java
    jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/index/IndexTest.java
    jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/json/JsonBuilderTest.java

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/mem/MemoryKernelImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/mem/MemoryKernelImpl.java?rev=1186701&r1=1186700&r2=1186701&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/mem/MemoryKernelImpl.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/mem/MemoryKernelImpl.java
Thu Oct 20 09:56:07 2011
@@ -488,6 +488,9 @@ public class MemoryKernelImpl implements
         if (!PathUtils.isAbsolute(path)) {
             throw ExceptionFactory.get("Not an absolute path: " + path);
         }
+        if (PathUtils.denotesRoot(path)) {
+            return true;
+        }
         // TODO possibly use a cache / a bloom filter
         return getRevision(revisionId).exists(path.substring(1));
     }

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/mem/NodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/mem/NodeImpl.java?rev=1186701&r1=1186700&r2=1186701&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/mem/NodeImpl.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/mem/NodeImpl.java
Thu Oct 20 09:56:07 2011
@@ -141,7 +141,7 @@ public class NodeImpl implements Cache.V
         return c;
     }
 
-    NodeImpl cloneAndRemoveChildNode(String path, long revId) {
+    public NodeImpl cloneAndRemoveChildNode(String path, long revId) {
         int index = PathUtils.getNextSlash(path, 0);
         if (index < 0) {
             NodeImpl clone = createClone(revId);
@@ -222,7 +222,7 @@ public class NodeImpl implements Cache.V
         return propertyValuePairs[index + 1];
     }
 
-    void append(JsopBuilder json, int depth, long offset, int count, boolean childNodeCount)
{
+    public void append(JsopBuilder json, int depth, long offset, int count, boolean childNodeCount)
{
         json.object();
         String[] pv = propertyValuePairs;
         if (pv != null) {
@@ -384,6 +384,13 @@ public class NodeImpl implements Cache.V
         return path;
     }
 
+    public String getChildNodeName(long pos) {
+        if (childNodes == null || childNodes.size() <= pos) {
+            return null;
+        }
+        return childNodes.getName(pos);
+    }
+
     public Iterator<String> getChildNodeNames(int maxCount) {
         if (childNodes == null || childNodes.size() == 0) {
             return new ArrayList<String>().iterator();
@@ -466,7 +473,7 @@ public class NodeImpl implements Cache.V
         this.childNodes = childNodes;
     }
 
-    NodeImpl setChild(String name, NodeImpl child, long revId) {
+    public NodeImpl setChild(String name, NodeImpl child, long revId) {
         NodeImpl result = this;
         if (exists(name)) {
             NodeImpl n = getChildNode(name);

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/mem/NodeList.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/mem/NodeList.java?rev=1186701&r1=1186700&r2=1186701&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/mem/NodeList.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/mem/NodeList.java
Thu Oct 20 09:56:07 2011
@@ -33,6 +33,8 @@ interface NodeList {
 
     void add(String name, long x);
 
+    String getName(long pos);
+
     Iterator<String> getNames(long offset, int maxCount);
 
     long remove(String name);

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/mem/NodeListLarge.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/mem/NodeListLarge.java?rev=1186701&r1=1186700&r2=1186701&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/mem/NodeListLarge.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/mem/NodeListLarge.java
Thu Oct 20 09:56:07 2011
@@ -89,6 +89,20 @@ public class NodeListLarge implements No
         throw ExceptionFactory.get("Node not found: " + name);
     }
 
+    public String getName(long pos) {
+        int i = 0;
+        for (; i < children.size(); i++) {
+            Child c = children.get(i);
+            long size = getList(c, false).size();
+            if (size > pos) {
+                NodeList list = getList(c, false);
+                return list.getName(pos);
+            }
+            pos -= size;
+        }
+        return null;
+    }
+
     public Iterator<String> getNames(long offset, final int maxCount) {
         int i = 0;
         for (; i < children.size(); i++) {

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/mem/NodeListSmall.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/mem/NodeListSmall.java?rev=1186701&r1=1186700&r2=1186701&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/mem/NodeListSmall.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/mem/NodeListSmall.java
Thu Oct 20 09:56:07 2011
@@ -99,6 +99,10 @@ public class NodeListSmall implements No
         size++;
     }
 
+    public String getName(long pos) {
+        return pos >= names.length ? null : names[(int) pos];
+    }
+
     public Iterator<String> getNames(final long offset, final int maxCount) {
         return  new Iterator<String>() {
             int pos = (int) offset;

Modified: jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/HelloWorld.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/HelloWorld.java?rev=1186701&r1=1186700&r2=1186701&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/HelloWorld.java
(original)
+++ jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/HelloWorld.java
Thu Oct 20 09:56:07 2011
@@ -27,6 +27,7 @@ public class HelloWorld {
     public static void main(String... args) throws ParseException {
         test("fs:{homeDir};clean");
         test("mem:");
+        test("mem:fs:target/temp;clean");
     }
 
     private static void test(String url) throws ParseException {

Modified: jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/MultiMkTestBase.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/MultiMkTestBase.java?rev=1186701&r1=1186700&r2=1186701&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/MultiMkTestBase.java
(original)
+++ jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/MultiMkTestBase.java
Thu Oct 20 09:56:07 2011
@@ -37,7 +37,8 @@ public class MultiMkTestBase {
             return Arrays.asList(new Object[][]{
                     {"fs:{homeDir}/target"},
                     {"mem:"},
-                    {"mem:fs:target/temp"}});
+                    {"mem:fs:target/temp"}
+                    });
     }
 
     @Before

Modified: jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/index/IndexTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/index/IndexTest.java?rev=1186701&r1=1186700&r2=1186701&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/index/IndexTest.java
(original)
+++ jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/index/IndexTest.java
Thu Oct 20 09:56:07 2011
@@ -103,6 +103,7 @@ public class IndexTest extends MultiMkTe
             tree.add("" + i, "p" + i);
             // print(mk, tree);
         }
+        // indexer.commitChanges();
         for (int i = 0; i < len; i++) {
             // log("#test " + i);
             Cursor c = tree.findFirst("" + i);
@@ -113,8 +114,9 @@ public class IndexTest extends MultiMkTe
         print(mk, tree);
         for (int i = 0; i < len; i++) {
             Assert.assertTrue("not found when removing " + i, tree.remove("" + i, null));
-            // print(mk, index);
+            // print(mk, tree);
         }
+        // indexer.commitChanges();
         print(mk, tree);
         for (int i = 0; i < len; i++) {
             Cursor c = tree.findFirst("" + i);

Modified: jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/json/JsonBuilderTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/json/JsonBuilderTest.java?rev=1186701&r1=1186700&r2=1186701&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/json/JsonBuilderTest.java
(original)
+++ jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/json/JsonBuilderTest.java
Thu Oct 20 09:56:07 2011
@@ -16,7 +16,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
 package org.apache.jackrabbit.mk.json;
 
 import junit.framework.Assert;



Mime
View raw message