jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: r1338749 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/mk/index/ oak-core/src/main/java/org/apache/jackrabbit/mk/simple/ oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/ oak-core/src/test/java/org/apache/j...
Date Tue, 15 May 2012 15:23:35 GMT
Author: stefan
Date: Tue May 15 15:23:34 2012
New Revision: 1338749

URL: http://svn.apache.org/viewvc?rev=1338749&view=rev
Log:
OAK-75: specify format and semantics of 'filter' parameter in MicroKernel API (WIP)

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/index/IndexWrapper.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/simple/SimpleKernelImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/LogWrapper.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/MicroKernelWrapper.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/MicroKernelWrapperBase.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/SecurityWrapper.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/VirtualRepositoryWrapper.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/mk/MoveNodeIT.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/mk/concurrent/ConcurrentTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/mk/simple/MoveNodeIT.java
    jackrabbit/oak/trunk/oak-it/mk/src/main/java/org/apache/jackrabbit/mk/test/MicroKernelIT.java
    jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/api/MicroKernel.java
    jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/client/Client.java
    jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/core/MicroKernelImpl.java
    jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/server/MicroKernelServlet.java
    jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/concurrent/ConcurrentTest.java
    jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/store/DefaultRevisionStoreTest.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/index/IndexWrapper.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/index/IndexWrapper.java?rev=1338749&r1=1338748&r2=1338749&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/index/IndexWrapper.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/index/IndexWrapper.java
Tue May 15 15:23:34 2012
@@ -234,13 +234,13 @@ public class IndexWrapper extends MicroK
     }
 
     @Override
-    public JsopReader diffStream(String fromRevisionId, String toRevisionId, String filter)
{
-        return mk.diffStream(fromRevisionId, toRevisionId, filter);
+    public JsopReader diffStream(String fromRevisionId, String toRevisionId, String path)
{
+        return mk.diffStream(fromRevisionId, toRevisionId, path);
     }
 
     @Override
-    public JsopReader getJournalStream(String fromRevisionId, String toRevisionId, String
filter) {
-        return mk.getJournalStream(fromRevisionId, toRevisionId, filter);
+    public JsopReader getJournalStream(String fromRevisionId, String toRevisionId, String
path) {
+        return mk.getJournalStream(fromRevisionId, toRevisionId, path);
     }
 
     @Override
@@ -249,8 +249,8 @@ public class IndexWrapper extends MicroK
     }
 
     @Override
-    public JsopReader getRevisionsStream(long since, int maxEntries) {
-        return mk.getRevisionsStream(since, maxEntries);
+    public JsopReader getRevisionsStream(long since, int maxEntries, String path) {
+        return mk.getRevisionsStream(since, maxEntries, path);
     }
 
     @Override

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/simple/SimpleKernelImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/simple/SimpleKernelImpl.java?rev=1338749&r1=1338748&r2=1338749&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/simple/SimpleKernelImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/simple/SimpleKernelImpl.java
Tue May 15 15:23:34 2012
@@ -342,7 +342,7 @@ public class SimpleKernelImpl extends Mi
     }
 
     @Override
-    public JsopReader getRevisionsStream(long since, int maxEntries) {
+    public JsopReader getRevisionsStream(long since, int maxEntries, String path) {
         NodeImpl node = getRoot();
         long sinceNanos = since * 1000000;
         ArrayList<Revision> revisions = new ArrayList<Revision>();
@@ -386,7 +386,7 @@ public class SimpleKernelImpl extends Mi
     }
 
     @Override
-    public JsopReader getJournalStream(String fromRevisionId, String toRevisionId, String
filter) {
+    public JsopReader getJournalStream(String fromRevisionId, String toRevisionId, String
path) {
         fromRevisionId = fromRevisionId == null ? headRevision : fromRevisionId;
         toRevisionId = toRevisionId == null ? headRevision : toRevisionId;
 
@@ -454,7 +454,7 @@ public class SimpleKernelImpl extends Mi
 
 
     @Override
-    public JsopReader diffStream(String fromRevisionId, String toRevisionId, String filter)
{
+    public JsopReader diffStream(String fromRevisionId, String toRevisionId, String path)
{
         fromRevisionId = fromRevisionId == null ? headRevision : fromRevisionId;
         toRevisionId = toRevisionId == null ? headRevision : toRevisionId;
         // TODO implement if required

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/LogWrapper.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/LogWrapper.java?rev=1338749&r1=1338748&r2=1338749&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/LogWrapper.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/LogWrapper.java
Tue May 15 15:23:34 2012
@@ -76,10 +76,10 @@ public class LogWrapper implements Micro
     }
 
     @Override
-    public String getJournal(String fromRevisionId, String toRevisionId, String filter) {
+    public String getJournal(String fromRevisionId, String toRevisionId, String path) {
         try {
             logMethod("getJournal", fromRevisionId, toRevisionId);
-            String result = mk.getJournal(fromRevisionId, toRevisionId, filter);
+            String result = mk.getJournal(fromRevisionId, toRevisionId, path);
             logResult(result);
             return result;
         } catch (Exception e) {
@@ -89,10 +89,10 @@ public class LogWrapper implements Micro
     }
 
     @Override
-    public String diff(String fromRevisionId, String toRevisionId, String filter) {
+    public String diff(String fromRevisionId, String toRevisionId, String path) {
         try {
-            logMethod("diff", fromRevisionId, toRevisionId, filter);
-            String result = mk.diff(fromRevisionId, toRevisionId, filter);
+            logMethod("diff", fromRevisionId, toRevisionId, path);
+            String result = mk.diff(fromRevisionId, toRevisionId, path);
             logResult(result);
             return result;
         } catch (Exception e) {
@@ -141,10 +141,10 @@ public class LogWrapper implements Micro
     }
 
     @Override
-    public String getRevisionHistory(long since, int maxEntries) {
+    public String getRevisionHistory(long since, int maxEntries, String path) {
         try {
-            logMethod("getRevisionHistory", since, maxEntries);
-            String result = mk.getRevisionHistory(since, maxEntries);
+            logMethod("getRevisionHistory", since, maxEntries, path);
+            String result = mk.getRevisionHistory(since, maxEntries, path);
             logResult(result);
             return result;
         } catch (Exception e) {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/MicroKernelWrapper.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/MicroKernelWrapper.java?rev=1338749&r1=1338748&r2=1338749&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/MicroKernelWrapper.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/MicroKernelWrapper.java
Tue May 15 15:23:34 2012
@@ -26,9 +26,9 @@ import org.apache.jackrabbit.mk.json.Jso
  */
 public interface MicroKernelWrapper extends MicroKernel {
 
-    JsopReader getRevisionsStream(long since, int maxEntries) throws MicroKernelException;
+    JsopReader getRevisionsStream(long since, int maxEntries, String path) throws MicroKernelException;
 
-    JsopReader getJournalStream(String fromRevisionId, String toRevisionId, String filter)
throws MicroKernelException;
+    JsopReader getJournalStream(String fromRevisionId, String toRevisionId, String path)
throws MicroKernelException;
 
     JsopReader getNodesStream(String path, String revisionId) throws MicroKernelException;
 
@@ -36,6 +36,6 @@ public interface MicroKernelWrapper exte
 
     String commitStream(String path, JsopReader jsonDiff, String revisionId, String message)
throws MicroKernelException;
 
-    JsopReader diffStream(String fromRevisionId, String toRevisionId, String filter);
+    JsopReader diffStream(String fromRevisionId, String toRevisionId, String path);
 
 }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/MicroKernelWrapperBase.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/MicroKernelWrapperBase.java?rev=1338749&r1=1338748&r2=1338749&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/MicroKernelWrapperBase.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/MicroKernelWrapperBase.java
Tue May 15 15:23:34 2012
@@ -34,8 +34,8 @@ public abstract class MicroKernelWrapper
     }
 
     @Override
-    public final String getJournal(String fromRevisionId, String toRevisionId, String filter)
{
-        return getJournalStream(fromRevisionId, toRevisionId, filter).toString();
+    public final String getJournal(String fromRevisionId, String toRevisionId, String path)
{
+        return getJournalStream(fromRevisionId, toRevisionId, path).toString();
     }
 
     @Override
@@ -60,13 +60,13 @@ public abstract class MicroKernelWrapper
     }
 
     @Override
-    public final String diff(String fromRevisionId, String toRevisionId, String filter) {
-        return diffStream(fromRevisionId, toRevisionId, filter).toString();
+    public final String diff(String fromRevisionId, String toRevisionId, String path) {
+        return diffStream(fromRevisionId, toRevisionId, path).toString();
     }
 
     @Override
-    public final String getRevisionHistory(long since, int maxEntries) {
-        return getRevisionsStream(since, maxEntries).toString();
+    public final String getRevisionHistory(long since, int maxEntries, String path) {
+        return getRevisionsStream(since, maxEntries, path).toString();
     }
 
     /**
@@ -90,8 +90,8 @@ public abstract class MicroKernelWrapper
             }
 
             @Override
-            public JsopReader getJournalStream(String fromRevisionId, String toRevisionId,
String filter) {
-                return new JsopTokenizer(wrapped.getJournal(fromRevisionId, toRevisionId,
filter));
+            public JsopReader getJournalStream(String fromRevisionId, String toRevisionId,
String path) {
+                return new JsopTokenizer(wrapped.getJournal(fromRevisionId, toRevisionId,
path));
             }
 
             @Override
@@ -116,8 +116,8 @@ public abstract class MicroKernelWrapper
             }
 
             @Override
-            public JsopReader getRevisionsStream(long since, int maxEntries) {
-                return new JsopTokenizer(wrapped.getRevisionHistory(since, maxEntries));
+            public JsopReader getRevisionsStream(long since, int maxEntries, String path)
{
+                return new JsopTokenizer(wrapped.getRevisionHistory(since, maxEntries, path));
             }
 
             @Override
@@ -156,8 +156,8 @@ public abstract class MicroKernelWrapper
             }
 
             @Override
-            public String getJournal(String fromRevisionId, String toRevisionId, String filter)
{
-                return wrapped.getJournal(fromRevisionId, toRevisionId, filter);
+            public String getJournal(String fromRevisionId, String toRevisionId, String path)
{
+                return wrapped.getJournal(fromRevisionId, toRevisionId, path);
             }
 
             @Override
@@ -176,8 +176,8 @@ public abstract class MicroKernelWrapper
             }
 
             @Override
-            public String getRevisionHistory(long since, int maxEntries) {
-                return wrapped.getRevisionHistory(since, maxEntries);
+            public String getRevisionHistory(long since, int maxEntries, String path) {
+                return wrapped.getRevisionHistory(since, maxEntries, path);
             }
 
             @Override

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/SecurityWrapper.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/SecurityWrapper.java?rev=1338749&r1=1338748&r2=1338749&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/SecurityWrapper.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/SecurityWrapper.java
Tue May 15 15:23:34 2012
@@ -107,9 +107,9 @@ public class SecurityWrapper extends Mic
     }
 
     @Override
-    public JsopReader getJournalStream(String fromRevisionId, String toRevisionId, String
filter) {
+    public JsopReader getJournalStream(String fromRevisionId, String toRevisionId, String
path) {
         rightsRevision = getHeadRevision();
-        JsopReader t = mk.getJournalStream(fromRevisionId, toRevisionId, filter);
+        JsopReader t = mk.getJournalStream(fromRevisionId, toRevisionId, path);
         if (admin) {
             return t;
         }
@@ -315,8 +315,8 @@ public class SecurityWrapper extends Mic
     }
 
     @Override
-    public JsopReader getRevisionsStream(long since, int maxEntries) {
-        return mk.getRevisionsStream(since, maxEntries);
+    public JsopReader getRevisionsStream(long since, int maxEntries, String path) {
+        return mk.getRevisionsStream(since, maxEntries, path);
     }
 
     @Override

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/VirtualRepositoryWrapper.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/VirtualRepositoryWrapper.java?rev=1338749&r1=1338748&r2=1338749&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/VirtualRepositoryWrapper.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/VirtualRepositoryWrapper.java
Tue May 15 15:23:34 2012
@@ -257,8 +257,8 @@ public class VirtualRepositoryWrapper ex
     }
 
     @Override
-    public JsopReader getJournalStream(String fromRevisionId, String toRevisionId, String
filter) {
-        return mk.getJournalStream(fromRevisionId, toRevisionId, filter);
+    public JsopReader getJournalStream(String fromRevisionId, String toRevisionId, String
path) {
+        return mk.getJournalStream(fromRevisionId, toRevisionId, path);
     }
 
     @Override
@@ -298,8 +298,8 @@ public class VirtualRepositoryWrapper ex
     }
 
     @Override
-    public JsopReader getRevisionsStream(long since, int maxEntries) {
-        return mk.getRevisionsStream(since, maxEntries);
+    public JsopReader getRevisionsStream(long since, int maxEntries, String path) {
+        return mk.getRevisionsStream(since, maxEntries, path);
     }
 
     @Override

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/mk/MoveNodeIT.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/mk/MoveNodeIT.java?rev=1338749&r1=1338748&r2=1338749&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/mk/MoveNodeIT.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/mk/MoveNodeIT.java Tue
May 15 15:23:34 2012
@@ -81,7 +81,7 @@ public class MoveNodeIT extends MultiMkT
 
     private String getJournal() {
         if (journalRevision == null) {
-            String revs = mk.getRevisionHistory(0, 1);
+            String revs = mk.getRevisionHistory(0, 1, null);
             JsopTokenizer t = new JsopTokenizer(revs);
             t.read('[');
             do {

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/mk/concurrent/ConcurrentTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/mk/concurrent/ConcurrentTest.java?rev=1338749&r1=1338748&r2=1338749&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/mk/concurrent/ConcurrentTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/mk/concurrent/ConcurrentTest.java
Tue May 15 15:23:34 2012
@@ -42,7 +42,7 @@ public class ConcurrentTest extends Mult
                 String newRev = mk.commit("/", "+\"" + i + "\":{\"x\": " + i + "}", rev,
"");
                 Assert.assertTrue(!newRev.equals(rev));
                 mk.getJournal(rev, newRev, null);
-                mk.getRevisionHistory(start, 100);
+                mk.getRevisionHistory(start, 100, null);
                 mk.getNodes("/" + i, newRev);
                 mk.getNodes("/" + i, newRev, 0, 0, 0, null);
                 Assert.assertFalse(mk.nodeExists("/" + i, rev));

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/mk/simple/MoveNodeIT.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/mk/simple/MoveNodeIT.java?rev=1338749&r1=1338748&r2=1338749&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/mk/simple/MoveNodeIT.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/mk/simple/MoveNodeIT.java
Tue May 15 15:23:34 2012
@@ -260,7 +260,7 @@ public class MoveNodeIT {
 
     private String getJournal() {
         if (journalRevision == null) {
-            String revs = mk.getRevisionHistory(0, 1);
+            String revs = mk.getRevisionHistory(0, 1, null);
             JsopTokenizer t = new JsopTokenizer(revs);
             t.read('[');
             do {

Modified: jackrabbit/oak/trunk/oak-it/mk/src/main/java/org/apache/jackrabbit/mk/test/MicroKernelIT.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-it/mk/src/main/java/org/apache/jackrabbit/mk/test/MicroKernelIT.java?rev=1338749&r1=1338748&r2=1338749&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-it/mk/src/main/java/org/apache/jackrabbit/mk/test/MicroKernelIT.java
(original)
+++ jackrabbit/oak/trunk/oak-it/mk/src/main/java/org/apache/jackrabbit/mk/test/MicroKernelIT.java
Tue May 15 15:23:34 2012
@@ -75,12 +75,12 @@ public class MicroKernelIT extends Abstr
         long now = System.currentTimeMillis();
 
         // get history since 'now'
-        JSONArray array = parseJSONArray(mk.getRevisionHistory(now, -1));
+        JSONArray array = parseJSONArray(mk.getRevisionHistory(now, -1, null));
         // history should be empty since there was no commit since 'now'
         assertEquals(0, array.size());
 
         // get oldest available revision
-        array = parseJSONArray(mk.getRevisionHistory(0, 1));
+        array = parseJSONArray(mk.getRevisionHistory(0, 1, null));
         // there should be exactly 1 revision
         assertEquals(array.size(), 1);
 
@@ -94,7 +94,7 @@ public class MicroKernelIT extends Abstr
         }
 
         // get oldest available revision
-        array = parseJSONArray(mk.getRevisionHistory(ts0, -1));
+        array = parseJSONArray(mk.getRevisionHistory(ts0, -1, null));
         // there should be exactly NUM_COMMITS revisions
         assertEquals(array.size(), NUM_COMMITS);
         long previousTS = ts0;
@@ -143,6 +143,8 @@ public class MicroKernelIT extends Abstr
         array = parseJSONArray(mk.getJournal(toRev, fromRev, ""));
         // there should be exactly 0 entries
         assertEquals(array.size(), 0);
+
+        // TODO test getRevisionHistory/getJournal path filter
     }
 
     @Test
@@ -161,6 +163,8 @@ public class MicroKernelIT extends Abstr
 
         // diff of rev0->rev2 should be empty
         assertEquals(mk.diff(rev0, rev2, null), "");
+
+        // TODO test path filter
     }
 
     @Test
@@ -708,7 +712,7 @@ public class MicroKernelIT extends Abstr
         branchRev = mk.commit("", "+\"/branch/foo\":{}", branchRev, "");
 
         // make sure branchRev doesn't show up in revision history
-        String hist = mk.getRevisionHistory(0, -1);
+        String hist = mk.getRevisionHistory(0, -1, null);
         JSONArray ar = parseJSONArray(hist);
         for (Object entry : ar) {
             assertTrue(entry instanceof JSONObject);

Modified: jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/api/MicroKernel.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/api/MicroKernel.java?rev=1338749&r1=1338748&r2=1338749&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/api/MicroKernel.java
(original)
+++ jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/api/MicroKernel.java
Tue May 15 15:23:34 2012
@@ -77,14 +77,20 @@ public interface MicroKernel {
      *   ...
      * ]
      * </pre>
+     * The {@code path} parameter allows to filter the revisions by path, i.e.
+     * only those revisions that affected the subtree rooted at {@code path}
+     * will be included.
      *
      * @param since      timestamp (ms) of earliest revision to be returned
      * @param maxEntries maximum #entries to be returned;
      *                   if < 0, no limit will be applied.
+     * @param path       optional path filter; if {@code null} or {@code ""} the
+     *                   default ({@code"/"}) will be assumed, i.e. no filter
+     *                   will be applied
      * @return a list of revisions in chronological order in JSON format.
      * @throws MicroKernelException if an error occurs
      */
-    String /* jsonArray */ getRevisionHistory(long since, int maxEntries)
+    String /* jsonArray */ getRevisionHistory(long since, int maxEntries, String path)
             throws MicroKernelException;
 
     /**
@@ -127,6 +133,10 @@ public interface MicroKernel {
      * If {@code fromRevisionId} and {@code toRevisionId} are not in chronological
      * order the returned journal will be empty (i.e. {@code []})
      * <p/>
+     * The {@code path} parameter allows to filter the revisions by path, i.e.
+     * only those revisions that affected the subtree rooted at {@code path}
+     * will be included.
+     * <p/>
      * A {@code MicroKernelException} is thrown if either {@code fromRevisionId}
      * or {@code toRevisionId}  doesn't exist, denotes a <i>private</i> branch
      * revision or if another error occurs.
@@ -134,14 +144,14 @@ public interface MicroKernel {
      * @param fromRevisionId id of first revision to be returned in journal
      * @param toRevisionId   id of last revision to be returned in journal,
      *                       if {@code null} the current head revision is assumed
-     * @param filter         (optional) filter criteria
-     *                       (e.g. path, property names, etc);
-     *                       TODO specify format and semantics
+     * @param path           optional path filter; if {@code null} or {@code ""}
+     *                       the default ({@code"/"}) will be assumed, i.e. no
+     *                       filter will be applied
      * @return a chronological list of revisions in JSON format
      * @throws MicroKernelException if an error occurs
      */
     String /* jsonArray */ getJournal(String fromRevisionId, String toRevisionId,
-                                      String filter)
+                                      String path)
             throws MicroKernelException;
 
     /**
@@ -149,17 +159,21 @@ public interface MicroKernel {
      * revisions. The changes will be consolidated if the specified range
      * covers intermediary revisions. {@code fromRevisionId} and {@code toRevisionId}
      * don't need not be in a specific chronological order.
+     * <p/>
+     * The {@code path} parameter allows to filter the revisions by path, i.e.
+     * only those revisions that affected the subtree rooted at {@code path}
+     * will be included.
      *
      * @param fromRevisionId a revision id, if {@code null} the current head revision is
assumed
      * @param toRevisionId   another revision id, if {@code null} the current head revision
is assumed
-     * @param filter         (optional) filter criteria
-     *                       (e.g. path, property names, etc);
-     *                       TODO specify format and semantics
+     * @param path           optional path filter; if {@code null} or {@code ""}
+     *                       the default ({@code"/"}) will be assumed, i.e. no
+     *                       filter will be applied
      * @return JSON diff representation of the changes
      * @throws MicroKernelException if an error occurs
      */
     String /* JSON diff */ diff(String fromRevisionId, String toRevisionId,
-                                String filter)
+                                String path)
             throws MicroKernelException;
 
     //-------------------------------------------------------------< READ ops >
@@ -250,6 +264,20 @@ public interface MicroKernel {
      * <p/>
      * The {@code offset} and {@code count} parameters are only applied to the
      * direct child nodes of the root of the returned node tree.
+     * <p/>
+     * The {@code filter} parameter allows to specify the names of properties
+     * to be included or excluded.
+     * <p/>
+     * Format:
+     * <pre>
+     * {
+     *   incl: [ "foo", "foo1" ],
+     *   excl: [ "bar", "tmp" ]
+     * }
+     * </pre>
+     * TODO clarify (globbing) syntax, semantics and implicit default filter (OAK-75)
+     * <p/>
+     * For more information see {@link #getNodes(String, String)}.
      *
      * @param path       path denoting root of node tree to be retrieved
      * @param revisionId revision id, if {@code null} the current head revision is assumed
@@ -257,11 +285,11 @@ public interface MicroKernel {
      * @param offset     start position in the iteration order of child nodes (0 to start
at the
      *                   beginning)
      * @param count      maximum number of child nodes to retrieve (-1 for all)
-     * @param filter     (optional) filter criteria
-     *                   (e.g. names of properties to be included, etc);
-     *                   TODO specify format and semantics
+     * @param filter     optional filter on property names; if {@code null} or
+     *                   {@code ""} the default filter will be assumed
      * @return node tree in JSON format or {@code null} if the specified node does not exist
      * @throws MicroKernelException if the specified revision does not exist or if another
error occurs
+     * @see #getNodes(String, String)
      */
     String /* jsonTree */ getNodes(String path, String revisionId, int depth,
                                    long offset, int count, String filter)
@@ -377,4 +405,4 @@ public interface MicroKernel {
      * @throws MicroKernelException if an error occurs
      */
     String /* blobId */ write(InputStream in) throws MicroKernelException;
-}
\ No newline at end of file
+}

Modified: jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/client/Client.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/client/Client.java?rev=1338749&r1=1338748&r2=1338749&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/client/Client.java
(original)
+++ jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/client/Client.java
Tue May 15 15:23:34 2012
@@ -112,7 +112,7 @@ public class Client implements MicroKern
     }
 
     @Override
-    public String getRevisionHistory(long since, int maxEntries)
+    public String getRevisionHistory(long since, int maxEntries, String path)
             throws MicroKernelException {
 
         Request request = null;
@@ -121,6 +121,7 @@ public class Client implements MicroKern
             request = createRequest("getRevisionHistory");
             request.addParameter("since", since);
             request.addParameter("max_entries", maxEntries);
+            request.addParameter("path", path);
             return request.getString();
         } catch (IOException e) {
             throw toMicroKernelException(e);
@@ -148,7 +149,7 @@ public class Client implements MicroKern
     }
 
     @Override
-    public String getJournal(String fromRevisionId, String toRevisionId, String filter)
+    public String getJournal(String fromRevisionId, String toRevisionId, String path)
             throws MicroKernelException {
         
         Request request = null;
@@ -157,7 +158,7 @@ public class Client implements MicroKern
             request = createRequest("getJournal");
             request.addParameter("from_revision_id", fromRevisionId);
             request.addParameter("to_revision_id", toRevisionId);
-            request.addParameter("filter", filter);
+            request.addParameter("path", path);
             return request.getString();
         } catch (IOException e) {
             throw toMicroKernelException(e);
@@ -167,7 +168,7 @@ public class Client implements MicroKern
     }
 
     @Override
-    public String diff(String fromRevisionId, String toRevisionId, String filter)
+    public String diff(String fromRevisionId, String toRevisionId, String path)
             throws MicroKernelException {
         Request request = null;
 
@@ -175,7 +176,7 @@ public class Client implements MicroKern
             request = createRequest("diff");
             request.addParameter("from_revision_id", fromRevisionId);
             request.addParameter("to_revision_id", toRevisionId);
-            request.addParameter("filter", filter);
+            request.addParameter("path", path);
             return request.getString();
         } catch (IOException e) {
             throw toMicroKernelException(e);

Modified: jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/core/MicroKernelImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/core/MicroKernelImpl.java?rev=1338749&r1=1338748&r2=1338749&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/core/MicroKernelImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/core/MicroKernelImpl.java
Tue May 15 15:23:34 2012
@@ -109,10 +109,11 @@ public class MicroKernelImpl implements 
         }
     }
 
-    public String getRevisionHistory(long since, int maxEntries) throws MicroKernelException
{
+    public String getRevisionHistory(long since, int maxEntries, String path) throws MicroKernelException
{
         if (rep == null) {
             throw new IllegalStateException("this instance has already been disposed");
         }
+        // todo support path filter
         maxEntries = maxEntries < 0 ? Integer.MAX_VALUE : maxEntries;
         List<StoredCommit> history = new ArrayList<StoredCommit>();
         try {
@@ -148,11 +149,13 @@ public class MicroKernelImpl implements 
         return gate.waitForCommit(oldHeadRevisionId, maxWaitMillis);
     }
 
-    public String getJournal(String fromRevision, String toRevision, String filter) throws
MicroKernelException {
+    public String getJournal(String fromRevision, String toRevision, String path) throws
MicroKernelException {
         if (rep == null) {
             throw new IllegalStateException("this instance has already been disposed");
         }
 
+        // todo support path filter
+
         Id fromRevisionId = Id.fromString(fromRevision);
         Id toRevisionId = toRevision == null ? getHeadRevisionId() : Id.fromString(toRevision);
 
@@ -218,9 +221,8 @@ public class MicroKernelImpl implements 
         return commitBuff.endArray().toString();
     }
 
-    public String diff(String fromRevision, String toRevision, String filter) throws MicroKernelException
{
-        // TODO extract and evaluate filter criteria (such as e.g. 'path') specified in 'filter'
parameter
-        String path = "/";
+    public String diff(String fromRevision, String toRevision, String path) throws MicroKernelException
{
+        path = (path == null || "".equals(path)) ? "/" : path;
 
         Id fromRevisionId, toRevisionId;
         if (fromRevision == null || toRevision == null) {
@@ -240,7 +242,7 @@ public class MicroKernelImpl implements 
             NodeState before = rep.getNodeState(fromRevisionId, path);
             NodeState after = rep.getNodeState(toRevisionId, path);
 
-            return new DiffBuilder(before, after, path, rep.getRevisionStore(), filter).build();
+            return new DiffBuilder(before, after, path, rep.getRevisionStore(), path).build();
         } catch (Exception e) {
             throw new MicroKernelException(e);
         }

Modified: jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/server/MicroKernelServlet.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/server/MicroKernelServlet.java?rev=1338749&r1=1338748&r2=1338749&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/server/MicroKernelServlet.java
(original)
+++ jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/server/MicroKernelServlet.java
Tue May 15 15:23:34 2012
@@ -108,9 +108,10 @@ class MicroKernelServlet {
 
             long since = request.getParameter("since", 0L);
             int maxEntries = request.getParameter("max_entries", 10);
+            String path = request.getParameter("path", "");
 
             response.setContentType("application/json");
-            String json = mk.getRevisionHistory(since, maxEntries);
+            String json = mk.getRevisionHistory(since, maxEntries, path);
             if (request.getHeaders().containsKey("User-Agent")) {
                 json = JsopBuilder.prettyPrint(json);
             }
@@ -152,10 +153,10 @@ class MicroKernelServlet {
 
             String fromRevisionId = request.getParameter("from_revision_id", headRevision);
             String toRevisionId = request.getParameter("to_revision_id", headRevision);
-            String filter = request.getParameter("filter", "");
+            String path = request.getParameter("path", "");
 
             response.setContentType("application/json");
-            String json = mk.getJournal(fromRevisionId, toRevisionId, filter);
+            String json = mk.getJournal(fromRevisionId, toRevisionId, path);
             if (request.getHeaders().containsKey("User-Agent")) {
                 json = JsopBuilder.prettyPrint(json);
             }
@@ -173,10 +174,10 @@ class MicroKernelServlet {
 
             String fromRevisionId = request.getParameter("from_revision_id", headRevision);
             String toRevisionId = request.getParameter("to_revision_id", headRevision);
-            String filter = request.getParameter("filter", "");
+            String path = request.getParameter("path", "");
 
             response.setContentType("application/json");
-            String json = mk.diff(fromRevisionId, toRevisionId, filter);
+            String json = mk.diff(fromRevisionId, toRevisionId, path);
             if (request.getHeaders().containsKey("User-Agent")) {
                 json = JsopBuilder.prettyPrint(json);
             }

Modified: jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/concurrent/ConcurrentTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/concurrent/ConcurrentTest.java?rev=1338749&r1=1338748&r2=1338749&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/concurrent/ConcurrentTest.java
(original)
+++ jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/concurrent/ConcurrentTest.java
Tue May 15 15:23:34 2012
@@ -39,7 +39,7 @@ public class ConcurrentTest {
                 String newRev = mk.commit("/", "+\"" + i + "\":{\"x\": " + i + "}", rev,
"");
                 Assert.assertTrue(!newRev.equals(rev));
                 mk.getJournal(rev, newRev, null);
-                mk.getRevisionHistory(start, 100);
+                mk.getRevisionHistory(start, 100, null);
                 mk.getNodes("/" + i, newRev);
                 mk.getNodes("/" + i, newRev, 0, 0, 0, null);
                 Assert.assertFalse(mk.nodeExists("/" + i, rev));

Modified: jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/store/DefaultRevisionStoreTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/store/DefaultRevisionStoreTest.java?rev=1338749&r1=1338748&r2=1338749&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/store/DefaultRevisionStoreTest.java
(original)
+++ jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/store/DefaultRevisionStoreTest.java
Tue May 15 15:23:34 2012
@@ -91,7 +91,7 @@ public class DefaultRevisionStoreTest {
         assertEquals(headRevision, mk.getHeadRevision());
         assertEquals(contents, mk.getNodes("/", headRevision));
         
-        String history = mk.getRevisionHistory(Long.MIN_VALUE, Integer.MIN_VALUE);
+        String history = mk.getRevisionHistory(Long.MIN_VALUE, Integer.MIN_VALUE, null);
         assertEquals(1, ((JsopArray) Jsop.parse(history)).size());
     }
 
@@ -115,7 +115,7 @@ public class DefaultRevisionStoreTest {
 
         rs.gc();
 
-        String history = mk.getRevisionHistory(Long.MIN_VALUE, Integer.MIN_VALUE);
+        String history = mk.getRevisionHistory(Long.MIN_VALUE, Integer.MIN_VALUE, null);
         assertEquals(1, ((JsopArray) Jsop.parse(history)).size());
     }
     



Mime
View raw message