Package org.apache.aries.application

Examples of org.apache.aries.application.VersionRange


          || (Constants.BUNDLE_VERSION_ATTRIBUTE.equals(attribName))) {
        // version and bundle-version attrib requires special
        // conversion.
        realAttrib = true;

        VersionRange vr = ManifestHeaderProcessor
            .parseVersionRange(attrib.getValue());

        filter.append("(" + attribName + ">=" + vr.getMinimumVersion());

        if (vr.getMaximumVersion() != null) {
          filter.append(")(" + attribName + "<=");
          filter.append(vr.getMaximumVersion());
        }

        if (vr.getMaximumVersion() != null && vr.isMinimumExclusive()) {
          filter.append(")(!(" + attribName + "=");
          filter.append(vr.getMinimumVersion());
          filter.append(")");
        }

        if (vr.getMaximumVersion() != null && vr.isMaximumExclusive()) {
          filter.append(")(!(" + attribName + "=");
          filter.append(vr.getMaximumVersion());
          filter.append(")");
        }
        filter.append(")");

      } else if (NESTED_FILTER_ATTRIBUTE.equals(attribName)) {
View Full Code Here


      useBundles.put(c.getContentName(), c.getVersion());
    }
   
    for (BundleInfo info : bundlesRequired) {
     
      VersionRange appContentRange = appContent.get(info.getSymbolicName());
      VersionRange useBundleRange = useBundles.get(info.getSymbolicName());
      DeploymentContent dp = new DeploymentContentImpl(info.getSymbolicName(), info.getVersion());
     
      if ((appContentRange == null) && (useBundleRange == null)){
        _provisionSharedContent.add(dp);
      } else if (appContentRange.matches(info.getVersion())) {
        _deploymentContent.add(dp);
      else if (useBundleRange.matches(info.getVersion())) {
        _deployedUseBundleContent.add(dp);
      }
      else {
        throw new ResolverException("Bundle " + info.getSymbolicName() + " at version " + info.getVersion() + " is not in the range " + appContentRange + " or " + useBundleRange);
      }
View Full Code Here

        boolean isIntersectSuccessful = true;
       
        if (rangeStr1 != null && rangeStr2 != null)
        {
          // Both requirements have a version constraint so check for an intersection between them.
          VersionRange range1 = ManifestHeaderProcessor.parseVersionRange(rangeStr1);
          VersionRange range2 = ManifestHeaderProcessor.parseVersionRange(rangeStr2);
          VersionRange intersectRange = range1.intersect(range2);
         
          if (intersectRange == null)
          {
            // No intersection possible.
            isIntersectSuccessful = false;
          }
          else
          {
            // Use the intersected version range.
            mergedAttribs.put(Constants.VERSION_ATTRIBUTE, intersectRange.toString());
          }
        }
        else if (rangeStr1 != null)
        {
          mergedAttribs.put(Constants.VERSION_ATTRIBUTE, rangeStr1);
View Full Code Here

            // we got it covered in our exports
            value = true;
          }
        } else {
          // parse vi into version range.
          VersionRange vri = ManifestHeaderProcessor.parseVersionRange(vi);
          Version minV = vri.getMinimumVersion();
          Version maxV = vri.getMaximumVersion();
          if (minV.compareTo(new Version(ve)) < 0 && maxV.compareTo(new Version(ve)) > 0) {
            value = true;
          } else if (minV.compareTo(new Version(ve)) == 0 && !!!vri.isMinimumExclusive()) {
            value = true;
          } else if (maxV.compareTo(new Version(ve)) == 0 && !!!vri.isMaximumExclusive()) {
            value = true;
          }
        }

      }
View Full Code Here

    public BundleInfo getBundleInfo(String bundleSymbolicName, Version bundleVersion) {
        Map<String, String> attribs = new HashMap<String, String>();
        // bundleVersion is an exact version - so ensure right version filter is
        // generated
        VersionRange range = ManifestHeaderProcessor.parseVersionRange(bundleVersion.toString(), true);
        attribs.put(Resource.VERSION, range.toString());
        String filterString = ManifestHeaderProcessor.generateFilter(Resource.SYMBOLIC_NAME, bundleSymbolicName,
                attribs);
        Resource[] resources;
        try {
            resources = repositoryAdmin.discoverResources(filterString);
View Full Code Here

                inserts.add(customAttrs);
            }

            if (!unknownType && attrs.containsKey(Constants.VERSION_ATTRIBUTE)) {
                msgKey.append("_WITH_VERSION");
                VersionRange vr = ManifestHeaderProcessor.parseVersionRange(attrs.get(Constants.VERSION_ATTRIBUTE));
                inserts.add(vr.getMinimumVersion());

                if (!!!vr.isExactVersion()) {
                    msgKey.append(vr.isMinimumExclusive() ? "_LOWEX" : "_LOW");
                    if (vr.getMaximumVersion() != null) {
                        msgKey.append(vr.isMaximumExclusive() ? "_UPEX" : "_UP");
                        inserts.add(vr.getMaximumVersion());
                    }
                }
            }

            String msgKeyStr = msgKey.toString();
View Full Code Here

      inserts.add(customAttrs);
    }

    if (!unknownType && attrs.containsKey(Constants.VERSION_ATTRIBUTE)) {
      msgKey.append("_WITH_VERSION");
      VersionRange vr = ManifestHeaderProcessor.parseVersionRange(attrs
          .get(Constants.VERSION_ATTRIBUTE));
      inserts.add(vr.getMinimumVersion());

      if (!!!vr.isExactVersion()) {
        msgKey.append(vr.isMinimumExclusive() ? "_LOWEX" : "_LOW");
        if (vr.getMaximumVersion() != null) {
          msgKey.append(vr.isMaximumExclusive() ? "_UPEX" : "_UP");
          inserts.add(vr.getMaximumVersion());
        }
      }
    }

    String msgKeyStr = msgKey.toString();
View Full Code Here

  public void addDirective(String key, String value) {
    this.directives.put(key, value);
  }
 
  public VersionRange getVersion() {
    VersionRange vi = null;
    if (this.attributes.get(Constants.VERSION_ATTRIBUTE) != null
        && this.attributes.get(Constants.VERSION_ATTRIBUTE).length() > 0) {
      vi = ManifestHeaderProcessor.parseVersionRange(this.attributes.get(Constants.VERSION_ATTRIBUTE));
    } else {
      // what if version is not specified?  let's interpret it as 0.0.0
View Full Code Here

          || (Constants.BUNDLE_VERSION_ATTRIBUTE.equals(attribName))) {
        // version and bundle-version attrib requires special
        // conversion.
        realAttrib = true;

        VersionRange vr = ManifestHeaderProcessor
            .parseVersionRange(attrib.getValue());

        // The RFC of OSGi Bundle Repository (OBR) is still under discussion.
        // According to section "5.11.3 Require-Bundle" in the current version
        // of this RFC (Jan. 2011), we need use version rather than bundle-version
        // in the filter for the "require-bundle" requirement.
        String versionAttribName = "version";
       
        filter.append("(" + versionAttribName + ">=" + vr.getMinimumVersion());

        if (vr.getMaximumVersion() != null) {
          filter.append(")(" + versionAttribName + "<=");
          filter.append(vr.getMaximumVersion());
        }

        if (vr.getMaximumVersion() != null && vr.isMinimumExclusive()) {
          filter.append(")(!(" + versionAttribName + "=");
          filter.append(vr.getMinimumVersion());
          filter.append(")");
        }

        if (vr.getMaximumVersion() != null && vr.isMaximumExclusive()) {
          filter.append(")(!(" + versionAttribName + "=");
          filter.append(vr.getMaximumVersion());
          filter.append(")");
        }
        filter.append(")");

      } else if (NESTED_FILTER_ATTRIBUTE.equals(attribName)) {
View Full Code Here

  public void addDirective(String key, String value) {
    this.directives.put(key, value);
  }
 
  public VersionRange getVersion() {
    VersionRange vi = null;
    if (this.attributes.get(Constants.VERSION_ATTRIBUTE) != null
        && this.attributes.get(Constants.VERSION_ATTRIBUTE).length() > 0) {
      vi = ManifestHeaderProcessor.parseVersionRange(this.attributes.get(Constants.VERSION_ATTRIBUTE));
    } else {
      // what if version is not specified?  let's interpret it as 0.0.0
View Full Code Here

TOP

Related Classes of org.apache.aries.application.VersionRange

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.