Package aQute.bnd.version

Examples of aQute.bnd.version.VersionRange


        String versionRangeStr;
        if (isWorkspace(resource)) {
            versionRangeStr = VERSION_LATEST;
        } else {
            Version version = ResourceUtils.getVersion(idCap);
            VersionRange versionRange = createVersionRange(version);
            versionRangeStr = versionRange.toString();
        }
        attribs.put(Constants.VERSION_ATTRIBUTE, versionRangeStr);

        return new VersionedClause(identity, attribs);
View Full Code Here


    private static VersionRange createVersionRange(Version version) {
        Version base = new Version(version.getMajor(), version.getMinor(), version.getMicro());
        Version next = new Version(version.getMajor(), version.getMinor(), version.getMicro() + 1);

        return new VersionRange(String.format("[%s,%s)", base, next));
    }
View Full Code Here

            // Check if this is a self-import
            boolean selfImport = false;
            List<ExportPackage> matchingExports = exports.get(pkgName);
            if (matchingExports != null) {
                String versionRangeStr = importAttribs.get(Constants.VERSION_ATTRIBUTE);
                VersionRange versionRange = (versionRangeStr != null) ? new VersionRange(versionRangeStr) : new VersionRange("0");
                for (ExportPackage export : matchingExports) {
                    String versionStr = export.getAttribs().get(Constants.VERSION_ATTRIBUTE);
                    Version version = (versionStr != null) ? new Version(versionStr) : new Version(0);
                    if (versionRange.includes(version)) {
                        selfImport = true;
                        break;
                    }
                }
            }
            ImportPackage importPackage = new ImportPackage(pkgName, selfImport, importAttribs, usedBy.get(pkgName), classMap);
            List<ImportPackage> importList = imports.get(pkgName);
            if (importList == null) {
                importList = new LinkedList<ImportPackage>();
                imports.put(pkgName, importList);
            }
            importList.add(importPackage);
        }

        // Process require-bundles
        String requireBundlesStr = attribs.getValue(Constants.REQUIRE_BUNDLE);
        final Parameters requiredBundleMap = new Parameters(requireBundlesStr);
        for (Entry<String,Attrs> entry : requiredBundleMap.entrySet()) {
            String name = entry.getKey();
            Attrs rbAttribs = entry.getValue();

            // Check if the required bundle is already included in the closure
            boolean satisfied = false;
            Set<Version> includedVersions = bundleVersions.get(name);
            if (includedVersions != null) {
                String versionRangeStr = rbAttribs.get(Constants.BUNDLE_VERSION_ATTRIBUTE);
                VersionRange versionRange = (versionRangeStr != null) ? new VersionRange(versionRangeStr) : new VersionRange("0");
                for (Version includedVersion : includedVersions) {
                    if (versionRange.includes(includedVersion)) {
                        satisfied = true;
                        break;
                    }
                }
            }
View Full Code Here

        String versionRangeStr;
        if (isWorkspace(resource)) {
            versionRangeStr = VERSION_LATEST;
        } else {
            Version version = ResourceUtils.getVersion(idCap);
            VersionRange versionRange = createVersionRange(version);
            versionRangeStr = versionRange.toString();
        }
        attribs.put(Constants.VERSION_ATTRIBUTE, versionRangeStr);

        return new VersionedClause(identity, attribs);
View Full Code Here

    private static VersionRange createVersionRange(Version version) {
        Version base = new Version(version.getMajor(), version.getMinor(), version.getMicro());
        Version next = new Version(version.getMajor(), version.getMinor(), version.getMicro() + 1);

        return new VersionRange(String.format("[%s,%s)", base, next));
    }
View Full Code Here

            // Check if this is a self-import
            boolean selfImport = false;
            List<ExportPackage> matchingExports = exports.get(pkgName);
            if (matchingExports != null) {
                String versionRangeStr = importAttribs.get(Constants.VERSION_ATTRIBUTE);
                VersionRange versionRange = (versionRangeStr != null) ? new VersionRange(versionRangeStr) : new VersionRange("0");
                for (ExportPackage export : matchingExports) {
                    String versionStr = export.getAttribs().get(Constants.VERSION_ATTRIBUTE);
                    Version version = (versionStr != null) ? new Version(versionStr) : new Version(0);
                    if (versionRange.includes(version)) {
                        selfImport = true;
                        break;
                    }
                }
            }
            ImportPackage importPackage = new ImportPackage(pkgName, selfImport, importAttribs, usedBy.get(pkgName), classMap);
            List<ImportPackage> importList = imports.get(pkgName);
            if (importList == null) {
                importList = new LinkedList<ImportPackage>();
                imports.put(pkgName, importList);
            }
            importList.add(importPackage);
        }

        // Process require-bundles
        String requireBundlesStr = attribs.getValue(Constants.REQUIRE_BUNDLE);
        final Parameters requiredBundleMap = new Parameters(requireBundlesStr);
        for (Entry<String,Attrs> entry : requiredBundleMap.entrySet()) {
            String name = entry.getKey();
            Attrs rbAttribs = entry.getValue();

            // Check if the required bundle is already included in the closure
            boolean satisfied = false;
            Set<Version> includedVersions = bundleVersions.get(name);
            if (includedVersions != null) {
                String versionRangeStr = rbAttribs.get(Constants.BUNDLE_VERSION_ATTRIBUTE);
                VersionRange versionRange = (versionRangeStr != null) ? new VersionRange(versionRangeStr) : new VersionRange("0");
                for (Version includedVersion : includedVersions) {
                    if (versionRange.includes(includedVersion)) {
                        satisfied = true;
                        break;
                    }
                }
            }
View Full Code Here

TOP

Related Classes of aQute.bnd.version.VersionRange

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.