本文整理了Java中org.apache.felix.utils.manifest.Parser.parseHeader()
方法的一些代码示例,展示了Parser.parseHeader()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Parser.parseHeader()
方法的具体详情如下:
包路径:org.apache.felix.utils.manifest.Parser
类名称:Parser
方法名:parseHeader
暂无
代码示例来源:origin: apache/karaf
protected void formatHeader(String header, ClauseFormatter formatter, StringBuilder builder, int indent) {
Clause[] clauses = Parser.parseHeader(header);
formatClauses(clauses, formatter, builder, indent);
}
代码示例来源:origin: jboss-fuse/fabric8
protected List<Clause> getOptionalImports(String importsStr) {
Clause[] imports = Parser.parseHeader(importsStr);
List<Clause> result = new LinkedList<Clause>();
for (Clause anImport : imports) {
String resolution = anImport.getDirective(Constants.RESOLUTION_DIRECTIVE);
if (Constants.RESOLUTION_OPTIONAL.equals(resolution)) {
result.add(anImport);
}
}
return result;
}
代码示例来源:origin: org.fusesource.patch/patch-core
protected List<Clause> getOptionalImports(String importsStr) {
Clause[] imports = Parser.parseHeader(importsStr);
List<Clause> result = new LinkedList<Clause>();
for (int i = 0; i < imports.length; i++) {
String resolution = imports[i].getDirective(Constants.RESOLUTION_DIRECTIVE);
if (Constants.RESOLUTION_OPTIONAL.equals(resolution)) {
result.add(imports[i]);
}
}
return result;
}
代码示例来源:origin: org.apache.karaf.bundle/org.apache.karaf.bundle.core
protected void formatHeader(String header, ClauseFormatter formatter, StringBuilder builder, int indent) {
Clause[] clauses = Parser.parseHeader(header);
formatClauses(clauses, formatter, builder, indent);
}
代码示例来源:origin: apache/karaf
protected void formatHeader(String header, ClauseFormatter formatter, StringBuilder builder, int indent) {
Clause[] clauses = Parser.parseHeader(header);
formatClauses(clauses, formatter, builder, indent);
}
代码示例来源:origin: org.fusesource.fabric.fab/fab-osgi
protected void formatHeader(String header, ClauseFormatter formatter, StringBuilder builder, int indent) {
Clause[] clauses = Parser.parseHeader(header);
formatClauses(clauses, formatter, builder, indent);
}
代码示例来源:origin: apache/karaf
/**
* Get the list of imports from the manifest. If no imports have been defined, this method returns an empty list.
*
* @param manifest the manifest
* @return the list of imports
*/
public static List<Clause> getImports(Manifest manifest) {
List<Clause> result = new LinkedList<>();
Clause[] clauses = Parser.parseHeader(getHeader(Constants.IMPORT_PACKAGE, manifest));
for (Clause clause : clauses) {
result.add(clause);
}
return result;
}
代码示例来源:origin: apache/karaf
/**
* Get the list of exports from the manifest. If no exports have been defined, this method returns an empty list.
*
* @param manifest the manifest
* @return the list of exports
*/
public static List<Clause> getExports(Manifest manifest) {
List<Clause> result = new LinkedList<>();
Clause[] clauses = Parser.parseHeader(getHeader(Constants.EXPORT_PACKAGE, manifest));
for (Clause clause : clauses) {
result.add(clause);
}
return result;
}
代码示例来源:origin: org.apache.karaf.shell/org.apache.karaf.shell.osgi
protected void formatHeader(String header, ClauseFormatter formatter, StringBuilder builder, int indent) {
Clause[] clauses = Parser.parseHeader(header);
formatClauses(clauses, formatter, builder, indent);
}
代码示例来源:origin: org.apache.karaf.subsystem/org.apache.karaf.subsystem.core
protected void formatHeader(String header, ClauseFormatter formatter, StringBuilder builder, int indent) {
Clause[] clauses = Parser.parseHeader(header);
formatClauses(clauses, formatter, builder, indent);
}
代码示例来源:origin: io.fabric8.fab/fab-osgi
protected void formatHeader(String header, ClauseFormatter formatter, StringBuilder builder, int indent) {
Clause[] clauses = Parser.parseHeader(header);
formatClauses(clauses, formatter, builder, indent);
}
代码示例来源:origin: org.apache.karaf.tooling/karaf-maven-plugin
/**
* Get the list of imports from the manifest. If no imports have been defined, this method returns an empty list.
*
* @param manifest the manifest
* @return the list of imports
*/
public static List<Clause> getImports(Manifest manifest) {
List<Clause> result = new LinkedList<>();
Clause[] clauses = Parser.parseHeader(getHeader(Constants.IMPORT_PACKAGE, manifest));
for (Clause clause : clauses) {
result.add(clause);
}
return result;
}
代码示例来源:origin: org.apache.felix/org.apache.felix.fileinstall
protected List<Clause> getOptionalImports(String importsStr)
{
Clause[] imports = Parser.parseHeader(importsStr);
List<Clause> result = new LinkedList<Clause>();
for (Clause anImport : imports)
{
String resolution = anImport.getDirective(Constants.RESOLUTION_DIRECTIVE);
if (Constants.RESOLUTION_OPTIONAL.equals(resolution))
{
result.add(anImport);
}
}
return result;
}
代码示例来源:origin: org.apache.karaf.tooling/karaf-maven-plugin
/**
* Get the list of exports from the manifest. If no exports have been defined, this method returns an empty list.
*
* @param manifest the manifest
* @return the list of exports
*/
public static List<Clause> getExports(Manifest manifest) {
List<Clause> result = new LinkedList<>();
Clause[] clauses = Parser.parseHeader(getHeader(Constants.EXPORT_PACKAGE, manifest));
for (Clause clause : clauses) {
result.add(clause);
}
return result;
}
代码示例来源:origin: apache/karaf
private void createNodesForImports(Node<Bundle> node, Bundle bundle) {
Clause[] imports = Parser.parseHeader(bundle.getHeaders().get("Import-Package"));
Clause[] exports = Parser.parseHeader(bundle.getHeaders().get("Export-Package"));
for (Clause i : imports) {
boolean exported = false;
for (Clause e : exports) {
if (e.getName().equals(i.getName())) {
exported = true;
break;
}
}
if (!exported) {
createNodeForImport(node, bundle, i);
}
}
}
代码示例来源:origin: org.apache.sling/org.apache.sling.feature.analyser
private List<String> extractInitialContent(final Manifest m) {
final List<String> initialContent = new ArrayList<>();
if ( m != null ) {
final String root = m.getMainAttributes().getValue(CONTENT_HEADER);
if (root != null) {
Clause[] clauses = Parser.parseHeader(root);
for (final Clause entry :clauses) {
String path = entry.getDirective(PATH_DIRECTIVE);
if (path == null) {
path = "/";
} else if (!path.startsWith("/")) {
// make relative path absolute
path = "/" + path;
}
initialContent.add(path);
}
}
}
return initialContent;
}
}
代码示例来源:origin: org.apache.karaf.bundle/org.apache.karaf.bundle.core
private void createNodesForImports(Node<Bundle> node, Bundle bundle) {
Clause[] imports = Parser.parseHeader(bundle.getHeaders().get("Import-Package"));
Clause[] exports = Parser.parseHeader(bundle.getHeaders().get("Export-Package"));
for (Clause i : imports) {
boolean exported = false;
for (Clause e : exports) {
if (e.getName().equals(i.getName())) {
exported = true;
break;
}
}
if (!exported) {
createNodeForImport(node, bundle, i);
}
}
}
代码示例来源:origin: org.apache.sling/org.apache.sling.feature.analyser
private Set<PackageInfo> calculateSystemPackages(final Map<String,String> fwkProps) {
return
Stream.of(
Parser.parseHeader(
Stream.of(
fwkProps.get(Constants.FRAMEWORK_SYSTEMPACKAGES),
fwkProps.get(Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA)
).filter(Objects::nonNull)
.collect(Collectors.joining(","))
)
).map(
clause -> new PackageInfo(clause.getName(), clause.getAttribute("version") != null ? clause.getAttribute("version") : "0.0.0", false))
.collect(Collectors.toSet());
}
代码示例来源:origin: org.apache.sling/org.apache.sling.feature.analyser
private List<String> extractBundleResources(final Manifest m) {
final List<String> bundleResources = new ArrayList<>();
if ( m != null ) {
final String root = m.getMainAttributes().getValue(BUNDLE_RESOURCE_ROOTS);
if (root != null) {
Clause[] clauses = Parser.parseHeader(root);
for (final Clause entry : clauses) {
final String resourceRoot = entry.getName();
final String pathDirective = entry.getDirective(PATH_DIRECTIVE);
if (pathDirective != null) {
bundleResources.add(resourceRoot + "!" + pathDirective);
} else {
bundleResources.add(resourceRoot);
}
}
}
}
return bundleResources;
}
}
代码示例来源:origin: apache/karaf
private void reformatClauses(Properties config, String key) {
String val = config.getProperty(key);
if (val != null && !val.isEmpty()) {
List<String> comments = config.getComments(key);
Clause[] clauses = org.apache.felix.utils.manifest.Parser.parseHeader(val);
Set<String> strings = new LinkedHashSet<>();
for (Clause clause : clauses) {
strings.add(clause.toString());
}
List<String> lines = new ArrayList<>();
lines.add("");
int index = 0;
for (String string : strings) {
String s = " " + string;
if (index++ < strings.size() - 1) {
s += ", ";
}
lines.add(s);
}
config.put(key, comments, lines);
}
}
内容来源于网络,如有侵权,请联系作者删除!