felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mccu...@apache.org
Subject svn commit: r722891 - /felix/trunk/bundleplugin/src/main/java/org/osgi/impl/bundle/obr/resource/BundleInfo.java
Date Wed, 03 Dec 2008 14:08:32 GMT
Author: mcculls
Date: Wed Dec  3 06:08:31 2008
New Revision: 722891

URL: http://svn.apache.org/viewvc?rev=722891&view=rev
Log:
Apply latest Bindex patch

Modified:
    felix/trunk/bundleplugin/src/main/java/org/osgi/impl/bundle/obr/resource/BundleInfo.java

Modified: felix/trunk/bundleplugin/src/main/java/org/osgi/impl/bundle/obr/resource/BundleInfo.java
URL: http://svn.apache.org/viewvc/felix/trunk/bundleplugin/src/main/java/org/osgi/impl/bundle/obr/resource/BundleInfo.java?rev=722891&r1=722890&r2=722891&view=diff
==============================================================================
--- felix/trunk/bundleplugin/src/main/java/org/osgi/impl/bundle/obr/resource/BundleInfo.java
(original)
+++ felix/trunk/bundleplugin/src/main/java/org/osgi/impl/bundle/obr/resource/BundleInfo.java
Wed Dec  3 06:08:31 2008
@@ -1,5 +1,5 @@
 /*
- * $Id: BundleInfo.java 92 2008-11-06 07:46:37Z peter.kriens@aqute.biz $
+ * $Id: BundleInfo.java 94 2008-12-03 13:31:50Z peter.kriens@aqute.biz $
  * 
  * Copyright (c) OSGi Alliance (2002, 2006, 2007). All Rights Reserved.
  * 
@@ -28,7 +28,7 @@
  * Convert a bundle to a generic resource description and store its local
  * dependencies (like for example a license file in the JAR) in a zip file.
  * 
- * @version $Revision: 92 $
+ * @version $Revision: 94 $
  */
 public class BundleInfo {
 	Manifest manifest;
@@ -357,6 +357,12 @@
 		appendVersion(filter, pack.getVersion());
 		Map attributes = pack.getAttributes();
 		Set attrs = doImportPackageAttributes(req, filter, attributes);
+		
+		// The next code is using the subset operator 
+		// to check mandatory attributes, it seems to be
+		// impossible to rewrite. It must assert that whateber
+		// is in mandatory: must be in any of the attributes.
+		// This is a fundamental shortcoming of the filter language.
 		if (attrs.size() > 0) {
 			String del = "";
 			filter.append("(mandatory:<*");
@@ -374,19 +380,31 @@
 	private void appendVersion(StringBuffer filter, VersionRange version) {
 		if (version != null) {
 			if (version.isRange()) {
-				filter.append("(version");
-				filter.append(">");
-				if (version.includeLow())
-					filter.append("=");
-				filter.append(version.low);
-				filter.append(")");
+				if (version.includeLow()) {
+					filter.append("(version");
+					filter.append(">=");
+					filter.append(version.low);
+					filter.append(")");
+				}
+				else {
+					filter.append("(!(version");
+					filter.append("<=");
+					filter.append(version.low);
+					filter.append("))");
+				}
 
-				filter.append("(version");
-				filter.append("<");
-				if (version.includeHigh())
-					filter.append("=");
-				filter.append(version.high);
-				filter.append(")");
+				if ( version.includeHigh() ) {
+					filter.append("(version");
+					filter.append("<=");
+					filter.append(version.high);
+					filter.append(")");					
+				}
+				else {
+					filter.append("(!(version");
+					filter.append(">=");
+					filter.append(version.low);
+					filter.append("))");
+				}
 			} else {
 				filter.append("(version>=");
 				filter.append(version);



Mime
View raw message