jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r365458 [2/2] - in /incubator/jackrabbit/trunk/contrib/jcr-rmi: ./ src/java/org/apache/jackrabbit/rmi/client/ src/java/org/apache/jackrabbit/rmi/client/iterator/ src/java/org/apache/jackrabbit/rmi/iterator/ src/java/org/apache/jackrabbit/rm...
Date Mon, 02 Jan 2006 23:19:30 GMT
Modified: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerAdapterFactory.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerAdapterFactory.java?rev=365458&r1=365457&r2=365458&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerAdapterFactory.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerAdapterFactory.java Mon Jan  2 15:18:30 2006
@@ -23,7 +23,9 @@
 import javax.jcr.Item;
 import javax.jcr.NamespaceRegistry;
 import javax.jcr.Node;
+import javax.jcr.NodeIterator;
 import javax.jcr.Property;
+import javax.jcr.PropertyIterator;
 import javax.jcr.Repository;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
@@ -32,6 +34,7 @@
 import javax.jcr.nodetype.ItemDefinition;
 import javax.jcr.nodetype.NodeDefinition;
 import javax.jcr.nodetype.NodeType;
+import javax.jcr.nodetype.NodeTypeIterator;
 import javax.jcr.nodetype.NodeTypeManager;
 import javax.jcr.nodetype.PropertyDefinition;
 import javax.jcr.observation.Event;
@@ -41,12 +44,17 @@
 import javax.jcr.query.QueryManager;
 import javax.jcr.query.QueryResult;
 import javax.jcr.query.Row;
+import javax.jcr.query.RowIterator;
 import javax.jcr.version.Version;
 import javax.jcr.version.VersionHistory;
+import javax.jcr.version.VersionIterator;
 
+import org.apache.jackrabbit.rmi.remote.ArrayIterator;
+import org.apache.jackrabbit.rmi.remote.BufferIterator;
 import org.apache.jackrabbit.rmi.remote.RemoteEventCollection;
 import org.apache.jackrabbit.rmi.remote.RemoteItem;
 import org.apache.jackrabbit.rmi.remote.RemoteItemDefinition;
+import org.apache.jackrabbit.rmi.remote.RemoteIterator;
 import org.apache.jackrabbit.rmi.remote.RemoteLock;
 import org.apache.jackrabbit.rmi.remote.RemoteNamespaceRegistry;
 import org.apache.jackrabbit.rmi.remote.RemoteNode;
@@ -65,6 +73,11 @@
 import org.apache.jackrabbit.rmi.remote.RemoteVersion;
 import org.apache.jackrabbit.rmi.remote.RemoteVersionHistory;
 import org.apache.jackrabbit.rmi.remote.RemoteWorkspace;
+import org.apache.jackrabbit.rmi.server.iterator.ServerNodeIterator;
+import org.apache.jackrabbit.rmi.server.iterator.ServerNodeTypeIterator;
+import org.apache.jackrabbit.rmi.server.iterator.ServerPropertyIterator;
+import org.apache.jackrabbit.rmi.server.iterator.ServerRowIterator;
+import org.apache.jackrabbit.rmi.server.iterator.ServerVersionIterator;
 
 /**
  * Default implementation of the
@@ -79,6 +92,11 @@
 public class ServerAdapterFactory implements RemoteAdapterFactory {
 
     /**
+     * The default maximum buffer size used for local iterator buffers.
+     */
+    private static final int MAX_BUFFER_SIZE = 100;
+
+    /**
      * Creates a {@link ServerRepository ServerRepository} instance.
      * {@inheritDoc}
      */
@@ -282,4 +300,78 @@
 
         return new ServerEventCollection(listenerId, remoteEvents);
     }
+
+    /**
+     * Optimizes the given remote iterator for transmission across the
+     * network. This method retrieves the first set of elements from
+     * the iterator by calling {@link RemoteIterator#nextObjects()} and
+     * then asks for the total size of the iterator. If the size is unkown
+     * or greater than the length of the retrieved array, then the elements,
+     * the size, and the remote iterator reference are wrapped into a
+     * {@link BufferIterator} instance that gets passed over the network.
+     * If the retrieved array of elements contains all the elements in the
+     * iterator, then the iterator instance is discarded and just the elements
+     * are wrapped into a {@link ArrayIterator} instance to be passed to the
+     * client.
+     *
+     * @param remote remote iterator
+     * @return optimized remote iterator
+     * @throws RemoteException on RMI errors
+     */
+    private RemoteIterator optimizeIterator(RemoteIterator remote)
+            throws RemoteException {
+        Object[] elements = remote.nextObjects();
+        long size = remote.getSize();
+        if (size == -1 || (elements != null && size > elements.length)) {
+            return new BufferIterator(elements, size, remote);
+        } else {
+            return new ArrayIterator(elements);
+        }
+    }
+
+    /**
+     * Creates a {@link ServerNodeIterator} instance. {@inheritDoc}
+     */
+    public RemoteIterator getRemoteNodeIterator(NodeIterator iterator)
+            throws RemoteException {
+        return optimizeIterator(
+                new ServerNodeIterator(iterator, this, MAX_BUFFER_SIZE));
+    }
+
+    /**
+     * Creates a {@link ServerPropertyIterator} instance. {@inheritDoc}
+     */
+    public RemoteIterator getRemotePropertyIterator(PropertyIterator iterator)
+            throws RemoteException {
+        return optimizeIterator(
+                new ServerPropertyIterator(iterator, this, MAX_BUFFER_SIZE));
+    }
+
+    /**
+     * Creates a {@link ServerVersionIterator} instance. {@inheritDoc}
+     */
+    public RemoteIterator getRemoteVersionIterator(VersionIterator iterator)
+            throws RemoteException {
+        return optimizeIterator(
+                new ServerVersionIterator(iterator, this, MAX_BUFFER_SIZE));
+    }
+
+    /**
+     * Creates a {@link ServerNodeTypeIterator} instance. {@inheritDoc}
+     */
+    public RemoteIterator getRemoteNodeTypeIterator(NodeTypeIterator iterator)
+            throws RemoteException {
+        return optimizeIterator(
+                new ServerNodeTypeIterator(iterator, this, MAX_BUFFER_SIZE));
+    }
+
+    /**
+     * Creates a {@link ServerRowIterator} instance. {@inheritDoc}
+     */
+    public RemoteIterator getRemoteRowIterator(RowIterator iterator)
+            throws RemoteException {
+        return optimizeIterator(
+                new ServerRowIterator(iterator, this, MAX_BUFFER_SIZE));
+    }
+
 }

Modified: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerNode.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerNode.java?rev=365458&r1=365457&r2=365458&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerNode.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerNode.java Mon Jan  2 15:18:30 2006
@@ -27,6 +27,7 @@
 import javax.jcr.version.Version;
 
 import org.apache.jackrabbit.rmi.remote.RemoteItem;
+import org.apache.jackrabbit.rmi.remote.RemoteIterator;
 import org.apache.jackrabbit.rmi.remote.RemoteLock;
 import org.apache.jackrabbit.rmi.remote.RemoteNode;
 import org.apache.jackrabbit.rmi.remote.RemoteNodeDefinition;
@@ -94,10 +95,10 @@
     }
 
     /** {@inheritDoc} */
-    public RemoteProperty[] getProperties()
+    public RemoteIterator getProperties()
             throws RepositoryException, RemoteException {
         try {
-            return getRemotePropertyArray(node.getProperties());
+            return getFactory().getRemotePropertyIterator(node.getProperties());
         } catch (RepositoryException ex) {
             throw getRepositoryException(ex);
         }
@@ -114,20 +115,20 @@
     }
 
     /** {@inheritDoc} */
-    public RemoteProperty[] getProperties(String pattern)
+    public RemoteIterator getProperties(String pattern)
             throws RepositoryException, RemoteException {
         try {
-            return getRemotePropertyArray(node.getProperties(pattern));
+            return getFactory().getRemotePropertyIterator(node.getProperties(pattern));
         } catch (RepositoryException ex) {
             throw getRepositoryException(ex);
         }
     }
 
     /** {@inheritDoc} */
-    public RemoteProperty[] getReferences()
+    public RemoteIterator getReferences()
             throws RepositoryException, RemoteException {
         try {
-            return getRemotePropertyArray(node.getReferences());
+            return getFactory().getRemotePropertyIterator(node.getReferences());
         } catch (RepositoryException ex) {
             throw getRepositoryException(ex);
         }
@@ -201,19 +202,19 @@
     }
 
     /** {@inheritDoc} */
-    public RemoteNode[] getNodes() throws RepositoryException, RemoteException {
+    public RemoteIterator getNodes() throws RepositoryException, RemoteException {
         try {
-            return getRemoteNodeArray(node.getNodes());
+            return getFactory().getRemoteNodeIterator(node.getNodes());
         } catch (RepositoryException ex) {
             throw getRepositoryException(ex);
         }
     }
 
     /** {@inheritDoc} */
-    public RemoteNode[] getNodes(String pattern)
+    public RemoteIterator getNodes(String pattern)
             throws RepositoryException, RemoteException {
         try {
-            return getRemoteNodeArray(node.getNodes(pattern));
+            return getFactory().getRemoteNodeIterator(node.getNodes(pattern));
         } catch (RepositoryException ex) {
             throw getRepositoryException(ex);
         }
@@ -358,10 +359,10 @@
     }
 
     /** {@inheritDoc} */
-    public RemoteNode[] merge(String workspace, boolean bestEffort)
+    public RemoteIterator merge(String workspace, boolean bestEffort)
             throws RepositoryException, RemoteException {
         try {
-            return getRemoteNodeArray(node.merge(workspace, bestEffort));
+            return getFactory().getRemoteNodeIterator(node.merge(workspace, bestEffort));
         } catch (RepositoryException ex) {
             throw getRepositoryException(ex);
         }

Modified: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerNodeType.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerNodeType.java?rev=365458&r1=365457&r2=365458&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerNodeType.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerNodeType.java Mon Jan  2 15:18:30 2006
@@ -19,6 +19,7 @@
 import java.rmi.RemoteException;
 
 import javax.jcr.Value;
+import javax.jcr.nodetype.NodeDefinition;
 import javax.jcr.nodetype.NodeType;
 import javax.jcr.nodetype.PropertyDefinition;
 
@@ -54,6 +55,57 @@
         super(factory);
         this.type = type;
     }
+
+    /**
+     * Utility method for creating an array of remote references for
+     * local node definitions. The remote references are created using the
+     * remote adapter factory.
+     * <p>
+     * A <code>null</code> input is treated as an empty array.
+     *
+     * @param defs local node definition array
+     * @return remote node definition array
+     * @throws RemoteException on RMI errors
+     */
+    private RemoteNodeDefinition[] getRemoteNodeDefArray(NodeDefinition[] defs)
+            throws RemoteException {
+        if (defs != null) {
+            RemoteNodeDefinition[] remotes =
+                new RemoteNodeDefinition[defs.length];
+            for (int i = 0; i < defs.length; i++) {
+                remotes[i] = getFactory().getRemoteNodeDefinition(defs[i]);
+            }
+            return remotes;
+        } else {
+            return new RemoteNodeDefinition[0]; // for safety
+        }
+    }
+
+    /**
+     * Utility method for creating an array of remote references for
+     * local property definitions. The remote references are created using the
+     * remote adapter factory.
+     * <p>
+     * A <code>null</code> input is treated as an empty array.
+     *
+     * @param defs local property definition array
+     * @return remote property definition array
+     * @throws RemoteException on RMI errors
+     */
+    private RemotePropertyDefinition[] getRemotePropertyDefArray(
+            PropertyDefinition[] defs) throws RemoteException {
+        if (defs != null) {
+            RemotePropertyDefinition[] remotes =
+                new RemotePropertyDefinition[defs.length];
+            for (int i = 0; i < defs.length; i++) {
+                remotes[i] = getFactory().getRemotePropertyDefinition(defs[i]);
+            }
+            return remotes;
+        } else {
+            return new RemotePropertyDefinition[0]; // for safety
+        }
+    }
+
 
     /** {@inheritDoc} */
     public String getName() throws RemoteException {

Modified: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerNodeTypeManager.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerNodeTypeManager.java?rev=365458&r1=365457&r2=365458&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerNodeTypeManager.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerNodeTypeManager.java Mon Jan  2 15:18:30 2006
@@ -21,6 +21,7 @@
 import javax.jcr.RepositoryException;
 import javax.jcr.nodetype.NodeTypeManager;
 
+import org.apache.jackrabbit.rmi.remote.RemoteIterator;
 import org.apache.jackrabbit.rmi.remote.RemoteNodeType;
 import org.apache.jackrabbit.rmi.remote.RemoteNodeTypeManager;
 
@@ -67,30 +68,33 @@
     }
 
     /** {@inheritDoc} */
-    public RemoteNodeType[] getAllNodeTypes()
+    public RemoteIterator getAllNodeTypes()
             throws RepositoryException, RemoteException {
         try {
-            return getRemoteNodeTypeArray(manager.getAllNodeTypes());
+            return getFactory().getRemoteNodeTypeIterator(
+                    manager.getAllNodeTypes());
         } catch (RepositoryException ex) {
             throw getRepositoryException(ex);
         }
     }
 
     /** {@inheritDoc} */
-    public RemoteNodeType[] getPrimaryNodeTypes()
+    public RemoteIterator getPrimaryNodeTypes()
             throws RepositoryException, RemoteException {
         try {
-            return getRemoteNodeTypeArray(manager.getPrimaryNodeTypes());
+            return getFactory().getRemoteNodeTypeIterator(
+                    manager.getPrimaryNodeTypes());
         } catch (RepositoryException ex) {
             throw getRepositoryException(ex);
         }
     }
 
     /** {@inheritDoc} */
-    public RemoteNodeType[] getMixinNodeTypes()
+    public RemoteIterator getMixinNodeTypes()
             throws RepositoryException, RemoteException {
         try {
-            return getRemoteNodeTypeArray(manager.getMixinNodeTypes());
+            return getFactory().getRemoteNodeTypeIterator(
+                    manager.getMixinNodeTypes());
         } catch (RepositoryException ex) {
             throw getRepositoryException(ex);
         }

Modified: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerObject.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerObject.java?rev=365458&r1=365457&r2=365458&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerObject.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerObject.java Mon Jan  2 15:18:30 2006
@@ -18,7 +18,6 @@
 
 import java.rmi.RemoteException;
 import java.rmi.server.UnicastRemoteObject;
-import java.util.ArrayList;
 
 import javax.jcr.AccessDeniedException;
 import javax.jcr.InvalidItemStateException;
@@ -31,10 +30,8 @@
 import javax.jcr.NamespaceException;
 import javax.jcr.NoSuchWorkspaceException;
 import javax.jcr.Node;
-import javax.jcr.NodeIterator;
 import javax.jcr.PathNotFoundException;
 import javax.jcr.Property;
-import javax.jcr.PropertyIterator;
 import javax.jcr.ReferentialIntegrityException;
 import javax.jcr.RepositoryException;
 import javax.jcr.UnsupportedRepositoryOperationException;
@@ -43,31 +40,19 @@
 import javax.jcr.nodetype.ConstraintViolationException;
 import javax.jcr.nodetype.NoSuchNodeTypeException;
 import javax.jcr.nodetype.NodeType;
-import javax.jcr.nodetype.NodeTypeIterator;
-import javax.jcr.nodetype.PropertyDefinition;
-import javax.jcr.nodetype.NodeDefinition;
 import javax.jcr.query.InvalidQueryException;
-import javax.jcr.query.RowIterator;
 import javax.jcr.version.Version;
 import javax.jcr.version.VersionException;
 import javax.jcr.version.VersionHistory;
-import javax.jcr.version.VersionIterator;
 
 import org.apache.jackrabbit.rmi.remote.RemoteItem;
 import org.apache.jackrabbit.rmi.remote.RemoteNode;
-import org.apache.jackrabbit.rmi.remote.RemoteNodeDefinition;
 import org.apache.jackrabbit.rmi.remote.RemoteNodeType;
-import org.apache.jackrabbit.rmi.remote.RemoteProperty;
-import org.apache.jackrabbit.rmi.remote.RemotePropertyDefinition;
-import org.apache.jackrabbit.rmi.remote.RemoteRow;
-import org.apache.jackrabbit.rmi.remote.RemoteVersion;
 
 /**
  * Base class for remote adapters. The purpose of this class is to
  * centralize the handling of the RemoteAdapterFactory instance used
  * to instantiate new server adapters.
- *
- * @author Jukka Zitting
  */
 public class ServerObject extends UnicastRemoteObject {
 
@@ -199,102 +184,6 @@
 
     /**
      * Utility method for creating an array of remote references for
-     * local properties. The remote references are created using the
-     * remote adapter factory.
-     * <p>
-     * A <code>null</code> input is treated as an empty iterator.
-     *
-     * @param iterator local property iterator
-     * @return remote property array
-     * @throws RemoteException on RMI errors
-     */
-    protected RemoteProperty[] getRemotePropertyArray(PropertyIterator iterator)
-            throws RemoteException {
-        if (iterator != null) {
-            ArrayList remotes = new ArrayList();
-            while (iterator.hasNext()) {
-                remotes.add(factory.getRemoteProperty(iterator.nextProperty()));
-            }
-            return (RemoteProperty[]) remotes.toArray(new RemoteProperty[remotes.size()]);
-        } else {
-            return new RemoteProperty[0]; // for safety
-        }
-    }
-
-    /**
-     * Utility method for creating an array of remote references for
-     * local nodes. The remote references are created using the
-     * remote adapter factory.
-     * <p>
-     * A <code>null</code> input is treated as an empty iterator.
-     *
-     * @param iterator local node iterator
-     * @return remote node array
-     * @throws RemoteException on RMI errors
-     */
-    protected RemoteNode[] getRemoteNodeArray(NodeIterator iterator)
-            throws RemoteException {
-        if (iterator != null) {
-            ArrayList remotes = new ArrayList();
-            while (iterator.hasNext()) {
-                remotes.add(getRemoteNode(iterator.nextNode()));
-            }
-            return (RemoteNode[]) remotes.toArray(new RemoteNode[remotes.size()]);
-        } else {
-            return new RemoteNode[0]; // for safety
-        }
-    }
-
-    /**
-     * Utility method for creating an array of remote references for
-     * local versions. The remote references are created using the
-     * remote adapter factory.
-     * <p>
-     * A <code>null</code> input is treated as an empty array.
-     *
-     * @param versions local version array
-     * @return remote version array
-     * @throws RemoteException on RMI errors
-     */
-    protected RemoteVersion[] getRemoteVersionArray(Version[] versions)
-            throws RemoteException {
-        if (versions != null) {
-            RemoteVersion[] remotes = new RemoteVersion[versions.length];
-            for (int i = 0; i < remotes.length; i++) {
-                remotes[i] = factory.getRemoteVersion(versions[i]);
-            }
-            return remotes;
-        } else {
-            return new RemoteVersion[0]; // for safety
-        }
-    }
-
-    /**
-     * Utility method for creating an array of remote references for
-     * local versions. The remote references are created using the
-     * remote adapter factory.
-     * <p>
-     * A <code>null</code> input is treated as an empty iterator.
-     *
-     * @param iterator local version iterator
-     * @return remote version array
-     * @throws RemoteException on RMI errors
-     */
-    protected RemoteVersion[] getRemoteVersionArray(VersionIterator iterator)
-            throws RemoteException {
-        if (iterator != null) {
-            ArrayList remotes = new ArrayList();
-            while (iterator.hasNext()) {
-                remotes.add(factory.getRemoteVersion(iterator.nextVersion()));
-            }
-            return (RemoteVersion[]) remotes.toArray(new RemoteVersion[remotes.size()]);
-        } else {
-            return new RemoteVersion[0]; // for safety
-        }
-    }
-
-    /**
-     * Utility method for creating an array of remote references for
      * local node types. The remote references are created using the
      * remote adapter factory.
      * <p>
@@ -314,102 +203,6 @@
             return remotes;
         } else {
             return new RemoteNodeType[0]; // for safety
-        }
-    }
-
-    /**
-     * Utility method for creating an array of remote references for
-     * local node types. The remote references are created using the
-     * remote adapter factory.
-     * <p>
-     * A <code>null</code> input is treated as an empty iterator.
-     *
-     * @param iterator local node type iterator
-     * @return remote node type array
-     * @throws RemoteException on RMI errors
-     */
-    protected RemoteNodeType[] getRemoteNodeTypeArray(NodeTypeIterator iterator)
-            throws RemoteException {
-        if (iterator != null) {
-            ArrayList remotes = new ArrayList();
-            while (iterator.hasNext()) {
-                remotes.add(factory.getRemoteNodeType(iterator.nextNodeType()));
-            }
-            return (RemoteNodeType[]) remotes.toArray(new RemoteNodeType[remotes.size()]);
-        } else {
-            return new RemoteNodeType[0]; // for safety
-        }
-    }
-
-    /**
-     * Utility method for creating an array of remote references for
-     * local node definitions. The remote references are created using the
-     * remote adapter factory.
-     * <p>
-     * A <code>null</code> input is treated as an empty array.
-     *
-     * @param defs local node definition array
-     * @return remote node definition array
-     * @throws RemoteException on RMI errors
-     */
-    protected RemoteNodeDefinition[] getRemoteNodeDefArray(NodeDefinition[] defs)
-            throws RemoteException {
-        if (defs != null) {
-            RemoteNodeDefinition[] remotes = new RemoteNodeDefinition[defs.length];
-            for (int i = 0; i < defs.length; i++) {
-                remotes[i] = factory.getRemoteNodeDefinition(defs[i]);
-            }
-            return remotes;
-        } else {
-            return new RemoteNodeDefinition[0]; // for safety
-        }
-    }
-
-    /**
-     * Utility method for creating an array of remote references for
-     * local property definitions. The remote references are created using the
-     * remote adapter factory.
-     * <p>
-     * A <code>null</code> input is treated as an empty array.
-     *
-     * @param defs local property definition array
-     * @return remote property definition array
-     * @throws RemoteException on RMI errors
-     */
-    protected RemotePropertyDefinition[] getRemotePropertyDefArray(PropertyDefinition[] defs)
-            throws RemoteException {
-        if (defs != null) {
-            RemotePropertyDefinition[] remotes = new RemotePropertyDefinition[defs.length];
-            for (int i = 0; i < defs.length; i++) {
-                remotes[i] = factory.getRemotePropertyDefinition(defs[i]);
-            }
-            return remotes;
-        } else {
-            return new RemotePropertyDefinition[0]; // for safety
-        }
-    }
-
-    /**
-     * Utility method for creating an array of remote references for
-     * local query result rows. The remote references are created using the
-     * remote adapter factory.
-     * <p>
-     * A <code>null</code> input is treated as an empty iterator.
-     *
-     * @param iterator local query result row iterator
-     * @return remote query result row array
-     * @throws RemoteException on RMI errors
-     */
-    protected RemoteRow[] getRemoteRowArray(RowIterator iterator)
-            throws RemoteException {
-        if (iterator != null) {
-            ArrayList remotes = new ArrayList();
-            while (iterator.hasNext()) {
-                remotes.add(getFactory().getRemoteRow(iterator.nextRow()));
-            }
-            return (RemoteRow[]) remotes.toArray(new RemoteRow[remotes.size()]);
-        } else {
-            return new RemoteRow[0]; // for safety
         }
     }
 

Modified: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerQueryResult.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerQueryResult.java?rev=365458&r1=365457&r2=365458&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerQueryResult.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerQueryResult.java Mon Jan  2 15:18:30 2006
@@ -21,9 +21,8 @@
 import javax.jcr.RepositoryException;
 import javax.jcr.query.QueryResult;
 
-import org.apache.jackrabbit.rmi.remote.RemoteNode;
+import org.apache.jackrabbit.rmi.remote.RemoteIterator;
 import org.apache.jackrabbit.rmi.remote.RemoteQueryResult;
-import org.apache.jackrabbit.rmi.remote.RemoteRow;
 
 /**
  * Remote adapter for the JCR {@link javax.jcr.query.QueryResult QueryResult} interface.
@@ -61,13 +60,13 @@
     }
 
     /** {@inheritDoc} */
-    public RemoteRow[] getRows() throws RepositoryException, RemoteException {
-        return getRemoteRowArray(result.getRows());
+    public RemoteIterator getRows() throws RepositoryException, RemoteException {
+        return getFactory().getRemoteRowIterator(result.getRows());
     }
 
     /** {@inheritDoc} */
-    public RemoteNode[] getNodes() throws RepositoryException, RemoteException {
-        return getRemoteNodeArray(result.getNodes());
+    public RemoteIterator getNodes() throws RepositoryException, RemoteException {
+        return getFactory().getRemoteNodeIterator(result.getNodes());
     }
 
 }

Modified: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerVersion.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerVersion.java?rev=365458&r1=365457&r2=365458&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerVersion.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerVersion.java Mon Jan  2 15:18:30 2006
@@ -53,6 +53,30 @@
         this.version = version;
     }
 
+    /**
+     * Utility method for creating an array of remote references for
+     * local versions. The remote references are created using the
+     * remote adapter factory.
+     * <p>
+     * A <code>null</code> input is treated as an empty array.
+     *
+     * @param versions local version array
+     * @return remote version array
+     * @throws RemoteException on RMI errors
+     */
+    private RemoteVersion[] getRemoteVersionArray(Version[] versions)
+            throws RemoteException {
+        if (versions != null) {
+            RemoteVersion[] remotes = new RemoteVersion[versions.length];
+            for (int i = 0; i < remotes.length; i++) {
+                remotes[i] = getFactory().getRemoteVersion(versions[i]);
+            }
+            return remotes;
+        } else {
+            return new RemoteVersion[0]; // for safety
+        }
+    }
+
 //  This is only available after 0.16.2
 //    /** {@inheritDoc} */
 //    public RemoteVersionHistory getContainingHistory() throws RepositoryException {

Modified: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerVersionHistory.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerVersionHistory.java?rev=365458&r1=365457&r2=365458&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerVersionHistory.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerVersionHistory.java Mon Jan  2 15:18:30 2006
@@ -22,6 +22,7 @@
 import javax.jcr.version.Version;
 import javax.jcr.version.VersionHistory;
 
+import org.apache.jackrabbit.rmi.remote.RemoteIterator;
 import org.apache.jackrabbit.rmi.remote.RemoteVersion;
 import org.apache.jackrabbit.rmi.remote.RemoteVersionHistory;
 
@@ -56,16 +57,6 @@
     }
 
     /** {@inheritDoc} */
-//    public String getVersionableUUID()
-//            throws RepositoryException, RemoteException {
-//        try {
-//            return versionHistory.getVersionableUUID();
-//        } catch (RepositoryException ex) {
-//            throw getRepositoryException(ex);
-//        }
-//    }
-
-    /** {@inheritDoc} */
     public RemoteVersion getRootVersion()
             throws RepositoryException, RemoteException {
         try {
@@ -76,10 +67,11 @@
     }
 
     /** {@inheritDoc} */
-    public RemoteVersion[] getAllVersions()
+    public RemoteIterator getAllVersions()
             throws RepositoryException, RemoteException {
         try {
-            return getRemoteVersionArray(versionHistory.getAllVersions());
+            return getFactory().getRemoteVersionIterator(
+                    versionHistory.getAllVersions());
         } catch (RepositoryException ex) {
             throw getRepositoryException(ex);
         }

Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/iterator/ServerIterator.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/iterator/ServerIterator.java?rev=365458&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/iterator/ServerIterator.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/iterator/ServerIterator.java Mon Jan  2 15:18:30 2006
@@ -0,0 +1,143 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ *                     as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.server.iterator;
+
+import java.rmi.RemoteException;
+import java.util.ArrayList;
+import java.util.NoSuchElementException;
+
+import javax.jcr.RangeIterator;
+
+import org.apache.jackrabbit.rmi.remote.RemoteIterator;
+import org.apache.jackrabbit.rmi.server.RemoteAdapterFactory;
+import org.apache.jackrabbit.rmi.server.ServerObject;
+
+
+/**
+ * Remote adapter for the JCR {@link RangeIterator} interface. This
+ * class makes a local iterator available as an RMI service using teh
+ * {@link RemoteIterator} interface.
+ */
+public abstract class ServerIterator extends ServerObject
+        implements RemoteIterator {
+
+    /** The adapted local iterator. */
+    private final RangeIterator iterator;
+
+    /** The maximum number of elements to send per request. */
+    private final int maxBufferSize;
+
+    /**
+     * The cached number of elements in the iterator, -1 if the iterator
+     * size is unknown, or -2 if the size has not been retrieved from the
+     * adapted local iterator. This variable is useful in cases when the
+     * underlying iterator does not know its sizes (getSize() returns -1)
+     * but we reach the end of the iterator in a nextObjects() call and
+     * can thus determine the size of the iterator.
+     */
+    private long size;
+
+    /**
+     * Creates a remote adapter for the given local item.
+     *
+     * @param iterator      local iterator to be adapted
+     * @param factory       remote adapter factory
+     * @param maxBufferSize maximum buffer size
+     * @throws RemoteException on RMI errors
+     */
+    public ServerIterator(
+            RangeIterator iterator, RemoteAdapterFactory factory,
+            int maxBufferSize) throws RemoteException {
+        super(factory);
+        this.iterator = iterator;
+        this.maxBufferSize = maxBufferSize;
+        this.size = -2;
+    }
+
+    /**
+     * Returns the size of the iterator. The size is cached by invoking the
+     * adapted local iterator when this method is first called or by
+     * determining the size from an end-of-iterator condition in nextObjects().
+     *
+     * @return size of the iterator
+     * @throws RemoteException on RMI errors
+     * @see RemoteIterator#getSize()
+     * @see RangeIterator#getSize()
+     */
+    public long getSize() throws RemoteException {
+        if (size == -2) {
+            size = iterator.getSize();
+        }
+        return size;
+    }
+
+    /**
+     * Skips the given number of elements.
+     *
+     * @param items number of elements to skip
+     * @throws NoSuchElementException if skipped past the last element
+     * @throws RemoteException on RMI errors
+     */
+    public void skip(long items)
+            throws NoSuchElementException, RemoteException {
+        try {
+            iterator.skip(items);
+        } catch (NoSuchElementException e) {
+            throw new NoSuchElementException(e.getMessage());
+        }
+    }
+
+    /**
+     * Returns a remote adapter for the given local object. This abstract
+     * method is used by {@link #nextObjects(int)} to convert the local
+     * objects to remote references to be sent to the client.
+     * <p>
+     * Subclasses should implement this method to use the remote adapter
+     * factory to create remote adapters of the specific element type.
+     *
+     * @param object local object
+     * @return remote adapter
+     * @throws RemoteException on RMI errors
+     */
+    protected abstract Object getRemoteObject(Object object)
+            throws RemoteException;
+
+    /**
+     * Returns an array of remote references to the next elements in this
+     * iteration.
+     *
+     * @return array of remote references, or <code>null</code>
+     * @throws RemoteException on RMI errors
+     * @see RemoteIterator#nextObjects(int)
+     * @see java.util.Iterator#next()
+     */
+    public Object[] nextObjects() throws RemoteException {
+        if (!iterator.hasNext()) {
+            return null;
+        } else {
+            ArrayList items = new ArrayList();
+            while (items.size() < maxBufferSize && iterator.hasNext()) {
+                items.add(getRemoteObject(iterator.next()));
+            }
+            if (!iterator.hasNext()) {
+                size = iterator.getPosition();
+            }
+            return items.toArray();
+        }
+    }
+
+}

Propchange: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/iterator/ServerIterator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/iterator/ServerNodeIterator.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/iterator/ServerNodeIterator.java?rev=365458&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/iterator/ServerNodeIterator.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/iterator/ServerNodeIterator.java Mon Jan  2 15:18:30 2006
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ *                     as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.server.iterator;
+
+import java.rmi.RemoteException;
+
+import javax.jcr.Node;
+import javax.jcr.NodeIterator;
+
+import org.apache.jackrabbit.rmi.server.RemoteAdapterFactory;
+
+/**
+ * A ServerIterator for iterating nodes.
+ */
+public class ServerNodeIterator extends ServerIterator {
+
+    /**
+     * Creates a ServerNodeIterator instance.
+     *
+     * @param iterator      local node iterator
+     * @param factory       remote adapter factory
+     * @param maxBufferSize maximum size of the element buffer
+     * @throws RemoteException on RMI errors
+     */
+    public ServerNodeIterator(
+            NodeIterator iterator, RemoteAdapterFactory factory,
+            int maxBufferSize) throws RemoteException {
+        super(iterator, factory, maxBufferSize);
+    }
+
+    /**
+     * Creates and returns a remote adapter for the given node.
+     *
+     * @param object local object
+     * @return remote adapter
+     * @throws RemoteException on RMI errors
+     * @see ServerIterator#getRemoteObject(Object)
+     */
+    protected Object getRemoteObject(Object object) throws RemoteException {
+        return getRemoteNode((Node) object);
+    }
+
+}

Propchange: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/iterator/ServerNodeIterator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/iterator/ServerNodeTypeIterator.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/iterator/ServerNodeTypeIterator.java?rev=365458&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/iterator/ServerNodeTypeIterator.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/iterator/ServerNodeTypeIterator.java Mon Jan  2 15:18:30 2006
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ *                     as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.server.iterator;
+
+import java.rmi.RemoteException;
+
+import javax.jcr.nodetype.NodeType;
+import javax.jcr.nodetype.NodeTypeIterator;
+
+import org.apache.jackrabbit.rmi.server.RemoteAdapterFactory;
+
+/**
+ * A ServerIterator for iterating node types.
+ */
+public class ServerNodeTypeIterator extends ServerIterator {
+
+    /**
+     * Creates a ServerNodeTypeIterator instance.
+     *
+     * @param iterator      local node type iterator
+     * @param factory       remote adapter factory
+     * @param maxBufferSize maximum size of the element buffer
+     * @throws RemoteException on RMI errors
+     */
+    public ServerNodeTypeIterator(
+            NodeTypeIterator iterator, RemoteAdapterFactory factory,
+            int maxBufferSize) throws RemoteException {
+        super(iterator, factory, maxBufferSize);
+    }
+
+    /**
+     * Creates and returns a remote adapter for the given node type.
+     *
+     * @param object local object
+     * @return remote adapter
+     * @throws RemoteException on RMI errors
+     * @see ServerIterator#getRemoteObject(Object)
+     */
+    protected Object getRemoteObject(Object object) throws RemoteException {
+        return getFactory().getRemoteNodeType((NodeType) object);
+    }
+
+}

Propchange: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/iterator/ServerNodeTypeIterator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/iterator/ServerPropertyIterator.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/iterator/ServerPropertyIterator.java?rev=365458&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/iterator/ServerPropertyIterator.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/iterator/ServerPropertyIterator.java Mon Jan  2 15:18:30 2006
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ *                     as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.server.iterator;
+
+import java.rmi.RemoteException;
+
+import javax.jcr.Property;
+import javax.jcr.PropertyIterator;
+
+import org.apache.jackrabbit.rmi.server.RemoteAdapterFactory;
+
+/**
+ * A ServerIterator for iterating properties.
+ */
+public class ServerPropertyIterator extends ServerIterator {
+
+    /**
+     * Creates a ServerPropertyIterator instance.
+     *
+     * @param iterator      local property iterator
+     * @param factory       remote adapter factory
+     * @param maxBufferSize maximum size of the element buffer
+     * @throws RemoteException on RMI errors
+     */
+    public ServerPropertyIterator(
+            PropertyIterator iterator, RemoteAdapterFactory factory,
+            int maxBufferSize) throws RemoteException {
+        super(iterator, factory, maxBufferSize);
+    }
+
+    /**
+     * Creates and returns a remote adapter for the given property.
+     *
+     * @param object local object
+     * @return remote adapter
+     * @throws RemoteException on RMI errors
+     * @see ServerIterator#getRemoteObject(Object)
+     */
+    protected Object getRemoteObject(Object object) throws RemoteException {
+        return getFactory().getRemoteProperty((Property) object);
+    }
+
+}

Propchange: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/iterator/ServerPropertyIterator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/iterator/ServerRowIterator.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/iterator/ServerRowIterator.java?rev=365458&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/iterator/ServerRowIterator.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/iterator/ServerRowIterator.java Mon Jan  2 15:18:30 2006
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ *                     as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.server.iterator;
+
+import java.rmi.RemoteException;
+
+import javax.jcr.query.Row;
+import javax.jcr.query.RowIterator;
+
+import org.apache.jackrabbit.rmi.server.RemoteAdapterFactory;
+
+/**
+ * A ServerIterator for iterating rows.
+ */
+public class ServerRowIterator extends ServerIterator {
+
+    /**
+     * Creates a ServerRowIterator instance.
+     *
+     * @param iterator      local row iterator
+     * @param factory       remote adapter factory
+     * @param maxBufferSize maximum size of the element buffer
+     * @throws RemoteException on RMI errors
+     */
+    public ServerRowIterator(
+            RowIterator iterator, RemoteAdapterFactory factory,
+            int maxBufferSize) throws RemoteException {
+        super(iterator, factory, maxBufferSize);
+    }
+
+    /**
+     * Creates and returns a remote adapter for the given row.
+     *
+     * @param object local object
+     * @return remote adapter
+     * @throws RemoteException on RMI errors
+     * @see ServerIterator#getRemoteObject(Object)
+     */
+    protected Object getRemoteObject(Object object) throws RemoteException {
+        return getFactory().getRemoteRow((Row) object);
+    }
+
+}

Propchange: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/iterator/ServerRowIterator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/iterator/ServerVersionIterator.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/iterator/ServerVersionIterator.java?rev=365458&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/iterator/ServerVersionIterator.java (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/iterator/ServerVersionIterator.java Mon Jan  2 15:18:30 2006
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ *                     as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.rmi.server.iterator;
+
+import java.rmi.RemoteException;
+
+import javax.jcr.version.Version;
+import javax.jcr.version.VersionIterator;
+
+import org.apache.jackrabbit.rmi.server.RemoteAdapterFactory;
+
+/**
+ * A ServerIterator for iterating versions.
+ */
+public class ServerVersionIterator extends ServerIterator {
+
+    /**
+     * Creates a ServerVersionIterator instance.
+     *
+     * @param iterator      local version iterator
+     * @param factory       remote adapter factory
+     * @param maxBufferSize maximum size of the element buffer
+     * @throws RemoteException on RMI errors
+     */
+    public ServerVersionIterator(
+            VersionIterator iterator, RemoteAdapterFactory factory,
+            int maxBufferSize) throws RemoteException {
+        super(iterator, factory, maxBufferSize);
+    }
+
+    /**
+     * Creates and returns a remote adapter for the given version..
+     *
+     * @param object local object
+     * @return remote adapter
+     * @throws RemoteException on RMI errors
+     * @see ServerIterator#getRemoteObject(Object)
+     */
+    protected Object getRemoteObject(Object object) throws RemoteException {
+        return getFactory().getRemoteVersion((Version) object);
+    }
+
+}

Propchange: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/iterator/ServerVersionIterator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/iterator/package.html
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/iterator/package.html?rev=365458&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/iterator/package.html (added)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/iterator/package.html Mon Jan  2 15:18:30 2006
@@ -0,0 +1,3 @@
+<body>
+Remote adapters for local iterators.
+</body>

Propchange: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/iterator/package.html
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteAdapterTest.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteAdapterTest.java?rev=365458&r1=365457&r2=365458&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteAdapterTest.java (original)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/test/org/apache/jackrabbit/test/rmi/RemoteAdapterTest.java Mon Jan  2 15:18:30 2006
@@ -261,6 +261,10 @@
         ignoreMethod("getVersionHistory");        // TODO
         ignoreMethod("getBaseVersion");           // TODO
         ignoreMethod("setProperty");              // multiple methods
+        ignoreMethod("getNodes");                 // null iterator
+        ignoreMethod("getProperties");            // null iterator
+        ignoreMethod("getReferences");            // null iterator
+        ignoreMethod("merge");                    // null iterator
 
         Node node = (Node) mock;
         RemoteNode remote = remoteFactory.getRemoteNode(node);
@@ -353,6 +357,9 @@
      */
     public void testNodeTypeManager() throws Exception {
         prepareTests(NodeTypeManager.class);
+        ignoreMethod("getAllNodeTypes");     // null iterator
+        ignoreMethod("getPrimaryNodeTypes"); // null iterator
+        ignoreMethod("getMixinNodeTypes");   // null iterator
 
         NodeTypeManager manager = (NodeTypeManager) mock;
         RemoteNodeTypeManager remote =
@@ -461,6 +468,8 @@
      */
     public void testQueryResult() throws Exception {
         prepareTests(QueryResult.class);
+        ignoreMethod("getNodes"); // null iterator
+        ignoreMethod("getRows");  // null iterator
 
         QueryResult result = (QueryResult) mock;
         RemoteQueryResult remote = remoteFactory.getRemoteQueryResult(result);
@@ -509,6 +518,7 @@
         prepareTests(VersionHistory.class);
         ignoreMethod("getVersionLabels"); // UUID call
         ignoreMethod("hasVersionLabel");  // UUID call
+        ignoreMethod("getAllVersions");   // null iterator
 
         VersionHistory history = (VersionHistory) mock;
         RemoteVersionHistory remote =



Mime
View raw message