Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/db/DatabasePersistenceManager.java =================================================================== --- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/db/DatabasePersistenceManager.java (revision 794599) +++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/db/DatabasePersistenceManager.java (working copy) @@ -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(); Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/BundleDbPersistenceManager.java =================================================================== --- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/BundleDbPersistenceManager.java (revision 794599) +++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/persistence/bundle/BundleDbPersistenceManager.java (working copy) @@ -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,7 +181,12 @@ */ private String name = super.toString(); + /** + * Whether the schema check must be done during initialization. + */ + private boolean schemaCheckEnabled = true; + /** * Returns the configured JDBC connection url. * @return 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(); Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/db/DatabaseFileSystem.java =================================================================== --- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/db/DatabaseFileSystem.java (revision 794599) +++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/fs/db/DatabaseFileSystem.java (working copy) @@ -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(); Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/db/DbDataStore.java =================================================================== --- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/db/DbDataStore.java (revision 794599) +++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/data/db/DbDataStore.java (working copy) @@ -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 { Index: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/DatabaseJournal.java =================================================================== --- jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/DatabaseJournal.java (revision 794599) +++ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/journal/DatabaseJournal.java (working copy) @@ -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, @@ -228,6 +230,11 @@ } /** + * Whether the schema check must be done during initialization. + */ + private boolean schemaCheckEnabled = true; + + /** * The instance that manages the local revision. */ private DatabaseRevision databaseRevision; @@ -302,9 +309,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(); @@ -1062,8 +1073,22 @@ janitorNextRun.set(Calendar.SECOND, 0); janitorNextRun.set(Calendar.MILLISECOND, 0); } - + /** + * @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.