jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1163563 - in /jackrabbit/sandbox/microkernel/src: main/java/org/apache/jackrabbit/mk/blobs/BlobStoreInputStream.java main/java/org/apache/jackrabbit/mk/index/PrefixIndex.java test/java/org/apache/jackrabbit/mk/index/PrefixIndexTest.java
Date Wed, 31 Aug 2011 10:17:11 GMT
Author: thomasm
Date: Wed Aug 31 10:17:10 2011
New Revision: 1163563

URL: http://svn.apache.org/viewvc?rev=1163563&view=rev
Log:
Index mechanism (WIP)

Modified:
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/blobs/BlobStoreInputStream.java
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/index/PrefixIndex.java
    jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/index/PrefixIndexTest.java

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/blobs/BlobStoreInputStream.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/blobs/BlobStoreInputStream.java?rev=1163563&r1=1163562&r2=1163563&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/blobs/BlobStoreInputStream.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/blobs/BlobStoreInputStream.java
Wed Aug 31 10:17:10 2011
@@ -32,9 +32,10 @@ public class BlobStoreInputStream extend
     private long pos;
     private byte[] oneByteBuff;
 
-    public BlobStoreInputStream(AbstractBlobStore store, String id) {
+    public BlobStoreInputStream(AbstractBlobStore store, String id, long pos) {
         this.store = store;
         this.id = id;
+        this.pos = pos;
     }
 
     public int read(byte[] b, int off, int len) throws IOException {
@@ -65,7 +66,7 @@ public class BlobStoreInputStream extend
     public static byte[] readFully(AbstractBlobStore store, String id) throws IOException
{
         int len = (int) store.getBlobLength(id);
         byte[] buff = new byte[len];
-        BlobStoreInputStream in = new BlobStoreInputStream(store, id);
+        BlobStoreInputStream in = new BlobStoreInputStream(store, id, 0);
         IOUtils.readFully(in, buff, 0, len);
         return buff;
     }

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/index/PrefixIndex.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/index/PrefixIndex.java?rev=1163563&r1=1163562&r2=1163563&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/index/PrefixIndex.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/index/PrefixIndex.java
Wed Aug 31 10:17:10 2011
@@ -65,9 +65,19 @@ public class PrefixIndex implements Inde
                 }
                 if (!t.matches(']')) {
                     do {
-                        String v = t.readString();
-                        if (v.startsWith(prefix)) {
-                            addOrRemove(path, propertyName, v, add);
+                        if (t.matches(JsopTokenizer.STRING)) {
+                            String v = t.getToken();
+                            if (v.startsWith(prefix)) {
+                                addOrRemove(path, propertyName, v, add);
+                            }
+                        } else if (t.matches(JsopTokenizer.FALSE)) {
+                            // ignore
+                        } else if (t.matches(JsopTokenizer.TRUE)) {
+                            // ignore
+                        } else if (t.matches(JsopTokenizer.NULL)) {
+                            // ignore
+                        } else if (t.matches(JsopTokenizer.NUMBER)) {
+                            // ignore
                         }
                     } while (t.matches(','));
                     t.read(']');

Modified: jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/index/PrefixIndexTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/index/PrefixIndexTest.java?rev=1163563&r1=1163562&r2=1163563&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/index/PrefixIndexTest.java
(original)
+++ jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/index/PrefixIndexTest.java
Wed Aug 31 10:17:10 2011
@@ -27,7 +27,7 @@ import org.apache.jackrabbit.mk.api.Micr
 public class PrefixIndexTest extends TestCase {
 
     private static final String URL = "fs:{homeDir}/target";
-    // private static final String URL = "mem:fs:target/temp";
+    // private static final String URL = "mem:fs:target/temp;clean";
     // private static final String URL = "mem:";
 
     public void test() {
@@ -56,6 +56,7 @@ public class PrefixIndexTest extends Tes
         assertEquals("/test2/blob2, /test4/blob4", getPathList(index, "d:2", head));
 
         head = mk.commit("/", "+\"test5\" : {\"blobs\":[\"a:0\",\"d:2\"]}", head, null);
+        head = mk.commit("/", "+\"test6\" : {\"data\":[true, false, null, 1, -1]}", head,
null);
         assertEquals("/test2/blob2, /test4/blob4, /test5/blobs", getPathList(index, "d:2",
head));
 
         mk.dispose();



Mime
View raw message