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