Blob Blame History Raw
From bfeef908b83862b6364dfcc856a26caf3be1765e Mon Sep 17 00:00:00 2001
From: Michael Simacek <msimacek@redhat.com>
Date: Thu, 26 May 2016 16:57:46 +0200
Subject: [PATCH 2/3] Remove unavailable parts

---
 biz.aQute.bnd/src/aQute/bnd/main/bnd.java          | 30 -----------------
 biz.aQute.bndlib/src/aQute/bnd/build/Project.java  |  4 +--
 .../src/aQute/bnd/component/AnnotationReader.java  | 38 ++++++++--------------
 .../src/aQute/bnd/component/ComponentDef.java      |  1 -
 .../src/aQute/bnd/component/FieldOption.java       |  5 +++
 .../src/aQute/bnd/component/HeaderReader.java      |  1 -
 .../src/aQute/bnd/component/ReferenceDef.java      |  2 --
 .../src/aQute/bnd/component/ReferenceScope.java    | 13 ++++++++
 .../src/aQute/bnd/component/ServiceScope.java      | 14 ++++++++
 .../src/aQute/bnd/http/HttpRequest.java            | 23 -------------
 .../src/aQute/bnd/obr/OBRFragment.java             | 22 ++++++-------
 biz.aQute.bndlib/src/aQute/bnd/osgi/Builder.java   |  3 --
 biz.aQute.bndlib/src/aQute/bnd/osgi/Contracts.java | 18 +++++-----
 .../src/aQute/bnd/osgi/resource/CapReqBuilder.java | 12 +++----
 .../src/aQute/bnd/osgi/resource/ResourceUtils.java | 18 ++++------
 15 files changed, 76 insertions(+), 128 deletions(-)
 create mode 100644 biz.aQute.bndlib/src/aQute/bnd/component/FieldOption.java
 create mode 100644 biz.aQute.bndlib/src/aQute/bnd/component/ReferenceScope.java
 create mode 100644 biz.aQute.bndlib/src/aQute/bnd/component/ServiceScope.java

diff --git a/biz.aQute.bnd/src/aQute/bnd/main/bnd.java b/biz.aQute.bnd/src/aQute/bnd/main/bnd.java
index 0a7affe..512d58f 100644
--- a/biz.aQute.bnd/src/aQute/bnd/main/bnd.java
+++ b/biz.aQute.bnd/src/aQute/bnd/main/bnd.java
@@ -4124,36 +4124,6 @@ public class bnd extends Processor {
 	}
 
 	/**
-	 * Resolve command
-	 * 
-	 * @throws Exception
-	 */
-
-	public void _resolve(ResolveCommand.ResolveOptions options) throws Exception {
-		ResolveCommand rc = new ResolveCommand(this);
-		String help = options._command().subCmd(options, rc);
-		if (help != null)
-			out.println(help);
-		getInfo(rc);
-		rc.close();
-	}
-
-	/**
-	 * Remote command
-	 * 
-	 * @throws Exception
-	 */
-
-	public void _remote(RemoteCommand.RemoteOptions options) throws Exception {
-		RemoteCommand rc = new RemoteCommand(this, options);
-		String help = options._command().subCmd(options, rc);
-		if (help != null)
-			out.println(help);
-		getInfo(rc);
-		rc.close();
-	}
-
-	/**
 	 * Export a bndrun file
 	 */
 
diff --git a/biz.aQute.bndlib/src/aQute/bnd/build/Project.java b/biz.aQute.bndlib/src/aQute/bnd/build/Project.java
index b0740f1..8ad8831 100644
--- a/biz.aQute.bndlib/src/aQute/bnd/build/Project.java
+++ b/biz.aQute.bndlib/src/aQute/bnd/build/Project.java
@@ -43,8 +43,6 @@ import java.util.regex.Pattern;
 import org.osgi.framework.namespace.IdentityNamespace;
 import org.osgi.resource.Capability;
 import org.osgi.resource.Requirement;
-import org.osgi.service.repository.ContentNamespace;
-import org.osgi.service.repository.Repository;
 
 import aQute.bnd.build.Container.TYPE;
 import aQute.bnd.header.Attrs;
@@ -1341,6 +1339,7 @@ public class Project extends Processor {
 
 			// If not, and if the repository implements the OSGi Repository
 			// Service, use a capability search on the osgi.content namespace.
+                        /*
 			if (result == null && plugin instanceof Repository) {
 				Repository repo = (Repository) plugin;
 
@@ -1373,6 +1372,7 @@ public class Project extends Processor {
 					result = plugin.get(id, bndVersion, null, blocker);
 				}
 			}
+                        */
 
 			if (result != null)
 				return toContainer(bsn, "hash", attrs, result, blocker);
diff --git a/biz.aQute.bndlib/src/aQute/bnd/component/AnnotationReader.java b/biz.aQute.bndlib/src/aQute/bnd/component/AnnotationReader.java
index 28d13ac..2a890fc 100644
--- a/biz.aQute.bndlib/src/aQute/bnd/component/AnnotationReader.java
+++ b/biz.aQute.bndlib/src/aQute/bnd/component/AnnotationReader.java
@@ -14,16 +14,11 @@ import java.util.regex.Pattern;
 
 import org.osgi.service.component.annotations.Activate;
 import org.osgi.service.component.annotations.Component;
-import org.osgi.service.component.annotations.ConfigurationPolicy;
 import org.osgi.service.component.annotations.Deactivate;
-import org.osgi.service.component.annotations.FieldOption;
 import org.osgi.service.component.annotations.Modified;
 import org.osgi.service.component.annotations.Reference;
 import org.osgi.service.component.annotations.ReferenceCardinality;
 import org.osgi.service.component.annotations.ReferencePolicy;
-import org.osgi.service.component.annotations.ReferenceScope;
-import org.osgi.service.component.annotations.ServiceScope;
-import org.osgi.service.metatype.annotations.Designate;
 
 import aQute.bnd.annotation.xml.XMLAttribute;
 import aQute.bnd.component.DSAnnotations.Options;
@@ -232,8 +227,6 @@ public class AnnotationReader extends ClassDataCollector {
 				doModified();
 			else if (a instanceof Reference)
 				doReference((Reference) a, annotation);
-			else if (a instanceof Designate)
-				doDesignate((Designate) a);
 			else if (annotation.getName().getFQN().startsWith("aQute.bnd.annotation.component"))
 				handleMixedUsageError(annotation);
 			else {
@@ -290,11 +283,6 @@ public class AnnotationReader extends ClassDataCollector {
 		}
 	}
 
-	protected void doDesignate(Designate a) {
-		if (a.factory() && component.configurationPolicy == null)
-			component.configurationPolicy = ConfigurationPolicy.REQUIRE;
-	}
-
 	/**
 	 * 
 	 */
@@ -536,15 +524,15 @@ public class AnnotationReader extends ClassDataCollector {
 		}
 		def.className = className.getFQN();
 		def.name = reference.name();
-		def.bind = reference.bind();
+		def.bind = "";
 		def.unbind = reference.unbind();
 		def.updated = reference.updated();
-		def.field = reference.field();
-		def.fieldOption = reference.fieldOption();
+		def.field = "";
+		def.fieldOption = FieldOption.REPLACE;
 		def.cardinality = reference.cardinality();
 		def.policy = reference.policy();
 		def.policyOption = reference.policyOption();
-		def.scope = reference.scope();
+		def.scope = ReferenceScope.BUNDLE;
 
 		// Check if we have a target, this must be a filter
 		def.target = reference.target();
@@ -857,17 +845,17 @@ public class AnnotationReader extends ClassDataCollector {
 			component.factory = comp.factory();
 		if (annotation.get("immediate") != null)
 			component.immediate = comp.immediate();
-		if (annotation.get("servicefactory") != null)
-			component.scope = comp.servicefactory() ? ServiceScope.BUNDLE : ServiceScope.SINGLETON;
-		if (annotation.get("scope") != null && comp.scope() != ServiceScope.DEFAULT) {
-			component.scope = comp.scope();
-			if (comp.scope() == ServiceScope.PROTOTYPE) {
-				component.updateVersion(V1_3);
-			}
-		}
+//		if (annotation.get("servicefactory") != null)
+//			component.scope = comp.servicefactory() ? ServiceScope.BUNDLE : ServiceScope.SINGLETON;
+//		if (annotation.get("scope") != null && comp.scope() != ServiceScope.DEFAULT) {
+//			component.scope = comp.scope();
+//			if (comp.scope() == ServiceScope.PROTOTYPE) {
+//				component.updateVersion(V1_3);
+//			}
+//		}
 
 		if (annotation.get("configurationPid") != null) {
-			component.configurationPid = comp.configurationPid();
+			component.configurationPid = new String[] {comp.configurationPid()};
 			if (component.configurationPid.length > 1) {
 				component.updateVersion(V1_3);
 			} else {
diff --git a/biz.aQute.bndlib/src/aQute/bnd/component/ComponentDef.java b/biz.aQute.bndlib/src/aQute/bnd/component/ComponentDef.java
index 38309fe..ba53142 100644
--- a/biz.aQute.bndlib/src/aQute/bnd/component/ComponentDef.java
+++ b/biz.aQute.bndlib/src/aQute/bnd/component/ComponentDef.java
@@ -9,7 +9,6 @@ import java.util.Map;
 import java.util.TreeMap;
 
 import org.osgi.service.component.annotations.ConfigurationPolicy;
-import org.osgi.service.component.annotations.ServiceScope;
 
 import aQute.bnd.osgi.Analyzer;
 import aQute.bnd.osgi.Descriptors.TypeRef;
diff --git a/biz.aQute.bndlib/src/aQute/bnd/component/FieldOption.java b/biz.aQute.bndlib/src/aQute/bnd/component/FieldOption.java
new file mode 100644
index 0000000..4b65c12
--- /dev/null
+++ b/biz.aQute.bndlib/src/aQute/bnd/component/FieldOption.java
@@ -0,0 +1,5 @@
+package aQute.bnd.component;
+enum FieldOption {
+    UPDATE,
+    REPLACE
+}
diff --git a/biz.aQute.bndlib/src/aQute/bnd/component/HeaderReader.java b/biz.aQute.bndlib/src/aQute/bnd/component/HeaderReader.java
index 2a64e20..b070fbd 100644
--- a/biz.aQute.bndlib/src/aQute/bnd/component/HeaderReader.java
+++ b/biz.aQute.bndlib/src/aQute/bnd/component/HeaderReader.java
@@ -16,7 +16,6 @@ import org.osgi.service.component.annotations.ConfigurationPolicy;
 import org.osgi.service.component.annotations.ReferenceCardinality;
 import org.osgi.service.component.annotations.ReferencePolicy;
 import org.osgi.service.component.annotations.ReferencePolicyOption;
-import org.osgi.service.component.annotations.ServiceScope;
 
 import aQute.bnd.component.error.DeclarativeServicesAnnotationError;
 import aQute.bnd.component.error.DeclarativeServicesAnnotationError.ErrorType;
diff --git a/biz.aQute.bndlib/src/aQute/bnd/component/ReferenceDef.java b/biz.aQute.bndlib/src/aQute/bnd/component/ReferenceDef.java
index cc48f2d..d21d63b 100644
--- a/biz.aQute.bndlib/src/aQute/bnd/component/ReferenceDef.java
+++ b/biz.aQute.bndlib/src/aQute/bnd/component/ReferenceDef.java
@@ -1,10 +1,8 @@
 package aQute.bnd.component;
 
-import org.osgi.service.component.annotations.FieldOption;
 import org.osgi.service.component.annotations.ReferenceCardinality;
 import org.osgi.service.component.annotations.ReferencePolicy;
 import org.osgi.service.component.annotations.ReferencePolicyOption;
-import org.osgi.service.component.annotations.ReferenceScope;
 
 import aQute.bnd.osgi.Analyzer;
 import aQute.bnd.osgi.Verifier;
diff --git a/biz.aQute.bndlib/src/aQute/bnd/component/ReferenceScope.java b/biz.aQute.bndlib/src/aQute/bnd/component/ReferenceScope.java
new file mode 100644
index 0000000..70f2b78
--- /dev/null
+++ b/biz.aQute.bndlib/src/aQute/bnd/component/ReferenceScope.java
@@ -0,0 +1,13 @@
+package aQute.bnd.component;
+enum ReferenceScope {
+    BUNDLE("bundle"),
+    PROTOTYPE("prototype"),
+    PROTOTYPE_REQUIRED("prototype_required");
+    private final String value;
+    ReferenceScope(String value) {
+        this.value = value;
+    }
+    public String toString() {
+        return value;
+    }
+}
diff --git a/biz.aQute.bndlib/src/aQute/bnd/component/ServiceScope.java b/biz.aQute.bndlib/src/aQute/bnd/component/ServiceScope.java
new file mode 100644
index 0000000..aa49766
--- /dev/null
+++ b/biz.aQute.bndlib/src/aQute/bnd/component/ServiceScope.java
@@ -0,0 +1,14 @@
+package aQute.bnd.component;
+enum ServiceScope {
+    SINGLETON("singleton"),
+    BUNDLE("bundle"),
+    PROTOTYPE("prototype"),
+    DEFAULT("<<default>>");
+    private final String value;
+    ServiceScope(String value) {
+        this.value = value;
+    }
+    public String toString() {
+        return value;
+    }
+}
diff --git a/biz.aQute.bndlib/src/aQute/bnd/http/HttpRequest.java b/biz.aQute.bndlib/src/aQute/bnd/http/HttpRequest.java
index 8ab406f..2ed3278 100644
--- a/biz.aQute.bndlib/src/aQute/bnd/http/HttpRequest.java
+++ b/biz.aQute.bndlib/src/aQute/bnd/http/HttpRequest.java
@@ -9,9 +9,6 @@ import java.util.Map;
 import java.util.concurrent.Executor;
 import java.util.concurrent.TimeUnit;
 
-import org.osgi.util.promise.Deferred;
-import org.osgi.util.promise.Promise;
-
 import aQute.bnd.osgi.Processor;
 import aQute.bnd.service.url.TaggedData;
 import aQute.lib.converter.TypeReference;
@@ -196,26 +193,6 @@ public class HttpRequest<T> {
 		return this;
 	}
 
-	public Promise<T> async(final URL url) {
-		this.url = url;
-		final Deferred<T> deferred = new Deferred<>();
-		Executor e = Processor.getExecutor();
-		e.execute(new Runnable() {
-
-			@Override
-			public void run() {
-				try {
-					T result = (T) client.send(HttpRequest.this);
-					deferred.resolve(result);
-				} catch (Exception t) {
-					deferred.fail(t);
-				}
-			}
-
-		});
-		return deferred.getPromise();
-	}
-
 	@Override
 	public String toString() {
 		return "HttpRequest [verb=" + verb + ", upload=" + upload + ", download=" + download + ", headers=" + headers
diff --git a/biz.aQute.bndlib/src/aQute/bnd/obr/OBRFragment.java b/biz.aQute.bndlib/src/aQute/bnd/obr/OBRFragment.java
index 80cb5d2..ac0f70c 100644
--- a/biz.aQute.bndlib/src/aQute/bnd/obr/OBRFragment.java
+++ b/biz.aQute.bndlib/src/aQute/bnd/obr/OBRFragment.java
@@ -15,10 +15,8 @@ import org.osgi.framework.namespace.ExecutionEnvironmentNamespace;
 import org.osgi.framework.namespace.HostNamespace;
 import org.osgi.framework.namespace.IdentityNamespace;
 import org.osgi.framework.namespace.PackageNamespace;
-import org.osgi.namespace.service.ServiceNamespace;
 import org.osgi.resource.Capability;
 import org.osgi.resource.Namespace;
-import org.osgi.service.repository.ContentNamespace;
 
 import aQute.bnd.header.Attrs;
 import aQute.bnd.header.Parameters;
@@ -217,10 +215,10 @@ public class OBRFragment {
 			//
 
 			for (Entry<String,Attrs> export : d.getParameters(Constants.EXPORT_SERVICE).entrySet()) {
-				CapReqBuilder exportedService = new CapReqBuilder(ServiceNamespace.SERVICE_NAMESPACE);
+				CapReqBuilder exportedService = new CapReqBuilder("osgi.service");
 				String service = Processor.removeDuplicateMarker(export.getKey());
-				exportedService.addAttribute(ServiceNamespace.SERVICE_NAMESPACE, service);
-				exportedService.addAttribute(ServiceNamespace.CAPABILITY_OBJECTCLASS_ATTRIBUTE,
+				exportedService.addAttribute("osgi.service", service);
+				exportedService.addAttribute("objectClass",
 						export.getValue().get("objectclass"));
 				resource.addCapability(exportedService);
 			}
@@ -230,10 +228,10 @@ public class OBRFragment {
 			//
 
 			for (Entry<String,Attrs> imported : d.getParameters(Constants.IMPORT_SERVICE).entrySet()) {
-				CapReqBuilder importedService = new CapReqBuilder(ServiceNamespace.SERVICE_NAMESPACE);
+				CapReqBuilder importedService = new CapReqBuilder("osgi.service");
 				String service = Processor.removeDuplicateMarker(imported.getKey());
 				importedService.addDirective(Namespace.REQUIREMENT_FILTER_DIRECTIVE,
-						filter(ServiceNamespace.SERVICE_NAMESPACE, service, imported.getValue()));
+						filter("osgi.service", service, imported.getValue()));
 				resource.addRequirement(importedService);
 			}
 
@@ -276,16 +274,16 @@ public class OBRFragment {
 			if (!reporter.isOk())
 				return reporter;
 
-			CapReqBuilder content = new CapReqBuilder(ContentNamespace.CONTENT_NAMESPACE);
+			CapReqBuilder content = new CapReqBuilder("osgi.content");
 			String sha = SHA1.digest(file).asHex();
-			content.addAttribute(ContentNamespace.CONTENT_NAMESPACE, sha);
-			content.addAttribute(ContentNamespace.CAPABILITY_SIZE_ATTRIBUTE, (long) file.length());
-			content.addAttribute(ContentNamespace.CAPABILITY_MIME_ATTRIBUTE, MIME_TYPE_OSGI_BUNDLE);
+			content.addAttribute("osgi.content", sha);
+			content.addAttribute("size", (long) file.length());
+			content.addAttribute("mime", MIME_TYPE_OSGI_BUNDLE);
 
 			if (base != null) {
 				String path = file.getAbsolutePath();
 				if (base.startsWith(path)) {
-					content.addAttribute(ContentNamespace.CAPABILITY_URL_ATTRIBUTE,
+					content.addAttribute("url",
 							path.substring(base.length()).replace(File.separatorChar, '/'));
 				} else {
 					reporter.error("Base path %s is not parent of file path: %s", base, file.getAbsolutePath());
diff --git a/biz.aQute.bndlib/src/aQute/bnd/osgi/Builder.java b/biz.aQute.bndlib/src/aQute/bnd/osgi/Builder.java
index c61ae1f..aa5f386 100644
--- a/biz.aQute.bndlib/src/aQute/bnd/osgi/Builder.java
+++ b/biz.aQute.bndlib/src/aQute/bnd/osgi/Builder.java
@@ -35,7 +35,6 @@ import aQute.bnd.make.component.ServiceComponent;
 import aQute.bnd.make.metatype.MetatypePlugin;
 import aQute.bnd.maven.PomPropertiesResource;
 import aQute.bnd.maven.PomResource;
-import aQute.bnd.metatype.MetatypeAnnotations;
 import aQute.bnd.osgi.Descriptors.PackageRef;
 import aQute.bnd.osgi.Descriptors.TypeRef;
 import aQute.bnd.service.SignerPlugin;
@@ -1569,7 +1568,6 @@ public class Builder extends Analyzer {
 	static ServiceComponent		serviceComponent	= new ServiceComponent();
 	static DSAnnotations		dsAnnotations		= new DSAnnotations();
 	static MetatypePlugin		metatypePlugin		= new MetatypePlugin();
-	static MetatypeAnnotations	metatypeAnnotations	= new MetatypeAnnotations();
 
 	@Override
 	protected void setTypeSpecificPlugins(Set<Object> list) {
@@ -1578,7 +1576,6 @@ public class Builder extends Analyzer {
 		list.add(serviceComponent);
 		list.add(dsAnnotations);
 		list.add(metatypePlugin);
-		list.add(metatypeAnnotations);
 		super.setTypeSpecificPlugins(list);
 	}
 
diff --git a/biz.aQute.bndlib/src/aQute/bnd/osgi/Contracts.java b/biz.aQute.bndlib/src/aQute/bnd/osgi/Contracts.java
index bf0c8e4..6fda472 100644
--- a/biz.aQute.bndlib/src/aQute/bnd/osgi/Contracts.java
+++ b/biz.aQute.bndlib/src/aQute/bnd/osgi/Contracts.java
@@ -7,8 +7,6 @@ import java.util.List;
 import java.util.Map.Entry;
 import java.util.Set;
 
-import org.osgi.namespace.contract.ContractNamespace;
-
 import aQute.bnd.header.Attrs;
 import aQute.bnd.header.Parameters;
 import aQute.bnd.osgi.Descriptors.PackageRef;
@@ -73,13 +71,13 @@ class Contracts {
 		contract: for (Entry<String,Attrs> p : pcs.entrySet()) {
 			String namespace = p.getKey();
 
-			if (namespace.equals(ContractNamespace.CONTRACT_NAMESPACE)) {
+			if (namespace.equals("osgi.contract")) {
 				Attrs capabilityAttrs = p.getValue();
 
-				String name = capabilityAttrs.get(ContractNamespace.CONTRACT_NAMESPACE);
+				String name = capabilityAttrs.get("osgi.contract");
 				if (name == null) {
 					analyzer.warning("No name (attr %s) defined in bundle %s from contract namespace: %s",
-							ContractNamespace.CONTRACT_NAMESPACE, from, capabilityAttrs);
+							"osgi.contract", from, capabilityAttrs);
 					continue contract;
 				}
 
@@ -96,7 +94,7 @@ class Contracts {
 						Contract c = new Contract();
 						c.name = name;
 
-						String list = capabilityAttrs.get(ContractNamespace.CAPABILITY_USES_DIRECTIVE + ":");
+						String list = capabilityAttrs.get("uses" + ":");
 						if (list == null || list.length() == 0) {
 							analyzer.warning("Contract %s has no uses: directive in %s.", name, from);
 							continue contract; // next contract
@@ -104,7 +102,7 @@ class Contracts {
 
 						c.uses = Processor.split(list);
 
-						c.version = (Version) capabilityAttrs.getTyped(ContractNamespace.CAPABILITY_VERSION_ATTRIBUTE);
+						c.version = (Version) capabilityAttrs.getTyped("version");
 						c.from = from;
 
 						if (c.version == null) {
@@ -159,14 +157,14 @@ class Contracts {
 	void addToRequirements(Parameters requirements) {
 		for (Contract c : contracts) {
 			Attrs attrs = new Attrs(c.decorators);
-			attrs.put(ContractNamespace.CONTRACT_NAMESPACE, c.name);
-			String name = ContractNamespace.CONTRACT_NAMESPACE;
+			attrs.put("osgi.contract", c.name);
+			String name = "osgi.contract";
 			while (requirements.containsKey(name))
 				name += "~";
 
 			Formatter f = new Formatter();
 			try {
-				f.format("(&(%s=%s)(version=%s))", ContractNamespace.CONTRACT_NAMESPACE, c.name, c.version);
+				f.format("(&(%s=%s)(version=%s))", "osgi.contract", c.name, c.version);
 
 				// TODO : shall we also assert the attributes?
 
diff --git a/biz.aQute.bndlib/src/aQute/bnd/osgi/resource/CapReqBuilder.java b/biz.aQute.bndlib/src/aQute/bnd/osgi/resource/CapReqBuilder.java
index 251c762..bd9c7fb 100644
--- a/biz.aQute.bndlib/src/aQute/bnd/osgi/resource/CapReqBuilder.java
+++ b/biz.aQute.bndlib/src/aQute/bnd/osgi/resource/CapReqBuilder.java
@@ -17,14 +17,10 @@ import org.osgi.framework.namespace.ExecutionEnvironmentNamespace;
 import org.osgi.framework.namespace.HostNamespace;
 import org.osgi.framework.namespace.IdentityNamespace;
 import org.osgi.framework.namespace.PackageNamespace;
-import org.osgi.namespace.contract.ContractNamespace;
-import org.osgi.namespace.extender.ExtenderNamespace;
-import org.osgi.namespace.service.ServiceNamespace;
 import org.osgi.resource.Capability;
 import org.osgi.resource.Namespace;
 import org.osgi.resource.Requirement;
 import org.osgi.resource.Resource;
-import org.osgi.service.repository.ContentNamespace;
 
 import aQute.bnd.header.Attrs;
 import aQute.bnd.header.Parameters;
@@ -412,11 +408,11 @@ public class CapReqBuilder {
 	}
 
 	public boolean isService() {
-		return ServiceNamespace.SERVICE_NAMESPACE.equals(getNamespace());
+		return "osgi.service".equals(getNamespace());
 	}
 
 	public boolean isContract() {
-		return ContractNamespace.CONTRACT_NAMESPACE.equals(getNamespace());
+		return "osgi.contract".equals(getNamespace());
 	}
 
 	public boolean isIdentity() {
@@ -424,7 +420,7 @@ public class CapReqBuilder {
 	}
 
 	public boolean isContent() {
-		return ContentNamespace.CONTENT_NAMESPACE.equals(getNamespace());
+		return "osgi.content".equals(getNamespace());
 	}
 
 	public boolean isEE() {
@@ -432,7 +428,7 @@ public class CapReqBuilder {
 	}
 
 	public boolean isExtender() {
-		return ExtenderNamespace.EXTENDER_NAMESPACE.equals(getNamespace());
+		return "osgi.extender".equals(getNamespace());
 	}
 
 	public Attrs toAttrs() {
diff --git a/biz.aQute.bndlib/src/aQute/bnd/osgi/resource/ResourceUtils.java b/biz.aQute.bndlib/src/aQute/bnd/osgi/resource/ResourceUtils.java
index 05d9023..c90b42e 100644
--- a/biz.aQute.bndlib/src/aQute/bnd/osgi/resource/ResourceUtils.java
+++ b/biz.aQute.bndlib/src/aQute/bnd/osgi/resource/ResourceUtils.java
@@ -23,14 +23,10 @@ import org.osgi.framework.namespace.ExecutionEnvironmentNamespace;
 import org.osgi.framework.namespace.HostNamespace;
 import org.osgi.framework.namespace.IdentityNamespace;
 import org.osgi.framework.namespace.PackageNamespace;
-import org.osgi.namespace.contract.ContractNamespace;
-import org.osgi.namespace.extender.ExtenderNamespace;
-import org.osgi.namespace.service.ServiceNamespace;
 import org.osgi.resource.Capability;
 import org.osgi.resource.Namespace;
 import org.osgi.resource.Requirement;
 import org.osgi.resource.Resource;
-import org.osgi.service.repository.ContentNamespace;
 
 import aQute.bnd.header.Attrs;
 import aQute.bnd.version.Version;
@@ -182,7 +178,7 @@ public class ResourceUtils {
 	public static List<ContentCapability> getContentCapabilities(Resource resource) {
 		List<ContentCapability> result = new ArrayList<>();
 
-		for (Capability c : resource.getCapabilities(ContentNamespace.CONTENT_NAMESPACE)) {
+		for (Capability c : resource.getCapabilities("osgi.content")) {
 			result.add(as(c, ContentCapability.class));
 		}
 		return result;
@@ -244,7 +240,7 @@ public class ResourceUtils {
 	}
 
 	public static URI getURI(Capability contentCapability) {
-		Object uriObj = contentCapability.getAttributes().get(ContentNamespace.CAPABILITY_URL_ATTRIBUTE);
+		Object uriObj = contentCapability.getAttributes().get("url");
 		if (uriObj == null)
 			return null;
 
@@ -288,14 +284,14 @@ public class ResourceUtils {
 			name = HostNamespace.CAPABILITY_BUNDLE_VERSION_ATTRIBUTE;
 		else if (PackageNamespace.PACKAGE_NAMESPACE.equals(ns))
 			name = PackageNamespace.CAPABILITY_VERSION_ATTRIBUTE;
-		else if (ServiceNamespace.SERVICE_NAMESPACE.equals(ns))
+		else if ("osgi.service".equals(ns))
 			name = null;
 		else if (ExecutionEnvironmentNamespace.EXECUTION_ENVIRONMENT_NAMESPACE.equals(ns))
 			name = ExecutionEnvironmentNamespace.CAPABILITY_VERSION_ATTRIBUTE;
-		else if (ExtenderNamespace.EXTENDER_NAMESPACE.equals(ns))
-			name = ExtenderNamespace.CAPABILITY_VERSION_ATTRIBUTE;
-		else if (ContractNamespace.CONTRACT_NAMESPACE.equals(ns))
-			name = ContractNamespace.CAPABILITY_VERSION_ATTRIBUTE;
+		else if ("osgi.extender".equals(ns))
+			name = "version";
+		else if ("osgi.contract".equals(ns))
+			name = "version";
 		else
 			name = null;
 
-- 
2.7.4