public static List<String> removeOverlapInServiceComponentHeader(Collection<String> names) { List<String> wildcards = new ArrayList<>(names); wildcards.removeIf(name -> !name.contains("*")); Instructions wildcardedPaths = new Instructions(wildcards); if (wildcardedPaths.isEmpty()) return new ArrayList<>(names); List<String> actual = new ArrayList<>(); for (String name : names) { if (!name.contains("*") && wildcardedPaths.matches(name)) continue; actual.add(name); } return actual; }
public static List<String> removeOverlapInServiceComponentHeader(Collection<String> names) { List<String> wildcards = new ArrayList<>(names); wildcards.removeIf(name -> !name.contains("*")); Instructions wildcardedPaths = new Instructions(wildcards); if (wildcardedPaths.isEmpty()) return new ArrayList<>(names); List<String> actual = new ArrayList<>(); for (String name : names) { if (!name.contains("*") && wildcardedPaths.matches(name)) continue; actual.add(name); } return actual; }
/** * @param p * @param pack */ private boolean isDynamicImport(PackageRef pack) { if (dynamicImports == null) dynamicImports = new Instructions(main.getDynamicImportPackage()); return dynamicImports.matches(pack.getFQN()); }
private Element resourcesElement(Jar jar) throws Exception { List<Element> resources = new ArrayList<Element>(); for (Map.Entry<String,Resource> entry : jar.getResources().entrySet()) { // // The manifest and other (signer) files are ignored // since they are extremely sensitive to time // if ( META_INF_P.matcher(entry.getKey()).matches()) continue; if ( localIgnore != null && localIgnore.matches(entry.getKey())) continue; InputStream in = entry.getValue().openInputStream(); try { Digester<SHA1> digester = SHA1.getDigester(); IO.copy(in, digester); String value = Hex.toHexString(digester.digest().digest()); resources.add(new Element(Type.RESOURCE, entry.getKey(), Arrays.asList(new Element(Type.SHA, value)), CHANGED, CHANGED, null)); } finally { in.close(); } } return new Element(Type.RESOURCES, "<resources>", resources, CHANGED, CHANGED, null); }
/** * @param p * @param pack */ private boolean isDynamicImport(PackageRef pack) { if (dynamicImports == null) dynamicImports = new Instructions(main.getDynamicImportPackage()); if (dynamicImports.isEmpty()) return false; return dynamicImports.matches(pack.getFQN()); }
/** * @param p * @param pack */ private boolean isDynamicImport(PackageRef pack) { if (dynamicImports == null) dynamicImports = new Instructions(main.getDynamicImportPackage()); if (dynamicImports.isEmpty()) return false; return dynamicImports.matches(pack.getFQN()); }
private Element resourcesElement(Jar jar) throws Exception { List<Element> resources = new ArrayList<Element>(); for (Map.Entry<String,Resource> entry : jar.getResources().entrySet()) { // // The manifest and other (signer) files are ignored // since they are extremely sensitive to time // if ( META_INF_P.matcher(entry.getKey()).matches()) continue; if ( localIgnore != null && localIgnore.matches(entry.getKey())) continue; InputStream in = entry.getValue().openInputStream(); try { Digester<SHA1> digester = SHA1.getDigester(); IO.copy(in, digester); String value = Hex.toHexString(digester.digest().digest()); resources.add(new Element(Type.RESOURCE, entry.getKey(), Arrays.asList(new Element(Type.SHA, value)), CHANGED, CHANGED, null)); } finally { in.close(); } } return new Element(Type.RESOURCES, "<resources>", resources, CHANGED, CHANGED, null); }
/** * @param p * @param pack */ private boolean isDynamicImport(PackageRef pack) { if (dynamicImports == null) dynamicImports = new Instructions(main.getDynamicImportPackage()); if (dynamicImports.isEmpty()) return false; return dynamicImports.matches(pack.getFQN()); }
continue; if (localIgnore != null && localIgnore.matches(header)) { continue;
private void copy(Jar jar, String path, File from, Instructions preprocess, Map<String, String> extra) throws Exception { if (doNotCopy(from)) return; logger.debug("copy d={} s={} path={}", jar, from, path); if (from.isDirectory()) { File files[] = from.listFiles(); for (int i = 0; i < files.length; i++) { copy(jar, appendPath(path, files[i].getName()), files[i], preprocess, extra); } } else { if (from.exists()) { Resource resource = new FileResource(from); if (preprocess != null && preprocess.matches(path)) { resource = new PreprocessResource(this, resource); } String x = extra.get("extra"); if (x != null) resource.setExtra(x); if (path.endsWith("/")) path = path + from.getName(); copy(jar, path, resource, extra); } else if (from.getName() .equals(Constants.EMPTY_HEADER)) { jar.putResource(path, new EmbeddedResource(new byte[0], 0L)); } else { error("Input file does not exist: %s", from).header(INCLUDERESOURCE + "|" + INCLUDE_RESOURCE); } } }
/** * @param p * @param pack */ private boolean isDynamicImport(PackageRef pack) { if (dynamicImports == null) dynamicImports = new Instructions(main.getDynamicImportPackage()); if (dynamicImports.isEmpty()) return false; return dynamicImports.matches(pack.getFQN()); }
continue; if (localIgnore != null && localIgnore.matches(header)) { continue;
public void copy(RepositoryPlugin source, Instructions filter, RepositoryPlugin destination) throws Exception { assert source != null; assert destination != null; logger.info("copy from repo {} to {} with filter {}", source, destination, filter); for (String bsn : source.list(null)) { for (Version version : source.versions(bsn)) { if (filter == null || filter.matches(bsn)) { logger.info("copy {}:{}", bsn, version); File file = source.get(bsn, version, null); if (file.getName() .endsWith(".jar")) { try (InputStream in = IO.stream(file)) { PutOptions po = new PutOptions(); po.bsn = bsn; po.context = null; po.type = "bundle"; po.version = version; PutResult put = destination.put(in, po); } catch (Exception e) { logger.error("Failed to copy {}-{}", e, bsn, version); error("Failed to copy %s:%s from %s to %s, error: %s", bsn, version, source, destination, e); } } } } } }
private void copy(Jar jar, String path, File from, Instructions preprocess, Map<String, String> extra) throws Exception { if (doNotCopy(from)) return; logger.debug("copy d={} s={} path={}", jar, from, path); if (from.isDirectory()) { File files[] = from.listFiles(); for (int i = 0; i < files.length; i++) { copy(jar, appendPath(path, files[i].getName()), files[i], preprocess, extra); } } else { if (from.exists()) { Resource resource = new FileResource(from); if (preprocess != null && preprocess.matches(path)) { resource = new PreprocessResource(this, resource); } String x = extra.get("extra"); if (x != null) resource.setExtra(x); if (path.endsWith("/")) path = path + from.getName(); copy(jar, path, resource, extra); } else if (from.getName() .equals(Constants.EMPTY_HEADER)) { jar.putResource(path, new EmbeddedResource(new byte[0], 0L)); } else { error("Input file does not exist: %s", from).header(INCLUDERESOURCE + "|" + INCLUDE_RESOURCE); } } }
public void copy(RepositoryPlugin source, Instructions filter, RepositoryPlugin destination) throws Exception { assert source != null; assert destination != null; logger.info("copy from repo {} to {} with filter {}", source, destination, filter); for (String bsn : source.list(null)) { for (Version version : source.versions(bsn)) { if (filter == null || filter.matches(bsn)) { logger.info("copy {}:{}", bsn, version); File file = source.get(bsn, version, null); if (file.getName() .endsWith(".jar")) { try (InputStream in = IO.stream(file)) { PutOptions po = new PutOptions(); po.bsn = bsn; po.context = null; po.type = "bundle"; po.version = version; PutResult put = destination.put(in, po); } catch (Exception e) { logger.error("Failed to copy {}-{}", e, bsn, version); error("Failed to copy %s:%s from %s to %s, error: %s", bsn, version, source, destination, e); } } } } } }
if (from.exists()) { Resource resource = new FileResource(from); if (preprocess != null && preprocess.matches(path)) { resource = new PreprocessResource(this, resource);
if (from.exists()) { Resource resource = new FileResource(from); if (preprocess != null && preprocess.matches(path)) { resource = new PreprocessResource(this, resource);
continue; if (localIgnore != null && localIgnore.matches(entry.getKey())) continue;
continue; if (localIgnore != null && localIgnore.matches(entry.getKey())) continue;
if (packageFilters.matches(packageDiff.getName())) show(pw, packageDiff, 0);