Merged V2.2 to HEAD

11106: Leniency in AVM CAL upgrade to avoid customer upgrade issues ACT-4500
   11129: ETWOTWO-460 Service Port for alfresco runtime
   11144: Proper clean-up of deleted node's properties and aspects
   11146: Modifications to enable 'alternatives' when running patches
   11153: Fixed masked NPE when checking 'alternative' patches
   11154: Some neat reporting when a patch doesn't execute as a result of an alternative patch having run
   11161: ETWOTWO-91
   11163: ETWOTWO-733: CheckOutCheckInService.getWorkingCopy(NodeRef) returns nodes ...
   11165: Merged V2.1 to V2.2
      10983: Close stream for audit config
   11192: ETWOTWO-169 -  Editing FSR Deployment Receiver causes password to be lost
   11210: Merge of refactored AVM Filesystem storeCreated Processing from 2.1


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@11227 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2008-10-07 02:01:55 +00:00
parent e6d7627f13
commit 1cd93731fd
16 changed files with 636 additions and 76 deletions

View File

@@ -56,6 +56,7 @@ import org.apache.commons.logging.LogFactory;
public class PatchServiceImpl implements PatchService
{
private static final String MSG_NOT_RELEVANT = "patch.service.not_relevant";
private static final String MSG_PRECEEDED_BY_ALTERNATIVE = "patch.service.preceeded_by_alternative";
private static final String MSG_APPLYING_PATCH = "patch.service.applying_patch";
private static final Date ZERO_DATE = new Date(0L);
@@ -245,6 +246,7 @@ public class PatchServiceImpl implements PatchService
boolean success = false;
// first check whether the patch is relevant to the repo
Descriptor repoDescriptor = descriptorService.getInstalledRepositoryDescriptor();
String preceededByAlternative = preceededByAlternative(patch);
boolean applies = applies(repoDescriptor, patch);
if (!applies)
{
@@ -252,6 +254,11 @@ public class PatchServiceImpl implements PatchService
report = I18NUtil.getMessage(MSG_NOT_RELEVANT, repoDescriptor.getSchema());
success = true; // this succeeded because it didn't need to be applied
}
else if (preceededByAlternative != null)
{
report = I18NUtil.getMessage(MSG_PRECEEDED_BY_ALTERNATIVE, preceededByAlternative);
success = true; // this succeeded because it didn't need to be applied
}
else
{
// perform actual execution
@@ -309,6 +316,28 @@ public class PatchServiceImpl implements PatchService
return appliedPatch;
}
/**
* Identifies if one of the alternative patches has already been executed.
*
* @param patch the patch to check
* @return Returns the ID of any successfully executed alternative patch
*/
private String preceededByAlternative(Patch patch)
{
// If any alternatives were executed, then bypass this one
List<Patch> alternatives = patch.getAlternatives();
for (Patch alternative : alternatives)
{
// If the patch was executed, then this one was effectively executed
AppliedPatch appliedAlternative = patchDaoService.getAppliedPatch(alternative.getId());
if (appliedAlternative != null && appliedAlternative.getSucceeded())
{
return alternative.getId();
}
}
return null;
}
/**
* Check whether the patch is applicable to the particular version of the repository.
*