diff --git a/config/alfresco/patch/patch-services-context.xml b/config/alfresco/patch/patch-services-context.xml index 1007bebadd..fe1ac46655 100644 --- a/config/alfresco/patch/patch-services-context.xml +++ b/config/alfresco/patch/patch-services-context.xml @@ -21,6 +21,7 @@ + PROPAGATION_NOT_SUPPORTED ${server.transaction.mode.readOnly} ${server.transaction.mode.default} @@ -37,6 +38,9 @@ + + + diff --git a/source/java/org/alfresco/repo/action/executer/ImporterActionExecuter.java b/source/java/org/alfresco/repo/action/executer/ImporterActionExecuter.java index ac3032f8e9..44ca8e441e 100644 --- a/source/java/org/alfresco/repo/action/executer/ImporterActionExecuter.java +++ b/source/java/org/alfresco/repo/action/executer/ImporterActionExecuter.java @@ -348,7 +348,7 @@ public class ImporterActionExecuter extends ActionExecuterAbstractBase else { File newdir = new File(extractDir + entry.getName()); - newdir.mkdir(); + newdir.mkdirs(); } } } diff --git a/source/java/org/alfresco/repo/admin/patch/AbstractPatch.java b/source/java/org/alfresco/repo/admin/patch/AbstractPatch.java index fad28d455f..1ba4553c96 100644 --- a/source/java/org/alfresco/repo/admin/patch/AbstractPatch.java +++ b/source/java/org/alfresco/repo/admin/patch/AbstractPatch.java @@ -335,6 +335,12 @@ public abstract class AbstractPatch implements Patch // execute in a transaction try { + if (logger.isDebugEnabled()) + { + logger.debug("\n" + + "Patch will be applied: \n" + + " patch: " + this); + } AuthenticationUtil.RunAsWork authorisedPathWork = new AuthenticationUtil.RunAsWork() { public String doWork() throws Exception @@ -361,7 +367,8 @@ public abstract class AbstractPatch implements Patch // done if (logger.isDebugEnabled()) { - logger.debug("Patch successfully applied: \n" + + logger.debug("\n" + + "Patch successfully applied: \n" + " patch: " + this + "\n" + " report: " + report); } diff --git a/source/java/org/alfresco/repo/admin/patch/PatchServiceImpl.java b/source/java/org/alfresco/repo/admin/patch/PatchServiceImpl.java index b8d3e88137..982850f173 100644 --- a/source/java/org/alfresco/repo/admin/patch/PatchServiceImpl.java +++ b/source/java/org/alfresco/repo/admin/patch/PatchServiceImpl.java @@ -34,10 +34,12 @@ import java.util.Map; import org.alfresco.i18n.I18NUtil; import org.alfresco.repo.domain.AppliedPatch; +import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; import org.alfresco.service.cmr.admin.PatchException; import org.alfresco.service.cmr.rule.RuleService; import org.alfresco.service.descriptor.Descriptor; import org.alfresco.service.descriptor.DescriptorService; +import org.alfresco.service.transaction.TransactionService; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -61,6 +63,7 @@ public class PatchServiceImpl implements PatchService private static Log logger = LogFactory.getLog(PatchServiceImpl.class); private DescriptorService descriptorService; + private TransactionService transactionService; private RuleService ruleService; private PatchDaoService patchDaoService; private List patches; @@ -75,6 +78,11 @@ public class PatchServiceImpl implements PatchService this.descriptorService = descriptorService; } + public void setTransactionService(TransactionService transactionService) + { + this.transactionService = transactionService; + } + public void setPatchDaoService(PatchDaoService patchDaoService) { this.patchDaoService = patchDaoService; @@ -156,7 +164,7 @@ public class PatchServiceImpl implements PatchService * @param appliedPatchesById already applied patches keyed by their ID * @return Returns true if the patch and all its dependencies were successfully applied. */ - private boolean applyPatchAndDependencies(Patch patch, Map appliedPatchesById) + private boolean applyPatchAndDependencies(final Patch patch, Map appliedPatchesById) { String id = patch.getId(); // check if it has already been done @@ -183,7 +191,14 @@ public class PatchServiceImpl implements PatchService } } // all the dependencies were successful - appliedPatch = applyPatch(patch); + RetryingTransactionCallback callback = new RetryingTransactionCallback() + { + public AppliedPatch execute() throws Throwable + { + return applyPatch(patch); + } + }; + appliedPatch = transactionService.getRetryingTransactionHelper().doInTransaction(callback, false, true); if (!appliedPatch.getSucceeded()) { // this was a failure