本文整理了Java中org.apache.felix.utils.manifest.Parser
类的一些代码示例,展示了Parser
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Parser
类的具体详情如下:
包路径:org.apache.felix.utils.manifest.Parser
类名称:Parser
暂无
代码示例来源: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: apache/karaf
public static String extractUrl(String override) {
Clause[] cs = Parser.parseClauses(new String[]{override});
if (cs.length != 1) {
throw new IllegalStateException("Override contains more than one clause: " + override);
}
return cs[0].getName();
}
代码示例来源:origin: org.everit.osgi.bundles/org.everit.osgi.bundles.org.apache.felix.utils
public static Clause[] parseHeader(String header) throws IllegalArgumentException
{
Clause[] clauses = null;
if (header != null)
{
if (header.length() == 0)
{
throw new IllegalArgumentException("The header cannot be an empty string.");
}
String[] ss = parseDelimitedString(header, ",");
clauses = parseClauses(ss);
}
return (clauses == null) ? new Clause[0] : clauses;
}
代码示例来源:origin: org.apache.karaf.profile/org.apache.karaf.profile.core
void downloadLibraries(Downloader downloader, final Properties config, Collection<String> libraries, String indent) throws MalformedURLException {
Clause[] clauses = org.apache.felix.utils.manifest.Parser.parseClauses(libraries.toArray(new String[libraries.size()]));
for (final Clause clause : clauses) {
final String filename;
String packages = headers.get(Constants.EXPORT_PACKAGE);
if (packages != null) {
Clause[] clauses1 = org.apache.felix.utils.manifest.Parser.parseHeader(packages);
if (export) {
StringBuilder val = new StringBuilder(config.getProperty(Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA));
代码示例来源:origin: org.everit.osgi.bundles/org.everit.osgi.bundles.org.apache.felix.utils
String[] pieces = parseDelimitedString(ss[ssIdx], ";");
代码示例来源:origin: apache/karaf
void downloadLibraries(Downloader downloader, final Properties config, Collection<String> libraries, String indent) throws MalformedURLException {
Clause[] clauses = org.apache.felix.utils.manifest.Parser.parseClauses(libraries.toArray(new String[libraries.size()]));
for (final Clause clause : clauses) {
final String filename;
String packages = headers.get(Constants.EXPORT_PACKAGE);
if (packages != null) {
Clause[] clauses1 = org.apache.felix.utils.manifest.Parser.parseHeader(packages);
if (export) {
StringBuilder val = new StringBuilder(config.getProperty(Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA));
代码示例来源:origin: org.apache.felix/org.apache.felix.fileinstall
String[] pieces = parseDelimitedString(ss[ssIdx], ";");
代码示例来源: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
public Blacklist(List<String> blacklist) {
this.clauses = Parser.parseClauses(blacklist.toArray(new String[blacklist.size()]));
compileClauses();
}
代码示例来源:origin: org.apache.felix/org.apache.felix.utils
public static Clause[] parseHeader(String header) throws IllegalArgumentException
{
Clause[] clauses = null;
if (header != null)
{
if (header.length() == 0)
{
throw new IllegalArgumentException("The header cannot be an empty string.");
}
String[] ss = parseDelimitedString(header, ",");
clauses = parseClauses(ss);
}
return (clauses == null) ? new Clause[0] : clauses;
}
代码示例来源:origin: apache/felix
String[] pieces = parseDelimitedString(ss[ssIdx], ";");
代码示例来源: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
public Blacklist(String blacklistUrl) {
Set<String> blacklist = new HashSet<>();
if (blacklistUrl != null) {
try (InputStream is = new URL(blacklistUrl).openStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(is))) {
reader.lines() //
.map(String::trim) //
.filter(line -> !line.isEmpty() && !line.startsWith("#"))
.forEach(blacklist::add);
} catch (FileNotFoundException e) {
LOGGER.debug("Unable to load blacklist bundles list", e.toString());
} catch (Exception e) {
LOGGER.debug("Unable to load blacklist bundles list", e);
}
}
this.clauses = Parser.parseClauses(blacklist.toArray(new String[blacklist.size()]));
compileClauses();
}
代码示例来源:origin: org.apache.felix/org.apache.felix.fileinstall
public static Clause[] parseHeader(String header) throws IllegalArgumentException
{
Clause[] clauses = null;
if (header != null)
{
if (header.length() == 0)
{
throw new IllegalArgumentException("The header cannot be an empty string.");
}
String[] ss = parseDelimitedString(header, ",");
clauses = parseClauses(ss);
}
return (clauses == null) ? new Clause[0] : clauses;
}
代码示例来源:origin: org.apache.felix/org.apache.felix.utils
String[] pieces = parseDelimitedString(ss[ssIdx], ";");
代码示例来源: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: apache/karaf
public static <T extends Resource> void override(Map<String, T> resources, Collection<String> overrides) {
for (Clause override : Parser.parseClauses(overrides.toArray(new String[overrides.size()]))) {
String overrideRange = override.getAttribute(OVERRIDE_RANGE);
T over = resources.get(override.getName());
代码示例来源:origin: apache/felix
public static Clause[] parseHeader(String header) throws IllegalArgumentException
{
Clause[] clauses = null;
if (header != null)
{
if (header.length() == 0)
{
throw new IllegalArgumentException("The header cannot be an empty string.");
}
String[] ss = parseDelimitedString(header, ",");
clauses = parseClauses(ss);
}
return (clauses == null) ? new Clause[0] : clauses;
}
代码示例来源:origin: org.apache.felix/maven-bundle-plugin
/**
* Write out an entry, handling proper unicode and line length constraints
*/
private static void writeEntry(OutputStream out, String name, String value, boolean nice) throws IOException {
if (nice && NICE_HEADERS.contains(name)) {
int n = write(out, 0, name + ": ");
String[] parts = Parser.parseDelimitedString(value, ",");
if (parts.length > 1) {
write(out, 0, "\r\n ");
n = 1;
}
for (int i = 0; i < parts.length; i++) {
if (i < parts.length - 1) {
write(out, n, parts[i] + ",");
write(out, 0, "\r\n ");
} else {
write(out, n, parts[i]);
write(out, 0, "\r\n");
}
n = 1;
}
} else {
int n = write(out, 0, name + ": ");
write(out, n, value);
write(out, 0, "\r\n");
}
}
代码示例来源:origin: apache/karaf
protected void formatHeader(String header, ClauseFormatter formatter, StringBuilder builder, int indent) {
Clause[] clauses = Parser.parseHeader(header);
formatClauses(clauses, formatter, builder, indent);
}
内容来源于网络,如有侵权,请联系作者删除!