aQute.lib.osgi.Jar.addAll()方法的使用及代码示例

x33g5p2x  于2022-01-22 转载在 其他  
字(4.0k)|赞(0)|评价(0)|浏览(193)

本文整理了Java中aQute.lib.osgi.Jar.addAll()方法的一些代码示例,展示了Jar.addAll()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Jar.addAll()方法的具体详情如下:
包路径:aQute.lib.osgi.Jar
类名称:Jar
方法名:addAll

Jar.addAll介绍

[英]Add all the resources in the given jar that match the given filter.
[中]在给定jar中添加与给定过滤器匹配的所有资源。

代码示例

代码示例来源:origin: biz.aQute/bnd

/**
 * Add all the resources in the given jar that match the given filter.
 * 
 * @param sub
 *            the jar
 * @param filter
 *            a pattern that should match the resoures in sub to be added
 */
public boolean addAll(Jar sub, Instruction filter) {
  return addAll(sub, filter, "");
}

代码示例来源:origin: biz.aQute/bnd

public boolean addAll(Jar src) {
  return addAll(src, null);
}

代码示例来源:origin: biz.aQute/aQute.bnd

public boolean addAll(Jar src) {
  return addAll(src, null);
}

代码示例来源:origin: biz.aQute/aQute.bnd

/**
 * Extra resources from a Jar and add them to the given jar. The clause is
 * the
 * 
 * @param jar
 * @param clauses
 * @param i
 * @throws ZipException
 * @throws IOException
 */
private void extractFromJar(Jar jar, String name) throws ZipException,
    IOException {
  // Inline all resources and classes from another jar
  // optionally appended with a modified regular expression
  // like @zip.jar!/META-INF/MANIFEST.MF
  int n = name.lastIndexOf("!/");
  Pattern filter = null;
  if (n > 0) {
    String fstring = name.substring(n + 2);
    name = name.substring(0, n);
    filter = wildcard(fstring);
  }
  Jar sub = getJarFromName(name, "extract from jar");
  if (sub == null)
    error("Can not find JAR file " + name);
  else
    jar.addAll(sub, filter);
}

代码示例来源:origin: biz.aQute/bnd

error("Can not find JAR file " + source);
else {
  jar.addAll(sub, instr, destination);

代码示例来源:origin: biz.aQute/aQute.bnd

private void doExpand(Jar jar) throws IOException {
  if (getClasspath().size() == 0
      && (getProperty(EXPORT_PACKAGE) != null || getProperty(PRIVATE_PACKAGE) != null))
    warning("Classpath is empty. Private-Package and Export-Package can only expand from the classpath when there is one");
  Map<Instruction, Map<String, String>> privateMap = replaceWitInstruction(
      getHeader(PRIVATE_PACKAGE), PRIVATE_PACKAGE);
  Map<Instruction, Map<String, String>> exportMap = replaceWitInstruction(
      getHeader(EXPORT_PACKAGE), EXPORT_PACKAGE);
  if (isTrue(getProperty(Constants.UNDERTEST))) {
    privateMap.putAll(replaceWitInstruction(parseHeader(getProperty(
        Constants.TESTPACKAGES, "test;presence:=optional")),
        TESTPACKAGES));
  }
  if (!privateMap.isEmpty())
    doExpand(jar, "Private-Package, or -testpackages", privateMap, true);
  if (!exportMap.isEmpty()) {
    Jar exports = new Jar("exports");
    doExpand(exports, "Export-Package", exportMap, true);
    jar.addAll(exports);
    exports.close();
  }
  if (privateMap.isEmpty() && exportMap.isEmpty() && !isResourceOnly()) {
    warning("Neither Export-Package, Private-Package, -testpackages is set, therefore no packages will be included");
  }
}

代码示例来源:origin: biz.aQute/bnd

private void doExpand(Jar jar) throws IOException {
  if (getClasspath().size() == 0
      && (getProperty(EXPORT_PACKAGE) != null || getProperty(EXPORT_PACKAGE) != null || getProperty(PRIVATE_PACKAGE) != null))
    warning("Classpath is empty. Private-Package and Export-Package can only expand from the classpath when there is one");
  Map<Instruction, Map<String, String>> privateMap = Instruction
      .replaceWithInstruction(getHeader(PRIVATE_PACKAGE));
  Map<Instruction, Map<String, String>> exportMap = Instruction
      .replaceWithInstruction(getHeader(EXPORT_PACKAGE));
  if (isTrue(getProperty(Constants.UNDERTEST))) {
    privateMap.putAll(Instruction.replaceWithInstruction(parseHeader(getProperty(
        Constants.TESTPACKAGES, "test;presence:=optional"))));
  }
  if (!privateMap.isEmpty())
    doExpand(jar, "Private-Package, or -testpackages", privateMap, true);
  if (!exportMap.isEmpty()) {
    Jar exports = new Jar("exports");
    doExpand(exports, EXPORT_PACKAGE, exportMap, true);
    jar.addAll(exports);
    exports.close();
  }
  if (!isNoBundle()) {
    if (privateMap.isEmpty() && exportMap.isEmpty() && !isResourceOnly()
        && getProperty(EXPORT_CONTENTS) == null) {
      warning("None of Export-Package, Provide-Package, Private-Package, -testpackages, or -exportcontents is set, therefore no packages will be included");
    }
  }
}

相关文章