public Archive merge(Archive archive) { Map<String, File> entriesToMerge = archive.getEntries(); for (Entry<String, File> entry : entriesToMerge.entrySet()) { File file = entry.getValue(); if (file != null && !file.isDirectory()) { try { addEntry(entry.getKey(), FileUtils.readFile(file)); } catch (IOException e) { throw new IllegalStateException("Unexpected error reading Archive file '" + file.getAbsolutePath() + "'.", e); } } else { addEntry(entry.getKey(), (byte[]) null); } } return this; }
public Archive merge(Archive archive) { Map<String, File> entriesToMerge = archive.getEntries(); for (Entry<String, File> entry : entriesToMerge.entrySet()) { File file = entry.getValue(); if (file != null && !file.isDirectory()) { try { addEntry(entry.getKey(), FileUtils.readFile(file)); } catch (IOException e) { throw new IllegalStateException("Unexpected error reading Archive file '" + file.getAbsolutePath() + "'.", e); } } else { addEntry(entry.getKey(), (byte[]) null); } } return this; }
private String saveSchema(Archive archive, String entryPath, Resource resource, String ns, String pluginID) { StringBuilder result = new StringBuilder(); ByteArrayOutputStream out = new ByteArrayOutputStream(); log.info("Saving XML Schema " + ns); try { resource.save(out, null); if (archive.getEntries().containsKey(entryPath)) { throw new RuntimeException("Duplicate entry " + entryPath); } archive.addEntry(entryPath, out.toByteArray()); result.append("\t<uri name=\""); result.append(ns); result.append("\" uri=\"platform:/fragment/" + pluginID + "/"); result.append(entryPath); result.append("\"/>\n"); } catch (Exception e) { log.error("Failed to save XML Schema " + ns, e); } return result.toString(); }
public Archive merge(Archive archive) { Map<String, File> entriesToMerge = archive.getEntries(); for (Entry<String, File> entry : entriesToMerge.entrySet()) { File file = entry.getValue(); if (file != null && !file.isDirectory()) { try { addEntry(entry.getKey(), FileUtils.readFile(file)); } catch (IOException e) { throw new IllegalStateException("Unexpected error reading Archive file '" + file.getAbsolutePath() + "'.", e); } } else { addEntry(entry.getKey(), (byte[]) null); } } return this; }