jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r762364 - in /jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src: main/java/org/apache/jackrabbit/rmi/client/ main/java/org/apache/jackrabbit/rmi/remote/ main/java/org/apache/jackrabbit/rmi/server/ test/java/org/apache/jackrabbit/test/rmi/
Date Mon, 06 Apr 2009 14:43:04 GMT
Author: jukka
Date: Mon Apr  6 14:43:04 2009
New Revision: 762364

URL: http://svn.apache.org/viewvc?rev=762364&view=rev
Log:
JCRRMI-17: Multiple TCK test failures

Lock.getNode() needs to return the locked node, not the node on which getLock() was called.

Modified:
    jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientAdapterFactory.java
    jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientLock.java
    jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientNode.java
    jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/LocalAdapterFactory.java
    jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteLock.java
    jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerAdapterFactory.java
    jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerLock.java
    jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/test/java/org/apache/jackrabbit/test/rmi/RemoteAdapterTest.java

Modified: jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientAdapterFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientAdapterFactory.java?rev=762364&r1=762363&r2=762364&view=diff
==============================================================================
--- jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientAdapterFactory.java
(original)
+++ jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientAdapterFactory.java
Mon Apr  6 14:43:04 2009
@@ -237,8 +237,8 @@
      *
      * {@inheritDoc}
      */
-    public Lock getLock(Node node, RemoteLock remote) {
-        return new ClientLock(node, remote);
+    public Lock getLock(Session session, Node node, RemoteLock remote) {
+        return new ClientLock(session, remote, this);
     }
 
     /**

Modified: jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientLock.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientLock.java?rev=762364&r1=762363&r2=762364&view=diff
==============================================================================
--- jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientLock.java
(original)
+++ jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientLock.java
Mon Apr  6 14:43:04 2009
@@ -20,6 +20,7 @@
 
 import javax.jcr.Node;
 import javax.jcr.RepositoryException;
+import javax.jcr.Session;
 import javax.jcr.lock.Lock;
 
 import org.apache.jackrabbit.rmi.remote.RemoteLock;
@@ -33,10 +34,10 @@
  * @see javax.jcr.lock.Lock
  * @see org.apache.jackrabbit.rmi.remote.RemoteLock
  */
-public class ClientLock implements Lock {
+public class ClientLock extends ClientObject implements Lock {
 
-    /** The current node. */
-    private Node node;
+    /** Current session. */
+    private Session session;
 
     /** The adapted remote lock. */
     private RemoteLock remote;
@@ -44,21 +45,25 @@
     /**
      * Creates a local adapter for the given remote lock.
      *
-     * @param node current node
+     * @param session current session
      * @param remote remote lock
+     * @param factory local adapter factory
      */
-    public ClientLock(Node node, RemoteLock remote) {
-        this.node = node;
+    public ClientLock(Session session, RemoteLock remote, LocalAdapterFactory factory) {
+        super(factory);
+        this.session = session;
         this.remote = remote;
     }
 
-    /**
-     * Returns the owning node without contacting the remote lock.
-     *
-     * {@inheritDoc}
-     */
+    /** {@inheritDoc} */
     public Node getNode() {
-        return node;
+        try {
+            return getNode(session, remote.getNode());
+        } catch (RemoteException e) {
+            throw new RemoteRuntimeException(e);
+        } catch (RepositoryException e) {
+            throw new RuntimeException(e);
+        }
     }
 
     /** {@inheritDoc} */

Modified: jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientNode.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientNode.java?rev=762364&r1=762363&r2=762364&view=diff
==============================================================================
--- jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientNode.java
(original)
+++ jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/ClientNode.java
Mon Apr  6 14:43:04 2009
@@ -615,7 +615,7 @@
             throws RepositoryException {
         try {
             RemoteLock lock = remote.lock(isDeep, isSessionScoped);
-            return getFactory().getLock(this, lock);
+            return getFactory().getLock(getSession(), this, lock);
         } catch (RemoteException ex) {
             throw new RemoteRepositoryException(ex);
         }
@@ -624,7 +624,7 @@
     /** {@inheritDoc} */
     public Lock getLock() throws RepositoryException {
         try {
-            return getFactory().getLock(this, remote.getLock());
+            return getFactory().getLock(getSession(), this, remote.getLock());
         } catch (RemoteException ex) {
             throw new RemoteRepositoryException(ex);
         }

Modified: jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/LocalAdapterFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/LocalAdapterFactory.java?rev=762364&r1=762363&r2=762364&view=diff
==============================================================================
--- jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/LocalAdapterFactory.java
(original)
+++ jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/client/LocalAdapterFactory.java
Mon Apr  6 14:43:04 2009
@@ -234,11 +234,12 @@
     /**
      * Factory method for creating a local adapter for a remote lock.
      *
+     * @param session current session
      * @param node current node
      * @param remote remote lock
      * @return local lock adapter
      */
-    Lock getLock(Node node, RemoteLock remote);
+    Lock getLock(Session session, Node node, RemoteLock remote);
 
     /**
      * Factory method for creating a local adapter for a remote query manager.

Modified: jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteLock.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteLock.java?rev=762364&r1=762363&r2=762364&view=diff
==============================================================================
--- jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteLock.java
(original)
+++ jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteLock.java
Mon Apr  6 14:43:04 2009
@@ -41,6 +41,17 @@
 
     /**
      * Remote version of the
+     * {@link javax.jcr.lock.Lock#getNode() Lock.getNode()} method.
+     *
+     * @return remote node
+     * @throws RepositoryException on repository errors
+     * @throws RemoteException on RMI errors
+     * @since JCR-RMI 2.0
+     */
+    RemoteNode getNode() throws RepositoryException, RemoteException;
+
+    /**
+     * Remote version of the
      * {@link javax.jcr.lock.Lock#getLockOwner() Lock.getLockOwner()} method.
      *
      * @return lock owner

Modified: jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerAdapterFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerAdapterFactory.java?rev=762364&r1=762363&r2=762364&view=diff
==============================================================================
--- jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerAdapterFactory.java
(original)
+++ jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerAdapterFactory.java
Mon Apr  6 14:43:04 2009
@@ -295,7 +295,7 @@
      * {@inheritDoc}
      */
     public RemoteLock getRemoteLock(Lock lock) throws RemoteException {
-        return new ServerLock(lock);
+        return new ServerLock(lock, this);
     }
 
     /**

Modified: jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerLock.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerLock.java?rev=762364&r1=762363&r2=762364&view=diff
==============================================================================
--- jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerLock.java
(original)
+++ jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerLock.java
Mon Apr  6 14:43:04 2009
@@ -23,6 +23,7 @@
 import javax.jcr.lock.Lock;
 
 import org.apache.jackrabbit.rmi.remote.RemoteLock;
+import org.apache.jackrabbit.rmi.remote.RemoteNode;
 
 /**
  * Remote adapter for the JCR {@link javax.jcr.lock.Lock Lock} interface.
@@ -33,7 +34,7 @@
  * @see javax.jcr.lock.Lock
  * @see org.apache.jackrabbit.rmi.remote.RemoteLock
  */
-public class ServerLock extends UnicastRemoteObject implements RemoteLock {
+public class ServerLock extends ServerObject implements RemoteLock {
 
     /** The adapted local lock. */
     private Lock lock;
@@ -44,11 +45,18 @@
      * @param lock local lock
      * @throws RemoteException on RMI errors
      */
-    public ServerLock(Lock lock) throws RemoteException {
+    public ServerLock(Lock lock, RemoteAdapterFactory factory)
+            throws RemoteException {
+        super(factory);
         this.lock = lock;
     }
 
     /** {@inheritDoc} */
+    public RemoteNode getNode() throws RemoteException {
+        return getRemoteNode(lock.getNode());
+    }
+
+    /** {@inheritDoc} */
     public String getLockOwner() throws RemoteException {
         return lock.getLockOwner();
     }

Modified: jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/test/java/org/apache/jackrabbit/test/rmi/RemoteAdapterTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/test/java/org/apache/jackrabbit/test/rmi/RemoteAdapterTest.java?rev=762364&r1=762363&r2=762364&view=diff
==============================================================================
--- jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/test/java/org/apache/jackrabbit/test/rmi/RemoteAdapterTest.java
(original)
+++ jackrabbit/commons/jcr-rmi/trunk/jcr-rmi/src/test/java/org/apache/jackrabbit/test/rmi/RemoteAdapterTest.java
Mon Apr  6 14:43:04 2009
@@ -308,7 +308,7 @@
 
         Lock lock = (Lock) mock;
         RemoteLock remote = remoteFactory.getRemoteLock(lock);
-        Lock local = localFactory.getLock(null, remote);
+        Lock local = localFactory.getLock(null, null, remote);
 
         runTests(local);
     }



Mime
View raw message