jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r792932 - in /jackrabbit/trunk/jackrabbit-core: ./ src/main/java/org/apache/jackrabbit/core/ src/test/java/org/apache/jackrabbit/core/
Date Fri, 10 Jul 2009 12:59:00 GMT
Author: mreutegg
Date: Fri Jul 10 12:58:59 2009
New Revision: 792932

URL: http://svn.apache.org/viewvc?rev=792932&view=rev
Log:
JCR-2203: Create default repository in target

Modified:
    jackrabbit/trunk/jackrabbit-core/pom.xml
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryFactoryImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/TransientRepository.java
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/TransientRepositoryTest.java

Modified: jackrabbit/trunk/jackrabbit-core/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/pom.xml?rev=792932&r1=792931&r2=792932&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/pom.xml (original)
+++ jackrabbit/trunk/jackrabbit-core/pom.xml Fri Jul 10 12:58:59 2009
@@ -88,6 +88,10 @@
               <value>target/derby.log</value>
             </property>
             <property>
+              <name>org.apache.jackrabbit.repository.home</name>
+              <value>target/repository-factory-test</value>
+            </property>
+            <property>
               <name>known.issues</name>
               <value>
                 org.apache.jackrabbit.core.xml.DocumentViewTest#testMultiValue

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=792932&r1=792931&r2=792932&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
Fri Jul 10 12:58:59 2009
@@ -82,12 +82,16 @@
             throws RepositoryException {
         JackrabbitRepository repo = REPOSITORY_INSTANCES.get(home);
         if (repo == null) {
+            TransientRepository tr;
             if (home == null) {
-                repo = new TransientRepository();
+                tr = new TransientRepository();
+                // also remember this instance as the default repository
+                REPOSITORY_INSTANCES.put(null, tr);
             } else {
-                repo = new TransientRepository(conf, home);
+                tr = new TransientRepository(conf, home);
             }
-            REPOSITORY_INSTANCES.put(home, repo);
+            REPOSITORY_INSTANCES.put(tr.getHomeDir(), tr);
+            repo = tr;
         }
         return repo;
     }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/TransientRepository.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/TransientRepository.java?rev=792932&r1=792931&r2=792932&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/TransientRepository.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/TransientRepository.java
Fri Jul 10 12:58:59 2009
@@ -121,13 +121,20 @@
     private final Properties descriptors;
 
     /**
+     * The path to the repository home directory.
+     */
+    private final String home;
+
+    /**
      * Creates a transient repository proxy that will use the given repository
      * factory to initialize the underlying repository instances.
      *
      * @param factory repository factory
+     * @param home    the path to the repository home directory.
      */
-    public TransientRepository(RepositoryFactory factory) {
+    public TransientRepository(RepositoryFactory factory, String home) {
         this.factory = factory;
+        this.home = home;
         this.repository = null;
         this.descriptors = new Properties();
 
@@ -171,7 +178,7 @@
             public RepositoryImpl getRepository() throws RepositoryException {
                 return RepositoryImpl.create(config);
             }
-        });
+        }, config.getHomeDir());
     }
 
     /**
@@ -231,7 +238,14 @@
                             "Invalid repository configuration file: " + xml, e);
                 }
             }
-        });
+        }, dir.getAbsolutePath());
+    }
+
+    /**
+     * @return the path to the repository home directory.
+     */
+    public String getHomeDir() {
+        return home;
     }
 
     /**

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/TransientRepositoryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/TransientRepositoryTest.java?rev=792932&r1=792931&r2=792932&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/TransientRepositoryTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/TransientRepositoryTest.java
Fri Jul 10 12:58:59 2009
@@ -44,7 +44,7 @@
                 public RepositoryImpl getRepository() throws RepositoryException {
                     throw new UnsupportedRepositoryOperationException();
                 }
-            });
+            }, null);
     }
 
     /**



Mime
View raw message