jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r901170 - in /jackrabbit/trunk: ./ jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/repository/ jackrabbit-jcr-servlet/ jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/ jackrabbit-jcr-servlet/src/main/ja...
Date Wed, 20 Jan 2010 12:51:09 GMT
Author: jukka
Date: Wed Jan 20 12:51:08 2010
New Revision: 901170

URL: http://svn.apache.org/viewvc?rev=901170&view=rev
Log:
JCR-2470: Include to jackrabbit-jcr-rmi and jackrabbit-jcr-servlet in main trunk

Copy jcr-servlet to main trunk.

Added:
    jackrabbit/trunk/jackrabbit-jcr-servlet/   (props changed)
      - copied from r901142, jackrabbit/commons/jcr-servlet/trunk/
Removed:
    jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/ContextRepositoryFactory.java
    jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/CrossContextRepositoryFactory.java
Modified:
    jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/repository/ProxyRepository.java
    jackrabbit/trunk/jackrabbit-jcr-servlet/pom.xml
    jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/AbstractRepositoryServlet.java
    jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/ContextRepositoryServlet.java
    jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/JNDIRepositoryServlet.java
    jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/jackrabbit/JackrabbitRepositoryServlet.java
    jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/JNDIRemoteBindingServlet.java
    jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/JNDIRemoteRepositoryServlet.java
    jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/RMIRemoteBindingServlet.java
    jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/RMIRemoteRepositoryServlet.java
    jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/RemoteBindingServlet.java
    jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/RemoteRepositoryServlet.java
    jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/URLRemoteBindingServlet.java
    jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/URLRemoteRepositoryServlet.java
    jackrabbit/trunk/pom.xml

Modified: jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/repository/ProxyRepository.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/repository/ProxyRepository.java?rev=901170&r1=901169&r2=901170&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/repository/ProxyRepository.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/repository/ProxyRepository.java
Wed Jan 20 12:51:08 2010
@@ -82,6 +82,14 @@
     }
 
     /**
+     * Protected constructor for subclasses that want to override the
+     * {@link #getRepository()} method.
+     */
+    protected ProxyRepository() {
+        this.factory = null;
+    }
+
+    /**
      * Returns the proxied repository. Subclasses can override this
      * method to implement custom repository access mechanisms.
      *

Propchange: jackrabbit/trunk/jackrabbit-jcr-servlet/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Jan 20 12:51:08 2010
@@ -0,0 +1,5 @@
+target
+.*
+*.iml
+*.ipr
+*.iws

Propchange: jackrabbit/trunk/jackrabbit-jcr-servlet/
------------------------------------------------------------------------------
    svn:mergeinfo = 

Modified: jackrabbit/trunk/jackrabbit-jcr-servlet/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-servlet/pom.xml?rev=901170&r1=901142&r2=901170&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-servlet/pom.xml (original)
+++ jackrabbit/trunk/jackrabbit-jcr-servlet/pom.xml Wed Jan 20 12:51:08 2010
@@ -22,15 +22,14 @@
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
                              http://maven.apache.org/maven-v4_0_0.xsd">
   <modelVersion>4.0.0</modelVersion>
-
   <parent>
     <groupId>org.apache.jackrabbit</groupId>
-    <artifactId>parent</artifactId>
-    <version>3</version>
+    <artifactId>jackrabbit-parent</artifactId>
+    <version>2.1-SNAPSHOT</version>
+    <relativePath>../jackrabbit-parent/pom.xml</relativePath>
   </parent>
 
   <artifactId>jackrabbit-jcr-servlet</artifactId>
-  <version>1.6-SNAPSHOT</version>
 
   <name>Jackrabbit JCR Servlets</name>
   <description>
@@ -42,7 +41,6 @@
     <dependency>
       <groupId>javax.jcr</groupId>
       <artifactId>jcr</artifactId>
-      <version>1.0</version>
     </dependency>
     <dependency>
       <groupId>javax.servlet</groupId>
@@ -53,18 +51,18 @@
     <dependency>
       <groupId>org.apache.jackrabbit</groupId>
       <artifactId>jackrabbit-jcr-commons</artifactId>
-      <version>1.5.5</version>
+      <version>2.1-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.apache.jackrabbit</groupId>
       <artifactId>jackrabbit-jcr-rmi</artifactId>
-      <version>1.5.0</version>
+      <version>2.1-SNAPSHOT</version>
       <optional>true</optional>
     </dependency>
     <dependency>
       <groupId>org.apache.jackrabbit</groupId>
       <artifactId>jackrabbit-core</artifactId>
-      <version>1.5.5</version>
+      <version>2.1-SNAPSHOT</version>
       <optional>true</optional>
     </dependency>
   </dependencies>

Modified: jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/AbstractRepositoryServlet.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/AbstractRepositoryServlet.java?rev=901170&r1=901142&r2=901170&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/AbstractRepositoryServlet.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/AbstractRepositoryServlet.java
Wed Jan 20 12:51:08 2010
@@ -20,6 +20,7 @@
 import java.util.Properties;
 
 import javax.jcr.Repository;
+import javax.jcr.RepositoryException;
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
@@ -75,7 +76,13 @@
     public void init() throws ServletException {
         getServletContext().setAttribute(
                 getAttributeName(),
-                new ProxyRepository(getRepositoryFactory()));
+                new ProxyRepository() {
+                    @Override
+                    protected Repository getRepository()
+                            throws RepositoryException {
+                        return AbstractRepositoryServlet.this.getRepository();
+                    }
+                });
     }
 
     /**
@@ -86,14 +93,14 @@
     }
 
     /**
-     * Returns the repository factory that will be used by the
+     * Returns the repository that will be used by the
      * {@link ProxyRepository} bound to the servlet context.
      *
-     * @return repository factory
-     * @throws ServletException if the factory could not be created
+     * @return repository
+     * @throws RepositoryException if the repository could not be created
      */
-    protected abstract RepositoryFactory getRepositoryFactory()
-        throws ServletException;
+    protected abstract Repository getRepository()
+        throws RepositoryException;
 
     /**
      * Returns the name of the repository attribute. The default

Modified: jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/ContextRepositoryServlet.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/ContextRepositoryServlet.java?rev=901170&r1=901142&r2=901170&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/ContextRepositoryServlet.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/ContextRepositoryServlet.java
Wed Jan 20 12:51:08 2010
@@ -17,10 +17,8 @@
 package org.apache.jackrabbit.servlet;
 
 import javax.jcr.Repository;
+import javax.jcr.RepositoryException;
 import javax.servlet.ServletContext;
-import javax.servlet.ServletException;
-
-import org.apache.jackrabbit.commons.repository.RepositoryFactory;
 
 /**
  * Servlet that makes a repository from one servlet context attribute
@@ -61,13 +59,12 @@
     private static final long serialVersionUID = 6222606878557491477L;
 
     /**
-     * Creates and returns a repository factory for accessing a repository
-     * in the configured servlet context attribute.
+     * Creates and returns the repository in the configured servlet
+     * context attribute.
      *
-     * @return repository factory
+     * @return repository
      */
-    protected RepositoryFactory getRepositoryFactory()
-            throws ServletException {
+    protected Repository getRepository() throws RepositoryException {
         String path = getInitParameter("path");
         String name = getInitParameter("name", Repository.class.getName());
 
@@ -77,15 +74,32 @@
         }
 
         if (path == null && name.equals(getAttributeName())) {
-            throw new ServletException(
+            throw new RepositoryException(
                     "Invalid configuration: Can not duplicate attribute "
                     + name + " of servlet " + getServletName());
         }
 
-        if (path != null) {
-            return new CrossContextRepositoryFactory(context, path, name);
+        ServletContext otherContext = context.getContext(path);
+        if (otherContext == null) {
+            throw new RepositoryException(
+                    "Repository not found: Servlet context " + path
+                    + " does not exist or is not accessible from context "
+                    + context.getServletContextName());
+        }
+
+        Object repository = otherContext.getAttribute(name);
+        if (repository instanceof Repository) {
+            return (Repository) repository;
+        } else if (repository != null) {
+            throw new RepositoryException(
+                    "Invalid repository: Attribute " + name
+                    + " in servet context " + otherContext.getServletContextName()
+                    + " is an instance of " + repository.getClass().getName());
         } else {
-            return new ContextRepositoryFactory(context, name);
+            throw new RepositoryException(
+                    "Repository not found: Attribute " + name
+                    + " does not exist in servet context "
+                    + otherContext.getServletContextName());
         }
     }
 

Modified: jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/JNDIRepositoryServlet.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/JNDIRepositoryServlet.java?rev=901170&r1=901142&r2=901170&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/JNDIRepositoryServlet.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/JNDIRepositoryServlet.java
Wed Jan 20 12:51:08 2010
@@ -20,12 +20,11 @@
 import java.util.Hashtable;
 
 import javax.jcr.Repository;
+import javax.jcr.RepositoryException;
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
-import javax.servlet.ServletException;
 
 import org.apache.jackrabbit.commons.repository.JNDIRepositoryFactory;
-import org.apache.jackrabbit.commons.repository.RepositoryFactory;
 
 /**
  * Servlet that makes a repository from JNDI available as an attribute
@@ -63,12 +62,11 @@
     private static final long serialVersionUID = 8952525573562952560L;
 
     /**
-     * Creates and returns a JNDI repository factory based on the configured
-     * init parameters.
+     * Returns a JNDI repository based on the configured init parameters.
      *
-     * @return JNDI repository factory
+     * @return JNDI repository
      */
-    protected RepositoryFactory getRepositoryFactory() throws ServletException {
+    protected Repository getRepository() throws RepositoryException {
         try {
             String location = Repository.class.getName().replace('.', '/');
             Hashtable environment = new Hashtable();
@@ -82,9 +80,9 @@
                 }
             }
             return new JNDIRepositoryFactory(
-                    new InitialContext(environment), location);
+                    new InitialContext(environment), location).getRepository();
         } catch (NamingException e) {
-            throw new ServletException(
+            throw new RepositoryException(
                     "Repository not found: Invalid JNDI context", e);
         }
     }

Modified: jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/jackrabbit/JackrabbitRepositoryServlet.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/jackrabbit/JackrabbitRepositoryServlet.java?rev=901170&r1=901142&r2=901170&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/jackrabbit/JackrabbitRepositoryServlet.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/jackrabbit/JackrabbitRepositoryServlet.java
Wed Jan 20 12:51:08 2010
@@ -22,12 +22,11 @@
 import java.io.InputStream;
 import java.io.OutputStream;
 
+import javax.jcr.Repository;
 import javax.jcr.RepositoryException;
 import javax.servlet.ServletException;
 
 import org.apache.jackrabbit.api.JackrabbitRepository;
-import org.apache.jackrabbit.commons.repository.RepositoryFactory;
-import org.apache.jackrabbit.commons.repository.SingletonRepositoryFactory;
 import org.apache.jackrabbit.core.RepositoryImpl;
 import org.apache.jackrabbit.core.config.RepositoryConfig;
 import org.apache.jackrabbit.servlet.AbstractRepositoryServlet;
@@ -119,13 +118,13 @@
     }
 
     /**
-     * Returns a repository factory that always returns the configured
-     * repository instance.
+     * Returns the configured repository instance.
      *
-     * @return repository factory
+     * @return repository
      */
-    protected RepositoryFactory getRepositoryFactory() {
-        return new SingletonRepositoryFactory(repository);
+    @Override
+    protected Repository getRepository() {
+        return repository;
     }
 
     /**

Modified: jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/JNDIRemoteBindingServlet.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/JNDIRemoteBindingServlet.java?rev=901170&r1=901142&r2=901170&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/JNDIRemoteBindingServlet.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/JNDIRemoteBindingServlet.java
Wed Jan 20 12:51:08 2010
@@ -25,7 +25,6 @@
 import javax.naming.NamingException;
 import javax.servlet.ServletException;
 
-import org.apache.jackrabbit.rmi.jackrabbit.JackrabbitServerAdapterFactory;
 import org.apache.jackrabbit.rmi.remote.RemoteRepository;
 import org.apache.jackrabbit.rmi.server.RemoteAdapterFactory;
 
@@ -44,8 +43,7 @@
  *   <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}.
+ *     constructor that takes no arguments.
  *   </dd>
  *   <dt>location</dt>
  *   <dd>

Modified: jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/JNDIRemoteRepositoryServlet.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/JNDIRemoteRepositoryServlet.java?rev=901170&r1=901142&r2=901170&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/JNDIRemoteRepositoryServlet.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/JNDIRemoteRepositoryServlet.java
Wed Jan 20 12:51:08 2010
@@ -20,13 +20,13 @@
 import java.util.Hashtable;
 
 import javax.jcr.Repository;
+import javax.jcr.RepositoryException;
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
 import javax.servlet.ServletException;
 
 import org.apache.jackrabbit.commons.repository.RepositoryFactory;
 import org.apache.jackrabbit.rmi.client.LocalAdapterFactory;
-import org.apache.jackrabbit.rmi.jackrabbit.JackrabbitClientAdapterFactory;
 import org.apache.jackrabbit.rmi.remote.RemoteRepository;
 import org.apache.jackrabbit.rmi.repository.JNDIRemoteRepositoryFactory;
 import org.apache.jackrabbit.servlet.AbstractRepositoryServlet;
@@ -46,8 +46,7 @@
  *   <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}.
+ *     public constructor that takes no arguments.
  *   </dd>
  *   <dt>location</dt>
  *   <dd>
@@ -75,13 +74,13 @@
     private static final long serialVersionUID = 9029928193416404478L;
 
     /**
-     * Creates and returns a factory for retrieving the remote repository
-     * in the configured JNDI location.
+     * Returns the remote repository in the configured JNDI location.
      *
-     * @return repository factory
-     * @throws ServletException if the factory could not be created
+     * @return repository
+     * @throws RepositoryException if the repository could not be accessed
      */
-    protected RepositoryFactory getRepositoryFactory() throws ServletException {
+    @Override
+    protected Repository getRepository() throws RepositoryException {
         String location =
             "//localhost/" + RemoteRepository.class.getName().replace('.', '/');
         try {
@@ -98,9 +97,9 @@
             }
             return new JNDIRemoteRepositoryFactory(
                     getLocalAdapterFactory(),
-                    new InitialContext(environment), location);
+                    new InitialContext(environment), location).getRepository();
         } catch (NamingException e) {
-            throw new ServletException(
+            throw new RepositoryException(
                     "Repository not found: Invalid JNDI context", e);
         }
     }

Modified: jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/RMIRemoteBindingServlet.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/RMIRemoteBindingServlet.java?rev=901170&r1=901142&r2=901170&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/RMIRemoteBindingServlet.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/RMIRemoteBindingServlet.java
Wed Jan 20 12:51:08 2010
@@ -17,15 +17,12 @@
 package org.apache.jackrabbit.servlet.remote;
 
 import java.net.MalformedURLException;
-import java.rmi.AlreadyBoundException;
 import java.rmi.Naming;
 import java.rmi.NotBoundException;
 import java.rmi.RemoteException;
 
 import javax.servlet.ServletException;
 
-import org.apache.jackrabbit.rmi.jackrabbit.JackrabbitServerAdapterFactory;
-
 /**
  * Servlet that binds a repository from a servlet context attribute in RMI.
  * <p>
@@ -40,8 +37,7 @@
  *   <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}.
+ *     constructor that takes no arguments.
  *   </dd>
  *   <dt>url</dt>
  *   <dd>

Modified: jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/RMIRemoteRepositoryServlet.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/RMIRemoteRepositoryServlet.java?rev=901170&r1=901142&r2=901170&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/RMIRemoteRepositoryServlet.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/RMIRemoteRepositoryServlet.java
Wed Jan 20 12:51:08 2010
@@ -16,10 +16,10 @@
  */
 package org.apache.jackrabbit.servlet.remote;
 
+import javax.jcr.Repository;
+import javax.jcr.RepositoryException;
 import javax.servlet.ServletException;
 
-import org.apache.jackrabbit.commons.repository.RepositoryFactory;
-import org.apache.jackrabbit.rmi.jackrabbit.JackrabbitClientAdapterFactory;
 import org.apache.jackrabbit.rmi.repository.RMIRemoteRepositoryFactory;
 import org.apache.jackrabbit.servlet.AbstractRepositoryServlet;
 
@@ -38,8 +38,7 @@
  *   <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}.
+ *     public constructor that takes no arguments.
  *   </dd>
  *   <dt>url</dt>
  *   <dd>
@@ -66,10 +65,12 @@
      * @return RMI repository factory
      * @throws ServletException if the factory could not be created
      */
-    protected RepositoryFactory getRepositoryFactory() throws ServletException {
+    @Override
+    protected Repository getRepository() throws RepositoryException {
         return new RMIRemoteRepositoryFactory(
                 getLocalAdapterFactory(),
-                getInitParameter("url", "//localhost/javax/jcr/Repository"));
+                getInitParameter("url", "//localhost/javax/jcr/Repository")
+                ).getRepository();
     }
 
 }

Modified: jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/RemoteBindingServlet.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/RemoteBindingServlet.java?rev=901170&r1=901142&r2=901170&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/RemoteBindingServlet.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/RemoteBindingServlet.java
Wed Jan 20 12:51:08 2010
@@ -26,9 +26,9 @@
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-import org.apache.jackrabbit.rmi.jackrabbit.JackrabbitServerAdapterFactory;
 import org.apache.jackrabbit.rmi.remote.RemoteRepository;
 import org.apache.jackrabbit.rmi.server.RemoteAdapterFactory;
+import org.apache.jackrabbit.rmi.server.ServerAdapterFactory;
 import org.apache.jackrabbit.servlet.ServletRepository;
 
 /**
@@ -49,8 +49,7 @@
  *   <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}.
+ *     constructor that takes no arguments.
  *   </dd>
  * </dl>
  *
@@ -99,7 +98,7 @@
             throws ServletException {
         String name = getInitParameter(RemoteAdapterFactory.class.getName());
         if (name == null) {
-            name = JackrabbitServerAdapterFactory.class.getName();
+            return new ServerAdapterFactory();
         }
         try {
             Class factoryClass = Class.forName(name);

Modified: jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/RemoteRepositoryServlet.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/RemoteRepositoryServlet.java?rev=901170&r1=901142&r2=901170&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/RemoteRepositoryServlet.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/RemoteRepositoryServlet.java
Wed Jan 20 12:51:08 2010
@@ -16,10 +16,10 @@
  */
 package org.apache.jackrabbit.servlet.remote;
 
-import javax.servlet.ServletException;
+import javax.jcr.RepositoryException;
 
+import org.apache.jackrabbit.rmi.client.ClientAdapterFactory;
 import org.apache.jackrabbit.rmi.client.LocalAdapterFactory;
-import org.apache.jackrabbit.rmi.jackrabbit.JackrabbitClientAdapterFactory;
 import org.apache.jackrabbit.servlet.AbstractRepositoryServlet;
 
 /**
@@ -37,8 +37,7 @@
  *   <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}.
+ *     public constructor that takes no arguments.
  *   </dd>
  * </dl>
  * <p>
@@ -54,27 +53,27 @@
      * Instantiates and returns the configured local adapter factory.
      *
      * @return local adapter factory
-     * @throws ServletException if the factory could not be instantiated
+     * @throws RepositoryException if the factory could not be instantiated
      */
     protected LocalAdapterFactory getLocalAdapterFactory()
-            throws ServletException {
+            throws RepositoryException {
         String name = getInitParameter(
                 LocalAdapterFactory.class.getName(),
-                JackrabbitClientAdapterFactory.class.getName());
+                ClientAdapterFactory.class.getName());
         try {
             Class factoryClass = Class.forName(name);
             return (LocalAdapterFactory) factoryClass.newInstance();
         } catch (ClassNotFoundException e) {
-            throw new ServletException(
+            throw new RepositoryException(
                     "Local adapter factory class not found: " + name, e);
         } catch (InstantiationException e) {
-            throw new ServletException(
+            throw new RepositoryException(
                     "Failed to instantiate the adapter factory: " + name, e);
         } catch (IllegalAccessException e) {
-            throw new ServletException(
+            throw new RepositoryException(
                     "Adapter factory constructor is not public: " + name, e);
         } catch (ClassCastException e) {
-            throw new ServletException(
+            throw new RepositoryException(
                     "Invalid local adapter factory class: " + name, e);
         }
     }

Modified: jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/URLRemoteBindingServlet.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/URLRemoteBindingServlet.java?rev=901170&r1=901142&r2=901170&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/URLRemoteBindingServlet.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/URLRemoteBindingServlet.java
Wed Jan 20 12:51:08 2010
@@ -23,8 +23,6 @@
 
 import javax.servlet.ServletException;
 
-import org.apache.jackrabbit.rmi.jackrabbit.JackrabbitServerAdapterFactory;
-
 /**
  * Servlet that writes the remote reference of a repository in the servlet
  * context to the configured URL.
@@ -40,8 +38,7 @@
  *   <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}.
+ *     constructor that takes no arguments.
  *   </dd>
  *   <dt>url</dt>
  *   <dd>

Modified: jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/URLRemoteRepositoryServlet.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/URLRemoteRepositoryServlet.java?rev=901170&r1=901142&r2=901170&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/URLRemoteRepositoryServlet.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/remote/URLRemoteRepositoryServlet.java
Wed Jan 20 12:51:08 2010
@@ -19,10 +19,9 @@
 import java.net.MalformedURLException;
 import java.net.URL;
 
-import javax.servlet.ServletException;
+import javax.jcr.Repository;
+import javax.jcr.RepositoryException;
 
-import org.apache.jackrabbit.commons.repository.RepositoryFactory;
-import org.apache.jackrabbit.rmi.jackrabbit.JackrabbitClientAdapterFactory;
 import org.apache.jackrabbit.rmi.repository.URLRemoteRepositoryFactory;
 import org.apache.jackrabbit.servlet.AbstractRepositoryServlet;
 
@@ -41,8 +40,7 @@
  *   <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}.
+ *     public constructor that takes no arguments.
  *   </dd>
  *   <dt>url</dt>
  *   <dd>
@@ -63,23 +61,23 @@
     private static final long serialVersionUID = 6144781813459102448L;
 
     /**
-     * Creates and returns a factory for retrieving the remote repository
-     * at the given URL.
+     * Returns the remote repository at the given URL.
      *
-     * @return repository factory
-     * @throws ServletException if the factory could not be created
+     * @return repository
+     * @throws RepositoryException if the repository could not be accessed
      */
-    protected RepositoryFactory getRepositoryFactory() throws ServletException {
+    @Override
+    protected Repository getRepository() throws RepositoryException {
         String url = getInitParameter("url");
         if (url == null) {
-            throw new ServletException("Missing init parameter: url");
+            throw new RepositoryException("Missing init parameter: url");
         }
 
         try {
             return new URLRemoteRepositoryFactory(
-                        getLocalAdapterFactory(), new URL(url));
+                        getLocalAdapterFactory(), new URL(url)).getRepository();
         } catch (MalformedURLException e) {
-            throw new ServletException("Invalid repository URL: " + url, e);
+            throw new RepositoryException("Invalid repository URL: " + url, e);
         }
     }
 

Modified: jackrabbit/trunk/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/pom.xml?rev=901170&r1=901169&r2=901170&view=diff
==============================================================================
--- jackrabbit/trunk/pom.xml (original)
+++ jackrabbit/trunk/pom.xml Wed Jan 20 12:51:08 2010
@@ -44,6 +44,7 @@
     <module>jackrabbit-webdav</module>
     <module>jackrabbit-jcr-server</module>
     <module>jackrabbit-jcr-rmi</module>
+    <module>jackrabbit-jcr-servlet</module>
     <module>jackrabbit-webapp</module>
     <module>jackrabbit-jca</module>
     <module>jackrabbit-spi</module>



Mime
View raw message