热门标签 | 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)$")) {

推荐阅读
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社区 版权所有