jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1173282 - in /jackrabbit/sandbox/jackrabbit-mk: jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/ jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/ jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/comm...
Date Tue, 20 Sep 2011 18:04:08 GMT
Author: mduerig
Date: Tue Sep 20 18:04:07 2011
New Revision: 1173282

URL: http://svn.apache.org/viewvc?rev=1173282&view=rev
Log:
Microkernel based Jackrabbit prototype (WIP) 
revert changes from r1170635  and r1170615 since they create problems in Sling

Added:
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/JcrConstants.java
      - copied unchanged from r1170614, jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/JcrConstants.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/util/
      - copied from r1170634, jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/util/
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/util/Text.java
      - copied unchanged from r1170634, jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/util/Text.java
Removed:
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/JcrConstants.java
Modified:
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/cnd/CompactNodeTypeDefWriter.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/flat/BTreeManager.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/Text.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr-commons/src/test/java/org/apache/jackrabbit/util/TextTest.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/MoveTest.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/xml/SessionImportTest.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/identifier/AbstractIdFactory.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/CommitMessage.java

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/cnd/CompactNodeTypeDefWriter.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/cnd/CompactNodeTypeDefWriter.java?rev=1173282&r1=1173281&r2=1173282&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/cnd/CompactNodeTypeDefWriter.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/cnd/CompactNodeTypeDefWriter.java
Tue Sep 20 18:04:07 2011
@@ -16,7 +16,7 @@
  */
 package org.apache.jackrabbit.commons.cnd;
 
-import org.apache.jackrabbit.commons.JcrConstants;
+import org.apache.jackrabbit.JcrConstants;
 import org.apache.jackrabbit.commons.query.qom.Operator;
 import org.apache.jackrabbit.util.ISO9075;
 import org.apache.jackrabbit.util.Text;

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/flat/BTreeManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/flat/BTreeManager.java?rev=1173282&r1=1173281&r2=1173282&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/flat/BTreeManager.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/flat/BTreeManager.java
Tue Sep 20 18:04:07 2011
@@ -16,7 +16,7 @@
  */
 package org.apache.jackrabbit.commons.flat;
 
-import org.apache.jackrabbit.commons.JcrConstants;
+import org.apache.jackrabbit.JcrConstants;
 import org.apache.jackrabbit.commons.iterator.FilterIterator;
 import org.apache.jackrabbit.commons.iterator.SizedIterator;
 import org.apache.jackrabbit.commons.predicate.Predicate;
@@ -148,8 +148,8 @@ public class BTreeManager implements Tre
     }
 
     /**
-     * Properties to ignore. The default set contains {@link org.apache.jackrabbit.commons.JcrConstants#JCR_PRIMARYTYPE}
-     * and {@link org.apache.jackrabbit.commons.JcrConstants#JCR_MIXINTYPES}.
+     * Properties to ignore. The default set contains {@link JcrConstants#JCR_PRIMARYTYPE}
+     * and {@link JcrConstants#JCR_MIXINTYPES}.
      *
      * @return
      */

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/Text.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/Text.java?rev=1173282&r1=1173281&r2=1173282&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/Text.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/util/Text.java
Tue Sep 20 18:04:07 2011
@@ -109,64 +109,6 @@ public class Text {
     }
 
     /**
-     * Escape all {@code target} characters of string {@code s} with the given
-     * {@code escape} character.
-     *
-     * @param s  string to escape
-     * @param target  characters to escape
-     * @param escape  escape character prepended to all target characters
-     * @return  escaped string
-     */
-    public static String escape(String s, char target, char escape) {
-        if (s == null) {
-            return null;
-        }
-
-        StringBuilder sb = new StringBuilder();
-        for (int k = 0; k < s.length(); k++) {
-            char c = s.charAt(k);
-            if (c == target || c == escape) {
-                sb.append(escape);
-            }
-            sb.append(c);
-        }
-
-        return sb.toString();
-    }
-
-    /**
-     * Unescape all characters in string {@code s} which are escaped with the
-     * given {@code escape} character.
-     *
-     * @param s  string to unescape
-     * @param escape  escape character prepended to all target characters
-     * @return  unescaped string
-     */
-    public static String unescape(String s, char escape) {
-        if (s == null) {
-            return null;
-        }
-
-        boolean escaping = false;
-        StringBuilder sb = new StringBuilder();
-        for (int k = 0; k < s.length(); k++) {
-            char c = s.charAt(k);
-            if (escaping) {
-                sb.append(c);
-                escaping = false;
-            }
-            else if (c == escape) {
-                escaping = true;
-            }
-            else {
-                sb.append(c);
-            }
-        }
-
-        return sb.toString();
-    }
-
-    /**
      * returns an array of strings decomposed of the original string, split at
      * every occurrence of 'ch'. if 2 'ch' follow each other with no intermediate
      * characters, empty "" entries are avoided.
@@ -372,8 +314,8 @@ public class Text {
      * @return the escaped string
      * @throws NullPointerException if {@code string} is {@code null}.
      */
-    public static String urlEncode(String string, char escape) {
-        return urlEncode(string, escape, false);
+    public static String escape(String string, char escape) {
+        return escape(string, escape, false);
     }
 
     /**
@@ -389,7 +331,7 @@ public class Text {
      * @return the escaped string
      * @throws NullPointerException if {@code string} is {@code null}.
      */
-    public static String urlEncode(String string, char escape, boolean isPath) {
+    public static String escape(String string, char escape, boolean isPath) {
         try {
             BitSet validChars = isPath ? URISaveEx : URISave;
             byte[] bytes = string.getBytes("utf-8");
@@ -419,23 +361,23 @@ public class Text {
      * @return the escaped string
      * @throws NullPointerException if {@code string} is {@code null}.
      */
-    public static String urlEncode(String string) {
-        return urlEncode(string, '%');
+    public static String escape(String string) {
+        return escape(string, '%');
     }
 
     /**
      * Does a URL encoding of the {@code path}. The characters that
      * don't need encoding are those defined 'unreserved' in section 2.3 of
      * the 'URI generic syntax' RFC 2396. In contrast to the
-     * {@link #urlEncode(String)} method, not the entire path string is escaped,
+     * {@link #escape(String)} method, not the entire path string is escaped,
      * but every individual part (i.e. the slashes are not escaped).
      *
      * @param path the path to encode
      * @return the escaped path
      * @throws NullPointerException if {@code path} is {@code null}.
      */
-    public static String urlEncodePath(String path) {
-        return urlEncode(path, '%', true);
+    public static String escapePath(String path) {
+        return escape(path, '%', true);
     }
 
     /**
@@ -452,7 +394,7 @@ public class Text {
      *                                        or if not enough characters follow an
      *                                        escape character
      */
-    public static String urlDecode(String string, char escape)  {
+    public static String unescape(String string, char escape)  {
         try {
             byte[] utf8 = string.getBytes("utf-8");
 
@@ -493,8 +435,8 @@ public class Text {
      * @throws IllegalArgumentException       if the 2 characters following the escape
      *                                        character do not represent a hex-number.
      */
-    public static String urlDecode(String string) {
-        return urlDecode(string, '%');
+    public static String unescape(String string) {
+        return unescape(string, '%');
     }
 
     /**
@@ -563,7 +505,7 @@ public class Text {
      * Unescapes previously escaped jcr chars.
      * <p/>
      * Please note, that this does not exactly the same as the url related
-     * {@link #urlDecode(String)}, since it handles the byte-encoding
+     * {@link #unescape(String)}, since it handles the byte-encoding
      * differently.
      *
      * @param name the name to unescape

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr-commons/src/test/java/org/apache/jackrabbit/util/TextTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr-commons/src/test/java/org/apache/jackrabbit/util/TextTest.java?rev=1173282&r1=1173281&r2=1173282&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr-commons/src/test/java/org/apache/jackrabbit/util/TextTest.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr-commons/src/test/java/org/apache/jackrabbit/util/TextTest.java
Tue Sep 20 18:04:07 2011
@@ -16,12 +16,12 @@
  */
 package org.apache.jackrabbit.util;
 
-import junit.framework.TestCase;
-
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 
+import junit.framework.TestCase;
+
 /**
  * Test cases for the Text utility class.
  */
@@ -143,16 +143,16 @@ public class TextTest extends TestCase {
         String escaped = testString
             .replaceAll("%", "%25")
             .replaceAll(" ", "%20");
-        String unescaped = Text.urlDecode(escaped);
+        String unescaped = Text.unescape(escaped);
         assertEquals(testString, unescaped);
 
-        escaped = Text.urlEncode(testString);
-        unescaped = Text.urlDecode(escaped);
+        escaped = Text.escape(testString);
+        unescaped = Text.unescape(escaped);
         assertEquals(testString, unescaped);
 
-        assertEquals("%", Text.urlDecode("%25"));
-        assertEquals("", Text.urlDecode(""));
-        assertEquals("\u4e2d\u56fd\u7684\u7f51\u9875", Text.urlDecode("\u4e2d\u56fd\u7684\u7f51\u9875"));
+        assertEquals("%", Text.unescape("%25"));
+        assertEquals("", Text.unescape(""));
+        assertEquals("\u4e2d\u56fd\u7684\u7f51\u9875", Text.unescape("\u4e2d\u56fd\u7684\u7f51\u9875"));
     }
 
     /**
@@ -175,7 +175,7 @@ public class TextTest extends TestCase {
 
     private void assertInvalidUnescape(String string) {
         try {
-            Text.urlDecode(string);
+            Text.unescape(string);
             fail("Text.unescape(" + string + ") should throw IllegalArgumentException");
         } catch (IllegalArgumentException expected) {
         } catch (RuntimeException unexpected) {

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/MoveTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/MoveTest.java?rev=1173282&r1=1173281&r2=1173282&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/MoveTest.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/MoveTest.java
Tue Sep 20 18:04:07 2011
@@ -28,7 +28,7 @@ import javax.jcr.Repository;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 
-import org.apache.jackrabbit.commons.JcrConstants;
+import org.apache.jackrabbit.JcrConstants;
 import org.apache.jackrabbit.commons.JcrUtils;
 import org.apache.jackrabbit.test.NotExecutableException;
 import org.slf4j.Logger;

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/xml/SessionImportTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/xml/SessionImportTest.java?rev=1173282&r1=1173281&r2=1173282&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/xml/SessionImportTest.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/xml/SessionImportTest.java
Tue Sep 20 18:04:07 2011
@@ -16,13 +16,12 @@
  */
 package org.apache.jackrabbit.jcr2spi.xml;
 
-import org.apache.jackrabbit.commons.JcrConstants;
-import org.apache.jackrabbit.spi.Name;
-import org.apache.jackrabbit.test.AbstractJCRTest;
-import org.apache.jackrabbit.test.NotExecutableException;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.AttributesImpl;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Arrays;
+import java.util.List;
+import java.util.UUID;
 
 import javax.jcr.ImportUUIDBehavior;
 import javax.jcr.Item;
@@ -34,12 +33,14 @@ import javax.jcr.Session;
 import javax.jcr.nodetype.ConstraintViolationException;
 import javax.jcr.nodetype.NodeType;
 import javax.jcr.nodetype.NodeTypeIterator;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Arrays;
-import java.util.List;
-import java.util.UUID;
+
+import org.apache.jackrabbit.JcrConstants;
+import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.test.AbstractJCRTest;
+import org.apache.jackrabbit.test.NotExecutableException;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.AttributesImpl;
 
 /**
  * <code>SessionImportTest</code>...

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/identifier/AbstractIdFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/identifier/AbstractIdFactory.java?rev=1173282&r1=1173281&r2=1173282&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/identifier/AbstractIdFactory.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/identifier/AbstractIdFactory.java
Tue Sep 20 18:04:07 2011
@@ -85,7 +85,7 @@ public abstract class AbstractIdFactory 
             return DELIMITER + path.toString();
         } else {
             StringBuilder bf = new StringBuilder();
-            bf.append(Text.urlEncode(uniqueId, DELIMITER));
+            bf.append(Text.escape(uniqueId, DELIMITER));
             bf.append(DELIMITER);
             bf.append(path.toString());
             return bf.toString();
@@ -105,7 +105,7 @@ public abstract class AbstractIdFactory 
             case 0:
                 return createNodeId((String) null, getPathFactory().create(jcrIdentifier.substring(1)));
             default:
-                String uniqueId = Text.urlDecode(jcrIdentifier.substring(0, pos), DELIMITER);
+                String uniqueId = Text.unescape(jcrIdentifier.substring(0, pos), DELIMITER);
                 Path path = getPathFactory().create(jcrIdentifier.substring(pos+1));
                 return createNodeId(uniqueId, path);
         }        

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/CommitMessage.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/CommitMessage.java?rev=1173282&r1=1173281&r2=1173282&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/CommitMessage.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/CommitMessage.java
Tue Sep 20 18:04:07 2011
@@ -2,7 +2,7 @@ package org.apache.jackrabbit.spi2microk
 
 
 import org.apache.jackrabbit.spi.commons.util.Unchecked;
-import org.apache.jackrabbit.util.Text;
+import org.apache.jackrabbit.spi2microkernel.util.Text;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 



Mime
View raw message