Package org.osgi.framework

Examples of org.osgi.framework.Version.compareTo()


            if (i == 0) {
                idx = 0;
                v = resources[i].getVersion();
            } else {
                Version vtmp = resources[i].getVersion();
                if (vtmp.compareTo(v) > 0) {
                    idx = i;
                    v = vtmp;
                }
            }
        }
View Full Code Here


            public int compare(Object o1, Object o2)
            {
                Version v1 = ((Bundle) o1).adapt(BundleRevision.class).getVersion();
                Version v2 = ((Bundle) o2).adapt(BundleRevision.class).getVersion();
                // Compare in reverse order to get descending sort.
                return v2.compareTo(v1);
            }
        });
        return bundles;
    }
View Full Code Here

                Version v2 = (!cap2.getAttributes().containsKey(Constants.BUNDLE_VERSION_ATTRIBUTE))
                    ? Version.emptyVersion
                    : (Version) cap2.getAttributes().get(Constants.BUNDLE_VERSION_ATTRIBUTE);
                // Compare these in reverse order, since we want
                // highest version to have priority.
                c = v2.compareTo(v1);
            }
        }
        // Compare package capabilities.
        else if ((c == 0) && cap1.getNamespace().equals(BundleRevision.PACKAGE_NAMESPACE))
        {
View Full Code Here

                Version v2 = (!cap2.getAttributes().containsKey(BundleCapabilityImpl.VERSION_ATTR))
                    ? Version.emptyVersion
                    : (Version) cap2.getAttributes().get(BundleCapabilityImpl.VERSION_ATTR);
                // Compare these in reverse order, since we want
                // highest version to have priority.
                c = v2.compareTo(v1);
            }
        }

        // Finally, compare bundle identity.
        if (c == 0)
View Full Code Here

                {
                    return -1;
                }
                else
                {
                    return v2.compareTo(v1);
                }
            }
        }

        private Version findExportVersion(IPackageImport pi, ISigilBundle o1)
View Full Code Here

                v = resources[i].getVersion();
            }
            else
            {
                Version vtmp = resources[i].getVersion();
                if (vtmp.compareTo(v) > 0)
                {
                    idx = i;
                    v = vtmp;
                }
            }
View Full Code Here

            while (top <= bottom)
            {
                middle = (bottom - top) / 2 + top;
                middleVersion = revisions[middle].getVersion();
                // Sort in reverse version order.
                int cmp = middleVersion.compareTo(version);
                if (cmp < 0)
                {
                    bottom = middle - 1;
                }
                else
View Full Code Here

                finalVersion = installedVersion;
                EmbeddedArtifactLocator artifactsLocator = Activator.getDefault().getArtifactLocator();
                EmbeddedArtifact toolingSupportBundle = artifactsLocator.loadToolingSupportBundle();
                Version ourVersion = new Version(toolingSupportBundle.getVersion());

                if (installedVersion == null || ourVersion.compareTo(installedVersion) > 0) {
          // then auto-install it if possible
          try {

                        InputStream contents = null;
                        try {
View Full Code Here

                        if ( oldVersion == null ) {
                            logger.error("Nothing to uninstall. {} is currently not installed.", info);
                            result = new ChangeStateTask(toActivate, ResourceState.IGNORED);
                        } else {

                            final int compare = oldVersion.compareTo(newVersion);
                            if ( compare == 0 ) {
                                result = new UninstallSubsystemTask(toActivate, this.bundleContext, ref);
                            } else {
                                logger.error("Nothing to uninstall. {} is currently not installed, different version is installed {}", info, oldVersion);
                                result = new ChangeStateTask(toActivate, ResourceState.IGNORED);
View Full Code Here

                    // Install
                    if ( rsrc.getState() == ResourceState.INSTALL ) {
                        if ( oldVersion != null ) {

                            final int compare = oldVersion.compareTo(newVersion);
                            if (compare < 0) {
                                // installed version is lower -> update
                                result = new UpdateSubsystemTask(toActivate, this.bundleContext, ref, this.rootSubsystem);
                            } else if ( compare == 0 && isSnapshot(newVersion) ) {
                                // same version but snapshot -> update
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.