jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1133911 - /jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/MicroKernelFactory.java
Date Thu, 09 Jun 2011 15:07:31 GMT
Author: thomasm
Date: Thu Jun  9 15:07:30 2011
New Revision: 1133911

URL: http://svn.apache.org/viewvc?rev=1133911&view=rev
Log:
Allow to re-use and clean the in-memory implementation.

Modified:
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/MicroKernelFactory.java

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/MicroKernelFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/MicroKernelFactory.java?rev=1133911&r1=1133910&r2=1133911&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/MicroKernelFactory.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/MicroKernelFactory.java
Thu Jun  9 15:07:30 2011
@@ -38,13 +38,21 @@ public class MicroKernelFactory {
      * @return a new instance
      */
     public static MicroKernel getInstance(String url) {
+        boolean clean = false;
+        if (url.endsWith(";clean")) {
+            url = url.substring(0, url.length() - ";clean".length());
+            clean = true;
+        }
         if (url.startsWith("mem:")) {
-            return new MemoryKernelImpl();
+            MemoryKernelImpl impl = MemoryKernelImpl.get(url.substring("mem:".length()));
+            if (clean) {
+                impl.clear();
+            }
+            return impl;
         } else if (url.startsWith("fs:")) {
             String dir = url.substring("fs:".length());
             dir = dir.replaceAll("\\{homeDir\\}", System.getProperty("homeDir", "."));
-            if (dir.endsWith(";clean")) {
-                dir = dir.substring(0, dir.indexOf(";clean"));
+            if (clean) {
                 new File(dir, ".mk/db/revs.h2.db").delete();
             }
             return new MicroKernelImpl(dir);



Mime
View raw message