Package aQute.library.capreq.FilterParser

Examples of aQute.library.capreq.FilterParser.Expression


  // @Override
  public Set<ResourceDescriptor> findResources(org.osgi.resource.Requirement requirement, boolean includeDependencies)
      throws Exception {
    FilterParser fp = new FilterParser();
    Expression expression = fp.parse(requirement.getDirectives().get("filter"));
    String query = expression.query();
   
    if ( query == null) {
      return Collections.emptySet();
    }
   
View Full Code Here


    String f = req.getDirectives().get("filter");
    if (f == null)
      return false;

    Expression parse = parser.parse(f);

    return parse.eval(attributes);
  }
View Full Code Here

    return req;
  }

  public List<Capability> findProviders(Requirement rq) throws IOException {
    List<Capability> providers = new ArrayList<Capability>();
    Expression exp = null;
    if (!(rq instanceof RequirementImpl)) {
      exp = parser.parse(rq.getDirectives().get("filter"));
    } else
      exp = ((RequirementImpl) rq).getFilter();
    for (ResourceImpl rs : getResources()) {
      for (Capability cap : rs.getCapabilities(rq.getNamespace())) {
        if (exp.eval(cap.getAttributes()))
          providers.add(cap);
      }
    }
    return providers;
  }
View Full Code Here

TOP

Related Classes of aQute.library.capreq.FilterParser.Expression

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.