Merged V2.0 to HEAD

svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V2.0@5154 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V2.0@5155 .
      - Installer script cleanup
   svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V2.0@5156 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V2.0@5157 .
   svn merge svn://svn.alfresco.com:3691/alfresco/BRANCHES/V2.0@5162 svn://svn.alfresco.com:3691/alfresco/BRANCHES/V2.0@5163 .
   svn rm --force root\projects\repository\config\alfresco\dbscripts\create\1.4\org.hibernate.dialect.Dialect\post-create-indexes.sql
   svn rm --force root\projects\repository\config\alfresco\dbscripts\create\1.4\org.hibernate.dialect.MySQLInnoDBDialect\post-create-indexes.sql
      - Fix AR-1225: Upgrade and install indexes


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5171 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2007-02-16 16:10:44 +00:00
parent f484e98638
commit b4e48157f5
15 changed files with 294 additions and 105 deletions

View File

@@ -95,13 +95,15 @@ public class SchemaBootstrap extends AbstractLifecycleBean
private boolean updateSchema;
private List<String> postCreateScriptUrls;
private List<SchemaUpgradeScriptPatch> validateUpdateScriptPatches;
private List<SchemaUpgradeScriptPatch> applyUpdateScriptPatches;
private List<SchemaUpgradeScriptPatch> preUpdateScriptPatches;
private List<SchemaUpgradeScriptPatch> postUpdateScriptPatches;
public SchemaBootstrap()
{
postCreateScriptUrls = new ArrayList<String>(1);
validateUpdateScriptPatches = new ArrayList<SchemaUpgradeScriptPatch>(4);
applyUpdateScriptPatches = new ArrayList<SchemaUpgradeScriptPatch>(4);
preUpdateScriptPatches = new ArrayList<SchemaUpgradeScriptPatch>(4);
postUpdateScriptPatches = new ArrayList<SchemaUpgradeScriptPatch>(4);
}
public void setLocalSessionFactory(LocalSessionFactoryBean localSessionFactory)
@@ -154,7 +156,7 @@ public class SchemaBootstrap extends AbstractLifecycleBean
* For example, at version 3.0, the upgrade scripts for version 1.4 may be considered
* unsupported - this doesn't prevent the manual application of the scripts, though.
*
* @param applyUpdateScriptPatches a list of schema patches to check
* @param scriptPatches a list of schema patches to check
*/
public void setValidateUpdateScriptPatches(List<SchemaUpgradeScriptPatch> scriptPatches)
{
@@ -162,13 +164,23 @@ public class SchemaBootstrap extends AbstractLifecycleBean
}
/**
* Set the schema script patches that may be executed during an update.
* Set the schema script patches that may be applied prior to the auto-update process.
*
* @param applyUpdateScriptPatches a list of schema patches to check
* @param scriptPatches a list of schema patches to check
*/
public void setApplyUpdateScriptPatches(List<SchemaUpgradeScriptPatch> scriptPatches)
public void setPreUpdateScriptPatches(List<SchemaUpgradeScriptPatch> scriptPatches)
{
this.applyUpdateScriptPatches = scriptPatches;
this.preUpdateScriptPatches = scriptPatches;
}
/**
* Set the schema script patches that may be applied after the auto-update process.
*
* @param postUpdateScriptPatches a list of schema patches to check
*/
public void setPostUpdateScriptPatches(List<SchemaUpgradeScriptPatch> scriptPatches)
{
this.postUpdateScriptPatches = scriptPatches;
}
/**
@@ -350,10 +362,12 @@ public class SchemaBootstrap extends AbstractLifecycleBean
}
else
{
// we have a database, so just run the update scripts
checkSchemaPatchScripts(cfg, session, connection, validateUpdateScriptPatches, false); // check for scripts that must have been run
checkSchemaPatchScripts(cfg, session, connection, applyUpdateScriptPatches, true); // execute scripts as required
// let Hibernate do any required updates
// Check for scripts that must have been run
checkSchemaPatchScripts(cfg, session, connection, validateUpdateScriptPatches, false);
// Execute any pre-auto-update scripts
checkSchemaPatchScripts(cfg, session, connection, preUpdateScriptPatches, true);
// Build and execute changes generated by Hibernate
File tempFile = null;
Writer writer = null;
try
@@ -383,6 +397,9 @@ public class SchemaBootstrap extends AbstractLifecycleBean
{
executeScriptFile(cfg, connection, tempFile, tempFile.getPath());
}
// Execute any post-auto-update scripts
checkSchemaPatchScripts(cfg, session, connection, postUpdateScriptPatches, true);
}
}
@@ -414,7 +431,8 @@ public class SchemaBootstrap extends AbstractLifecycleBean
boolean wasSuccessfullyApplied = didPatchSucceed(connection, patchId);
if (wasSuccessfullyApplied)
{
// nothing to do - it has been done before
// Either the patch was executed before or the system was bootstrapped
// with the patch bean present.
continue;
}
else if (!apply)
@@ -574,7 +592,7 @@ public class SchemaBootstrap extends AbstractLifecycleBean
{
if (logger.isDebugEnabled())
{
logger.debug("Executing statment: " + sql);
logger.debug("Executing statement: " + sql);
}
stmt.execute(sql);
}
@@ -626,8 +644,9 @@ public class SchemaBootstrap extends AbstractLifecycleBean
}
// verify that all patches have been applied correctly
checkSchemaPatchScripts(cfg, session, connection, validateUpdateScriptPatches, false); // check scripts
checkSchemaPatchScripts(cfg, session, connection, applyUpdateScriptPatches, false); // check scripts
checkSchemaPatchScripts(cfg, session, connection, validateUpdateScriptPatches, false); // check scripts
checkSchemaPatchScripts(cfg, session, connection, preUpdateScriptPatches, false); // check scripts
checkSchemaPatchScripts(cfg, session, connection, postUpdateScriptPatches, false); // check scripts
// all done successfully
transaction.commit();