jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r573272 - in /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence: bundle/BundleDbPersistenceManager.java bundle/OraclePersistenceManager.java db/DatabasePersistenceManager.java
Date Thu, 06 Sep 2007 14:05:40 GMT
Author: thomasm
Date: Thu Sep  6 07:05:40 2007
New Revision: 573272

URL: http://svn.apache.org/viewvc?rev=573272&view=rev
Log:
JCR-1116: Database persistence managers: log database and driver name and version

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/BundleDbPersistenceManager.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/OraclePersistenceManager.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/db/DatabasePersistenceManager.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/BundleDbPersistenceManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/BundleDbPersistenceManager.java?rev=573272&r1=573271&r2=573272&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/BundleDbPersistenceManager.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/BundleDbPersistenceManager.java
Thu Sep  6 07:05:40 2007
@@ -25,7 +25,6 @@
 import org.apache.jackrabbit.core.state.NodeReferencesId;
 import org.apache.jackrabbit.core.state.NodeReferences;
 import org.apache.jackrabbit.core.persistence.PMContext;
-import org.apache.jackrabbit.core.persistence.AbstractPersistenceManager;
 import org.apache.jackrabbit.core.persistence.bundle.util.DbNameIndex;
 import org.apache.jackrabbit.core.persistence.bundle.util.NodePropBundle;
 import org.apache.jackrabbit.core.persistence.bundle.util.BundleBinding;
@@ -538,6 +537,15 @@
         Driver drv = (Driver) Class.forName(driver).newInstance();
         log.info("JDBC driver created: {}", drv);
         con = DriverManager.getConnection(url, user, password);
+        
+        DatabaseMetaData meta = con.getMetaData();
+        try {
+            log.info("Database: " + meta.getDatabaseProductName() + " / " + meta.getDatabaseProductVersion());
+            log.info("Driver: " + meta.getDriverName() + " / " + meta.getDriverVersion());
+        } catch (SQLException e) {
+            log.warn("Can not retrieve database and driver name / version", e);
+        }
+        
         con.setAutoCommit(true);
 
         // make sure schemaObjectPrefix consists of legal name characters only

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/OraclePersistenceManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/OraclePersistenceManager.java?rev=573272&r1=573271&r2=573272&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/OraclePersistenceManager.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/OraclePersistenceManager.java
Thu Sep  6 07:05:40 2007
@@ -23,6 +23,8 @@
 import org.apache.jackrabbit.core.persistence.bundle.util.NGKDbNameIndex;
 import org.apache.jackrabbit.core.persistence.bundle.util.DbNameIndex;
 import org.apache.jackrabbit.util.Text;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * Extends the {@link BundleDbPersistenceManager} by Oracle specific code.
@@ -48,6 +50,11 @@
     /** the cvs/svn id */
     static final String CVS_ID = "$URL$ $Rev$ $Date$";
 
+    /**
+     * the default logger
+     */
+    private static Logger log = LoggerFactory.getLogger(OraclePersistenceManager.class);
+
     /** the variable for the Oracle table space */
     public static final String TABLE_SPACE_VARIABLE =
         "${tableSpace}";
@@ -104,17 +111,20 @@
             setSchemaObjectPrefix(context.getHomeDir().getName() + "_");
         }
         super.init(context);
-/*
+        
         // check driver version
-        DatabaseMetaData metaData = con.getMetaData();
-        if (metaData.getDriverMajorVersion() < 10) {
-            // oracle drivers prior to version 10 only support
-            // writing BLOBs up to 32k in size...
-            log.warn("unsupported driver version detected: "
-                    + metaData.getDriverName()
-                    + " v" + metaData.getDriverVersion());
+        try {
+            DatabaseMetaData metaData = con.getMetaData();
+            if (metaData.getDriverMajorVersion() < 10) {
+                // Oracle drivers prior to version 10 only support
+                // writing BLOBs up to 32k in size...
+                log.warn("Unsupported driver version detected: "
+                        + metaData.getDriverName()
+                        + " v" + metaData.getDriverVersion());
+            }
+        } catch (SQLException e) {
+            log.warn("Can not retrieve driver version", e);
         }
-*/
     }
 
     /**

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/db/DatabasePersistenceManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/db/DatabasePersistenceManager.java?rev=573272&r1=573271&r2=573272&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/db/DatabasePersistenceManager.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/db/DatabasePersistenceManager.java
Thu Sep  6 07:05:40 2007
@@ -195,6 +195,14 @@
         // setup jdbc connection
         initConnection();
 
+        DatabaseMetaData meta = con.getMetaData();
+        try {
+            log.info("Database: " + meta.getDatabaseProductName() + " / " + meta.getDatabaseProductVersion());
+            log.info("Driver: " + meta.getDriverName() + " / " + meta.getDriverVersion());
+        } catch (SQLException e) {
+            log.warn("Can not retrieve database and driver name / version", e);
+        }
+
         // make sure schemaObjectPrefix consists of legal name characters only
         prepareSchemaObjectPrefix();
 
@@ -237,7 +245,7 @@
 
         try {
             // close shared prepared statements
-            for (Iterator it = preparedStatements.values().iterator(); it.hasNext(); ) {
+            for (Iterator it = preparedStatements.values().iterator(); it.hasNext();) {
                 closeStatement((PreparedStatement) it.next());
             }
             preparedStatements.clear();
@@ -777,7 +785,7 @@
         // gracefully in order to avoid potential memory leaks
 
         // close shared prepared statements
-        for (Iterator it = preparedStatements.values().iterator(); it.hasNext(); ) {
+        for (Iterator it = preparedStatements.values().iterator(); it.hasNext();) {
             PreparedStatement stmt = ((PreparedStatement) it.next());
             if (stmt != null) {
                 try {
@@ -1160,12 +1168,12 @@
             return super.skip(n);
         }
 
-        public int read(byte b[]) throws IOException {
+        public int read(byte[] b) throws IOException {
             consumed = true;
             return super.read(b);
         }
 
-        public int read(byte b[], int off, int len) throws IOException {
+        public int read(byte[] b, int off, int len) throws IOException {
             consumed = true;
             return super.read(b, off, len);
         }



Mime
View raw message