jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r900712 - /jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/repository/RmiRepositoryFactory.java
Date Tue, 19 Jan 2010 09:53:26 GMT
Author: jukka
Date: Tue Jan 19 09:53:26 2010
New Revision: 900712

URL: http://svn.apache.org/viewvc?rev=900712&view=rev
Log:
JSR-283: Implement RepositoryFactory

Add support for URLs pointing directly to the serialized RMI stub.

Modified:
    jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/repository/RmiRepositoryFactory.java

Modified: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/repository/RmiRepositoryFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/repository/RmiRepositoryFactory.java?rev=900712&r1=900711&r2=900712&view=diff
==============================================================================
--- jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/repository/RmiRepositoryFactory.java
(original)
+++ jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/repository/RmiRepositoryFactory.java
Tue Jan 19 09:53:26 2010
@@ -16,6 +16,8 @@
  */
 package org.apache.jackrabbit.rmi.repository;
 
+import java.io.InputStream;
+import java.io.ObjectInputStream;
 import java.net.URI;
 import java.rmi.Naming;
 import java.util.Hashtable;
@@ -55,7 +57,18 @@
                         return null;
                     }
                 } else {
-                    return null;
+                    InputStream stream = uri.toURL().openStream();
+                    try {
+                        Object remote =
+                            new ObjectInputStream(stream).readObject();
+                        if (remote instanceof RemoteRepository) {
+                            return getRepository((RemoteRepository) remote);
+                        } else {
+                            return null;
+                        }
+                    } finally {
+                        stream.close();
+                    }
                 }
             } catch (Exception e) {
                 return null;



Mime
View raw message