jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r553411 - in /jackrabbit/trunk/contrib/jackrabbit-spi-xml/src/main/java/org/apache/jackrabbit/spi/xml: XMLNodeId.java XMLNodeInfo.java XMLPropertyIdIterator.java XMLRepositoryService.java nodetype/XMLQNodeTypeDefinitionIterator.java
Date Thu, 05 Jul 2007 08:14:20 GMT
Author: angela
Date: Thu Jul  5 01:14:19 2007
New Revision: 553411

URL: http://svn.apache.org/viewvc?view=rev&rev=553411
Log:
JCR-1001 SPI: prefer 'Iterator' instead of specialized subclasses

Removed:
    jackrabbit/trunk/contrib/jackrabbit-spi-xml/src/main/java/org/apache/jackrabbit/spi/xml/nodetype/XMLQNodeTypeDefinitionIterator.java
Modified:
    jackrabbit/trunk/contrib/jackrabbit-spi-xml/src/main/java/org/apache/jackrabbit/spi/xml/XMLNodeId.java
    jackrabbit/trunk/contrib/jackrabbit-spi-xml/src/main/java/org/apache/jackrabbit/spi/xml/XMLNodeInfo.java
    jackrabbit/trunk/contrib/jackrabbit-spi-xml/src/main/java/org/apache/jackrabbit/spi/xml/XMLPropertyIdIterator.java
    jackrabbit/trunk/contrib/jackrabbit-spi-xml/src/main/java/org/apache/jackrabbit/spi/xml/XMLRepositoryService.java

Modified: jackrabbit/trunk/contrib/jackrabbit-spi-xml/src/main/java/org/apache/jackrabbit/spi/xml/XMLNodeId.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-spi-xml/src/main/java/org/apache/jackrabbit/spi/xml/XMLNodeId.java?view=diff&rev=553411&r1=553410&r2=553411
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-spi-xml/src/main/java/org/apache/jackrabbit/spi/xml/XMLNodeId.java
(original)
+++ jackrabbit/trunk/contrib/jackrabbit-spi-xml/src/main/java/org/apache/jackrabbit/spi/xml/XMLNodeId.java
Thu Jul  5 01:14:19 2007
@@ -24,7 +24,6 @@
 import org.apache.jackrabbit.name.Path;
 import org.apache.jackrabbit.name.QName;
 import org.apache.jackrabbit.spi.ChildInfo;
-import org.apache.jackrabbit.spi.IdIterator;
 import org.apache.jackrabbit.spi.NodeId;
 import org.apache.jackrabbit.spi.PropertyId;
 import org.w3c.dom.NamedNodeMap;
@@ -48,7 +47,7 @@
         }
     }
 
-    public IdIterator getPropertyIds() {
+    public Iterator getPropertyIds() {
         return new XMLPropertyIdIterator(
                 new XMLPrimaryTypeId(this), node.getAttributes());
     }

Modified: jackrabbit/trunk/contrib/jackrabbit-spi-xml/src/main/java/org/apache/jackrabbit/spi/xml/XMLNodeInfo.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-spi-xml/src/main/java/org/apache/jackrabbit/spi/xml/XMLNodeInfo.java?view=diff&rev=553411&r1=553410&r2=553411
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-spi-xml/src/main/java/org/apache/jackrabbit/spi/xml/XMLNodeInfo.java
(original)
+++ jackrabbit/trunk/contrib/jackrabbit-spi-xml/src/main/java/org/apache/jackrabbit/spi/xml/XMLNodeInfo.java
Thu Jul  5 01:14:19 2007
@@ -17,11 +17,12 @@
 package org.apache.jackrabbit.spi.xml;
 
 import org.apache.jackrabbit.name.QName;
-import org.apache.jackrabbit.spi.IdIterator;
 import org.apache.jackrabbit.spi.NodeId;
 import org.apache.jackrabbit.spi.NodeInfo;
 import org.apache.jackrabbit.spi.PropertyId;
 
+import java.util.Iterator;
+
 public class XMLNodeInfo extends XMLItemInfo implements NodeInfo {
 
     public XMLNodeInfo(XMLNodeId id) {
@@ -46,7 +47,7 @@
         return QName.NT_UNSTRUCTURED;
     }
 
-    public IdIterator getPropertyIds() {
+    public Iterator getPropertyIds() {
         return id.getPropertyIds();
     }
 

Modified: jackrabbit/trunk/contrib/jackrabbit-spi-xml/src/main/java/org/apache/jackrabbit/spi/xml/XMLPropertyIdIterator.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-spi-xml/src/main/java/org/apache/jackrabbit/spi/xml/XMLPropertyIdIterator.java?view=diff&rev=553411&r1=553410&r2=553411
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-spi-xml/src/main/java/org/apache/jackrabbit/spi/xml/XMLPropertyIdIterator.java
(original)
+++ jackrabbit/trunk/contrib/jackrabbit-spi-xml/src/main/java/org/apache/jackrabbit/spi/xml/XMLPropertyIdIterator.java
Thu Jul  5 01:14:19 2007
@@ -17,12 +17,12 @@
 package org.apache.jackrabbit.spi.xml;
 
 import java.util.NoSuchElementException;
+import java.util.Iterator;
 
-import org.apache.jackrabbit.spi.IdIterator;
 import org.apache.jackrabbit.spi.ItemId;
 import org.w3c.dom.NamedNodeMap;
 
-public class XMLPropertyIdIterator implements IdIterator {
+public class XMLPropertyIdIterator implements Iterator {
 
     private final ItemId primary;
 
@@ -36,25 +36,11 @@
         this.index = -1;
     }
 
-    //----------------------------------------------------------< IdIterator >
-
-    public ItemId nextId() {
-        if (hasNext()) {
-            if (++index == 0) {
-                return primary;
-            } else {
-                return new XMLNodeId(nodes.item(index));
-            }
-        } else {
-            throw new NoSuchElementException();
-        }
-    }
-
-    public long getPosition() {
+    private long getPosition() {
         return index + 1;
     }
 
-    public long getSize() {
+    private long getSize() {
         if (nodes != null) {
             return nodes.getLength() + 1;
         } else {
@@ -62,22 +48,24 @@
         }
     }
 
-    public void skip(long n) {
-        while (n-- > 0) {
-            next();
-        }
-    }
-
+    //--------------------------------------------------------------< Iterator >
     public boolean hasNext() {
         return getPosition() < getSize();
     }
 
     public Object next() {
-        return nextId();
+        if (hasNext()) {
+            if (++index == 0) {
+                return primary;
+            } else {
+                return new XMLNodeId(nodes.item(index));
+            }
+        } else {
+            throw new NoSuchElementException();
+        }
     }
 
     public void remove() {
         throw new UnsupportedOperationException();
     }
-
 }

Modified: jackrabbit/trunk/contrib/jackrabbit-spi-xml/src/main/java/org/apache/jackrabbit/spi/xml/XMLRepositoryService.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/jackrabbit-spi-xml/src/main/java/org/apache/jackrabbit/spi/xml/XMLRepositoryService.java?view=diff&rev=553411&r1=553410&r2=553411
==============================================================================
--- jackrabbit/trunk/contrib/jackrabbit-spi-xml/src/main/java/org/apache/jackrabbit/spi/xml/XMLRepositoryService.java
(original)
+++ jackrabbit/trunk/contrib/jackrabbit-spi-xml/src/main/java/org/apache/jackrabbit/spi/xml/XMLRepositoryService.java
Thu Jul  5 01:14:19 2007
@@ -23,6 +23,7 @@
 import java.util.Map;
 import java.util.Set;
 import java.util.Collections;
+import java.util.Arrays;
 
 import javax.jcr.AccessDeniedException;
 import javax.jcr.Credentials;
@@ -51,7 +52,6 @@
 import org.apache.jackrabbit.spi.EventBundle;
 import org.apache.jackrabbit.spi.EventFilter;
 import org.apache.jackrabbit.spi.IdFactory;
-import org.apache.jackrabbit.spi.IdIterator;
 import org.apache.jackrabbit.spi.ItemId;
 import org.apache.jackrabbit.spi.LockInfo;
 import org.apache.jackrabbit.spi.NodeId;
@@ -60,13 +60,11 @@
 import org.apache.jackrabbit.spi.PropertyInfo;
 import org.apache.jackrabbit.spi.QNodeDefinition;
 import org.apache.jackrabbit.spi.QNodeTypeDefinition;
-import org.apache.jackrabbit.spi.QNodeTypeDefinitionIterator;
 import org.apache.jackrabbit.spi.QPropertyDefinition;
 import org.apache.jackrabbit.spi.QValueFactory;
 import org.apache.jackrabbit.spi.QueryInfo;
 import org.apache.jackrabbit.spi.RepositoryService;
 import org.apache.jackrabbit.spi.SessionInfo;
-import org.apache.jackrabbit.spi.xml.nodetype.XMLQNodeTypeDefinitionIterator;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.NamedNodeMap;
@@ -226,9 +224,9 @@
         return null;
     }
 
-    public QNodeTypeDefinitionIterator getNodeTypeDefinitions(
+    public Iterator getNodeTypeDefinitions(
             SessionInfo session) {
-        return new XMLQNodeTypeDefinitionIterator(types);
+        return Arrays.asList(types).iterator();
     }
 
     public NodeId getRootId(SessionInfo session) {
@@ -475,7 +473,7 @@
     /* (non-Javadoc)
      * @see org.apache.jackrabbit.spi.RepositoryService#merge(org.apache.jackrabbit.spi.SessionInfo,
org.apache.jackrabbit.spi.NodeId, java.lang.String, boolean)
      */
-    public IdIterator merge(SessionInfo sessionInfo, NodeId nodeId,
+    public Iterator merge(SessionInfo sessionInfo, NodeId nodeId,
             String srcWorkspaceName, boolean bestEffort)
             throws NoSuchWorkspaceException, AccessDeniedException,
             MergeException, LockException, InvalidItemStateException,



Mime
View raw message