热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

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

本文整理了Java中aQute.lib.osgi.Jar.getDirectories()方法的一些代码示例,展示了Jar.getDirectories()

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

Jar.getDirectories介绍

暂无

代码示例

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

/**
* Analyze the classpath for a split package
*
* @param pack
* @param classpath
* @param source
* @return
*/
private String diagnostic(String pack, List classpath, File source) {
// Default is like merge-first, but with a warning
// Find the culprits
pack = pack.replace('.', '/');
List culprits = new ArrayList();
for (Iterator i = classpath.iterator(); i.hasNext();) {
Jar culprit = (Jar) i.next();
if (culprit.getDirectories().containsKey(pack)) {
culprits.add(culprit);
}
}
return "Split package "
+ pack
+ "\nUse directive -split-package:=(merge-first|merge-last|error|first) on Export/Private Package instruction to get rid of this warning\n"
+ "Package found in " + culprits + "\n" + "Reference from " + source + "\n"
+ "Classpath " + classpath;
}

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

/**
* Analyze the classpath for a split package
*
* @param pack
* @param classpath
* @param source
* @return
*/
private String diagnostic(String pack, List classpath, File source) {
// Default is like merge-first, but with a warning
// Find the culprits
pack = pack.replace('.', '/');
List culprits = new ArrayList();
for (Iterator i = classpath.iterator(); i.hasNext();) {
Jar culprit = (Jar) i.next();
if (culprit.getDirectories().containsKey(pack)) {
culprits.add(culprit);
}
}
return "Split package "
+ pack
+ "\nUse directive -split-package:=(merge-first|merge-last|error|first) on Export/Private Package instruction to get rid of this warning\n"
+ "Package found in " + culprits + "\n"
+ "Reference from " + source + "\n" + "Classpath "
+ classpath;
}

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

/**
* Calculate an export header solely based on the contents of a JAR file
*
* @param bundle
* The jar file to analyze
* @return
*/
public String calculateExportsFromContents(Jar bundle) {
String ddel = "";
StringBuffer sb = new StringBuffer();
Map> map = bundle.getDirectories();
for (Iterator i = map.keySet().iterator(); i.hasNext();) {
String directory = (String) i.next();
if (directory.equals("META-INF") || directory.startsWith("META-INF/"))
continue;
if (directory.equals("OSGI-OPT") || directory.startsWith("OSGI-OPT/"))
continue;
if (directory.equals("/"))
continue;
if (directory.endsWith("/"))
directory = directory.substring(0, directory.length() - 1);
directory = directory.replace('/', '.');
sb.append(ddel);
sb.append(directory);
ddel = ",";
}
return sb.toString();
}

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

/**
* Get the exporter of a package ...
*/
public String _exporters(String args[]) throws Exception {
Macro.verifyCommand(
args,
"${exporters;}, returns the list of jars that export the given package",
null, 2, 2);
StringBuilder sb = new StringBuilder();
String del = "";
String pack = args[1].replace('.', '/');
for (Jar jar : classpath) {
if (jar.getDirectories().containsKey(pack)) {
sb.append(del);
sb.append(jar.getName());
}
}
return sb.toString();
}

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

/**
* Calculate an export header solely based on the contents of a JAR file
*
* @param bundle
* The jar file to analyze
* @return
*/
public String calculateExportsFromContents(Jar bundle) {
String ddel = "";
StringBuffer sb = new StringBuffer();
Map> map = bundle.getDirectories();
for (Iterator i = map.keySet().iterator(); i.hasNext();) {
String directory = (String) i.next();
if (directory.equals("META-INF")
|| directory.startsWith("META-INF/"))
continue;
if (directory.equals("OSGI-OPT")
|| directory.startsWith("OSGI-OPT/"))
continue;
if (directory.equals("/"))
continue;
if (directory.endsWith("/"))
directory = directory.substring(0, directory.length() - 1);
directory = directory.replace('/', '.');
sb.append(ddel);
sb.append(directory);
ddel = ",";
}
return sb.toString();
}

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

/**
* Get the exporter of a package ...
*/
public String _exporters(String args[]) throws Exception {
Macro
.verifyCommand(
args,
"${exporters;}, returns the list of jars that export the given package",
null, 2, 2);
StringBuilder sb = new StringBuilder();
String del = "";
String pack = args[1].replace('.', '/');
for (Jar jar : classpath) {
if (jar.getDirectories().containsKey(pack)) {
sb.append(del);
sb.append(jar.getName());
}
}
return sb.toString();
}

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

public boolean analyzeJar(Analyzer analyzer) throws Exception {
Jar jar = analyzer.getJar();
Map 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> i = dir.entrySet().iterator(); i.hasNext();) {
Map.Entry 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

/**
* Print the metatypes in this JAR.
*
* @param jar
*/
private void printMetatype(PrintStream out, Jar jar) throws Exception {
out.println("[METATYPE]");
Manifest manifest = jar.getManifest();
if (manifest == null) {
out.println("No manifest");
return;
}
Map map = jar.getDirectories().get("OSGI-INF/metatype");
if (map != null) {
for (Map.Entry entry : map.entrySet()) {
out.println(entry.getKey());
IO.copy(entry.getValue().openInputStream(), out);
out.println();
}
out.println();
}
}

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

public void verifyBundleClasspath() {
Map> bcp = parseHeader(getHeader(Analyzer.BUNDLE_CLASSPATH));
if (bcp.isEmpty() || bcp.containsKey("."))
return;
for ( String path : bcp.keySet() ) {
if ( path.endsWith("/"))
error("A Bundle-ClassPath entry must not end with '/': %s", path);

if ( dot.getDirectories().containsKey(path))
// We assume that any classes are in a directory
// and therefore do not care when the bundle is included
return;
}

for (String path : dot.getResources().keySet()) {
if (path.endsWith(".class")) {
warning("The Bundle-Classpath does not contain the actual bundle JAR (as specified with '.' in the Bundle-Classpath) but the JAR does contain classes. Is this intentional?");
return;
}
}
}

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

@SuppressWarnings("unchecked")
public boolean analyzeJar(Analyzer analyzer) throws Exception {
Jar jar = analyzer.getJar();
Map dir = (Map) jar.getDirectories().get("META-INF/spring");
if ( dir == null || dir.isEmpty())
return false;

for (Iterator i = dir.entrySet().iterator(); i.hasNext();) {
Map.Entry entry = (Map.Entry) i.next();
String path = (String) entry.getKey();
Resource resource = (Resource) entry.getValue();
if (SPRING_SOURCE.matcher(path).matches()) {
try {
InputStream in = resource.openInputStream();
Set set = analyze(in);
in.close();
for (Iterator r = set.iterator(); r.hasNext();) {
String pack = (String) r.next();
if ( !QN.matcher(pack).matches())
analyzer.warning("Package does not seem a package in spring resource ("+path+"): " + pack );
if (!analyzer.getReferred().containsKey(pack))
analyzer.getReferred().put(pack, new LinkedHashMap());
}
} catch( Exception e ) {
analyzer.error("Unexpected exception in processing spring resources("+path+"): " + e );
}
}
}
return false;
}

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

.getAbsolutePath());
out.printf("Name : %s\n", jar.getName());
Map> dirs = jar.getDirectories();
for (Map.Entry> entry : dirs.entrySet()) {
Map dir = entry.getValue();

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

size = dot.getDirectories().size();
analyze();
analyzed = false;
doExpand(dot, CONDITIONAL_PACKAGE + " Private imports",
replaceWitInstruction(filtered, CONDITIONAL_PACKAGE), false);
} while (dot.getDirectories().size() > size);
analyzed = true;

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

builder.addClose(signed);
Map dir = signed.getDirectories().get("META-INF");
for (String path : dir.keySet()) {
if (path.matches(".*\\.(DSA|RSA|SF|MF)$")) {

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

/**
* Create the imports/exports by parsing
*
* @throws IOException
*/
void analyzeClasspath() throws Exception {
classpathExports = newHashMap();
for (Iterator c = getClasspath().iterator(); c.hasNext();) {
Jar current = c.next();
checkManifest(current);
for (Iterator j = current.getDirectories().keySet().iterator(); j.hasNext();) {
String dir = j.next();
Resource resource = current.getResource(dir + "/packageinfo");
if (resource != null) {
InputStream in = resource.openInputStream();
try {
String version = parsePackageInfo(in);
setPackageInfo(dir, VERSION_ATTRIBUTE, version);
} finally {
in.close();
}
}
}
}
}

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

/**
* Create the imports/exports by parsing
*
* @throws IOException
*/
void analyzeClasspath() throws IOException {
classpathExports = newHashMap();
for (Iterator c = getClasspath().iterator(); c.hasNext();) {
Jar current = c.next();
checkManifest(current);
for (Iterator j = current.getDirectories().keySet()
.iterator(); j.hasNext();) {
String dir = j.next();
Resource resource = current.getResource(dir + "/packageinfo");
if (resource != null) {
InputStream in = resource.openInputStream();
try {
String version = parsePackageInfo(in);
setPackageInfo(dir, "version", version);
} finally {
in.close();
}
}
}
}
}

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

+ jarOrDir + ", " + e);
} else if (dot.getDirectories().containsKey(jarOrDir)) {
if (r3)
error("R3 bundles do not support directories on the Bundle-ClassPath: "

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

if (dot.getDirectories().containsKey(path)) {
cOntainsDirectory= true;
break;
if (dot.getDirectories().containsKey(path)) {

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

+ jarOrDir + ", " + e);
} else if (dot.getDirectories().containsKey(jarOrDir)) {
if (r3)
error("R3 bundles do not support directories on the Bundle-ClassPath: "

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

if (dot.getDirectories().containsKey(path)) {
analyzeJar(dot, path + '/', classSpace, contained,
referred, uses);

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

builder.addClose(signed);
Map dir = signed.getDirectories().get("META-INF");
for (String path : dir.keySet()) {
if (path.matches(".*\\.(DSA|RSA|SF|MF)$")) {

推荐阅读
  • Java太阳系小游戏分析和源码详解
    本文介绍了一个基于Java的太阳系小游戏的分析和源码详解。通过对面向对象的知识的学习和实践,作者实现了太阳系各行星绕太阳转的效果。文章详细介绍了游戏的设计思路和源码结构,包括工具类、常量、图片加载、面板等。通过这个小游戏的制作,读者可以巩固和应用所学的知识,如类的继承、方法的重载与重写、多态和封装等。 ... [详细]
  • Spring源码解密之默认标签的解析方式分析
    本文分析了Spring源码解密中默认标签的解析方式。通过对命名空间的判断,区分默认命名空间和自定义命名空间,并采用不同的解析方式。其中,bean标签的解析最为复杂和重要。 ... [详细]
  • Java容器中的compareto方法排序原理解析
    本文从源码解析Java容器中的compareto方法的排序原理,讲解了在使用数组存储数据时的限制以及存储效率的问题。同时提到了Redis的五大数据结构和list、set等知识点,回忆了作者大学时代的Java学习经历。文章以作者做的思维导图作为目录,展示了整个讲解过程。 ... [详细]
  • 本文讨论了一个关于cuowu类的问题,作者在使用cuowu类时遇到了错误提示和使用AdjustmentListener的问题。文章提供了16个解决方案,并给出了两个可能导致错误的原因。 ... [详细]
  • 关键词:Golang, Cookie, 跟踪位置, net/http/cookiejar, package main, golang.org/x/net/publicsuffix, io/ioutil, log, net/http, net/http/cookiejar ... [详细]
  • Go Cobra命令行工具入门教程
    本文介绍了Go语言实现的命令行工具Cobra的基本概念、安装方法和入门实践。Cobra被广泛应用于各种项目中,如Kubernetes、Hugo和Github CLI等。通过使用Cobra,我们可以快速创建命令行工具,适用于写测试脚本和各种服务的Admin CLI。文章还通过一个简单的demo演示了Cobra的使用方法。 ... [详细]
  • 本文介绍了如何使用Express App提供静态文件,同时提到了一些不需要使用的文件,如package.json和/.ssh/known_hosts,并解释了为什么app.get('*')无法捕获所有请求以及为什么app.use(express.static(__dirname))可能会提供不需要的文件。 ... [详细]
  • JDK源码学习之HashTable(附带面试题)的学习笔记
    本文介绍了JDK源码学习之HashTable(附带面试题)的学习笔记,包括HashTable的定义、数据类型、与HashMap的关系和区别。文章提供了干货,并附带了其他相关主题的学习笔记。 ... [详细]
  • 本文介绍了在处理不规则数据时如何使用Python自动提取文本中的时间日期,包括使用dateutil.parser模块统一日期字符串格式和使用datefinder模块提取日期。同时,还介绍了一段使用正则表达式的代码,可以支持中文日期和一些特殊的时间识别,例如'2012年12月12日'、'3小时前'、'在2012/12/13哈哈'等。 ... [详细]
  • Android系统源码分析Zygote和SystemServer启动过程详解
    本文详细解析了Android系统源码中Zygote和SystemServer的启动过程。首先介绍了系统framework层启动的内容,帮助理解四大组件的启动和管理过程。接着介绍了AMS、PMS等系统服务的作用和调用方式。然后详细分析了Zygote的启动过程,解释了Zygote在Android启动过程中的决定作用。最后通过时序图展示了整个过程。 ... [详细]
  • 本文介绍了如何使用elementui分页组件进行分页功能的改写,只需一行代码即可调用。通过封装分页组件,避免在每个页面都写跳转请求的重复代码。详细的代码示例和使用方法在正文中给出。 ... [详细]
  • 先看看ElementUI里关于el-table的template数据结构:<template><el-table:datatableData><e ... [详细]
  • Java编程实现邻接矩阵表示稠密图的方法及实现类介绍
    本文介绍了Java编程如何实现邻接矩阵表示稠密图的方法,通过一个名为AMWGraph.java的类来构造邻接矩阵表示的图,并提供了插入结点、插入边、获取邻接结点等功能。通过使用二维数组来表示结点之间的关系,并通过元素的值来表示权值的大小,实现了稠密图的表示和操作。对于对稠密图的表示和操作感兴趣的读者可以参考本文。 ... [详细]
  • 本文介绍了在go语言中利用(*interface{})(nil)传递参数类型的原理及应用。通过分析Martini框架中的injector类型的声明,解释了values映射表的作用以及parent Injector的含义。同时,讨论了该技术在实际开发中的应用场景。 ... [详细]
  • Python的参数解析argparse模块的学习
    本文介绍了Python中参数解析的重要模块argparse的学习内容。包括位置参数和可选参数的定义和使用方式,以及add_argument()函数的详细参数关键字解释。同时还介绍了命令行参数的操作和可接受数量的设置,其中包括整数类型的参数。通过学习本文内容,可以更好地理解和使用argparse模块进行参数解析。 ... [详细]
author-avatar
田文萍
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有