jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1161473 - in /jackrabbit/sandbox/microkernel: ./ src/main/java/org/apache/jackrabbit/mk/api/ src/main/java/org/apache/jackrabbit/mk/blobs/ src/main/java/org/apache/jackrabbit/mk/json/ src/main/java/org/apache/jackrabbit/mk/mem/ src/main/ja...
Date Thu, 25 Aug 2011 09:47:18 GMT
Author: thomasm
Date: Thu Aug 25 09:47:18 2011
New Revision: 1161473

URL: http://svn.apache.org/viewvc?rev=1161473&view=rev
Log:
Checkstyle

Added:
    jackrabbit/sandbox/microkernel/checkstyle.xml
Modified:
    jackrabbit/sandbox/microkernel/   (props changed)
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/api/MicroKernelException.java
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/blobs/AbstractBlobStore.java
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/blobs/BlobStore.java
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/blobs/FileBlobStore.java
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/json/JsopTokenizer.java
    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/Revision.java
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/CommitBuilder.java
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/Constants.java
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/FatNode.java
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/MutableCommit.java
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/NodeTree.java
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/NodeUtils.java
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/PersistenceManager.java
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/util/IOUtils.java
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/util/NonDescendingClock.java
    jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/ConcurrentWriteTest.java
    jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/LargeObjectTest.java
    jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/Profiler.java
    jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/blobs/DataStoreTest.java
    jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/blobs/DbBlobStoreTest.java

Propchange: jackrabbit/sandbox/microkernel/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Thu Aug 25 09:47:18 2011
@@ -5,3 +5,4 @@ target
 .classpath
 .settings
 .mk
+.checkstyle

Added: jackrabbit/sandbox/microkernel/checkstyle.xml
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/checkstyle.xml?rev=1161473&view=auto
==============================================================================
--- jackrabbit/sandbox/microkernel/checkstyle.xml (added)
+++ jackrabbit/sandbox/microkernel/checkstyle.xml Thu Aug 25 09:47:18 2011
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN" "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
+
+<!--
+    This configuration file was written by the eclipse-cs plugin configuration editor
+-->
+<!--
+    Checkstyle-Configuration: Day Checkstyle
+    Description: none
+-->
+<module name="Checker">
+  <property name="severity" value="warning"/>
+  <module name="TreeWalker">
+    <property name="tabWidth" value="4"/>
+    <module name="ConstantName"/>
+    <module name="LocalFinalVariableName"/>
+    <module name="LocalVariableName"/>
+    <module name="MemberName"/>
+    <module name="MethodName"/>
+    <module name="PackageName"/>
+    <module name="ParameterName"/>
+    <module name="StaticVariableName"/>
+    <module name="TypeName"/>
+    <module name="AvoidStarImport"/>
+    <module name="IllegalImport"/>
+    <module name="RedundantImport"/>
+    <module name="UnusedImports"/>
+    <module name="EmptyForIteratorPad"/>
+    <module name="MethodParamPad"/>
+    <module name="NoWhitespaceAfter">
+      <property name="tokens" value="BNOT,DEC,DOT,INC,LNOT,UNARY_MINUS,UNARY_PLUS"/>
+    </module>
+    <module name="NoWhitespaceBefore"/>
+    <module name="OperatorWrap">
+      <property name="severity" value="ignore"/>
+      <property name="tokens" value="BAND,BOR,BSR,BXOR,COLON,DIV,EQUAL,GE,GT,LAND,LE,LITERAL_INSTANCEOF,LT,MINUS,MOD,NOT_EQUAL,SL,SR,STAR"/>
+      <metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
+    </module>
+    <module name="ParenPad"/>
+    <module name="WhitespaceAfter"/>
+    <module name="WhitespaceAround">
+      <property name="tokens" value="ASSIGN,BAND,BAND_ASSIGN,BOR,BOR_ASSIGN,BSR,BSR_ASSIGN,BXOR,BXOR_ASSIGN,DIV_ASSIGN,EQUAL,GE,GT,LAND,LE,LITERAL_ASSERT,LITERAL_CATCH,LITERAL_DO,LITERAL_ELSE,LITERAL_FINALLY,LITERAL_FOR,LITERAL_IF,LITERAL_RETURN,LITERAL_SYNCHRONIZED,LITERAL_TRY,LITERAL_WHILE,LOR,LT,MINUS,MINUS_ASSIGN,MOD,MOD_ASSIGN,NOT_EQUAL,PLUS_ASSIGN,SL,SLIST,SL_ASSIGN,SR,SR_ASSIGN,STAR,STAR_ASSIGN,LITERAL_ASSERT,TYPE_EXTENSION_AND,WILDCARD_TYPE"/>
+    </module>
+    <module name="ModifierOrder"/>
+    <module name="RedundantModifier"/>
+    <module name="LeftCurly">
+      <property name="tokens" value="CTOR_DEF,INTERFACE_DEF,LITERAL_CATCH,LITERAL_DO,LITERAL_ELSE,LITERAL_FINALLY,LITERAL_FOR,LITERAL_IF,LITERAL_SWITCH,LITERAL_SYNCHRONIZED,LITERAL_TRY,LITERAL_WHILE,METHOD_DEF"/>
+    </module>
+    <module name="NeedBraces"/>
+    <module name="RightCurly"/>
+    <module name="DoubleCheckedLocking"/>
+    <module name="EmptyStatement"/>
+    <module name="EqualsHashCode"/>
+    <module name="IllegalInstantiation"/>
+    <module name="RedundantThrows">
+      <property name="allowUnchecked" value="true"/>
+      <property name="allowSubclasses" value="true"/>
+      <property name="logLoadErrors" value="true"/>
+      <property name="suppressLoadErrors" value="true"/>
+    </module>
+    <module name="SimplifyBooleanExpression"/>
+    <module name="SimplifyBooleanReturn"/>
+    <module name="InterfaceIsType"/>
+    <module name="ArrayTypeStyle"/>
+    <module name="GenericIllegalRegexp">
+      <property name="severity" value="ignore"/>
+      <metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
+    </module>
+    <module name="TodoComment">
+      <property name="severity" value="ignore"/>
+      <metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
+    </module>
+    <module name="UpperEll"/>
+    <module name="JavadocType">
+      <property name="severity" value="ignore"/>
+      <metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
+    </module>
+    <module name="EmptyForInitializerPad"/>
+    <module name="CovariantEquals"/>
+    <module name="DefaultComesLast"/>
+    <module name="DeclarationOrder"/>
+    <module name="ExplicitInitialization"/>
+    <module name="FallThrough"/>
+    <module name="IllegalThrows"/>
+    <module name="SuperClone"/>
+    <module name="UnnecessaryParentheses"/>
+    <module name="TrailingComment"/>
+    <module name="PackageHtml">
+      <property name="severity" value="ignore"/>
+      <metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
+    </module>
+  </module>
+  <module name="FileTabCharacter">
+    <property name="severity" value="ignore"/>
+    <metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
+  </module>
+  <module name="NewlineAtEndOfFile">
+    <property name="severity" value="ignore"/>
+    <metadata name="net.sf.eclipsecs.core.lastEnabledSeverity" value="inherit"/>
+  </module>
+  <module name="Translation"/>
+</module>

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/api/MicroKernelException.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/api/MicroKernelException.java?rev=1161473&r1=1161472&r2=1161473&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/api/MicroKernelException.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/api/MicroKernelException.java
Thu Aug 25 09:47:18 2011
@@ -21,6 +21,8 @@ package org.apache.jackrabbit.mk.api;
  */
 public class MicroKernelException extends RuntimeException {
 
+    private static final long serialVersionUID = 1L;
+
     public MicroKernelException() {
         super();
     }

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/blobs/AbstractBlobStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/blobs/AbstractBlobStore.java?rev=1161473&r1=1161472&r2=1161473&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/blobs/AbstractBlobStore.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/blobs/AbstractBlobStore.java
Thu Aug 25 09:47:18 2011
@@ -58,6 +58,8 @@ public abstract class AbstractBlobStore 
     protected static final int TYPE_HASH = 1;
     protected static final int TYPE_HASH_COMPRESSED = 2;
 
+    private static final String HASH_ALGORITHM = "SHA-1";
+
     /**
      * The minimum size of a block. Smaller blocks are stored (the data store id
      * is the data itself).
@@ -70,7 +72,7 @@ public abstract class AbstractBlobStore 
      */
     private int blockSize = 128 * 1024;
 
-    private static final String HASH_ALGORITHM = "SHA-1";
+    private SmallLRUCache<String, byte[]> cache = SmallLRUCache.newInstance(5);
 
     public void setBlockSizeMin(int x) {
         this.blockSizeMin = x;
@@ -80,8 +82,6 @@ public abstract class AbstractBlobStore 
         this.blockSize = x;
     }
 
-    private SmallLRUCache<String, byte[]> cache = SmallLRUCache.newInstance(5);
-
     public String writeBlob(InputStream in) throws Exception {
         ByteArrayOutputStream idStream = new ByteArrayOutputStream();
         convertBlobToId(in, idStream, 0, 0);

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/blobs/BlobStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/blobs/BlobStore.java?rev=1161473&r1=1161472&r2=1161473&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/blobs/BlobStore.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/blobs/BlobStore.java
Thu Aug 25 09:47:18 2011
@@ -19,7 +19,7 @@ package org.apache.jackrabbit.mk.blobs;
 import java.io.InputStream;
 
 /**
- *
+ * An interface to store and read large binary objects.
  */
 public interface BlobStore {
 

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/blobs/FileBlobStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/blobs/FileBlobStore.java?rev=1161473&r1=1161472&r2=1161473&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/blobs/FileBlobStore.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/blobs/FileBlobStore.java
Thu Aug 25 09:47:18 2011
@@ -29,7 +29,7 @@ import java.io.IOException;
  */
 public class FileBlobStore extends AbstractBlobStore {
 
-    final private File baseDir;
+    private final File baseDir;
 
     public FileBlobStore(String dir) {
         baseDir = new File(dir);

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/json/JsopTokenizer.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/json/JsopTokenizer.java?rev=1161473&r1=1161472&r2=1161473&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/json/JsopTokenizer.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/json/JsopTokenizer.java
Thu Aug 25 09:47:18 2011
@@ -21,8 +21,8 @@ package org.apache.jackrabbit.mk.json;
  */
 public class JsopTokenizer {
 
-    public final static int STRING = 0, NUMBER = 1, TRUE = 2, FALSE = 3, NULL = 4;
-    public final static int COMMENT = 5, ERROR = 6, END = 7;
+    public static final int STRING = 0, NUMBER = 1, TRUE = 2, FALSE = 3, NULL = 4;
+    public static final int COMMENT = 5, ERROR = 6, END = 7;
 
     private static final String[] TYPE = {
             "string", "number", "true", "false", "null", "error", "end"

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=1161473&r1=1161472&r2=1161473&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 Aug 25 09:47:18 2011
@@ -51,15 +51,6 @@ public class MemoryKernelImpl implements
     private NonDescendingClock clock = new NonDescendingClock(System.currentTimeMillis());
     private final CommitGate gate = new CommitGate();
 
-    public synchronized static MemoryKernelImpl get(String name) {
-        MemoryKernelImpl instance = INSTANCES.get(name);
-        if (instance == null) {
-            instance = new MemoryKernelImpl(name);
-            INSTANCES.put(name, instance);
-        }
-        return instance;
-    }
-
     private MemoryKernelImpl(String name) {
         if (name.startsWith("fs:")) {
             String dir = name.substring("fs:".length());
@@ -71,6 +62,15 @@ public class MemoryKernelImpl implements
         init();
     }
 
+    public static synchronized MemoryKernelImpl get(String name) {
+        MemoryKernelImpl instance = INSTANCES.get(name);
+        if (instance == null) {
+            instance = new MemoryKernelImpl(name);
+            INSTANCES.put(name, instance);
+        }
+        return instance;
+    }
+
     public void clear() {
         headRevId = 0;
         init();
@@ -119,121 +119,122 @@ public class MemoryKernelImpl implements
             }
             String path;
             switch (r) {
-                case '+':
-                    path = t.readString();
-                    w.append("+ ").key(PathUtils.concat(rootPath, path));
-                    t.read(':');
-                    t.read('{');
-                    NodeImpl n = NodeImpl.parse(t, headRevId);
-                    headRoot = headRoot.cloneAndAddChildNode(PathUtils.concat(fromRoot, path),
false, null, n, headRevId);
-                    w.append(n.toString()).appendWhitespace("\n");
-                    break;
-                case '-':
-                    path = t.readString();
-                    w.append("- ").key(PathUtils.concat(rootPath, path));
-                    headRoot = headRoot.cloneAndRemoveChildNode(PathUtils.concat(fromRoot,
path), headRevId);
-                    w.appendWhitespace("\n");
-                    break;
-                case '^':
-                    path = t.readString();
-                    t.read(':');
-                    String value;
-                    if (t.matches(JsopTokenizer.NULL)) {
-                        value = null;
+            case '+':
+                path = t.readString();
+                w.append("+ ").key(PathUtils.concat(rootPath, path));
+                t.read(':');
+                int todoSupportAddProperty;
+                t.read('{');
+                NodeImpl n = NodeImpl.parse(t, headRevId);
+                headRoot = headRoot.cloneAndAddChildNode(PathUtils.concat(fromRoot, path),
false, null, n, headRevId);
+                w.append(n.toString()).appendWhitespace("\n");
+                break;
+            case '-':
+                path = t.readString();
+                w.append("- ").key(PathUtils.concat(rootPath, path));
+                headRoot = headRoot.cloneAndRemoveChildNode(PathUtils.concat(fromRoot, path),
headRevId);
+                w.appendWhitespace("\n");
+                break;
+            case '^':
+                path = t.readString();
+                t.read(':');
+                String value;
+                if (t.matches(JsopTokenizer.NULL)) {
+                    value = null;
+                    w.append("^ ").key(PathUtils.concat(rootPath, path));
+                    w.value(null);
+                } else {
+                    value = t.readRawValue().trim();
+                    String nodeName = PathUtils.concat(fromRoot, PathUtils.getParentPath(path));
+                    String propertyName = PathUtils.getName(path);
+                    if (headRoot.getNode(nodeName).hasProperty(propertyName)) {
                         w.append("^ ").key(PathUtils.concat(rootPath, path));
-                        w.value(null);
                     } else {
-                        value = t.readRawValue().trim();
-                        String nodeName = PathUtils.concat(fromRoot, PathUtils.getParentPath(path));
-                        String propertyName = PathUtils.getName(path);
-                        if (headRoot.getNode(nodeName).hasProperty(propertyName)) {
-                            w.append("^ ").key(PathUtils.concat(rootPath, path));
-                        } else {
-                            w.append("+ ").key(PathUtils.concat(rootPath, path));
-                        }
-                        w.append(value);
+                        w.append("+ ").key(PathUtils.concat(rootPath, path));
                     }
-                    headRoot = headRoot.cloneAndSetProperty(PathUtils.concat(fromRoot, path),
value, headRevId);
-                    w.appendWhitespace("\n");
-                    break;
-                case '>':
-                    path = t.readString();
-                    String from = PathUtils.concat(fromRoot, path);
-                    String name = PathUtils.getName(from);
-                    w.append("> ").key(PathUtils.concat(rootPath, from));
+                    w.append(value);
+                }
+                headRoot = headRoot.cloneAndSetProperty(PathUtils.concat(fromRoot, path),
value, headRevId);
+                w.appendWhitespace("\n");
+                break;
+            case '>':
+                path = t.readString();
+                String from = PathUtils.concat(fromRoot, path);
+                String name = PathUtils.getName(from);
+                w.append("> ").key(PathUtils.concat(rootPath, from));
+                t.read(':');
+                String position, target;
+                boolean rename;
+                String to;
+                if (t.matches('{')) {
+                    rename = false;
+                    position = t.readString();
                     t.read(':');
-                    String position, target;
-                    boolean rename;
-                    String to;
-                    if (t.matches('{')) {
-                        rename = false;
-                        position = t.readString();
-                        t.read(':');
-                        target = t.readString();
-                        t.read('}');
-                        w.object().key(position);
-                        if (PathUtils.isAbsolute(target)) {
-                            w.value(target);
-                        } else {
-                            w.value(PathUtils.concat(rootPath, target));
-                        }
-                        w.endObject();
-                    } else {
-                        rename = true;
-                        position = null;
-                        target = t.readString();
-                        if (PathUtils.isAbsolute(target)) {
-                            w.value(target);
-                        } else {
-                            w.value(PathUtils.concat(rootPath, target));
-                        }
-                    }
-                    w.appendWhitespace("\n");
-                    boolean before = false;
-                    if ("last".equals(position)) {
-                        target = PathUtils.concat(target, name);
-                        position = null;
-                    } else if ("first".equals(position)) {
-                        target = PathUtils.concat(target, name);
-                        position = null;
-                        before = true;
-                    } else if ("before".equals(position)) {
-                        position = PathUtils.getName(target);
-                        target = PathUtils.getParentPath(target);
-                        target = PathUtils.concat(target, name);
-                        before = true;
-                    } else if ("after".equals(position)) {
-                        position = PathUtils.getName(target);
-                        target = PathUtils.getParentPath(target);
-                        target = PathUtils.concat(target, name);
-                    } else if (position == null) {
-                        // move
+                    target = t.readString();
+                    t.read('}');
+                    w.object().key(position);
+                    if (PathUtils.isAbsolute(target)) {
+                        w.value(target);
                     } else {
-                        throw new AssertionError("position: " + position);
+                        w.value(PathUtils.concat(rootPath, target));
                     }
+                    w.endObject();
+                } else {
+                    rename = true;
+                    position = null;
+                    target = t.readString();
                     if (PathUtils.isAbsolute(target)) {
-                        to = PathUtils.relativize("/", target);
+                        w.value(target);
                     } else {
-                        to = PathUtils.concat(fromRoot, target);
+                        w.value(PathUtils.concat(rootPath, target));
                     }
-                    boolean inPlaceRename = false;
-                    if (rename) {
-                        if (PathUtils.getParentPath(from).equals(PathUtils.getParentPath(to)))
{
-                            inPlaceRename = true;
-                            position = PathUtils.getName(from);
-                        }
+                }
+                w.appendWhitespace("\n");
+                boolean before = false;
+                if ("last".equals(position)) {
+                    target = PathUtils.concat(target, name);
+                    position = null;
+                } else if ("first".equals(position)) {
+                    target = PathUtils.concat(target, name);
+                    position = null;
+                    before = true;
+                } else if ("before".equals(position)) {
+                    position = PathUtils.getName(target);
+                    target = PathUtils.getParentPath(target);
+                    target = PathUtils.concat(target, name);
+                    before = true;
+                } else if ("after".equals(position)) {
+                    position = PathUtils.getName(target);
+                    target = PathUtils.getParentPath(target);
+                    target = PathUtils.concat(target, name);
+                } else if (position == null) {
+                    // move
+                } else {
+                    throw new AssertionError("position: " + position);
+                }
+                if (PathUtils.isAbsolute(target)) {
+                    to = PathUtils.relativize("/", target);
+                } else {
+                    to = PathUtils.concat(fromRoot, target);
+                }
+                boolean inPlaceRename = false;
+                if (rename) {
+                    if (PathUtils.getParentPath(from).equals(PathUtils.getParentPath(to)))
{
+                        inPlaceRename = true;
+                        position = PathUtils.getName(from);
                     }
-                    NodeImpl node = headRoot.getNode(from);
-                    if (!inPlaceRename) {
-                        headRoot = headRoot.cloneAndRemoveChildNode(from, headRevId);
-                    }
-                    headRoot = headRoot.cloneAndAddChildNode(to, before, position, node,
headRevId);
-                    if (inPlaceRename) {
-                        headRoot = headRoot.cloneAndRemoveChildNode(from, headRevId);
-                    }
-                    break;
-                default:
-                    throw new AssertionError("token: " + (char) t.getTokenType());
+                }
+                NodeImpl node = headRoot.getNode(from);
+                if (!inPlaceRename) {
+                    headRoot = headRoot.cloneAndRemoveChildNode(from, headRevId);
+                }
+                headRoot = headRoot.cloneAndAddChildNode(to, before, position, node, headRevId);
+                if (inPlaceRename) {
+                    headRoot = headRoot.cloneAndRemoveChildNode(from, headRevId);
+                }
+                break;
+            default:
+                throw new AssertionError("token: " + (char) t.getTokenType());
             }
         }
         return w.toString();

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=1161473&r1=1161472&r2=1161473&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 Aug 25 09:47:18 2011
@@ -26,6 +26,9 @@ import java.util.HashMap;
 import java.util.LinkedHashMap;
 import java.util.Map.Entry;
 
+/**
+ * An in-memory node, including all child nodes.
+ */
 public class NodeImpl {
 
     private final long revId;

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/mem/Revision.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/mem/Revision.java?rev=1161473&r1=1161472&r2=1161473&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/mem/Revision.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/mem/Revision.java
Thu Aug 25 09:47:18 2011
@@ -16,6 +16,9 @@
  */
 package org.apache.jackrabbit.mk.mem;
 
+/**
+ * A revision, including pointer to the root node of that revision.
+ */
 public class Revision {
 
     private final long id;

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/CommitBuilder.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/CommitBuilder.java?rev=1161473&r1=1161472&r2=1161473&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/CommitBuilder.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/CommitBuilder.java
Thu Aug 25 09:47:18 2011
@@ -63,7 +63,8 @@ public class CommitBuilder {
         MutableNode newChild = new MutableNode();
         newChild.getProperties().putAll(properties);
 
-        modParent.getChildNodeEntries().put(nodeName, ""); // value will be computed on commit
+        // value will be computed on commit
+        modParent.getChildNodeEntries().put(nodeName, "");
         String newPath = PathUtils.concat(parentNodePath, nodeName);
         staged.put(newPath, newChild);
         // update change log
@@ -357,7 +358,7 @@ public class CommitBuilder {
                         // todo handle/merge colliding node additions
                     }
                 }
-
+                // TODO fall through?
                 case REMOVED_DIRTY_NODE_CONFLICT:
                     mergedNode.getProperties().remove(conflictName);
                     break;

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/Constants.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/Constants.java?rev=1161473&r1=1161472&r2=1161473&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/Constants.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/Constants.java
Thu Aug 25 09:47:18 2011
@@ -19,15 +19,15 @@ package org.apache.jackrabbit.mk.store;
 /**
  *
  */
-public interface Constants {
+public class Constants {
 
-    static String[] TYPE_NAMES = {"node", "nodetree", "fatnode", "fatnodepart", "commit",
"blob"};
+    static final String[] TYPE_NAMES = {"node", "nodetree", "fatnode", "fatnodepart", "commit",
"blob"};
 
-    static int ANY = -1;
-    static int NODE = 0;
-    static int NODE_TREE = 1;
-    static int FAT_NODE = 2;
-    static int FAT_NODE_PART = 3;
-    static int COMMIT = 4;
-    static int BLOB = 5;
+    static final int ANY = -1;
+    static final int NODE = 0;
+    static final int NODE_TREE = 1;
+    static final int FAT_NODE = 2;
+    static final int FAT_NODE_PART = 3;
+    static final int COMMIT = 4;
+    static final int BLOB = 5;
 }

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/FatNode.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/FatNode.java?rev=1161473&r1=1161472&r2=1161473&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/FatNode.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/FatNode.java
Thu Aug 25 09:47:18 2011
@@ -24,7 +24,8 @@ import java.util.Map;
  */
 public class FatNode extends Node {
 
-    final String nextPartId; // refers to next FatNodePart
+    // refers to next FatNodePart
+    final String nextPartId;
 
     public FatNode(String id,
                    Map<String, String> properties,

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/MutableCommit.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/MutableCommit.java?rev=1161473&r1=1161472&r2=1161473&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/MutableCommit.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/MutableCommit.java
Thu Aug 25 09:47:18 2011
@@ -41,9 +41,6 @@ public class MutableCommit {
     // id of parent commit
     String parentId;
 
-    public MutableCommit() {
-    }
-
     public String getParentId() {
         return parentId;
     }

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/NodeTree.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/NodeTree.java?rev=1161473&r1=1161472&r2=1161473&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/NodeTree.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/NodeTree.java
Thu Aug 25 09:47:18 2011
@@ -28,10 +28,11 @@ public class NodeTree extends StoredObje
     //--------------------------------------------------------< inner classes >
 
     public static interface ChildNodeEntryTarget {
+        // TODO used?
     }
 
     public static class EmbeddedNode implements ChildNodeEntryTarget {
-
+        // TODO used?
     }
 
     public static class NodeId implements ChildNodeEntryTarget {

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/NodeUtils.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/NodeUtils.java?rev=1161473&r1=1161472&r2=1161473&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/NodeUtils.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/NodeUtils.java
Thu Aug 25 09:47:18 2011
@@ -28,6 +28,7 @@ import java.util.Set;
 public class NodeUtils {
 
     private NodeUtils() {
+        // utility class
     }
 
     /**

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/PersistenceManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/PersistenceManager.java?rev=1161473&r1=1161472&r2=1161473&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/PersistenceManager.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/store/PersistenceManager.java
Thu Aug 25 09:47:18 2011
@@ -24,7 +24,7 @@ import java.util.concurrent.locks.Reentr
 /**
  *
  */
-public class PersistenceManager implements Constants {
+public class PersistenceManager {
 
     boolean initialized;
     ReentrantLock headLock = new ReentrantLock();

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/util/IOUtils.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/util/IOUtils.java?rev=1161473&r1=1161472&r2=1161473&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/util/IOUtils.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/util/IOUtils.java
Thu Aug 25 09:47:18 2011
@@ -94,7 +94,7 @@ public class IOUtils {
     public static String readString(InputStream in) throws IOException {
         int len = readVarInt(in);
         byte[] data = new byte[len];
-        for (int pos = 0; pos < len; ) {
+        for (int pos = 0; pos < len;) {
             int l = in.read(data, pos, data.length - pos);
             if (l < 0) {
                 throw new EOFException();
@@ -131,7 +131,7 @@ public class IOUtils {
             return x;
         }
         x &= 0x7f;
-        for (int s = 7; ; s += 7) {
+        for (int s = 7;; s += 7) {
             int b = (byte) in.read();
             x |= (b & 0x7f) << s;
             if (b >= 0) {
@@ -167,7 +167,7 @@ public class IOUtils {
             return x;
         }
         x &= 0x7f;
-        for (int s = 7; ; s += 7) {
+        for (int s = 7;; s += 7) {
             long b = (byte) in.read();
             x |= (b & 0x7f) << s;
             if (b >= 0) {

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/util/NonDescendingClock.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/util/NonDescendingClock.java?rev=1161473&r1=1161472&r2=1161473&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/util/NonDescendingClock.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/util/NonDescendingClock.java
Thu Aug 25 09:47:18 2011
@@ -24,7 +24,7 @@ package org.apache.jackrabbit.mk.util;
  */
 public class NonDescendingClock {
 
-    private final static int MAX_REPEAT = 1000;
+    private static final int MAX_REPEAT = 1000;
 
     private long last;
     private int count = MAX_REPEAT;

Modified: jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/ConcurrentWriteTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/ConcurrentWriteTest.java?rev=1161473&r1=1161472&r2=1161473&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/ConcurrentWriteTest.java
(original)
+++ jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/ConcurrentWriteTest.java
Thu Aug 25 09:47:18 2011
@@ -23,15 +23,15 @@ import java.util.Random;
 
 public class ConcurrentWriteTest extends TestCase {
 
+    protected static final String TEST_PATH = "/" + ConcurrentWriteTest.class.getName();
+
     private static final String URL = "fs:{homeDir}/target;clean";
     //private static final String URL = "mem:";
 
     private static final int NUM_THREADS = 20;
     private static final int NUM_CHILDNODES = 1000;
 
-    private MicroKernel mk;
-
-    private static String TEST_PATH = "/" + ConcurrentWriteTest.class.getName();
+    MicroKernel mk;
 
     public void setUp() throws Exception {
         mk = MicroKernelFactory.getInstance(URL);
@@ -75,9 +75,9 @@ public class ConcurrentWriteTest extends
         System.out.println("duration: " + (t1 - t0) + "ms");
 
         String head = mk.getHeadRevision();
-        String json = mk.getNodes("/", head, Integer.MAX_VALUE, 0, -1);
+        mk.getNodes("/", head, Integer.MAX_VALUE, 0, -1);
+        // System.out.println(json);
         System.out.println("new HEAD: " + head);
-        //System.out.println(json);
         System.out.println();
 
         String history = mk.getRevisions(t0, -1);
@@ -85,10 +85,10 @@ public class ConcurrentWriteTest extends
         System.out.println(history);
         System.out.println();
 
-        String journal = mk.getJournal(oldHead, head);
-        System.out.println("Journal:");
-        //System.out.println(journal);
-        System.out.println();
+        mk.getJournal(oldHead, head);
+        // System.out.println("Journal:");
+        // System.out.println(journal);
+        // System.out.println();
 
         // System.out.println(prof.getTop(5));
 

Modified: jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/LargeObjectTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/LargeObjectTest.java?rev=1161473&r1=1161472&r2=1161473&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/LargeObjectTest.java
(original)
+++ jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/LargeObjectTest.java
Thu Aug 25 09:47:18 2011
@@ -27,9 +27,9 @@ public class LargeObjectTest extends Tes
     private static final String URL = "fs:{homeDir}/target;clean";
     // private static final String URL = "mem:";
 
-    private MicroKernel mk;
+    private static final String TEST_PATH = "/" + LargeObjectTest.class.getName();
 
-    private static String TEST_PATH = "/" + LargeObjectTest.class.getName();
+    private MicroKernel mk;
 
     public void setUp() throws Exception {
         mk = MicroKernelFactory.getInstance(URL);

Modified: jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/Profiler.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/Profiler.java?rev=1161473&r1=1161472&r2=1161473&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/Profiler.java (original)
+++ jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/Profiler.java Thu
Aug 25 09:47:18 2011
@@ -51,10 +51,10 @@ public class Profiler implements Runnabl
                     "dalvik.system.NativeStart.run"
             , ',', true);
     volatile boolean stop;
+    int total;
     private HashMap<String, Integer> counts = new HashMap<String, Integer>();
     private HashMap<String, Integer> packages = new HashMap<String, Integer>();
     private int minCount = 1;
-    int total;
     private Thread thread;
     private long time;
 
@@ -179,7 +179,7 @@ public class Profiler implements Runnabl
             map.put(trace, oldCount + 1);
         }
         while (map.size() > MAX_ELEMENTS) {
-            for (Iterator<Map.Entry<String, Integer>> ei = map.entrySet().iterator();
ei.hasNext(); ) {
+            for (Iterator<Map.Entry<String, Integer>> ei = map.entrySet().iterator();
ei.hasNext();) {
                 Map.Entry<String, Integer> e = ei.next();
                 if (e.getValue() <= minCount) {
                     ei.remove();
@@ -228,7 +228,7 @@ public class Profiler implements Runnabl
     }
 
     private static void appendTop(StringBuilder buff, HashMap<String, Integer> map,
int count, int total) {
-        for (int x = 0, min = 0; ; ) {
+        for (int x = 0, min = 0;;) {
             int highest = 0;
             Map.Entry<String, Integer> best = null;
             for (Map.Entry<String, Integer> el : map.entrySet()) {

Modified: jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/blobs/DataStoreTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/blobs/DataStoreTest.java?rev=1161473&r1=1161472&r2=1161473&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/blobs/DataStoreTest.java
(original)
+++ jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/blobs/DataStoreTest.java
Thu Aug 25 09:47:18 2011
@@ -61,7 +61,7 @@ public class DataStoreTest extends TestC
     private void doTest(int maxLength, int count) throws IOException {
         String[] s = new String[count * 2];
         Random r = new Random(0);
-        for (int i = 0; i < s.length; ) {
+        for (int i = 0; i < s.length;) {
             int len = count == 1 ? maxLength : r.nextInt(maxLength);
             byte[] data = new byte[len];
             r.nextBytes(data);
@@ -69,7 +69,7 @@ public class DataStoreTest extends TestC
             s[i++] = mk.write(new ByteArrayInputStream(data));
         }
         r.setSeed(0);
-        for (int i = 0; i < s.length; ) {
+        for (int i = 0; i < s.length;) {
             int len = count == 1 ? maxLength : r.nextInt(maxLength);
             byte[] expectedData = new byte[len];
             r.nextBytes(expectedData);

Modified: jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/blobs/DbBlobStoreTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/blobs/DbBlobStoreTest.java?rev=1161473&r1=1161472&r2=1161473&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/blobs/DbBlobStoreTest.java
(original)
+++ jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/blobs/DbBlobStoreTest.java
Thu Aug 25 09:47:18 2011
@@ -101,14 +101,14 @@ public class DbBlobStoreTest extends Tes
     private void doTest(int maxLength, int count) throws Exception {
         String[] s = new String[count * 2];
         Random r = new Random(0);
-        for (int i = 0; i < s.length; ) {
+        for (int i = 0; i < s.length;) {
             byte[] data = new byte[r.nextInt(maxLength)];
             r.nextBytes(data);
             s[i++] = store.writeBlob(new ByteArrayInputStream(data));
             s[i++] = store.writeBlob(new ByteArrayInputStream(data));
         }
         r.setSeed(0);
-        for (int i = 0; i < s.length; ) {
+        for (int i = 0; i < s.length;) {
             int expectedLen = r.nextInt(maxLength);
             byte[] expectedData = new byte[expectedLen];
             r.nextBytes(expectedData);



Mime
View raw message