aQute.bnd.osgi.Analyzer.getJar()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(7.9k)|赞(0)|评价(0)|浏览(174)

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

Analyzer.getJar介绍

[英]Try to get a Jar from a file name/path or a url, or in last resort from the classpath name part of their files.
[中]尝试从文件名/路径或url获取Jar,或者最后从文件的类路径名部分获取Jar。

代码示例

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

public Jar getTarget() {
  return getJar();
}

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

public Jar getTarget() {
  return getJar();
}

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

public Verifier(Analyzer analyzer) throws Exception {
  super(analyzer);
  this.analyzer = analyzer;
  this.dot = analyzer.getJar();
  this.manifest = dot.getManifest();
  this.main = Domain.domain(manifest);
}

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

public Verifier(Analyzer analyzer) throws Exception {
  this.analyzer = analyzer;
  this.dot = analyzer.getJar();
  this.manifest = dot.getManifest();
  this.main = Domain.domain(manifest);
}

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

public Verifier(Analyzer analyzer) throws Exception {
  super(analyzer);
  this.analyzer = analyzer;
  this.dot = analyzer.getJar();
  this.manifest = dot.getManifest();
  this.main = Domain.domain(manifest);
}

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

public Verifier(Analyzer analyzer) throws Exception {
  super(analyzer);
  this.analyzer = analyzer;
  this.dot = analyzer.getJar();
  this.manifest = dot.getManifest();
  this.main = Domain.domain(manifest);
}

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

public boolean analyzeJar(Analyzer analyzer) throws Exception {
  Jar jar = analyzer.getJar();
  Map<String,Resource> dir = jar.getDirectories().get(root);
  if (dir == null || dir.isEmpty()) {
    Resource resource = jar.getResource(root);
    if (resource != null)
      process(analyzer, root, resource);
    return false;
  }
  for (Iterator<Map.Entry<String,Resource>> i = dir.entrySet().iterator(); i.hasNext();) {
    Map.Entry<String,Resource> entry = i.next();
    String path = entry.getKey();
    Resource resource = entry.getValue();
    if (paths.matcher(path).matches()) {
      process(analyzer, path, resource);
    }
  }
  return false;
}

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

public Verifier(Analyzer analyzer) throws Exception {
  super(analyzer);
  this.analyzer = analyzer;
  this.dot = analyzer.getJar();
  this.manifest = dot.getManifest();
  this.main = Domain.domain(manifest);
}

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

public boolean analyzeJar(Analyzer analyzer) throws Exception {
  Jar jar = analyzer.getJar();
  Map<String,Resource> dir = jar.getDirectories().get(root);
  if (dir == null || dir.isEmpty()) {
    Resource resource = jar.getResource(root);
    if (resource != null)
      process(analyzer, root, resource);
    return false;
  }
  for (Iterator<Map.Entry<String,Resource>> i = dir.entrySet().iterator(); i.hasNext();) {
    Map.Entry<String,Resource> entry = i.next();
    String path = entry.getKey();
    Resource resource = entry.getValue();
    if (paths.matcher(path).matches()) {
      process(analyzer, path, resource);
    }
  }
  return false;
}

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

/**
 * Create an element representing a bundle from the Jar.
 * 
 * @param infos
 * @param jar
 *            The Jar to be analyzed
 * @return the elements that should be compared
 * @throws Exception
 */
private Element bundleElement(Analyzer analyzer) throws Exception {
  List<Element> result = new ArrayList<Element>();
  Manifest manifest = analyzer.getJar().getManifest();
  if (manifest != null) {
    result.add(JavaElement.getAPI(analyzer));
    result.add(manifestElement(manifest));
  }
  result.add(resourcesElement(analyzer.getJar()));
  return new Element(Type.BUNDLE, analyzer.getJar().getName(), result, CHANGED, CHANGED, null);
}

代码示例来源:origin: reficio/p2-maven-plugin

private static void setManifest(Analyzer analyzer) throws Exception {
  analyzer.mergeManifest(analyzer.getJar().getManifest());
}

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

/**
 * Create an element representing a bundle from the Jar.
 * 
 * @param infos
 * @param jar The Jar to be analyzed
 * @return the elements that should be compared
 * @throws Exception
 */
private Element bundleElement(Analyzer analyzer) throws Exception {
  List<Element> result = new ArrayList<>();
  Manifest manifest = analyzer.getJar()
    .getManifest();
  if (manifest != null) {
    result.add(JavaElement.getAPI(analyzer));
    result.add(manifestElement(manifest));
  }
  result.add(resourcesElement(analyzer));
  return new Element(Type.BUNDLE, analyzer.getJar()
    .getName(), result, CHANGED, CHANGED, null);
}

代码示例来源:origin: reficio/p2-maven-plugin

private static void setPackageOptions(Analyzer analyzer) {
  analyzer.setProperty(Analyzer.IMPORT_PACKAGE, "*;resolution:=optional");
  String export = analyzer.calculateExportsFromContents(analyzer.getJar());
  analyzer.setProperty(Analyzer.EXPORT_PACKAGE, export);
}

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

public boolean analyzeJar(Analyzer analyzer) throws Exception {

    Parameters map = analyzer.parseHeader(analyzer.getProperty(Constants.METATYPE));

    Jar jar = analyzer.getJar();
    for (String name : map.keySet()) {
      Collection<Clazz> metatypes = analyzer.getClasses("", QUERY.ANNOTATED.toString(), Meta.OCD.class.getName(), //
          QUERY.NAMED.toString(), name //
          );
      for (Clazz c : metatypes) {
        jar.putResource("OSGI-INF/metatype/" + c.getFQN() + ".xml", new MetaTypeReader(c, analyzer));
      }
    }
    return false;
  }
}

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

public boolean analyzeJar(Analyzer analyzer) throws Exception {
  Parameters map = analyzer.parseHeader(analyzer.getProperty(Constants.METATYPE));
  Jar jar = analyzer.getJar();
  for (String name : map.keySet()) {
    Collection<Clazz> metatypes = analyzer.getClasses("", QUERY.ANNOTATED.toString(), Meta.OCD.class.getName(), //
        QUERY.NAMED.toString(), name //
        );
    for (Clazz c : metatypes) {
      jar.putResource("OSGI-INF/metatype/" + c.getFQN() + ".xml", new MetaTypeReader(c, analyzer));
    }
  }
  return false;
}
@Override

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

public boolean analyzeJar(Analyzer analyzer) throws Exception {
  Parameters map = analyzer.parseHeader(analyzer.getProperty(Constants.METATYPE));
  Jar jar = analyzer.getJar();
  for (String name : map.keySet()) {
    Collection<Clazz> metatypes = analyzer.getClasses("", QUERY.ANNOTATED.toString(), Meta.OCD.class.getName(), //
        QUERY.NAMED.toString(), name //
        );
    for (Clazz c : metatypes) {
      jar.putResource("OSGI-INF/metatype/" + c.getFQN() + ".xml", new MetaTypeReader(c, analyzer));
    }
  }
  return false;
}
@Override

代码示例来源:origin: reficio/p2-maven-plugin

private void populateJar(Analyzer analyzer, File outputFile) throws Exception {
  Jar jar = analyzer.getJar();
  jar.setManifest(analyzer.calcManifest());
  try {
    jar.write(outputFile);
  } finally {
    jar.close();
  }
}

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

private boolean hasSource(Analyzer analyzer, String path) throws Exception {
  if (!path.endsWith(".class"))
    return false;
  TypeRef type = analyzer.getTypeRefFromPath(path);
  PackageRef packageRef = type.getPackageRef();
  Clazz clazz = analyzer.findClass(type);
  if (clazz == null)
    return false;
  String sourceFile = clazz.getSourceFile();
  if (sourceFile == null)
    return false;
  String source = "OSGI-OPT/src/" + packageRef.getBinary() + "/" + sourceFile;
  Resource sourceResource = analyzer.getJar()
    .getResource(source);
  if (sourceResource == null)
    return false;
  return true;
}

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

private boolean hasSource(Analyzer analyzer, String path) throws Exception {
  if (!path.endsWith(".class"))
    return false;
  TypeRef type = analyzer.getTypeRefFromPath(path);
  PackageRef packageRef = type.getPackageRef();
  Clazz clazz = analyzer.findClass(type);
  if (clazz == null)
    return false;
  String sourceFile = clazz.getSourceFile();
  if (sourceFile == null)
    return false;
  String source = "OSGI-OPT/src/" + packageRef.getBinary() + "/" + sourceFile;
  Resource sourceResource = analyzer.getJar()
    .getResource(source);
  if (sourceResource == null)
    return false;
  return true;
}

代码示例来源:origin: org.apache.felix/maven-bundle-plugin

public Manifest getManifest( MavenProject project, DependencyNode dependencyGraph, Map<String, String> instructions, Properties properties, Jar[] classpath,
    BuildContext buildContext) throws IOException, MojoFailureException, MojoExecutionException, Exception
{
  Analyzer analyzer = getAnalyzer(project, dependencyGraph, instructions, properties, classpath);
  Jar jar = analyzer.getJar();
  Manifest manifest = jar.getManifest();
  if (exportScr)
  {
    exportScr(analyzer, jar, scrLocation, buildContext, getLog() );
  }
  // cleanup...
  analyzer.close();
  return manifest;
}

相关文章

Analyzer类方法