jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r155785 - in incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server: RemoteAdapterFactory.java ServerAdapterFactory.java ServerQueryManager.java ServerQueryResult.java
Date Tue, 01 Mar 2005 15:05:14 GMT
Author: jukka
Date: Tue Mar  1 07:05:10 2005
New Revision: 155785

URL: http://svn.apache.org/viewcvs?view=rev&rev=155785
Log:
Added missing factory methods for the new Query adapters.
Better factory javadocs.

Modified:
    incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/RemoteAdapterFactory.java
    incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerAdapterFactory.java
    incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerQueryManager.java
    incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerQueryResult.java

Modified: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/RemoteAdapterFactory.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/RemoteAdapterFactory.java?view=diff&r1=155784&r2=155785
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/RemoteAdapterFactory.java
(original)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/RemoteAdapterFactory.java
Tue Mar  1 07:05:10 2005
@@ -30,7 +30,10 @@
 import javax.jcr.nodetype.NodeType;
 import javax.jcr.nodetype.NodeTypeManager;
 import javax.jcr.nodetype.PropertyDef;
+import javax.jcr.query.Query;
 import javax.jcr.query.QueryManager;
+import javax.jcr.query.QueryResult;
+import javax.jcr.query.Row;
 
 import org.apache.jackrabbit.rmi.remote.RemoteItem;
 import org.apache.jackrabbit.rmi.remote.RemoteLock;
@@ -41,8 +44,11 @@
 import org.apache.jackrabbit.rmi.remote.RemoteNodeTypeManager;
 import org.apache.jackrabbit.rmi.remote.RemoteProperty;
 import org.apache.jackrabbit.rmi.remote.RemotePropertyDef;
+import org.apache.jackrabbit.rmi.remote.RemoteQuery;
 import org.apache.jackrabbit.rmi.remote.RemoteQueryManager;
+import org.apache.jackrabbit.rmi.remote.RemoteQueryResult;
 import org.apache.jackrabbit.rmi.remote.RemoteRepository;
+import org.apache.jackrabbit.rmi.remote.RemoteRow;
 import org.apache.jackrabbit.rmi.remote.RemoteSession;
 import org.apache.jackrabbit.rmi.remote.RemoteWorkspace;
 
@@ -53,11 +59,10 @@
  * modified (for example to add extra features) by changing the
  * remote adapter factory used by the repository server.
  * <p>
- * Note that the
- * {@link org.apache.jackrabbit.rmi.server.ServerObject ServerObject}
- * base class provides a number of utility methods designed to work with
- * a remote adapter factory. Adapter implementations may want to inherit
- * that functionality by subclassing from ServerObject.
+ * Note that the {@link ServerObject ServerObject} base class provides
+ * a number of utility methods designed to work with a remote adapter
+ * factory. Adapter implementations may want to inherit that functionality
+ * by subclassing from ServerObject.
  *
  * @author Jukka Zitting
  * @author Philipp Koch
@@ -68,7 +73,7 @@
 public interface RemoteAdapterFactory {
 
     /**
-     * Factory method for creating a remote adapter for a local repository.
+     * Returns a remote adapter for the given local repository.
      *
      * @param repository local repository
      * @return remote repository adapter
@@ -78,7 +83,7 @@
             throws RemoteException;
 
     /**
-     * Factory method for creating a remote adapter for a local session.
+     * Returns a remote adapter for the given local session.
      *
      * @param session local session
      * @return remote session adapter
@@ -87,7 +92,7 @@
     RemoteSession getRemoteSession(Session session) throws RemoteException;
 
     /**
-     * Factory method for creating a remote adapter for a local workspace.
+     * Returns a remote adapter for the given local workspace.
      *
      * @param workspace local workspace
      * @return remote workspace adapter
@@ -97,8 +102,7 @@
             throws RemoteException;
 
     /**
-     * Factory method for creating a remote adapter for a local namespace
-     * registry.
+     * Returns a remote adapter for the given local namespace registry.
      *
      * @param registry local namespace registry
      * @return remote namespace registry adapter
@@ -108,8 +112,7 @@
             NamespaceRegistry registry) throws RemoteException;
 
     /**
-     * Factory method for creating a remote adapter for a local node type
-     * manager.
+     * Returns a remote adapter for the given local node type manager.
      *
      * @param manager local node type manager
      * @return remote node type manager adapter
@@ -119,13 +122,12 @@
             throws RemoteException;
 
     /**
-     * Factory method for creating a remote adapter for a local item.
-     * Note that before calling this method, the server may want to
-     * introspect the local item to determine whether to use the
-     * {@link #getRemoteNode(Node) getRemoteNode} or
-     * {@link #getRemoteProperty(Property) getRemoteProperty} method
-     * instead, as the adapter returned by this method will only cover
-     * the basic {@link RemoteItem RemoteItem} interface.
+     * Returns a remote adapter for the given local item. This method
+     * will return an adapter that implements <i>only</i> the
+     * {@link Item Item} interface. The caller may want to introspect
+     * the local item to determine whether to use either the
+     * {@link #getRemoteNode(Node) getRemoteNode} or the
+     * {@link #getRemoteProperty(Property) getRemoteProperty} method instead.
      *
      * @param item local item
      * @return remote item adapter
@@ -134,7 +136,7 @@
     RemoteItem getRemoteItem(Item item) throws RemoteException;
 
     /**
-     * Factory method for creating a remote adapter for a local property.
+     * Returns a remote adapter for the given local property.
      *
      * @param property local property
      * @return remote property adapter
@@ -143,7 +145,7 @@
     RemoteProperty getRemoteProperty(Property property) throws RemoteException;
 
     /**
-     * Factory method for creating a remote adapter for a local node.
+     * Returns a remote adapter for the given local node.
      *
      * @param node local node
      * @return remote node adapter
@@ -152,7 +154,7 @@
     RemoteNode getRemoteNode(Node node) throws RemoteException;
 
     /**
-     * Factory method for creating a remote adapter for a local node type.
+     * Returns a remote adapter for the given local node type.
      *
      * @param type local node type
      * @return remote node type adapter
@@ -161,8 +163,7 @@
     RemoteNodeType getRemoteNodeType(NodeType type) throws RemoteException;
 
     /**
-     * Factory method for creating a remote adapter for a local node
-     * definition.
+     * Returns a remote adapter for the given local node definition.
      *
      * @param def local node definition
      * @return remote node definition adapter
@@ -171,8 +172,7 @@
     RemoteNodeDef getRemoteNodeDef(NodeDef def) throws RemoteException;
 
     /**
-     * Factory method for creating a remote adapter for a local property
-     * definition.
+     * Returns a remote adapter for the given local property definition.
      *
      * @param def local property definition
      * @return remote property definition adapter
@@ -182,7 +182,7 @@
             throws RemoteException;
 
     /**
-     * Factory method for creating a remote adapter for a local lock.
+     * Returns a remote adapter for the given local lock.
      *
      * @param lock local lock
      * @return remote lock adapter
@@ -191,7 +191,7 @@
     RemoteLock getRemoteLock(Lock lock) throws RemoteException;
 
     /**
-     * Factory method for creating a remote adapter for a local query manager.
+     * Returns a remote adapter for the given local query manager.
      *
      * @param manager local query manager
      * @return remote query manager adapter
@@ -199,5 +199,33 @@
      */
     RemoteQueryManager getRemoteQueryManager(QueryManager manager)
             throws RemoteException;
+
+    /**
+     * Returns a remote adapter for the given local query.
+     *
+     * @param query local query
+     * @return remote query adapter
+     * @throws RemoteException on RMI errors
+     */
+    RemoteQuery getRemoteQuery(Query query) throws RemoteException;
+
+    /**
+     * Returns a remote adapter for the given local query result.
+     *
+     * @param result local query result
+     * @return remote query result adapter
+     * @throws RemoteException on RMI errors
+     */
+    RemoteQueryResult getRemoteQueryResult(QueryResult result)
+            throws RemoteException;
+
+    /**
+     * Returns a remote adapter for the given local query row.
+     *
+     * @param row local query row
+     * @return remote query row adapter
+     * @throws RemoteException on RMI errors
+     */
+    RemoteRow getRemoteRow(Row row) throws RemoteException;
 
 }

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?view=diff&r1=155784&r2=155785
==============================================================================
--- 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
Tue Mar  1 07:05:10 2005
@@ -30,7 +30,10 @@
 import javax.jcr.nodetype.NodeType;
 import javax.jcr.nodetype.NodeTypeManager;
 import javax.jcr.nodetype.PropertyDef;
+import javax.jcr.query.Query;
 import javax.jcr.query.QueryManager;
+import javax.jcr.query.QueryResult;
+import javax.jcr.query.Row;
 
 import org.apache.jackrabbit.rmi.remote.RemoteItem;
 import org.apache.jackrabbit.rmi.remote.RemoteLock;
@@ -41,18 +44,20 @@
 import org.apache.jackrabbit.rmi.remote.RemoteNodeTypeManager;
 import org.apache.jackrabbit.rmi.remote.RemoteProperty;
 import org.apache.jackrabbit.rmi.remote.RemotePropertyDef;
+import org.apache.jackrabbit.rmi.remote.RemoteQuery;
 import org.apache.jackrabbit.rmi.remote.RemoteQueryManager;
+import org.apache.jackrabbit.rmi.remote.RemoteQueryResult;
 import org.apache.jackrabbit.rmi.remote.RemoteRepository;
+import org.apache.jackrabbit.rmi.remote.RemoteRow;
 import org.apache.jackrabbit.rmi.remote.RemoteSession;
 import org.apache.jackrabbit.rmi.remote.RemoteWorkspace;
 
 /**
  * Default implementation of the
- * {@link org.apache.jackrabbit.rmi.server.RemoteAdapterFactory RemoteAdapterFactory}
- * interface. This factory uses the server adapters defined in this
- * package as the default adapter implementations. Subclasses can
- * easily override or extend the default adapters by implementing the
- * corresponding factory methods.
+ * {@link RemoteAdapterFactory RemoteAdapterFactory} interface.
+ * This factory uses the server adapters defined in this package as
+ * the default adapter implementations. Subclasses can override or extend
+ * the default adapters by implementing the corresponding factory methods.
  *
  * @author Jukka Zitting
  * @author Philipp Koch
@@ -60,8 +65,7 @@
 public class ServerAdapterFactory implements RemoteAdapterFactory {
 
     /**
-     * Creates and returns a {@link ServerRepository ServerRepository} instance.
-     *
+     * Creates a {@link ServerRepository ServerRepository} instance.
      * {@inheritDoc}
      */
     public RemoteRepository getRemoteRepository(Repository repository)
@@ -70,8 +74,7 @@
     }
 
     /**
-     * Creates and returns a {@link ServerSession ServerSession} instance.
-     *
+     * Creates a {@link ServerSession ServerSession} instance.
      * {@inheritDoc}
      */
     public RemoteSession getRemoteSession(Session session)
@@ -80,8 +83,7 @@
     }
 
     /**
-     * Creates and returns a {@link ServerWorkspace ServerWorkspace} instance.
-     *
+     * Creates a {@link ServerWorkspace ServerWorkspace} instance.
      * {@inheritDoc}
      */
     public RemoteWorkspace getRemoteWorkspace(Workspace workspace)
@@ -90,9 +92,8 @@
     }
 
     /**
-     * Creates and returns a
-     * {@link ServerNamespaceRegistry ServerNamespaceRegistry} instance.
-     *
+     * Creates a {@link ServerNamespaceRegistry ServerNamespaceRegistry}
+     * instance.
      * {@inheritDoc}
      */
     public RemoteNamespaceRegistry getRemoteNamespaceRegistry(
@@ -101,9 +102,7 @@
     }
 
     /**
-     * Creates and returns a
-     * {@link ServerNodeTypeManager ServerNodeTypeManager} instance.
-     *
+     * Creates a {@link ServerNodeTypeManager ServerNodeTypeManager} instance.
      * {@inheritDoc}
      */
     public RemoteNodeTypeManager getRemoteNodeTypeManager(
@@ -112,8 +111,7 @@
     }
 
     /**
-     * Creates and returns a {@link ServerItem ServerItem} instance.
-     *
+     * Creates a {@link ServerItem ServerItem} instance.
      * {@inheritDoc}
      */
     public RemoteItem getRemoteItem(Item item) throws RemoteException {
@@ -121,8 +119,7 @@
     }
 
     /**
-     * Creates and returns a {@link ServerProperty ServerProperty} instance.
-     *
+     * Creates a {@link ServerProperty ServerProperty} instance.
      * {@inheritDoc}
      */
     public RemoteProperty getRemoteProperty(Property property)
@@ -131,8 +128,7 @@
     }
 
     /**
-     * Creates and returns a {@link ServerNode ServerNode} instance.
-     *
+     * Creates a {@link ServerNode ServerNode} instance.
      * {@inheritDoc}
      */
     public RemoteNode getRemoteNode(Node node) throws RemoteException {
@@ -140,8 +136,7 @@
     }
 
     /**
-     * Creates and returns a {@link ServerNodeType ServerNodeType} instance.
-     *
+     * Creates a {@link ServerNodeType ServerNodeType} instance.
      * {@inheritDoc}
      */
     public RemoteNodeType getRemoteNodeType(NodeType type)
@@ -150,8 +145,7 @@
     }
 
     /**
-     * Creates and returns a {@link ServerNodeDef ServerNodeDef} instance.
-     *
+     * Creates a {@link ServerNodeDef ServerNodeDef} instance.
      * {@inheritDoc}
      */
     public RemoteNodeDef getRemoteNodeDef(NodeDef def)
@@ -160,9 +154,7 @@
     }
 
     /**
-     * Creates and returns a {@link ServerPropertyDef ServerPropertyDef}
-     * instance.
-     *
+     * Creates a {@link ServerPropertyDef ServerPropertyDef} instance.
      * {@inheritDoc}
      */
     public RemotePropertyDef getRemotePropertyDef(PropertyDef def)
@@ -171,8 +163,7 @@
     }
 
     /**
-     * Creates and returns a {@link ServerLock ServerLock} instance.
-     *
+     * Creates a {@link ServerLock ServerLock} instance.
      * {@inheritDoc}
      */
     public RemoteLock getRemoteLock(Lock lock) throws RemoteException {
@@ -180,14 +171,37 @@
     }
 
     /**
-     * Creates and returns a {@link ServerQueryManager ServerQueryManager}
-     * instance.
-     *
+     * Creates a {@link ServerQueryManager ServerQueryManager} instance.
      * {@inheritDoc}
      */
     public RemoteQueryManager getRemoteQueryManager(QueryManager manager)
             throws RemoteException {
         return new ServerQueryManager(manager, this);
+    }
+
+    /**
+     * Creates a {@link ServerQuery ServerQuery} instance.
+     * {@inheritDoc}
+     */
+    public RemoteQuery getRemoteQuery(Query query) throws RemoteException {
+        return new ServerQuery(query, this);
+    }
+
+    /**
+     * Creates a {@link ServerQueryResult ServerQueryResult} instance.
+     * {@inheritDoc}
+     */
+    public RemoteQueryResult getRemoteQueryResult(QueryResult result)
+            throws RemoteException {
+        return new ServerQueryResult(result, this);
+    }
+
+    /**
+     * Creates a {@link ServerQueryResult ServerQueryResult} instance.
+     * {@inheritDoc}
+     */
+    public RemoteRow getRemoteRow(Row row) throws RemoteException {
+        return new ServerRow(row, this);
     }
 
 }

Modified: incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerQueryManager.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerQueryManager.java?view=diff&r1=155784&r2=155785
==============================================================================
--- incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerQueryManager.java
(original)
+++ incubator/jackrabbit/trunk/contrib/jcr-rmi/src/java/org/apache/jackrabbit/rmi/server/ServerQueryManager.java
Tue Mar  1 07:05:10 2005
@@ -63,7 +63,7 @@
             throws InvalidQueryException, RepositoryException, RemoteException {
         try {
             Query query = manager.createQuery(statement, language);
-            return new ServerQuery(query, getFactory());
+            return getFactory().getRemoteQuery(query);
         } catch (RepositoryException ex) {
             throw getRepositoryException(ex);
         }
@@ -74,7 +74,7 @@
             throws InvalidQueryException, RepositoryException, RemoteException {
         try {
             Node node = null; // TODO
-            return new ServerQuery(manager.getQuery(node), getFactory());
+            return getFactory().getRemoteQuery(manager.getQuery(node));
         } catch (RepositoryException ex) {
             throw getRepositoryException(ex);
         }

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?view=diff&r1=155784&r2=155785
==============================================================================
--- 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
Tue Mar  1 07:05:10 2005
@@ -68,7 +68,7 @@
 
         RemoteRow[] remotes = new RemoteRow[(int) iterator.getSize()];
         for (int i = 0; iterator != null && iterator.hasNext(); i++) {
-            remotes[i] = new ServerRow(iterator.nextRow(), getFactory());
+            remotes[i] = getFactory().getRemoteRow(iterator.nextRow());
         }
         return remotes;
 



Mime
View raw message