private void split(Jar original, Jar main, Jar src) { for (Map.Entry<String, Resource> e : original.getResources() .entrySet()) { String path = e.getKey(); if (path.startsWith("OSGI-OPT/src/")) { src.putResource(path.substring("OSGI-OPT/src/".length()), e.getValue()); } else { main.putResource(path, e.getValue()); } } }
private void split(Jar original, Jar main, Jar src) { for (Map.Entry<String, Resource> e : original.getResources() .entrySet()) { String path = e.getKey(); if (path.startsWith("OSGI-OPT/src/")) { src.putResource(path.substring("OSGI-OPT/src/".length()), e.getValue()); } else { main.putResource(path, e.getValue()); } } }
private void split(Jar original, Jar main, Jar src) { for (Map.Entry<String,Resource> e : original.getResources().entrySet()) { String path = e.getKey(); if (path.startsWith("OSGI-OPT/src/")) { src.putResource(path.substring("OSGI-OPT/src/".length()), e.getValue()); } else { main.putResource(path, e.getValue()); } } }
private void split(Jar original, Jar main, Jar src) { for (Map.Entry<String,Resource> e : original.getResources().entrySet()) { String path = e.getKey(); if (path.startsWith("OSGI-OPT/src/")) { src.putResource(path.substring("OSGI-OPT/src/".length()), e.getValue()); } else { main.putResource(path, e.getValue()); } } }
private void split(Jar original, Jar main, Jar src) { for (Map.Entry<String,Resource> e : original.getResources().entrySet()) { String path = e.getKey(); if (path.startsWith("OSGI-OPT/src/")) { src.putResource(path.substring("OSGI-OPT/src/".length()), e.getValue()); } else { main.putResource(path, e.getValue()); } } }
private void split(Jar original, Jar main, Jar src) { for (Map.Entry<String,Resource> e : original.getResources().entrySet()) { String path = e.getKey(); if (path.startsWith("OSGI-OPT/src/")) { src.putResource(path.substring("OSGI-OPT/src/".length()), e.getValue()); } else { main.putResource(path, e.getValue()); } } }
private void split(Jar original, Jar main, Jar src) { for (Map.Entry<String,Resource> e : original.getResources().entrySet()) { String path = e.getKey(); if (path.startsWith("OSGI-OPT/src/")) { src.putResource(path.substring("OSGI-OPT/src/".length()), e.getValue()); } else { main.putResource(path, e.getValue()); } } }
public boolean addDirectory(Map<String, Resource> directory, boolean overwrite) { check(); boolean duplicates = false; if (directory == null) return false; for (Map.Entry<String, Resource> entry : directory.entrySet()) { duplicates |= putResource(entry.getKey(), entry.getValue(), overwrite); } return duplicates; }
public boolean putResource(String path, Resource resource) { check(); return putResource(path, resource, true); }
public boolean addDirectory(Map<String, Resource> directory, boolean overwrite) { check(); boolean duplicates = false; if (directory == null) return false; for (Map.Entry<String, Resource> entry : directory.entrySet()) { duplicates |= putResource(entry.getKey(), entry.getValue(), overwrite); } return duplicates; }
public static void build(Jar jar, InputStream in, long lastModified) throws IOException { ZipInputStream jin = new ZipInputStream(in); ZipEntry entry = jin.getNextEntry(); while (entry != null) { if (!entry.isDirectory()) { byte data[] = collect(jin); jar.putResource(entry.getName(), new EmbeddedResource(data, lastModified), true); } entry = jin.getNextEntry(); } IO.drain(in); jin.close(); }
@Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { String relativePath = IO.normalizePath(baseDir.relativize(file)); putResource(relativePath, new FileResource(file, attrs), true); return FileVisitResult.CONTINUE; } });
@Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { String relativePath = IO.normalizePath(baseDir.relativize(file)); putResource(relativePath, new FileResource(file, attrs), true); return FileVisitResult.CONTINUE; } });
public boolean rename(String oldPath, String newPath) { check(); Resource resource = remove(oldPath); if (resource == null) return false; return putResource(newPath, resource); }
private void copyInfoResource(Jar source, Jar dest, String type) { if (source.getResources() .containsKey(type) && !dest.getResources() .containsKey(type)) dest.putResource(type, source.getResource(type)); }
public boolean rename(String oldPath, String newPath) { check(); Resource resource = remove(oldPath); if (resource == null) return false; return putResource(newPath, resource); }
public boolean rename(String oldPath, String newPath) { check(); Resource resource = remove(oldPath); if (resource == null) return false; return putResource(newPath, resource); }
public boolean rename(String oldPath, String newPath) { check(); Resource resource = remove(oldPath); if (resource == null) return false; return putResource(newPath, resource); }
private void copy(Jar jar, String path, Resource resource, Map<String, String> extra) { jar.putResource(path, resource); if (isTrue(extra.get(LIB_DIRECTIVE))) { setProperty(BUNDLE_CLASSPATH, append(getProperty(BUNDLE_CLASSPATH, "."), path)); } }
@Override public Entry<String, Resource> export(String type, Project project, Map<String, String> options) throws Exception { project.prepare(); Collection<Container> runbundles = project.getRunbundles(); Jar jar = new Jar(project.getName()); jar.setDoNotTouchManifest(); for (Container container : runbundles) { File source = container.getFile(); String path = nonCollidingPath(jar, source.getName()); jar.putResource(path, new FileResource(source)); } return new SimpleEntry<>(jar.getName(), new JarResource(jar, true)); }