Return-Path: Delivered-To: apmail-portals-jetspeed-dev-archive@www.apache.org Received: (qmail 89837 invoked from network); 13 Sep 2010 17:48:17 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 13 Sep 2010 17:48:17 -0000 Received: (qmail 17875 invoked by uid 500); 13 Sep 2010 17:48:16 -0000 Delivered-To: apmail-portals-jetspeed-dev-archive@portals.apache.org Received: (qmail 17815 invoked by uid 500); 13 Sep 2010 17:48:15 -0000 Mailing-List: contact jetspeed-dev-help@portals.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Jetspeed Developers List" Delivered-To: mailing list jetspeed-dev@portals.apache.org Received: (qmail 17594 invoked by uid 99); 13 Sep 2010 17:48:15 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Sep 2010 17:48:15 +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; Mon, 13 Sep 2010 17:48:10 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 1410423889BF; Mon, 13 Sep 2010 17:47:50 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r996614 [1/2] - in /portals/jetspeed-2/portal/trunk: components/jetspeed-capability/src/main/java/org/apache/jetspeed/tools/migration/ components/jetspeed-db-tools/src/main/java/org/apache/jetspeed/tools/migration/ components/jetspeed-page-... Date: Mon, 13 Sep 2010 17:47:49 -0000 To: jetspeed-dev@portals.apache.org From: rwatler@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100913174750.1410423889BF@eris.apache.org> Author: rwatler Date: Mon Sep 13 17:47:49 2010 New Revision: 996614 URL: http://svn.apache.org/viewvc?rev=996614&view=rev Log: Jetspeed DB Migration Tools Extensions -------------------------------------------------------------------- Added the following options to JetspeedMigrationApplication DB tools to facilitate migration to replicated target databases: -migration-phase=[0-3] - 0 invokes all phases, 1 creates tables and indexes in target database, 2 migrates data from source to target database, and 3 adds constraints to target database; default = 0. -rows-migrated-per-commit=500 - issues checkpoint commits periodically based on rows migrated; default = 500. Added: portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/tools/migration/JetspeedMigrationListener.java Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-capability/src/main/java/org/apache/jetspeed/tools/migration/JetspeedCapabilitiesMigration.java portals/jetspeed-2/portal/trunk/components/jetspeed-db-tools/src/main/java/org/apache/jetspeed/tools/migration/JetspeedMigrationApplication.java portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/tools/migration/JetspeedDBPageManagerMigration.java portals/jetspeed-2/portal/trunk/components/jetspeed-profiler/src/main/java/org/apache/jetspeed/tools/migration/JetspeedProfilerMigration.java portals/jetspeed-2/portal/trunk/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/datasource/DBCPDatasourceComponent.java portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/tools/migration/JetspeedRegistryMigration.java portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/tools/migration/JetspeedSecurityMigration.java portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/main/java/org/apache/jetspeed/tools/migration/JetspeedSSOSecurityMigration.java portals/jetspeed-2/portal/trunk/components/jetspeed-statistics/src/main/java/org/apache/jetspeed/tools/migration/JetspeedStatisticsMigration.java portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/tools/migration/JetspeedMigration.java Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-capability/src/main/java/org/apache/jetspeed/tools/migration/JetspeedCapabilitiesMigration.java URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-capability/src/main/java/org/apache/jetspeed/tools/migration/JetspeedCapabilitiesMigration.java?rev=996614&r1=996613&r2=996614&view=diff ============================================================================== --- portals/jetspeed-2/portal/trunk/components/jetspeed-capability/src/main/java/org/apache/jetspeed/tools/migration/JetspeedCapabilitiesMigration.java (original) +++ portals/jetspeed-2/portal/trunk/components/jetspeed-capability/src/main/java/org/apache/jetspeed/tools/migration/JetspeedCapabilitiesMigration.java Mon Sep 13 17:47:49 2010 @@ -48,9 +48,9 @@ public class JetspeedCapabilitiesMigrati } /* (non-Javadoc) - * @see org.apache.jetspeed.tools.migration.JetspeedMigration#migrate(java.sql.Connection, int, java.sql.Connection) + * @see org.apache.jetspeed.tools.migration.JetspeedMigration#migrate(java.sql.Connection, int, java.sql.Connection, org.apache.jetspeed.tools.migration.JetspeedMigrationListener) */ - public JetspeedMigrationResult migrate(Connection sourceConnection, int sourceVersion, Connection targetConnection) throws SQLException + public JetspeedMigrationResult migrate(Connection sourceConnection, int sourceVersion, Connection targetConnection, JetspeedMigrationListener migrationListener) throws SQLException { int rowsMigrated = 0; @@ -68,6 +68,7 @@ public class JetspeedCapabilitiesMigrati mediaTypeInsertStatement.setString(5, mediaTypeResultSet.getString(5)); mediaTypeInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } mediaTypeResultSet.close(); mediaTypeQueryStatement.close(); @@ -90,6 +91,7 @@ public class JetspeedCapabilitiesMigrati clientInsertStatement.setInt(8, clientResultSet.getInt(8)); clientInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } clientResultSet.close(); clientQueryStatement.close(); @@ -106,6 +108,7 @@ public class JetspeedCapabilitiesMigrati mimeTypeInsertStatement.setString(2, mimeTypeResultSet.getString(2)); mimeTypeInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } mimeTypeResultSet.close(); mimeTypeQueryStatement.close(); @@ -122,6 +125,7 @@ public class JetspeedCapabilitiesMigrati capabilityInsertStatement.setString(2, capabilityResultSet.getString(2)); capabilityInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } capabilityResultSet.close(); capabilityQueryStatement.close(); @@ -138,6 +142,7 @@ public class JetspeedCapabilitiesMigrati clientToCapabilityInsertStatement.setInt(2, clientToCapabilityResultSet.getInt(2)); clientToCapabilityInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } clientToCapabilityResultSet.close(); clientToCapabilityQueryStatement.close(); @@ -154,6 +159,7 @@ public class JetspeedCapabilitiesMigrati clientToMimeTypeInsertStatement.setInt(2, clientToMimeTypeResultSet.getInt(2)); clientToMimeTypeInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } clientToMimeTypeResultSet.close(); clientToMimeTypeQueryStatement.close(); @@ -170,6 +176,7 @@ public class JetspeedCapabilitiesMigrati mediaTypeToCapabilityInsertStatement.setInt(2, mediaTypeToCapabilityResultSet.getInt(2)); mediaTypeToCapabilityInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } mediaTypeToCapabilityResultSet.close(); mediaTypeToCapabilityQueryStatement.close(); @@ -186,6 +193,7 @@ public class JetspeedCapabilitiesMigrati mediaTypeToMimeTypeInsertStatement.setInt(2, mediaTypeToMimeTypeResultSet.getInt(2)); mediaTypeToMimeTypeInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } mediaTypeToMimeTypeResultSet.close(); mediaTypeToMimeTypeQueryStatement.close(); @@ -204,6 +212,7 @@ public class JetspeedCapabilitiesMigrati ojbInsertStatement.setInt(5, ojbResultSet.getInt(5)); ojbInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } ojbResultSet.close(); ojbQueryStatement.close(); Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-db-tools/src/main/java/org/apache/jetspeed/tools/migration/JetspeedMigrationApplication.java URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-db-tools/src/main/java/org/apache/jetspeed/tools/migration/JetspeedMigrationApplication.java?rev=996614&r1=996613&r2=996614&view=diff ============================================================================== --- portals/jetspeed-2/portal/trunk/components/jetspeed-db-tools/src/main/java/org/apache/jetspeed/tools/migration/JetspeedMigrationApplication.java (original) +++ portals/jetspeed-2/portal/trunk/components/jetspeed-db-tools/src/main/java/org/apache/jetspeed/tools/migration/JetspeedMigrationApplication.java Mon Sep 13 17:47:49 2010 @@ -41,6 +41,14 @@ public class JetspeedMigrationApplicatio { private static final Logger log = LoggerFactory.getLogger(JetspeedMigrationApplication.class); + private static final int ALL_MIGRATION_PHASE = 0; + private static final int CREATE_SCHEMA_MIGRATION_PHASE = 1; + private static final int DATA_MIGRATION_PHASE = 2; + private static final int CONSTRAINTS_SCHEMA_MIGRATION_PHASE = 3; + + private static final int DEFAULT_ROWS_MIGRATED_PER_COMMIT = 500; + private static final int DEFAULT_MIGRATION_PHASE = ALL_MIGRATION_PHASE; + private String sourceDBUsername; private String sourceDBPassword; private String sourceJDBCUrl; @@ -49,11 +57,16 @@ public class JetspeedMigrationApplicatio private String dbPassword; private String jdbcUrl; private String jdbcDriverClass; + private int rowsMigratedPerCommit; private File dropSchemaSQLScriptFile; private File createSchemaSQLScriptFile; + private int migrationPhase; private DBCPDatasourceComponent sourceDataSourceFactory; private DBCPDatasourceComponent targetDataSourceFactory; + private DBCPDatasourceComponent targetTxnDataSourceFactory; private JetspeedMigration [] migrations; + private int rowsCheckpointCommitted; + private int rowsMigrated; /** * Construct application instance using arguments. @@ -62,9 +75,16 @@ public class JetspeedMigrationApplicatio */ public JetspeedMigrationApplication(String[] args) { + this.rowsMigratedPerCommit = DEFAULT_ROWS_MIGRATED_PER_COMMIT; + this.migrationPhase = DEFAULT_MIGRATION_PHASE; + for (String arg : args) { - if (arg.startsWith("-source-db-username=")) + if (arg.startsWith("-migration-phase=")) + { + this.migrationPhase = Integer.parseInt(arg.substring(17)); + } + else if (arg.startsWith("-source-db-username=")) { this.sourceDBUsername = arg.substring(20); } @@ -96,6 +116,10 @@ public class JetspeedMigrationApplicatio { this.jdbcDriverClass = arg.substring(19); } + else if (arg.startsWith("-rows-migrated-per-commit=")) + { + this.rowsMigratedPerCommit = Integer.parseInt(arg.substring(26)); + } else if (arg.startsWith("-drop-schema-sql=")) { this.dropSchemaSQLScriptFile = new File(arg.substring(17)); @@ -114,19 +138,28 @@ public class JetspeedMigrationApplicatio } } - if (this.sourceDBUsername == null) + if ((this.migrationPhase != ALL_MIGRATION_PHASE) && (this.migrationPhase != CREATE_SCHEMA_MIGRATION_PHASE) && + (this.migrationPhase != DATA_MIGRATION_PHASE) && (this.migrationPhase != CONSTRAINTS_SCHEMA_MIGRATION_PHASE)) + { + throw new RuntimeException("Invalid -migration-phase argument"); + } + if ((this.sourceDBUsername == null) && ((this.migrationPhase == ALL_MIGRATION_PHASE) || + (this.migrationPhase == DATA_MIGRATION_PHASE))) { throw new RuntimeException("Missing -source-db-username argument"); } - if (this.sourceDBPassword == null) + if ((this.sourceDBPassword == null) && ((this.migrationPhase == ALL_MIGRATION_PHASE) || + (this.migrationPhase == DATA_MIGRATION_PHASE))) { throw new RuntimeException("Missing -source-db-password argument"); } - if (this.sourceJDBCUrl == null) + if ((this.sourceJDBCUrl == null) && ((this.migrationPhase == ALL_MIGRATION_PHASE) || + (this.migrationPhase == DATA_MIGRATION_PHASE))) { throw new RuntimeException("Missing -source-jdbc-url argument"); } - if (this.sourceJDBCDriverClass == null) + if ((this.sourceJDBCDriverClass == null) && ((this.migrationPhase == ALL_MIGRATION_PHASE) || + (this.migrationPhase == DATA_MIGRATION_PHASE))) { throw new RuntimeException("Missing -source-jdbc-driver-class argument"); } @@ -146,32 +179,42 @@ public class JetspeedMigrationApplicatio { throw new RuntimeException("Missing -jdbc-driver-class argument"); } - if (this.dropSchemaSQLScriptFile == null) + if ((this.dropSchemaSQLScriptFile == null) && ((this.migrationPhase == ALL_MIGRATION_PHASE) || + (this.migrationPhase == CREATE_SCHEMA_MIGRATION_PHASE))) { - throw new RuntimeException("Missing -drop-schema-sql argument"); + throw new RuntimeException("Missing -drop-schema-sql argument required for phase"); } - if (this.createSchemaSQLScriptFile == null) + if ((this.createSchemaSQLScriptFile == null) && ((this.migrationPhase == ALL_MIGRATION_PHASE) || + (this.migrationPhase == CREATE_SCHEMA_MIGRATION_PHASE) || + (this.migrationPhase == CONSTRAINTS_SCHEMA_MIGRATION_PHASE))) { - throw new RuntimeException("Missing -create-schema-sql argument"); + throw new RuntimeException("Missing -create-schema-sql argument required for phase"); } + + this.jdbcUrl = validateJDBCUrlOptions(this.jdbcUrl, this.jdbcDriverClass); + this.sourceJDBCUrl = validateJDBCUrlOptions(this.sourceJDBCUrl, this.sourceJDBCDriverClass); + if ((this.migrationPhase == ALL_MIGRATION_PHASE) || (this.migrationPhase == DATA_MIGRATION_PHASE)) + { + if (this.jdbcUrl.equals(this.sourceJDBCUrl)) + { + throw new RuntimeException("Source and target JDBC databases must be different: "+this.jdbcUrl); + } - if (this.jdbcUrl.equals(this.sourceJDBCUrl)) + this.sourceDataSourceFactory = new DBCPDatasourceComponent(this.sourceDBUsername, this.sourceDBPassword, this.sourceJDBCDriverClass, this.sourceJDBCUrl, 2, 0, GenericObjectPool.WHEN_EXHAUSTED_GROW, true); + this.targetTxnDataSourceFactory = new DBCPDatasourceComponent(this.dbUsername, this.dbPassword, this.jdbcDriverClass, this.jdbcUrl, 2, 0, GenericObjectPool.WHEN_EXHAUSTED_GROW, false); + } + if ((this.migrationPhase == ALL_MIGRATION_PHASE) || (this.migrationPhase == CREATE_SCHEMA_MIGRATION_PHASE) || (this.migrationPhase == CONSTRAINTS_SCHEMA_MIGRATION_PHASE)) { - throw new RuntimeException("Source and target JDBC databases must be different: "+this.jdbcUrl); + this.targetDataSourceFactory = new DBCPDatasourceComponent(this.dbUsername, this.dbPassword, this.jdbcDriverClass, this.jdbcUrl, 2, 0, GenericObjectPool.WHEN_EXHAUSTED_GROW, true); } - this.sourceJDBCUrl = validateJDBCUrlOptions(this.sourceJDBCUrl, this.sourceJDBCDriverClass); - sourceDataSourceFactory = new DBCPDatasourceComponent(this.sourceDBUsername, this.sourceDBPassword, this.sourceJDBCDriverClass, this.sourceJDBCUrl, 2, 0, GenericObjectPool.WHEN_EXHAUSTED_GROW, true); - this.jdbcUrl = validateJDBCUrlOptions(this.jdbcUrl, this.jdbcDriverClass); - targetDataSourceFactory = new DBCPDatasourceComponent(this.dbUsername, this.dbPassword, this.jdbcDriverClass, this.jdbcUrl, 2, 0, GenericObjectPool.WHEN_EXHAUSTED_GROW, true); - - migrations = new JetspeedMigration[]{new JetspeedCapabilitiesMigration(), - new JetspeedStatisticsMigration(), - new JetspeedDBPageManagerMigration(), - new JetspeedProfilerMigration(), - new JetspeedRegistryMigration(), - new JetspeedSecurityMigration(), - new JetspeedSSOSecurityMigration()}; + this.migrations = new JetspeedMigration[]{new JetspeedCapabilitiesMigration(), + new JetspeedStatisticsMigration(), + new JetspeedDBPageManagerMigration(), + new JetspeedProfilerMigration(), + new JetspeedRegistryMigration(), + new JetspeedSecurityMigration(), + new JetspeedSSOSecurityMigration()}; } /** @@ -183,12 +226,15 @@ public class JetspeedMigrationApplicatio */ private String validateJDBCUrlOptions(String jdbcUrl, String jdbcDriverClass) { - // add cursor fetch option for mysql, (assumes server and connector 5.0.3+) - if (jdbcUrl.startsWith("jdbc:mysql://") && jdbcDriverClass.startsWith("com.mysql.jdbc.")) + if ((jdbcUrl != null) && (jdbcDriverClass != null)) { - if (!jdbcUrl.contains("useCursorFetch=")) + // add cursor fetch option for mysql, (assumes server and connector 5.0.3+) + if (jdbcUrl.startsWith("jdbc:mysql://") && jdbcDriverClass.startsWith("com.mysql.jdbc.")) { - jdbcUrl += (jdbcUrl.contains("?") ? "&" : "?")+"useCursorFetch=true"; + if (!jdbcUrl.contains("useCursorFetch=")) + { + jdbcUrl += (jdbcUrl.contains("?") ? "&" : "?")+"useCursorFetch=true"; + } } } @@ -204,61 +250,164 @@ public class JetspeedMigrationApplicatio */ public void run() throws IOException, SQLException { - // start data source pools - sourceDataSourceFactory.start(); - targetDataSourceFactory.start(); - DataSource sourceDataSource = sourceDataSourceFactory.getDatasource(); - DataSource targetDataSource = targetDataSourceFactory.getDatasource(); - - // open connections - Connection sourceConnection = sourceDataSource.getConnection(); - Connection targetConnection = targetDataSource.getConnection(); + rowsCheckpointCommitted = 0; + rowsMigrated = 0; - // clean target database - log.info("Clean target database..."); - executeSQLScript(targetConnection, dropSchemaSQLScriptFile, true); - // create tables and indices in target database - log.info("Initialize target database schema tables and indices..."); - executeSQLScript(targetConnection, createSchemaSQLScriptFile, false, "^\\s*create\\s+(?:table|index|unique\\s+index)\\s", true); - - // determine and validate schema version - int sourceVersion = JetspeedMigration.JETSPEED_SCHEMA_VERSION_UNKNOWN; - for (JetspeedMigration migration : migrations) - { - sourceVersion = migration.detectSourceVersion(sourceConnection, sourceVersion); + // setup data source pools and connections + Connection targetConnection = null; + Connection targetTxnConnection = null; + Connection sourceConnection = null; + switch (migrationPhase) + { + case ALL_MIGRATION_PHASE: + case CREATE_SCHEMA_MIGRATION_PHASE: + case CONSTRAINTS_SCHEMA_MIGRATION_PHASE: + { + targetDataSourceFactory.start(); + DataSource targetDataSource = targetDataSourceFactory.getDatasource(); + targetConnection = targetDataSource.getConnection(); + } + break; + } + switch (migrationPhase) + { + case ALL_MIGRATION_PHASE: + case DATA_MIGRATION_PHASE: + { + targetTxnDataSourceFactory.start(); + DataSource targetTxnDataSource = targetTxnDataSourceFactory.getDatasource(); + targetTxnConnection = targetTxnDataSource.getConnection(); + sourceDataSourceFactory.start(); + DataSource sourceDataSource = sourceDataSourceFactory.getDatasource(); + sourceConnection = sourceDataSource.getConnection(); + } + break; } - for (JetspeedMigration migration : migrations) + + // clean target database + switch (migrationPhase) { - sourceVersion = migration.detectSourceVersion(sourceConnection, sourceVersion); + case ALL_MIGRATION_PHASE: + case CREATE_SCHEMA_MIGRATION_PHASE: + { + log.info("Clean target database..."); + executeSQLScript(targetConnection, dropSchemaSQLScriptFile, true); + // create tables and indices in target database + log.info("Initialize target database schema tables and indices..."); + executeSQLScript(targetConnection, createSchemaSQLScriptFile, false, "^\\s*create\\s+(?:table|index|unique\\s+index)\\s", true); + } + break; } - log.info("Detected source schema version: "+sourceVersion); // migrate data from source to target database - for (JetspeedMigration migration : migrations) + switch (migrationPhase) { - log.info("Migrating "+migration.getName()+" data..."); - JetspeedMigrationResult result = migration.migrate(sourceConnection, sourceVersion, targetConnection); - if (result.getDroppedRows() == 0) + case ALL_MIGRATION_PHASE: + case DATA_MIGRATION_PHASE: { - log.info("Migrated "+result.getMigratedRows()+" "+migration.getName()+" data rows."); + // determine and validate schema version + int sourceVersion = JetspeedMigration.JETSPEED_SCHEMA_VERSION_UNKNOWN; + for (JetspeedMigration migration : migrations) + { + sourceVersion = migration.detectSourceVersion(sourceConnection, sourceVersion); + } + for (JetspeedMigration migration : migrations) + { + sourceVersion = migration.detectSourceVersion(sourceConnection, sourceVersion); + } + log.info("Detected source schema version: "+sourceVersion); + + // migrate data from source to target database + JetspeedMigrationListener migrationListener = new JetspeedMigrationListener() + { + /* (non-Javadoc) + * @see org.apache.jetspeed.tools.migration.JetspeedMigrationListener#rowMigrated(java.sql.Connection) + */ + public void rowMigrated(Connection targetTxnConnection) throws SQLException + { + rowsMigrated++; + // periodically checkpoint commit target connection based + // on rowsMigratedPerCommit configuration + if (rowsMigrated > rowsCheckpointCommitted) + { + if ((rowsMigratedPerCommit > 0) && ((rowsMigrated-rowsCheckpointCommitted) >= rowsMigratedPerCommit)) + { + targetTxnConnection.commit(); + rowsCheckpointCommitted = rowsMigrated; + log.info("Checkpoint commit of "+rowsCheckpointCommitted+" total data rows."); + } + } + } + + /* (non-Javadoc) + * @see org.apache.jetspeed.tools.migration.JetspeedMigrationListener#rowDropped(java.sql.Connection) + */ + public void rowDropped(Connection targetTxnConnection) + { + } + }; + for (JetspeedMigration migration : migrations) + { + // invoke migrate for each migration + log.info("Migrating "+migration.getName()+" data..."); + JetspeedMigrationResult result = migration.migrate(sourceConnection, sourceVersion, targetTxnConnection, migrationListener); + if (result.getDroppedRows() == 0) + { + log.info("Migrated "+result.getMigratedRows()+" "+migration.getName()+" data rows."); + } + else + { + log.info("Migrated "+result.getMigratedRows()+" "+migration.getName()+" data rows, ("+result.getDroppedRows()+" dropped)."); + } + // checkpoint commit target connection + if (rowsMigrated > rowsCheckpointCommitted) + { + targetTxnConnection.commit(); + rowsCheckpointCommitted = rowsMigrated; + log.info("Checkpoint commit of "+rowsCheckpointCommitted+" total data rows."); + } + } } - else + break; + } + + // add constraints and remaining schema to target database + switch (migrationPhase) + { + case ALL_MIGRATION_PHASE: + case CONSTRAINTS_SCHEMA_MIGRATION_PHASE: { - log.info("Migrated "+result.getMigratedRows()+" "+migration.getName()+" data rows, ("+result.getDroppedRows()+" dropped)."); + log.info("Setup target database schema constraints..."); + executeSQLScript(targetConnection, createSchemaSQLScriptFile, false, "^\\s*create\\s+(?:table|index|unique\\s+index)\\s", false); } + break; } - // add constraints and remaining schema to target database - log.info("Setup target database schema constraints..."); - executeSQLScript(targetConnection, createSchemaSQLScriptFile, false, "^\\s*create\\s+(?:table|index|unique\\s+index)\\s", false); - - // close connections - sourceConnection.close(); - targetConnection.close(); - - // stop data source pools - sourceDataSourceFactory.stop(); - targetDataSourceFactory.stop(); + // close connections and stop data source pools + switch (migrationPhase) + { + case ALL_MIGRATION_PHASE: + case DATA_MIGRATION_PHASE: + { + sourceConnection.close(); + sourceDataSourceFactory.stop(); + targetTxnConnection.commit(); + targetTxnConnection.close(); + targetTxnDataSourceFactory.stop(); + } + break; + } + switch (migrationPhase) + { + case ALL_MIGRATION_PHASE: + case CREATE_SCHEMA_MIGRATION_PHASE: + case CONSTRAINTS_SCHEMA_MIGRATION_PHASE: + { + targetConnection.close(); + targetDataSourceFactory.stop(); + } + break; + } } /** Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/tools/migration/JetspeedDBPageManagerMigration.java URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/tools/migration/JetspeedDBPageManagerMigration.java?rev=996614&r1=996613&r2=996614&view=diff ============================================================================== --- portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/tools/migration/JetspeedDBPageManagerMigration.java (original) +++ portals/jetspeed-2/portal/trunk/components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/tools/migration/JetspeedDBPageManagerMigration.java Mon Sep 13 17:47:49 2010 @@ -75,9 +75,9 @@ public class JetspeedDBPageManagerMigrat } /* (non-Javadoc) - * @see org.apache.jetspeed.tools.migration.JetspeedMigration#migrate(java.sql.Connection, int, java.sql.Connection) + * @see org.apache.jetspeed.tools.migration.JetspeedMigration#migrate(java.sql.Connection, int, java.sql.Connection, org.apache.jetspeed.tools.migration.JetspeedMigrationListener) */ - public JetspeedMigrationResult migrate(Connection sourceConnection, int sourceVersion, Connection targetConnection) throws SQLException + public JetspeedMigrationResult migrate(Connection sourceConnection, int sourceVersion, Connection targetConnection, JetspeedMigrationListener migrationListener) throws SQLException { int rowsMigrated = 0; @@ -132,6 +132,7 @@ public class JetspeedDBPageManagerMigrat folderInsertStatement.setString(20, folderResultSet.getString(20)); folderInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } folderResultSet.close(); folderQueryStatement.close(); @@ -151,6 +152,7 @@ public class JetspeedDBPageManagerMigrat folderMetadataInsertStatement.setString(5, folderMetadataResultSet.getString(5)); folderMetadataInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } folderMetadataResultSet.close(); folderMetadataQueryStatement.close(); @@ -172,6 +174,7 @@ public class JetspeedDBPageManagerMigrat folderConstraintInsertStatement.setString(7, folderConstraintResultSet.getString(7)); folderConstraintInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } folderConstraintResultSet.close(); folderConstraintQueryStatement.close(); @@ -190,6 +193,7 @@ public class JetspeedDBPageManagerMigrat folderConstraintsRefInsertStatement.setString(4, folderConstraintsRefResultSet.getString(4)); folderConstraintsRefInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } folderConstraintsRefResultSet.close(); folderConstraintsRefQueryStatement.close(); @@ -208,6 +212,7 @@ public class JetspeedDBPageManagerMigrat folderOrderInsertStatement.setString(4, folderOrderResultSet.getString(4)); folderOrderInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } folderOrderResultSet.close(); folderOrderQueryStatement.close(); @@ -239,6 +244,7 @@ public class JetspeedDBPageManagerMigrat Static.setNullableShort(folderMenuResultSet, 17, folderMenuInsertStatement); folderMenuInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } folderMenuResultSet.close(); folderMenuQueryStatement.close(); @@ -258,6 +264,7 @@ public class JetspeedDBPageManagerMigrat folderMenuMetadataInsertStatement.setString(5, folderMenuMetadataResultSet.getString(5)); folderMenuMetadataInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } folderMenuMetadataResultSet.close(); folderMenuMetadataQueryStatement.close(); @@ -323,6 +330,7 @@ public class JetspeedDBPageManagerMigrat pageInsertStatement.setString(23, pageResultSet.getString(20)); pageInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } pageResultSet.close(); } @@ -357,6 +365,7 @@ public class JetspeedDBPageManagerMigrat pageInsertStatement.setString(23, pageResultSet.getString(23)); pageInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } pageResultSet.close(); } @@ -379,6 +388,7 @@ public class JetspeedDBPageManagerMigrat pageMetadataInsertStatement.setString(5, pageMetadataResultSet.getString(5)); pageMetadataInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } pageMetadataResultSet.close(); pageMetadataQueryStatement.close(); @@ -400,6 +410,7 @@ public class JetspeedDBPageManagerMigrat pageConstraintInsertStatement.setString(7, pageConstraintResultSet.getString(7)); pageConstraintInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } pageConstraintResultSet.close(); pageConstraintQueryStatement.close(); @@ -418,6 +429,7 @@ public class JetspeedDBPageManagerMigrat pageConstraintsRefInsertStatement.setString(4, pageConstraintsRefResultSet.getString(4)); pageConstraintsRefInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } pageConstraintsRefResultSet.close(); pageConstraintsRefQueryStatement.close(); @@ -449,6 +461,7 @@ public class JetspeedDBPageManagerMigrat Static.setNullableShort(pageMenuResultSet, 17, pageMenuInsertStatement); pageMenuInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } pageMenuResultSet.close(); pageMenuQueryStatement.close(); @@ -468,6 +481,7 @@ public class JetspeedDBPageManagerMigrat pageMenuMetadataInsertStatement.setString(5, pageMenuMetadataResultSet.getString(5)); pageMenuMetadataInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } pageMenuMetadataResultSet.close(); pageMenuMetadataQueryStatement.close(); @@ -530,6 +544,7 @@ public class JetspeedDBPageManagerMigrat fragmentInsertStatement.setString(23, fragmentResultSet.getString(20)); fragmentInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } fragmentResultSet.close(); } @@ -570,6 +585,7 @@ public class JetspeedDBPageManagerMigrat fragmentInsertStatement.setString(23, fragmentResultSet.getString(21)); fragmentInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } fragmentResultSet.close(); } @@ -604,6 +620,7 @@ public class JetspeedDBPageManagerMigrat fragmentInsertStatement.setString(23, fragmentResultSet.getString(23)); fragmentInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } fragmentResultSet.close(); } @@ -628,6 +645,7 @@ public class JetspeedDBPageManagerMigrat fragmentConstraintInsertStatement.setString(7, fragmentConstraintResultSet.getString(7)); fragmentConstraintInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } fragmentConstraintResultSet.close(); fragmentConstraintQueryStatement.close(); @@ -646,6 +664,7 @@ public class JetspeedDBPageManagerMigrat fragmentConstraintsRefInsertStatement.setString(4, fragmentConstraintsRefResultSet.getString(4)); fragmentConstraintsRefInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } fragmentConstraintsRefResultSet.close(); fragmentConstraintsRefQueryStatement.close(); @@ -664,6 +683,7 @@ public class JetspeedDBPageManagerMigrat fragmentPrefInsertStatement.setShort(4, fragmentPrefResultSet.getShort(4)); fragmentPrefInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } fragmentPrefResultSet.close(); fragmentPrefQueryStatement.close(); @@ -682,6 +702,7 @@ public class JetspeedDBPageManagerMigrat fragmentPrefValueInsertStatement.setString(4, fragmentPrefValueResultSet.getString(4)); fragmentPrefValueInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } fragmentPrefValueResultSet.close(); fragmentPrefValueQueryStatement.close(); @@ -711,6 +732,7 @@ public class JetspeedDBPageManagerMigrat fragmentPropInsertStatement.setString(6, fragmentResultSet.getString(3)); fragmentPropInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } if ((fragmentResultSet.getString(4) != null) && (fragmentResultSet.getString(5) != null)) { @@ -722,6 +744,7 @@ public class JetspeedDBPageManagerMigrat fragmentPropInsertStatement.setString(6, fragmentResultSet.getString(5)); fragmentPropInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } } fragmentResultSet.close(); @@ -740,6 +763,7 @@ public class JetspeedDBPageManagerMigrat fragmentPropInsertStatement.setString(6, fragmentPropResultSet.getString(6)); fragmentPropInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } fragmentPropResultSet.close(); } @@ -776,6 +800,7 @@ public class JetspeedDBPageManagerMigrat linkInsertStatement.setString(20, linkResultSet.getString(20)); linkInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } linkResultSet.close(); linkQueryStatement.close(); @@ -795,6 +820,7 @@ public class JetspeedDBPageManagerMigrat linkMetadataInsertStatement.setString(5, linkMetadataResultSet.getString(5)); linkMetadataInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } linkMetadataResultSet.close(); linkMetadataQueryStatement.close(); @@ -816,6 +842,7 @@ public class JetspeedDBPageManagerMigrat linkConstraintInsertStatement.setString(7, linkConstraintResultSet.getString(7)); linkConstraintInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } linkConstraintResultSet.close(); linkConstraintQueryStatement.close(); @@ -834,6 +861,7 @@ public class JetspeedDBPageManagerMigrat linkConstraintsRefInsertStatement.setString(4, linkConstraintsRefResultSet.getString(4)); linkConstraintsRefInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } linkConstraintsRefResultSet.close(); linkConstraintsRefQueryStatement.close(); @@ -861,6 +889,7 @@ public class JetspeedDBPageManagerMigrat pageSecurityInsertStatement.setString(13, pageSecurityResultSet.getString(13)); pageSecurityInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } pageSecurityResultSet.close(); pageSecurityQueryStatement.close(); @@ -878,6 +907,7 @@ public class JetspeedDBPageManagerMigrat pageSecurityConstraintsDefInsertStatement.setString(3, pageSecurityConstraintsDefResultSet.getString(3)); pageSecurityConstraintsDefInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } pageSecurityConstraintsDefResultSet.close(); pageSecurityConstraintsDefQueryStatement.close(); @@ -899,6 +929,7 @@ public class JetspeedDBPageManagerMigrat pageSecurityConstraintDefInsertStatement.setString(7, pageSecurityConstraintDefResultSet.getString(7)); pageSecurityConstraintDefInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } pageSecurityConstraintDefResultSet.close(); pageSecurityConstraintDefQueryStatement.close(); @@ -917,6 +948,7 @@ public class JetspeedDBPageManagerMigrat pageSecurityConstraintsRefInsertStatement.setString(4, pageSecurityConstraintsRefResultSet.getString(4)); pageSecurityConstraintsRefInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } pageSecurityConstraintsRefResultSet.close(); pageSecurityConstraintsRefQueryStatement.close(); @@ -935,6 +967,7 @@ public class JetspeedDBPageManagerMigrat ojbInsertStatement.setInt(5, ojbResultSet.getInt(5)); ojbInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } switch (sourceVersion) { @@ -954,6 +987,7 @@ public class JetspeedDBPageManagerMigrat ojbInsertStatement.setInt(5, version); ojbInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } } break; Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-profiler/src/main/java/org/apache/jetspeed/tools/migration/JetspeedProfilerMigration.java URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-profiler/src/main/java/org/apache/jetspeed/tools/migration/JetspeedProfilerMigration.java?rev=996614&r1=996613&r2=996614&view=diff ============================================================================== --- portals/jetspeed-2/portal/trunk/components/jetspeed-profiler/src/main/java/org/apache/jetspeed/tools/migration/JetspeedProfilerMigration.java (original) +++ portals/jetspeed-2/portal/trunk/components/jetspeed-profiler/src/main/java/org/apache/jetspeed/tools/migration/JetspeedProfilerMigration.java Mon Sep 13 17:47:49 2010 @@ -48,9 +48,9 @@ public class JetspeedProfilerMigration i } /* (non-Javadoc) - * @see org.apache.jetspeed.tools.migration.JetspeedMigration#migrate(java.sql.Connection, int, java.sql.Connection) + * @see org.apache.jetspeed.tools.migration.JetspeedMigration#migrate(java.sql.Connection, int, java.sql.Connection, org.apache.jetspeed.tools.migration.JetspeedMigrationListener) */ - public JetspeedMigrationResult migrate(Connection sourceConnection, int sourceVersion, Connection targetConnection) throws SQLException + public JetspeedMigrationResult migrate(Connection sourceConnection, int sourceVersion, Connection targetConnection, JetspeedMigrationListener migrationListener) throws SQLException { int rowsMigrated = 0; @@ -66,6 +66,7 @@ public class JetspeedProfilerMigration i profilingRuleInsertStatement.setString(3, profilingRuleResultSet.getString(3)); profilingRuleInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } profilingRuleResultSet.close(); profilingRuleQueryStatement.close(); @@ -87,6 +88,7 @@ public class JetspeedProfilerMigration i Static.setNullableInt(ruleCriterionResultSet, 7, ruleCriterionInsertStatement); ruleCriterionInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } ruleCriterionResultSet.close(); ruleCriterionQueryStatement.close(); @@ -104,6 +106,7 @@ public class JetspeedProfilerMigration i principalRuleAssocInsertStatement.setString(3, principalRuleAssocResultSet.getString(3)); principalRuleAssocInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } principalRuleAssocResultSet.close(); principalRuleAssocQueryStatement.close(); @@ -120,6 +123,7 @@ public class JetspeedProfilerMigration i profilePageAssocInsertStatement.setString(2, profilePageAssocResultSet.getString(2)); profilePageAssocInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } profilePageAssocResultSet.close(); profilePageAssocQueryStatement.close(); @@ -138,6 +142,7 @@ public class JetspeedProfilerMigration i ojbInsertStatement.setInt(5, ojbResultSet.getInt(5)); ojbInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } ojbResultSet.close(); ojbQueryStatement.close(); Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/datasource/DBCPDatasourceComponent.java URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/datasource/DBCPDatasourceComponent.java?rev=996614&r1=996613&r2=996614&view=diff ============================================================================== --- portals/jetspeed-2/portal/trunk/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/datasource/DBCPDatasourceComponent.java (original) +++ portals/jetspeed-2/portal/trunk/components/jetspeed-rdbms/src/main/java/org/apache/jetspeed/components/datasource/DBCPDatasourceComponent.java Mon Sep 13 17:47:49 2010 @@ -69,6 +69,8 @@ public class DBCPDatasourceComponent imp private byte whenExhausted; + private boolean autoCommit; + private PoolableConnectionFactory dsConnectionFactory; /** * @@ -118,6 +120,7 @@ public class DBCPDatasourceComponent imp this.connectURI = connectURI; this.maxActive = maxActive; this.maxWait = maxWait; + this.autoCommit = autoCommit; } /** @@ -161,7 +164,7 @@ public class DBCPDatasourceComponent imp ConnectionFactory connectionFactory = new DriverManagerConnectionFactory(connectURI, user, password); - dsConnectionFactory = new PoolableConnectionFactory(connectionFactory, connectionPool, null, null, false, true); + dsConnectionFactory = new PoolableConnectionFactory(connectionFactory, connectionPool, null, null, false, autoCommit); dataSource = new PoolingDataSource(connectionPool); Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/tools/migration/JetspeedRegistryMigration.java URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/tools/migration/JetspeedRegistryMigration.java?rev=996614&r1=996613&r2=996614&view=diff ============================================================================== --- portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/tools/migration/JetspeedRegistryMigration.java (original) +++ portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/tools/migration/JetspeedRegistryMigration.java Mon Sep 13 17:47:49 2010 @@ -66,9 +66,9 @@ public class JetspeedRegistryMigration i } /* (non-Javadoc) - * @see org.apache.jetspeed.tools.migration.JetspeedMigration#migrate(java.sql.Connection, int, java.sql.Connection) + * @see org.apache.jetspeed.tools.migration.JetspeedMigration#migrate(java.sql.Connection, int, java.sql.Connection, org.apache.jetspeed.tools.migration.JetspeedMigrationListener) */ - public JetspeedMigrationResult migrate(Connection sourceConnection, int sourceVersion, Connection targetConnection) throws SQLException + public JetspeedMigrationResult migrate(Connection sourceConnection, int sourceVersion, Connection targetConnection, JetspeedMigrationListener migrationListener) throws SQLException { List localizedDescriptions = new ArrayList(); int rowsMigrated = 0; @@ -106,6 +106,7 @@ public class JetspeedRegistryMigration i portletDefinitionInsertStatement.setNull(9, Types.VARCHAR); portletDefinitionInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } } break; @@ -126,6 +127,7 @@ public class JetspeedRegistryMigration i portletDefinitionInsertStatement.setString(9, portletDefinitionResultSet.getString(9)); portletDefinitionInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } } break; @@ -174,6 +176,7 @@ public class JetspeedRegistryMigration i portletApplicationInsertStatement.setNull(10, Types.VARCHAR); portletApplicationInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); int applicationId = portletApplicationResultSet.getInt(1); String description = portletApplicationResultSet.getString(7); @@ -203,6 +206,7 @@ public class JetspeedRegistryMigration i portletApplicationInsertStatement.setString(10, portletApplicationResultSet.getString(10)); portletApplicationInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } } break; @@ -225,6 +229,7 @@ public class JetspeedRegistryMigration i portletApplicationMetadataInsertStatement.setString(5, portletApplicationMetadataResultSet.getString(5)); portletApplicationMetadataInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } portletApplicationMetadataResultSet.close(); portletApplicationMetadataQueryStatement.close(); @@ -244,6 +249,7 @@ public class JetspeedRegistryMigration i portletDefinitionMetadataInsertStatement.setString(5, portletDefinitionMetadataResultSet.getString(5)); portletDefinitionMetadataInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } portletDefinitionMetadataResultSet.close(); portletDefinitionMetadataQueryStatement.close(); @@ -271,6 +277,7 @@ public class JetspeedRegistryMigration i languageInsertStatement.setString(7, languageResultSet.getString(6)); languageInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } } break; @@ -289,6 +296,7 @@ public class JetspeedRegistryMigration i languageInsertStatement.setString(7, languageResultSet.getString(7)); languageInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } } break; @@ -317,6 +325,7 @@ public class JetspeedRegistryMigration i portletSupportsInsertStatement.setNull(5, Types.VARCHAR); portletSupportsInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } } break; @@ -333,6 +342,7 @@ public class JetspeedRegistryMigration i portletSupportsInsertStatement.setString(5, portletSupportsResultSet.getString(5)); portletSupportsInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } } break; @@ -361,6 +371,7 @@ public class JetspeedRegistryMigration i parameterInsertStatement.setString(5, parameterResultSet.getString(5)); parameterInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } } break; @@ -377,6 +388,7 @@ public class JetspeedRegistryMigration i parameterInsertStatement.setString(5, parameterResultSet.getString(5)); parameterInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } } break; @@ -470,10 +482,12 @@ public class JetspeedRegistryMigration i portletPreferenceInsertStatement.setShort(8, readOnly); portletPreferenceInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } else { rowsDropped++; + migrationListener.rowDropped(targetConnection); } } } @@ -497,6 +511,7 @@ public class JetspeedRegistryMigration i portletPreferenceInsertStatement.setShort(8, portletPreferenceResultSet.getShort(8)); portletPreferenceInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } } break; @@ -533,10 +548,12 @@ public class JetspeedRegistryMigration i portletPreferenceValueInsertStatement.setString(4, portletPreferenceValueResultSet.getString(4)); portletPreferenceValueInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } else { rowsDropped++; + migrationListener.rowDropped(targetConnection); } } portletPreferenceIdQueryStatement.close(); @@ -554,6 +571,7 @@ public class JetspeedRegistryMigration i portletPreferenceValueInsertStatement.setString(4, portletPreferenceValueResultSet.getString(4)); portletPreferenceValueInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } } break; @@ -575,6 +593,7 @@ public class JetspeedRegistryMigration i securityRoleReferenceInsertStatement.setString(4, securityRoleReferenceResultSet.getString(4)); securityRoleReferenceInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } securityRoleReferenceResultSet.close(); securityRoleReferenceQueryStatement.close(); @@ -624,6 +643,7 @@ public class JetspeedRegistryMigration i securityRoleInsertStatement.setString(3, securityRoleResultSet.getString(3)); securityRoleInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); int securityRoleId = securityRoleResultSet.getInt(1); String description = securityRoleResultSet.getString(4); @@ -635,6 +655,7 @@ public class JetspeedRegistryMigration i else { rowsDropped++; + migrationListener.rowDropped(targetConnection); } } applicationQueryStatement.close(); @@ -652,6 +673,7 @@ public class JetspeedRegistryMigration i securityRoleInsertStatement.setString(3, securityRoleResultSet.getString(3)); securityRoleInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } } break; @@ -673,6 +695,7 @@ public class JetspeedRegistryMigration i userAttributeRefInsertStatement.setString(4, userAttributeRefResultSet.getString(4)); userAttributeRefInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } userAttributeRefResultSet.close(); userAttributeRefQueryStatement.close(); @@ -696,6 +719,7 @@ public class JetspeedRegistryMigration i userAttributeInsertStatement.setString(3, userAttributeResultSet.getString(3)); userAttributeInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); int userAttributeId = userAttributeResultSet.getInt(1); String description = userAttributeResultSet.getString(4); @@ -717,6 +741,7 @@ public class JetspeedRegistryMigration i userAttributeInsertStatement.setString(3, userAttributeResultSet.getString(3)); userAttributeInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } } break; @@ -737,6 +762,7 @@ public class JetspeedRegistryMigration i jetspeedServiceInsertStatement.setString(3, jetspeedServiceResultSet.getString(3)); jetspeedServiceInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } jetspeedServiceResultSet.close(); jetspeedServiceQueryStatement.close(); @@ -762,6 +788,7 @@ public class JetspeedRegistryMigration i customPortletModeInsertStatement.setShort(5, (short)1); customPortletModeInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); int customPortletModeId = customPortletModeResultSet.getInt(1); String description = customPortletModeResultSet.getString(5); @@ -785,6 +812,7 @@ public class JetspeedRegistryMigration i customPortletModeInsertStatement.setShort(5, customPortletModeResultSet.getShort(5)); customPortletModeInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } } break; @@ -812,6 +840,7 @@ public class JetspeedRegistryMigration i customWindowStateInsertStatement.setString(4, customWindowStateResultSet.getString(4)); customWindowStateInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); int customWindowStateId = customWindowStateResultSet.getInt(1); String description = customWindowStateResultSet.getString(5); @@ -834,6 +863,7 @@ public class JetspeedRegistryMigration i customWindowStateInsertStatement.setString(4, customWindowStateResultSet.getString(4)); customWindowStateInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } } break; @@ -884,6 +914,7 @@ public class JetspeedRegistryMigration i localizedDescriptionInsertStatement.setString(5, localizedDescriptionResultSet.getString(5)); localizedDescriptionInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } } for (LocalizedDescription description : localizedDescriptions) @@ -895,6 +926,7 @@ public class JetspeedRegistryMigration i localizedDescriptionInsertStatement.setString(5, DEFAULT_LOCALE_STRING); localizedDescriptionInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } } break; @@ -911,6 +943,7 @@ public class JetspeedRegistryMigration i localizedDescriptionInsertStatement.setString(5, localizedDescriptionResultSet.getString(5)); localizedDescriptionInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } } break; @@ -947,6 +980,7 @@ public class JetspeedRegistryMigration i localizedDisplayNameInsertStatement.setString(5, localizedDisplayNameResultSet.getString(5)); localizedDisplayNameInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } } } @@ -964,6 +998,7 @@ public class JetspeedRegistryMigration i localizedDisplayNameInsertStatement.setString(5, localizedDisplayNameResultSet.getString(5)); localizedDisplayNameInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } } break; @@ -992,6 +1027,7 @@ public class JetspeedRegistryMigration i eventDefinitionInsertStatement.setString(6, eventDefinitionResultSet.getString(6)); eventDefinitionInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } eventDefinitionResultSet.close(); eventDefinitionQueryStatement.close(); @@ -1011,6 +1047,7 @@ public class JetspeedRegistryMigration i eventAliasInsertStatement.setString(5, eventAliasResultSet.getString(5)); eventAliasInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } eventAliasResultSet.close(); eventAliasQueryStatement.close(); @@ -1030,6 +1067,7 @@ public class JetspeedRegistryMigration i parameterAliasInsertStatement.setString(5, parameterAliasResultSet.getString(5)); parameterAliasInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } parameterAliasResultSet.close(); parameterAliasQueryStatement.close(); @@ -1049,6 +1087,7 @@ public class JetspeedRegistryMigration i publishingEventInsertStatement.setString(5, publishingEventResultSet.getString(5)); publishingEventInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } publishingEventResultSet.close(); publishingEventQueryStatement.close(); @@ -1068,6 +1107,7 @@ public class JetspeedRegistryMigration i processingEventInsertStatement.setString(5, processingEventResultSet.getString(5)); processingEventInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } processingEventResultSet.close(); processingEventQueryStatement.close(); @@ -1085,6 +1125,7 @@ public class JetspeedRegistryMigration i namedParameterInsertStatement.setString(3, namedParameterResultSet.getString(3)); namedParameterInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } namedParameterResultSet.close(); namedParameterQueryStatement.close(); @@ -1103,6 +1144,7 @@ public class JetspeedRegistryMigration i runtimeOptionInsertStatement.setString(4, runtimeOptionResultSet.getString(4)); runtimeOptionInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } runtimeOptionResultSet.close(); runtimeOptionQueryStatement.close(); @@ -1120,6 +1162,7 @@ public class JetspeedRegistryMigration i runtimeValueInsertStatement.setString(3, runtimeValueResultSet.getString(3)); runtimeValueInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } runtimeValueResultSet.close(); runtimeValueQueryStatement.close(); @@ -1140,6 +1183,7 @@ public class JetspeedRegistryMigration i publicParameterInsertStatement.setString(6, publicParameterResultSet.getString(6)); publicParameterInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } publicParameterResultSet.close(); publicParameterQueryStatement.close(); @@ -1158,6 +1202,7 @@ public class JetspeedRegistryMigration i portletFilterInsertStatement.setString(4, portletFilterResultSet.getString(4)); portletFilterInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } portletFilterResultSet.close(); portletFilterQueryStatement.close(); @@ -1175,6 +1220,7 @@ public class JetspeedRegistryMigration i filterLifecycleInsertStatement.setString(3, filterLifecycleResultSet.getString(3)); filterLifecycleInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } filterLifecycleResultSet.close(); filterLifecycleQueryStatement.close(); @@ -1192,6 +1238,7 @@ public class JetspeedRegistryMigration i filterMappingInsertStatement.setString(3, filterMappingResultSet.getString(3)); filterMappingInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } filterMappingResultSet.close(); filterMappingQueryStatement.close(); @@ -1209,6 +1256,7 @@ public class JetspeedRegistryMigration i filteredPortletInsertStatement.setString(3, filteredPortletResultSet.getString(3)); filteredPortletInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } filteredPortletResultSet.close(); filteredPortletQueryStatement.close(); @@ -1226,6 +1274,7 @@ public class JetspeedRegistryMigration i portletListenerInsertStatement.setString(3, portletListenerResultSet.getString(3)); portletListenerInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } portletListenerResultSet.close(); portletListenerQueryStatement.close(); @@ -1243,6 +1292,7 @@ public class JetspeedRegistryMigration i portletApplicationSecurityConstraintInsertStatement.setString(3, portletApplicationSecurityConstraintResultSet.getString(3)); portletApplicationSecurityConstraintInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } portletApplicationSecurityConstraintResultSet.close(); portletApplicationSecurityConstraintQueryStatement.close(); @@ -1260,6 +1310,7 @@ public class JetspeedRegistryMigration i securedPortletInsertStatement.setString(3, securedPortletResultSet.getString(3)); securedPortletInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } securedPortletResultSet.close(); securedPortletQueryStatement.close(); @@ -1278,6 +1329,7 @@ public class JetspeedRegistryMigration i localeEncodingMappingInsertStatement.setString(4, localeEncodingMappingResultSet.getString(4)); localeEncodingMappingInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } localeEncodingMappingResultSet.close(); localeEncodingMappingQueryStatement.close(); @@ -1318,6 +1370,7 @@ public class JetspeedRegistryMigration i ojbInsertStatement.setInt(5, version); ojbInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } ojbResultSet.close(); ojbQueryStatement.close(); @@ -1353,6 +1406,7 @@ public class JetspeedRegistryMigration i ojbInsertStatement.setInt(5, ojbResultSet.getInt(5)); ojbInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } } ojbResultSet.close(); @@ -1370,6 +1424,7 @@ public class JetspeedRegistryMigration i ojbInsertStatement.setInt(5, version); ojbInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } } break; Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/tools/migration/JetspeedSecurityMigration.java URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/tools/migration/JetspeedSecurityMigration.java?rev=996614&r1=996613&r2=996614&view=diff ============================================================================== --- portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/tools/migration/JetspeedSecurityMigration.java (original) +++ portals/jetspeed-2/portal/trunk/components/jetspeed-security/src/main/java/org/apache/jetspeed/tools/migration/JetspeedSecurityMigration.java Mon Sep 13 17:47:49 2010 @@ -68,9 +68,9 @@ public class JetspeedSecurityMigration i } /* (non-Javadoc) - * @see org.apache.jetspeed.tools.migration.JetspeedMigration#migrate(java.sql.Connection, int, java.sql.Connection) + * @see org.apache.jetspeed.tools.migration.JetspeedMigration#migrate(java.sql.Connection, int, java.sql.Connection, org.apache.jetspeed.tools.migration.JetspeedMigrationListener) */ - public JetspeedMigrationResult migrate(Connection sourceConnection, int sourceVersion, Connection targetConnection) throws SQLException + public JetspeedMigrationResult migrate(Connection sourceConnection, int sourceVersion, Connection targetConnection, JetspeedMigrationListener migrationListener) throws SQLException { int rowsMigrated = 0; @@ -92,6 +92,7 @@ public class JetspeedSecurityMigration i securityDomainInsertStatement.setNull(5, Types.INTEGER); securityDomainInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); securityDomainInsertStatement.setInt(1, DEFAULT_SECURITY_DOMAIN_ID); securityDomainInsertStatement.setString(2, SecurityDomain.DEFAULT_NAME); @@ -100,6 +101,7 @@ public class JetspeedSecurityMigration i securityDomainInsertStatement.setNull(5, Types.INTEGER); securityDomainInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); maxSecurityDomainId = DEFAULT_SECURITY_DOMAIN_ID; securityDomainResultSet = securityDomainQueryStatement.executeQuery("SELECT NAME FROM SSO_SITE"); @@ -112,6 +114,7 @@ public class JetspeedSecurityMigration i securityDomainInsertStatement.setInt(5, DEFAULT_SECURITY_DOMAIN_ID); securityDomainInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } } break; @@ -128,6 +131,7 @@ public class JetspeedSecurityMigration i Static.setNullableInt(securityDomainResultSet, 5, securityDomainInsertStatement); securityDomainInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } } break; @@ -215,6 +219,7 @@ public class JetspeedSecurityMigration i securityPrincipalInsertStatement.setInt(10, domainId); securityPrincipalInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } } domainQueryStatement.close(); @@ -239,6 +244,7 @@ public class JetspeedSecurityMigration i securityPrincipalInsertStatement.setInt(10, securityPrincipalResultSet.getInt(10)); securityPrincipalInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } } break; @@ -302,6 +308,7 @@ public class JetspeedSecurityMigration i securityAttributeInsertStatement.setString(4, securityAttributeResultSet.getString(4)); securityAttributeInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); securityAttributeRowsMigrated = true; } } @@ -320,6 +327,7 @@ public class JetspeedSecurityMigration i securityAttributeInsertStatement.setString(4, securityAttributeResultSet.getString(4)); securityAttributeInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } } break; @@ -345,6 +353,7 @@ public class JetspeedSecurityMigration i securityPrincipalAssocInsertStatement.setInt(3, securityPrincipalAssocResultSet.getInt(2)); securityPrincipalAssocInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } securityPrincipalAssocResultSet.close(); securityPrincipalAssocQueryStatement1.close(); @@ -359,6 +368,7 @@ public class JetspeedSecurityMigration i securityPrincipalAssocInsertStatement.setInt(3, securityPrincipalAssocResultSet.getInt(2)); securityPrincipalAssocInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } securityPrincipalAssocResultSet.close(); securityPrincipalAssocQueryStatement2.close(); @@ -373,6 +383,7 @@ public class JetspeedSecurityMigration i securityPrincipalAssocInsertStatement.setInt(3, securityPrincipalAssocResultSet.getInt(2)); securityPrincipalAssocInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } securityPrincipalAssocResultSet.close(); securityPrincipalAssocQueryStatement3.close(); @@ -407,6 +418,7 @@ public class JetspeedSecurityMigration i securityPrincipalAssocInsertStatement.setInt(3, principalId); securityPrincipalAssocInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } principalQueryStatement.close(); ssoPrincipalResultSet.close(); @@ -426,6 +438,7 @@ public class JetspeedSecurityMigration i securityPrincipalAssocInsertStatement.setInt(3, securityPrincipalAssocResultSet.getInt(3)); securityPrincipalAssocInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } securityPrincipalAssocResultSet.close(); securityPrincipalAssocQueryStatement.close(); @@ -479,6 +492,7 @@ public class JetspeedSecurityMigration i securityPermissionInsertStatement.setString(4, securityPermissionResultSet.getString(4)); securityPermissionInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } } } @@ -495,6 +509,7 @@ public class JetspeedSecurityMigration i securityPermissionInsertStatement.setString(4, securityPermissionResultSet.getString(4)); securityPermissionInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } } break; @@ -514,6 +529,7 @@ public class JetspeedSecurityMigration i principalPermissionInsertStatement.setInt(2, principalPermissionResultSet.getInt(2)); principalPermissionInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } principalPermissionResultSet.close(); principalPermissionQueryStatement.close(); @@ -572,6 +588,7 @@ public class JetspeedSecurityMigration i securityCredentialInsertStatement.setDate(16, securityCredentialResultSet.getDate(14)); securityCredentialInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } principalTypeQueryStatement.close(); } @@ -600,6 +617,7 @@ public class JetspeedSecurityMigration i securityCredentialInsertStatement.setDate(16, securityCredentialResultSet.getDate(16)); securityCredentialInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } } break; @@ -621,6 +639,7 @@ public class JetspeedSecurityMigration i ojbInsertStatement.setInt(5, ojbResultSet.getInt(5)); ojbInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } ojbResultSet.close(); ojbQueryStatement.close(); @@ -651,6 +670,7 @@ public class JetspeedSecurityMigration i ojbInsertStatement.setInt(5, ojbResultSet.getInt(5)); ojbInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } } ojbResultSet.close(); @@ -668,6 +688,7 @@ public class JetspeedSecurityMigration i ojbInsertStatement.setInt(5, version); ojbInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } } break; Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/main/java/org/apache/jetspeed/tools/migration/JetspeedSSOSecurityMigration.java URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/main/java/org/apache/jetspeed/tools/migration/JetspeedSSOSecurityMigration.java?rev=996614&r1=996613&r2=996614&view=diff ============================================================================== --- portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/main/java/org/apache/jetspeed/tools/migration/JetspeedSSOSecurityMigration.java (original) +++ portals/jetspeed-2/portal/trunk/components/jetspeed-sso/src/main/java/org/apache/jetspeed/tools/migration/JetspeedSSOSecurityMigration.java Mon Sep 13 17:47:49 2010 @@ -58,9 +58,9 @@ public class JetspeedSSOSecurityMigratio } /* (non-Javadoc) - * @see org.apache.jetspeed.tools.migration.JetspeedMigration#migrate(java.sql.Connection, int, java.sql.Connection) + * @see org.apache.jetspeed.tools.migration.JetspeedMigration#migrate(java.sql.Connection, int, java.sql.Connection, org.apache.jetspeed.tools.migration.JetspeedMigrationListener) */ - public JetspeedMigrationResult migrate(Connection sourceConnection, int sourceVersion, Connection targetConnection) throws SQLException + public JetspeedMigrationResult migrate(Connection sourceConnection, int sourceVersion, Connection targetConnection, JetspeedMigrationListener migrationListener) throws SQLException { int rowsMigrated = 0; @@ -105,6 +105,7 @@ public class JetspeedSSOSecurityMigratio ssoSiteInsertStatement.setInt(11, domainId); ssoSiteInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } domainQueryStatement.close(); } @@ -128,6 +129,7 @@ public class JetspeedSSOSecurityMigratio ssoSiteInsertStatement.setInt(11, ssoSiteResultSet.getInt(11)); ssoSiteInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } } break; @@ -149,6 +151,7 @@ public class JetspeedSSOSecurityMigratio ojbInsertStatement.setInt(5, ojbResultSet.getInt(5)); ojbInsertStatement.executeUpdate(); rowsMigrated++; + migrationListener.rowMigrated(targetConnection); } ojbResultSet.close(); ojbQueryStatement.close(); --------------------------------------------------------------------- To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org For additional commands, e-mail: jetspeed-dev-help@portals.apache.org