public void pre(Clause clause, StringBuilder output) { boolean isSatisfied = checkBundle(clause.getName(), clause.getAttribute("bundle-version")); output.append(isSatisfied ? SimpleAnsi.COLOR_DEFAULT : SimpleAnsi.COLOR_RED); } public void post(Clause clause, StringBuilder output) {
public void pre(Clause clause, StringBuilder output) { boolean isSatisfied = checkPackage(clause.getName(), clause.getAttribute("version")); boolean isOptional = "optional".equals(clause.getDirective("resolution")); output.append(isSatisfied ? SimpleAnsi.COLOR_DEFAULT : SimpleAnsi.COLOR_RED); output.append(isSatisfied || isOptional ? SimpleAnsi.INTENSITY_NORMAL : SimpleAnsi.INTENSITY_BOLD); } public void post(Clause clause, StringBuilder output) {
String type = c.getAttribute(BLACKLIST_TYPE); if (type == null) { String url = c.getAttribute(BLACKLIST_URL); if (url != null || c.getName().startsWith("mvn:")) { switch (type) { case TYPE_REPOSITORY: location = c.getName(); if (c.getAttribute(BLACKLIST_URL) != null) { location = c.getAttribute(BLACKLIST_URL); case TYPE_FEATURE: try { featureBlacklist.add(new FeaturePattern(c.toString())); } catch (IllegalArgumentException e) { LOG.warn("Problem parsing blacklisted feature identifier \"" + c.toString() + "\": " + e.getMessage() + ". Ignoring."); location = c.getName(); if (c.getAttribute(BLACKLIST_URL) != null) { location = c.getAttribute(BLACKLIST_URL);
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; } }
protected void formatClause(Clause clause, StringBuilder builder, int indent) { if (indent < 0) { if (clause.toString().length() < getTermWidth() - 8) { // -8 for tabs indent = 1; } else { String name = clause.getName(); Directive[] directives = clause.getDirectives(); Attribute[] attributes = clause.getAttributes(); Arrays.sort(directives, Comparator.comparing(Directive::getName)); Arrays.sort(attributes, Comparator.comparing(Attribute::getName));
for ( int i = 0; i < pkgs.length; i++ ) Clause export = new Clause( pkgs[i].getName(), pkgs[i].getDirectives(), pkgs[i].getAttributes() ); val[i] = collectExport( export.getName(), export.getAttribute( Constants.VERSION_ATTRIBUTE ) ); imports.put( pkg.getName(), new Clause( pkg.getName(), pkg.getDirectives(), pkg.getAttributes() ) ); ExportedPackage ep = ( ExportedPackage ) candidates.get( r4Import.getName() ); String path = r4Import.getName().replace( '.', '/' ); if ( bundle.getEntry( path ) != null ) importList.add(collectImport( r4Import.getName(), r4Import.getAttribute( Constants.VERSION_ATTRIBUTE ), Constants.RESOLUTION_OPTIONAL.equals( r4Import .getDirective( Constants.RESOLUTION_DIRECTIVE ) ), ep, pluginRoot ));
String multiple = clause.getDirective("multiple"); String avail = clause.getDirective("availability"); String filter = clause.getAttribute("filter"); filter = "(" + Constants.OBJECTCLASS + "=" + clause.getName() + ")"; } else if (!filter.startsWith("(") && !filter.endsWith(")")) { filter = "(&(" + Constants.OBJECTCLASS + "=" + clause.getName() + ")(" + filter + "))"; } else { filter = "(&(" + Constants.OBJECTCLASS + "=" + clause.getName() + ")" + filter + ")"; sb.append(hc[i].getName()); for (int i = 0; i < hc[0].getAttributes().length; i++) sb.append(hc[0].getAttributes()[i].getName()); sb.append("=\""); sb.append(hc[0].getAttributes()[i].getValue()); sb.append("\""); String pkg = a.getName(); if ( "Import-Class".equals( header ) ) int n = a.getName().lastIndexOf( '.' ); if ( n > 0 ) for (Attribute attribute : a.getAttributes()) merge.add(clause.toString());
final String filename; final String library; if (clause.getDirective("url") != null) { filename = clause.getName(); library = clause.getDirective("url"); } else { filename = null; library = clause.getName(); final String type = clause.getDirective(LIBRARY_CLAUSE_TYPE) != null ? clause.getDirective(LIBRARY_CLAUSE_TYPE) : Library.TYPE_DEFAULT; if (!javase.supportsEndorsedAndExtLibraries() && (Library.TYPE_ENDORSED.equals(type) || Library.TYPE_EXTENSION.equals(type))) { LOGGER.warn("Ignoring library " + library + " of type " + type + " which is only supported for Java 1.8."); boolean export = Boolean.parseBoolean(clause.getDirective(LIBRARY_CLAUSE_EXPORT)); boolean delegate = Boolean.parseBoolean(clause.getDirective(LIBRARY_CLAUSE_DELEGATE)); if (export || delegate) { Map<String, String> headers = getHeaders(provider); StringBuilder val = new StringBuilder(config.getProperty(Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA)); for (Clause clause1 : clauses1) { val.append(",").append(clause1.toString()); StringBuilder val = new StringBuilder(config.getProperty(Constants.FRAMEWORK_BOOTDELEGATION)); for (Clause clause1 : clauses1) { val.append(",").append(clause1.getName());
String schemaName = clause.getName(); Attribute[] attributes = clause.getAttributes(); if (attributes.length > 0) { throw new SchemaExpressionSyntaxException("No Attributes in the schema expresson are supported."); Directive[] directives = clause.getDirectives(); if (directives.length > 1) { throw new SchemaExpressionSyntaxException(
/** * Check if a given manifest clause represents an optional import * * @param clause the manifest clause * @return <code>true</code> for an optional import, <code>false</code> for mandatory imports */ public static boolean isOptional(Clause clause) { return "optional".equals(clause.getDirective("resolution")); }
@SuppressWarnings("deprecation") public static VersionRange getVersionRange(Clause clause) { String v = clause.getAttribute(Constants.VERSION_ATTRIBUTE); if (v == null) { v = clause.getAttribute(Constants.PACKAGE_SPECIFICATION_VERSION); } if (v == null) { v = clause.getAttribute(Constants.BUNDLE_VERSION_ATTRIBUTE); } return VersionRange.parseVersionRange(v); } }
private void fillAttributesOfRequirementFromClause(final Map<String, Object> attributes, final Clause clauses) { Attribute[] parsedAttributes = clauses.getAttributes(); for (Attribute attribute : parsedAttributes) { attributes.put(attribute.getName(), attribute.getValue()); } }
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); } }
for (int pkgIdx = 0; pkgIdx < pathCount; pkgIdx++) pkgs[pkgIdx] = new Clause(pieces[pkgIdx], dirsFinal, attrsFinal); completeList.add(pkgs[pkgIdx]);
protected void formatClause(Clause clause, StringBuilder builder, int indent) { if (indent < 0) { if (clause.toString().length() < getTermWidth() - 8) { // -8 for tabs indent = 1; } else { String name = clause.getName(); Directive[] directives = clause.getDirectives(); Attribute[] attributes = clause.getAttributes(); Arrays.sort(directives, Comparator.comparing(Directive::getName)); Arrays.sort(attributes, Comparator.comparing(Attribute::getName));
for ( int i = 0; i < pkgs.length; i++ ) Clause export = new Clause( pkgs[i].getName(), pkgs[i].getDirectives(), pkgs[i].getAttributes() ); val[i] = collectExport( export.getName(), export.getAttribute( Constants.VERSION_ATTRIBUTE ) ); imports.put( pkg.getName(), new Clause( pkg.getName(), pkg.getDirectives(), pkg.getAttributes() ) ); ExportedPackage ep = ( ExportedPackage ) candidates.get( r4Import.getName() ); String path = r4Import.getName().replace( '.', '/' ); if ( bundle.getEntry( path ) != null ) importList.add(collectImport( r4Import.getName(), r4Import.getAttribute( Constants.VERSION_ATTRIBUTE ), Constants.RESOLUTION_OPTIONAL.equals( r4Import .getDirective( Constants.RESOLUTION_DIRECTIVE ) ), ep, pluginRoot ));
final String filename; final String library; if (clause.getDirective("url") != null) { filename = clause.getName(); library = clause.getDirective("url"); } else { filename = null; library = clause.getName(); final String type = clause.getDirective(LIBRARY_CLAUSE_TYPE) != null ? clause.getDirective(LIBRARY_CLAUSE_TYPE) : Library.TYPE_DEFAULT; if (!javase.supportsEndorsedAndExtLibraries() && (Library.TYPE_ENDORSED.equals(type) || Library.TYPE_EXTENSION.equals(type))) { LOGGER.warn("Ignoring library " + library + " of type " + type + " which is only supported for Java 1.8."); boolean export = Boolean.parseBoolean(clause.getDirective(LIBRARY_CLAUSE_EXPORT)); boolean delegate = Boolean.parseBoolean(clause.getDirective(LIBRARY_CLAUSE_DELEGATE)); if (export || delegate) { Map<String, String> headers = getHeaders(provider); StringBuilder val = new StringBuilder(config.getProperty(Constants.FRAMEWORK_SYSTEMPACKAGES_EXTRA)); for (Clause clause1 : clauses1) { val.append(",").append(clause1.toString()); StringBuilder val = new StringBuilder(config.getProperty(Constants.FRAMEWORK_BOOTDELEGATION)); for (Clause clause1 : clauses1) { val.append(",").append(clause1.getName());
String schemaName = clause.getName(); Attribute[] attributes = clause.getAttributes(); if (attributes.length > 0) { throw new SchemaExpressionSyntaxException( "No Attributes in the schema expresson are supported."); Directive[] directives = clause.getDirectives(); String filterString = "(" + LiquibaseEOSGiConstants.CAPABILITY_NS_LIQUIBASE_CHANGELOG + "=" + schemaName + ")";