@Override public boolean matches(ServiceReference<?> serviceReference) { BasicServiceReference<?> basicServiceReference = (BasicServiceReference<?>)serviceReference; Dictionary<String, Object> dictionary = new UnmodifiableCaseInsensitiveMapDictionary<>( basicServiceReference._properties); return _filter.match(dictionary); }
@Override public boolean matches(Map<String, Object> properties) { Dictionary<String, Object> dictionary = new UnmodifiableCaseInsensitiveMapDictionary<>(properties); return _filter.match(dictionary); }
List<Resource> narrowVersionsByFilter(String pkgName, SortedMap<Version, Resource> versionMap, Filter filter) { List<Resource> result = new ArrayList<Resource>(versionMap.size()); Dictionary<String, String> dict = new Hashtable<String, String>(); dict.put("package", pkgName); for (Version version : versionMap.keySet()) { dict.put("version", version.toString()); if (filter.match(dict)) result.add(versionMap.get(version)); } return result; }
static List<Resource> narrowVersionsByFilter(String pkgName, SortedMap<Version, Resource> versionMap, Filter filter) throws Exception { List<Resource> result = new ArrayList<>(versionMap.size()); Dictionary<String, String> dict = new Hashtable<>(); dict.put("package", pkgName); for (Entry<Version, Resource> entry : versionMap.entrySet()) { dict.put("version", entry.getKey() .toString()); if (filter.match(dict)) result.add(entry.getValue()); } return result; }
static List<Resource> narrowVersionsByFilter(String pkgName, SortedMap<Version, Resource> versionMap, Filter filter) throws Exception { List<Resource> result = new ArrayList<>(versionMap.size()); Dictionary<String, String> dict = new Hashtable<>(); dict.put("package", pkgName); for (Entry<Version, Resource> entry : versionMap.entrySet()) { dict.put("version", entry.getKey() .toString()); if (filter.match(dict)) result.add(entry.getValue()); } return result; }
/** * Ensure that we are running on the correct bnd. */ void doRequireBnd() { Map<String, String> require = OSGiHeader.parseProperties(getProperty(REQUIRE_BND)); if (require == null || require.isEmpty()) return; Hashtable<String, String> map = new Hashtable<String, String>(); 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 %s", REQUIRE_BND, require.get(filter)); } catch (Exception t) { error("%s with value %s throws exception", t, REQUIRE_BND, require); } } }
void filterResourcesByResolverMode(Collection<Resource> resources, ResolverMode mode) { assert mode != null; Properties modeCapability = new Properties(); modeCapability.setProperty(CapabilityType.MODE.getTypeName(), mode.name()); for (Iterator<Resource> iter = resources.iterator(); iter.hasNext(); ) { Resource resource = iter.next(); Require modeRequire = resource.findRequire(CapabilityType.MODE.getTypeName()); if (modeRequire == null) continue; else if (modeRequire.getFilter() == null) iter.remove(); else { try { Filter filter = new Filter(modeRequire.getFilter()); if (!filter.match(modeCapability)) iter.remove(); } catch (IllegalArgumentException e) { synchronized (this) { if (reporter != null) reporter.error("Error parsing mode filter requirement on resource %s: %s", resource.getUrl(), modeRequire.getFilter()); } iter.remove(); } } } }
realNames.add("resources"); if (filter != null) { if (!filter.match(ht)) continue;
/** * 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); } } }
/** * Ensure that we are running on the correct bnd. */ void doRequireBnd() { Attrs require = OSGiHeader.parseProperties(getProperty(REQUIRE_BND)); if (require == null || require.isEmpty()) return; Hashtable<String,String> map = new Hashtable<String,String>(); 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 %s", REQUIRE_BND, require.get(filter)); } catch (Exception t) { error("%s with value %s throws exception", t, REQUIRE_BND, require); } } }
/** * 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); } } }
/** * Ensure that we are running on the correct bnd. */ void doRequireBnd() { Attrs require = OSGiHeader.parseProperties(getProperty(REQUIRE_BND)); if (require == null || require.isEmpty()) return; Hashtable<String,String> map = new Hashtable<String,String>(); 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 %s", REQUIRE_BND, require.get(filter)); } catch (Exception t) { error("%s with value %s throws exception", t, REQUIRE_BND, require); } } }
/** * Ensure that we are running on the correct bnd. */ void doRequireBnd() { Attrs require = OSGiHeader.parseProperties(getProperty(REQUIRE_BND)); if (require == null || require.isEmpty()) return; Hashtable<String,String> map = new Hashtable<String,String>(); 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 %s", REQUIRE_BND, require.get(filter)); } catch (Exception t) { error("%s with value %s throws exception", t, REQUIRE_BND, require); } } }