jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r526707 - in /jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server: RemoteAdapterFactory.java ServerAdapterFactory.java ServerObject.java
Date Mon, 09 Apr 2007 10:56:21 GMT
Author: jukka
Date: Mon Apr  9 03:56:20 2007
New Revision: 526707

URL: http://svn.apache.org/viewvc?view=rev&rev=526707
Log:
JCR-781: Allow custom socket factories and port number in the RMI server.

Modified:
    jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/RemoteAdapterFactory.java
    jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerAdapterFactory.java
    jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerObject.java

Modified: jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/RemoteAdapterFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/RemoteAdapterFactory.java?view=diff&rev=526707&r1=526706&r2=526707
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/RemoteAdapterFactory.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/RemoteAdapterFactory.java
Mon Apr  9 03:56:20 2007
@@ -17,6 +17,8 @@
 package org.apache.jackrabbit.rmi.server;
 
 import java.rmi.RemoteException;
+import java.rmi.server.RMIClientSocketFactory;
+import java.rmi.server.RMIServerSocketFactory;
 
 import javax.jcr.Item;
 import javax.jcr.NamespaceRegistry;
@@ -87,6 +89,30 @@
  * @see org.apache.jackrabbit.rmi.server.ServerObject
  */
 public interface RemoteAdapterFactory {
+
+    /**
+     * Returns the RMI port to use.
+     *
+     * @return RMI port number
+     * @since 1.3
+     */
+    int getPort();
+
+    /**
+     * Returns the RMI client socket factory to use.
+     *
+     * @return RMI client socket factory
+     * @since 1.3
+     */
+    RMIClientSocketFactory getClientSocketFactory(); 
+
+    /**
+     * Returns the RMI server socket factory to use.
+     *
+     * @return RMI server socket factory
+     * @since 1.3
+     */
+    RMIServerSocketFactory getServerSocketFactory();
 
     /**
      * Returns a remote adapter for the given local repository.

Modified: jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerAdapterFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerAdapterFactory.java?view=diff&rev=526707&r1=526706&r2=526707
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerAdapterFactory.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerAdapterFactory.java
Mon Apr  9 03:56:20 2007
@@ -17,6 +17,9 @@
 package org.apache.jackrabbit.rmi.server;
 
 import java.rmi.RemoteException;
+import java.rmi.server.RMIClientSocketFactory;
+import java.rmi.server.RMIServerSocketFactory;
+import java.rmi.server.RMISocketFactory;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -99,14 +102,13 @@
     private static final int DEFAULT_BUFFER_SIZE = 100;
 
     /** The buffer size of iterators created by this factory. */
-    private int bufferSize;
+    private int bufferSize = DEFAULT_BUFFER_SIZE;
 
-    /**
-     * Creates a server adapter factory with the default iterator buffer size.
-     */
-    public ServerAdapterFactory() {
-        bufferSize = DEFAULT_BUFFER_SIZE;
-    }
+    private int port = 0;
+
+    private RMIClientSocketFactory clientSocketFactory = null;
+
+    private RMIServerSocketFactory serverSocketFactory = null;
 
     /**
      * Returns the iterator buffer size.
@@ -124,6 +126,82 @@
      */
     public void setBufferSize(int bufferSize) {
         this.bufferSize = bufferSize;
+    }
+
+    /**
+     * Returns the RMI port to use.
+     *
+     * @return RMI port number
+     * @since 1.3
+     */
+    public int getPort() {
+        return port;
+    }
+
+    /**
+     * Sets the RMI port to use.
+     *
+     * @param port RMI port number
+     * @since 1.3
+     */
+    public void setPort(int port) {
+        this.port = port;
+    }
+
+    /**
+     * Returns the RMI client socket factory to use.
+     *
+     * @return RMI client socket factory
+     * @since 1.3
+     */
+    public RMIClientSocketFactory getClientSocketFactory() {
+        RMIClientSocketFactory factory = clientSocketFactory;
+        if (factory == null) {
+            factory = RMISocketFactory.getSocketFactory();
+        }
+        if (factory == null) {
+            factory = RMISocketFactory.getDefaultSocketFactory();
+        }
+        return factory;
+    }
+
+    /**
+     * Sets the RMI client socket factory to use.
+     *
+     * @param factory RMI client socket factory,
+     *                or <code>null</code> to use the default
+     * @since 1.3
+     */
+    public void setClientSocketFactory(RMIClientSocketFactory factory) {
+        clientSocketFactory = factory;
+    }
+
+    /**
+     * Returns the RMI server socket factory to use.
+     *
+     * @return RMI server socket factory
+     * @since 1.3
+     */
+    public RMIServerSocketFactory getServerSocketFactory() {
+        RMIServerSocketFactory factory = serverSocketFactory;
+        if (factory == null) {
+            factory = RMISocketFactory.getSocketFactory();
+        }
+        if (factory == null) {
+            factory = RMISocketFactory.getDefaultSocketFactory();
+        }
+        return factory;
+    }
+
+    /**
+     * Sets the RMI server socket factory to use.
+     *
+     * @param factory RMI server socket factory,
+     *                or <code>null</code> to use the default
+     * @since 1.3
+     */
+    public void setServerSocketFactory(RMIServerSocketFactory factory) {
+        serverSocketFactory = factory;
     }
 
     /**

Modified: jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerObject.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerObject.java?view=diff&rev=526707&r1=526706&r2=526707
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerObject.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/ServerObject.java
Mon Apr  9 03:56:20 2007
@@ -68,6 +68,9 @@
      */
     protected ServerObject(RemoteAdapterFactory factory)
             throws RemoteException {
+        super(factory.getPort(),
+                factory.getClientSocketFactory(),
+                factory.getServerSocketFactory());
         this.factory = factory;
     }
 



Mime
View raw message