jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From resc...@apache.org
Subject svn commit: r1583981 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/ oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/ oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document...
Date Wed, 02 Apr 2014 11:53:02 GMT
Author: reschke
Date: Wed Apr  2 11:53:02 2014
New Revision: 1583981

URL: http://svn.apache.org/r1583981
Log:
OAK-1533 - remove JDBC URL specific constructors from -core

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentMK.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBBlobStore.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDataSourceFactory.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentStore.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/blob/RDBBlobStoreTest.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/NodeStoreFixture.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OakDocumentRDBRepositoryStub.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentMK.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentMK.java?rev=1583981&r1=1583980&r2=1583981&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentMK.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentMK.java
Wed Apr  2 11:53:02 2014
@@ -506,31 +506,6 @@ public class DocumentMK implements Micro
         }
 
         /**
-         * Sets a JDBC connection URL to use for the RDB document and blob
-         * stores.
-         *
-         * @return this
-         */
-        public Builder setRDBConnection(String jdbcurl, String username, String password)
{
-            this.documentStore = new RDBDocumentStore(jdbcurl, username, password, this);
-            this.blobStore = new RDBBlobStore(jdbcurl, username, password);
-            return this;
-        }
-
-        /**
-         * Sets a JDBC connection URLs to use for the RDB document and blob
-         * stores.
-         *
-         * @return this
-         */
-        public Builder setRDBConnection(String dsjdbcurl, String dsusername, String dspassword,
String bsjdbcurl,
-                String bsusername, String bspassword) {
-            this.documentStore = new RDBDocumentStore(dsjdbcurl, dsusername, dspassword,
this);
-            this.blobStore = new RDBBlobStore(bsjdbcurl, bsusername, bspassword);
-            return this;
-        }
-
-        /**
          * Sets a {@link DataSource} to use for the RDB document and blob
          * stores.
          *

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBBlobStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBBlobStore.java?rev=1583981&r1=1583980&r2=1583981&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBBlobStore.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBBlobStore.java
Wed Apr  2 11:53:02 2014
@@ -39,32 +39,6 @@ import org.slf4j.LoggerFactory;
 import com.google.common.collect.AbstractIterator;
 
 public class RDBBlobStore extends CachingBlobStore implements Closeable {
-    /**
-     * Creates a {@linkplain RDBBlobStore} instance using an embedded H2
-     * database in in-memory mode.
-     */
-    public RDBBlobStore() {
-        try {
-            String jdbcurl = "jdbc:h2:mem:oaknodes";
-            DataSource ds = RDBDataSourceFactory.forJdbcUrl(jdbcurl, "sa", "");
-            initialize(ds);
-        } catch (Exception ex) {
-            throw new MicroKernelException("initializing RDB blob store", ex);
-        }
-    }
-
-    /**
-     * Creates a {@linkplain RDBBlobStore} instance using the provided JDBC
-     * connection information.
-     */
-    public RDBBlobStore(String jdbcurl, String username, String password) {
-        try {
-            DataSource ds = RDBDataSourceFactory.forJdbcUrl(jdbcurl, username, password);
-            initialize(ds);
-        } catch (Exception ex) {
-            throw new MicroKernelException("initializing RDB blob store", ex);
-        }
-    }
 
     /**
      * Creates a {@linkplain RDBBlobStore} instance using the provided

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDataSourceFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDataSourceFactory.java?rev=1583981&r1=1583980&r2=1583981&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDataSourceFactory.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDataSourceFactory.java
Wed Apr  2 11:53:02 2014
@@ -23,16 +23,21 @@ import java.sql.SQLException;
 import javax.sql.DataSource;
 
 import org.apache.commons.dbcp.BasicDataSource;
+import org.apache.jackrabbit.mk.api.MicroKernelException;
 
 public class RDBDataSourceFactory {
 
-    public static DataSource forJdbcUrl(String url, String username, String passwd) throws
SQLException {
-        BasicDataSource bds = new BasicDataSource();
-        Driver d = DriverManager.getDriver(url);
-        bds.setDriverClassName(d.getClass().getName());
-        bds.setUsername(username);
-        bds.setPassword(passwd);
-        bds.setUrl(url);
-        return bds;
+    public static DataSource forJdbcUrl(String url, String username, String passwd) {
+        try {
+            BasicDataSource bds = new BasicDataSource();
+            Driver d = DriverManager.getDriver(url);
+            bds.setDriverClassName(d.getClass().getName());
+            bds.setUsername(username);
+            bds.setPassword(passwd);
+            bds.setUrl(url);
+            return bds;
+        } catch (SQLException ex) {
+            throw new MicroKernelException("trying to obtain driver for " + url, ex);
+        }
     }
 }

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentStore.java?rev=1583981&r1=1583980&r2=1583981&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentStore.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/rdb/RDBDocumentStore.java
Wed Apr  2 11:53:02 2014
@@ -77,19 +77,6 @@ public class RDBDocumentStore implements
         }
     }
 
-    /**
-     * Creates a {@linkplain RDBDocumentStore} instance using the provided JDBC
-     * connection information.
-     */
-    public RDBDocumentStore(String jdbcurl, String username, String password, DocumentMK.Builder
builder) {
-        try {
-            DataSource ds = RDBDataSourceFactory.forJdbcUrl(jdbcurl, username, password);
-            initialize(ds, builder);
-        } catch (Exception ex) {
-            throw new MicroKernelException("initializing RDB document store", ex);
-        }
-    }
-
     @Override
     public <T extends Document> T find(Collection<T> collection, String id) {
         return find(collection, id, Integer.MAX_VALUE);

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/blob/RDBBlobStoreTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/blob/RDBBlobStoreTest.java?rev=1583981&r1=1583980&r2=1583981&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/blob/RDBBlobStoreTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/document/blob/RDBBlobStoreTest.java
Wed Apr  2 11:53:02 2014
@@ -20,6 +20,7 @@ import java.util.Iterator;
 import java.util.List;
 
 import org.apache.jackrabbit.oak.plugins.document.rdb.RDBBlobStore;
+import org.apache.jackrabbit.oak.plugins.document.rdb.RDBDataSourceFactory;
 import org.apache.jackrabbit.oak.spi.blob.AbstractBlobStoreTest;
 import org.junit.After;
 import org.junit.Before;
@@ -36,7 +37,7 @@ public class RDBBlobStoreTest extends Ab
     @Before
     @Override
     public void setUp() throws Exception {
-        blobStore = new RDBBlobStore();
+        blobStore = new RDBBlobStore(RDBDataSourceFactory.forJdbcUrl("jdbc:h2:mem:oakblobs",
"sa", ""));
         blobStore.setBlockSize(128);
         blobStore.setBlockSizeMin(48);
         this.store = blobStore;

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/NodeStoreFixture.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/NodeStoreFixture.java?rev=1583981&r1=1583980&r2=1583981&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/NodeStoreFixture.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/NodeStoreFixture.java
Wed Apr  2 11:53:02 2014
@@ -23,12 +23,15 @@ import java.io.File;
 import java.io.IOException;
 import java.util.UUID;
 
+import javax.sql.DataSource;
+
 import com.mongodb.DB;
 
 import org.apache.jackrabbit.mk.core.MicroKernelImpl;
 import org.apache.jackrabbit.oak.kernel.KernelNodeStore;
 import org.apache.jackrabbit.oak.plugins.document.DocumentMK;
 import org.apache.jackrabbit.oak.plugins.document.DocumentNodeStore;
+import org.apache.jackrabbit.oak.plugins.document.rdb.RDBDataSourceFactory;
 import org.apache.jackrabbit.oak.plugins.document.util.MongoConnection;
 import org.apache.jackrabbit.oak.plugins.segment.SegmentNodeStore;
 import org.apache.jackrabbit.oak.plugins.segment.SegmentStore;
@@ -82,14 +85,16 @@ public abstract class NodeStoreFixture {
         public NodeStore createNodeStore() {
             String id = UUID.randomUUID().toString();
             String folder = (new File("target")).isDirectory() ? "target/" : "";
-            return new DocumentMK.Builder().setRDBConnection("jdbc:h2:file:" + folder + id
+ ";MVCC=true", "sa", "").getNodeStore();
+            DataSource ds = RDBDataSourceFactory.forJdbcUrl("jdbc:h2:file:" + folder + id
+ ";MVCC=true", "sa", "");
+            return new DocumentMK.Builder().setRDBConnection(ds).getNodeStore();
         }
 
         @Override
         public NodeStore createNodeStore(int clusterNodeId) {
             try {
                 String folder = (new File("target")).isDirectory() ? "target/" : "";
-                return new DocumentMK.Builder().setRDBConnection("jdbc:h2:file:" + folder
+ "oaknodes-" + clusterNodeId, "sa", "").getNodeStore();
+                DataSource ds = RDBDataSourceFactory.forJdbcUrl("jdbc:h2:file:" + folder
+ "oaknodes-" + clusterNodeId, "sa", "");
+                return new DocumentMK.Builder().setRDBConnection(ds).getNodeStore();
             } catch (Exception e) {
                 return null;
             }

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OakDocumentRDBRepositoryStub.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OakDocumentRDBRepositoryStub.java?rev=1583981&r1=1583980&r2=1583981&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OakDocumentRDBRepositoryStub.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OakDocumentRDBRepositoryStub.java
Wed Apr  2 11:53:02 2014
@@ -32,6 +32,7 @@ import javax.jcr.UnsupportedRepositoryOp
 import org.apache.jackrabbit.api.JackrabbitSession;
 import org.apache.jackrabbit.oak.plugins.document.DocumentMK;
 import org.apache.jackrabbit.oak.plugins.document.DocumentNodeStore;
+import org.apache.jackrabbit.oak.plugins.document.rdb.RDBDataSourceFactory;
 import org.apache.jackrabbit.test.NotExecutableException;
 import org.apache.jackrabbit.test.RepositoryStub;
 
@@ -87,7 +88,7 @@ public class OakDocumentRDBRepositoryStu
         DocumentNodeStore m = new DocumentMK.Builder()
                 .setClusterId(1)
                 .memoryCacheSize(64 * 1024 * 1024)
-                .setRDBConnection(url, username, password)
+                .setRDBConnection(RDBDataSourceFactory.forJdbcUrl(url, username, password))
                 .getNodeStore();
         return new Jcr(m).createRepository();
     }



Mime
View raw message