jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1333505 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/mk/ oak-core/src/main/java/org/apache/jackrabbit/mk/fs/ oak-core/src/main/java/org/apache/jackrabbit/mk/simple/ oak-core/src/test/java/org/apache/jackrabbit/m...
Date Thu, 03 May 2012 15:31:18 GMT
Author: jukka
Date: Thu May  3 15:31:17 2012
New Revision: 1333505

URL: http://svn.apache.org/viewvc?rev=1333505&view=rev
Log:
OAK-56: File system abstraction

Move .mk.fs to oak-mk.
Replace dependencies in oak-core with simpler alternatives.

Added:
    jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/fs/
    jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/fs/FileBase.java  
(contents, props changed)
      - copied, changed from r1333502, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/fs/FileBase.java
    jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/fs/FileCache.java 
 (contents, props changed)
      - copied, changed from r1333502, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/fs/FileCache.java
    jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/fs/FileChannelInputStream.java
  (contents, props changed)
      - copied, changed from r1333502, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/fs/FileChannelInputStream.java
    jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/fs/FilePath.java  
(contents, props changed)
      - copied, changed from r1333502, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/fs/FilePath.java
    jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/fs/FilePathCache.java
  (contents, props changed)
      - copied, changed from r1333502, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/fs/FilePathCache.java
    jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/fs/FilePathDisk.java
  (contents, props changed)
      - copied, changed from r1333502, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/fs/FilePathDisk.java
    jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/fs/FilePathWrapper.java
  (contents, props changed)
      - copied, changed from r1333502, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/fs/FilePathWrapper.java
    jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/fs/FileUtils.java 
 (contents, props changed)
      - copied, changed from r1333502, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/fs/FileUtils.java
    jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/fs/
    jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/fs/FileSystemTest.java
  (contents, props changed)
      - copied, changed from r1333502, jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/mk/fs/FileSystemTest.java
Removed:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/fs/FileBase.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/fs/FileCache.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/fs/FileChannelInputStream.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/fs/FilePath.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/fs/FilePathCache.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/fs/FilePathDisk.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/fs/FilePathWrapper.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/fs/FileUtils.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/mk/fs/FileSystemTest.java
Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/MicroKernelFactory.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/simple/NodeMapInDb.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/mk/MultiMkTestBase.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/MicroKernelFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/MicroKernelFactory.java?rev=1333505&r1=1333504&r2=1333505&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/MicroKernelFactory.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/MicroKernelFactory.java
Thu May  3 15:31:17 2012
@@ -20,7 +20,6 @@ import org.apache.jackrabbit.mk.api.Micr
 import org.apache.jackrabbit.mk.api.MicroKernelException;
 import org.apache.jackrabbit.mk.client.Client;
 import org.apache.jackrabbit.mk.core.MicroKernelImpl;
-import org.apache.jackrabbit.mk.fs.FileUtils;
 import org.apache.jackrabbit.mk.index.IndexWrapper;
 import org.apache.jackrabbit.mk.server.Server;
 import org.apache.jackrabbit.mk.simple.SimpleKernelImpl;
@@ -29,6 +28,7 @@ import org.apache.jackrabbit.mk.wrapper.
 import org.apache.jackrabbit.mk.wrapper.SecurityWrapper;
 import org.apache.jackrabbit.mk.wrapper.VirtualRepositoryWrapper;
 
+import java.io.File;
 import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
@@ -75,6 +75,8 @@ public class MicroKernelFactory {
             tail = tail.replaceAll("\\{homeDir\\}", System.getProperty("homeDir", "."));
 
             if (clean) {
+                // TODO: The factory should not control repository lifecycle
+                // See also https://issues.apache.org/jira/browse/OAK-32
                 String dir;
                 if (head.equals("fs")) {
                     dir = tail + "/.mk";
@@ -82,12 +84,7 @@ public class MicroKernelFactory {
                     dir = tail.substring(tail.lastIndexOf(':') + 1);
                     INSTANCES.remove(tail);
                 }
-
-                try {
-                    FileUtils.deleteRecursive(dir, false);
-                } catch (Exception e) {
-                    throw ExceptionFactory.convert(e);
-                }
+                deleteRecursive(new File(dir));
             }
 
             if (head.equals("fs")) {
@@ -174,4 +171,17 @@ public class MicroKernelFactory {
         }
     }
 
+    /**
+     * Delete a directory or file and all subdirectories and files inside it.
+     *
+     * @param path the path
+     */
+    private static void deleteRecursive(File file) {
+        File[] files = file.listFiles();
+        for (int i = 0; files != null && i < files.length; i++) {
+            deleteRecursive(files[i]);
+        }
+        file.delete();
+    }
+
 }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/simple/NodeMapInDb.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/simple/NodeMapInDb.java?rev=1333505&r1=1333504&r2=1333505&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/simple/NodeMapInDb.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/simple/NodeMapInDb.java
Thu May  3 15:31:17 2012
@@ -16,6 +16,7 @@
  */
 package org.apache.jackrabbit.mk.simple;
 
+import java.io.File;
 import java.sql.Connection;
 import java.sql.DriverManager;
 import java.sql.PreparedStatement;
@@ -26,7 +27,6 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.TreeMap;
 import java.util.Map.Entry;
-import org.apache.jackrabbit.mk.fs.FilePath;
 import org.apache.jackrabbit.mk.json.JsopBuilder;
 import org.apache.jackrabbit.mk.simple.NodeImpl.ChildVisitor;
 import org.apache.jackrabbit.mk.util.Cache;
@@ -49,7 +49,8 @@ public class NodeMapInDb extends NodeMap
 
     NodeMapInDb(String dir) {
         try {
-            url = "jdbc:h2:" + FilePath.get(dir).resolve("nodes").toRealPath().toString()
+ System.getProperty("mk.db", "");
+            String path = new File(dir, "nodes").getAbsolutePath();
+            url = "jdbc:h2:" + path + System.getProperty("mk.db", "");
             Class.forName("org.h2.Driver");
             conn = DriverManager.getConnection(url);
             Statement stat = conn.createStatement();

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/mk/MultiMkTestBase.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/mk/MultiMkTestBase.java?rev=1333505&r1=1333504&r2=1333505&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/mk/MultiMkTestBase.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/mk/MultiMkTestBase.java
Thu May  3 15:31:17 2012
@@ -22,7 +22,6 @@ import java.util.Collection;
 import java.util.List;
 
 import org.apache.jackrabbit.mk.api.MicroKernel;
-import org.apache.jackrabbit.mk.fs.FileUtils;
 import org.apache.jackrabbit.mk.json.JsopBuilder;
 import org.apache.jackrabbit.mk.json.JsopReader;
 import org.apache.jackrabbit.mk.json.JsopTokenizer;
@@ -56,7 +55,6 @@ public class MultiMkTestBase {
 
     @Before
     public void setUp() throws Exception {
-        FileUtils.deleteRecursive("target/temp", false);
         mk = MicroKernelFactory.getInstance(url + ";clean");
         cleanRepository(mk);
 

Copied: jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/fs/FileBase.java
(from r1333502, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/fs/FileBase.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/fs/FileBase.java?p2=jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/fs/FileBase.java&p1=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/fs/FileBase.java&r1=1333502&r2=1333505&rev=1333505&view=diff
==============================================================================
    (empty)

Propchange: jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/fs/FileBase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/fs/FileCache.java
(from r1333502, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/fs/FileCache.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/fs/FileCache.java?p2=jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/fs/FileCache.java&p1=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/fs/FileCache.java&r1=1333502&r2=1333505&rev=1333505&view=diff
==============================================================================
    (empty)

Propchange: jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/fs/FileCache.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/fs/FileChannelInputStream.java
(from r1333502, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/fs/FileChannelInputStream.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/fs/FileChannelInputStream.java?p2=jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/fs/FileChannelInputStream.java&p1=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/fs/FileChannelInputStream.java&r1=1333502&r2=1333505&rev=1333505&view=diff
==============================================================================
    (empty)

Propchange: jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/fs/FileChannelInputStream.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/fs/FilePath.java
(from r1333502, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/fs/FilePath.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/fs/FilePath.java?p2=jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/fs/FilePath.java&p1=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/fs/FilePath.java&r1=1333502&r2=1333505&rev=1333505&view=diff
==============================================================================
    (empty)

Propchange: jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/fs/FilePath.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/fs/FilePathCache.java
(from r1333502, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/fs/FilePathCache.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/fs/FilePathCache.java?p2=jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/fs/FilePathCache.java&p1=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/fs/FilePathCache.java&r1=1333502&r2=1333505&rev=1333505&view=diff
==============================================================================
    (empty)

Propchange: jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/fs/FilePathCache.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/fs/FilePathDisk.java
(from r1333502, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/fs/FilePathDisk.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/fs/FilePathDisk.java?p2=jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/fs/FilePathDisk.java&p1=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/fs/FilePathDisk.java&r1=1333502&r2=1333505&rev=1333505&view=diff
==============================================================================
    (empty)

Propchange: jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/fs/FilePathDisk.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/fs/FilePathWrapper.java
(from r1333502, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/fs/FilePathWrapper.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/fs/FilePathWrapper.java?p2=jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/fs/FilePathWrapper.java&p1=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/fs/FilePathWrapper.java&r1=1333502&r2=1333505&rev=1333505&view=diff
==============================================================================
    (empty)

Propchange: jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/fs/FilePathWrapper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/fs/FileUtils.java
(from r1333502, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/fs/FileUtils.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/fs/FileUtils.java?p2=jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/fs/FileUtils.java&p1=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/fs/FileUtils.java&r1=1333502&r2=1333505&rev=1333505&view=diff
==============================================================================
    (empty)

Propchange: jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/fs/FileUtils.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/fs/FileSystemTest.java
(from r1333502, jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/mk/fs/FileSystemTest.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/fs/FileSystemTest.java?p2=jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/fs/FileSystemTest.java&p1=jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/mk/fs/FileSystemTest.java&r1=1333502&r2=1333505&rev=1333505&view=diff
==============================================================================
    (empty)

Propchange: jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/fs/FileSystemTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message