@Override public List<String> getPatchStreams() throws PatchingException { final List<InstalledIdentity> installedIdentities = manager.getInstalledIdentities(); if(installedIdentities.size() == 1) { return Collections.singletonList(installedIdentities.get(0).getIdentity().getName()); } final List<String> result = new ArrayList<String>(installedIdentities.size()); for(InstalledIdentity ii : installedIdentities) { result.add(ii.getIdentity().getName()); } return result; }
@Override public List<String> getPatchStreams() throws PatchingException { final List<InstalledIdentity> installedIdentities = manager.getInstalledIdentities(); if(installedIdentities.size() == 1) { return Collections.singletonList(installedIdentities.get(0).getIdentity().getName()); } final List<String> result = new ArrayList<String>(installedIdentities.size()); for(InstalledIdentity ii : installedIdentities) { result.add(ii.getIdentity().getName()); } return result; }
@Override public Set<String> children() { final InstallationManager manager = getInstallationManager(); if (manager == null) { return Collections.emptySet(); } List<InstalledIdentity> installedIdentities; try { installedIdentities = manager.getInstalledIdentities(); } catch (PatchingException e) { throw new IllegalStateException(e); } if(installedIdentities.size() == 1) { return Collections.singleton(installedIdentities.get(0).getIdentity().getName()); } final Set<String> set = new HashSet<String>(installedIdentities.size()); for(InstalledIdentity identity : installedIdentities) { set.add(identity.getIdentity().getName()); } return set; } }
@Override public Set<String> children() { final InstallationManager manager = getInstallationManager(); if (manager == null) { return Collections.emptySet(); } List<InstalledIdentity> installedIdentities; try { installedIdentities = manager.getInstalledIdentities(); } catch (PatchingException e) { throw new IllegalStateException(e); } if(installedIdentities.size() == 1) { return Collections.singleton(installedIdentities.get(0).getIdentity().getName()); } final Set<String> set = new HashSet<String>(installedIdentities.size()); for(InstalledIdentity identity : installedIdentities) { set.add(identity.getIdentity().getName()); } return set; } }
@Override protected void execute(OperationContext context, ModelNode operation, InstallationManager instMgr, String patchStream) throws OperationFailedException { try { if (patchStream != null) { final InstalledIdentity installedIdentity = instMgr.getInstalledIdentity(patchStream, null); ageOutHistory(installedIdentity); } else { for (InstalledIdentity installedIdentity : instMgr.getInstalledIdentities()) { ageOutHistory(installedIdentity); } } } catch (PatchingException e) { throw new IllegalStateException(PatchLogger.ROOT_LOGGER.failedToLoadIdentity(), e); } context.completeStep(OperationContext.RollbackHandler.NOOP_ROLLBACK_HANDLER); }
@Override protected void execute(OperationContext context, ModelNode operation, InstallationManager instMgr, String patchStream) throws OperationFailedException { try { if (patchStream != null) { final InstalledIdentity installedIdentity = instMgr.getInstalledIdentity(patchStream, null); ageOutHistory(installedIdentity); } else { for (InstalledIdentity installedIdentity : instMgr.getInstalledIdentities()) { ageOutHistory(installedIdentity); } } } catch (PatchingException e) { throw new IllegalStateException(PatchLogger.ROOT_LOGGER.failedToLoadIdentity(), e); } context.completeStep(OperationContext.RollbackHandler.NOOP_ROLLBACK_HANDLER); }
for(InstalledIdentity installedIdentity : manager.getInstalledIdentities()) { final Identity identity = installedIdentity.getIdentity(); final TargetInfo patchingInfo = identity.loadTargetInfo();
for(InstalledIdentity installedIdentity : manager.getInstalledIdentities()) { final Identity identity = installedIdentity.getIdentity(); final TargetInfo patchingInfo = identity.loadTargetInfo();
final List<BundledPatch.BundledPatchEntry> results = new ArrayList<BundledPatch.BundledPatchEntry>(patches.size()); final List<InstalledIdentity> installedIdentities = manager.getInstalledIdentities(); for(BundledPatchEntry entry : patches) {
final List<BundledPatch.BundledPatchEntry> results = new ArrayList<BundledPatch.BundledPatchEntry>(patches.size()); final List<InstalledIdentity> installedIdentities = manager.getInstalledIdentities(); for(BundledPatchEntry entry : patches) {
@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); } }