jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1409171 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak: plugins/index/old/PrefixContentIndex.java plugins/index/old/PropertyContentIndex.java spi/query/Cursor.java spi/query/Cursors.java
Date Wed, 14 Nov 2012 11:47:49 GMT
Author: thomasm
Date: Wed Nov 14 11:47:48 2012
New Revision: 1409171

URL: http://svn.apache.org/viewvc?rev=1409171&view=rev
Log:
OAK-423 Query: org.apache.jackrabbit.oak.spi.query.Cursor.currentRow called too late - refactor
the Cursor interface to extend Iterator<IndexRow>

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/old/PrefixContentIndex.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/old/PropertyContentIndex.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/query/Cursor.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/query/Cursors.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/old/PrefixContentIndex.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/old/PrefixContentIndex.java?rev=1409171&r1=1409170&r2=1409171&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/old/PrefixContentIndex.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/old/PrefixContentIndex.java
Wed Nov 14 11:47:48 2012
@@ -30,6 +30,7 @@ import org.apache.jackrabbit.oak.spi.que
 import org.apache.jackrabbit.oak.spi.query.Filter;
 import org.apache.jackrabbit.oak.spi.query.IndexRow;
 import org.apache.jackrabbit.oak.spi.query.QueryIndex;
+import org.apache.jackrabbit.oak.spi.query.Cursors.AbstractCursor;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 
 /**
@@ -108,7 +109,7 @@ public class PrefixContentIndex implemen
     /**
      * The cursor to for this index.
      */
-    static class ContentCursor implements Cursor {
+    static class ContentCursor extends AbstractCursor {
 
         private final Iterator<String> it;
 

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/old/PropertyContentIndex.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/old/PropertyContentIndex.java?rev=1409171&r1=1409170&r2=1409171&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/old/PropertyContentIndex.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/old/PropertyContentIndex.java
Wed Nov 14 11:47:48 2012
@@ -27,6 +27,7 @@ import org.apache.jackrabbit.oak.spi.que
 import org.apache.jackrabbit.oak.spi.query.Filter;
 import org.apache.jackrabbit.oak.spi.query.IndexRow;
 import org.apache.jackrabbit.oak.spi.query.QueryIndex;
+import org.apache.jackrabbit.oak.spi.query.Cursors.AbstractCursor;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 
 /**
@@ -88,7 +89,7 @@ public class PropertyContentIndex implem
     /**
      * The cursor to for this index.
      */
-    static class ContentCursor implements Cursor {
+    static class ContentCursor extends AbstractCursor {
 
         private final Iterator<String> it;
 

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/query/Cursor.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/query/Cursor.java?rev=1409171&r1=1409170&r2=1409171&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/query/Cursor.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/query/Cursor.java
Wed Nov 14 11:47:48 2012
@@ -18,10 +18,12 @@
  */
 package org.apache.jackrabbit.oak.spi.query;
 
+import java.util.Iterator;
+
 /**
  * A cursor to read a number of nodes sequentially.
  */
-public interface Cursor {
+public interface Cursor extends Iterator<IndexRow> {
 
     /**
      * The next row within this index.
@@ -46,8 +48,7 @@ public interface Cursor {
      * 
      * @return the row
      */
+    @Override
     IndexRow next();
     
-    boolean hasNext();
-
 }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/query/Cursors.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/query/Cursors.java?rev=1409171&r1=1409170&r2=1409171&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/query/Cursors.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/query/Cursors.java
Wed Nov 14 11:47:48 2012
@@ -65,12 +65,25 @@ public class Cursors {
                                              NodeState root) {
         return new TraversingCursor(filter, root);
     }
+    
+    /**
+     * A Cursor implementation where the remove method throws an
+     * UnsupportedOperationException.
+     */
+    public abstract static class AbstractCursor implements Cursor {
+        
+        @Override
+        public void remove() {
+            throw new UnsupportedOperationException();
+        }
+        
+    }
 
     /**
      * <code>PathCursor</code> implements a simple {@link Cursor} that iterates
      * over a {@link String} based path {@link Iterable}.
      */
-    private static class PathCursor implements Cursor {
+    private static class PathCursor extends AbstractCursor {
 
         private final Iterator<String> iterator;
 
@@ -95,7 +108,7 @@ public class Cursors {
     /**
      * A cursor that reads all nodes in a given subtree.
      */
-    private static class TraversingCursor implements Cursor {
+    private static class TraversingCursor extends AbstractCursor {
 
         private static final Logger LOG = LoggerFactory.getLogger(TraversingIndex.class);
 



Mime
View raw message