Search in sources :

Example 1 with MapToDictionaryAdapter

use of aQute.bnd.deployer.repository.MapToDictionaryAdapter in project bnd by bndtools.

the class AbstractResolveContext method matches.

private boolean matches(Requirement requirement, Capability selfCap) {
    boolean match = false;
    if (isCorrectEffectiveness(requirement, selfCap)) {
        try {
            String filterStr = requirement.getDirectives().get(Namespace.REQUIREMENT_FILTER_DIRECTIVE);
            org.osgi.framework.Filter filter = filterStr != null ? org.osgi.framework.FrameworkUtil.createFilter(filterStr) : null;
            if (filter == null)
                match = true;
            else
                match = filter.match(new MapToDictionaryAdapter(selfCap.getAttributes()));
        } catch (InvalidSyntaxException e) {
            log.log(LogService.LOG_ERROR, "Invalid filter directive on requirement: " + requirement, e);
        }
    }
    return match;
}
Also used : MapToDictionaryAdapter(aQute.bnd.deployer.repository.MapToDictionaryAdapter) InvalidSyntaxException(org.osgi.framework.InvalidSyntaxException)

Aggregations

MapToDictionaryAdapter (aQute.bnd.deployer.repository.MapToDictionaryAdapter)1 InvalidSyntaxException (org.osgi.framework.InvalidSyntaxException)1