Return-Path: Delivered-To: apmail-jackrabbit-commits-archive@www.apache.org Received: (qmail 9188 invoked from network); 23 Jul 2009 06:09:40 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 23 Jul 2009 06:09:40 -0000 Received: (qmail 88091 invoked by uid 500); 23 Jul 2009 06:10:45 -0000 Delivered-To: apmail-jackrabbit-commits-archive@jackrabbit.apache.org Received: (qmail 88023 invoked by uid 500); 23 Jul 2009 06:10:45 -0000 Mailing-List: contact commits-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jackrabbit.apache.org Delivered-To: mailing list commits@jackrabbit.apache.org Received: (qmail 88014 invoked by uid 99); 23 Jul 2009 06:10:45 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Jul 2009 06:10:45 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Jul 2009 06:10:41 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id ED82D23888BD; Thu, 23 Jul 2009 06:10:19 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@jackrabbit.apache.org From: martijnh@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090723061019.ED82D23888BD@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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"/> * </DataStore> * *

@@ -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) *

  • janitorFirstRunHourOfDay: specifies the hour at which the clean-up * thread initiates its first run (default = 3 which means 3:00 at night)
  • + *
  • schemaCheckEnabled: whether the schema check during initialization is enabled + * (default = true)
  • *

    * 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 @@ *

  • <param name="{@link #setSchemaObjectPrefix(String) schemaObjectPrefix}" value=""/> *
  • <param name="{@link #setErrorHandling(String) errorHandling}" value=""/> *
  • <param name="{@link #setBlockOnConnectionLoss(String) blockOnConnectionLoss}" value="false"/> + *
  • <param name="{@link #setSchemaCheckEnabled(String) schemaCheckEnabled}" value="true"/> * */ 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();