public static void marshal(final OutputStream os, final Patch patch) throws XMLStreamException { marshal(os, patch, patch instanceof RollbackPatch ? ROLLBACK_1_0 : XML1_0); }
public static PatchMetadataResolver parse(final InputStream stream) throws XMLStreamException { return parse(stream, null); }
public static PatchMetadataResolver parse(final InputStream stream, InstalledIdentity originalIdentity) throws XMLStreamException { return parse(getXMLInputFactory().createXMLStreamReader(stream), originalIdentity); }
private void doMarshall(String fileName) throws Exception { final String original = toString(fileName); try (final InputStream is = getResource(fileName)) { final Patch patch = PatchXml.parse(is).resolvePatch(null, null); final StringWriter writer = new StringWriter(); PatchXml.marshal(writer, patch); final String marshalled = writer.toString(); XMLUtils.compareXml(original, marshalled, false); } }
private static XMLInputFactory getXMLInputFactory() throws XMLStreamException { final XMLInputFactory inputFactory = INPUT_FACTORY; setIfSupported(inputFactory, XMLInputFactory.IS_VALIDATING, Boolean.FALSE); setIfSupported(inputFactory, XMLInputFactory.SUPPORT_DTD, Boolean.FALSE); return inputFactory; }
Patch patch; try { patch = PatchXml.parse(f).resolvePatch(null, null); } catch (Exception e) { throw new PatchingException("Failed to parse " + f.getAbsolutePath(), e); PatchXml.marshal(writer, patch); } catch (Exception e) { throw new PatchingException("Failed to marshal merged metadata into " + f.getName(), e); PatchXml.marshal(writer, mergedMetadata); } catch (Exception e) { throw new PatchingException("Failed to marshal merged metadata into " + PatchXml.PATCH_XML, e);
private static XMLInputFactory getXMLInputFactory() throws XMLStreamException { final XMLInputFactory inputFactory = INPUT_FACTORY; setIfSupported(inputFactory, XMLInputFactory.IS_VALIDATING, Boolean.FALSE); setIfSupported(inputFactory, XMLInputFactory.SUPPORT_DTD, Boolean.FALSE); return inputFactory; }
public static PatchMetadataResolver parse(final File patchXml) throws IOException, XMLStreamException { return parse(patchXml, null); }
Patch patch; try { patch = PatchXml.parse(f).resolvePatch(null, null); } catch (Exception e) { throw new PatchingException("Failed to parse " + f.getAbsolutePath(), e); PatchXml.marshal(writer, patch); } catch (Exception e) { throw new PatchingException("Failed to marshal merged metadata into " + f.getName(), e); PatchXml.marshal(writer, mergedMetadata); } catch (Exception e) { throw new PatchingException("Failed to marshal merged metadata into " + PatchXml.PATCH_XML, e);
public static void marshal(final OutputStream os, final Patch patch) throws XMLStreamException { marshal(os, patch, patch instanceof RollbackPatch ? ROLLBACK_1_0 : XML1_0); }
public static PatchMetadataResolver parse(final Reader reader, InstalledIdentity originalIdentity) throws XMLStreamException { return parse(getXMLInputFactory().createXMLStreamReader(reader), originalIdentity); }
public static PatchMetadataResolver parse(final InputStream stream) throws XMLStreamException { return parse(stream, null); }
public static void marshal(final OutputStream os, final RollbackPatch patch) throws XMLStreamException { marshal(os, patch, ROLLBACK_1_0); }
public static PatchMetadataResolver parse(final Reader reader, InstalledIdentity originalIdentity) throws XMLStreamException { return parse(getXMLInputFactory().createXMLStreamReader(reader), originalIdentity); }
public static PatchMetadataResolver parse(final File patchXml) throws IOException, XMLStreamException { return parse(patchXml, null); }
public static void marshal(final OutputStream os, final RollbackPatch patch) throws XMLStreamException { marshal(os, patch, ROLLBACK_1_0); }
public static PatchMetadataResolver parse(final InputStream stream, InstalledIdentity originalIdentity) throws XMLStreamException { return parse(getXMLInputFactory().createXMLStreamReader(stream), originalIdentity); }
public static PatchMetadataResolver parse(final Reader stream) throws XMLStreamException { return parse(stream, null); }
/** * Write the patch.xml * * @param rollbackPatch the patch * @param file the target file * @throws IOException */ static void writePatch(final Patch rollbackPatch, final File file) throws IOException { final File parent = file.getParentFile(); if (!parent.isDirectory()) { if (!parent.mkdirs() && !parent.exists()) { throw PatchLogger.ROOT_LOGGER.cannotCreateDirectory(file.getAbsolutePath()); } } try { try (final OutputStream os = new FileOutputStream(file)){ PatchXml.marshal(os, rollbackPatch); } } catch (XMLStreamException e) { throw new IOException(e); } }
public static PatchMetadataResolver parse(final Reader stream) throws XMLStreamException { return parse(stream, null); }