if (state != State.COMPLETED) { try { modification.cancel(); } finally { try {
if (state != State.COMPLETED) { try { modification.cancel(); } finally { try {
@Override public PatchingResult rollback(final String streamName, final String patchId, final ContentVerificationPolicy contentPolicy, final boolean rollbackTo, final boolean resetConfiguration) throws PatchingException { InstalledIdentity targetIdentity = null; if (streamName == null) { for (InstalledIdentity identity : manager.getInstalledIdentities()) { if (identity.getAllInstalledPatches().contains(patchId)) { if (targetIdentity != null) { throw new PatchingException(PatchLogger.ROOT_LOGGER.patchIdFoundInMoreThanOneStream(patchId, targetIdentity.getIdentity().getName(), identity.getIdentity().getName())); } targetIdentity = identity; } } if(targetIdentity == null) { throw PatchLogger.ROOT_LOGGER.patchNotFoundInHistory(patchId); } } else { targetIdentity = manager.getInstalledIdentity(streamName, null); } // Rollback the patch final InstallationManager.InstallationModification modification = targetIdentity.modifyInstallation(runner); try { return runner.rollbackPatch(patchId, contentPolicy, rollbackTo, resetConfiguration, modification); } catch (Exception e) { modification.cancel(); throw rethrowException(e); } }
@Override public PatchingResult rollback(final String streamName, final String patchId, final ContentVerificationPolicy contentPolicy, final boolean rollbackTo, final boolean resetConfiguration) throws PatchingException { InstalledIdentity targetIdentity = null; if (streamName == null) { for (InstalledIdentity identity : manager.getInstalledIdentities()) { if (identity.getAllInstalledPatches().contains(patchId)) { if (targetIdentity != null) { throw new PatchingException(PatchLogger.ROOT_LOGGER.patchIdFoundInMoreThanOneStream(patchId, targetIdentity.getIdentity().getName(), identity.getIdentity().getName())); } targetIdentity = identity; } } if(targetIdentity == null) { throw PatchLogger.ROOT_LOGGER.patchNotFoundInHistory(patchId); } } else { targetIdentity = manager.getInstalledIdentity(streamName, null); } // Rollback the patch final InstallationManager.InstallationModification modification = targetIdentity.modifyInstallation(runner); try { return runner.rollbackPatch(patchId, contentPolicy, rollbackTo, resetConfiguration, modification); } catch (Exception e) { modification.cancel(); throw rethrowException(e); } }
@Override public PatchingResult rollbackLast(final String streamName, final ContentVerificationPolicy contentPolicy, final boolean resetConfiguration) throws PatchingException { final InstalledIdentity targetIdentity = streamName == null ? manager.getDefaultIdentity() : manager.getInstalledIdentity(streamName, null); final InstallationManager.InstallationModification modification = targetIdentity.modifyInstallation(runner); try { return runner.rollbackLast(contentPolicy, resetConfiguration, modification); } catch (Exception e) { modification.cancel(); throw rethrowException(e); } }
@Override public void rollback() { if (undoChanges()) { try { callback.operationCancelled(IdentityPatchContext.this); } finally { modification.cancel(); } } } };
protected PatchingResult apply(final PatchMetadataResolver patchResolver, final PatchContentProvider contentProvider, final ContentVerificationPolicy contentPolicy) throws PatchingException { // Apply the patch final org.jboss.as.patching.metadata.Identity identity = patchResolver.resolvePatch(null, null).getIdentity(); final InstallationManager.InstallationModification modification = ((InstallationManagerImpl)manager). getInstalledIdentity(identity.getName(), identity.getVersion()).modifyInstallation(callback); try { return runner.applyPatch(patchResolver, contentProvider, contentPolicy, modification); } catch (Exception e) { modification.cancel(); throw rethrowException(e); } }
@Override public PatchingResult rollbackLast(final String streamName, final ContentVerificationPolicy contentPolicy, final boolean resetConfiguration) throws PatchingException { final InstalledIdentity targetIdentity = streamName == null ? manager.getDefaultIdentity() : manager.getInstalledIdentity(streamName, null); final InstallationManager.InstallationModification modification = targetIdentity.modifyInstallation(runner); try { return runner.rollbackLast(contentPolicy, resetConfiguration, modification); } catch (Exception e) { modification.cancel(); throw rethrowException(e); } }
protected PatchingResult apply(final PatchMetadataResolver patchResolver, final PatchContentProvider contentProvider, final ContentVerificationPolicy contentPolicy) throws PatchingException { // Apply the patch final org.jboss.as.patching.metadata.Identity identity = patchResolver.resolvePatch(null, null).getIdentity(); final InstallationManager.InstallationModification modification = ((InstallationManagerImpl)manager). getInstalledIdentity(identity.getName(), identity.getVersion()).modifyInstallation(callback); try { return runner.applyPatch(patchResolver, contentProvider, contentPolicy, modification); } catch (Exception e) { modification.cancel(); throw rethrowException(e); } }
@Override public void rollback() { if (undoChanges()) { try { callback.operationCancelled(IdentityPatchContext.this); } finally { modification.cancel(); } } } };