jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: r386638 - in /incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core: fs/db/DB2FileSystem.java fs/db/DbFileSystem.java state/db/SimpleDbPersistenceManager.java
Date Fri, 17 Mar 2006 13:50:46 GMT
Author: stefan
Date: Fri Mar 17 05:50:42 2006
New Revision: 386638

URL: http://svn.apache.org/viewcvs?rev=386638&view=rev
Log:
JCR-355: Extract JDBC Connection Init

Modified:
    incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/fs/db/DB2FileSystem.java
    incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/fs/db/DbFileSystem.java
    incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/db/SimpleDbPersistenceManager.java

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/fs/db/DB2FileSystem.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/fs/db/DB2FileSystem.java?rev=386638&r1=386637&r2=386638&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/fs/db/DB2FileSystem.java
(original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/fs/db/DB2FileSystem.java
Fri Mar 17 05:50:42 2006
@@ -20,8 +20,6 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.sql.DriverManager;
-
 /**
  * <code>DB2FileSystem</code> is a JDBC-based <code>FileSystem</code>
  * implementation for Jackrabbit that persists file system entries in a
@@ -84,9 +82,7 @@
 
         try {
             // setup jdbc connection
-            Class.forName(driver);
-            con = DriverManager.getConnection(url, user, password);
-            con.setAutoCommit(true);
+            initConnection();
 
             // make sure schemaObjectPrefix consists of legal name characters only
             prepareSchemaObjectPrefix();

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/fs/db/DbFileSystem.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/fs/db/DbFileSystem.java?rev=386638&r1=386637&r2=386638&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/fs/db/DbFileSystem.java
(original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/fs/db/DbFileSystem.java
Fri Mar 17 05:50:42 2006
@@ -261,9 +261,7 @@
 
         try {
             // setup jdbc connection
-            Class.forName(driver);
-            con = DriverManager.getConnection(url, user, password);
-            con.setAutoCommit(true);
+            initConnection();
 
             // make sure schemaObjectPrefix consists of legal name characters only
             prepareSchemaObjectPrefix();
@@ -1166,7 +1164,18 @@
         }
     }
 
-    //-------------------------------------------------< misc. helper methods >
+    //----------------------------------< misc. helper methods & overridables >
+    /**
+     * Initialize the JDBC connection.
+     *
+     * @throws Exception if an error occurs
+     */
+    protected void initConnection() throws Exception {
+        Class.forName(driver);
+        con = DriverManager.getConnection(url, user, password);
+        con.setAutoCommit(false);
+    }
+
     /**
      * Makes sure that <code>schemaObjectPrefix</code> does only consist of
      * characters that are allowed in names on the target database. Illegal

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/db/SimpleDbPersistenceManager.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/db/SimpleDbPersistenceManager.java?rev=386638&r1=386637&r2=386638&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/db/SimpleDbPersistenceManager.java
(original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/db/SimpleDbPersistenceManager.java
Fri Mar 17 05:50:42 2006
@@ -293,9 +293,7 @@
         }
 
         // setup jdbc connection
-        Class.forName(driver);
-        con = DriverManager.getConnection(url, user, password);
-        con.setAutoCommit(false);
+        initConnection();
 
         // make sure schemaObjectPrefix consists of legal name characters only
         prepareSchemaObjectPrefix();
@@ -900,7 +898,18 @@
         }
     }
 
-    //-------------------------------------------------< misc. helper methods >
+    //----------------------------------< misc. helper methods & overridables >
+    /**
+     * Initialize the JDBC connection.
+     *
+     * @throws Exception if an error occurs
+     */
+    protected void initConnection() throws Exception {
+        Class.forName(driver);
+        con = DriverManager.getConnection(url, user, password);
+        con.setAutoCommit(false);
+    }
+
     /**
      * Resets the given <code>PreparedStatement</code> by clearing the parameters
      * and warnings contained.



Mime
View raw message