Package org.osgi.framework

Examples of org.osgi.framework.Version


      final Iterator itEe = ba.pkgExportMap.entrySet().iterator();
      while (itEe.hasNext()) {
        final Map.Entry eE = (Map.Entry) itEe.next();
        final String pkgName = (String) eE.getKey();
        final Version pkgVersion = (Version) eE.getValue();

        SortedMap versions = (SortedMap) allExports.get(pkgName);
        if (null == versions) {
          versions = new TreeMap();
          allExports.put(pkgName, versions);
        }

        SortedSet exporters = (SortedSet) versions.get(pkgVersion);
        if (null == exporters) {
          exporters = new TreeSet();
          versions.put(pkgVersion, exporters);
        }
        exporters.add(ba);
      }
    }

    // For each bundle build the pkgProvidersMap
    for (Iterator itBa = allBundleArchives.iterator(); itBa.hasNext();) {
      final BundleArchive ba = (BundleArchive) itBa.next();

      final Iterator itIe = ba.pkgImportMap.entrySet().iterator();
      while (itIe.hasNext()) {
        final Map.Entry iE = (Map.Entry) itIe.next();
        final String pkgName = (String) iE.getKey();
        final VersionRange range = (VersionRange) iE.getValue();

        SortedMap versions = (SortedMap) allExports.get(pkgName);
        if (null != versions) {
          final Iterator itV = versions.entrySet().iterator();
          while (itV.hasNext()) {
            final Map.Entry vE = (Map.Entry) itV.next();
            final Version pkgVersion = (Version) vE.getKey();

            if (range.contains(pkgVersion)) {
              final SortedSet providers = (SortedSet) vE.getValue();

              final Iterator itP = providers.iterator();
View Full Code Here


            record = records[0];
          }
        } else {
          record = m_brs.getBundleRecord(
                                         pc.getTargetName(i),
                                         new Version(pc.getTargetVersion(i)));
        }

        if (record != null) {
          record.printAttributes(out);
        } else {
View Full Code Here

          // check for an update, so ignore the bundle.
          continue;
        }

        // Get the local bundle's version.
        Version localVersion = bundles[bundleIdx].getVersion();

        // Get the matching repository bundle records.
        BundleRecord[] records = m_brs.getBundleRecords((String) bundles[bundleIdx].getHeaders().get(Constants.BUNDLE_NAME));

        // Loop through all records to see if there is an update.
        for (int recordIdx = 0;
             (records != null) && (recordIdx < records.length);
             recordIdx++) {
          String remoteLoc = (String)
            records[recordIdx].getAttribute(BundleRecord.BUNDLE_UPDATELOCATION);
          if (remoteLoc == null) {
            continue;
          }

          // If the update locations are equal, then compare versions.
          if (remoteLoc.equals(localLoc)) {
            String remoteVersionS = (String)
              records[recordIdx].getAttribute(BundleRecord.BUNDLE_VERSION);
            if (remoteVersionS != null) {
              Version remoteVersion = new Version(remoteVersionS);
              int result = remoteVersion.compareTo(localVersion);
              if (result > 0) {
                out.println(records[recordIdx].getAttribute(BundleRecord.BUNDLE_NAME)
                            + " update available.");
                break;
              }
View Full Code Here

          m_brs.getBundleRecords(name);
        if (records.length == 1) {
          record = records[0];
        }
      } else {
        record = m_brs.getBundleRecord(name, new Version(versionString));
      }

      return record;
    }
View Full Code Here

              bundle = matchingBundles[0];
            }
        }
      } else {
        // Find the local bundle by name and version.
        bundle = findLocalBundleByVersion(name, new Version(versionString));
      }

      return bundle;
    }
View Full Code Here

      // Find bundle with matching version.
      if (targets.length > 0) {
        for (int i = 0; i < targets.length; i++) {
          String targetName = (String)
            targets[i].getHeaders().get(BundleRecord.BUNDLE_NAME);
          Version targetVersion = targets[i].getVersion();

          if ((targetName != null) && targetName.equalsIgnoreCase(name) &&
              0==targetVersion.compareTo(version)) {
            return targets[i];
          }
        }
      }
View Full Code Here

      boolean cp = vr.endsWith(")");
      boolean cb = vr.endsWith("]");
      int comma = vr.indexOf(',');

      if (comma > 0 && (cp || cb)) {
        low = new Version(vr.substring(1, comma).trim());
        high = new Version(vr.substring(comma + 1, vr.length() - 1).trim());
        lowIncluded = ob;
        highIncluded = cb;
      } else  {
        throw new NumberFormatException("Illegal version range: " + vr);
      }
    } else {
      low = new Version(vr);
      high = null;
      lowIncluded = true;
      highIncluded = false;
    }
  }
View Full Code Here

      sb.append("<br>");

      sb.append("<font color=\"#444444\">");
      sb.append(epkg.getName());

      final Version version = epkg.getVersion();
      if (version != null) {
        sb.append(" ").append(version);
      }
      if (isShadowed) {
        sb.append(" <i>shadowed</i>");
View Full Code Here

      boolean cp = vr.endsWith(")");
      boolean cb = vr.endsWith("]");
      int comma = vr.indexOf(',');

      if (comma > 0 && (cp || cb)) {
        low = new Version(vr.substring(1, comma).trim());
        high = new Version(vr.substring(comma + 1, vr.length() - 1).trim());
        lowIncluded = ob;
        highIncluded = cb;
      } else  {
        throw new NumberFormatException("Illegal version range: " + vr);
      }
    } else {
      low = new Version(vr);
      high = null;
      lowIncluded = true;
      highIncluded = false;
    }
  }
View Full Code Here

      fwprops.put(Constants.FRAMEWORK_LANGUAGE,
                bc.getProperty(Constants.FRAMEWORK_LANGUAGE));

      String  proc  = bc.getProperty(Constants.FRAMEWORK_PROCESSOR);
      String  os    = bc.getProperty(Constants.FRAMEWORK_OS_NAME);
      Version osVer = new Version(bc.getProperty(Constants.FRAMEWORK_OS_VERSION));
      String osLang = bc.getProperty(Constants.FRAMEWORK_LANGUAGE);
      boolean optional = false;
      List best = null;
      VersionRange bestVer = null;
      boolean bestLang = false;
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.