/** * Remove the attributes mentioned in the REMOVE_ATTRIBUTE_DIRECTIVE. You * can add a remove-attribute: directive with a regular expression for * attributes that need to be removed. We also remove all attributes that * have a value of !. This allows you to use macros with ${if} to remove * values. */ void removeAttributes(Attrs attributes) { String remove = attributes.remove(REMOVE_ATTRIBUTE_DIRECTIVE); if (remove != null) { Instructions removeInstr = new Instructions(remove); attributes.keySet().removeAll(removeInstr.select(attributes.keySet(), false)); } // Remove any ! valued attributes for (Iterator<Entry<String,String>> i = attributes.entrySet().iterator(); i.hasNext();) { String v = i.next().getValue(); if (v.equals("!")) i.remove(); } }
public boolean isEqual(Attrs other) { if (this == other) return true; if (other == null || size() != other.size()) return false; if (isEmpty()) return true; TreeSet<String> l = new TreeSet<String>(keySet()); TreeSet<String> lo = new TreeSet<String>(other.keySet()); if (!l.equals(lo)) return false; for (String key : keySet()) { String value = get(key); String valueo = other.get(key); if (!(value == valueo || (value != null && value.equals(valueo)))) return false; } return true; }
/** * Remove the attributes mentioned in the REMOVE_ATTRIBUTE_DIRECTIVE. You * can add a remove-attribute: directive with a regular expression for * attributes that need to be removed. We also remove all attributes that * have a value of !. This allows you to use macros with ${if} to remove * values. */ void removeAttributes(Attrs attributes) { String remove = attributes.remove(REMOVE_ATTRIBUTE_DIRECTIVE); if (remove != null) { Instructions removeInstr = new Instructions(remove); attributes.keySet().removeAll(removeInstr.select(attributes.keySet(), false)); } // Remove any ! valued attributes for (Iterator<Entry<String,String>> i = attributes.entrySet().iterator(); i.hasNext();) { String v = i.next().getValue(); if (v.equals("!")) i.remove(); } }
public boolean isEqual(Attrs other) { if (this == other) return true; if (other == null || size() != other.size()) return false; if (isEmpty()) return true; TreeSet<String> l = new TreeSet<String>(keySet()); TreeSet<String> lo = new TreeSet<String>(other.keySet()); if (!l.equals(lo)) return false; for (String key : keySet()) { String value = get(key); String valueo = other.get(key); if (!(value == valueo || (value != null && value.equals(valueo)))) return false; } return true; }
/** * Remove the attributes mentioned in the REMOVE_ATTRIBUTE_DIRECTIVE. You * can add a remove-attribute: directive with a regular expression for * attributes that need to be removed. We also remove all attributes that * have a value of !. This allows you to use macros with ${if} to remove * values. */ void removeAttributes(Attrs attributes) { String remove = attributes.remove(REMOVE_ATTRIBUTE_DIRECTIVE); if (remove != null) { Instructions removeInstr = new Instructions(remove); attributes.keySet() .removeAll(removeInstr.select(attributes.keySet(), false)); } // Remove any ! valued attributes for (Iterator<Entry<String, String>> i = attributes.entrySet() .iterator(); i.hasNext();) { String v = i.next() .getValue(); if (v.equals("!")) i.remove(); } }
public static CapReqBuilder createCapReqBuilder(String namespace, Attrs attrs) throws Exception { CapReqBuilder builder = new CapReqBuilder(namespace); for (String key : attrs.keySet()) { if (key.endsWith(":")) { String value = attrs.get(key); key = key.substring(0, key.length() - 1); builder.addDirective(key, value); } else { Object value = attrs.getTyped(key); builder.addAttribute(key, value); } } return builder; }
public static CapReqBuilder createCapReqBuilder(String namespace, Attrs attrs) throws Exception { CapReqBuilder builder = new CapReqBuilder(namespace); for (String key : attrs.keySet()) { if (key.endsWith(":")) { String value = attrs.get(key); key = key.substring(0, key.length() - 1); builder.addDirective(key, value); } else { Object value = attrs.getTyped(key); builder.addAttribute(key, value); } } return builder; }
public boolean isEqual(Attrs other) { if (this == other) return true; if (other == null || size() != other.size()) return false; if (isEmpty()) return true; TreeSet<String> l = new TreeSet<>(keySet()); TreeSet<String> lo = new TreeSet<>(other.keySet()); if (!l.equals(lo)) return false; for (String key : keySet()) { if (!Objects.equals(get(key), other.get(key))) { return false; } if (getType(key) != other.getType(key)) { return false; } } return true; }
/** * @param attrs */ void verifyAttrs(Attrs attrs) { for (String a : attrs.keySet()) { String v = attrs.get(a); if (!a.endsWith(":")) { Attrs.Type t = attrs.getType(a); if ("version".equals(a)) { if (t != Attrs.Type.VERSION) error("Version attributes should always be of type version, it is %s", t); } else verifyType(t, v); } } }
/** * @param attrs */ void verifyAttrs(Attrs attrs) { for (String a : attrs.keySet()) { String v = attrs.get(a); if (!a.endsWith(":")) { Attrs.Type t = attrs.getType(a); if ("version".equals(a)) { if (t != Attrs.Type.VERSION) error("Version attributes should always be of type version, it is %s", t); } else verifyType(t, v); } } }
public boolean isEqual(Attrs o) { if (this == o) return true; Attrs other = o; if (size() != other.size()) return false; if (isEmpty()) return true; SortedList<String> l = new SortedList<String>(keySet()); SortedList<String> lo = new SortedList<String>(other.keySet()); if (!l.isEqual(lo)) return false; for (String key : keySet()) { if (!get(key).equals(other.get(key))) return false; } return true; }
/** * @param attrs */ void verifyAttrs(String key, Attrs attrs) { for (String a : attrs.keySet()) { String v = attrs.get(a); if (!a.endsWith(":")) { Attrs.Type t = attrs.getType(a); if ("version".equals(a)) { if (t != Attrs.Type.VERSION && t != Attrs.Type.VERSIONS) error( "Version attributes should always be of type Version or List<Version>, it is version:%s=%s for %s", t, v, key); } else verifyType(t, v); } } }
/** * @param attrs */ void verifyAttrs(Attrs attrs) { for (String a : attrs.keySet()) { String v = attrs.get(a); if (!a.endsWith(":")) { Attrs.Type t = attrs.getType(a); if ("version".equals(a)) { if (t != Attrs.Type.VERSION) error("Version attributes should always be of type version, it is %s", t); } else verifyType(t, v); } } }
/** * Fixup Attributes Execute any macros on an export and */ void fixupAttributes(Attrs attributes) { // Convert any attribute values that have macros. for (String key : attributes.keySet()) { String value = attributes.get(key); if (value.indexOf('$') >= 0) { value = getReplacer().process(value); attributes.put(key, value); } } }
/** * @param attrs */ void verifyAttrs(String key, Attrs attrs) { for (String a : attrs.keySet()) { String v = attrs.get(a); if (!a.endsWith(":")) { Attrs.Type t = attrs.getType(a); if ("version".equals(a)) { if (t != Attrs.Type.VERSION && t != Attrs.Type.VERSIONS) error( "Version attributes should always be of type Version or List<Version>, it is version:%s=%s for %s", t, v, key); } else verifyType(t, v); } } }
/** * Fixup Attributes Execute any macros on an export and * * @throws IOException */ void fixupAttributes(PackageRef packageRef, Attrs attributes) throws IOException { // Convert any attribute values that have macros. for (String key : attributes.keySet()) { String value = attributes.get(key); if (value.indexOf('$') >= 0) { value = getReplacer().process(value); attributes.put(key, value); } if (!key.endsWith(":")) { String from = attributes.get(FROM_DIRECTIVE); verifyAttribute(from, "package info for " + packageRef, key, value); } } }
/** * Fixup Attributes Execute any macros on an export and * * @throws IOException */ void fixupAttributes(PackageRef packageRef, Attrs attributes) throws IOException { // Convert any attribute values that have macros. for (String key : attributes.keySet()) { String value = attributes.get(key); if (value.indexOf('$') >= 0) { value = getReplacer().process(value); attributes.put(key, value); } if (!key.endsWith(":")) { String from = attributes.get("from:"); verifyAttribute(from, "package info for " + packageRef, key, value); } } }
/** * Fixup Attributes Execute any macros on an export and * * @throws IOException */ void fixupAttributes(PackageRef packageRef, Attrs attributes) throws IOException { // Convert any attribute values that have macros. for (String key : attributes.keySet()) { String value = attributes.get(key); if (value.indexOf('$') >= 0) { value = getReplacer().process(value); attributes.put(key, value); } if (!key.endsWith(":")) { String from = attributes.get("from:"); verifyAttribute(from, "package info for " + packageRef, key, value); } } }
/** * Fixup Attributes Execute any macros on an export and * * @throws IOException */ void fixupAttributes(PackageRef packageRef, Attrs attributes) throws IOException { // Convert any attribute values that have macros. for (String key : attributes.keySet()) { String value = attributes.get(key); if (value.indexOf('$') >= 0) { value = getReplacer().process(value); attributes.put(key, value); } if (!key.endsWith(":")) { String from = attributes.get(FROM_DIRECTIVE); verifyAttribute(from, "package info for " + packageRef, key, value); } } }
/** * Ensure that we are running on the correct bnd. */ protected void doRequireBnd() { Attrs require = OSGiHeader.parseProperties(getProperty(REQUIRE_BND)); if (require == null || require.isEmpty()) return; Hashtable<String, String> map = new Hashtable<>(); map.put(Constants.VERSION_FILTER, getBndVersion()); for (String filter : require.keySet()) { try { Filter f = new Filter(filter); if (f.match(map)) continue; error("%s fails for filter %s values=%s", REQUIRE_BND, require.get(filter), map); } catch (Exception t) { exception(t, "%s with value %s throws exception", REQUIRE_BND, require); } } }