jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1239677 - in /jackrabbit/sandbox/microkernel/src: main/java/org/apache/jackrabbit/mk/mem/ main/java/org/apache/jackrabbit/mk/wrapper/ test/java/org/apache/jackrabbit/mk/
Date Thu, 02 Feb 2012 15:41:46 GMT
Author: thomasm
Date: Thu Feb  2 15:41:45 2012
New Revision: 1239677

URL: http://svn.apache.org/viewvc?rev=1239677&view=rev
Log:
Javadoc; remove unused code.

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/NodeListSmall.java
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/mem/NodeListTrie.java
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/mem/NodeMap.java
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/wrapper/SecurityWrapper.java
    jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/MultiMkTestBase.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=1239677&r1=1239676&r2=1239677&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 Feb  2 15:41:45 2012
@@ -63,8 +63,6 @@ Node structure:
  */
 public class MemoryKernelImpl extends WrapperBase implements MicroKernel {
 
-    public static final boolean SORT_CHILDREN = Boolean.getBoolean("mk.sortChildren");
-
     private static final HashMap<String, MemoryKernelImpl> INSTANCES = new HashMap<String,
MemoryKernelImpl>();
 
     private static final int REV_SKIP_OFFSET = 20;

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=1239677&r1=1239676&r2=1239677&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 Feb  2 15:41:45 2012
@@ -124,10 +124,6 @@ public class NodeImpl implements Cache.V
         return clone;
     }
 
-    long getChildCount() {
-        return childNodes == null ? 0 : childNodes.size();
-    }
-
     public long getDescendantCount() {
         return descendantCount;
     }

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=1239677&r1=1239676&r2=1239677&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 Feb  2 15:41:45 2012
@@ -27,30 +27,101 @@ import org.apache.jackrabbit.mk.mem.Node
  */
 interface NodeList {
 
+    /**
+     * Get the number of (direct) child nodes.
+     *
+     * @return the number of child nodes
+     */
     long size();
 
+    /**
+     * Check if the given child node already exists in this list.
+     *
+     * @param name the child node name
+     * @return true if it exists
+     */
     boolean containsKey(String name);
 
+    /**
+     * Get the node id of the given child node. The child node must exist.
+     *
+     * @param name the child node name
+     * @return the node id
+     */
     NodeId get(String name);
 
+    /**
+     * Add a new child node.
+     *
+     * @param name the node name
+     * @param x the node id
+     */
     void add(String name, NodeId x);
 
+    /**
+     * Get the child node name at this position. If the index is larger than the
+     * number of child nodes, then null is returned.
+     *
+     * @param pos the index
+     * @return the node name or null
+     */
     String getName(long pos);
 
+    /**
+     * Get an iterator over the child node names.
+     *
+     * @param offset the offset
+     * @param maxCount the maximum number of returned names
+     * @return the iterator
+     */
     Iterator<String> getNames(long offset, int maxCount);
 
+    /**
+     * Remove a child node. The node must exist.
+     *
+     * @param name the child node name
+     * @return the old node id
+     */
     NodeId remove(String name);
 
+    /**
+     * Clone the child node list.
+     *
+     * @param map the node map
+     * @param revId the revision
+     * @return a copy
+     */
     NodeList createClone(NodeMap map, long revId);
 
+    /**
+     * Visit all child nodes.
+     *
+     * @param v the visitor
+     */
     void visit(ChildVisitor v);
 
+    /**
+     * Write the child node list into a jsop writer.
+     *
+     * @param json the jsop writer
+     * @param map the node map
+     */
     void append(JsopWriter json, NodeMap map);
 
-    byte[] getNameFilter(NodeMap map);
-
+    /**
+     * Estimate the memory used in bytes.
+     *
+     * @return the memory used
+     */
     int getMemory();
 
+    /**
+     * Write the data into the output stream in order to calculate the content
+     * hash.
+     *
+     * @param map the node map
+     * @param out the output stream
+     */
     void updateHash(NodeMap map, OutputStream out) throws IOException;
 
 }

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=1239677&r1=1239676&r2=1239677&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 Feb  2 15:41:45 2012
@@ -25,17 +25,38 @@ import org.apache.jackrabbit.mk.json.Jso
 import org.apache.jackrabbit.mk.json.JsopWriter;
 import org.apache.jackrabbit.mk.mem.NodeImpl.ChildVisitor;
 import org.apache.jackrabbit.mk.util.ArrayUtils;
-import org.apache.jackrabbit.mk.util.BloomFilterUtils;
 import org.apache.jackrabbit.mk.util.ExceptionFactory;
 import org.apache.jackrabbit.mk.util.IOUtils;
 import org.apache.jackrabbit.mk.util.StringCache;
 
+/**
+ * A list of child nodes that fits in memory.
+ */
 public class NodeListSmall implements NodeList {
 
+    /**
+     * The number of (direct) child nodes.
+     */
     int size;
+
+    /**
+     * The child node names, in order they were added.
+     */
     String[] names;
+
+    /**
+     * The child node ids.
+     */
     NodeId[] children;
+
+    /**
+     * The sort index.
+     */
     private int[] sort;
+
+    /**
+     * The index of the last child node name lookup (to speed up name lookups).
+     */
     private int lastNameIndexCache;
 
     NodeListSmall() {
@@ -180,14 +201,6 @@ public class NodeListSmall implements No
         }
     }
 
-    public byte[] getNameFilter(NodeMap map) {
-        byte[] data = BloomFilterUtils.createFilter(map.getMaxMemoryChildren(), 64);
-        for (String n : names) {
-            BloomFilterUtils.add(data, n);
-        }
-        return data;
-    }
-
     public int getMemory() {
         int memory = 100;
         for (int i = 0; i < names.length; i++) {

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/mem/NodeListTrie.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/mem/NodeListTrie.java?rev=1239677&r1=1239676&r2=1239677&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/mem/NodeListTrie.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/mem/NodeListTrie.java
Thu Feb  2 15:41:45 2012
@@ -237,6 +237,9 @@ public class NodeListTrie implements Nod
         return size;
     }
 
+    /**
+     * A child entry.
+     */
     static class Child {
 
         NodeId id;
@@ -296,9 +299,17 @@ public class NodeListTrie implements Nod
         json.key(NodeImpl.COUNT).value(size);
     }
 
-    static NodeListTrie read(JsopTokenizer t, NodeMap map, String value) {
+    /**
+     * Read a large child node list.
+     *
+     * @param t the tokenizer
+     * @param map the node map
+     * @param firstNodeId the node id of the first child
+     * @return the node list
+     */
+    static NodeListTrie read(JsopTokenizer t, NodeMap map, String firstNodeId) {
         Child c = new Child();
-        c.id = map.parseId(value);
+        c.id = map.parseId(firstNodeId);
         ArrayList<Child> children = new ArrayList<Child>();
         children.add(c);
         int len = 0;
@@ -309,9 +320,9 @@ public class NodeListTrie implements Nod
             if (k.endsWith(NodeImpl.COUNT)) {
                 size = Long.parseLong(t.readRawValue());
             } else if (k.equals(NodeImpl.CHILDREN)) {
-                value = t.readRawValue();
+                String nodeId = t.readRawValue();
                 c = new Child();
-                c.id = map.parseId(value);
+                c.id = map.parseId(nodeId);
                 children.add(c);
             } else if (k.equals(NodeImpl.NAMES)) {
                 c.prefix = t.readString();
@@ -340,8 +351,4 @@ public class NodeListTrie implements Nod
         }
     }
 
-    public byte[] getNameFilter(NodeMap map) {
-        return null;
-    }
-
 }

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/mem/NodeMap.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/mem/NodeMap.java?rev=1239677&r1=1239676&r2=1239677&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/mem/NodeMap.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/mem/NodeMap.java
Thu Feb  2 15:41:45 2012
@@ -171,18 +171,10 @@ public class NodeMap {
         this.descendantCount = descendantCount;
     }
 
-    public int getDescendantInlineCount() {
-        return descendantInlineCount;
-    }
-
     public void setDescendantInlineCount(int descendantInlineCount) {
         this.descendantInlineCount = descendantInlineCount;
     }
 
-    public void setHash(boolean hash) {
-        this.hash = hash;
-    }
-
     public boolean getHash() {
         return hash;
     }

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/wrapper/SecurityWrapper.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/wrapper/SecurityWrapper.java?rev=1239677&r1=1239676&r2=1239677&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/wrapper/SecurityWrapper.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/wrapper/SecurityWrapper.java
Thu Feb  2 15:41:45 2012
@@ -51,8 +51,7 @@ public class SecurityWrapper extends Wra
     private String rightsRevision;
 
     private SecurityWrapper(MicroKernel mk, String[] rights) {
-        // TODO reduce or eliminate json parsing + building
-        // TODO make the index secure mechanism
+        // TODO security for the index mechanism
         this.mk = WrapperBase.wrap(mk);
         this.userRights = rights;
         boolean isAdmin = false, canWrite = false;

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=1239677&r1=1239676&r2=1239677&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 Feb  2 15:41:45 2012
@@ -71,6 +71,7 @@ public class MultiMkTestBase {
         if (PROFILE) {
             prof = new Profiler();
             prof.interval = 1;
+            prof.depth = 32;
             prof.startCollecting();
         }
     }



Mime
View raw message