@Override protected RollbackPatch resolveMetaData(PatchMetadataResolver resolver) throws PatchingException { return (RollbackPatch) resolver.resolvePatch(null, null); } };
@Override protected Patch resolveMetaData(PatchMetadataResolver resolver) throws PatchingException { return resolver.resolvePatch(null, null); } };
@Override protected RollbackPatch resolveMetaData(PatchMetadataResolver resolver) throws PatchingException { return (RollbackPatch) resolver.resolvePatch(null, null); } };
@Override protected Patch resolveMetaData(PatchMetadataResolver resolver) throws PatchingException { return resolver.resolvePatch(null, null); } };
static RollbackPatch loadRollbackInformation(final String patchId, final InstalledImage installedImage) throws PatchingException, IOException, XMLStreamException { final File historyDir = installedImage.getPatchHistoryDir(patchId); final File patchXml = new File(historyDir, Constants.ROLLBACK_XML); return (RollbackPatch) PatchXml.parse(patchXml).resolvePatch(null, null); }
static RollbackPatch loadRollbackInformation(final String patchId, final InstalledImage installedImage) throws PatchingException, IOException, XMLStreamException { final File historyDir = installedImage.getPatchHistoryDir(patchId); final File patchXml = new File(historyDir, Constants.ROLLBACK_XML); return (RollbackPatch) PatchXml.parse(patchXml).resolvePatch(null, null); }
private static Patch parsePatchXml(final File patch1Dir, File patch1) throws PatchingException { final File patch1Xml = new File(patch1Dir, PatchXml.PATCH_XML); if (!patch1Xml.exists()) { throw new PatchingException("Failed to locate " + PatchXml.PATCH_XML + " in " + patch1.getAbsolutePath()); } try { return PatchXml.parse(patch1Xml).resolvePatch(null, null); } catch (Exception e) { throw new PatchingException("Failed to parse " + PatchXml.PATCH_XML + " from " + patch1.getAbsolutePath(), e); } }
static Patch loadPatchInformation(final String patchId, final InstalledImage installedImage) throws PatchingException, IOException, XMLStreamException { final File patchDir = installedImage.getPatchHistoryDir(patchId); final File patchXml = new File(patchDir, PatchXml.PATCH_XML); return PatchXml.parse(patchXml).resolvePatch(null, null); }
static Patch loadPatchInformation(final String patchId, final InstalledImage installedImage) throws PatchingException, IOException, XMLStreamException { final File patchDir = installedImage.getPatchHistoryDir(patchId); final File patchXml = new File(patchDir, PatchXml.PATCH_XML); return PatchXml.parse(patchXml).resolvePatch(null, null); }
private static Patch parsePatchXml(final File patch1Dir, File patch1) throws PatchingException { final File patch1Xml = new File(patch1Dir, PatchXml.PATCH_XML); if (!patch1Xml.exists()) { throw new PatchingException("Failed to locate " + PatchXml.PATCH_XML + " in " + patch1.getAbsolutePath()); } try { return PatchXml.parse(patch1Xml).resolvePatch(null, null); } catch (Exception e) { throw new PatchingException("Failed to parse " + PatchXml.PATCH_XML + " from " + patch1.getAbsolutePath(), e); } }
private static void assertExistsOnDisk(IteratorImpl i, String id) throws NoSuchElementException { final File historyDir = i.mgr.getInstalledImage().getPatchHistoryDir(id); if(!historyDir.exists()) { throw new NoSuchElementException(PatchLogger.ROOT_LOGGER.noPatchHistory(historyDir.getAbsolutePath())); } // TODO parsed xml can be cached final File rollbackXml = new File(historyDir, "rollback.xml"); if(!rollbackXml.exists()) { throw new NoSuchElementException(PatchLogger.ROOT_LOGGER.patchIsMissingFile(rollbackXml.getAbsolutePath())); } try { PatchXml.parse(rollbackXml); } catch (Exception e) { throw new NoSuchElementException(PatchLogger.ROOT_LOGGER.fileIsNotReadable(rollbackXml.getAbsolutePath() + ": " + e.getLocalizedMessage())); } final File patchXml = new File(historyDir, "patch.xml"); if(!patchXml.exists()) { throw new NoSuchElementException(PatchLogger.ROOT_LOGGER.patchIsMissingFile(patchXml.getAbsolutePath())); } final Patch patchMetaData; try { patchMetaData = PatchXml.parse(patchXml).resolvePatch(i.mgr.getIdentity().getName(), i.mgr.getIdentity().getVersion()); } catch (Exception e) { throw new NoSuchElementException(PatchLogger.ROOT_LOGGER.fileIsNotReadable(patchXml.getAbsolutePath() + ": " + e.getLocalizedMessage())); } if(i.excludeAgedOut && isAgedOut(i.mgr, patchMetaData)) { throw new NoSuchElementException("Patch " + patchMetaData.getPatchId() + " was aged out"); } }
private static void assertExistsOnDisk(IteratorImpl i, String id) throws NoSuchElementException { final File historyDir = i.mgr.getInstalledImage().getPatchHistoryDir(id); if(!historyDir.exists()) { throw new NoSuchElementException(PatchLogger.ROOT_LOGGER.noPatchHistory(historyDir.getAbsolutePath())); } // TODO parsed xml can be cached final File rollbackXml = new File(historyDir, "rollback.xml"); if(!rollbackXml.exists()) { throw new NoSuchElementException(PatchLogger.ROOT_LOGGER.patchIsMissingFile(rollbackXml.getAbsolutePath())); } try { PatchXml.parse(rollbackXml); } catch (Exception e) { throw new NoSuchElementException(PatchLogger.ROOT_LOGGER.fileIsNotReadable(rollbackXml.getAbsolutePath() + ": " + e.getLocalizedMessage())); } final File patchXml = new File(historyDir, "patch.xml"); if(!patchXml.exists()) { throw new NoSuchElementException(PatchLogger.ROOT_LOGGER.patchIsMissingFile(patchXml.getAbsolutePath())); } final Patch patchMetaData; try { patchMetaData = PatchXml.parse(patchXml).resolvePatch(i.mgr.getIdentity().getName(), i.mgr.getIdentity().getVersion()); } catch (Exception e) { throw new NoSuchElementException(PatchLogger.ROOT_LOGGER.fileIsNotReadable(patchXml.getAbsolutePath() + ": " + e.getLocalizedMessage())); } if(i.excludeAgedOut && isAgedOut(i.mgr, patchMetaData)) { throw new NoSuchElementException("Patch " + patchMetaData.getPatchId() + " was aged out"); } }
final Patch patch = PatchXml.parse(is).resolvePatch(null, null); displayPatchXml(ctx, patch); } else {
final Patch patch = PatchXml.parse(is).resolvePatch(null, null); displayPatchXml(ctx, patch); } else {
final Patch patch = PatchXml.parse(is).resolvePatch(null, null); displayPatchXml(ctx, patch); } else {
final Patch patch = PatchXml.parse(is).resolvePatch(null, null); displayPatchXml(ctx, patch); } else {
final Patch patchMetadata = PatchXml.parse(patchXml).resolvePatch(null, null); final String patchID = patchMetadata.getPatchId(); final String patchPath = patchID + ".zip";
protected PatchingResult execute(final File workDir, final ContentVerificationPolicy contentPolicy) throws PatchingException, IOException, XMLStreamException { final File patchBundleXml = new File(workDir, PatchBundleXml.MULTI_PATCH_XML); if (patchBundleXml.exists()) { final InputStream patchIs = new FileInputStream(patchBundleXml); try { // Handle multi patch installs final BundledPatch bundledPatch = PatchBundleXml.parse(patchIs); return applyPatchBundle(workDir, bundledPatch, contentPolicy); } finally { safeClose(patchIs); } } else { // Parse the xml File patchXml = new File(workDir, PatchXml.PATCH_XML); PatchMetadataResolver patchResolver = parsePatchXml(patchXml); Patch patch = patchResolver.resolvePatch(null, null); final InstalledIdentity installedIdentity = manager.getInstalledIdentity(patch.getIdentity().getName(), null); final String currentVersion = installedIdentity.getIdentity().getVersion(); if(!Constants.UNKNOWN.equals(currentVersion) && !patch.getIdentity().getVersion().equals(currentVersion)) { patchXml = new File(workDir, currentVersion + PatchMerger.PATCH_XML_SUFFIX); if(!patchXml.exists()) { throw new PatchingException("The patch does not contain metadata for currently installed " + patch.getIdentity().getName() + " version " + currentVersion); } patchResolver = parsePatchXml(patchXml); patch = patchResolver.resolvePatch(null, null); } return apply(patchResolver, PatchContentProvider.DefaultContentProvider.create(workDir), contentPolicy); } }
protected PatchingResult execute(final File workDir, final ContentVerificationPolicy contentPolicy) throws PatchingException, IOException, XMLStreamException { final File patchBundleXml = new File(workDir, PatchBundleXml.MULTI_PATCH_XML); if (patchBundleXml.exists()) { final InputStream patchIs = new FileInputStream(patchBundleXml); try { // Handle multi patch installs final BundledPatch bundledPatch = PatchBundleXml.parse(patchIs); return applyPatchBundle(workDir, bundledPatch, contentPolicy); } finally { safeClose(patchIs); } } else { // Parse the xml File patchXml = new File(workDir, PatchXml.PATCH_XML); PatchMetadataResolver patchResolver = parsePatchXml(patchXml); Patch patch = patchResolver.resolvePatch(null, null); final InstalledIdentity installedIdentity = manager.getInstalledIdentity(patch.getIdentity().getName(), null); final String currentVersion = installedIdentity.getIdentity().getVersion(); if(!Constants.UNKNOWN.equals(currentVersion) && !patch.getIdentity().getVersion().equals(currentVersion)) { patchXml = new File(workDir, currentVersion + PatchMerger.PATCH_XML_SUFFIX); if(!patchXml.exists()) { throw new PatchingException("The patch does not contain metadata for currently installed " + patch.getIdentity().getName() + " version " + currentVersion); } patchResolver = parsePatchXml(patchXml); patch = patchResolver.resolvePatch(null, null); } return apply(patchResolver, PatchContentProvider.DefaultContentProvider.create(workDir), contentPolicy); } }
throw new CommandLineException("Failed to locate " + PatchXml.PATCH_XML + " in bundled patch " + bundledPatch.getPatchPath()); final Patch patch = PatchXml.parse(bundledPatchIs).resolvePatch(null, null);