jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: r1241513 - in /jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk: model/ store/
Date Tue, 07 Feb 2012 16:38:02 GMT
Author: stefan
Date: Tue Feb  7 16:38:01 2012
New Revision: 1241513

URL: http://svn.apache.org/viewvc?rev=1241513&view=rev
Log:
refactor ChildNodeEntriesBucket and ChildNodeEntriesInlined into ChildNodeEntriesMap

Added:
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/ChildNodeEntriesMap.java
      - copied, changed from r1241482, jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/ChildNodeEntriesInlined.java
Removed:
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/ChildNodeEntriesBucket.java
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/ChildNodeEntriesInlined.java
Modified:
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/AbstractNode.java
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/ChildNodeEntriesTree.java
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/StoredNode.java
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/AbstractPersistenceManager.java
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/BDbPersistenceManager.java
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/FSPersistenceManager.java
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/H2PersistenceManager.java
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/IdFactory.java
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/InMemPersistenceManager.java
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/MongoPersistenceManager.java
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/RevisionProvider.java
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/RevisionStore.java

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/AbstractNode.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/AbstractNode.java?rev=1241513&r1=1241512&r2=1241513&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/AbstractNode.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/AbstractNode.java
Tue Feb  7 16:38:01 2012
@@ -45,7 +45,7 @@ public abstract class AbstractNode imple
     protected AbstractNode(RevisionProvider provider) {
         this.provider = provider;
         this.properties = new HashMap<String, String>();
-        this.childEntries = new ChildNodeEntriesInlined();
+        this.childEntries = new ChildNodeEntriesMap(true);
     }
 
     protected AbstractNode(Node other, RevisionProvider provider) {
@@ -57,7 +57,7 @@ public abstract class AbstractNode imple
         } else {
             this.properties = new HashMap<String, String>(other.getProperties());
             if (other.getChildNodeCount() <= ChildNodeEntries.CAPACITY_THRESHOLD) {
-                this.childEntries = new ChildNodeEntriesInlined();
+                this.childEntries = new ChildNodeEntriesMap(true);
             } else {
                 this.childEntries = new ChildNodeEntriesTree(provider);
             }

Copied: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/ChildNodeEntriesMap.java
(from r1241482, jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/ChildNodeEntriesInlined.java)
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/ChildNodeEntriesMap.java?p2=jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/ChildNodeEntriesMap.java&p1=jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/ChildNodeEntriesInlined.java&r1=1241482&r2=1241513&rev=1241513&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/ChildNodeEntriesInlined.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/ChildNodeEntriesMap.java
Tue Feb  7 16:38:01 2012
@@ -29,37 +29,57 @@ import java.util.LinkedHashMap;
 import java.util.Map;
 
 /**
- * todo consolidate ChildNodeEntriesBucket and ChildNodeEntriesInlined -> ChildNodeEntriesBucket(insertionOrdered)
+ *
  */
-public class ChildNodeEntriesInlined implements ChildNodeEntries {
+public class ChildNodeEntriesMap implements ChildNodeEntries {
 
     protected static final Iterator<ChildNodeEntry> EMPTY_ITER = new EmptyIterator<ChildNodeEntry>();
     
     protected HashMap<String, ChildNodeEntry> entries;
+
+    protected boolean insertionOrdered;
     
-    ChildNodeEntriesInlined() {
-        entries = new LinkedHashMap<String, ChildNodeEntry>();
+    ChildNodeEntriesMap(boolean insertionOrdered) {
+        this.insertionOrdered = insertionOrdered;
+        if (insertionOrdered) {
+            entries = new LinkedHashMap<String, ChildNodeEntry>();
+        } else {
+            entries = new HashMap<String, ChildNodeEntry>();
+        }
+    }
+
+    ChildNodeEntriesMap(ChildNodeEntriesMap other) {
+        insertionOrdered = other.insertionOrdered;
+        if (insertionOrdered) {
+            entries = (LinkedHashMap<String, ChildNodeEntry>) other.entries.clone();
+        } else {
+            entries = (HashMap<String, ChildNodeEntry>) other.entries.clone();
+        }
     }
 
     //------------------------------------------------------------< overrides >
 
     @Override
     public boolean equals(Object obj) {
-        if (obj instanceof ChildNodeEntriesInlined) {
-            return entries.equals(((ChildNodeEntriesInlined) obj).entries);
+        if (obj instanceof ChildNodeEntriesMap) {
+            return entries.equals(((ChildNodeEntriesMap) obj).entries);
         }
         return false;
     }
 
     @Override
     public Object clone()  {
-        ChildNodeEntriesInlined clone = null;
+        ChildNodeEntriesMap clone = null;
         try {
-            clone = (ChildNodeEntriesInlined) super.clone();
+            clone = (ChildNodeEntriesMap) super.clone();
         } catch (CloneNotSupportedException e) {
             // can't possibly get here
         }
-        clone.entries = (LinkedHashMap<String, ChildNodeEntry>) entries.clone();
+        if (insertionOrdered) {
+            clone.entries = (LinkedHashMap<String, ChildNodeEntry>) entries.clone();
+        } else {
+            clone.entries = (HashMap<String, ChildNodeEntry>) entries.clone();
+        }
         return clone;
     }
 
@@ -250,6 +270,7 @@ public class ChildNodeEntriesInlined imp
 
     @Override
     public void serialize(Binding binding) throws Exception {
+        binding.write(":ordered", insertionOrdered ? 1 : 0);
         binding.write(":children", getCount(),
                 new AbstractRangeIterator<Binding.KeyValuePair>(getEntries(0, -1),
0, -1) {
                     @Override
@@ -260,8 +281,9 @@ public class ChildNodeEntriesInlined imp
                 });
     }
 
-    static ChildNodeEntriesInlined deserialize(RevisionProvider provider, Binding binding)
throws Exception {
-        ChildNodeEntriesInlined newInstance = new ChildNodeEntriesInlined();
+    public static ChildNodeEntriesMap deserialize(Binding binding) throws Exception {
+        boolean insertionOrdered = binding.readIntValue(":ordered") == 0 ? false : true;
+        ChildNodeEntriesMap newInstance = new ChildNodeEntriesMap(insertionOrdered);
         Iterator<Binding.KeyValuePair> iter = binding.read(":children");
         while (iter.hasNext()) {
             Binding.KeyValuePair kvp = iter.next();

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/ChildNodeEntriesTree.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/ChildNodeEntriesTree.java?rev=1241513&r1=1241512&r2=1241513&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/ChildNodeEntriesTree.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/ChildNodeEntriesTree.java
Tue Feb  7 16:38:01 2012
@@ -152,7 +152,7 @@ public class ChildNodeEntriesTree implem
                         list.add((NodeInfo) e);
                     } else if (e instanceof BucketInfo) {
                         BucketInfo bi = (BucketInfo) e;
-                        ChildNodeEntriesBucket bucket = retrieveBucket(bi.getId());
+                        ChildNodeEntries bucket = retrieveBucket(bi.getId());
                         for (Iterator<ChildNodeEntry> it =
                                      bucket.getEntries(offset - skipped, cnt - list.size());
                              it.hasNext(); ) {
@@ -318,7 +318,7 @@ public class ChildNodeEntriesTree implem
                             added.add((ChildNodeEntry) ie2);    
                         } else if (ie2 instanceof BucketInfo) {
                             BucketInfo bi = (BucketInfo) ie2;
-                            ChildNodeEntriesBucket bucket = retrieveBucket(bi.getId());
+                            ChildNodeEntries bucket = retrieveBucket(bi.getId());
                             for (Iterator<ChildNodeEntry> it = bucket.getEntries(0,
-1);
                                  it.hasNext(); ) {
                                 added.add(it.next());
@@ -333,9 +333,9 @@ public class ChildNodeEntriesTree implem
                         }
                     } else if (ie2 != null) {
                         // both this and other index entry are non-null
-                        ChildNodeEntriesBucket bucket1;
+                        ChildNodeEntriesMap bucket1;
                         if (ie1 instanceof NodeInfo) {
-                            bucket1 = new ChildNodeEntriesBucket();
+                            bucket1 = new ChildNodeEntriesMap(false);
                             bucket1.add((ChildNodeEntry) ie1);
                         } else if (ie1 instanceof BucketInfo) {
                             BucketInfo bi = (BucketInfo) ie1;
@@ -344,9 +344,9 @@ public class ChildNodeEntriesTree implem
                             // dirty bucket
                             bucket1 = (Bucket) ie1;
                         }
-                        ChildNodeEntriesBucket bucket2;
+                        ChildNodeEntriesMap bucket2;
                         if (ie2 instanceof NodeInfo) {
-                            bucket2 = new ChildNodeEntriesBucket();
+                            bucket2 = new ChildNodeEntriesMap(false);
                             bucket2.add((ChildNodeEntry) ie2);
                         } else if (ie2 instanceof BucketInfo) {
                             BucketInfo bi = (BucketInfo) ie2;
@@ -395,7 +395,7 @@ public class ChildNodeEntriesTree implem
                             removed.add((ChildNodeEntry) ie1);
                         } else if (ie1 instanceof BucketInfo) {
                             BucketInfo bi = (BucketInfo) ie1;
-                            ChildNodeEntriesBucket bucket = retrieveBucket(bi.getId());
+                            ChildNodeEntries bucket = retrieveBucket(bi.getId());
                             for (Iterator<ChildNodeEntry> it = bucket.getEntries(0,
-1);
                                  it.hasNext(); ) {
                                 removed.add(it.next());
@@ -410,9 +410,9 @@ public class ChildNodeEntriesTree implem
                         }
                     } else if (ie1 != null) {
                         // both this and other index entry are non-null
-                        ChildNodeEntriesBucket bucket1;
+                        ChildNodeEntriesMap bucket1;
                         if (ie1 instanceof NodeInfo) {
-                            bucket1 = new ChildNodeEntriesBucket();
+                            bucket1 = new ChildNodeEntriesMap(false);
                             bucket1.add((ChildNodeEntry) ie1);
                         } else if (ie1 instanceof BucketInfo) {
                             BucketInfo bi = (BucketInfo) ie1;
@@ -421,9 +421,9 @@ public class ChildNodeEntriesTree implem
                             // dirty bucket
                             bucket1 = (Bucket) ie1;
                         }
-                        ChildNodeEntriesBucket bucket2;
+                        ChildNodeEntriesMap bucket2;
                         if (ie2 instanceof NodeInfo) {
-                            bucket2 = new ChildNodeEntriesBucket();
+                            bucket2 = new ChildNodeEntriesMap(false);
                             bucket2.add((ChildNodeEntry) ie2);
                         } else if (ie2 instanceof BucketInfo) {
                             BucketInfo bi = (BucketInfo) ie2;
@@ -477,9 +477,9 @@ public class ChildNodeEntriesTree implem
                         }
                     }
 
-                    ChildNodeEntriesBucket bucket1;
+                    ChildNodeEntriesMap bucket1;
                     if (ie1 instanceof NodeInfo) {
-                        bucket1 = new ChildNodeEntriesBucket();
+                        bucket1 = new ChildNodeEntriesMap(false);
                         bucket1.add((ChildNodeEntry) ie1);
                     } else if (ie1 instanceof BucketInfo) {
                         BucketInfo bi = (BucketInfo) ie1;
@@ -488,9 +488,9 @@ public class ChildNodeEntriesTree implem
                         // dirty bucket
                         bucket1 = (Bucket) ie1;
                     }
-                    ChildNodeEntriesBucket bucket2;
+                    ChildNodeEntriesMap bucket2;
                     if (ie2 instanceof NodeInfo) {
-                        bucket2 = new ChildNodeEntriesBucket();
+                        bucket2 = new ChildNodeEntriesMap(false);
                         bucket2.add((ChildNodeEntry) ie2);
                     } else if (ie2 instanceof BucketInfo) {
                         BucketInfo bi = (BucketInfo) ie2;
@@ -526,7 +526,7 @@ public class ChildNodeEntriesTree implem
             if (index[i] instanceof Bucket) {
                 // dirty bucket
                 Bucket bucket = (Bucket) index[i];
-                String id = store.putCNEBucket(bucket);
+                String id = store.putCNEMap(bucket);
                 index[i] = new BucketInfo(id, bucket.getSize());
             }
         }
@@ -538,12 +538,12 @@ public class ChildNodeEntriesTree implem
         return (hash & 0x7FFFFFFF) % index.length;
     }
 
-    protected ChildNodeEntriesBucket retrieveBucket(String id) {
+    protected ChildNodeEntriesMap retrieveBucket(String id) {
         try {
-            return revProvider.getCNEBucket(id);
+            return revProvider.getCNEMap(id);
         } catch (Exception e) {
             // todo log error and gracefully handle exception
-            return new ChildNodeEntriesBucket();
+            return new ChildNodeEntriesMap(false);
         }
     }
 
@@ -661,12 +661,13 @@ public class ChildNodeEntriesTree implem
         }
     }
 
-    protected static class Bucket extends ChildNodeEntriesBucket implements IndexEntry {
+    protected static class Bucket extends ChildNodeEntriesMap implements IndexEntry {
 
         protected Bucket() {
+            super(false);
         }
 
-        protected Bucket(ChildNodeEntriesBucket other) {
+        protected Bucket(ChildNodeEntriesMap other) {
             super(other);
         }
 

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/StoredNode.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/StoredNode.java?rev=1241513&r1=1241512&r2=1241513&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/StoredNode.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/StoredNode.java
Tue Feb  7 16:38:01 2012
@@ -41,7 +41,7 @@ public class StoredNode extends Abstract
         }
         boolean inlined = binding.readIntValue(":inlined") != 0;
         if (inlined) {
-            newInstance.childEntries = ChildNodeEntriesInlined.deserialize(provider, binding);
+            newInstance.childEntries = ChildNodeEntriesMap.deserialize(binding);
         } else {
             newInstance.childEntries = ChildNodeEntriesTree.deserialize(provider, binding);
         }

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/AbstractPersistenceManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/AbstractPersistenceManager.java?rev=1241513&r1=1241512&r2=1241513&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/AbstractPersistenceManager.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/AbstractPersistenceManager.java
Tue Feb  7 16:38:01 2012
@@ -16,7 +16,7 @@
  */
 package org.apache.jackrabbit.mk.store;
 
-import org.apache.jackrabbit.mk.model.ChildNodeEntriesBucket;
+import org.apache.jackrabbit.mk.model.ChildNodeEntriesMap;
 import org.apache.jackrabbit.mk.model.Commit;
 import org.apache.jackrabbit.mk.model.MutableCommit;
 import org.apache.jackrabbit.mk.model.Node;
@@ -58,11 +58,11 @@ public abstract class AbstractPersistenc
 
     protected abstract StoredNode readNode(String id) throws NotFoundException, Exception;
 
-    protected abstract ChildNodeEntriesBucket readCNEBucket(String id) throws NotFoundException,
Exception;
+    protected abstract ChildNodeEntriesMap readCNEMap(String id) throws NotFoundException,
Exception;
 
     protected abstract String writeNode(Node node) throws Exception;
 
-    protected abstract String writeCNEBucket(ChildNodeEntriesBucket bucket) throws Exception;
+    protected abstract String writeCNEMap(ChildNodeEntriesMap map) throws Exception;
 
     protected abstract StoredCommit readCommit(String id) throws NotFoundException, Exception;
 
@@ -141,22 +141,22 @@ public abstract class AbstractPersistenc
         return id;
     }
 
-    public String putCNEBucket(ChildNodeEntriesBucket bucket) throws Exception {
+    public String putCNEMap(ChildNodeEntriesMap map) throws Exception {
         verifyInitialized();
 
         PersistHook callback = null;
-        if (bucket instanceof PersistHook) {
-            callback = (PersistHook) bucket;
+        if (map instanceof PersistHook) {
+            callback = (PersistHook) map;
             callback.prePersist(this);
         }
 
-       String id = writeCNEBucket(bucket);
+       String id = writeCNEMap(map);
 
         if (callback != null)  {
             callback.postPersist(this);
         }
 
-        cache.put(id, bucket);
+        cache.put(id, map);
 
         return id;
     }
@@ -224,19 +224,19 @@ public abstract class AbstractPersistenc
         return node;
     }
 
-    public ChildNodeEntriesBucket getCNEBucket(String id) throws NotFoundException, Exception
{
+    public ChildNodeEntriesMap getCNEMap(String id) throws NotFoundException, Exception {
         verifyInitialized();
 
-        ChildNodeEntriesBucket bucket = (ChildNodeEntriesBucket) cache.get(id);
-        if (bucket != null) {
-            return bucket;
+        ChildNodeEntriesMap map = (ChildNodeEntriesMap) cache.get(id);
+        if (map != null) {
+            return map;
         }
 
-        bucket = readCNEBucket(id);
+        map = readCNEMap(id);
 
-        cache.put(id, bucket);
+        cache.put(id, map);
 
-        return bucket;
+        return map;
     }
 
     public StoredCommit getCommit(String id) throws NotFoundException, Exception {

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/BDbPersistenceManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/BDbPersistenceManager.java?rev=1241513&r1=1241512&r2=1241513&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/BDbPersistenceManager.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/BDbPersistenceManager.java
Tue Feb  7 16:38:01 2012
@@ -23,7 +23,7 @@ import java.io.InputStream;
 
 import org.apache.jackrabbit.mk.blobs.BlobStore;
 import org.apache.jackrabbit.mk.blobs.FileBlobStore;
-import org.apache.jackrabbit.mk.model.ChildNodeEntriesBucket;
+import org.apache.jackrabbit.mk.model.ChildNodeEntriesMap;
 import org.apache.jackrabbit.mk.model.Commit;
 import org.apache.jackrabbit.mk.model.Node;
 import org.apache.jackrabbit.mk.model.StoredCommit;
@@ -183,22 +183,22 @@ public class BDbPersistenceManager exten
     }
 
     @Override
-    protected ChildNodeEntriesBucket readCNEBucket(String id) throws NotFoundException, Exception
{
+    protected ChildNodeEntriesMap readCNEMap(String id) throws NotFoundException, Exception
{
         DatabaseEntry key = new DatabaseEntry(StringUtils.convertHexToBytes(id));
         DatabaseEntry data = new DatabaseEntry();
 
         if (db.get(null, key, data, LockMode.DEFAULT) == OperationStatus.SUCCESS) {
             ByteArrayInputStream in = new ByteArrayInputStream(data.getData());
-            return ChildNodeEntriesBucket.deserialize(id, new BinaryBinding(in));
+            return ChildNodeEntriesMap.deserialize(new BinaryBinding(in));
         } else {
             throw new NotFoundException(id);
         }
     }
 
     @Override
-    protected String writeCNEBucket(ChildNodeEntriesBucket bucket) throws Exception {
+    protected String writeCNEMap(ChildNodeEntriesMap map) throws Exception {
         ByteArrayOutputStream out = new ByteArrayOutputStream();
-        bucket.serialize(new BinaryBinding(out));
+        map.serialize(new BinaryBinding(out));
         byte[] bytes = out.toByteArray();
         byte[] rawId = idFactory.createContentId(bytes);
         return persist(bytes, rawId);

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/FSPersistenceManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/FSPersistenceManager.java?rev=1241513&r1=1241512&r2=1241513&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/FSPersistenceManager.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/FSPersistenceManager.java
Tue Feb  7 16:38:01 2012
@@ -25,7 +25,7 @@ import java.io.InputStream;
 
 import org.apache.jackrabbit.mk.blobs.BlobStore;
 import org.apache.jackrabbit.mk.blobs.FileBlobStore;
-import org.apache.jackrabbit.mk.model.ChildNodeEntriesBucket;
+import org.apache.jackrabbit.mk.model.ChildNodeEntriesMap;
 import org.apache.jackrabbit.mk.model.Commit;
 import org.apache.jackrabbit.mk.model.Node;
 import org.apache.jackrabbit.mk.model.StoredCommit;
@@ -146,12 +146,12 @@ public class FSPersistenceManager extend
     }
 
     @Override
-    protected ChildNodeEntriesBucket readCNEBucket(String id) throws NotFoundException, Exception
{
+    protected ChildNodeEntriesMap readCNEMap(String id) throws NotFoundException, Exception
{
         File f = getFile(id);
         if (f.exists()) {
             BufferedInputStream in = new BufferedInputStream(new FileInputStream(f));
             try {
-                return ChildNodeEntriesBucket.deserialize(id, new BinaryBinding(in));
+                return ChildNodeEntriesMap.deserialize(new BinaryBinding(in));
             } finally {
                 in.close();
             }
@@ -161,9 +161,9 @@ public class FSPersistenceManager extend
     }
 
     @Override
-    protected String writeCNEBucket(ChildNodeEntriesBucket bucket) throws Exception {
+    protected String writeCNEMap(ChildNodeEntriesMap map) throws Exception {
         ByteArrayOutputStream out = new ByteArrayOutputStream();
-        bucket.serialize(new BinaryBinding(out));
+        map.serialize(new BinaryBinding(out));
         byte[] bytes = out.toByteArray();
         byte[] rawId = idFactory.createContentId(bytes);
         return writeFile(bytes, rawId);

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/H2PersistenceManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/H2PersistenceManager.java?rev=1241513&r1=1241512&r2=1241513&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/H2PersistenceManager.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/H2PersistenceManager.java
Tue Feb  7 16:38:01 2012
@@ -18,7 +18,7 @@ package org.apache.jackrabbit.mk.store;
 
 import org.apache.jackrabbit.mk.blobs.BlobStore;
 import org.apache.jackrabbit.mk.blobs.FileBlobStore;
-import org.apache.jackrabbit.mk.model.ChildNodeEntriesBucket;
+import org.apache.jackrabbit.mk.model.ChildNodeEntriesMap;
 import org.apache.jackrabbit.mk.model.Commit;
 import org.apache.jackrabbit.mk.model.Node;
 import org.apache.jackrabbit.mk.model.StoredCommit;
@@ -225,7 +225,7 @@ public class H2PersistenceManager extend
     }
 
     @Override
-    protected ChildNodeEntriesBucket readCNEBucket(String id) throws NotFoundException, Exception
{
+    protected ChildNodeEntriesMap readCNEMap(String id) throws NotFoundException, Exception
{
         Connection con = cp.getConnection();
         try {
             PreparedStatement stmt = con.prepareStatement("select DATA from REVS where ID
= ?");
@@ -234,7 +234,7 @@ public class H2PersistenceManager extend
                 ResultSet rs = stmt.executeQuery();
                 if (rs.next()) {
                     ByteArrayInputStream in = new ByteArrayInputStream(rs.getBytes(1));
-                    return ChildNodeEntriesBucket.deserialize(id, new BinaryBinding(in));
+                    return ChildNodeEntriesMap.deserialize(new BinaryBinding(in));
                 } else {
                     throw new NotFoundException(id);
                 }
@@ -247,9 +247,9 @@ public class H2PersistenceManager extend
     }
 
     @Override
-    protected String writeCNEBucket(ChildNodeEntriesBucket bucket) throws Exception {
+    protected String writeCNEMap(ChildNodeEntriesMap map) throws Exception {
         ByteArrayOutputStream out = new ByteArrayOutputStream();
-        bucket.serialize(new BinaryBinding(out));
+        map.serialize(new BinaryBinding(out));
         byte[] bytes = out.toByteArray();
         byte[] rawId = idFactory.createContentId(bytes);
         String id = StringUtils.convertBytesToHex(rawId);

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/IdFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/IdFactory.java?rev=1241513&r1=1241512&r2=1241513&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/IdFactory.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/IdFactory.java
Tue Feb  7 16:38:01 2012
@@ -18,9 +18,6 @@ package org.apache.jackrabbit.mk.store;
 
 import java.security.MessageDigest;
 
-import org.apache.jackrabbit.mk.model.ChildNodeEntriesBucket;
-import org.apache.jackrabbit.mk.model.Commit;
-import org.apache.jackrabbit.mk.model.Node;
 import org.apache.jackrabbit.mk.util.AscendingClock;
 
 /**

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/InMemPersistenceManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/InMemPersistenceManager.java?rev=1241513&r1=1241512&r2=1241513&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/InMemPersistenceManager.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/InMemPersistenceManager.java
Tue Feb  7 16:38:01 2012
@@ -26,7 +26,7 @@ import java.util.Map;
 
 import org.apache.jackrabbit.mk.blobs.BlobStore;
 import org.apache.jackrabbit.mk.blobs.MemoryBlobStore;
-import org.apache.jackrabbit.mk.model.ChildNodeEntriesBucket;
+import org.apache.jackrabbit.mk.model.ChildNodeEntriesMap;
 import org.apache.jackrabbit.mk.model.Commit;
 import org.apache.jackrabbit.mk.model.Node;
 import org.apache.jackrabbit.mk.model.StoredCommit;
@@ -41,7 +41,7 @@ public class InMemPersistenceManager ext
 
     private final Map<String, StoredNode> nodes = Collections.synchronizedMap(new HashMap<String,
StoredNode>());
     private final Map<String, StoredCommit> commits = Collections.synchronizedMap(new
HashMap<String, StoredCommit>());
-    private final Map<String, ChildNodeEntriesBucket> buckets = Collections.synchronizedMap(new
HashMap<String, ChildNodeEntriesBucket>());
+    private final Map<String, ChildNodeEntriesMap> cneMaps = Collections.synchronizedMap(new
HashMap<String, ChildNodeEntriesMap>());
     private final BlobStore blobs = new MemoryBlobStore();
 
     private String head;
@@ -129,24 +129,24 @@ public class InMemPersistenceManager ext
     }
 
     @Override
-    protected ChildNodeEntriesBucket readCNEBucket(String id) throws NotFoundException, Exception
{
-        ChildNodeEntriesBucket bucket = buckets.get(id);
-        if (bucket != null) {
-            return bucket;
+    protected ChildNodeEntriesMap readCNEMap(String id) throws NotFoundException, Exception
{
+        ChildNodeEntriesMap map = cneMaps.get(id);
+        if (map != null) {
+            return map;
         } else {
             throw new NotFoundException(id);
         }
     }
 
     @Override
-    protected String writeCNEBucket(ChildNodeEntriesBucket bucket) throws Exception {
+    protected String writeCNEMap(ChildNodeEntriesMap map) throws Exception {
         ByteArrayOutputStream out = new ByteArrayOutputStream();
-        bucket.serialize(new BinaryBinding(out));
+        map.serialize(new BinaryBinding(out));
         byte[] bytes = out.toByteArray();
         String id = StringUtils.convertBytesToHex(idFactory.createContentId(bytes));
 
-        if (!buckets.containsKey(id)) {
-            buckets.put(id, ChildNodeEntriesBucket.deserialize(id, new BinaryBinding(new
ByteArrayInputStream(bytes))));
+        if (!cneMaps.containsKey(id)) {
+            cneMaps.put(id, ChildNodeEntriesMap.deserialize(new BinaryBinding(new ByteArrayInputStream(bytes))));
         }
 
         return id;

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/MongoPersistenceManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/MongoPersistenceManager.java?rev=1241513&r1=1241512&r2=1241513&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/MongoPersistenceManager.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/MongoPersistenceManager.java
Tue Feb  7 16:38:01 2012
@@ -22,7 +22,7 @@ import java.io.File;
 import java.io.InputStream;
 import java.util.Iterator;
 
-import org.apache.jackrabbit.mk.model.ChildNodeEntriesBucket;
+import org.apache.jackrabbit.mk.model.ChildNodeEntriesMap;
 import org.apache.jackrabbit.mk.model.Commit;
 import org.apache.jackrabbit.mk.model.Node;
 import org.apache.jackrabbit.mk.model.StoredCommit;
@@ -52,7 +52,7 @@ public class MongoPersistenceManager ext
     private static final String HEAD_COLLECTION = "head";
     private static final String NODES_COLLECTION = "nodes";
     private static final String COMMITS_COLLECTION = "commits";
-    private static final String BUCKETS_COLLECTION = "buckets";
+    private static final String CNEMAPS_COLLECTION = "cneMaps";
     private static final String ID_FIELD = ":id";
     private static final String DATA_FIELD = ":data";
 
@@ -60,7 +60,7 @@ public class MongoPersistenceManager ext
     private DB db;
     private DBCollection nodes;
     private DBCollection commits;
-    private DBCollection buckets;
+    private DBCollection cneMaps;
     private GridFS fs;
 
     @Override
@@ -86,8 +86,8 @@ public class MongoPersistenceManager ext
                 new BasicDBObject(ID_FIELD, 1),
                 new BasicDBObject("unique", true));
 
-        buckets = db.getCollection(BUCKETS_COLLECTION);
-        buckets.ensureIndex(
+        cneMaps = db.getCollection(CNEMAPS_COLLECTION);
+        cneMaps.ensureIndex(
                 new BasicDBObject(ID_FIELD, 1),
                 new BasicDBObject("unique", true));
 
@@ -244,20 +244,20 @@ public class MongoPersistenceManager ext
     }
 
     @Override
-    protected ChildNodeEntriesBucket readCNEBucket(String id) throws NotFoundException, Exception
{
+    protected ChildNodeEntriesMap readCNEMap(String id) throws NotFoundException, Exception
{
         BasicDBObject key = new BasicDBObject();
         if (BINARY_FORMAT) {
             key.put(ID_FIELD, StringUtils.convertHexToBytes(id));
         } else {
             key.put(ID_FIELD, id);
         }
-        BasicDBObject bucketObject = (BasicDBObject) buckets.findOne(key);
-        if (bucketObject != null) {
+        BasicDBObject mapObject = (BasicDBObject) cneMaps.findOne(key);
+        if (mapObject != null) {
             if (BINARY_FORMAT) {
-                byte[] bytes = (byte[]) bucketObject.get(DATA_FIELD);
-                return ChildNodeEntriesBucket.deserialize(id, new BinaryBinding(new ByteArrayInputStream(bytes)));
+                byte[] bytes = (byte[]) mapObject.get(DATA_FIELD);
+                return ChildNodeEntriesMap.deserialize(new BinaryBinding(new ByteArrayInputStream(bytes)));
             } else {
-                return ChildNodeEntriesBucket.deserialize(id, new DBObjectBinding(bucketObject));
+                return ChildNodeEntriesMap.deserialize(new DBObjectBinding(mapObject));
             }
         } else {
             throw new NotFoundException(id);
@@ -265,22 +265,22 @@ public class MongoPersistenceManager ext
     }
 
     @Override
-    protected String writeCNEBucket(ChildNodeEntriesBucket bucket) throws Exception {
+    protected String writeCNEMap(ChildNodeEntriesMap map) throws Exception {
         ByteArrayOutputStream out = new ByteArrayOutputStream();
-        bucket.serialize(new BinaryBinding(out));
+        map.serialize(new BinaryBinding(out));
         byte[] bytes = out.toByteArray();
         byte[] key = idFactory.createContentId(bytes);
         String id = StringUtils.convertBytesToHex(key);
 
-        BasicDBObject bucketObject;
+        BasicDBObject mapObject;
         if (BINARY_FORMAT) {
-            bucketObject = new BasicDBObject(ID_FIELD, key).append(DATA_FIELD, bytes);
+            mapObject = new BasicDBObject(ID_FIELD, key).append(DATA_FIELD, bytes);
         } else {
-            bucketObject = new BasicDBObject(ID_FIELD, id);
-            bucket.serialize(new DBObjectBinding(bucketObject));
+            mapObject = new BasicDBObject(ID_FIELD, id);
+            map.serialize(new DBObjectBinding(mapObject));
         }
         try {
-            buckets.insert(bucketObject);
+            cneMaps.insert(mapObject);
         } catch (MongoException.DuplicateKey ignore) {
             // fall through
         }

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/RevisionProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/RevisionProvider.java?rev=1241513&r1=1241512&r2=1241513&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/RevisionProvider.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/RevisionProvider.java
Tue Feb  7 16:38:01 2012
@@ -16,7 +16,7 @@
  */
 package org.apache.jackrabbit.mk.store;
 
-import org.apache.jackrabbit.mk.model.ChildNodeEntriesBucket;
+import org.apache.jackrabbit.mk.model.ChildNodeEntriesMap;
 import org.apache.jackrabbit.mk.model.StoredCommit;
 import org.apache.jackrabbit.mk.model.StoredNode;
 
@@ -27,7 +27,7 @@ public interface RevisionProvider {
 
     StoredNode getNode(String id) throws NotFoundException, Exception;
     StoredCommit getCommit(String id) throws NotFoundException, Exception;
-    ChildNodeEntriesBucket getCNEBucket(String id) throws NotFoundException, Exception;
+    ChildNodeEntriesMap getCNEMap(String id) throws NotFoundException, Exception;
     StoredNode getRootNode(String commitId) throws NotFoundException, Exception;
     StoredCommit getHeadCommit() throws Exception;
     String getHeadCommitId() throws Exception;

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/RevisionStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/RevisionStore.java?rev=1241513&r1=1241512&r2=1241513&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/RevisionStore.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/RevisionStore.java
Tue Feb  7 16:38:01 2012
@@ -16,7 +16,7 @@
  */
 package org.apache.jackrabbit.mk.store;
 
-import org.apache.jackrabbit.mk.model.ChildNodeEntriesBucket;
+import org.apache.jackrabbit.mk.model.ChildNodeEntriesMap;
 import org.apache.jackrabbit.mk.model.Commit;
 import org.apache.jackrabbit.mk.model.Node;
 
@@ -29,7 +29,7 @@ public interface RevisionStore extends R
 
     String /*id*/ putNode(Node node) throws Exception;
     String /*id*/ putCommit(Commit commit) throws Exception;
-    String /*id*/ putCNEBucket(ChildNodeEntriesBucket bucket) throws Exception;
+    String /*id*/ putCNEMap(ChildNodeEntriesMap map) throws Exception;
     void setHeadCommitId(String commitId) throws Exception;
     void lockHead();
     void unlockHead();



Mime
View raw message