jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From marti...@apache.org
Subject svn commit: r796957 - in /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core: data/db/ fs/db/ journal/ persistence/bundle/ persistence/db/
Date Thu, 23 Jul 2009 06:10:19 GMT
Author: martijnh
Date: Thu Jul 23 06:10:19 2009
New Revision: 796957

URL: http://svn.apache.org/viewvc?rev=796957&view=rev
Log:
JCR-2034 Add an option so skip the "checkSchema" methods

* Fixed by adding the configuration parameter "schemaCheckEnabled" (true (default) or false).

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/db/DbDataStore.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/db/DatabaseFileSystem.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/DatabaseJournal.java
    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/db/DatabasePersistenceManager.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/db/DbDataStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/db/DbDataStore.java?rev=796957&r1=796956&r2=796957&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/db/DbDataStore.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/db/DbDataStore.java
Thu Jul 23 06:10:19 2009
@@ -66,6 +66,7 @@
  *     <param name="{@link #setCopyWhenReading(boolean) copyWhenReading}" value="true"/>
  *     <param name="{@link #setTablePrefix(String) tablePrefix}" value=""/>
  *     <param name="{@link #setSchemaObjectPrefix(String) schemaObjectPrefix}" value=""/>
+ *     <param name="{@link #setSchemaCheckEnabled(String) schemaCheckEnabled}" value="true"/>
  * &lt/DataStore>
  * </pre>
  * <p>
@@ -192,6 +193,11 @@
     protected String schemaObjectPrefix = "";
 
     /**
+     * Whether the schema check must be done during initialization.
+     */
+    private boolean schemaCheckEnabled = true;
+
+    /**
      * This is the property 'table'
      * in the [databaseType].properties file, initialized with the default value.
      */
@@ -580,7 +586,7 @@
             ResultSet rs = meta.getTables(null, null, schemaObjectPrefix + tableSQL, null);
             boolean exists = rs.next();
             rs.close();
-            if (!exists) {
+            if (!exists && isSchemaCheckEnabled()) {
                 // CREATE TABLE DATASTORE(ID VARCHAR(255) PRIMARY KEY, 
                 // LENGTH BIGINT, LAST_MODIFIED BIGINT, DATA BLOB)
                 conn.executeStmt(createTableSQL, null);
@@ -826,6 +832,20 @@
     }
 
     /**
+     * @return whether the schema check is enabled
+     */
+    public final boolean isSchemaCheckEnabled() {
+        return schemaCheckEnabled;
+    }
+
+    /**
+     * @param enabled set whether the schema check is enabled
+     */
+    public final void setSchemaCheckEnabled(boolean enabled) {
+        schemaCheckEnabled = enabled;
+    }
+
+    /**
      * {@inheritDoc}
      */
     public synchronized void close() throws DataStoreException {

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/db/DatabaseFileSystem.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/db/DatabaseFileSystem.java?rev=796957&r1=796956&r2=796957&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/db/DatabaseFileSystem.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/db/DatabaseFileSystem.java
Thu Jul 23 06:10:19 2009
@@ -72,6 +72,11 @@
     protected String schema;
     protected String schemaObjectPrefix;
 
+    /**
+     * Whether the schema check must be done during initialization.
+     */
+    private boolean schemaCheckEnabled = true;
+
     // initial size of buffer used to serialize objects
     protected static final int INITIAL_BUFFER_SIZE = 8192;
 
@@ -131,6 +136,20 @@
         this.schema = schema;
     }
 
+    /**
+     * @return whether the schema check is enabled
+     */
+    public final boolean isSchemaCheckEnabled() {
+        return schemaCheckEnabled;
+    }
+
+    /**
+     * @param enabled set whether the schema check is enabled
+     */
+    public final void setSchemaCheckEnabled(boolean enabled) {
+        schemaCheckEnabled = enabled;
+    }
+
     //-------------------------------------------< java.lang.Object overrides >
     /**
      * {@inheritDoc}
@@ -186,7 +205,9 @@
             prepareSchemaObjectPrefix();
 
             // check if schema objects exist and create them if necessary
-            checkSchema();
+            if (isSchemaCheckEnabled()) {
+                checkSchema();
+            }
 
             // build sql statements
             buildSQLStatements();

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/DatabaseJournal.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/DatabaseJournal.java?rev=796957&r1=796956&r2=796957&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/DatabaseJournal.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/DatabaseJournal.java
Thu Jul 23 06:10:19 2009
@@ -64,6 +64,8 @@
  * which equals 24 hours)</li>
  * <li><code>janitorFirstRunHourOfDay</code>: specifies the hour at which
the clean-up
  * thread initiates its first run (default = <code>3</code> which means 3:00
at night)</li>
+ * <li><code>schemaCheckEnabled</code>:  whether the schema check during
initialization is enabled
+ * (default = <code>true</code>)</li>
  * <p>
  * JNDI can be used to get the connection. In this case, use the javax.naming.InitialContext
as the driver,
  * and the JNDI name as the URL. If the user and password are configured in the JNDI resource,
@@ -230,6 +232,11 @@
     private Thread janitorThread;
 
     /**
+     * Whether the schema check must be done during initialization.
+     */
+    private boolean schemaCheckEnabled = true;
+
+    /**
      * The instance that manages the local revision.
      */
     private DatabaseRevision databaseRevision;
@@ -304,9 +311,13 @@
         try {
             connection = getConnection();
             setAutoCommit(connection, true);
-            checkSchema();
+            if (isSchemaCheckEnabled()) {
+                checkSchema();
+            }
             // Make sure that the LOCAL_REVISIONS table exists (see JCR-1087)
-            checkLocalRevisionSchema();
+            if (isSchemaCheckEnabled()) {
+                checkLocalRevisionSchema();
+            }
 
             buildSQLStatements();
             prepareStatements();
@@ -1069,6 +1080,20 @@
     }
 
     /**
+     * @return whether the schema check is enabled
+     */
+    public final boolean isSchemaCheckEnabled() {
+        return schemaCheckEnabled;
+    }
+
+    /**
+     * @param enabled set whether the schema check is enabled
+     */
+    public final void setSchemaCheckEnabled(boolean enabled) {
+        schemaCheckEnabled = enabled;
+    }
+
+    /**
      * This class manages the local revision of the cluster node. It
      * persists the local revision in the LOCAL_REVISIONS table in the
      * clustering database.

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=796957&r1=796956&r2=796957&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 Jul 23 06:10:19 2009
@@ -81,6 +81,7 @@
  * <li>&lt;param name="{@link #setSchemaObjectPrefix(String) schemaObjectPrefix}"
value=""/>
  * <li>&lt;param name="{@link #setErrorHandling(String) errorHandling}" value=""/>
  * <li>&lt;param name="{@link #setBlockOnConnectionLoss(String) blockOnConnectionLoss}"
value="false"/>
+ * <li>&lt;param name="{@link #setSchemaCheckEnabled(String) schemaCheckEnabled}"
value="true"/>
  * </ul>
  */
 public class BundleDbPersistenceManager extends AbstractBundlePersistenceManager {
@@ -180,6 +181,11 @@
      */
     private String name = super.toString();
 
+    /**
+     * Whether the schema check must be done during initialization.
+     */
+    private boolean schemaCheckEnabled = true;
+
 
     /**
      * Returns the configured JDBC connection url.
@@ -428,6 +434,20 @@
     }
 
     /**
+     * @return whether the schema check is enabled
+     */
+    public final boolean isSchemaCheckEnabled() {
+        return schemaCheckEnabled;
+    }
+
+    /**
+     * @param enabled set whether the schema check is enabled
+     */
+    public final void setSchemaCheckEnabled(boolean enabled) {
+        schemaCheckEnabled = enabled;
+    }
+
+    /**
      * Checks if the required schema objects exist and creates them if they
      * don't exist yet.
      *
@@ -581,7 +601,9 @@
         prepareSchemaObjectPrefix();
 
         // check if schema objects exist and create them if necessary
-        checkSchema();
+        if (isSchemaCheckEnabled()) {
+            checkSchema();
+        }
 
         // create correct blob store
         blobStore = createBlobStore();

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=796957&r1=796956&r2=796957&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 Jul 23 06:10:19 2009
@@ -84,6 +84,11 @@
 
     protected boolean externalBLOBs;
 
+    /**
+     * Whether the schema check must be done during initialization.
+     */
+    private boolean schemaCheckEnabled = true;
+
     // initial size of buffer used to serialize objects
     protected static final int INITIAL_BUFFER_SIZE = 1024;
 
@@ -182,6 +187,20 @@
         this.externalBLOBs = Boolean.valueOf(externalBLOBs).booleanValue();
     }
 
+    /**
+     * @return whether the schema check is enabled
+     */
+    public final boolean isSchemaCheckEnabled() {
+        return schemaCheckEnabled;
+    }
+
+    /**
+     * @param enabled set whether the schema check is enabled
+     */
+    public final void setSchemaCheckEnabled(boolean enabled) {
+        schemaCheckEnabled = enabled;
+    }
+
     //---------------------------------------------------< PersistenceManager >
     /**
      * {@inheritDoc}
@@ -206,7 +225,9 @@
         prepareSchemaObjectPrefix();
 
         // check if schema objects exist and create them if necessary
-        checkSchema();
+        if (isSchemaCheckEnabled()) {
+            checkSchema();
+        }
 
         // build sql statements
         buildSQLStatements();



Mime
View raw message