org.apache.felix.utils.manifest.Parser类的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(187)

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

Parser介绍

暂无

代码示例

代码示例来源:origin: jboss-fuse/fabric8

  1. protected List<Clause> getOptionalImports(String importsStr) {
  2. Clause[] imports = Parser.parseHeader(importsStr);
  3. List<Clause> result = new LinkedList<Clause>();
  4. for (Clause anImport : imports) {
  5. String resolution = anImport.getDirective(Constants.RESOLUTION_DIRECTIVE);
  6. if (Constants.RESOLUTION_OPTIONAL.equals(resolution)) {
  7. result.add(anImport);
  8. }
  9. }
  10. return result;
  11. }

代码示例来源:origin: apache/karaf

  1. public static String extractUrl(String override) {
  2. Clause[] cs = Parser.parseClauses(new String[]{override});
  3. if (cs.length != 1) {
  4. throw new IllegalStateException("Override contains more than one clause: " + override);
  5. }
  6. return cs[0].getName();
  7. }

代码示例来源:origin: org.everit.osgi.bundles/org.everit.osgi.bundles.org.apache.felix.utils

  1. public static Clause[] parseHeader(String header) throws IllegalArgumentException
  2. {
  3. Clause[] clauses = null;
  4. if (header != null)
  5. {
  6. if (header.length() == 0)
  7. {
  8. throw new IllegalArgumentException("The header cannot be an empty string.");
  9. }
  10. String[] ss = parseDelimitedString(header, ",");
  11. clauses = parseClauses(ss);
  12. }
  13. return (clauses == null) ? new Clause[0] : clauses;
  14. }

代码示例来源:origin: org.apache.karaf.profile/org.apache.karaf.profile.core

  1. void downloadLibraries(Downloader downloader, final Properties config, Collection<String> libraries, String indent) throws MalformedURLException {
  2. Clause[] clauses = org.apache.felix.utils.manifest.Parser.parseClauses(libraries.toArray(new String[libraries.size()]));
  3. for (final Clause clause : clauses) {
  4. final String filename;
  5. String packages = headers.get(Constants.EXPORT_PACKAGE);
  6. if (packages != null) {
  7. Clause[] clauses1 = org.apache.felix.utils.manifest.Parser.parseHeader(packages);
  8. if (export) {
  9. StringBuilder val = new StringBuilder(config.getProperty(Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA));

代码示例来源:origin: org.everit.osgi.bundles/org.everit.osgi.bundles.org.apache.felix.utils

  1. String[] pieces = parseDelimitedString(ss[ssIdx], ";");

代码示例来源:origin: apache/karaf

  1. void downloadLibraries(Downloader downloader, final Properties config, Collection<String> libraries, String indent) throws MalformedURLException {
  2. Clause[] clauses = org.apache.felix.utils.manifest.Parser.parseClauses(libraries.toArray(new String[libraries.size()]));
  3. for (final Clause clause : clauses) {
  4. final String filename;
  5. String packages = headers.get(Constants.EXPORT_PACKAGE);
  6. if (packages != null) {
  7. Clause[] clauses1 = org.apache.felix.utils.manifest.Parser.parseHeader(packages);
  8. if (export) {
  9. StringBuilder val = new StringBuilder(config.getProperty(Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA));

代码示例来源:origin: org.apache.felix/org.apache.felix.fileinstall

  1. String[] pieces = parseDelimitedString(ss[ssIdx], ";");

代码示例来源:origin: org.apache.karaf.bundle/org.apache.karaf.bundle.core

  1. protected void formatHeader(String header, ClauseFormatter formatter, StringBuilder builder, int indent) {
  2. Clause[] clauses = Parser.parseHeader(header);
  3. formatClauses(clauses, formatter, builder, indent);
  4. }

代码示例来源:origin: apache/karaf

  1. public Blacklist(List<String> blacklist) {
  2. this.clauses = Parser.parseClauses(blacklist.toArray(new String[blacklist.size()]));
  3. compileClauses();
  4. }

代码示例来源:origin: org.apache.felix/org.apache.felix.utils

  1. public static Clause[] parseHeader(String header) throws IllegalArgumentException
  2. {
  3. Clause[] clauses = null;
  4. if (header != null)
  5. {
  6. if (header.length() == 0)
  7. {
  8. throw new IllegalArgumentException("The header cannot be an empty string.");
  9. }
  10. String[] ss = parseDelimitedString(header, ",");
  11. clauses = parseClauses(ss);
  12. }
  13. return (clauses == null) ? new Clause[0] : clauses;
  14. }

代码示例来源:origin: apache/felix

  1. String[] pieces = parseDelimitedString(ss[ssIdx], ";");

代码示例来源:origin: apache/karaf

  1. /**
  2. * Get the list of imports from the manifest. If no imports have been defined, this method returns an empty list.
  3. *
  4. * @param manifest the manifest
  5. * @return the list of imports
  6. */
  7. public static List<Clause> getImports(Manifest manifest) {
  8. List<Clause> result = new LinkedList<>();
  9. Clause[] clauses = Parser.parseHeader(getHeader(Constants.IMPORT_PACKAGE, manifest));
  10. for (Clause clause : clauses) {
  11. result.add(clause);
  12. }
  13. return result;
  14. }

代码示例来源:origin: apache/karaf

  1. public Blacklist(String blacklistUrl) {
  2. Set<String> blacklist = new HashSet<>();
  3. if (blacklistUrl != null) {
  4. try (InputStream is = new URL(blacklistUrl).openStream();
  5. BufferedReader reader = new BufferedReader(new InputStreamReader(is))) {
  6. reader.lines() //
  7. .map(String::trim) //
  8. .filter(line -> !line.isEmpty() && !line.startsWith("#"))
  9. .forEach(blacklist::add);
  10. } catch (FileNotFoundException e) {
  11. LOGGER.debug("Unable to load blacklist bundles list", e.toString());
  12. } catch (Exception e) {
  13. LOGGER.debug("Unable to load blacklist bundles list", e);
  14. }
  15. }
  16. this.clauses = Parser.parseClauses(blacklist.toArray(new String[blacklist.size()]));
  17. compileClauses();
  18. }

代码示例来源:origin: org.apache.felix/org.apache.felix.fileinstall

  1. public static Clause[] parseHeader(String header) throws IllegalArgumentException
  2. {
  3. Clause[] clauses = null;
  4. if (header != null)
  5. {
  6. if (header.length() == 0)
  7. {
  8. throw new IllegalArgumentException("The header cannot be an empty string.");
  9. }
  10. String[] ss = parseDelimitedString(header, ",");
  11. clauses = parseClauses(ss);
  12. }
  13. return (clauses == null) ? new Clause[0] : clauses;
  14. }

代码示例来源:origin: org.apache.felix/org.apache.felix.utils

  1. String[] pieces = parseDelimitedString(ss[ssIdx], ";");

代码示例来源:origin: org.fusesource.patch/patch-core

  1. protected List<Clause> getOptionalImports(String importsStr) {
  2. Clause[] imports = Parser.parseHeader(importsStr);
  3. List<Clause> result = new LinkedList<Clause>();
  4. for (int i = 0; i < imports.length; i++) {
  5. String resolution = imports[i].getDirective(Constants.RESOLUTION_DIRECTIVE);
  6. if (Constants.RESOLUTION_OPTIONAL.equals(resolution)) {
  7. result.add(imports[i]);
  8. }
  9. }
  10. return result;
  11. }

代码示例来源:origin: apache/karaf

  1. public static <T extends Resource> void override(Map<String, T> resources, Collection<String> overrides) {
  2. for (Clause override : Parser.parseClauses(overrides.toArray(new String[overrides.size()]))) {
  3. String overrideRange = override.getAttribute(OVERRIDE_RANGE);
  4. T over = resources.get(override.getName());

代码示例来源:origin: apache/felix

  1. public static Clause[] parseHeader(String header) throws IllegalArgumentException
  2. {
  3. Clause[] clauses = null;
  4. if (header != null)
  5. {
  6. if (header.length() == 0)
  7. {
  8. throw new IllegalArgumentException("The header cannot be an empty string.");
  9. }
  10. String[] ss = parseDelimitedString(header, ",");
  11. clauses = parseClauses(ss);
  12. }
  13. return (clauses == null) ? new Clause[0] : clauses;
  14. }

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

  1. /**
  2. * Write out an entry, handling proper unicode and line length constraints
  3. */
  4. private static void writeEntry(OutputStream out, String name, String value, boolean nice) throws IOException {
  5. if (nice && NICE_HEADERS.contains(name)) {
  6. int n = write(out, 0, name + ": ");
  7. String[] parts = Parser.parseDelimitedString(value, ",");
  8. if (parts.length > 1) {
  9. write(out, 0, "\r\n ");
  10. n = 1;
  11. }
  12. for (int i = 0; i < parts.length; i++) {
  13. if (i < parts.length - 1) {
  14. write(out, n, parts[i] + ",");
  15. write(out, 0, "\r\n ");
  16. } else {
  17. write(out, n, parts[i]);
  18. write(out, 0, "\r\n");
  19. }
  20. n = 1;
  21. }
  22. } else {
  23. int n = write(out, 0, name + ": ");
  24. write(out, n, value);
  25. write(out, 0, "\r\n");
  26. }
  27. }

代码示例来源:origin: apache/karaf

  1. protected void formatHeader(String header, ClauseFormatter formatter, StringBuilder builder, int indent) {
  2. Clause[] clauses = Parser.parseHeader(header);
  3. formatClauses(clauses, formatter, builder, indent);
  4. }

相关文章