Example #1
0
  public static CapReqBuilder createBundleRequirement(String bsn, String range) {
    Filter filter;
    SimpleFilter bsnFilter = new SimpleFilter(IdentityNamespace.IDENTITY_NAMESPACE, bsn);
    if (range != null)
      filter =
          new AndFilter()
              .addChild(bsnFilter)
              .addChild(new LiteralFilter(Filters.fromVersionRange(range)));
    else filter = bsnFilter;

    return new CapReqBuilder(IdentityNamespace.IDENTITY_NAMESPACE)
        .addDirective(Namespace.REQUIREMENT_FILTER_DIRECTIVE, filter.toString());
  }
Example #2
0
  public static CapReqBuilder createSimpleRequirement(String ns, String name, String range) {
    Filter filter;
    SimpleFilter bsnFilter = new SimpleFilter(ns, name);
    if (range != null)
      filter =
          new AndFilter()
              .addChild(bsnFilter)
              .addChild(new LiteralFilter(Filters.fromVersionRange(range)));
    else filter = bsnFilter;

    return new CapReqBuilder(ns)
        .addDirective(Namespace.REQUIREMENT_FILTER_DIRECTIVE, filter.toString());
  }
Example #3
0
  public static final CapReqBuilder createPackageRequirement(String pkgName, String range) {
    Filter filter;
    SimpleFilter pkgNameFilter = new SimpleFilter(PackageNamespace.PACKAGE_NAMESPACE, pkgName);
    if (range != null)
      filter =
          new AndFilter()
              .addChild(pkgNameFilter)
              .addChild(new LiteralFilter(Filters.fromVersionRange(range)));
    else filter = pkgNameFilter;

    return new CapReqBuilder(PackageNamespace.PACKAGE_NAMESPACE)
        .addDirective(Namespace.REQUIREMENT_FILTER_DIRECTIVE, filter.toString());
  }