You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by re...@apache.org on 2013/12/10 17:00:07 UTC

svn commit: r1549879 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/sqlpersistence/SQLDocumentStore.java

Author: reschke
Date: Tue Dec 10 16:00:06 2013
New Revision: 1549879

URL: http://svn.apache.org/r1549879
Log:
OAK-1266 - work in progress SQL/JDBC DocumentStore implementation - change default constructor to create an in-memory DB instance

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/sqlpersistence/SQLDocumentStore.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/sqlpersistence/SQLDocumentStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/sqlpersistence/SQLDocumentStore.java?rev=1549879&r1=1549878&r2=1549879&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/sqlpersistence/SQLDocumentStore.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/sqlpersistence/SQLDocumentStore.java Tue Dec 10 16:00:06 2013
@@ -53,16 +53,11 @@ public class SQLDocumentStore implements
 
     /**
      * Creates a {@linkplain SQLDocumentStore} instance using an embedded H2
-     * database.
+     * database in in-memory mode.
      */
     public SQLDocumentStore() {
         try {
-            File dbDir = new File(".", "db");
-            if (!dbDir.exists()) {
-                dbDir.mkdirs();
-            }
-
-            String jdbcurl = "jdbc:h2:" + dbDir.getCanonicalPath() + "/revs";
+            String jdbcurl = "jdbc:h2:mem:oaknodes";
             initialize(jdbcurl, "sa", "");
         } catch (Exception ex) {
             throw new MicroKernelException("initializing SQL document store", ex);
@@ -166,10 +161,6 @@ public class SQLDocumentStore implements
         connection.setAutoCommit(false);
         Statement stmt = connection.createStatement();
 
-        // statement below needed while this is tested as a drop-in for the
-        // memory document store
-        stmt.execute("drop table if exists CLUSTERNODES");
-        stmt.execute("drop table if exists NODES");
         stmt.execute("create table if not exists CLUSTERNODES(ID varchar primary key, MODIFIED bigint, MODCOUNT bigint, DATA varchar)");
         stmt.execute("create table if not exists NODES(ID varchar primary key, MODIFIED bigint, MODCOUNT bigint, DATA varchar)");
     }