Package org.osgi.framework

Examples of org.osgi.framework.Version


  private void displayError(String error, HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    // redirection from
    // FormAuthenticationService.setNotAuthenticated
    String versionString = req.getHeader("Orion-Version"); //$NON-NLS-1$
    Version version = versionString == null ? null : new Version(versionString);

    // TODO: This is a workaround for calls
    // that does not include the WebEclipse version header
    String xRequestedWith = req.getHeader("X-Requested-With"); //$NON-NLS-1$
View Full Code Here


    resp.setHeader("WWW-Authenticate", HttpServletRequest.FORM_AUTH); //$NON-NLS-1$
    resp.setStatus(HttpServletResponse.SC_UNAUTHORIZED);

    // redirection from FormAuthenticationService.setNotAuthenticated
    String versionString = req.getHeader("Orion-Version"); //$NON-NLS-1$
    Version version = versionString == null ? null : new Version(versionString);

    // TODO: This is a workaround for calls
    // that does not include the WebEclipse version header
    String xRequestedWith = req.getHeader("X-Requested-With"); //$NON-NLS-1$
View Full Code Here

    System.err.println("StsTestUtil: " + minimalVersion + " or later? ...");
    boolean found = false;
    try {
      Bundle platformBundle = Platform.getBundle("org.eclipse.platform");
      System.err.println("platform bundle: " + platformBundle);
      Version version = platformBundle.getVersion();
      System.err.println("platform bundle version: " + version);
      if (version.compareTo(minimalVersion) >= 0) {
        found = true;
      }
    }
    catch (Throwable e) {
      System.err.println("StsTestUtil: Couldn't determine Eclipse version");
View Full Code Here

        return admin.discoverResources(sb.toString());
    }

    public Resource selectNewestVersion(Resource[] resources) {
        int idx = -1;
        Version v = null;
        for (int i = 0; (resources != null) && (i < resources.length); i++) {
            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

        for (int i = 0; (bundles != null) && (i < bundles.length); i++)
        {
            String sym = bundles[i].getSymbolicName();
            if ((sym != null) && sym.equals(symbolicName))
            {
                Version v = bundles[i].adapt(BundleRevision.class).getVersion();
                if ((vr == null) || vr.isInRange(v))
                {
                    list.add(bundles[i]);
                }
            }
        }
        if (list.isEmpty())
        {
            return null;
        }
        bundles = (Bundle[]) list.toArray(new Bundle[list.size()]);
        Arrays.sort(bundles,new Comparator() {
            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

                    for (IPackageFragment pkgFragment : newPkgFragments)
                    {
                        IPackageImport pkgImport = ModelElementFactory.getInstance().newModelElement(
                            IPackageImport.class);
                        pkgImport.setPackageName(pkgFragment.getElementName());
                        Version version = dialog.getVersion();
                        if (version == null)
                        {
                            version = getBundle().getVersion();
                        }
                        VersionRange versionRange = ModelHelper.getDefaultRange(version);
View Full Code Here

        {
            String s = range.substring(1, range.length() - 1);
            String vlo = s.substring(0, s.indexOf(',')).trim();
            String vhi = s.substring(s.indexOf(',') + 1, s.length()).trim();
            return new VersionRange (
                new Version(vlo), (range.charAt(0) == '['),
                new Version(vhi), (range.charAt(range.length() - 1) == ']'));
        }
        else
        {
            return new VersionRange(new Version(range), true, null, false);
        }
    }
View Full Code Here

                // Keep track of hosts and associated fragments.
                if (req.getNamespace().equals(HostNamespace.HOST_NAMESPACE))
                {
                    String resSymName = Util.getSymbolicName(req.getResource());
                    Version resVersion = Util.getVersion(req.getResource());

                    Map<String, Map<Version, List<Requirement>>> fragments = hostFragments.get(cap);
                    if (fragments == null)
                    {
                        fragments = new HashMap<String, Map<Version, List<Requirement>>>();
                        hostFragments.put(cap, fragments);
                    }
                    Map<Version, List<Requirement>> fragmentVersions = fragments.get(resSymName);
                    if (fragmentVersions == null)
                    {
                        fragmentVersions =
                            new TreeMap<Version, List<Requirement>>(Collections.reverseOrder());
                        fragments.put(resSymName, fragmentVersions);
                    }
                    List<Requirement> actual = fragmentVersions.get(resVersion);
                    if (actual == null)
                    {
                        actual = new ArrayList<Requirement>();
                        if (resVersion == null)
                            resVersion = new Version(0, 0, 0);
                        fragmentVersions.put(resVersion, actual);
                    }
                    actual.add(req);
                }
            }
View Full Code Here

        {
            c = ((Comparable) cap1.getAttributes().get(BundleRevision.BUNDLE_NAMESPACE))
                .compareTo(cap2.getAttributes().get(BundleRevision.BUNDLE_NAMESPACE));
            if (c == 0)
            {
                Version v1 = (!cap1.getAttributes().containsKey(Constants.BUNDLE_VERSION_ATTRIBUTE))
                    ? Version.emptyVersion
                    : (Version) cap1.getAttributes().get(Constants.BUNDLE_VERSION_ATTRIBUTE);
                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))
        {
            c = ((Comparable) cap1.getAttributes().get(BundleRevision.PACKAGE_NAMESPACE))
                .compareTo(cap2.getAttributes().get(BundleRevision.PACKAGE_NAMESPACE));
            if (c == 0)
            {
                Version v1 = (!cap1.getAttributes().containsKey(BundleCapabilityImpl.VERSION_ATTR))
                    ? Version.emptyVersion
                    : (Version) cap1.getAttributes().get(BundleCapabilityImpl.VERSION_ATTR);
                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

        IFormValueConverter converter = new IFormValueConverter()
        {
            public String getLabel(Object value)
            {
                Version v = (Version) value;
                return v.toString();
            }

            public Object getValue(String label)
            {
                return VersionTable.getVersion(label);
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.