Search in sources :

Example 1 with LiteralFilter

use of aQute.libg.filters.LiteralFilter 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;
}
Also used : LiteralFilter(aQute.libg.filters.LiteralFilter) CapReqBuilder(aQute.bnd.osgi.resource.CapReqBuilder) AndFilter(aQute.libg.filters.AndFilter) Requirement(org.osgi.resource.Requirement) SimpleFilter(aQute.libg.filters.SimpleFilter) AndFilter(aQute.libg.filters.AndFilter) Filter(aQute.libg.filters.Filter) LiteralFilter(aQute.libg.filters.LiteralFilter) SimpleFilter(aQute.libg.filters.SimpleFilter)

Example 2 with LiteralFilter

use of aQute.libg.filters.LiteralFilter 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());
}
Also used : LiteralFilter(aQute.libg.filters.LiteralFilter) AndFilter(aQute.libg.filters.AndFilter) SimpleFilter(aQute.libg.filters.SimpleFilter) AndFilter(aQute.libg.filters.AndFilter) Filter(aQute.libg.filters.Filter) LiteralFilter(aQute.libg.filters.LiteralFilter) SimpleFilter(aQute.libg.filters.SimpleFilter)

Example 3 with LiteralFilter

use of aQute.libg.filters.LiteralFilter 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());
}
Also used : LiteralFilter(aQute.libg.filters.LiteralFilter) AndFilter(aQute.libg.filters.AndFilter) SimpleFilter(aQute.libg.filters.SimpleFilter) AndFilter(aQute.libg.filters.AndFilter) Filter(aQute.libg.filters.Filter) LiteralFilter(aQute.libg.filters.LiteralFilter) SimpleFilter(aQute.libg.filters.SimpleFilter)

Example 4 with LiteralFilter

use of aQute.libg.filters.LiteralFilter 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;
}
Also used : LiteralFilter(aQute.libg.filters.LiteralFilter) CapReqBuilder(aQute.bnd.osgi.resource.CapReqBuilder) AndFilter(aQute.libg.filters.AndFilter) Requirement(org.osgi.resource.Requirement) Capability(org.osgi.resource.Capability) Version(org.osgi.framework.Version) SimpleFilter(aQute.libg.filters.SimpleFilter)

Example 5 with LiteralFilter

use of aQute.libg.filters.LiteralFilter in project bnd by bndtools.

the class CapReqBuilder method createSimpleRequirement.

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());
}
Also used : LiteralFilter(aQute.libg.filters.LiteralFilter) AndFilter(aQute.libg.filters.AndFilter) SimpleFilter(aQute.libg.filters.SimpleFilter) AndFilter(aQute.libg.filters.AndFilter) Filter(aQute.libg.filters.Filter) LiteralFilter(aQute.libg.filters.LiteralFilter) SimpleFilter(aQute.libg.filters.SimpleFilter)

Aggregations

AndFilter (aQute.libg.filters.AndFilter)7 LiteralFilter (aQute.libg.filters.LiteralFilter)7 SimpleFilter (aQute.libg.filters.SimpleFilter)7 Filter (aQute.libg.filters.Filter)6 CapReqBuilder (aQute.bnd.osgi.resource.CapReqBuilder)4 Requirement (org.osgi.resource.Requirement)4 VersionedClause (aQute.bnd.build.model.clauses.VersionedClause)2 RepoBundleSelectionWizard (bndtools.wizards.repo.RepoBundleSelectionWizard)2 LinkedHashSet (java.util.LinkedHashSet)2 IStatus (org.eclipse.core.runtime.IStatus)2 Status (org.eclipse.core.runtime.Status)2 WizardDialog (org.eclipse.jface.wizard.WizardDialog)2 Version (org.osgi.framework.Version)1 Capability (org.osgi.resource.Capability)1