Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2011-09-23 21:13:47 +0000
committerThomas Watson2011-09-23 21:15:53 +0000
commit95830aefcf72ab237738d916e8298e034f344c91 (patch)
treef68e2cd3112c012f33fe4e220dd9e2b97f5a86a2 /bundles
parent9f4a32866c2e03cd8ff895364f6a6d0a4ca15f6e (diff)
downloadrt.equinox.framework-95830aefcf72ab237738d916e8298e034f344c91.tar.gz
rt.equinox.framework-95830aefcf72ab237738d916e8298e034f344c91.tar.xz
rt.equinox.framework-95830aefcf72ab237738d916e8298e034f344c91.zip
Bug 350959 - [R4.4] BundleRevision must contain all capability and
requirement specified even if not effective
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/OSGiCapabilityTest.java43
-rw-r--r--bundles/org.eclipse.osgi.tests/test_files/genericCapability/c1.osgi.MF5
-rw-r--r--bundles/org.eclipse.osgi.tests/test_files/genericCapability/c2.osgi.MF5
-rw-r--r--bundles/org.eclipse.osgi.tests/test_files/genericCapability/c3.osgi.MF5
-rw-r--r--bundles/org.eclipse.osgi.tests/test_files/genericCapability/p1.osgi.MF4
-rw-r--r--bundles/org.eclipse.osgi.tests/test_files/genericCapability/p1.osgi.name.MF3
-rw-r--r--bundles/org.eclipse.osgi.tests/test_files/genericCapability/p2.osgi.MF3
-rw-r--r--bundles/org.eclipse.osgi.tests/test_files/genericCapability/p2.osgi.name.MF3
-rw-r--r--bundles/org.eclipse.osgi.tests/test_files/genericCapability/p3.osgi.MF3
-rw-r--r--bundles/org.eclipse.osgi.tests/test_files/genericCapability/p3.osgi.name.MF3
-rw-r--r--bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/GenericCapability.java9
-rw-r--r--bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/GenericConstraint.java10
-rw-r--r--bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverImpl.java46
-rw-r--r--bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateBuilder.java15
14 files changed, 110 insertions, 47 deletions
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/OSGiCapabilityTest.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/OSGiCapabilityTest.java
index 5410a59af..9eb9b8472 100644
--- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/OSGiCapabilityTest.java
+++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/OSGiCapabilityTest.java
@@ -10,8 +10,6 @@
*******************************************************************************/
package org.eclipse.osgi.tests.services.resolver;
-import org.osgi.framework.resource.ResourceConstants;
-
import java.io.File;
import java.io.IOException;
import java.net.URL;
@@ -22,6 +20,7 @@ import org.eclipse.osgi.framework.util.Headers;
import org.eclipse.osgi.service.resolver.*;
import org.osgi.framework.BundleException;
import org.osgi.framework.Constants;
+import org.osgi.framework.resource.*;
public class OSGiCapabilityTest extends AbstractStateTest {
private static final String MANIFEST_ROOT = "test_files/genericCapability/";
@@ -111,6 +110,17 @@ public class OSGiCapabilityTest extends AbstractStateTest {
checkGenericBasics(4, c2.getResolvedGenericRequires(), p2.getSelectedGenericCapabilities());
checkGenericBasics(4, c3.getResolvedGenericRequires(), p3.getSelectedGenericCapabilities());
+ if (p1Manifest.indexOf(".osgi.") != -1) {
+ checkForNonEffectiveCapability(p1);
+ checkForNonEffectiveCapability(p2);
+ checkForNonEffectiveCapability(p3);
+ }
+ if (c1Manifest.indexOf(".osgi.") != -1) {
+ checkForNonEffectiveRequirement(c1);
+ checkForNonEffectiveRequirement(c2);
+ checkForNonEffectiveRequirement(c3);
+ }
+
File stateDir = getContext().getDataFile(getName()); //$NON-NLS-1$
stateDir.mkdirs();
try {
@@ -135,6 +145,35 @@ public class OSGiCapabilityTest extends AbstractStateTest {
checkGenericBasics(4, c1.getResolvedGenericRequires(), p1.getSelectedGenericCapabilities());
checkGenericBasics(4, c2.getResolvedGenericRequires(), p2.getSelectedGenericCapabilities());
checkGenericBasics(4, c3.getResolvedGenericRequires(), p3.getSelectedGenericCapabilities());
+
+ if (p1Manifest.indexOf(".osgi.") != -1) {
+ checkForNonEffectiveCapability(p1);
+ checkForNonEffectiveCapability(p2);
+ checkForNonEffectiveCapability(p3);
+ }
+ if (c1Manifest.indexOf(".osgi.") != -1) {
+ checkForNonEffectiveRequirement(c1);
+ checkForNonEffectiveRequirement(c2);
+ checkForNonEffectiveRequirement(c3);
+ }
+ }
+
+ private static final String notEffective = "not.effective";
+
+ private void checkForNonEffectiveCapability(BundleDescription p1) {
+ List nonEffectiveCaps = p1.getCapabilities(notEffective);
+ assertNotNull(nonEffectiveCaps);
+ assertEquals("Wrong number of not.effective", 1, nonEffectiveCaps.size());
+ Capability c = (Capability) nonEffectiveCaps.get(0);
+ assertEquals("Wrong effective value", Constants.EFFECTIVE_ACTIVE, c.getDirectives().get(Constants.EFFECTIVE_DIRECTIVE));
+ }
+
+ private void checkForNonEffectiveRequirement(BundleDescription c1) {
+ List nonEffectiveReqs = c1.getRequirements(notEffective);
+ assertNotNull(nonEffectiveReqs);
+ assertEquals("Wrong number of not.effective", 1, nonEffectiveReqs.size());
+ Requirement r = (Requirement) nonEffectiveReqs.get(0);
+ assertEquals("Wrong effective value", Constants.EFFECTIVE_ACTIVE, r.getDirectives().get(Constants.EFFECTIVE_DIRECTIVE));
}
private void checkGenericBasics(int expectedCnt, GenericDescription[] genRequired, GenericDescription[] genProvided) {
diff --git a/bundles/org.eclipse.osgi.tests/test_files/genericCapability/c1.osgi.MF b/bundles/org.eclipse.osgi.tests/test_files/genericCapability/c1.osgi.MF
index ee107a5d7..2ea922b1e 100644
--- a/bundles/org.eclipse.osgi.tests/test_files/genericCapability/c1.osgi.MF
+++ b/bundles/org.eclipse.osgi.tests/test_files/genericCapability/c1.osgi.MF
@@ -19,4 +19,7 @@ Require-Capability:
(test.version>=1.0)(!(test.version>=2.0))
(test.string~=abc))",
osgi.identity;
- filter:="(&(osgi.identity=p1.*)(version=1.0)(type=osgi.bundle))"
+ filter:="(&(osgi.identity=p1.*)(version=1.0)(type=osgi.bundle))",
+ not.effective;
+ filter:="(not.effective=true)";
+ effective:=active
diff --git a/bundles/org.eclipse.osgi.tests/test_files/genericCapability/c2.osgi.MF b/bundles/org.eclipse.osgi.tests/test_files/genericCapability/c2.osgi.MF
index 925983cc9..2f5602a5a 100644
--- a/bundles/org.eclipse.osgi.tests/test_files/genericCapability/c2.osgi.MF
+++ b/bundles/org.eclipse.osgi.tests/test_files/genericCapability/c2.osgi.MF
@@ -19,4 +19,7 @@ Require-Capability:
(test.version>=2.0)(!(test.version>=3.0))
(test.string~=abc))",
osgi.identity;
- filter:="(&(osgi.identity=p2.*)(version=1.0)(type=osgi.bundle))"
+ filter:="(&(osgi.identity=p2.*)(version=1.0)(type=osgi.bundle))",
+ not.effective;
+ filter:="(not.effective=true)";
+ effective:=active
diff --git a/bundles/org.eclipse.osgi.tests/test_files/genericCapability/c3.osgi.MF b/bundles/org.eclipse.osgi.tests/test_files/genericCapability/c3.osgi.MF
index dde8c74e5..2131819d9 100644
--- a/bundles/org.eclipse.osgi.tests/test_files/genericCapability/c3.osgi.MF
+++ b/bundles/org.eclipse.osgi.tests/test_files/genericCapability/c3.osgi.MF
@@ -19,4 +19,7 @@ Require-Capability:
(test.version>=3.0)(!(test.version>=4.0))
(test.string~=abc))",
osgi.identity;
- filter:="(&(osgi.identity=p3.*)(version=1.0)(type=osgi.bundle))"
+ filter:="(&(osgi.identity=p3.*)(version=1.0)(type=osgi.bundle))",
+ not.effective;
+ filter:="(not.effective=true)";
+ effective:=active
diff --git a/bundles/org.eclipse.osgi.tests/test_files/genericCapability/p1.osgi.MF b/bundles/org.eclipse.osgi.tests/test_files/genericCapability/p1.osgi.MF
index 1eb6b5022..3698b901b 100644
--- a/bundles/org.eclipse.osgi.tests/test_files/genericCapability/p1.osgi.MF
+++ b/bundles/org.eclipse.osgi.tests/test_files/genericCapability/p1.osgi.MF
@@ -5,5 +5,5 @@ Bundle-Version: 1.0
Provide-Capability:
namespace.1; rank:Long="100"; percent:Double="0.10"; test.version:Version="1.0.0"; test.string="ABC"; long.list:List<Long>="1,2,3"; double.list:List<Double>="0.1,0.2,0.3"; version.list:List<Version>="1.0, 2.0, 3.0"; string.list:List="A, B, C",
namespace.2; rank:Long="100"; percent:Double="0.10"; test.version:Version="1.0.0"; test.string="ABC"; long.list:List<Long>="1,2,3"; double.list:List<Double>="0.1,0.2,0.3"; version.list:List<Version>="1.0, 2.0, 3.0"; string.list:List="A, B, C",
- namespace.3; rank:Long="100"; percent:Double="0.10"; test.version:Version="1.0.0"; test.string="ABC"; long.list:List<Long>="1,2,3"; double.list:List<Double>="0.1,0.2,0.3"; version.list:List<Version>="1.0, 2.0, 3.0"; string.list:List="A, B, C"
-
+ namespace.3; rank:Long="100"; percent:Double="0.10"; test.version:Version="1.0.0"; test.string="ABC"; long.list:List<Long>="1,2,3"; double.list:List<Double>="0.1,0.2,0.3"; version.list:List<Version>="1.0, 2.0, 3.0"; string.list:List="A, B, C",
+ not.effective; not.effective=test; effective:=active
diff --git a/bundles/org.eclipse.osgi.tests/test_files/genericCapability/p1.osgi.name.MF b/bundles/org.eclipse.osgi.tests/test_files/genericCapability/p1.osgi.name.MF
index ce1a70373..00ddd45a3 100644
--- a/bundles/org.eclipse.osgi.tests/test_files/genericCapability/p1.osgi.name.MF
+++ b/bundles/org.eclipse.osgi.tests/test_files/genericCapability/p1.osgi.name.MF
@@ -5,5 +5,6 @@ Bundle-Version: 1.0
Provide-Capability:
namespace.1; rank:Long="100"; percent:Double="0.10"; test.version:Version="1.0.0"; test.string:String="ABC"; namespace.1="p1",
namespace.2; rank:Long="100"; percent:Double="0.10"; test.version:Version="1.0.0"; test.string:String="ABC"; namespace.2="p1",
- namespace.3; rank:Long="100"; percent:Double="0.10"; test.version:Version="1.0.0"; test.string:String="ABC"; namespace.3="p1"
+ namespace.3; rank:Long="100"; percent:Double="0.10"; test.version:Version="1.0.0"; test.string:String="ABC"; namespace.3="p1",
+ not.effective; not.effective=test; effective:=active
diff --git a/bundles/org.eclipse.osgi.tests/test_files/genericCapability/p2.osgi.MF b/bundles/org.eclipse.osgi.tests/test_files/genericCapability/p2.osgi.MF
index 8e8ae1455..db31dc95d 100644
--- a/bundles/org.eclipse.osgi.tests/test_files/genericCapability/p2.osgi.MF
+++ b/bundles/org.eclipse.osgi.tests/test_files/genericCapability/p2.osgi.MF
@@ -5,5 +5,6 @@ Bundle-Version: 1.0
Provide-Capability:
namespace.1; rank:Long="200"; percent:Double="0.20"; test.version:Version="2.0.0"; test.string="ABC",
namespace.2; rank:Long="200"; percent:Double="0.20"; test.version:Version="2.0.0"; test.string="ABC",
- namespace.3; rank:Long="200"; percent:Double="0.20"; test.version:Version="2.0.0"; test.string="ABC"
+ namespace.3; rank:Long="200"; percent:Double="0.20"; test.version:Version="2.0.0"; test.string="ABC",
+ not.effective; not.effective=test; effective:=active
diff --git a/bundles/org.eclipse.osgi.tests/test_files/genericCapability/p2.osgi.name.MF b/bundles/org.eclipse.osgi.tests/test_files/genericCapability/p2.osgi.name.MF
index 8e9157737..922dca408 100644
--- a/bundles/org.eclipse.osgi.tests/test_files/genericCapability/p2.osgi.name.MF
+++ b/bundles/org.eclipse.osgi.tests/test_files/genericCapability/p2.osgi.name.MF
@@ -5,5 +5,6 @@ Bundle-Version: 1.0
Provide-Capability:
namespace.1; rank:Long="200"; percent:Double="0.20"; test.version:Version="2.0.0"; test.string:String="ABC"; namespace.1="p2",
namespace.2; rank:Long="200"; percent:Double="0.20"; test.version:Version="2.0.0"; test.string:String="ABC"; namespace.2="p2",
- namespace.3; rank:Long="200"; percent:Double="0.20"; test.version:Version="2.0.0"; test.string:String="ABC"; namespace.3="p2"
+ namespace.3; rank:Long="200"; percent:Double="0.20"; test.version:Version="2.0.0"; test.string:String="ABC"; namespace.3="p2",
+ not.effective; not.effective=test; effective:=active
diff --git a/bundles/org.eclipse.osgi.tests/test_files/genericCapability/p3.osgi.MF b/bundles/org.eclipse.osgi.tests/test_files/genericCapability/p3.osgi.MF
index 7efac9750..c7934ba2c 100644
--- a/bundles/org.eclipse.osgi.tests/test_files/genericCapability/p3.osgi.MF
+++ b/bundles/org.eclipse.osgi.tests/test_files/genericCapability/p3.osgi.MF
@@ -5,5 +5,6 @@ Bundle-Version: 1.0
Provide-Capability:
namespace.1; rank:Long="300"; percent:Double="0.30"; test.version:Version="3.0.0"; test.string="ABC",
namespace.2; rank:Long="300"; percent:Double="0.30"; test.version:Version="3.0.0"; test.string="ABC",
- namespace.3; rank:Long="300"; percent:Double="0.30"; test.version:Version="3.0.0"; test.string="ABC"
+ namespace.3; rank:Long="300"; percent:Double="0.30"; test.version:Version="3.0.0"; test.string="ABC",
+ not.effective; not.effective=test; effective:=active
diff --git a/bundles/org.eclipse.osgi.tests/test_files/genericCapability/p3.osgi.name.MF b/bundles/org.eclipse.osgi.tests/test_files/genericCapability/p3.osgi.name.MF
index 780a71868..8c049fe71 100644
--- a/bundles/org.eclipse.osgi.tests/test_files/genericCapability/p3.osgi.name.MF
+++ b/bundles/org.eclipse.osgi.tests/test_files/genericCapability/p3.osgi.name.MF
@@ -5,5 +5,6 @@ Bundle-Version: 1.0
Provide-Capability:
namespace.1; rank:Long="300"; percent:Double="0.30"; test.version:Version="3.0.0"; test.string:String="ABC"; namespace.1="p3",
namespace.2; rank:Long="300"; percent:Double="0.30"; test.version:Version="3.0.0"; test.string:String="ABC"; namespace.2="p3",
- namespace.3; rank:Long="300"; percent:Double="0.30"; test.version:Version="3.0.0"; test.string:String="ABC"; namespace.3="p3"
+ namespace.3; rank:Long="300"; percent:Double="0.30"; test.version:Version="3.0.0"; test.string:String="ABC"; namespace.3="p3",
+ not.effective; not.effective=test; effective:=active
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/GenericCapability.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/GenericCapability.java
index b376ede08..3156e00fa 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/GenericCapability.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/GenericCapability.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2010 IBM Corporation and others.
+ * Copyright (c) 2006, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -18,12 +18,15 @@ import org.osgi.framework.Constants;
public class GenericCapability extends VersionSupplier {
final ResolverBundle resolverBundle;
final String[] uses;
+ final boolean effective;
GenericCapability(ResolverBundle resolverBundle, GenericDescription base) {
super(base);
this.resolverBundle = resolverBundle;
String usesDirective = base.getDeclaredDirectives().get(Constants.USES_DIRECTIVE);
uses = ManifestElement.getArrayFromList(usesDirective);
+ String effectiveDirective = base.getDeclaredDirectives().get(Constants.EFFECTIVE_DIRECTIVE);
+ effective = effectiveDirective == null || Constants.EFFECTIVE_RESOLVE.equals(effectiveDirective);
}
public BundleDescription getBundleDescription() {
@@ -41,4 +44,8 @@ public class GenericCapability extends VersionSupplier {
String[] getUsesDirective() {
return uses;
}
+
+ boolean isEffective() {
+ return effective;
+ }
}
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/GenericConstraint.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/GenericConstraint.java
index 7c3e9164f..7aa53580d 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/GenericConstraint.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/GenericConstraint.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2010 IBM Corporation and others.
+ * Copyright (c) 2006, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,13 +11,17 @@
package org.eclipse.osgi.internal.module;
import org.eclipse.osgi.service.resolver.GenericSpecification;
+import org.osgi.framework.Constants;
public class GenericConstraint extends ResolverConstraint {
+ private final boolean effective;
private boolean supplierHasUses;
GenericConstraint(ResolverBundle bundle, GenericSpecification constraint) {
super(bundle, constraint);
+ String effectiveDirective = constraint.getRequirement().getDirectives().get(Constants.EFFECTIVE_DIRECTIVE);
+ effective = effectiveDirective == null || Constants.EFFECTIVE_RESOLVE.equals(effectiveDirective);
}
boolean isOptional() {
@@ -28,6 +32,10 @@ public class GenericConstraint extends ResolverConstraint {
return !supplierHasUses && (((GenericSpecification) constraint).getResolution() & GenericSpecification.RESOLUTION_MULTIPLE) != 0;
}
+ boolean isEffective() {
+ return effective;
+ }
+
public String getNameSpace() {
return ((GenericSpecification) getVersionConstraint()).getType();
}
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverImpl.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverImpl.java
index 8493bd23c..70ec071e7 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverImpl.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverImpl.java
@@ -1223,26 +1223,28 @@ public class ResolverImpl implements Resolver {
if (!failed) {
GenericConstraint[] genericRequires = bundle.getGenericRequires();
for (int i = 0; i < genericRequires.length; i++) {
- if (!resolveGenericReq(genericRequires[i], cycle)) {
- if (DEBUG || DEBUG_GENERICS)
- ResolverImpl.log("** GENERICS " + genericRequires[i].getVersionConstraint().getName() + "[" + genericRequires[i].getBundleDescription() + "] failed to resolve"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- state.addResolverError(genericRequires[i].getVersionConstraint().getBundle(), ResolverError.MISSING_GENERIC_CAPABILITY, genericRequires[i].getVersionConstraint().toString(), genericRequires[i].getVersionConstraint());
- if (genericRequires[i].isFromFragment()) {
- if (!developmentMode) // only detach fragments when not in devmode
- bundle.detachFragment(bundleMapping.get(genericRequires[i].getVersionConstraint().getBundle()), null);
- continue;
- }
- if (!developmentMode) {
- // fail fast; otherwise we want to attempt to resolver other constraints in dev mode
- failed = true;
- break;
- }
- } else {
- if ("osgi.ee".equals(genericRequires[i].getNameSpace())) { //$NON-NLS-1$
- VersionSupplier supplier = genericRequires[i].getSelectedSupplier();
- Integer ee = supplier == null ? null : (Integer) ((GenericDescription) supplier.getBaseDescription()).getAttributes().get(ExportPackageDescriptionImpl.EQUINOX_EE);
- if (ee != null && ((BundleDescriptionImpl) bundle.getBaseDescription()).getEquinoxEE() < 0)
- ((BundleDescriptionImpl) bundle.getBundleDescription()).setEquinoxEE(ee);
+ if (genericRequires[i].isEffective()) {
+ if (!resolveGenericReq(genericRequires[i], cycle)) {
+ if (DEBUG || DEBUG_GENERICS)
+ ResolverImpl.log("** GENERICS " + genericRequires[i].getVersionConstraint().getName() + "[" + genericRequires[i].getBundleDescription() + "] failed to resolve"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ state.addResolverError(genericRequires[i].getVersionConstraint().getBundle(), ResolverError.MISSING_GENERIC_CAPABILITY, genericRequires[i].getVersionConstraint().toString(), genericRequires[i].getVersionConstraint());
+ if (genericRequires[i].isFromFragment()) {
+ if (!developmentMode) // only detach fragments when not in devmode
+ bundle.detachFragment(bundleMapping.get(genericRequires[i].getVersionConstraint().getBundle()), null);
+ continue;
+ }
+ if (!developmentMode) {
+ // fail fast; otherwise we want to attempt to resolver other constraints in dev mode
+ failed = true;
+ break;
+ }
+ } else {
+ if ("osgi.ee".equals(genericRequires[i].getNameSpace())) { //$NON-NLS-1$
+ VersionSupplier supplier = genericRequires[i].getSelectedSupplier();
+ Integer ee = supplier == null ? null : (Integer) ((GenericDescription) supplier.getBaseDescription()).getAttributes().get(ExportPackageDescriptionImpl.EQUINOX_EE);
+ if (ee != null && ((BundleDescriptionImpl) bundle.getBaseDescription()).getEquinoxEE() < 0)
+ ((BundleDescriptionImpl) bundle.getBundleDescription()).setEquinoxEE(ee);
+ }
}
}
}
@@ -1713,7 +1715,7 @@ public class ResolverImpl implements Resolver {
GenericCapability[] capabilities = rb.getGenericCapabilities();
List<GenericDescription> selectedCapabilities = new ArrayList<GenericDescription>(capabilities.length);
for (GenericCapability capability : capabilities)
- if (permissionChecker.checkCapabilityPermission(capability.getGenericDescription()))
+ if (capability.isEffective() && permissionChecker.checkCapabilityPermission(capability.getGenericDescription()))
selectedCapabilities.add(capability.getGenericDescription());
GenericDescription[] selectedCapabilitiesArray = selectedCapabilities.toArray(new GenericDescription[selectedCapabilities.size()]);
@@ -2120,6 +2122,8 @@ public class ResolverImpl implements Resolver {
void addGenerics(GenericCapability[] generics) {
for (GenericCapability capability : generics) {
+ if (!capability.isEffective())
+ continue;
String type = capability.getGenericDescription().getType();
VersionHashMap<GenericCapability> namespace = resolverGenerics.get(type);
if (namespace == null) {
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateBuilder.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateBuilder.java
index a93479068..a3ecf0253 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateBuilder.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateBuilder.java
@@ -11,8 +11,6 @@
*******************************************************************************/
package org.eclipse.osgi.internal.resolver;
-import org.osgi.framework.resource.ResourceConstants;
-
import java.lang.reflect.Constructor;
import java.util.*;
import org.eclipse.osgi.framework.internal.core.*;
@@ -21,6 +19,7 @@ import org.eclipse.osgi.service.resolver.*;
import org.eclipse.osgi.util.ManifestElement;
import org.eclipse.osgi.util.NLS;
import org.osgi.framework.*;
+import org.osgi.framework.resource.ResourceConstants;
/**
* This class builds bundle description objects from manifests
@@ -491,11 +490,7 @@ public class StateBuilder {
result = new ArrayList<GenericSpecification>();
for (ManifestElement element : osgiRequires) {
String[] namespaces = element.getValueComponents();
- types: for (String namespace : namespaces) {
- String effective = element.getDirective(Constants.EFFECTIVE_DIRECTIVE);
- if (effective != null && !Constants.EFFECTIVE_RESOLVE.equals(effective))
- break types;
-
+ for (String namespace : namespaces) {
GenericSpecificationImpl spec = new GenericSpecificationImpl();
spec.setType(namespace);
String filterSpec = element.getDirective(Constants.FILTER_DIRECTIVE);
@@ -581,11 +576,7 @@ public class StateBuilder {
for (ManifestElement element : osgiCapabilities) {
String[] namespaces = element.getValueComponents();
- types: for (String namespace : namespaces) {
- String effective = element.getDirective(Constants.EFFECTIVE_DIRECTIVE);
- // Any declared osgi.identity capability with an effective directive value of "resolve" will be overridden.
- if (effective != null && !Constants.EFFECTIVE_RESOLVE.equals(effective))
- break types; // ignore any namespace that is not effective at resolve time.
+ for (String namespace : namespaces) {
if (ResourceConstants.IDENTITY_NAMESPACE.equals(namespace))
throw new BundleException("A bundle is not allowed to define a capability in the " + ResourceConstants.IDENTITY_NAMESPACE + " name space."); //$NON-NLS-1$ //$NON-NLS-2$

Back to the top