jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r897842 - in /jackrabbit/trunk: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/ jackrabbit-jcr2dav/src/main/java/org/apache/jackrabbit/jcr2dav/
Date Mon, 11 Jan 2010 11:38:32 GMT
Author: jukka
Date: Mon Jan 11 11:38:31 2010
New Revision: 897842

URL: http://svn.apache.org/viewvc?rev=897842&view=rev
Log:
JCR-2360: JcrUtils.getRepository(...) for simple repository access

Replace GenericRepositoryFactory.URI with JcrUtils.REPOSITORY_URI to keep JcrUtils more self-contained
and to allow later renaming of GenericRepositoryFactory to the more appropriate JndiRepositoryFactory.

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryFactoryImpl.java
    jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/GenericRepositoryFactory.java
    jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/JcrUtils.java
    jackrabbit/trunk/jackrabbit-jcr2dav/src/main/java/org/apache/jackrabbit/jcr2dav/Jcr2davRepositoryFactory.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryFactoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryFactoryImpl.java?rev=897842&r1=897841&r2=897842&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryFactoryImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryFactoryImpl.java
Mon Jan 11 11:38:31 2010
@@ -30,7 +30,7 @@
 import org.apache.jackrabbit.api.JackrabbitRepository;
 import org.apache.jackrabbit.api.JackrabbitRepositoryFactory;
 import org.apache.jackrabbit.api.management.RepositoryManager;
-import org.apache.jackrabbit.commons.GenericRepositoryFactory;
+import org.apache.jackrabbit.commons.JcrUtils;
 
 /**
  * <code>RepositoryFactoryImpl</code> implements a repository factory that
@@ -71,8 +71,8 @@
                 String conf = parameters.get(REPOSITORY_CONF).toString();
                 String home = parameters.get(REPOSITORY_HOME).toString();
                 return getOrCreateRepository(conf, home);
-            } else if (parameters.containsKey(GenericRepositoryFactory.URI)) {
-                Object parameter = parameters.get(GenericRepositoryFactory.URI);
+            } else if (parameters.containsKey(JcrUtils.REPOSITORY_URI)) {
+                Object parameter = parameters.get(JcrUtils.REPOSITORY_URI);
                 try {
                     URI uri = new URI(parameter.toString().trim());
                     if ("file".equalsIgnoreCase(uri.getScheme())) {

Modified: jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/GenericRepositoryFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/GenericRepositoryFactory.java?rev=897842&r1=897841&r2=897842&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/GenericRepositoryFactory.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/GenericRepositoryFactory.java
Mon Jan 11 11:38:31 2010
@@ -57,8 +57,8 @@
     /**
      * The repository URI parameter name.
      */
-    public static final String URI =
-        "org.apache.jackrabbit.repository.uri";
+    @Deprecated
+    public static final String URI = JcrUtils.REPOSITORY_URI;
 
     /**
      * The JNDI name parameter name.
@@ -81,8 +81,8 @@
             if (environment.containsKey(JNDI_NAME)) {
                 String name = environment.remove(JNDI_NAME).toString();
                 return getRepository(name, environment);
-            } else if (environment.containsKey(URI)) {
-                Object parameter = environment.remove(URI);
+            } else if (environment.containsKey(JcrUtils.REPOSITORY_URI)) {
+                Object parameter = environment.remove(JcrUtils.REPOSITORY_URI);
                 try {
                     URI uri = new URI(parameter.toString().trim());
                     if ("jndi".equalsIgnoreCase(uri.getScheme())) {

Modified: jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/JcrUtils.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/JcrUtils.java?rev=897842&r1=897841&r2=897842&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/JcrUtils.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/JcrUtils.java
Mon Jan 11 11:38:31 2010
@@ -51,6 +51,15 @@
 public class JcrUtils {
 
     /**
+     * The repository URI parameter name used by the
+     * {@link #getRepository(String)} method. All {@link RepositoryFactory}
+     * implementations that want to support this repository access convention
+     * should implement processing of this parameter.
+     */
+    public static final String REPOSITORY_URI =
+        "org.apache.jackrabbit.repository.uri";
+
+    /**
      * Private constructor to prevent instantiation of this class.
      */
     private JcrUtils() {
@@ -130,7 +139,7 @@
     public static Repository getRepository(String uri)
             throws RepositoryException {
         Map<String, String> parameters = new HashMap<String, String>();
-        parameters.put(GenericRepositoryFactory.URI, uri);
+        parameters.put(JcrUtils.REPOSITORY_URI, uri);
         return getRepository(parameters);
     }
 

Modified: jackrabbit/trunk/jackrabbit-jcr2dav/src/main/java/org/apache/jackrabbit/jcr2dav/Jcr2davRepositoryFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2dav/src/main/java/org/apache/jackrabbit/jcr2dav/Jcr2davRepositoryFactory.java?rev=897842&r1=897841&r2=897842&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2dav/src/main/java/org/apache/jackrabbit/jcr2dav/Jcr2davRepositoryFactory.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr2dav/src/main/java/org/apache/jackrabbit/jcr2dav/Jcr2davRepositoryFactory.java
Mon Jan 11 11:38:31 2010
@@ -26,6 +26,7 @@
 import javax.jcr.RepositoryFactory;
 
 import org.apache.jackrabbit.commons.GenericRepositoryFactory;
+import org.apache.jackrabbit.commons.JcrUtils;
 import org.apache.jackrabbit.jcr2spi.RepositoryImpl;
 import org.apache.jackrabbit.jcr2spi.Jcr2spiRepositoryFactory;
 import org.apache.jackrabbit.spi.RepositoryServiceFactory;
@@ -64,9 +65,6 @@
     private static final String DAVEX_URI =
         Spi2davexRepositoryServiceFactory.PARAM_REPOSITORY_URI;
 
-    private static final String GENERIC_URI =
-        GenericRepositoryFactory.URI;
-
     public Repository getRepository(Map parameters) throws RepositoryException {
         if (parameters == null) {
             return null;
@@ -76,9 +74,9 @@
         } else if (parameters.containsKey(DAVEX_URI)) {
             return getRepository(
                     new Spi2davexRepositoryServiceFactory(), parameters);
-        } else if (parameters.containsKey(GENERIC_URI)) {
+        } else if (parameters.containsKey(JcrUtils.REPOSITORY_URI)) {
             Map copy = new HashMap(parameters);
-            Object parameter = copy.remove(GENERIC_URI);
+            Object parameter = copy.remove(JcrUtils.REPOSITORY_URI);
             try {
                 URI uri = new URI(parameter.toString().trim());
                 String scheme = uri.getScheme();



Mime
View raw message