validateRollbackState(patchId, modification.getUnmodifiedInstallationState()); } catch (PatchingException e) { throw e; final List<String> oneOffs = modification.getPatchIDs(); final int index = oneOffs.indexOf(patchId); if (patchId.equals(modification.getCumulativePatchID())) { patches.add(modification.getCumulativePatchID()); } else { throw PatchLogger.ROOT_LOGGER.cannotRollbackPatch(patchId); if (!Constants.BASE.equals(rollback)) { rollback(rollback, context); modification.removeInstalledPatch(rollback);
final InstalledIdentity installedIdentity = modification.getUnmodifiedInstallationState(); final String name = installedIdentity.getIdentity().getName(); final IdentityImpl identity = new IdentityImpl(name, modification.getVersion()); if (patchType == Patch.PatchType.CUMULATIVE) { identity.setPatchType(Patch.PatchType.CUMULATIVE);
final String patchId; if (patchType == Patch.PatchType.CUMULATIVE) { patchId = modification.getCumulativePatchID(); } else { patchId = original.getPatchId();
if (patchType == Patch.PatchType.CUMULATIVE) { final List<String> invalidation = new ArrayList<String>(modification.getPatchIDs()); if (!invalidation.isEmpty()) { try { modification.getUnmodifiedInstallationState()); } catch (PatchingException e) { throw e; modification.addInstalledPatch(patchId);
final String patchId; if (patchType == Patch.PatchType.CUMULATIVE) { patchId = modification.getCumulativePatchID(); } else { patchId = original.getPatchId();
if (patchType == Patch.PatchType.CUMULATIVE) { final List<String> invalidation = new ArrayList<String>(modification.getPatchIDs()); if (!invalidation.isEmpty()) { try { modification.getUnmodifiedInstallationState()); } catch (PatchingException e) { throw e; modification.addInstalledPatch(patchId);
validateRollbackState(patchId, modification.getUnmodifiedInstallationState()); } catch (PatchingException e) { throw e; final List<String> oneOffs = modification.getPatchIDs(); final int index = oneOffs.indexOf(patchId); if (patchId.equals(modification.getCumulativePatchID())) { patches.add(modification.getCumulativePatchID()); } else { throw PatchLogger.ROOT_LOGGER.cannotRollbackPatch(patchId); if (!Constants.BASE.equals(rollback)) { rollback(rollback, context); modification.removeInstalledPatch(rollback);
try { final Patch patch = patchResolver.resolvePatch(modification.getName(), modification.getVersion()); if (patch == null) { throw PatchLogger.ROOT_LOGGER.failedToResolvePatch(modification.getName(), modification.getVersion()); if (!appliesTo.equals(modification.getVersion())) { throw PatchLogger.ROOT_LOGGER.doesNotApply(appliesTo, modification.getVersion()); if (modification.isApplied(patchId)) { throw PatchLogger.ROOT_LOGGER.alreadyApplied(patchId);
try { final Patch patch = patchResolver.resolvePatch(modification.getName(), modification.getVersion()); if (patch == null) { throw PatchLogger.ROOT_LOGGER.failedToResolvePatch(modification.getName(), modification.getVersion()); if (!appliesTo.equals(modification.getVersion())) { throw PatchLogger.ROOT_LOGGER.doesNotApply(appliesTo, modification.getVersion()); if (modification.isApplied(patchId)) { throw PatchLogger.ROOT_LOGGER.alreadyApplied(patchId);
final InstalledIdentity installedIdentity = modification.getUnmodifiedInstallationState(); final String name = installedIdentity.getIdentity().getName(); final IdentityImpl identity = new IdentityImpl(name, modification.getVersion()); if (patchType == Patch.PatchType.CUMULATIVE) { identity.setPatchType(Patch.PatchType.CUMULATIVE);
@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); } }
/** * Rollback the last applied patch. * * @param contentPolicy the content policy * @param resetConfiguration whether to reset the configuration * @param modification the installation modification * @return the patching result * @throws PatchingException */ public PatchingResult rollbackLast(final ContentVerificationPolicy contentPolicy, final boolean resetConfiguration, InstallationManager.InstallationModification modification) throws PatchingException { // Determine the patch id to rollback String patchId; final List<String> oneOffs = modification.getPatchIDs(); if (oneOffs.isEmpty()) { patchId = modification.getCumulativePatchID(); if (patchId == null || Constants.NOT_PATCHED.equals(patchId)) { throw PatchLogger.ROOT_LOGGER.noPatchesApplied(); } } else { patchId = oneOffs.get(0);//oneOffs.get(oneOffs.size() - 1); } return rollbackPatch(patchId, contentPolicy, false, resetConfiguration, modification); }
IdentityPatchContext(final File backup, final PatchContentProvider contentProvider, final ContentVerificationPolicy contentPolicy, final InstallationManager.InstallationModification modification, final PatchingTaskContext.Mode mode, final InstalledImage installedImage) { this.miscTargetRoot = installedImage.getJbossHome(); this.mode = mode; this.contentProvider = contentProvider; this.contentPolicy = contentPolicy; this.modification = modification; this.installedImage = installedImage; this.history = PatchingHistory.Factory.getHistory(modification.getUnmodifiedInstallationState()); if (backup != null) { this.miscBackup = new File(backup, PatchContentLoader.MISC); this.configBackup = new File(backup, Constants.CONFIGURATION); } else { this.miscBackup = null; // This will trigger a failure when the root is actually needed this.configBackup = null; } this.identityEntry = new IdentityEntry(modification, null); }
/** * Rollback the last applied patch. * * @param contentPolicy the content policy * @param resetConfiguration whether to reset the configuration * @param modification the installation modification * @return the patching result * @throws PatchingException */ public PatchingResult rollbackLast(final ContentVerificationPolicy contentPolicy, final boolean resetConfiguration, InstallationManager.InstallationModification modification) throws PatchingException { // Determine the patch id to rollback String patchId; final List<String> oneOffs = modification.getPatchIDs(); if (oneOffs.isEmpty()) { patchId = modification.getCumulativePatchID(); if (patchId == null || Constants.NOT_PATCHED.equals(patchId)) { throw PatchLogger.ROOT_LOGGER.noPatchesApplied(); } } else { patchId = oneOffs.get(0);//oneOffs.get(oneOffs.size() - 1); } return rollbackPatch(patchId, contentPolicy, false, resetConfiguration, modification); }
IdentityPatchContext(final File backup, final PatchContentProvider contentProvider, final ContentVerificationPolicy contentPolicy, final InstallationManager.InstallationModification modification, final PatchingTaskContext.Mode mode, final InstalledImage installedImage) { this.miscTargetRoot = installedImage.getJbossHome(); this.mode = mode; this.contentProvider = contentProvider; this.contentPolicy = contentPolicy; this.modification = modification; this.installedImage = installedImage; this.history = PatchingHistory.Factory.getHistory(modification.getUnmodifiedInstallationState()); if (backup != null) { this.miscBackup = new File(backup, PatchContentLoader.MISC); this.configBackup = new File(backup, Constants.CONFIGURATION); } else { this.miscBackup = null; // This will trigger a failure when the root is actually needed this.configBackup = null; } this.identityEntry = new IdentityEntry(modification, null); }
@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(); } } } };