Merged V2.0 to HEAD

5448: (From V1.4)
      5281 (V1.4): Patches not executed in read-only mode
      5284 (V1.4): Integrity messages
      5308 (V1.4): Category selector performance
      5331 (V1.4): Category performance
      5402 (V1.4): AR-1315
      5410 (V1.4): 
      5417 (V1.4): Upgrade script performance
      5435 (V1.4): Lucene test text encoding


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5482 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2007-04-11 23:24:00 +00:00
parent d3e08db677
commit 4ea83f7f2b
15 changed files with 183 additions and 22 deletions

View File

@@ -29,6 +29,7 @@ import java.util.List;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.i18n.I18NUtil;
import org.alfresco.service.transaction.TransactionService;
import org.alfresco.util.AbstractLifecycleBean;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -44,6 +45,7 @@ public class PatchExecuter extends AbstractLifecycleBean
{
private static final String MSG_CHECKING = "patch.executer.checking";
private static final String MSG_NO_PATCHES_REQUIRED = "patch.executer.no_patches_required";
private static final String MSG_SYSTEM_READ_ONLY = "patch.executer.system_readonly";
private static final String MSG_NOT_EXECUTED = "patch.executer.not_executed";
private static final String MSG_EXECUTED = "patch.executer.executed";
private static final String MSG_FAILED = "patch.executer.failed";
@@ -51,6 +53,7 @@ public class PatchExecuter extends AbstractLifecycleBean
private static Log logger = LogFactory.getLog(PatchExecuter.class);
private PatchService patchService;
private TransactionService transactionService;
/**
* @param patchService the server that actually executes the patches
@@ -59,12 +62,27 @@ public class PatchExecuter extends AbstractLifecycleBean
{
this.patchService = patchService;
}
/**
* @param transactionService provides the system read-only state
*/
public void setTransactionService(TransactionService transactionService)
{
this.transactionService = transactionService;
}
/**
* Ensures that all outstanding patches are applied.
*/
public void applyOutstandingPatches()
{
// Avoid read-only systems
if (transactionService.isReadOnly())
{
logger.warn(I18NUtil.getMessage(MSG_SYSTEM_READ_ONLY));
return;
}
logger.info(I18NUtil.getMessage(MSG_CHECKING));
Date before = new Date(System.currentTimeMillis() - 60000L); // 60 seconds ago