use of aQute.libg.filters.AndFilter in project bnd by bndtools.
the class CapReqBuilder method createPackageRequirement.
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());
}
use of aQute.libg.filters.AndFilter in project bnd by bndtools.
the class CapReqBuilder method createBundleRequirement.
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());
}
use of aQute.libg.filters.AndFilter in project bndtools by bndtools.
the class RunBlacklistPart method createRequirement.
private static Requirement createRequirement(Object elem) {
String bsn = null;
Version version = null;
if (elem instanceof RepositoryBundle) {
bsn = ((RepositoryBundle) elem).getBsn();
} else if (elem instanceof RepositoryBundleVersion) {
RepositoryBundleVersion rbv = (RepositoryBundleVersion) elem;
bsn = rbv.getBsn();
version = rbv.getVersion();
} else if (elem instanceof ProjectBundle) {
bsn = ((ProjectBundle) elem).getBsn();
}
if (bsn != null) {
Filter filter = new SimpleFilter(IdentityNamespace.IDENTITY_NAMESPACE, bsn);
if (version != null) {
filter = new AndFilter().addChild(filter).addChild(new SimpleFilter("version", Operator.GreaterThanOrEqual, version.toString()));
}
Requirement req = new CapReqBuilder(IdentityNamespace.IDENTITY_NAMESPACE).addDirective(Namespace.REQUIREMENT_FILTER_DIRECTIVE, filter.toString()).buildSyntheticRequirement();
return req;
}
return null;
}
use of aQute.libg.filters.AndFilter in project bndtools by bndtools.
the class ResolutionSuccessPanel method resourceToRequirement.
private static Requirement resourceToRequirement(Resource resource) {
Capability identity = ResourceUtils.getIdentityCapability(resource);
String id = ResourceUtils.getIdentity(identity);
Version version = ResourceUtils.getVersion(identity);
Version dropQualifier = new Version(version.getMajor(), version.getMinor(), version.getMicro());
AndFilter filter = new AndFilter();
filter.addChild(new SimpleFilter(IdentityNamespace.IDENTITY_NAMESPACE, id));
filter.addChild(new LiteralFilter(Filters.fromVersionRange(dropQualifier.toString())));
Requirement req = new CapReqBuilder(IdentityNamespace.IDENTITY_NAMESPACE).addDirective(Namespace.REQUIREMENT_FILTER_DIRECTIVE, filter.toString()).buildSyntheticRequirement();
return req;
}
use of aQute.libg.filters.AndFilter in project bnd by bndtools.
the class AbstractResolveContext method createIdentityRequirement.
public static Requirement createIdentityRequirement(String identity, String versionRange) {
// Construct a filter & requirement to find matches
Filter filter = new SimpleFilter(IdentityNamespace.IDENTITY_NAMESPACE, identity);
if (versionRange != null)
filter = new AndFilter().addChild(filter).addChild(new LiteralFilter(Filters.fromVersionRange(versionRange)));
Requirement frameworkReq = new CapReqBuilder(IdentityNamespace.IDENTITY_NAMESPACE).addDirective(Namespace.REQUIREMENT_FILTER_DIRECTIVE, filter.toString()).buildSyntheticRequirement();
return frameworkReq;
}
Aggregations