Package org.osgi.framework

Examples of org.osgi.framework.Version


        // First compare symbolic names
        int result = getBundleSymbolicName().compareTo(other.getBundleSymbolicName());
       
        // Then compare versions
        if(result == EQUAL) {
            final Version va = getVersion();
            final Version vb = other.getVersion();
            if(va == null && vb == null) {
                // result = EQUAL
            } else if(vb == null) {
                result = A_GREATER;
            } else if(va == null) {
View Full Code Here


                isSnapshot = false;
                lastModified = BND_LAST_MODIFIED_MISSING;
            } else {
                symbolicName = m.getMainAttributes().getValue(Constants.BUNDLE_SYMBOLICNAME);
                final String v = m.getMainAttributes().getValue(Constants.BUNDLE_VERSION);
                version = v == null ? null : new Version(v);
                isSnapshot = v != null && v.contains(SNAPSHOT_MARKER);
                final String last = m.getMainAttributes().getValue(BND_LAST_MODIFIED);
                long lastMod = BND_LAST_MODIFIED_MISSING;
                if(last != null) {
                    try {
View Full Code Here

     * @param bundleContext Provides access to the "Bundle-Version" manifest
     *            header of the containing bundle.
     */
    private void setProductInfo(final BundleContext bundleContext) {
        final Dictionary<?, ?> props = bundleContext.getBundle().getHeaders();
        final Version bundleVersion = Version.parseVersion((String) props.get(Constants.BUNDLE_VERSION));
        final String productVersion = bundleVersion.getMajor() + "."
            + bundleVersion.getMinor();
        this.productInfo = PRODUCT_NAME + "/" + productVersion;

        // update the server info
        this.setServerInfo();
    }
View Full Code Here

        Bundle current = get(newBnd, false);
        if (current != null) {
            final Maven2OsgiConverter converter = new DefaultMaven2OsgiConverter();

            // compare versions, the highest will be used
            final Version newVersion = new Version(converter.getVersion(newBnd.getVersion()));
            final Version oldVersion = new Version(converter.getVersion(current.getVersion()));
            if ( newVersion.compareTo(oldVersion) > 0 ) {
                current.setVersion(newBnd.getVersion());
            }
        } else {
            StartLevel startLevel = null;
View Full Code Here

      return;
    }

    List<AbstractBundle> list = new ArrayList<AbstractBundle>(bundles.length + 1);
    // find place to insert the bundle
    Version newVersion = bundle.getVersion();
    boolean added = false;
    for (int i = 0; i < bundles.length; i++) {
      AbstractBundle oldBundle = bundles[i];
      Version oldVersion = oldBundle.getVersion();
      if (!added && newVersion.compareTo(oldVersion) >= 0) {
        added = true;
        list.add(bundle);
      }
      list.add(oldBundle);
View Full Code Here

            final CellEditor textEditor = new TextCellEditor(viewer.getTable());
            textEditor.setValidator(new ICellEditorValidator() {
                @Override
                public String isValid(Object value) {
                    String versionStr = String.valueOf(value);
                    Version v = Version.emptyVersion;

                    try {
                        v = Version.parseVersion(String.valueOf(value));
                    } catch (IllegalArgumentException iae) {
                        return MessageFormat.format(Messages.PackageInfoDialog_VersionInvalid, versionStr);
View Full Code Here

        }

        @Override
        protected void setValue(Object element, Object userInputValue) {
            FileVersionTuple pkg = (FileVersionTuple) element;
            pkg.setVersion(new Version(String.valueOf(userInputValue)));
            getViewer().update(element, null);
        }
View Full Code Here

        public FileVersionTuple(String pkgName, File file) {
            this.name = pkgName;
            this.file = file;
           
            setVersion(new Version(1, 0, 0));
        }
View Full Code Here

            Capability identityCap = ResourceUtils.getIdentityCapability(resource);

            String name = ResourceUtils.getIdentity(identityCap);
            label.append(name);

            Version version = ResourceUtils.getVersion(identityCap);
            label.append(" " + version, StyledString.COUNTER_STYLER);
        } catch (IllegalArgumentException e) {
            label.append("<unknown>");
        }
View Full Code Here

        int ret = name1.compareTo(name2);
        if (ret != 0) {
            return ret;
        }

        Version ver1 = ResourceUtils.getVersion(id1);
        if (ver1 == null) {
            ver1 = Version.emptyVersion;
        }
        Version ver2 = ResourceUtils.getVersion(id2);
        if (ver2 == null) {
            ver2 = Version.emptyVersion;
        }
        return ver1.compareTo(ver2);
    }
View Full Code Here

TOP

Related Classes of org.osgi.framework.Version

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.