jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r543865 - /jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/servlet/
Date Sun, 03 Jun 2007 09:48:52 GMT
Author: jukka
Date: Sun Jun  3 02:48:51 2007
New Revision: 543865

URL: http://svn.apache.org/viewvc?view=rev&rev=543865
Log:
JCR-956: Extract shared functionality to base classes.

Added:
    jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/servlet/RemoteBindingServlet.java
  (with props)
    jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/servlet/RemoteRepositoryServlet.java
  (with props)
Modified:
    jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/servlet/JNDIRMIBindingServlet.java
    jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/servlet/JNDIRMIRepositoryServlet.java
    jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/servlet/RMIBindingServlet.java
    jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/servlet/RMIRepositoryServlet.java

Modified: jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/servlet/JNDIRMIBindingServlet.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/servlet/JNDIRMIBindingServlet.java?view=diff&rev=543865&r1=543864&r2=543865
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/servlet/JNDIRMIBindingServlet.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/servlet/JNDIRMIBindingServlet.java
Sun Jun  3 02:48:51 2007
@@ -16,8 +16,6 @@
  */
 package org.apache.jackrabbit.rmi.servlet;
 
-import java.rmi.Remote;
-import java.rmi.RemoteException;
 import java.util.Enumeration;
 import java.util.Hashtable;
 
@@ -26,9 +24,7 @@
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
 import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
 
-import org.apache.jackrabbit.commons.servlet.ServletRepository;
 import org.apache.jackrabbit.rmi.jackrabbit.JackrabbitServerAdapterFactory;
 import org.apache.jackrabbit.rmi.remote.RemoteRepository;
 import org.apache.jackrabbit.rmi.server.RemoteAdapterFactory;
@@ -55,7 +51,7 @@
  *   <dd>
  *     Location where to bind the repository in the JNDI directory.
  *     The default value is
- *      "<code>org/apache/jackrabbit/rmi/remote/RepoteRepository</code>".
+ *      "<code>org/apache/jackrabbit/rmi/remote/RemoteRepository</code>".
  *   </dd>
  *   <dt>*</dt>
  *   <dd>
@@ -66,12 +62,12 @@
  *
  * @since 1.4
  */
-public class JNDIRMIBindingServlet extends HttpServlet {
+public class JNDIRMIBindingServlet extends RemoteBindingServlet {
 
     /**
      * Serial version UID.
      */
-    private static final long serialVersionUID = -8981536241655836775L;
+    private static final long serialVersionUID = 3387067305901189614L;
 
     /**
      * JNDI context to which to bind the repository.
@@ -85,12 +81,6 @@
         RemoteRepository.class.getName().replace('.', '/');
 
     /**
-     * The remote repository reference. Kept to avoid it from being
-     * collected as garbage when no clients are connected.
-     */
-    private Remote remote;
-
-    /**
      * Binds a repository from the servlet context in the configured RMI URL.
      *
      * @throws ServletException if the repository could not be bound in RMI
@@ -109,12 +99,7 @@
                 }
             }
             context =  new InitialContext(environment);
-            RemoteAdapterFactory factory = getRemoteAdapterFactory();
-            remote = factory.getRemoteRepository(new ServletRepository(this));
-            context.bind(location, remote);
-        } catch (RemoteException e) {
-            throw new ServletException(
-                    "Failed to create the remote repository reference", e);
+            context.bind(location, getRemoteRepository());
         } catch (NamingException e) {
             throw new ServletException(
                     "Failed to bind remote repository to JNDI: " + location, e);
@@ -129,36 +114,6 @@
             context.unbind(location);
         } catch (NamingException e) {
             log("Failed to unbind remote repository from JNDI: " + location, e);
-        }
-    }
-
-    /**
-     * Instantiates and returns the configured remote adapter factory.
-     *
-     * @return remote adapter factory
-     * @throws ServletException if the factory could not be instantiated
-     */
-    private RemoteAdapterFactory getRemoteAdapterFactory()
-            throws ServletException {
-        String name = getInitParameter(RemoteAdapterFactory.class.getName());
-        if (name == null) {
-            name = JackrabbitServerAdapterFactory.class.getName();
-        }
-        try {
-            Class factoryClass = Class.forName(name);
-            return (RemoteAdapterFactory) factoryClass.newInstance();
-        } catch (ClassNotFoundException e) {
-            throw new ServletException(
-                    "Remote adapter factory class not found: " + name, e);
-        } catch (InstantiationException e) {
-            throw new ServletException(
-                    "Failed to instantiate the adapter factory: " + name, e);
-        } catch (IllegalAccessException e) {
-            throw new ServletException(
-                    "Adapter factory constructor is not public: " + name, e);
-        } catch (ClassCastException e) {
-            throw new ServletException(
-                    "Invalid remote adapter factory class: " + name, e);
         }
     }
 

Modified: jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/servlet/JNDIRMIRepositoryServlet.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/servlet/JNDIRMIRepositoryServlet.java?view=diff&rev=543865&r1=543864&r2=543865
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/servlet/JNDIRMIRepositoryServlet.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/servlet/JNDIRMIRepositoryServlet.java
Sun Jun  3 02:48:51 2007
@@ -66,12 +66,12 @@
  *
  * @since 1.4
  */
-public class JNDIRMIRepositoryServlet extends AbstractRepositoryServlet {
+public class JNDIRMIRepositoryServlet extends RemoteRepositoryServlet {
 
     /**
      * Serial version UID.
      */
-    private static final long serialVersionUID = 6345077056681327186L;
+    private static final long serialVersionUID = 3640243088693016475L;
 
     /**
      * Creates and returns a proxy for the remote repository in the configured
@@ -100,35 +100,6 @@
         } catch (NamingException e) {
             throw new ServletException(
                     "Repository not found: Invalid JNDI context", e);
-        }
-    }
-
-    /**
-     * Instantiates and returns the configured local adapter factory.
-     *
-     * @return local adapter factory
-     * @throws ServletException if the factory could not be instantiated
-     */
-    private LocalAdapterFactory getLocalAdapterFactory()
-            throws ServletException {
-        String name = getInitParameter(
-                LocalAdapterFactory.class.getName(),
-                JackrabbitClientAdapterFactory.class.getName());
-        try {
-            Class factoryClass = Class.forName(name);
-            return (LocalAdapterFactory) factoryClass.newInstance();
-        } catch (ClassNotFoundException e) {
-            throw new ServletException(
-                    "Local adapter factory class not found: " + name, e);
-        } catch (InstantiationException e) {
-            throw new ServletException(
-                    "Failed to instantiate the adapter factory: " + name, e);
-        } catch (IllegalAccessException e) {
-            throw new ServletException(
-                    "Adapter factory constructor is not public: " + name, e);
-        } catch (ClassCastException e) {
-            throw new ServletException(
-                    "Invalid local adapter factory class: " + name, e);
         }
     }
 

Modified: jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/servlet/RMIBindingServlet.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/servlet/RMIBindingServlet.java?view=diff&rev=543865&r1=543864&r2=543865
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/servlet/RMIBindingServlet.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/servlet/RMIBindingServlet.java
Sun Jun  3 02:48:51 2007
@@ -20,15 +20,11 @@
 import java.rmi.AlreadyBoundException;
 import java.rmi.Naming;
 import java.rmi.NotBoundException;
-import java.rmi.Remote;
 import java.rmi.RemoteException;
 
 import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
 
-import org.apache.jackrabbit.commons.servlet.ServletRepository;
 import org.apache.jackrabbit.rmi.jackrabbit.JackrabbitServerAdapterFactory;
-import org.apache.jackrabbit.rmi.server.RemoteAdapterFactory;
 
 /**
  * Servlet that binds a repository from a servlet context attribute in RMI.
@@ -56,12 +52,12 @@
  *
  * @since 1.4
  */
-public class RMIBindingServlet extends HttpServlet {
+public class RMIBindingServlet extends RemoteBindingServlet {
 
     /**
-     * Serial version UID.
+     * Serial version UID. 
      */
-    private static final long serialVersionUID = -207084931471893942L;
+    private static final long serialVersionUID = 7239156891304655304L;
 
     /**
      * Location of the repository within the JNDI context.
@@ -69,12 +65,6 @@
     private String url;
 
     /**
-     * The remote repository reference. Kept to avoid it from being
-     * collected as garbage when no clients are connected.
-     */
-    private Remote remote;
-
-    /**
      * Binds a repository from the servlet context in the configured RMI URL.
      *
      * @throws ServletException if the repository could not be bound in RMI
@@ -84,17 +74,8 @@
         if (url == null) {
             url = "//localhost/javax/jcr/Repository";
         }
-
         try {
-            RemoteAdapterFactory factory = getRemoteAdapterFactory();
-            remote = factory.getRemoteRepository(new ServletRepository(this));
-        } catch (RemoteException e) {
-            throw new ServletException(
-                    "Failed to create the remote repository reference", e);
-        }
-
-        try {
-            Naming.bind(url, remote);
+            Naming.bind(url, getRemoteRepository());
         } catch (MalformedURLException e) {
             throw new ServletException("Invalid RMI URL: " + url, e);
         } catch (AlreadyBoundException e) {
@@ -107,41 +88,10 @@
     }
 
     /**
-     * Instantiates and returns the configured remote adapter factory.
-     *
-     * @return remote adapter factory
-     * @throws ServletException if the factory could not be instantiated
-     */
-    private RemoteAdapterFactory getRemoteAdapterFactory()
-            throws ServletException {
-        String name = getInitParameter(RemoteAdapterFactory.class.getName());
-        if (name == null) {
-            name = JackrabbitServerAdapterFactory.class.getName();
-        }
-        try {
-            Class factoryClass = Class.forName(name);
-            return (RemoteAdapterFactory) factoryClass.newInstance();
-        } catch (ClassNotFoundException e) {
-            throw new ServletException(
-                    "Remote adapter factory class not found: " + name, e);
-        } catch (InstantiationException e) {
-            throw new ServletException(
-                    "Failed to instantiate the adapter factory: " + name, e);
-        } catch (IllegalAccessException e) {
-            throw new ServletException(
-                    "Adapter factory constructor is not public: " + name, e);
-        } catch (ClassCastException e) {
-            throw new ServletException(
-                    "Invalid remote adapter factory class: " + name, e);
-        }
-    }
-
-    /**
      * Unbinds the repository from RMI.
      */
     public void destroy() {
         try {
-            remote = null;
             Naming.unbind(url);
         } catch (MalformedURLException e) {
             log("Invalid RMI URL: " + url, e);

Modified: jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/servlet/RMIRepositoryServlet.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/servlet/RMIRepositoryServlet.java?view=diff&rev=543865&r1=543864&r2=543865
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/servlet/RMIRepositoryServlet.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/servlet/RMIRepositoryServlet.java
Sun Jun  3 02:48:51 2007
@@ -54,7 +54,7 @@
  *
  * @since 1.4
  */
-public class RMIRepositoryServlet extends AbstractRepositoryServlet {
+public class RMIRepositoryServlet extends RemoteRepositoryServlet {
 
     /**
      * Serial version UID.
@@ -70,35 +70,6 @@
         return new RMIRepository(
                 getLocalAdapterFactory(),
                 getInitParameter("url", "//localhost/javax/jcr/Repository"));
-    }
-
-    /**
-     * Instantiates and returns the configured local adapter factory.
-     *
-     * @return local adapter factory
-     * @throws ServletException if the factory could not be instantiated
-     */
-    private LocalAdapterFactory getLocalAdapterFactory()
-            throws ServletException {
-        String name = getInitParameter(
-                LocalAdapterFactory.class.getName(),
-                JackrabbitClientAdapterFactory.class.getName());
-        try {
-            Class factoryClass = Class.forName(name);
-            return (LocalAdapterFactory) factoryClass.newInstance();
-        } catch (ClassNotFoundException e) {
-            throw new ServletException(
-                    "Local adapter factory class not found: " + name, e);
-        } catch (InstantiationException e) {
-            throw new ServletException(
-                    "Failed to instantiate the adapter factory: " + name, e);
-        } catch (IllegalAccessException e) {
-            throw new ServletException(
-                    "Adapter factory constructor is not public: " + name, e);
-        } catch (ClassCastException e) {
-            throw new ServletException(
-                    "Invalid local adapter factory class: " + name, e);
-        }
     }
 
 }

Added: jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/servlet/RemoteBindingServlet.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/servlet/RemoteBindingServlet.java?view=auto&rev=543865
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/servlet/RemoteBindingServlet.java
(added)
+++ jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/servlet/RemoteBindingServlet.java
Sun Jun  3 02:48:51 2007
@@ -0,0 +1,139 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.servlet;
+
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+import java.rmi.RemoteException;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.jackrabbit.commons.servlet.ServletRepository;
+import org.apache.jackrabbit.rmi.jackrabbit.JackrabbitServerAdapterFactory;
+import org.apache.jackrabbit.rmi.remote.RemoteRepository;
+import org.apache.jackrabbit.rmi.server.RemoteAdapterFactory;
+
+/**
+ * Servlet that makes a repository in servlet context available as a remote
+ * repository reference. By default this servlet makes the serialized
+ * reference available through HTTP GET, but subclasses can extend this
+ * behavior to bind the remote reference to various locations like JNDI
+ * or the RMI registry.
+ * <p>
+ * The initialization parameters of this servlet are:
+ * <dl>
+ *   <dt>javax.jcr.Repository</dt>
+ *   <dd>
+ *     Name of the servlet context attribute that contains the repository.
+ *     The default value is "<code>javax.jcr.Repository</code>".
+ *   </dd>
+ *   <dt>org.apache.jackrabbit.rmi.server.RemoteAdapterFactory</dt>
+ *   <dd>
+ *     Name of the remote adapter factory class used to create the remote
+ *     repository reference. The configured class should have public
+ *     constructor that takes no arguments. The default class is
+ *     {@link JackrabbitServerAdapterFactory}.
+ *   </dd>
+ * </dl>
+ *
+ * @since 1.4
+ */
+public class RemoteBindingServlet extends HttpServlet {
+
+    /**
+     * Serial version UID.
+     */
+    private static final long serialVersionUID = -162482284843619248L;
+
+    /**
+     * Remote repository.
+     */
+    private RemoteRepository remote;
+
+    /**
+     * Returns the configured remote repository reference. The remote
+     * repository is instantiated and memorized during the first call to
+     * this method.
+     *
+     * @return remote repository
+     * @throws ServletException if the repository could not be instantiated
+     */
+    protected RemoteRepository getRemoteRepository() throws ServletException {
+        if (remote != null) {
+            try {
+                RemoteAdapterFactory factory = getRemoteAdapterFactory();
+                remote = factory.getRemoteRepository(new ServletRepository(this));
+            } catch (RemoteException e) {
+                throw new ServletException(
+                        "Failed to create the remote repository reference", e);
+            }
+        }
+        return remote;
+    }
+
+    /**
+     * Instantiates and returns the configured remote adapter factory.
+     *
+     * @return remote adapter factory
+     * @throws ServletException if the factory could not be instantiated
+     */
+    private RemoteAdapterFactory getRemoteAdapterFactory()
+            throws ServletException {
+        String name = getInitParameter(RemoteAdapterFactory.class.getName());
+        if (name == null) {
+            name = JackrabbitServerAdapterFactory.class.getName();
+        }
+        try {
+            Class factoryClass = Class.forName(name);
+            return (RemoteAdapterFactory) factoryClass.newInstance();
+        } catch (ClassNotFoundException e) {
+            throw new ServletException(
+                    "Remote adapter factory class not found: " + name, e);
+        } catch (InstantiationException e) {
+            throw new ServletException(
+                    "Failed to instantiate the adapter factory: " + name, e);
+        } catch (IllegalAccessException e) {
+            throw new ServletException(
+                    "Adapter factory constructor is not public: " + name, e);
+        } catch (ClassCastException e) {
+            throw new ServletException(
+                    "Invalid remote adapter factory class: " + name, e);
+        }
+    }
+
+    /**
+     * Outputs the remote repository reference as a serialized stream.
+     *
+     * @param request HTTP request
+     * @param response HTTP response
+     * @throws ServletException if the remote reference is not available
+     * @throws IOException on IO errors
+     */
+    protected void doGet(
+            HttpServletRequest request, HttpServletResponse response)
+            throws ServletException, IOException {
+        response.setContentType("application/octet-stream");
+        ObjectOutputStream output =
+            new ObjectOutputStream(response.getOutputStream());
+        output.writeObject(getRemoteRepository());
+        output.flush();
+    }
+
+}

Propchange: jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/servlet/RemoteBindingServlet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/servlet/RemoteRepositoryServlet.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/servlet/RemoteRepositoryServlet.java?view=auto&rev=543865
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/servlet/RemoteRepositoryServlet.java
(added)
+++ jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/servlet/RemoteRepositoryServlet.java
Sun Jun  3 02:48:51 2007
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.servlet;
+
+import javax.servlet.ServletException;
+
+import org.apache.jackrabbit.commons.servlet.AbstractRepositoryServlet;
+import org.apache.jackrabbit.rmi.client.LocalAdapterFactory;
+import org.apache.jackrabbit.rmi.jackrabbit.JackrabbitClientAdapterFactory;
+
+/**
+ * Abstract base class for servlets that make a remote repository available
+ * locally in the servlet context.
+ * <p>
+ * The supported initialization parameters of this servlet are:
+ * <dl>
+ *   <dt>javax.jcr.Repository</dt>
+ *   <dd>
+ *     Name of the servlet context attribute to put the repository in.
+ *     The default value is "<code>javax.jcr.Repository</code>".
+ *   </dd>
+ *   <dt>org.apache.jackrabbit.rmi.client.LocalAdapterFactory</dt>
+ *   <dd>
+ *     Name of the local adapter factory class used to create the local
+ *     adapter for the remote repository. The configured class should have
+ *     public constructor that takes no arguments. The default class is
+ *     {@link JackrabbitClientAdapterFactory}.
+ *   </dd>
+ * </dl>
+ * <p>
+ * This servlet can also be mapped to the URL space. See
+ * {@link AbstractRepositoryServlet} for the details.
+ *
+ * @since 1.4
+ */
+public abstract class RemoteRepositoryServlet
+        extends AbstractRepositoryServlet {
+
+    /**
+     * Instantiates and returns the configured local adapter factory.
+     *
+     * @return local adapter factory
+     * @throws ServletException if the factory could not be instantiated
+     */
+    protected LocalAdapterFactory getLocalAdapterFactory()
+            throws ServletException {
+        String name = getInitParameter(
+                LocalAdapterFactory.class.getName(),
+                JackrabbitClientAdapterFactory.class.getName());
+        try {
+            Class factoryClass = Class.forName(name);
+            return (LocalAdapterFactory) factoryClass.newInstance();
+        } catch (ClassNotFoundException e) {
+            throw new ServletException(
+                    "Local adapter factory class not found: " + name, e);
+        } catch (InstantiationException e) {
+            throw new ServletException(
+                    "Failed to instantiate the adapter factory: " + name, e);
+        } catch (IllegalAccessException e) {
+            throw new ServletException(
+                    "Adapter factory constructor is not public: " + name, e);
+        } catch (ClassCastException e) {
+            throw new ServletException(
+                    "Invalid local adapter factory class: " + name, e);
+        }
+    }
+
+}

Propchange: jackrabbit/trunk/jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/servlet/RemoteRepositoryServlet.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message