Package org.osgi.framework

Examples of org.osgi.framework.Version


          if (!bpInfo.providesPackage(packageName)) {
            log("Exported package not provided by bundle: " +packageName,
                Project.MSG_WARN);
          }
          // The Version from the packageinfo-file or null
          final Version piVersion =
            bpInfo.getProvidedPackageVersion(packageName);
          if (null!=piVersion) {
            final String epVersionS = (String) exportPackage.get(packageName);
            if (null==epVersionS) {
              // Use the version form the packageinfo-file
              exportPackage.put(packageName, piVersion.toString());
            } else {
              // Check that the versions match, if not trigger a build error
              try {
                final Version epVersion = Version.parseVersion(epVersionS);
                if (0!=epVersion.compareTo(piVersion)) {
                  final String msg = "Multiple versions found for export of "
                    +"the package '" +packageName
                    +"'. The packageinfo file ("
                    +bpInfo.getProvidedPackageVersionSource(packageName)
                    +") states '" +piVersion.toString()
                    +"' but the <exportpackage> element says '"
                    +epVersion.toString() +"'.";
                  log(msg, Project.MSG_ERR);
                  throw new BuildException(msg);
                }
              } catch (IllegalArgumentException iae) {
                final String msg = "Invalid version '" +epVersionS
View Full Code Here


  private static String toImportRange(final String version)
    throws IllegalArgumentException
  {
    if (null==version || 0==version.length()) return null;

    final Version vStart = Version.parseVersion(version);
    final Version vEnd = new Version(vStart.getMajor()+1, 0, 0, null);
    return "\"[" +vStart.toString() +"," +vEnd.toString() +")\"";
  }
View Full Code Here

    final StringBuffer res = new StringBuffer(255);

    for (Iterator ppIt = providedPackages.iterator(); ppIt.hasNext();) {
      final String pPkg = (String) ppIt.next();
      res.append(pPkg);
      final Version pPkgVersion = getProvidedPackageVersion(pPkg);
      if (null!=pPkgVersion) {
        res.append(";version=").append(pPkgVersion);
      }
      if (ppIt.hasNext()) {
        res.append(", ");
View Full Code Here

    try {
      br = new BufferedReader(new InputStreamReader(res.getInputStream()));
      String line = br.readLine();
      while (null!=line) {
        if (line.startsWith("version ")) {
          final Version version = new Version(line.substring(7).trim());
          return version;
        }
        line = br.readLine();
      }
    } catch (Throwable t) {
View Full Code Here

    // Currently registered path for version providing packageinfo
    // file, if any.
    final String curPkgInfoPath = (String) packageToInfofile.get(pkgName);

    if (null==curPkgInfoPath || !curPkgInfoPath.equals(pkgInfoPath)) {
      final Version newVersion = getVersion(res);
      if (null!=newVersion) {
        final Version curVersion = getProvidedPackageVersion(pkgName);

        if (null==curVersion) {
          packageToVersion.put(pkgName, newVersion);
          packageToInfofile.put(pkgName, pkgInfoPath);
          task.log("Package version for '" +pkgName +"' set to "
View Full Code Here

    res.append("BundlePackagesInfo:\n\t");
    res.append("Provided packages: [");
    for (Iterator ppIt = providedPackages.iterator(); ppIt.hasNext();) {
      final String pPkg = (String) ppIt.next();
      res.append(pPkg);
      final Version pPkgVersion = getProvidedPackageVersion(pPkg);
      if (null!=pPkgVersion) {
        res.append(";version=").append(pPkgVersion);
      }
      if (ppIt.hasNext()) {
        res.append(", ");
View Full Code Here

    this.exclude = Util.parseEnumeration(Constants.EXCLUDE_DIRECTIVE,
                                         (String)tokens.remove(Constants.EXCLUDE_DIRECTIVE));
    String versionStr = (String)tokens.remove(Constants.VERSION_ATTRIBUTE);
    String specVersionStr = (String)tokens.remove(Constants.PACKAGE_SPECIFICATION_VERSION);
    if (specVersionStr != null) {
      this.version = new Version(specVersionStr);
      if (versionStr != null && !this.version.equals(new Version(versionStr))) {
        throw new IllegalArgumentException("Both " + Constants.VERSION_ATTRIBUTE +
                                           "and " + Constants.PACKAGE_SPECIFICATION_VERSION +
                                           "are specified, and differs");
      }
    } else if (versionStr != null) {
      this.version = new Version(versionStr);
    } else {
      this.version = Version.emptyVersion;
    }
    if (tokens.containsKey(Constants.BUNDLE_VERSION_ATTRIBUTE)) {
      throw new IllegalArgumentException("Export definition illegally contains attribute, " +
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

  /**
   * Set value of the Bundle-ManifestVersion manifest header.
   */
  public void setManifestVersion(String manifestVersion) {
    this.manifestVersion = new Version(manifestVersion);
  }
View Full Code Here

  }


  private boolean doUses()
  {
    return bUses && manifestVersion.compareTo(new Version("1")) > 0;
  }
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.