Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2012-02-22 17:30:26 +0000
committerThomas Watson2012-02-22 19:40:25 +0000
commit61b4c49d88895f2c7cc9760a8d74816f7206f7f4 (patch)
treeadc3e9fe674a5438ed8de06a408957ded63cc0a9
parent86ebd7592f8ec2cd63934c99f50e15dace1f90c6 (diff)
downloadrt.equinox.framework-61b4c49d88895f2c7cc9760a8d74816f7206f7f4.tar.gz
rt.equinox.framework-61b4c49d88895f2c7cc9760a8d74816f7206f7f4.tar.xz
rt.equinox.framework-61b4c49d88895f2c7cc9760a8d74816f7206f7f4.zip
Bug 371997 - org.eclipse.osgi needs to be updated with the newv20120222-1940
org.osgi.framework.namespace package
-rw-r--r--bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resource/BasicTest.java45
-rw-r--r--bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resource/ResolverHookTests.java17
-rw-r--r--bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/OSGiCapabilityTest.java8
-rw-r--r--bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/StateResolverTest.java6
-rw-r--r--bundles/org.eclipse.osgi/.settings/.api_filters99
-rw-r--r--bundles/org.eclipse.osgi/META-INF/MANIFEST.MF3
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Bundle.java4
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/CapabilityPermission.java10
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Constants.java38
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/bundle/CollisionHook.java12
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/resolver/ResolverHook.java120
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/AbstractWiringNamespace.java56
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/BundleNamespace.java170
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/ContractNamespace.java54
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/ExecutionEnvironmentNamespace.java55
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/ExtenderNamespace.java54
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/HostNamespace.java169
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/IdentityNamespace.java110
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/PackageNamespace.java75
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/ResourceConstants.java377
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleCapability.java8
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleRequirement.java12
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleRevision.java108
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleWire.java2
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleWiring.java155
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/resource/Capability.java (renamed from bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/Capability.java)29
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/resource/Namespace.java154
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/resource/Requirement.java (renamed from bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/Requirement.java)28
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/resource/Resource.java (renamed from bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/Resource.java)46
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/resource/Wire.java (renamed from bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/Wire.java)4
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/resource/Wiring.java (renamed from bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/Wiring.java)76
-rw-r--r--bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverBundle.java6
-rw-r--r--bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverImpl.java4
-rw-r--r--bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/BundleDescriptionImpl.java4
-rw-r--r--bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/GenericSpecificationImpl.java4
-rw-r--r--bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateBuilder.java28
-rw-r--r--bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/VersionConstraintImpl.java34
37 files changed, 1379 insertions, 805 deletions
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resource/BasicTest.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resource/BasicTest.java
index b4635251a..df86b177e 100644
--- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resource/BasicTest.java
+++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resource/BasicTest.java
@@ -15,8 +15,9 @@ import java.util.Map.Entry;
import junit.framework.*;
import org.osgi.framework.Bundle;
import org.osgi.framework.Version;
-import org.osgi.framework.resource.*;
+import org.osgi.framework.namespace.IdentityNamespace;
import org.osgi.framework.wiring.*;
+import org.osgi.resource.*;
public class BasicTest extends AbstractResourceTest {
private interface CapabilityProvider {
@@ -154,7 +155,7 @@ public class BasicTest extends AbstractResourceTest {
assertVersion("1.0.0", version);
// Make sure TB1's type is correct.
String type = getType(revision);
- assertType(ResourceConstants.IDENTITY_TYPE_BUNDLE, type);
+ assertType(IdentityNamespace.TYPE_BUNDLE, type);
Map arbitraryAttrs = new HashMap();
arbitraryAttrs.put("attr1", "a1");
arbitraryAttrs.put("attr2", "a2");
@@ -173,7 +174,7 @@ public class BasicTest extends AbstractResourceTest {
capability = getIdentityCapability(wiring);
assertIdentityCapability(capability, symbolicName, version, type, arbitraryAttrs, arbitraryDirs);
// There should be 1 provided osgi.identity wire (TB1 -> TB3).
- List wires = wiring.getProvidedWires(ResourceConstants.IDENTITY_NAMESPACE);
+ List wires = wiring.getProvidedWires(IdentityNamespace.IDENTITY_NAMESPACE);
assertWires(wires, 1);
// Check the osgi.identity wire between TB1 and TB3.
Wire wire = (Wire) wires.get(0);
@@ -181,7 +182,7 @@ public class BasicTest extends AbstractResourceTest {
Requirement requirement = getIdentityRequirement(requirer, 0);
assertIdentityWire(wire, capability, revision, requirement, requirer);
// There should be 1 required osgi.identity wire (TB4 -> TB1 via TF1).
- wires = wiring.getRequiredWires(ResourceConstants.IDENTITY_NAMESPACE);
+ wires = wiring.getRequiredWires(IdentityNamespace.IDENTITY_NAMESPACE);
assertWires(wires, 1);
// Check the osgi.identity wire between TB4 and TB1 (via TF1).
wire = (Wire) wires.get(0);
@@ -243,7 +244,7 @@ public class BasicTest extends AbstractResourceTest {
assertVersion("1.0.0", version);
// Make sure TB3's type is correct.
String type = getType(revision);
- assertType(ResourceConstants.IDENTITY_TYPE_BUNDLE, type);
+ assertType(IdentityNamespace.TYPE_BUNDLE, type);
// Check TB3's osgi.identity capability from the revision.
Capability capability = getIdentityCapability(revision);
assertIdentityCapability(capability, symbolicName, version, type, Collections.EMPTY_MAP, Collections.EMPTY_MAP);
@@ -256,7 +257,7 @@ public class BasicTest extends AbstractResourceTest {
capability = getIdentityCapability(wiring);
assertIdentityCapability(capability, symbolicName, version, type, Collections.EMPTY_MAP, Collections.EMPTY_MAP);
// There should be 2 required osgi.identity wires (TB1 -> TB3 and TF1 -> TB3).
- List wires = wiring.getRequiredWires(ResourceConstants.IDENTITY_NAMESPACE);
+ List wires = wiring.getRequiredWires(IdentityNamespace.IDENTITY_NAMESPACE);
assertWires(wires, 2);
// Check the osgi.identity wire between TB1 and TB3.
Wire wire = (Wire) wires.get(0);
@@ -292,7 +293,7 @@ public class BasicTest extends AbstractResourceTest {
assertVersion("1.0.0", version);
// Make sure TB4's type is correct.
String type = getType(revision);
- assertType(ResourceConstants.IDENTITY_TYPE_BUNDLE, type);
+ assertType(IdentityNamespace.TYPE_BUNDLE, type);
// Check TB4's osgi.identity capability from the revision.
Capability capability = getIdentityCapability(revision);
assertIdentityCapability(capability, symbolicName, version, type, Collections.EMPTY_MAP, Collections.EMPTY_MAP);
@@ -305,7 +306,7 @@ public class BasicTest extends AbstractResourceTest {
capability = getIdentityCapability(wiring);
assertIdentityCapability(capability, symbolicName, version, type, Collections.EMPTY_MAP, Collections.EMPTY_MAP);
// There should be 1 provided osgi.identity wire (TB4 -> TB1 via TF1).
- List wires = wiring.getProvidedWires(ResourceConstants.IDENTITY_NAMESPACE);
+ List wires = wiring.getProvidedWires(IdentityNamespace.IDENTITY_NAMESPACE);
assertWires(wires, 1);
// Check the osgi.identity wire between TB4 and TB1 (via TF1).
Wire wire = (Wire) wires.get(0);
@@ -337,7 +338,7 @@ public class BasicTest extends AbstractResourceTest {
assertVersion("1.0.0", version);
// Make sure TF1's type is correct.
String type = getType(revision);
- assertType(ResourceConstants.IDENTITY_TYPE_FRAGMENT, type);
+ assertType(IdentityNamespace.TYPE_FRAGMENT, type);
// Check TF1's osgi.identity capability from the revision.
Capability capability = getIdentityCapability(revision);
assertIdentityCapability(capability, symbolicName, version, type, Collections.EMPTY_MAP, Collections.EMPTY_MAP);
@@ -350,7 +351,7 @@ public class BasicTest extends AbstractResourceTest {
capability = getIdentityCapability(wiring);
assertIdentityCapability(capability, symbolicName, version, type, Collections.EMPTY_MAP, Collections.EMPTY_MAP);
// There should be 1 provided osgi.identity wire (TF1 -> TB3).
- List wires = wiring.getProvidedWires(ResourceConstants.IDENTITY_NAMESPACE);
+ List wires = wiring.getProvidedWires(IdentityNamespace.IDENTITY_NAMESPACE);
assertWires(wires, 1);
// Check the osgi.identity wire between TF1 and TB3.
Wire wire = (Wire) wires.get(0);
@@ -403,20 +404,20 @@ public class BasicTest extends AbstractResourceTest {
}
private void assertFilterDirective(Requirement requirement) {
- assertNotNull("Missing filter directive", requirement.getDirectives().get(ResourceConstants.REQUIREMENT_FILTER_DIRECTIVE));
+ assertNotNull("Missing filter directive", requirement.getDirectives().get(Namespace.REQUIREMENT_FILTER_DIRECTIVE));
}
private void assertIdentityCapability(Capability capability, String symbolicName, Version version, String type, Map arbitraryAttrs, Map arbitraryDirs) {
- assertEquals("Wrong namespace", ResourceConstants.IDENTITY_NAMESPACE, capability.getNamespace());
+ assertEquals("Wrong namespace", IdentityNamespace.IDENTITY_NAMESPACE, capability.getNamespace());
assertEquals("Wrong number of attributes", 3 + arbitraryAttrs.size(), capability.getAttributes().size());
// The osgi.identity attribute contains the symbolic name of the resource.
- assertSymbolicName(symbolicName, (String) capability.getAttributes().get(ResourceConstants.IDENTITY_NAMESPACE));
+ assertSymbolicName(symbolicName, (String) capability.getAttributes().get(IdentityNamespace.IDENTITY_NAMESPACE));
// The version attribute must be of type Version.
// The version attribute contains the version of the resource.
- assertVersion(version, (Version) capability.getAttributes().get(ResourceConstants.IDENTITY_VERSION_ATTRIBUTE));
+ assertVersion(version, (Version) capability.getAttributes().get(IdentityNamespace.CAPABILITY_VERSION_ATTRIBUTE));
// The type attribute must be of type String.
// The type attribute contains the resource type.
- assertType(type, (String) capability.getAttributes().get(ResourceConstants.IDENTITY_TYPE_ATTRIBUTE));
+ assertType(type, (String) capability.getAttributes().get(IdentityNamespace.CAPABILITY_TYPE_ATTRIBUTE));
Map attributes = capability.getAttributes();
for (Iterator iEntries = arbitraryAttrs.entrySet().iterator(); iEntries.hasNext();) {
Map.Entry entry = (Entry) iEntries.next();
@@ -438,7 +439,7 @@ public class BasicTest extends AbstractResourceTest {
}
private void assertNotIdentityCapability(CapabilityProvider provider) {
- List capabilities = provider.getCapabilities(ResourceConstants.IDENTITY_NAMESPACE);
+ List capabilities = provider.getCapabilities(IdentityNamespace.IDENTITY_NAMESPACE);
// A resource with no symbolic name must not provide an identity capability.
assertCapabilities(capabilities, 0);
}
@@ -502,12 +503,12 @@ public class BasicTest extends AbstractResourceTest {
attributes.put("foo", "bar");
attributes.put("x", "y");
Map directives = new HashMap();
- directives.put(ResourceConstants.CAPABILITY_MANDATORY_DIRECTIVE, "foo,x");
+ directives.put(Namespace.RESOLUTION_MANDATORY, "foo,x");
return new BasicCapability(namespace, attributes, directives);
}
private Capability getIdentityCapability(BundleRevision revision) {
- List capabilities = revision.getDeclaredCapabilities(ResourceConstants.IDENTITY_NAMESPACE);
+ List capabilities = revision.getDeclaredCapabilities(IdentityNamespace.IDENTITY_NAMESPACE);
assertCapabilities(capabilities, 1);
Capability capability = (Capability) capabilities.get(0);
assertNotNull(capability);
@@ -515,7 +516,7 @@ public class BasicTest extends AbstractResourceTest {
}
private Capability getIdentityCapability(BundleWiring wiring) {
- List capabilities = wiring.getCapabilities(ResourceConstants.IDENTITY_NAMESPACE);
+ List capabilities = wiring.getCapabilities(IdentityNamespace.IDENTITY_NAMESPACE);
assertCapabilities(capabilities, 1);
Capability capability = (Capability) capabilities.get(0);
assertNotNull(capability);
@@ -523,7 +524,7 @@ public class BasicTest extends AbstractResourceTest {
}
private Capability getIdentityCapability(Resource resource) {
- List capabilities = resource.getCapabilities(ResourceConstants.IDENTITY_NAMESPACE);
+ List capabilities = resource.getCapabilities(IdentityNamespace.IDENTITY_NAMESPACE);
assertCapabilities(capabilities, 1);
Capability capability = (Capability) capabilities.get(0);
assertNotNull(capability);
@@ -531,7 +532,7 @@ public class BasicTest extends AbstractResourceTest {
}
private Requirement getIdentityRequirement(BundleRevision revision, int index) {
- List requirements = revision.getDeclaredRequirements(ResourceConstants.IDENTITY_NAMESPACE);
+ List requirements = revision.getDeclaredRequirements(IdentityNamespace.IDENTITY_NAMESPACE);
assertRequirements(requirements, index);
Requirement requirement = (Requirement) requirements.get(index);
assertNotNull(requirement);
@@ -539,6 +540,6 @@ public class BasicTest extends AbstractResourceTest {
}
private String getType(BundleRevision revision) {
- return (revision.getTypes() & BundleRevision.TYPE_FRAGMENT) == 0 ? ResourceConstants.IDENTITY_TYPE_BUNDLE : ResourceConstants.IDENTITY_TYPE_FRAGMENT;
+ return (revision.getTypes() & BundleRevision.TYPE_FRAGMENT) == 0 ? IdentityNamespace.TYPE_BUNDLE : IdentityNamespace.TYPE_FRAGMENT;
}
}
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resource/ResolverHookTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resource/ResolverHookTests.java
index c0715aa5e..c4cbaf93e 100644
--- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resource/ResolverHookTests.java
+++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resource/ResolverHookTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 IBM Corporation and others.
+ * Copyright (c) 2011, 2012 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
@@ -10,8 +10,6 @@
*******************************************************************************/
package org.eclipse.osgi.tests.resource;
-import org.osgi.framework.resource.ResourceConstants;
-
import java.util.*;
import junit.framework.Test;
import junit.framework.TestSuite;
@@ -19,6 +17,7 @@ import org.osgi.framework.Bundle;
import org.osgi.framework.ServiceRegistration;
import org.osgi.framework.hooks.resolver.ResolverHook;
import org.osgi.framework.hooks.resolver.ResolverHookFactory;
+import org.osgi.framework.namespace.IdentityNamespace;
import org.osgi.framework.wiring.*;
public class ResolverHookTests extends AbstractResourceTest {
@@ -43,14 +42,14 @@ public class ResolverHookTests extends AbstractResourceTest {
return;
called[0] = true;
try {
- assertEquals("Wrong namespace", ResourceConstants.IDENTITY_NAMESPACE, singleton.getNamespace());
- assertEquals("Wrong singleton directive", "true", singleton.getDirectives().get(ResourceConstants.IDENTITY_SINGLETON_DIRECTIVE));
- String symbolicName = (String) singleton.getAttributes().get(ResourceConstants.IDENTITY_NAMESPACE);
+ assertEquals("Wrong namespace", IdentityNamespace.IDENTITY_NAMESPACE, singleton.getNamespace());
+ assertEquals("Wrong singleton directive", "true", singleton.getDirectives().get(IdentityNamespace.CAPABILITY_SINGLETON_DIRECTIVE));
+ String symbolicName = (String) singleton.getAttributes().get(IdentityNamespace.IDENTITY_NAMESPACE);
for (Iterator iCandidates = collisionCandidates.iterator(); iCandidates.hasNext();) {
BundleCapability candidate = (BundleCapability) iCandidates.next();
- assertEquals("Wrong namespace", ResourceConstants.IDENTITY_NAMESPACE, candidate.getNamespace());
- assertEquals("Wrong singleton directive", "true", candidate.getDirectives().get(ResourceConstants.IDENTITY_SINGLETON_DIRECTIVE));
- assertEquals("Wrong symbolic name", symbolicName, (String) candidate.getAttributes().get(ResourceConstants.IDENTITY_NAMESPACE));
+ assertEquals("Wrong namespace", IdentityNamespace.IDENTITY_NAMESPACE, candidate.getNamespace());
+ assertEquals("Wrong singleton directive", "true", candidate.getDirectives().get(IdentityNamespace.CAPABILITY_SINGLETON_DIRECTIVE));
+ assertEquals("Wrong symbolic name", symbolicName, (String) candidate.getAttributes().get(IdentityNamespace.IDENTITY_NAMESPACE));
}
} catch (RuntimeException e) {
error[0] = e;
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 483477993..6e00f7614 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2011 IBM Corporation and others.
+ * Copyright (c) 2010, 2012 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
@@ -20,9 +20,11 @@ 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.*;
+import org.osgi.framework.namespace.IdentityNamespace;
import org.osgi.framework.wiring.BundleWire;
import org.osgi.framework.wiring.BundleWiring;
+import org.osgi.resource.Capability;
+import org.osgi.resource.Requirement;
public class OSGiCapabilityTest extends AbstractStateTest {
private static final String MANIFEST_ROOT = "test_files/genericCapability/";
@@ -187,7 +189,7 @@ public class OSGiCapabilityTest extends AbstractStateTest {
assertEquals("Specs do not match Descs", genRequired.length, genProvided.length + (fragIdentity == null ? 0 : 1));
Collection providedCollection = new ArrayList(Arrays.asList(genProvided));
for (int i = 0; i < genRequired.length; i++) {
- if (ResourceConstants.IDENTITY_NAMESPACE.equals(genRequired[i].getType()) && genRequired[i].getSupplier().getHost() != null)
+ if (IdentityNamespace.IDENTITY_NAMESPACE.equals(genRequired[i].getType()) && genRequired[i].getSupplier().getHost() != null)
assertEquals("Wrong fragment provider: " + genRequired[i], fragIdentity, genRequired[i]);
else
assertTrue("Wrong provider for requirement: " + genRequired[i], providedCollection.remove(genRequired[i]));
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/StateResolverTest.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/StateResolverTest.java
index b58ca558d..c1835d7b7 100644
--- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/StateResolverTest.java
+++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/StateResolverTest.java
@@ -22,9 +22,9 @@ import org.eclipse.osgi.internal.resolver.StateObjectFactoryImpl;
import org.eclipse.osgi.service.resolver.*;
import org.eclipse.osgi.tests.OSGiTestsActivator;
import org.osgi.framework.*;
-import org.osgi.framework.resource.Capability;
-import org.osgi.framework.resource.ResourceConstants;
+import org.osgi.framework.namespace.IdentityNamespace;
import org.osgi.framework.wiring.*;
+import org.osgi.resource.Capability;
public class StateResolverTest extends AbstractStateTest {
public static Test suite() {
@@ -2775,7 +2775,7 @@ public class StateResolverTest extends AbstractStateTest {
state.addBundle(systemB);
state.resolve();
- Collection ids = systemBundle.getCapabilities(ResourceConstants.IDENTITY_NAMESPACE);
+ Collection ids = systemBundle.getCapabilities(IdentityNamespace.IDENTITY_NAMESPACE);
assertNotNull("Null osgi.identity", ids);
assertEquals("Wrong number of identities", 1, ids.size());
diff --git a/bundles/org.eclipse.osgi/.settings/.api_filters b/bundles/org.eclipse.osgi/.settings/.api_filters
index 929723b61..a794f5110 100644
--- a/bundles/org.eclipse.osgi/.settings/.api_filters
+++ b/bundles/org.eclipse.osgi/.settings/.api_filters
@@ -402,6 +402,13 @@
</filter>
</resource>
<resource path="osgi/src/org/osgi/framework/Constants.java" type="org.osgi.framework.Constants">
+ <filter comment="Ignore OSGi API" id="1209008130">
+ <message_arguments>
+ <message_argument value="1.7"/>
+ <message_argument value="3.8"/>
+ <message_argument value="FRAMEWORK_BSNVERSION_MANAGED"/>
+ </message_arguments>
+ </filter>
<filter comment="Ignore OSGi APIs" id="1209008130">
<message_arguments>
<message_argument value="1.7"/>
@@ -435,45 +442,59 @@
</message_arguments>
</filter>
</resource>
- <resource path="osgi/src/org/osgi/framework/resource/Capability.java" type="org.osgi.framework.resource.Capability">
- <filter id="1110441988">
+ <resource path="osgi/src/org/osgi/framework/namespace/AbstractWiringNamespace.java" type="org.osgi.framework.namespace.AbstractWiringNamespace">
+ <filter comment="Ignore OSGi API" id="1110441988">
<message_arguments>
- <message_argument value="org.osgi.framework.resource.Capability"/>
+ <message_argument value="org.osgi.framework.namespace.AbstractWiringNamespace"/>
</message_arguments>
</filter>
</resource>
- <resource path="osgi/src/org/osgi/framework/resource/Requirement.java" type="org.osgi.framework.resource.Requirement">
- <filter id="1110441988">
+ <resource path="osgi/src/org/osgi/framework/namespace/BundleNamespace.java" type="org.osgi.framework.namespace.BundleNamespace">
+ <filter comment="Ignore OSGi API" id="1110441988">
<message_arguments>
- <message_argument value="org.osgi.framework.resource.Requirement"/>
+ <message_argument value="org.osgi.framework.namespace.BundleNamespace"/>
</message_arguments>
</filter>
</resource>
- <resource path="osgi/src/org/osgi/framework/resource/Resource.java" type="org.osgi.framework.resource.Resource">
- <filter id="1110441988">
+ <resource path="osgi/src/org/osgi/framework/namespace/ContractNamespace.java" type="org.osgi.framework.namespace.ContractNamespace">
+ <filter comment="Ignore OSGi API" id="1110441988">
<message_arguments>
- <message_argument value="org.osgi.framework.resource.Resource"/>
+ <message_argument value="org.osgi.framework.namespace.ContractNamespace"/>
</message_arguments>
</filter>
</resource>
- <resource path="osgi/src/org/osgi/framework/resource/ResourceConstants.java" type="org.osgi.framework.resource.ResourceConstants">
- <filter id="1110441988">
+ <resource path="osgi/src/org/osgi/framework/namespace/ExecutionEnvironmentNamespace.java" type="org.osgi.framework.namespace.ExecutionEnvironmentNamespace">
+ <filter comment="Ignore OSGi API" id="1110441988">
<message_arguments>
- <message_argument value="org.osgi.framework.resource.ResourceConstants"/>
+ <message_argument value="org.osgi.framework.namespace.ExecutionEnvironmentNamespace"/>
</message_arguments>
</filter>
</resource>
- <resource path="osgi/src/org/osgi/framework/resource/Wire.java" type="org.osgi.framework.resource.Wire">
- <filter id="1110441988">
+ <resource path="osgi/src/org/osgi/framework/namespace/ExtenderNamespace.java" type="org.osgi.framework.namespace.ExtenderNamespace">
+ <filter comment="Ignore OSGi API" id="1110441988">
<message_arguments>
- <message_argument value="org.osgi.framework.resource.Wire"/>
+ <message_argument value="org.osgi.framework.namespace.ExtenderNamespace"/>
</message_arguments>
</filter>
</resource>
- <resource path="osgi/src/org/osgi/framework/resource/Wiring.java" type="org.osgi.framework.resource.Wiring">
- <filter id="1110441988">
+ <resource path="osgi/src/org/osgi/framework/namespace/HostNamespace.java" type="org.osgi.framework.namespace.HostNamespace">
+ <filter comment="Ignore OSGi API" id="1110441988">
+ <message_arguments>
+ <message_argument value="org.osgi.framework.namespace.HostNamespace"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="osgi/src/org/osgi/framework/namespace/IdentityNamespace.java" type="org.osgi.framework.namespace.IdentityNamespace">
+ <filter comment="Ignore OSGi API" id="1110441988">
<message_arguments>
- <message_argument value="org.osgi.framework.resource.Wiring"/>
+ <message_argument value="org.osgi.framework.namespace.IdentityNamespace"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="osgi/src/org/osgi/framework/namespace/PackageNamespace.java" type="org.osgi.framework.namespace.PackageNamespace">
+ <filter comment="Ignore OSGi API" id="1110441988">
+ <message_arguments>
+ <message_argument value="org.osgi.framework.namespace.PackageNamespace"/>
</message_arguments>
</filter>
</resource>
@@ -520,6 +541,48 @@
</message_arguments>
</filter>
</resource>
+ <resource path="osgi/src/org/osgi/resource/Capability.java" type="org.osgi.resource.Capability">
+ <filter id="1110441988">
+ <message_arguments>
+ <message_argument value="org.osgi.resource.Capability"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="osgi/src/org/osgi/resource/Namespace.java" type="org.osgi.resource.Namespace">
+ <filter comment="Ignore OSGi API" id="1110441988">
+ <message_arguments>
+ <message_argument value="org.osgi.resource.Namespace"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="osgi/src/org/osgi/resource/Requirement.java" type="org.osgi.resource.Requirement">
+ <filter comment="Ignore OSGi API" id="1110441988">
+ <message_arguments>
+ <message_argument value="org.osgi.resource.Requirement"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="osgi/src/org/osgi/resource/Resource.java" type="org.osgi.resource.Resource">
+ <filter comment="Ignore OSGi API" id="1110441988">
+ <message_arguments>
+ <message_argument value="org.osgi.resource.Resource"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="osgi/src/org/osgi/resource/Wire.java" type="org.osgi.resource.Wire">
+ <filter comment="Ignore OSGi API" id="1110441988">
+ <message_arguments>
+ <message_argument value="org.osgi.resource.Wire"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="osgi/src/org/osgi/resource/Wiring.java" type="org.osgi.resource.Wiring">
+ <filter comment="Ignore OSGi API" id="1110441988">
+ <message_arguments>
+ <message_argument value="org.osgi.resource.Wiring"/>
+ </message_arguments>
+ </filter>
+ </resource>
<resource path="supplement/src/org/eclipse/core/runtime/internal/adaptor/Locker_JavaNio.java" type="org.eclipse.core.runtime.internal.adaptor.Locker_JavaNio">
<filter comment="Code is protected when running on a limited environment" id="630194212">
<message_arguments>
diff --git a/bundles/org.eclipse.osgi/META-INF/MANIFEST.MF b/bundles/org.eclipse.osgi/META-INF/MANIFEST.MF
index 4f3b01d46..29267ae60 100644
--- a/bundles/org.eclipse.osgi/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.osgi/META-INF/MANIFEST.MF
@@ -25,9 +25,10 @@ Export-Package: org.eclipse.osgi.event;version="1.0",
org.osgi.framework.hooks.resolver; version="1.0",
org.osgi.framework.hooks.service; version="1.1",
org.osgi.framework.hooks.weaving; version="1.0",
+ org.osgi.framework.namespace;version="1.0",
org.osgi.framework.startlevel; version="1.0",
org.osgi.framework.wiring; version="1.1",
- org.osgi.framework.resource; version="1.0",
+ org.osgi.resource; version="1.0",
org.osgi.service.condpermadmin;version="1.1.1",
org.osgi.service.framework; version="1.0"; x-internal:=true,
org.osgi.service.log; version="1.3",
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Bundle.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Bundle.java
index 96cd89a60..bc8954d89 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Bundle.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Bundle.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2011). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2012). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -1078,7 +1078,7 @@ public interface Bundle extends Comparable<Bundle> {
* This method is intended to be used to obtain configuration, setup,
* localization and other information from this bundle. This method takes
* into account that the &quot;contents&quot; of this bundle can be extended
- * with fragments. This &quot;bundle space&quot; is not a name space with
+ * with fragments. This &quot;bundle space&quot; is not a namespace with
* unique members; the same entry name can be present multiple times. This
* method therefore returns an enumeration of URL objects. These URLs can
* come from different JARs but have the same path name. This method can
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/CapabilityPermission.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/CapabilityPermission.java
index bab1ac06b..f65f518fc 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/CapabilityPermission.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/CapabilityPermission.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2011). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2012). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -133,7 +133,7 @@ public final class CapabilityPermission extends BasicPermission {
* <li>location - The location of the bundle providing the capability.</li>
* <li>id - The bundle ID of the bundle providing the capability.</li>
* <li>name - The symbolic name of the bundle providing the capability.</li>
- * <li>capability.namespace - The name space of the required capability.</li>
+ * <li>capability.namespace - The namespace of the required capability.</li>
* </ul>
* Since the above attribute names may conflict with attribute names of a
* capability, you can prefix an attribute name with '@' in the filter
@@ -146,9 +146,9 @@ public final class CapabilityPermission extends BasicPermission {
* {@code require} permission allows the owner of this permission to require
* a capability matching the attributes. The {@code provide} permission
* allows the bundle to provide a capability in the specified capability
- * name space.
+ * namespace.
*
- * @param name The capability name space or a filter over the attributes.
+ * @param name The capability namespace or a filter over the attributes.
* @param actions {@code require},{@code provide} (canonical order)
* @throws IllegalArgumentException If the specified name is a filter
* expression and either the specified action is not {@code require}
@@ -170,7 +170,7 @@ public final class CapabilityPermission extends BasicPermission {
* constructor cannot be added to a {@code CapabilityPermission} permission
* collection.
*
- * @param namespace The requested capability name space.
+ * @param namespace The requested capability namespace.
* @param attributes The requested capability attributes.
* @param providingBundle The bundle providing the requested capability.
* @param actions The action {@code require}.
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Constants.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Constants.java
index 9a86f456a..817a7c125 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Constants.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Constants.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2011). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2012). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,6 +16,7 @@
package org.osgi.framework;
+import org.osgi.framework.hooks.bundle.CollisionHook;
import org.osgi.framework.launch.Framework;
/**
@@ -1163,8 +1164,9 @@ public interface Constants {
/**
* Framework launching property specifying the trust repositories used by
* the framework. The value is a {@code java.io.File.pathSeparator}
- * separated list of valid file paths to files that contain key stores of
- * type {@code JKS}. The framework will use the key stores as trust
+ * separated list of valid file paths to files that contain key stores. Key
+ * stores of type {@code JKS} must be supported and other key store types
+ * may be supported. The framework will use the key stores as trust
* repositories to authenticate certificates of trusted signers. The key
* stores are only used as read-only trust repositories to access public
* keys. No passwords are required to access the key stores' public keys.
@@ -1290,7 +1292,7 @@ public interface Constants {
* persists across multiple Framework invocations.
*
* <p>
- * By convention, every bundle has its own unique name space, starting with
+ * By convention, every bundle has its own unique namespace, starting with
* the bundle's identifier (see {@link Bundle#getBundleId()}) and followed
* by a dot (.). A bundle may use this as the prefix of the persistent
* identifiers for the services it registers.
@@ -1660,12 +1662,11 @@ public interface Constants {
* {@link #BUNDLE_VERSION version} may be installed.
*
* <p>
- * Default value is {@link #FRAMEWORK_BSNVERSION_SINGLE single} in this
- * release of the specification. This default may change to
- * {@link #FRAMEWORK_BSNVERSION_MULTIPLE multiple} in a future specification
- * release. Therefore, code must not assume the default behavior is
- * {@code single} and should interrogate the value of this property to
- * determine the behavior.
+ * Default value is {@link #FRAMEWORK_BSNVERSION_MANAGED managed} in this
+ * release of the specification. This default may change in a future
+ * specification release. Therefore, code must not assume the default
+ * behavior is {@code managed} and should interrogate the value of this
+ * property to determine the behavior.
*
* <p>
* The value of this property may be retrieved by calling the
@@ -1673,6 +1674,7 @@ public interface Constants {
*
* @see #FRAMEWORK_BSNVERSION_MULTIPLE
* @see #FRAMEWORK_BSNVERSION_SINGLE
+ * @see #FRAMEWORK_BSNVERSION_MANAGED
* @since 1.6
*/
String FRAMEWORK_BSNVERSION = "org.osgi.framework.bsnversion";
@@ -1694,6 +1696,22 @@ public interface Constants {
*
* @since 1.6
* @see #FRAMEWORK_BSNVERSION
+ * @see BundleException#DUPLICATE_BUNDLE_ERROR
*/
String FRAMEWORK_BSNVERSION_SINGLE = "single";
+
+ /**
+ * Specifies the framework must consult the {@link CollisionHook bundle
+ * collision hook} services to determine if it will be an error to install a
+ * bundle or update a bundle to have the same symbolic name and version as
+ * another installed bundle. If no bundle collision hook services are
+ * registered, then it will be an error to install a bundle or update a
+ * bundle to have the same symbolic name and version as another installed
+ * bundle.
+ *
+ * @since 1.7
+ * @see #FRAMEWORK_BSNVERSION
+ * @see BundleException#DUPLICATE_BUNDLE_ERROR
+ */
+ String FRAMEWORK_BSNVERSION_MANAGED = "managed";
}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/bundle/CollisionHook.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/bundle/CollisionHook.java
index f7358d518..9f4ee5c02 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/bundle/CollisionHook.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/bundle/CollisionHook.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2011). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2011, 2012). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,14 +19,18 @@ import java.util.Collection;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
/**
* OSGi Framework Bundle Collision Hook Service.
*
* <p>
- * Bundles registering this service will be called during framework bundle
- * install and update operations to determine if an install or update operation
- * will result in a bundle symbolic name and version collision.
+ * If the framework was launched with the {@link Constants#FRAMEWORK_BSNVERSION
+ * org.osgi.framework.bsnversion} framework launching property set to
+ * {@link Constants#FRAMEWORK_BSNVERSION_MANAGED managed}, then bundles
+ * registering this service will be called during framework bundle install and
+ * update operations to determine if an install or update operation will result
+ * in a bundle symbolic name and version collision.
*
* @ThreadSafe
* @version $Id$
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/resolver/ResolverHook.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/resolver/ResolverHook.java
index 8ba035202..3db4f8cf3 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/resolver/ResolverHook.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/hooks/resolver/ResolverHook.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2010, 2011). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2010, 2012). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,7 +19,8 @@ package org.osgi.framework.hooks.resolver;
import java.util.Collection;
import org.osgi.framework.Bundle;
-import org.osgi.framework.resource.ResourceConstants;
+import org.osgi.framework.namespace.BundleNamespace;
+import org.osgi.framework.namespace.IdentityNamespace;
import org.osgi.framework.wiring.BundleCapability;
import org.osgi.framework.wiring.BundleRequirement;
import org.osgi.framework.wiring.BundleRevision;
@@ -60,52 +61,51 @@ import org.osgi.framework.wiring.FrameworkWiring;
*
* <li>Determine the collection of unresolved bundle revisions that may be
* considered for resolution during the current resolution process and place
- * each of the bundle revisions in a shrinkable collection {@code Resolvable}. For each
- * resolver hook call the {@link #filterResolvable(Collection)} method with the
- * shrinkable collection {@code Resolvable}.</li>
- * <li>The shrinkable collection {@code Resolvable} now contains all the unresolved
- * bundle revisions that may end up as resolved at the end of the current
- * resolve process. Any other bundle revisions that got removed from the
- * shrinkable collection {@code Resolvable} must not end up as resolved at the end of the
- * current resolve process.</li>
+ * each of the bundle revisions in a shrinkable collection {@code Resolvable}.
+ * For each resolver hook call the {@link #filterResolvable(Collection)} method
+ * with the shrinkable collection {@code Resolvable}.</li>
+ * <li>The shrinkable collection {@code Resolvable} now contains all the
+ * unresolved bundle revisions that may end up as resolved at the end of the
+ * current resolve process. Any other bundle revisions that got removed from the
+ * shrinkable collection {@code Resolvable} must not end up as resolved at the
+ * end of the current resolve process.</li>
* <li>For each bundle revision {@code B} left in the shrinkable collection
- * {@code Resolvable} and any bundle revision {@code B} which is currently resolved
- * that represents a singleton bundle do the following:
+ * {@code Resolvable} and any bundle revision {@code B} which is currently
+ * resolved that represents a singleton bundle do the following:
* <p/>
- * Determine the collection of available capabilities that have a name space of
- * {@link ResourceConstants#IDENTITY_NAMESPACE osgi.identity}, are singletons,
- * and have the same symbolic name as the singleton bundle revision {@code B}
- * and place each of the matching capabilities into a shrinkable collection
- * {@code Collisions}.
+ * Determine the collection of available capabilities that have a namespace of
+ * {@link IdentityNamespace osgi.identity}, are singletons, and have the same
+ * symbolic name as the singleton bundle revision {@code B} and place each of
+ * the matching capabilities into a shrinkable collection {@code Collisions}.
* <p/>
- * Remove the {@link ResourceConstants#IDENTITY_NAMESPACE osgi.identity}
- * capability provided by bundle revision {@code B} from shrinkable collection
- * {@code Collisions}. A singleton bundle cannot collide with itself.
+ * Remove the {@link IdentityNamespace osgi.identity} capability provided by
+ * bundle revision {@code B} from shrinkable collection {@code Collisions}. A
+ * singleton bundle cannot collide with itself.
* <p/>
* For each resolver hook call the
* {@link #filterSingletonCollisions(BundleCapability, Collection)} with the
- * {@link ResourceConstants#IDENTITY_NAMESPACE osgi.identity} capability
- * provided by bundle revision {@code B} and the shrinkable collection {@code Collisions}
+ * {@link IdentityNamespace osgi.identity} capability provided by bundle
+ * revision {@code B} and the shrinkable collection {@code Collisions}
* <p/>
* The shrinkable collection {@code Collisions} now contains all singleton
- * {@link ResourceConstants#IDENTITY_NAMESPACE osgi.identity} capabilities that
- * can influence the ability of bundle revision {@code B} to resolve.
+ * {@link IdentityNamespace osgi.identity} capabilities that can influence the
+ * ability of bundle revision {@code B} to resolve.
* <p/>
- * If the bundle revision {@code B} is already resolved then any resolvable
- * bundle revision contained in the collection {@code Collisions} is not
- * allowed to resolve.
- * </li>
+ * If the bundle revision {@code B} is already resolved then any resolvable
+ * bundle revision contained in the collection {@code Collisions} is not allowed
+ * to resolve.</li>
* <li>During a resolve process a framework is free to attempt to resolve any or
- * all bundles contained in shrinkable collection {@code Resolvable}. For each bundle
- * revision {@code B} left in the shrinkable collection {@code Resolvable} which the
- * framework attempts to resolve the following steps must be followed:
+ * all bundles contained in shrinkable collection {@code Resolvable}. For each
+ * bundle revision {@code B} left in the shrinkable collection
+ * {@code Resolvable} which the framework attempts to resolve the following
+ * steps must be followed:
* <p/>
* For each requirement {@code R} specified by bundle revision {@code B}
* determine the collection of capabilities that satisfy (or match) the
* requirement and place each matching capability into a shrinkable collection
- * {@code Candidates}. A capability is considered to match a particular requirement if
- * its attributes satisfy a specified requirement and the requirer bundle has
- * permission to access the capability.
+ * {@code Candidates}. A capability is considered to match a particular
+ * requirement if its attributes satisfy a specified requirement and the
+ * requirer bundle has permission to access the capability.
*
* <p/>
* For each resolver hook call the
@@ -113,10 +113,10 @@ import org.osgi.framework.wiring.FrameworkWiring;
* {@code R} and the shrinkable collection {@code Candidates}.
*
* <p/>
- * The shrinkable collection {@code Candidates} now contains all the capabilities that
- * may be used to satisfy the requirement {@code R}. Any other capabilities that
- * got removed from the shrinkable collection {@code Candidates} must not be used to
- * satisfy requirement {@code R}.</li>
+ * The shrinkable collection {@code Candidates} now contains all the
+ * capabilities that may be used to satisfy the requirement {@code R}. Any other
+ * capabilities that got removed from the shrinkable collection
+ * {@code Candidates} must not be used to satisfy requirement {@code R}.</li>
* <li>For each resolver hook call the {@link #end()} method to inform the hooks
* about a resolve process ending.</li>
* </ol>
@@ -156,20 +156,18 @@ public interface ResolverHook {
* represents a singleton capability and the specified collection represent
* a collection of singleton capabilities which are considered collision
* candidates. The singleton capability and the collection of collision
- * candidates must all use the same name space.
+ * candidates must all use the same namespace.
* <p>
- * Currently only capabilities with the name space of
- * {@link BundleRevision#BUNDLE_NAMESPACE osgi.wiring.bundle} and
- * {@link ResourceConstants#IDENTITY_NAMESPACE osgi.identity} can be
- * singletons. The collision candidates will all have the same name space,
- * be singletons, and have the same symbolic name as the specified
- * singleton capability.
+ * Currently only capabilities with the namespace of {@link BundleNamespace
+ * osgi.wiring.bundle} and {@link IdentityNamespace osgi.identity} can be
+ * singletons. The collision candidates will all have the same namespace, be
+ * singletons, and have the same symbolic name as the specified singleton
+ * capability.
* <p>
- * In the future, capabilities in other name spaces may support the
- * singleton concept. Hook implementations should be prepared to receive
- * calls to this method for capabilities in name spaces other than
- * {@link BundleRevision#BUNDLE_NAMESPACE osgi.wiring.bundle} or
- * {@link ResourceConstants#IDENTITY_NAMESPACE osgi.identity}.
+ * In the future, capabilities in other namespaces may support the singleton
+ * concept. Hook implementations should be prepared to receive calls to this
+ * method for capabilities in namespaces other than {@link BundleNamespace
+ * osgi.wiring.bundle} or {@link IdentityNamespace osgi.identity}.
* <p>
* This method can filter the list of collision candidates by removing
* potential collisions. Removing a collision candidate will allow the
@@ -182,18 +180,20 @@ public interface ResolverHook {
void filterSingletonCollisions(BundleCapability singleton, Collection<BundleCapability> collisionCandidates);
/**
- * Filter matches hook method. This method is called during the resolve process for the
- * specified requirement. The collection of candidates match the specified requirement.
- * This method can filter the collection of matching candidates by removing candidates from
- * the collection. Removing a candidate will prevent the resolve process from choosing the
- * removed candidate to satisfy the requirement.
+ * Filter matches hook method. This method is called during the resolve
+ * process for the specified requirement. The collection of candidates match
+ * the specified requirement. This method can filter the collection of
+ * matching candidates by removing candidates from the collection. Removing
+ * a candidate will prevent the resolve process from choosing the removed
+ * candidate to satisfy the requirement.
* <p>
- * All of the candidates will have the same name space and will
- * match the specified requirement.
+ * All of the candidates will have the same namespace and will match the
+ * specified requirement.
* <p>
- * If the Java Runtime Environment supports permissions then the collection of
- * candidates will only contain candidates for which the requirer has permission to
- * access.
+ * If the Java Runtime Environment supports permissions then the collection
+ * of candidates will only contain candidates for which the requirer has
+ * permission to access.
+ *
* @param requirement the requirement to filter candidates for
* @param candidates a collection of candidates that match the requirement
*/
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/AbstractWiringNamespace.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/AbstractWiringNamespace.java
new file mode 100644
index 000000000..383e84df9
--- /dev/null
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/AbstractWiringNamespace.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) OSGi Alliance (2012). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.osgi.framework.namespace;
+
+import org.osgi.resource.Namespace;
+
+/**
+ * Wiring Capability and Requirement Namespaces base class.
+ *
+ * <p>
+ * This class is the common class shared by all OSGi defined wiring namespaces.
+ * It defines the names for the common attributes and directives for the OSGi
+ * specified wiring namespaces.
+ *
+ * <p>
+ * The values associated with these keys are of type {@code String}, unless
+ * otherwise indicated.
+ *
+ * @Immutable
+ * @version $Id$
+ */
+public abstract class AbstractWiringNamespace extends Namespace {
+
+ /**
+ * The capability directive used to specify the comma separated list of
+ * mandatory attributes which must be specified in the
+ * {@link Namespace#REQUIREMENT_FILTER_DIRECTIVE filter} of a requirement in
+ * order for the capability to match the requirement.
+ */
+ public final static String CAPABILITY_MANDATORY_DIRECTIVE = "mandatory";
+
+ /**
+ * The capability attribute contains the {@code Version} of the resource
+ * providing the capability if one is specified or {@code 0.0.0} if not
+ * specified. The value of this attribute must be of type {@code Version}.
+ */
+ public static final String CAPABILITY_BUNDLE_VERSION_ATTRIBUTE = "bundle-version";
+
+ AbstractWiringNamespace() {
+ // empty
+ }
+}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/BundleNamespace.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/BundleNamespace.java
new file mode 100644
index 000000000..79a5a14a9
--- /dev/null
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/BundleNamespace.java
@@ -0,0 +1,170 @@
+/*
+ * Copyright (c) OSGi Alliance (2012). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.osgi.framework.namespace;
+
+import org.osgi.resource.Namespace;
+
+/**
+ * Bundle Capability and Requirement Namespace.
+ *
+ * <p>
+ * This class defines the names for the attributes and directives for this
+ * namespace. All unspecified capability attributes are of type {@code String}
+ * and are used as arbitrary matching attributes for the capability. The values
+ * associated with the specified directive and attribute keys are of type
+ * {@code String}, unless otherwise indicated.
+ * <p>
+ * For compatibility with previous versions of the specification all directives
+ * specified on the {@code Bundle-SymbolicName} header are available to this
+ * namespace. The directives {@link #CAPABILITY_FRAGMENT_ATTACHMENT_DIRECTIVE
+ * fragment-attachment} and {@link #REQUIREMENT_EXTENSION_DIRECTIVE extension}
+ * should be looked up using the {@link HostNamespace#HOST_NAMESPACE host}
+ * namespace. The directive {@link #CAPABILITY_SINGLETON_DIRECTIVE singleton}
+ * should be looked up using the {@link IdentityNamespace#IDENTITY_NAMESPACE
+ * identity} namespace. Also, the {@link Namespace#CAPABILITY_USES_DIRECTIVE uses}
+ * directive has no meaning to this namespace.
+ * <p>
+ * A non-fragment resource with the {@link IdentityNamespace#TYPE_BUNDLE
+ * osgi.bundle} type {@link IdentityNamespace#CAPABILITY_TYPE_ATTRIBUTE
+ * identity} provides exactly one<sup>&#8224;</sup> bundle capability (that is,
+ * the bundle can be required by another bundle). A fragment resource with the
+ * {@link IdentityNamespace#TYPE_FRAGMENT osgi.fragment} type
+ * {@link IdentityNamespace#CAPABILITY_TYPE_ATTRIBUTE identity} must not declare
+ * a bundle capability. A resource requires zero or more bundle requirements
+ * (that is, required bundles).
+ * <p>
+ * &#8224; A resource with no symbolic name must not provide a bundle
+ * capability.
+ *
+ * @Immutable
+ * @version $Id$
+ */
+public final class BundleNamespace extends AbstractWiringNamespace {
+
+ /**
+ * Namespace name for bundle capabilities and requirements.
+ *
+ * <p>
+ * Also, the capability attribute used to specify the symbolic name of the
+ * bundle.
+ */
+ public static final String BUNDLE_NAMESPACE = "osgi.wiring.bundle";
+
+ /**
+ * The capability directive identifying if the resource is a singleton. A
+ * {@code String} value of &quot;true&quot; indicates the resource is a
+ * singleton; any other value or <code>null</code> indicates the resource is
+ * not a singleton.
+ */
+ public static final String CAPABILITY_SINGLETON_DIRECTIVE = "singleton";
+
+ /**
+ * The capability directive identifying if and when a fragment may attach to
+ * a host bundle. The default value is {@link #FRAGMENT_ATTACHMENT_ALWAYS
+ * always}.
+ *
+ * @see #FRAGMENT_ATTACHMENT_ALWAYS
+ * @see #FRAGMENT_ATTACHMENT_RESOLVETIME
+ * @see #FRAGMENT_ATTACHMENT_NEVER
+ */
+ public static final String CAPABILITY_FRAGMENT_ATTACHMENT_DIRECTIVE = "fragment-attachment";
+
+ /**
+ * The directive value indicating that fragments are allowed to attach to
+ * the host bundle at any time (while the host is resolved or during the
+ * process of resolving the host bundle).
+ *
+ * @see #CAPABILITY_FRAGMENT_ATTACHMENT_DIRECTIVE
+ */
+ public static final String FRAGMENT_ATTACHMENT_ALWAYS = "always";
+
+ /**
+ * The directive value indicating that fragments are allowed to attach to
+ * the host bundle only during the process of resolving the host bundle.
+ *
+ * @see #CAPABILITY_FRAGMENT_ATTACHMENT_DIRECTIVE
+ */
+ public static final String FRAGMENT_ATTACHMENT_RESOLVETIME = "resolve-time";
+
+ /**
+ * The directive value indicating that no fragments are allowed to attach to
+ * the host bundle at any time.
+ *
+ * @see #CAPABILITY_FRAGMENT_ATTACHMENT_DIRECTIVE
+ */
+ public static final String FRAGMENT_ATTACHMENT_NEVER = "never";
+
+ /**
+ * The requirement directive used to specify the type of the extension
+ * fragment.
+ *
+ * @see #EXTENSION_FRAMEWORK
+ * @see #EXTENSION_BOOTCLASSPATH
+ */
+ public final static String REQUIREMENT_EXTENSION_DIRECTIVE = "extension";
+
+ /**
+ * The directive value indicating that the extension fragment is to be
+ * loaded by the framework's class loader.
+ *
+ *
+ * @see #REQUIREMENT_EXTENSION_DIRECTIVE
+ */
+ public final static String EXTENSION_FRAMEWORK = "framework";
+
+ /**
+ * The directive value indicating that the extension fragment is to be
+ * loaded by the boot class loader.
+ *
+ * @see #REQUIREMENT_EXTENSION_DIRECTIVE
+ */
+ public final static String EXTENSION_BOOTCLASSPATH = "bootclasspath";
+
+ /**
+ * The requirement directive used to specify the visibility type for a
+ * requirement. The default value is {@link #VISIBILITY_PRIVATE private}.
+ *
+ * @see #VISIBILITY_PRIVATE private
+ * @see #VISIBILITY_REEXPORT reexport
+ */
+ public final static String REQUIREMENT_VISIBILITY_DIRECTIVE = "visibility";
+
+ /**
+ * The directive value identifying a private
+ * {@link #REQUIREMENT_VISIBILITY_DIRECTIVE visibility} type. A private
+ * visibility type indicates that any {@link PackageNamespace packages} that
+ * are exported by the required bundle are not made visible on the export
+ * signature of the requiring bundle. .
+ *
+ * @see #REQUIREMENT_VISIBILITY_DIRECTIVE
+ */
+ public final static String VISIBILITY_PRIVATE = "private";
+
+ /**
+ * The directive value identifying a reexport
+ * {@link #REQUIREMENT_VISIBILITY_DIRECTIVE visibility} type. A reexport
+ * visibility type indicates any {@link PackageNamespace packages} that are
+ * exported by the required bundle are re-exported by the requiring bundle.
+ *
+ * @see #REQUIREMENT_VISIBILITY_DIRECTIVE
+ */
+ public final static String VISIBILITY_REEXPORT = "reexport";
+
+ private BundleNamespace() {
+ // empty
+ }
+}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/ContractNamespace.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/ContractNamespace.java
new file mode 100644
index 000000000..485f581dc
--- /dev/null
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/ContractNamespace.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) OSGi Alliance (2012). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.osgi.framework.namespace;
+
+import org.osgi.resource.Namespace;
+
+/**
+ * Contract Capability and Requirement Namespace.
+ *
+ * <p>
+ * This class defines the names for the attributes and directives for this
+ * namespace. All unspecified capability attributes are of type {@code String}
+ * and are used as arbitrary matching attributes for the capability. The values
+ * associated with the specified directive and attribute keys are of type
+ * {@code String}, unless otherwise indicated.
+ *
+ * @Immutable
+ * @version $Id$
+ */
+public final class ContractNamespace extends Namespace {
+
+ /**
+ * Namespace name for contract capabilities and requirements.
+ *
+ * <p>
+ * Also, the capability attribute used to specify the name of the contract.
+ */
+ public static final String CONTRACT_NAMESPACE = "osgi.contract";
+
+ /**
+ * The capability attribute contains the {@code Version} of the
+ * specification of the contract. The value of this attribute must be of
+ * type {@code Version}.
+ */
+ public final static String CAPABILITY_VERSION_ATTRIBUTE = "version";
+
+ private ContractNamespace() {
+ // empty
+ }
+}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/ExecutionEnvironmentNamespace.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/ExecutionEnvironmentNamespace.java
new file mode 100644
index 000000000..e1c30aac8
--- /dev/null
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/ExecutionEnvironmentNamespace.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) OSGi Alliance (2012). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.osgi.framework.namespace;
+
+import org.osgi.resource.Namespace;
+
+/**
+ * Execution Environment Capability and Requirement Namespace.
+ *
+ * <p>
+ * This class defines the names for the attributes and directives for this
+ * namespace. All unspecified capability attributes are of type {@code String}
+ * and are used as arbitrary matching attributes for the capability. The values
+ * associated with the specified directive and attribute keys are of type
+ * {@code String}, unless otherwise indicated.
+ *
+ * @Immutable
+ * @version $Id$
+ */
+public final class ExecutionEnvironmentNamespace extends Namespace {
+
+ /**
+ * Namespace name for execution environment capabilities and requirements.
+ *
+ * <p>
+ * Also, the capability attribute used to specify the name of the execution
+ * environment.
+ */
+ public static final String EXECUTION_ENVIRONMENT_NAMESPACE = "osgi.ee";
+
+ /**
+ * The capability attribute contains the versions of the execution
+ * environment. The value of this attribute must be of type
+ * {@code List<Version>}.
+ */
+ public final static String CAPABILITY_VERSION_ATTRIBUTE = "version";
+
+ private ExecutionEnvironmentNamespace() {
+ // empty
+ }
+}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/ExtenderNamespace.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/ExtenderNamespace.java
new file mode 100644
index 000000000..2434f81e9
--- /dev/null
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/ExtenderNamespace.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) OSGi Alliance (2012). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.osgi.framework.namespace;
+
+import org.osgi.resource.Namespace;
+
+/**
+ * Extender Capability and Requirement Namespace.
+ *
+ * <p>
+ * This class defines the names for the attributes and directives for this
+ * namespace. All unspecified capability attributes are of type {@code String}
+ * and are used as arbitrary matching attributes for the capability. The values
+ * associated with the specified directive and attribute keys are of type
+ * {@code String}, unless otherwise indicated.
+ *
+ * @Immutable
+ * @version $Id$
+ */
+public final class ExtenderNamespace extends Namespace {
+
+ /**
+ * Namespace name for extender capabilities and requirements.
+ *
+ * <p>
+ * Also, the capability attribute used to specify the name of the extender.
+ */
+ public static final String EXTENDER_NAMESPACE = "osgi.extender";
+
+ /**
+ * The capability attribute contains the {@code Version} of the
+ * specification of the extender. The value of this attribute must be of
+ * type {@code Version}.
+ */
+ public final static String CAPABILITY_VERSION_ATTRIBUTE = "version";
+
+ private ExtenderNamespace() {
+ // empty
+ }
+}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/HostNamespace.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/HostNamespace.java
new file mode 100644
index 000000000..d9482705d
--- /dev/null
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/HostNamespace.java
@@ -0,0 +1,169 @@
+/*
+ * Copyright (c) OSGi Alliance (2012). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.osgi.framework.namespace;
+
+import org.osgi.resource.Namespace;
+
+/**
+ * Host Capability and Requirement Namespace.
+ *
+ * <p>
+ * This class defines the names for the attributes and directives for this
+ * namespace. All unspecified capability attributes are of type {@code String}
+ * and are used as arbitrary matching attributes for the capability. The values
+ * associated with the specified directive and attribute keys are of type
+ * {@code String}, unless otherwise indicated.
+ * <p>
+ * For compatibility with previous versions of the specification all directives
+ * specified on the {@code Bundle-SymbolicName} header are available to this
+ * namespace. The directive {@link #REQUIREMENT_VISIBILITY_DIRECTIVE visibility}
+ * should be looked up using the {@link BundleNamespace#BUNDLE_NAMESPACE bundle}
+ * namespace. The directive {@link #CAPABILITY_SINGLETON_DIRECTIVE singleton}
+ * should be looked up using the {@link IdentityNamespace#IDENTITY_NAMESPACE
+ * identity} namespace. Also, the {@link Namespace#CAPABILITY_USES_DIRECTIVE uses}
+ * directive has no meaning to this namespace.
+ * <p>
+ * A non-fragment resource with the with the
+ * {@link IdentityNamespace#TYPE_BUNDLE osgi.bundle} type
+ * {@link IdentityNamespace#CAPABILITY_TYPE_ATTRIBUTE identity} provides zero or
+ * one<sup>&#8224;</sup> host capabilities. A fragment resource with the
+ * {@link IdentityNamespace#TYPE_FRAGMENT osgi.fragment} type
+ * {@link IdentityNamespace#CAPABILITY_TYPE_ATTRIBUTE identity} must not declare
+ * a host capability and must declare exactly one host requirement.
+ * <p>
+ * &#8224; A resource with no bundle symbolic name must not provide a host
+ * capability.
+ *
+ * @Immutable
+ * @version $Id$
+ */
+public final class HostNamespace extends AbstractWiringNamespace {
+
+ /**
+ * Namespace name for host capabilities and requirements.
+ *
+ * <p>
+ * Also, the capability attribute used to specify the symbolic name of the
+ * host.
+ *
+ */
+ public static final String HOST_NAMESPACE = "osgi.wiring.host";
+
+ /**
+ * The capability directive identifying if the resource is a singleton. A
+ * {@code String} value of &quot;true&quot; indicates the resource is a
+ * singleton; any other value or <code>null</code> indicates the resource is
+ * not a singleton.
+ */
+ public static final String CAPABILITY_SINGLETON_DIRECTIVE = "singleton";
+
+ /**
+ * The capability directive identifying if and when a fragment may attach to
+ * a host bundle. The default value is {@link #FRAGMENT_ATTACHMENT_ALWAYS
+ * always}.
+ *
+ * @see #FRAGMENT_ATTACHMENT_ALWAYS
+ * @see #FRAGMENT_ATTACHMENT_RESOLVETIME
+ * @see #FRAGMENT_ATTACHMENT_NEVER
+ */
+ public static final String CAPABILITY_FRAGMENT_ATTACHMENT_DIRECTIVE = "fragment-attachment";
+
+ /**
+ * The directive value indicating that fragments are allowed to attach to
+ * the host bundle at any time (while the host is resolved or during the
+ * process of resolving the host bundle).
+ *
+ * @see #CAPABILITY_FRAGMENT_ATTACHMENT_DIRECTIVE
+ */
+ public static final String FRAGMENT_ATTACHMENT_ALWAYS = "always";
+
+ /**
+ * The directive value indicating that fragments are allowed to attach to
+ * the host bundle only during the process of resolving the host bundle.
+ *
+ * @see #CAPABILITY_FRAGMENT_ATTACHMENT_DIRECTIVE
+ */
+ public static final String FRAGMENT_ATTACHMENT_RESOLVETIME = "resolve-time";
+
+ /**
+ * The directive value indicating that no fragments are allowed to attach to
+ * the host bundle at any time.
+ *
+ * @see #CAPABILITY_FRAGMENT_ATTACHMENT_DIRECTIVE
+ */
+ public static final String FRAGMENT_ATTACHMENT_NEVER = "never";
+
+ /**
+ * The requirement directive used to specify the type of the extension
+ * fragment.
+ *
+ * @see #EXTENSION_FRAMEWORK
+ * @see #EXTENSION_BOOTCLASSPATH
+ */
+ public final static String REQUIREMENT_EXTENSION_DIRECTIVE = "extension";
+
+ /**
+ * The directive value indicating that the extension fragment is to be
+ * loaded by the framework's class loader.
+ *
+ *
+ * @see #REQUIREMENT_EXTENSION_DIRECTIVE
+ */
+ public final static String EXTENSION_FRAMEWORK = "framework";
+
+ /**
+ * The directive value indicating that the extension fragment is to be
+ * loaded by the boot class loader.
+ *
+ * @see #REQUIREMENT_EXTENSION_DIRECTIVE
+ */
+ public final static String EXTENSION_BOOTCLASSPATH = "bootclasspath";
+
+ /**
+ * The requirement directive used to specify the visibility type for a
+ * requirement. The default value is {@link #VISIBILITY_PRIVATE private}.
+ *
+ * @see #VISIBILITY_PRIVATE private
+ * @see #VISIBILITY_REEXPORT reexport
+ */
+ public final static String REQUIREMENT_VISIBILITY_DIRECTIVE = "visibility";
+
+ /**
+ * The directive value identifying a private
+ * {@link #REQUIREMENT_VISIBILITY_DIRECTIVE visibility} type. A private
+ * visibility type indicates that any {@link PackageNamespace packages} that
+ * are exported by the required bundle are not made visible on the export
+ * signature of the requiring bundle. .
+ *
+ * @see #REQUIREMENT_VISIBILITY_DIRECTIVE
+ */
+ public final static String VISIBILITY_PRIVATE = "private";
+
+ /**
+ * The directive value identifying a reexport
+ * {@link #REQUIREMENT_VISIBILITY_DIRECTIVE visibility} type. A reexport
+ * visibility type indicates any {@link PackageNamespace packages} that are
+ * exported by the required bundle are re-exported by the requiring bundle.
+ *
+ * @see #REQUIREMENT_VISIBILITY_DIRECTIVE
+ */
+ public final static String VISIBILITY_REEXPORT = "reexport";
+
+ private HostNamespace() {
+ // empty
+ }
+}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/IdentityNamespace.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/IdentityNamespace.java
new file mode 100644
index 000000000..d033e96e5
--- /dev/null
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/IdentityNamespace.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) OSGi Alliance (2012). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.osgi.framework.namespace;
+
+import org.osgi.resource.Namespace;
+
+/**
+ * Identity Capability and Requirement Namespace.
+ *
+ * <p>
+ * This class defines the names for the attributes and directives for this
+ * namespace. All unspecified capability attributes are of type {@code String}
+ * and are used as arbitrary matching attributes for the capability. The values
+ * associated with the specified directive and attribute keys are of type
+ * {@code String}, unless otherwise indicated.
+ *
+ * <p>
+ * Each resource provides exactly one<sup>&#8224;</sup> identity capability that
+ * can be used to identify the resource.
+ *
+ * <p>
+ * The bundle wiring for the bundle revision provides exactly
+ * one<sup>&#8224;</sup> identity capability.
+ *
+ * <p>
+ * &#8224; A resource with no symbolic name must not provide an identity
+ * capability.
+ *
+ * @Immutable
+ * @version $Id$
+ */
+public final class IdentityNamespace extends Namespace {
+
+ /**
+ * Namespace name for identity capabilities and requirements.
+ *
+ * <p>
+ * Also, the capability attribute used to specify the symbolic name of the
+ * resource.
+ */
+ public static final String IDENTITY_NAMESPACE = "osgi.identity";
+
+ /**
+ * The capability directive identifying if the resource is a singleton. A
+ * {@code String} value of &quot;true&quot; indicates the resource is a
+ * singleton; any other value or <code>null</code> indicates the resource is
+ * not a singleton.
+ */
+ public static final String CAPABILITY_SINGLETON_DIRECTIVE = "singleton";
+
+ /**
+ * The capability attribute identifying the {@code Version} of the resource
+ * if one is specified or {@code 0.0.0} if not specified. The value of this
+ * attribute must be of type {@code Version}.
+ */
+ public static final String CAPABILITY_VERSION_ATTRIBUTE = "version";
+
+ /**
+ * The capability attribute identifying the resource type. If the resource
+ * has no type then the value {@link #TYPE_UNKNOWN unknown} must be used for
+ * the attribute.
+ *
+ * @see #TYPE_BUNDLE
+ * @see #TYPE_FRAGMENT
+ * @see #TYPE_UNKNOWN
+ */
+ public static final String CAPABILITY_TYPE_ATTRIBUTE = "type";
+
+ /**
+ * The attribute value identifying the resource
+ * {@link #CAPABILITY_TYPE_ATTRIBUTE type} as an OSGi bundle.
+ *
+ * @see #CAPABILITY_TYPE_ATTRIBUTE
+ */
+ public static final String TYPE_BUNDLE = "osgi.bundle";
+
+ /**
+ * The attribute value identifying the resource
+ * {@link #CAPABILITY_TYPE_ATTRIBUTE type} as an OSGi fragment.
+ *
+ * @see #CAPABILITY_TYPE_ATTRIBUTE
+ */
+ public static final String TYPE_FRAGMENT = "osgi.fragment";
+
+ /**
+ * The attribute value identifying the resource
+ * {@link #CAPABILITY_TYPE_ATTRIBUTE type} as unknown.
+ *
+ * @see #CAPABILITY_TYPE_ATTRIBUTE
+ */
+ public static final String TYPE_UNKNOWN = "unknown";
+
+ private IdentityNamespace() {
+ // empty
+ }
+}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/PackageNamespace.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/PackageNamespace.java
new file mode 100644
index 000000000..df5c7f2f6
--- /dev/null
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/namespace/PackageNamespace.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) OSGi Alliance (2012). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.osgi.framework.namespace;
+
+/**
+ * Package Capability and Requirement Namespace.
+ *
+ * <p>
+ * A resource provides zero or more package capabilities (this is, exported
+ * packages) and requires zero or more package requirements (that is, imported
+ * packages).
+ *
+ * <p>
+ * This class defines the names for the attributes and directives for this
+ * namespace. All unspecified capability attributes are of type {@code String}
+ * and are used as arbitrary matching attributes for the capability. The values
+ * associated with the specified directive and attribute keys are of type
+ * {@code String}, unless otherwise indicated.
+ *
+ * @Immutable
+ * @version $Id$
+ */
+public final class PackageNamespace extends AbstractWiringNamespace {
+
+ /**
+ * Namespace name for package capabilities and requirements.
+ *
+ * <p>
+ * Also, the capability attribute used to specify the name of the package.
+ */
+ public static final String PACKAGE_NAMESPACE = "osgi.wiring.package";
+
+ /**
+ * The capability directive used to specify the comma separated list of
+ * classes which must be allowed to be exported.
+ */
+ public final static String CAPABILITY_INCLUDE_DIRECTIVE = "include";
+
+ /**
+ * The capability directive used to specify the comma separated list of
+ * classes which must not be allowed to be exported.
+ */
+ public final static String CAPABILITY_EXCLUDE_DIRECTIVE = "exclude";
+
+ /**
+ * The capability attribute contains the {@code Version} of the package if
+ * one is specified or {@code 0.0.0} if not specified. The value of this
+ * attribute must be of type {@code Version}.
+ */
+ public final static String CAPABILITY_VERSION_ATTRIBUTE = "version";
+
+ /**
+ * The capability attribute contains the symbolic name of the resource
+ * providing the package.
+ */
+ public final static String CAPABILITY_BUNDLE_SYMBOLICNAME_ATTRIBUTE = "bundle-symbolic-name";
+
+ private PackageNamespace() {
+ // empty
+ }
+}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/ResourceConstants.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/ResourceConstants.java
deleted file mode 100644
index ab8d42db8..000000000
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/ResourceConstants.java
+++ /dev/null
@@ -1,377 +0,0 @@
-/*
- * Copyright (c) OSGi Alliance (2011). All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.osgi.framework.resource;
-
-import org.osgi.framework.Constants;
-import org.osgi.framework.Version;
-import org.osgi.framework.wiring.BundleRevision;
-import org.osgi.framework.wiring.BundleWiring;
-
-/**
- * Defines standard names for the attributes, directives and name spaces for
- * resources, capabilities and requirements.
- *
- * <p>
- * The values associated with these keys are of type {@code String}, unless
- * otherwise indicated.
- *
- * @Immutable
- * @version $Id$
- */
-public final class ResourceConstants {
-
- private ResourceConstants() {
- // keep others from creating objects of this type.
- }
-
- /**
- * Name space for the identity capability. Each {@link Resource resource}
- * provides exactly one<sup>&#8224;</sup> identity capability that can be
- * used to identify the resource.
- *
- * For identity capability attributes the following applies:
- * <ul>
- * <li>The
- * <q>osgi.identity</q> attribute contains the symbolic name of the
- * resource.
- * <li>The {@link #IDENTITY_VERSION_ATTRIBUTE version} attribute contains
- * the {@link Version} of the resource.
- * <li>The {@link #IDENTITY_TYPE_ATTRIBUTE type} attribute contains the
- * resource type.
- * </ul>
- * <p>
- * A resource with a symbolic name
- * {@link Resource#getCapabilities(String) provides} exactly one
- * <sup>&#8224;</sup> identity
- * {@link Resource#getCapabilities(String) capability}.
- * <p>
- * For a {@link BundleRevision revision} with a symbolic name the
- * {@link BundleWiring wiring} for the revision
- * {@link BundleWiring#getCapabilities(String) provides} exactly
- * one<sup>&#8224;</sup> identity capability.
- * <p>
- * &#8224; A resource with no symbolic name must not provide an identity
- * capability.
- */
- public static final String IDENTITY_NAMESPACE = "osgi.identity";
-
- /**
- * An {@link #IDENTITY_NAMESPACE identity} capability attribute identifying the
- * {@link Version version} of the resource. This attribute must be set to a value of
- * type {@link Version}. If the resource has no version then the value
- * {@link Version#emptyVersion 0.0.0} must be used for the attribute.
- */
- public static final String IDENTITY_VERSION_ATTRIBUTE = Constants.VERSION_ATTRIBUTE;
-
- /**
- * An {@link #IDENTITY_NAMESPACE identity} capability attribute identifying the
- * resource type. This attribute must be set to a value of type {@link String}.
- * if the resource has no type then the value
- * {@link ResourceConstants#IDENTITY_TYPE_UNKNOWN unknown} must be used for the
- * attribute.
- */
- public static final String IDENTITY_TYPE_ATTRIBUTE = "type";
-
- /**
- * An {@link #IDENTITY_NAMESPACE identity} capability {@link #IDENTITY_TYPE_ATTRIBUTE type}
- * attribute value identifying the resource type as an OSGi bundle.
- */
- public static final String IDENTITY_TYPE_BUNDLE = "osgi.bundle";
-
- /**
- * An {@link #IDENTITY_NAMESPACE identity} capability {@link #IDENTITY_TYPE_ATTRIBUTE type}
- * attribute value identifying the resource type as an OSGi fragment.
- */
- public static final String IDENTITY_TYPE_FRAGMENT = "osgi.fragment";
-
- /**
- * An {@link #IDENTITY_NAMESPACE identity} capability {@link #IDENTITY_TYPE_ATTRIBUTE type}
- * attribute value identifying the resource type as unknown.
- */
- public static final String IDENTITY_TYPE_UNKNOWN = "unknown";
-
- /**
- * An {@link #IDENTITY_NAMESPACE identity} capability {@link Requirement#getDirectives() directive}
- * identifying if the resource is a singleton. A {@link String} value of &quot;true&quot; indicates
- * the resource is a singleton; any other value or <code>null</code> indicates the resource is not a
- * singleton.
- */
- public static final String IDENTITY_SINGLETON_DIRECTIVE = Constants.SINGLETON_DIRECTIVE;
-
- /**
- * Name space for package capabilities and requirements.
- *
- * For capability attributes the following applies:
- * <ul>
- * <li>The
- * <q>osgi.wiring.package</q> attribute contains the name of the package.
- * <li>The {@link Constants#VERSION_ATTRIBUTE version} attribute contains
- * the the {@link Version} of the package if one is specified or
- * {@link Version#emptyVersion} if not specified.
- * <li>The {@link Constants#BUNDLE_SYMBOLICNAME_ATTRIBUTE
- * bundle-symbolic-name} attribute contains the symbolic name of the
- * resource providing the package if one is specified.
- * <li>The {@link Constants#BUNDLE_VERSION_ATTRIBUTE bundle-version}
- * attribute contains the {@link Version} of resource providing the package
- * if one is specified or {@link Version#emptyVersion} if not specified.
- * <li>All other attributes are of type {@link String} and are used as
- * arbitrary matching attributes for the capability.
- * </ul>
- * <p>
- * A resource provides zero or more package
- * {@link Resource#getCapabilities(String) capabilities} (this is, exported
- * packages) and requires zero or more package
- * {@link Resource#getRequirements(String) requirements} (that is, imported
- * packages).
- */
- public static final String WIRING_PACKAGE_NAMESPACE = "osgi.wiring.package";
-
- /**
- * Name space for bundle capabilities and requirements.
- *
- * For capability attributes the following applies:
- * <ul>
- * <li>The
- * <q>osgi.wiring.bundle</q> attribute contains the symbolic name of the
- * bundle.
- * <li>The {@link Constants#BUNDLE_VERSION_ATTRIBUTE bundle-version}
- * attribute contains the {@link Version} of the bundle if one is specified
- * or {@link Version#emptyVersion} if not specified.
- * <li>All other attributes are of type {@link String} and are used as
- * arbitrary matching attributes for the capability.
- * </ul>
- * <p>
- * A non-fragment resource with the {@link #IDENTITY_TYPE_BUNDLE
- * osgi.bundle} type {@link #IDENTITY_TYPE_ATTRIBUTE identity} provides
- * exactly one <sup>&#8224;</sup> bundle
- * {@link Resource#getCapabilities(String) capability} (that is, the bundle
- * can be required by another bundle). A fragment resource with the
- * {@link #IDENTITY_TYPE_FRAGMENT osgi.fragment} type
- * {@link #IDENTITY_TYPE_ATTRIBUTE identity} must not declare
- * a bundle capability. A resource requires zero or more bundle
- * {@link Resource#getRequirements(String) requirements} (that is, required
- * bundles).
- * <p>
- * &#8224; A resource with no symbolic name must not provide a bundle
- * capability.
- */
- public static final String WIRING_BUNDLE_NAMESPACE = "osgi.wiring.bundle";
-
- /**
- * Name space for host capabilities and requirements.
- *
- * For capability attributes the following applies:
- * <ul>
- * <li>The
- * <q>osgi.wiring.host</q> attribute contains the symbolic name of the
- * bundle.
- * <li>The {@link Constants#BUNDLE_VERSION_ATTRIBUTE bundle-version}
- * attribute contains the {@link Version} of the bundle if one is specified
- * or {@link Version#emptyVersion} if not specified.
- * <li>All other attributes are of type {@link String} and are used as
- * arbitrary matching attributes for the capability.
- * </ul>
- * <p>
- * <p>
- * A non-fragment resource with the with the {@link #IDENTITY_TYPE_BUNDLE
- * osgi.bundle} type {@link #IDENTITY_TYPE_ATTRIBUTE identity} provides
- * zero or one <sup>&#8224;</sup> host
- * {@link Resource#getCapabilities(String) capabilities}.
- * A fragment resource with the
- * {@link #IDENTITY_TYPE_FRAGMENT osgi.fragment} type
- * {@link #IDENTITY_TYPE_ATTRIBUTE identity} must not declare
- * a host capability and must
- * {@link Resource#getRequirements(String) declare} exactly one host
- * requirement.
- * <p>
- * &#8224; A resource with no bundle symbolic name must not provide a host
- * capability.
- */
- public static final String WIRING_HOST_NAMESPACE = "osgi.wiring.host";
-
- /**
- * A requirement {@link Requirement#getDirectives() directive} used to
- * specify a capability filter. This filter is used to match against a
- * capability's {@link Capability#getAttributes() attributes}.
- */
- public final static String REQUIREMENT_FILTER_DIRECTIVE = Constants.FILTER_DIRECTIVE;
-
- /**
- * A requirement {@link Requirement#getDirectives() directive} used to
- * specify the resolution type for a requirement. The default value is
- * {@link #REQUIREMENT_RESOLUTION_MANDATORY mandatory}.
- *
- * @see #REQUIREMENT_RESOLUTION_MANDATORY mandatory
- * @see #REQUIREMENT_RESOLUTION_OPTIONAL optional
- */
- public final static String REQUIREMENT_RESOLUTION_DIRECTIVE = Constants.RESOLUTION_DIRECTIVE;
- /**
- * A directive value identifying a mandatory
- * {@link Resource#getRequirements(String) requirement} resolution type. A
- * mandatory resolution type indicates that the requirement must be resolved
- * when the {@link Resource resource} is resolved. If such requirement
- * cannot be resolved, the resource fails to resolve.
- *
- * @see #REQUIREMENT_RESOLUTION_DIRECTIVE
- */
- public final static String REQUIREMENT_RESOLUTION_MANDATORY = Constants.RESOLUTION_MANDATORY;
-
- /**
- * A directive value identifying an optional
- * {@link Resource#getRequirements(String) requirement} resolution type. An
- * optional resolution type indicates that the requirement is optional and
- * the {@link Resource resource} may be resolved without requirement being
- * resolved.
- *
- * @see #REQUIREMENT_RESOLUTION_DIRECTIVE
- */
- public final static String REQUIREMENT_RESOLUTION_OPTIONAL = Constants.RESOLUTION_OPTIONAL;
-
- /**
- * A requirement {@link Requirement#getDirectives() directive} used to
- * specify the effective time for the requirement. The default value is
- * {@link #EFFECTIVE_RESOLVE resolve}.
- *
- * @see #EFFECTIVE_RESOLVE resolve
- * @see #EFFECTIVE_ACTIVE active
- */
- public final static String REQUIREMENT_EFFECTIVE_DIRECTIVE = Constants.EFFECTIVE_DIRECTIVE;
-
- /**
- * A directive value identifying a {@link #CAPABILITY_EFFECTIVE_DIRECTIVE
- * capability} or {@link #REQUIREMENT_EFFECTIVE_DIRECTIVE requirement} that
- * is effective at resolve time. Capabilities and requirements with an
- * effective time of resolve are the only capabilities which are processed
- * while resolving a resource.
- *
- * @see #REQUIREMENT_EFFECTIVE_DIRECTIVE
- * @see #CAPABILITY_EFFECTIVE_DIRECTIVE
- */
- public final static String EFFECTIVE_RESOLVE = Constants.EFFECTIVE_RESOLVE;
-
- /**
- * A directive value identifying a {@link #CAPABILITY_EFFECTIVE_DIRECTIVE
- * capability} or {@link #REQUIREMENT_EFFECTIVE_DIRECTIVE requirement} that
- * is effective at active time. Capabilities and requirements with an
- * effective time of active are ignored while resolving a resource.
- *
- * @see #REQUIREMENT_EFFECTIVE_DIRECTIVE
- * @see #CAPABILITY_EFFECTIVE_DIRECTIVE
- */
- public final static String EFFECTIVE_ACTIVE = Constants.EFFECTIVE_ACTIVE;
-
- /**
- * A requirement {@link Requirement#getDirectives() directive} used to
- * specify the visibility type for a requirement. The default value is
- * {@link #REQUIREMENT_VISIBILITY_PRIVATE private}. This directive must only
- * be used for requirements with the require
- * {@link #WIRING_BUNDLE_NAMESPACE bundle} name space.
- *
- * @see #REQUIREMENT_VISIBILITY_PRIVATE private
- * @see #REQUIREMENT_VISIBILITY_REEXPORT reexport
- */
- public final static String REQUIREMENT_VISIBILITY_DIRECTIVE = Constants.VISIBILITY_DIRECTIVE;
-
- /**
- * A directive value identifying a private
- * {@link #REQUIREMENT_VISIBILITY_DIRECTIVE visibility} type. A private
- * visibility type indicates that any {@link #WIRING_PACKAGE_NAMESPACE
- * packages} that are exported by the required
- * {@link #WIRING_BUNDLE_NAMESPACE bundle} are not made visible on the
- * export signature of the requiring {@link #WIRING_BUNDLE_NAMESPACE bundle}
- * .
- *
- * @see #REQUIREMENT_VISIBILITY_DIRECTIVE
- */
- public final static String REQUIREMENT_VISIBILITY_PRIVATE = Constants.VISIBILITY_PRIVATE;
-
- /**
- * A directive value identifying a reexport
- * {@link #REQUIREMENT_VISIBILITY_DIRECTIVE visibility} type. A reexport
- * visibility type indicates any {@link #WIRING_PACKAGE_NAMESPACE packages}
- * that are exported by the required {@link #WIRING_BUNDLE_NAMESPACE bundle}
- * are re-exported by the requiring {@link #WIRING_BUNDLE_NAMESPACE bundle}.
- */
- public final static String REQUIREMENT_VISIBILITY_REEXPORT = Constants.VISIBILITY_REEXPORT;
-
- /**
- * A requirement {@link Requirement#getDirectives() directive} used to
- * specify the cardinality for a requirement. The default value is
- * {@link #REQUIREMENT_CARDINALITY_SINGULAR singular}.
- *
- * @see #REQUIREMENT_CARDINALITY_MULTIPLE multiple
- * @see #REQUIREMENT_CARDINALITY_SINGULAR singular
- */
- public final static String REQUIREMENT_CARDINALITY_DIRECTIVE = "cardinality";
-
- /**
- * A directive value identifying a multiple
- * {@link #REQUIREMENT_CARDINALITY_DIRECTIVE cardinality} type.
- */
- public final static String REQUIREMENT_CARDINALITY_MULTIPLE = "multiple";
-
- /**
- * A directive value identifying a singular
- * {@link #REQUIREMENT_CARDINALITY_DIRECTIVE cardinality} type.
- */
- public final static String REQUIREMENT_CARDINALITY_SINGULAR = "singular";
-
-
- /**
- * A capability {@link Capability#getDirectives() directive} used to specify
- * the comma separated list of {@link #WIRING_PACKAGE_NAMESPACE package}
- * names a capability uses.
- */
- public final static String CAPABILITY_USES_DIRECTIVE = Constants.USES_DIRECTIVE;
-
- /**
- * A capability {@link Capability#getDirectives() directive} used to specify
- * the effective time for the capability. The default value is
- * {@link #EFFECTIVE_RESOLVE resolve}.
- *
- * @see #EFFECTIVE_RESOLVE resolve
- * @see #EFFECTIVE_ACTIVE active
- */
- public final static String CAPABILITY_EFFECTIVE_DIRECTIVE = Constants.EFFECTIVE_DIRECTIVE;
-
- /**
- * A capability {@link Capability#getDirectives() directive} used to specify
- * the comma separated list of mandatory attributes which must be specified
- * in the {@link #REQUIREMENT_FILTER_DIRECTIVE filter} of a requirement in
- * order for the capability to match the requirement. This directive must
- * only be used for capabilities with the {@link #WIRING_PACKAGE_NAMESPACE
- * package}, {@link #WIRING_BUNDLE_NAMESPACE bundle}, or
- * {@link #WIRING_HOST_NAMESPACE host} name space.
- */
- public final static String CAPABILITY_MANDATORY_DIRECTIVE = "mandatory";
-
- /**
- * A capability {@link Capability#getDirectives() directive} used to specify
- * the comma separated list of classes which must be allowed to be exported.
- * This directive must only be used for capabilities with the
- * {@link #WIRING_PACKAGE_NAMESPACE package} name space.
- */
- public final static String CAPABILITY_INCLUDE_DIRECTIVE = "include";
-
- /**
- * A capability {@link Capability#getDirectives() directive} used to specify
- * the comma separated list of classes which must not be allowed to be
- * exported. This directive must only be used for capabilities with the
- * {@link #WIRING_PACKAGE_NAMESPACE package} name space.
- */
- public final static String CAPABILITY_EXCLUDE_DIRECTIVE = "exclude";
-}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleCapability.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleCapability.java
index 8b31e9d8c..6ef74f1b5 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleCapability.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleCapability.java
@@ -18,7 +18,8 @@ package org.osgi.framework.wiring;
import java.util.Map;
-import org.osgi.framework.resource.Capability;
+import org.osgi.framework.namespace.AbstractWiringNamespace;
+import org.osgi.resource.Capability;
/**
* A capability that has been declared from a {@link BundleRevision bundle
@@ -44,6 +45,11 @@ public interface BundleCapability extends Capability {
/**
* {@inheritDoc}
+ *
+ * <p>
+ * All capability directives not specified by the
+ * {@link AbstractWiringNamespace wiring namespaces} have no specified
+ * semantics and are considered extra user defined information.
*/
Map<String, String> getDirectives();
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleRequirement.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleRequirement.java
index bb292dc1b..bc4807252 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleRequirement.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleRequirement.java
@@ -18,7 +18,8 @@ package org.osgi.framework.wiring;
import java.util.Map;
-import org.osgi.framework.resource.Requirement;
+import org.osgi.framework.namespace.AbstractWiringNamespace;
+import org.osgi.resource.Requirement;
/**
* A requirement that has been declared from a {@link BundleRevision bundle
@@ -38,10 +39,10 @@ public interface BundleRequirement extends Requirement {
/**
* Returns whether the specified capability matches this requirement.
- *
+ *
* @param capability The capability to match to this requirement.
* @return {@code true} if the specified capability has the same
- * {@link #getNamespace() name space} as this requirement and the
+ * {@link #getNamespace() namespace} as this requirement and the
* filter for this requirement matches the
* {@link BundleCapability#getAttributes() attributes of the
* specified capability}; {@code false} otherwise.
@@ -55,6 +56,11 @@ public interface BundleRequirement extends Requirement {
/**
* {@inheritDoc}
+ *
+ * <p>
+ * All requirement directives not specified by the
+ * {@link AbstractWiringNamespace wiring namespaces} have no specified
+ * semantics and are considered extra user defined information.
*/
Map<String, String> getDirectives();
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleRevision.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleRevision.java
index a9dd63b0e..edc3350c0 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleRevision.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleRevision.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2010, 2011). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2010, 2012). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,17 +22,19 @@ import org.osgi.framework.Bundle;
import org.osgi.framework.BundleReference;
import org.osgi.framework.Constants;
import org.osgi.framework.Version;
-import org.osgi.framework.resource.Capability;
-import org.osgi.framework.resource.Requirement;
-import org.osgi.framework.resource.Resource;
-import org.osgi.framework.resource.ResourceConstants;
+import org.osgi.framework.namespace.BundleNamespace;
+import org.osgi.framework.namespace.HostNamespace;
+import org.osgi.framework.namespace.PackageNamespace;
+import org.osgi.resource.Capability;
+import org.osgi.resource.Requirement;
+import org.osgi.resource.Resource;
/**
* Bundle Revision. When a bundle is installed and each time a bundle is
* updated, a new bundle revision of the bundle is created. Since a bundle
* update can change the entries in a bundle, different bundle wirings for the
* same bundle can be associated with different bundle revisions.
- *
+ *
* <p>
* For a bundle that has not been uninstalled, the most recent bundle revision
* is defined to be the current bundle revision. A bundle in the UNINSTALLED
@@ -40,15 +42,15 @@ import org.osgi.framework.resource.ResourceConstants;
* bundle can be obtained by calling {@link Bundle#adapt(Class) bundle.adapt}
* (BundleRevision.class). Since a bundle in the UNINSTALLED state does not have
* a current revision, adapting such a bundle returns {@code null}.
- *
+ *
* <p>
- * The framework defines name spaces for {@link #PACKAGE_NAMESPACE package},
- * {@link #BUNDLE_NAMESPACE bundle} and {@link #HOST_NAMESPACE host}
- * capabilities and requirements. These name spaces are defined only to express
- * wiring information by the framework. They must not be used in
+ * The framework defines namespaces for {@link PackageNamespace package},
+ * {@link BundleNamespace bundle} and {@link HostNamespace host} capabilities
+ * and requirements. These namespaces are defined only to express wiring
+ * information by the framework. They must not be used in
* {@link Constants#PROVIDE_CAPABILITY Provide-Capability} and
* {@link Constants#REQUIRE_CAPABILITY Require-Capability} manifest headers.
- *
+ *
* @ThreadSafe
* @noimplement
* @version $Id$
@@ -74,14 +76,14 @@ public interface BundleRevision extends BundleReference, Resource {
/**
* Returns the capabilities declared by this bundle revision.
- *
- * @param namespace The name space of the declared capabilities to return or
- * {@code null} to return the declared capabilities from all name
- * spaces.
+ *
+ * @param namespace The namespace of the declared capabilities to return or
+ * {@code null} to return the declared capabilities from all
+ * namespaces.
* @return An unmodifiable list containing the declared
- * {@link BundleCapability}s from the specified name space. The
+ * {@link BundleCapability}s from the specified namespace. The
* returned list will be empty if this bundle revision declares no
- * capabilities in the specified name space. The list contains the
+ * capabilities in the specified namespace. The list contains the
* declared capabilities in the order they are specified in the
* manifest.
*/
@@ -89,29 +91,29 @@ public interface BundleRevision extends BundleReference, Resource {
/**
* Returns the requirements declared by this bundle revision.
- *
- * @param namespace The name space of the declared requirements to return or
- * {@code null} to return the declared requirements from all name
- * spaces.
+ *
+ * @param namespace The namespace of the declared requirements to return or
+ * {@code null} to return the declared requirements from all
+ * namespaces.
* @return An unmodifiable list containing the declared
- * {@link BundleRequirement}s from the specified name space. The
+ * {@link BundleRequirement}s from the specified namespace. The
* returned list will be empty if this bundle revision declares no
- * requirements in the specified name space. The list contains the
+ * requirements in the specified namespace. The list contains the
* declared requirements in the order they are specified in the
* manifest.
*/
List<BundleRequirement> getDeclaredRequirements(String namespace);
/**
- * Name space for package capabilities and requirements.
- *
+ * Namespace for package capabilities and requirements.
+ *
* <p>
* The name of the package is stored in the capability attribute of the same
- * name as this name space (osgi.wiring.package). The other
- * directives and attributes of the package, from the
- * {@link Constants#EXPORT_PACKAGE Export-Package} manifest header, can be
- * found in the cabability's {@link BundleCapability#getDirectives()
- * directives} and {@link BundleCapability#getAttributes() attributes}. The
+ * name as this namespace (osgi.wiring.package). The other directives and
+ * attributes of the package, from the {@link Constants#EXPORT_PACKAGE
+ * Export-Package} manifest header, can be found in the cabability's
+ * {@link BundleCapability#getDirectives() directives} and
+ * {@link BundleCapability#getAttributes() attributes}. The
* {@link Constants#VERSION_ATTRIBUTE version} capability attribute must
* contain the {@link Version} of the package if one is specified or
* {@link Version#emptyVersion} if not specified. The
@@ -122,14 +124,14 @@ public interface BundleRevision extends BundleReference, Resource {
* bundle-version} capability attribute must contain the
* {@link BundleRevision#getVersion() version} of the provider if one is
* specified or {@link Version#emptyVersion} if not specified.
- *
+ *
* <p>
* The package capabilities provided by the system bundle, that is the
* bundle with id zero, must include the package specified by the
* {@link Constants#FRAMEWORK_SYSTEMPACKAGES} and
* {@link Constants#FRAMEWORK_SYSTEMPACKAGES_EXTRA} framework properties as
* well as any other package exported by the framework implementation.
- *
+ *
* <p>
* A bundle revision {@link BundleRevision#getDeclaredCapabilities(String)
* declares} zero or more package capabilities (this is, exported packages)
@@ -142,16 +144,18 @@ public interface BundleRevision extends BundleReference, Resource {
* resolved package requirements (that is, imported packages). The number of
* package wires required by a bundle wiring may change as the bundle wiring
* may dynamically import additional packages.
+ *
+ * @see PackageNamespace
*/
- String PACKAGE_NAMESPACE = ResourceConstants.WIRING_PACKAGE_NAMESPACE;
+ String PACKAGE_NAMESPACE = PackageNamespace.PACKAGE_NAMESPACE;
/**
- * Name space for bundle capabilities and requirements.
- *
+ * Namespace for bundle capabilities and requirements.
+ *
* <p>
* The bundle symbolic name of the bundle is stored in the capability
- * attribute of the same name as this name space (osgi.wiring.bundle).
- * The other directives and attributes of the bundle, from the
+ * attribute of the same name as this namespace (osgi.wiring.bundle). The
+ * other directives and attributes of the bundle, from the
* {@link Constants#BUNDLE_SYMBOLICNAME Bundle-SymbolicName} manifest
* header, can be found in the cabability's
* {@link BundleCapability#getDirectives() directives} and
@@ -160,14 +164,14 @@ public interface BundleRevision extends BundleReference, Resource {
* attribute must contain the {@link Version} of the bundle from the
* {@link Constants#BUNDLE_VERSION Bundle-Version} manifest header if one is
* specified or {@link Version#emptyVersion} if not specified.
- *
+ *
* <p>
* A non-fragment revision
* {@link BundleRevision#getDeclaredCapabilities(String) declares} exactly
* one<sup>&#8224;</sup> bundle capability (that is, the bundle can be
* required by another bundle). A fragment revision must not declare a
* bundle capability.
- *
+ *
* <p>
* A bundle wiring for a non-fragment revision
* {@link BundleWiring#getCapabilities(String) provides} exactly
@@ -175,21 +179,23 @@ public interface BundleRevision extends BundleReference, Resource {
* required by another bundle) and
* {@link BundleWiring#getRequiredWires(String) requires} zero or more
* bundle capabilities (that is, requires other bundles).
- *
+ *
* <p>
* &#8224; A bundle with no bundle symbolic name (that is, a bundle with
* {@link Constants#BUNDLE_MANIFESTVERSION Bundle-ManifestVersion}
* {@literal <} 2) must not provide a bundle capability.
+ *
+ * @see BundleNamespace
*/
- String BUNDLE_NAMESPACE = ResourceConstants.WIRING_BUNDLE_NAMESPACE;
+ String BUNDLE_NAMESPACE = BundleNamespace.BUNDLE_NAMESPACE;
/**
- * Name space for host capabilities and requirements.
- *
+ * Namespace for host capabilities and requirements.
+ *
* <p>
* The bundle symbolic name of the bundle is stored in the capability
- * attribute of the same name as this name space (osgi.wiring.host).
- * The other directives and attributes of the bundle, from the
+ * attribute of the same name as this namespace (osgi.wiring.host). The
+ * other directives and attributes of the bundle, from the
* {@link Constants#BUNDLE_SYMBOLICNAME Bundle-SymbolicName} manifest
* header, can be found in the cabability's
* {@link BundleCapability#getDirectives() directives} and
@@ -198,7 +204,7 @@ public interface BundleRevision extends BundleReference, Resource {
* attribute must contain the {@link Version} of the bundle from the
* {@link Constants#BUNDLE_VERSION Bundle-Version} manifest header if one is
* specified or {@link Version#emptyVersion} if not specified.
- *
+ *
* <p>
* A non-fragment revision
* {@link BundleRevision#getDeclaredCapabilities(String) declares} zero or
@@ -207,7 +213,7 @@ public interface BundleRevision extends BundleReference, Resource {
* attached}. A fragment revision must
* {@link BundleRevision#getDeclaredRequirements(String) declare} exactly
* one host requirement.
- *
+ *
* <p>
* A bundle wiring for a non-fragment revision
* {@link BundleWiring#getCapabilities(String) provides} zero or
@@ -216,13 +222,15 @@ public interface BundleRevision extends BundleReference, Resource {
* attached}. A bundle wiring for a fragment revision
* {@link BundleWiring#getRequiredWires(String) requires} a host capability
* for each host to which it is attached.
- *
+ *
* <p>
* &#8224; A bundle with no bundle symbolic name (that is, a bundle with
* {@link Constants#BUNDLE_MANIFESTVERSION Bundle-ManifestVersion}
* {@literal <} 2) must not provide a host capability.
+ *
+ * @see HostNamespace
*/
- String HOST_NAMESPACE = ResourceConstants.WIRING_HOST_NAMESPACE;
+ String HOST_NAMESPACE = HostNamespace.HOST_NAMESPACE;
/**
* Returns the special types of this bundle revision. The bundle revision
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleWire.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleWire.java
index 0d5aec119..f1e239aaa 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleWire.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleWire.java
@@ -16,7 +16,7 @@
package org.osgi.framework.wiring;
-import org.osgi.framework.resource.Wire;
+import org.osgi.resource.Wire;
/**
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleWiring.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleWiring.java
index 1479627fa..aaaaf6dbe 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleWiring.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleWiring.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2010, 2011). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2010, 2012). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,17 +22,19 @@ import java.util.List;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleReference;
-import org.osgi.framework.resource.Capability;
-import org.osgi.framework.resource.Requirement;
-import org.osgi.framework.resource.ResourceConstants;
-import org.osgi.framework.resource.Wire;
-import org.osgi.framework.resource.Wiring;
+import org.osgi.framework.namespace.IdentityNamespace;
+import org.osgi.framework.namespace.PackageNamespace;
+import org.osgi.resource.Capability;
+import org.osgi.resource.Namespace;
+import org.osgi.resource.Requirement;
+import org.osgi.resource.Wire;
+import org.osgi.resource.Wiring;
/**
* A wiring for a bundle. Each time a bundle is resolved, a new bundle wiring
* for the bundle is created. A bundle wiring is associated with a bundle
* revision and represents the dependencies with other bundle wirings.
- *
+ *
* <p>
* The bundle wiring for a bundle is the {@link #isCurrent() current} bundle
* wiring if it is the most recent bundle wiring for the current bundle
@@ -43,13 +45,13 @@ import org.osgi.framework.resource.Wiring;
* loader. All bundles with non-current, in use bundle wirings are considered
* removal pending. Once a bundle wiring is no longer in use, it is considered
* stale and is discarded by the framework.
- *
+ *
* <p>
* The current bundle wiring for a bundle can be obtained by calling
* {@link Bundle#adapt(Class) bundle.adapt}(BundleWiring.class). A bundle in the
* INSTALLED or UNINSTALLED state does not have a current wiring, adapting such
* a bundle returns {@code null}.
- *
+ *
* @ThreadSafe
* @noimplement
* @version $Id$
@@ -61,7 +63,7 @@ public interface BundleWiring extends BundleReference, Wiring {
* most recent bundle wiring for the current bundle revision. All bundles
* with non-current, in use bundle wirings are considered
* {@link FrameworkWiring#getRemovalPendingBundles() removal pending}.
- *
+ *
* @return {@code true} if this bundle wiring is the current bundle wiring;
* {@code false} otherwise.
*/
@@ -72,7 +74,7 @@ public interface BundleWiring extends BundleReference, Wiring {
* in use if it is the {@link #isCurrent() current} wiring or if some other
* in use bundle wiring is dependent upon it. Once a bundle wiring is no
* longer in use, it is considered stale and is discarded by the framework.
- *
+ *
* @return {@code true} if this bundle wiring is in use; {@code false}
* otherwise.
*/
@@ -80,18 +82,17 @@ public interface BundleWiring extends BundleReference, Wiring {
/**
* Returns the capabilities provided by this bundle wiring.
- *
+ *
* <p>
* Only capabilities considered by the resolver are returned. For example,
- * capabilities with
- * {@link ResourceConstants#CAPABILITY_EFFECTIVE_DIRECTIVE effective}
- * directive not equal to {@link ResourceConstants#EFFECTIVE_RESOLVE
+ * capabilities with {@link Namespace#CAPABILITY_EFFECTIVE_DIRECTIVE
+ * effective} directive not equal to {@link Namespace#EFFECTIVE_RESOLVE
* resolve} are not returned.
- *
+ *
* <p>
* A capability may not be required by any bundle wiring and thus there may
* be no {@link #getProvidedWires(String) wires} for the capability.
- *
+ *
* <p>
* A bundle wiring for a non-fragment revision provides a subset of the
* declared capabilities from the bundle revision and all attached fragment
@@ -101,100 +102,98 @@ public interface BundleWiring extends BundleReference, Wiring {
* other is discarded.
* <p>
* A bundle wiring for a fragment revision with a symbolic name must provide
- * exactly one {@link ResourceConstants#IDENTITY_NAMESPACE identity}
- * capability.
+ * exactly one {@link IdentityNamespace identity} capability.
* <p>
- * &#8224; The {@link ResourceConstants#IDENTITY_NAMESPACE identity}
- * capability provided by attached fragment revisions must not be included
- * in the capabilities of the host bundle wiring.
- *
- * @param namespace The name space of the capabilities to return or
- * {@code null} to return the capabilities from all name spaces.
+ * &#8224; The {@link IdentityNamespace identity} capability provided by
+ * attached fragment revisions must not be included in the capabilities of
+ * the host bundle wiring.
+ *
+ * @param namespace The namespace of the capabilities to return or
+ * {@code null} to return the capabilities from all namespaces.
* @return A list containing a snapshot of the {@link BundleCapability}s, or
* an empty list if this bundle wiring provides no capabilities in
- * the specified name space. If this bundle wiring is not
+ * the specified namespace. If this bundle wiring is not
* {@link #isInUse() in use}, {@code null} will be returned. For a
- * given name space, the list contains the wires in the order the
+ * given namespace, the list contains the wires in the order the
* capabilities were specified in the manifests of the
* {@link #getRevision() bundle revision} and the attached
* fragments<sup>&#8224;</sup> of this bundle wiring. There is no
- * ordering defined between capabilities in different name spaces.
+ * ordering defined between capabilities in different namespaces.
*/
List<BundleCapability> getCapabilities(String namespace);
/**
* Returns the requirements of this bundle wiring.
- *
+ *
* <p>
* Only requirements considered by the resolver are returned. For example,
- * requirements with
- * {@link ResourceConstants#REQUIREMENT_EFFECTIVE_DIRECTIVE effective}
- * directive not equal to {@link ResourceConstants#EFFECTIVE_RESOLVE
+ * requirements with {@link Namespace#REQUIREMENT_EFFECTIVE_DIRECTIVE
+ * effective} directive not equal to {@link Namespace#EFFECTIVE_RESOLVE
* resolve} are not returned.
- *
+ *
* <p>
* A bundle wiring for a non-fragment revision has a subset of the declared
* requirements from the bundle revision and all attached fragment
* revisions. Not all declared requirements may be present since some may be
* discarded. For example, if a package is declared to be optionally
* imported and is not actually imported, the requirement must be discarded.
- *
- * @param namespace The name space of the requirements to return or
- * {@code null} to return the requirements from all name spaces.
+ *
+ * @param namespace The namespace of the requirements to return or
+ * {@code null} to return the requirements from all namespaces.
* @return A list containing a snapshot of the {@link BundleRequirement}s,
* or an empty list if this bundle wiring uses no requirements in
- * the specified name space. If this bundle wiring is not
+ * the specified namespace. If this bundle wiring is not
* {@link #isInUse() in use}, {@code null} will be returned. For a
- * given name space, the list contains the wires in the order the
+ * given namespace, the list contains the wires in the order the
* requirements were specified in the manifests of the
* {@link #getRevision() bundle revision} and the attached fragments
* of this bundle wiring. There is no ordering defined between
- * requirements in different name spaces.
+ * requirements in different namespaces.
*/
List<BundleRequirement> getRequirements(String namespace);
/**
* Returns the {@link BundleWire}s to the provided {@link BundleCapability
* capabilities} of this bundle wiring.
- *
- * @param namespace The name space of the capabilities for which to return
+ *
+ * @param namespace The namespace of the capabilities for which to return
* wires or {@code null} to return the wires for the capabilities in
- * all name spaces.
+ * all namespaces.
* @return A list containing a snapshot of the {@link BundleWire}s for the
* {@link BundleCapability capabilities} of this bundle wiring, or
* an empty list if this bundle wiring has no capabilities in the
- * specified name space. If this bundle wiring is not
+ * specified namespace. If this bundle wiring is not
* {@link #isInUse() in use}, {@code null} will be returned. For a
- * given name space, the list contains the wires in the order the
+ * given namespace, the list contains the wires in the order the
* capabilities were specified in the manifests of the
* {@link #getRevision() bundle revision} and the attached fragments
* of this bundle wiring. There is no ordering defined between
- * capabilities in different name spaces.
+ * capabilities in different namespaces.
*/
List<BundleWire> getProvidedWires(String namespace);
/**
* Returns the {@link BundleWire}s to the {@link BundleRequirement
* requirements} in use by this bundle wiring.
- *
+ *
* <p>
* This method may return different results if this bundle wiring adds wires
* to more requirements. For example, dynamically importing a package will
* establish a new wire to the dynamically imported package.
- *
- * @param namespace The name space of the requirements for which to return
+ *
+ * @param namespace The namespace of the requirements for which to return
* wires or {@code null} to return the wires for the requirements in
- * all name spaces.
+ * all namespaces.
* @return A list containing a snapshot of the {@link BundleWire}s for the
* {@link BundleRequirement requirements} of this bundle wiring, or
* an empty list if this bundle wiring has no requirements in the
- * specified name space. If this bundle wiring is not
+ * specified namespace. If this bundle wiring is not
* {@link #isInUse() in use}, {@code null} will be returned. For a
- * given name space, the list contains the wires in the order the
+ * given namespace, the list contains the wires in the order the
* requirements were specified in the manifests of the
* {@link #getRevision() bundle revision} and the attached fragments
* of this bundle wiring. There is no ordering defined between
- * requirements in different name spaces.
+ * requirements in different namespaces.
*/
List<BundleWire> getRequiredWires(String namespace);
@@ -202,13 +201,13 @@ public interface BundleWiring extends BundleReference, Wiring {
* Returns the bundle revision for the bundle in this bundle wiring. Since a
* bundle update can change the entries in a bundle, different bundle
* wirings for the same bundle can have different bundle revisions.
- *
+ *
* <p>
* The bundle object {@link BundleReference#getBundle() referenced} by the
* returned {@code BundleRevision} may return different information than the
* returned {@code BundleRevision} since the returned {@code BundleRevision}
* may refer to an older revision of the bundle.
- *
+ *
* @return The bundle revision for this bundle wiring.
* @see BundleRevision#getWiring()
*/
@@ -218,7 +217,7 @@ public interface BundleWiring extends BundleReference, Wiring {
* Returns the class loader for this bundle wiring. Since a bundle refresh
* creates a new bundle wiring for a bundle, different bundle wirings for
* the same bundle will have different class loaders.
- *
+ *
* @return The class loader for this bundle wiring. If this bundle wiring is
* not {@link #isInUse() in use} or this bundle wiring is for a
* fragment revision, {@code null} will be returned.
@@ -234,24 +233,24 @@ public interface BundleWiring extends BundleReference, Wiring {
* loader is not used to search for entries. Only the contents of this
* bundle wiring's bundle revision and its attached fragment revisions are
* searched for the specified entries.
- *
+ *
* <p>
* This method takes into account that the &quot;contents&quot; of this
* bundle wiring can have attached fragments. This &quot;bundle space&quot;
- * is not a name space with unique members; the same entry name can be
+ * is not a namespace with unique members; the same entry name can be
* present multiple times. This method therefore returns a list of URL
* objects. These URLs can come from different JARs but have the same path
* name. This method can either return only entries in the specified path or
* recurse into subdirectories returning entries in the directory tree
* beginning at the specified path.
- *
+ *
* <p>
* URLs for directory entries must have their path end with &quot;/&quot;.
* <p>
* Note: Jar and zip files are not required to include directory entries.
* URLs to directory entries will not be returned if the bundle contents do
* not contain directory entries.
- *
+ *
* @param path The path name in which to look. The path is always relative
* to the root of this bundle wiring and may begin with
* &quot;/&quot;. A path value of &quot;/&quot; indicates the root of
@@ -283,14 +282,14 @@ public interface BundleWiring extends BundleReference, Wiring {
/**
* The find entries operation must recurse into subdirectories.
- *
+ *
* <p>
* This bit may be set when calling
* {@link #findEntries(String, String, int)} to specify the result must
* include the matching entries from the specified path and its
* subdirectories. If this bit is not set, then the result must only include
* matching entries from the specified path.
- *
+ *
* @see #findEntries(String, String, int)
*/
int FINDENTRIES_RECURSE = 0x00000001;
@@ -299,7 +298,7 @@ public interface BundleWiring extends BundleReference, Wiring {
* Returns the names of resources visible to this bundle wiring's
* {@link #getClassLoader() class loader}. The returned names can be used to
* access the resources via this bundle wiring's class loader.
- *
+ *
* <ul>
* <li>Only the resource names for resources in bundle wirings will be
* returned. The names of resources visible to a bundle wiring's parent
@@ -308,7 +307,7 @@ public interface BundleWiring extends BundleReference, Wiring {
* <li>Only established wires will be examined for resources. This method
* must not cause new wires for dynamic imports to be established.
* </ul>
- *
+ *
* @param path The path name in which to look. The path is always relative
* to the root of this bundle wiring's class loader and may begin
* with &quot;/&quot;. A path value of &quot;/&quot; indicates the
@@ -338,14 +337,14 @@ public interface BundleWiring extends BundleReference, Wiring {
/**
* The list resource names operation must recurse into subdirectories.
- *
+ *
* <p>
* This bit may be set when calling
* {@link #listResources(String, String, int)} to specify the result must
* include the names of matching resources from the specified path and its
* subdirectories. If this bit is not set, then the result must only include
* names of matching resources from the specified path.
- *
+ *
* @see #listResources(String, String, int)
*/
int LISTRESOURCES_RECURSE = 0x00000001;
@@ -355,9 +354,9 @@ public interface BundleWiring extends BundleReference, Wiring {
* matching resources contained in this bundle wiring's
* {@link #getRevision() bundle revision} and its attached fragment
* revisions. The result must not include resource names for resources in
- * {@link BundleRevision#PACKAGE_NAMESPACE package} names which are
+ * {@link PackageNamespace package} names which are
* {@link #getRequiredWires(String) imported} by this wiring.
- *
+ *
* <p>
* This bit may be set when calling
* {@link #listResources(String, String, int)} to specify the result must
@@ -367,57 +366,57 @@ public interface BundleWiring extends BundleReference, Wiring {
* reachable from this bundle wiring's class loader which may include the
* names of matching resources contained in imported packages and required
* bundles.
- *
+ *
* @see #listResources(String, String, int)
*/
int LISTRESOURCES_LOCAL = 0x00000002;
/**
* {@inheritDoc}
- *
+ *
* <p>
* This method returns the same value as {@link #getCapabilities(String)}.
- *
+ *
* @since 1.1
*/
List<Capability> getResourceCapabilities(String namespace);
/**
* {@inheritDoc}
- *
+ *
* <p>
* This method returns the same value as {@link #getRequirements(String)}.
- *
+ *
* @since 1.1
*/
List<Requirement> getResourceRequirements(String namespace);
/**
* {@inheritDoc}
- *
+ *
* <p>
* This method returns the same value as {@link #getProvidedWires(String)}.
- *
+ *
* @since 1.1
*/
List<Wire> getProvidedResourceWires(String namespace);
/**
* {@inheritDoc}
- *
+ *
* <p>
* This method returns the same value as {@link #getRequiredWires(String)}.
- *
+ *
* @since 1.1
*/
List<Wire> getRequiredResourceWires(String namespace);
/**
* {@inheritDoc}
- *
+ *
* <p>
* This method returns the same value as {@link #getRevision()}.
- *
+ *
* @since 1.1
*/
BundleRevision getResource();
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/Capability.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/resource/Capability.java
index 1fb855c7c..5f40514f7 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/Capability.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/resource/Capability.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.osgi.framework.resource;
+package org.osgi.resource;
import java.util.Map;
@@ -32,36 +32,15 @@ import java.util.Map;
public interface Capability {
/**
- * Returns the name space of this capability.
+ * Returns the namespace of this capability.
*
- * @return The name space of this capability.
+ * @return The namespace of this capability.
*/
String getNamespace();
/**
* Returns the directives of this capability.
*
- * <p>
- * Only the following list of directives have specified semantics:
- * <ul>
- * <li> {@link ResourceConstants#CAPABILITY_EFFECTIVE_DIRECTIVE effective}
- * <li> {@link ResourceConstants#CAPABILITY_USES_DIRECTIVE uses}
- * <li> {@link ResourceConstants#CAPABILITY_MANDATORY_DIRECTIVE mandatory} -
- * only recognized for the {@link ResourceConstants#WIRING_BUNDLE_NAMESPACE
- * osgi.wiring.bundle} and
- * {@link ResourceConstants#WIRING_PACKAGE_NAMESPACE osgi.wiring.package}
- * name spaces.
- * <li> {@link ResourceConstants#CAPABILITY_EXCLUDE_DIRECTIVE exclude} - only
- * recognized for the {@link ResourceConstants#WIRING_PACKAGE_NAMESPACE
- * osgi.wiring.package} name space.
- * <li> {@link ResourceConstants#CAPABILITY_INCLUDE_DIRECTIVE include} - only
- * recognized for the {@link ResourceConstants#WIRING_PACKAGE_NAMESPACE
- * osgi.wiring.package} name space.
- * </ul>
- * All other directives have no specified semantics and are considered extra
- * user defined information. The OSGi Alliance reserves the right to extend
- * the set of directives which have specified semantics.
- *
* @return An unmodifiable map of directive names to directive values for
* this capability, or an empty map if this capability has no
* directives.
@@ -89,7 +68,7 @@ public interface Capability {
*
* <p>
* This {@code Capability} is equal to another {@code Capability} if they
- * have the same name space, directives and attributes and are declared by
+ * have the same namespace, directives and attributes and are declared by
* the same resource.
*
* @param obj The object to compare against this {@code Capability}.
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/resource/Namespace.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/resource/Namespace.java
new file mode 100644
index 000000000..09d093ed7
--- /dev/null
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/resource/Namespace.java
@@ -0,0 +1,154 @@
+/*
+ * Copyright (c) OSGi Alliance (2012). All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.osgi.resource;
+
+/**
+ * Capability and Requirement Namespaces base class.
+ *
+ * <p>
+ * This class is the common class shared by all OSGi defined namespaces. It
+ * defines the names for the common attributes and directives for the OSGi
+ * specified namespaces.
+ *
+ * <p>
+ * The OSGi Alliance reserves the right to extend the set of directives and
+ * attributes which have specified semantics for all of the specified
+ * namespaces.
+ *
+ * <p>
+ * The values associated with these keys are of type {@code String}, unless
+ * otherwise indicated.
+ *
+ * @Immutable
+ * @version $Id$
+ */
+public abstract class Namespace {
+
+ /**
+ * The capability directive used to specify the comma separated list of
+ * package names used by a capability.
+ */
+ public final static String CAPABILITY_USES_DIRECTIVE = "uses";
+
+ /**
+ * The capability directive used to specify the effective time for the
+ * capability. The default value is {@link #EFFECTIVE_RESOLVE resolve}.
+ *
+ * @see #EFFECTIVE_RESOLVE resolve
+ * @see #EFFECTIVE_ACTIVE active
+ */
+ public final static String CAPABILITY_EFFECTIVE_DIRECTIVE = "effective";
+
+ /**
+ * The requirement directive used to specify a capability filter. This
+ * filter is used to match against a capability's attributes.
+ */
+ public final static String REQUIREMENT_FILTER_DIRECTIVE = "filter";
+
+ /**
+ * The requirement directive used to specify the resolution type for a
+ * requirement. The default value is {@link #RESOLUTION_MANDATORY mandatory}
+ * .
+ *
+ * @see #RESOLUTION_MANDATORY mandatory
+ * @see #RESOLUTION_OPTIONAL optional
+ */
+ public final static String REQUIREMENT_RESOLUTION_DIRECTIVE = "resolution";
+
+ /**
+ * The directive value identifying a mandatory requirement resolution type.
+ * A mandatory resolution type indicates that the requirement must be
+ * resolved when the resource is resolved. If such a requirement cannot be
+ * resolved, the resource fails to resolve.
+ *
+ * @see #REQUIREMENT_RESOLUTION_DIRECTIVE
+ */
+ public final static String RESOLUTION_MANDATORY = "mandatory";
+
+ /**
+ * The directive value identifying an optional requirement resolution type.
+ * An optional resolution type indicates that the requirement is optional
+ * and the resource may be resolved without requirement being resolved.
+ *
+ * @see #REQUIREMENT_RESOLUTION_DIRECTIVE
+ */
+ public final static String RESOLUTION_OPTIONAL = "optional";
+
+ /**
+ * The requirement directive used to specify the effective time for the
+ * requirement. The default value is {@link #EFFECTIVE_RESOLVE resolve}.
+ *
+ * @see #EFFECTIVE_RESOLVE resolve
+ * @see #EFFECTIVE_ACTIVE active
+ */
+ public final static String REQUIREMENT_EFFECTIVE_DIRECTIVE = "effective";
+
+ /**
+ * The directive value identifying a {@link #CAPABILITY_EFFECTIVE_DIRECTIVE
+ * capability} or {@link #REQUIREMENT_EFFECTIVE_DIRECTIVE requirement} that
+ * is effective at resolve time. Capabilities and requirements with an
+ * effective time of resolve are the only capabilities which are processed
+ * while resolving a resource.
+ *
+ * @see #REQUIREMENT_EFFECTIVE_DIRECTIVE
+ * @see #CAPABILITY_EFFECTIVE_DIRECTIVE
+ */
+ public final static String EFFECTIVE_RESOLVE = "resolve";
+
+ /**
+ * The directive value identifying a {@link #CAPABILITY_EFFECTIVE_DIRECTIVE
+ * capability} or {@link #REQUIREMENT_EFFECTIVE_DIRECTIVE requirement} that
+ * is effective at active time. Capabilities and requirements with an
+ * effective time of active are ignored while resolving a resource.
+ *
+ * @see #REQUIREMENT_EFFECTIVE_DIRECTIVE
+ * @see #CAPABILITY_EFFECTIVE_DIRECTIVE
+ */
+ public final static String EFFECTIVE_ACTIVE = "active";
+
+ /**
+ * The requirement directive used to specify the cardinality for a
+ * requirement. The default value is {@link #CARDINALITY_SINGLE single}.
+ *
+ * @see #CARDINALITY_MULTIPLE multiple
+ * @see #CARDINALITY_SINGLE single
+ */
+ public final static String REQUIREMENT_CARDINALITY_DIRECTIVE = "cardinality";
+
+ /**
+ * The directive value identifying a multiple
+ * {@link #REQUIREMENT_CARDINALITY_DIRECTIVE cardinality} type.
+ *
+ * @see #REQUIREMENT_CARDINALITY_DIRECTIVE
+ */
+ public final static String CARDINALITY_MULTIPLE = "multiple";
+
+ /**
+ * The directive value identifying a
+ * {@link #REQUIREMENT_CARDINALITY_DIRECTIVE cardinality} type of single.
+ *
+ * @see #REQUIREMENT_CARDINALITY_DIRECTIVE
+ */
+ public final static String CARDINALITY_SINGLE = "single";
+
+ /**
+ * Protected constructor for Namespace sub-types.
+ */
+ protected Namespace() {
+ // empty
+ }
+}
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/Requirement.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/resource/Requirement.java
index 0f28402db..212b26179 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/Requirement.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/resource/Requirement.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.osgi.framework.resource;
+package org.osgi.resource;
import java.util.Map;
@@ -31,32 +31,15 @@ import java.util.Map;
*/
public interface Requirement {
/**
- * Returns the name space of this requirement.
+ * Returns the namespace of this requirement.
*
- * @return The name space of this requirement.
+ * @return The namespace of this requirement.
*/
String getNamespace();
/**
* Returns the directives of this requirement.
*
- * <p>
- * Only the following list of directives have specified semantics:
- * <ul>
- * <li> {@link ResourceConstants#REQUIREMENT_EFFECTIVE_DIRECTIVE effective}
- * <li> {@link ResourceConstants#REQUIREMENT_FILTER_DIRECTIVE filter}
- * <li> {@link ResourceConstants#REQUIREMENT_CARDINALITY_DIRECTIVE
- * cardinality}
- * <li> {@link ResourceConstants#REQUIREMENT_RESOLUTION_DIRECTIVE resolution}
- * <li> {@link ResourceConstants#REQUIREMENT_VISIBILITY_DIRECTIVE visibility}
- * - only recognized for the
- * {@link ResourceConstants#WIRING_BUNDLE_NAMESPACE osgi.wiring.bundle} name
- * space.
- * </ul>
- * All other directives have no specified semantics and are considered extra
- * user defined information. The OSGi Alliance reserves the right to extend
- * the set of directives which have specified semantics.
- *
* @return An unmodifiable map of directive names to directive values for
* this requirement, or an empty map if this requirement has no
* directives.
@@ -79,7 +62,8 @@ public interface Requirement {
/**
* Returns the resource declaring this requirement.
*
- * @return The resource declaring this requirement.
+ * @return The resource declaring this requirement. This can be {@code null}
+ * if this requirement is synthesized.
*/
Resource getResource();
@@ -88,7 +72,7 @@ public interface Requirement {
*
* <p>
* This {@code Requirement} is equal to another {@code Requirement} if they
- * have the same name space, directives and attributes and are declared by
+ * have the same namespace, directives and attributes and are declared by
* the same resource.
*
* @param obj The object to compare against this {@code Requirement}.
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/Resource.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/resource/Resource.java
index 4b73a753d..1ffc6301b 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/Resource.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/resource/Resource.java
@@ -14,21 +14,21 @@
* limitations under the License.
*/
-package org.osgi.framework.resource;
+package org.osgi.resource;
import java.util.List;
-
/**
* A resource is the representation of a uniquely identified and typed data.
- *
- * A resources can be wired together via capabilities and requirements.
+ *
+ * A resource declares requirements that need to be satisfied by capabilities
+ * before it can provide its capabilities.
*
* <p>
* Instances of this type must be <i>effectively immutable</i>. That is, for a
* given instance of this interface, the methods defined by this interface must
- * always return the same result.
- *
+ * always return the same result. A Resource can be wired through a Resolver.
+ *
* @ThreadSafe
* @version $Id$
*/
@@ -36,26 +36,26 @@ public interface Resource {
/**
* Returns the capabilities declared by this resource.
*
- * @param namespace The name space of the declared capabilities to return or
- * {@code null} to return the declared capabilities from all name
- * spaces.
+ * @param namespace The namespace of the declared capabilities to return or
+ * {@code null} to return the declared capabilities from all
+ * namespaces.
* @return An unmodifiable list containing the declared {@link Capability}s
- * from the specified name space. The returned list will be empty if
- * this resource declares no capabilities in the specified name
- * space.
+ * from the specified namespace. The returned list will be empty if
+ * this resource declares no capabilities in the specified
+ * namespace.
*/
List<Capability> getCapabilities(String namespace);
/**
* Returns the requirements declared by this bundle resource.
- *
- * @param namespace The name space of the declared requirements to return or
- * {@code null} to return the declared requirements from all name
- * spaces.
+ *
+ * @param namespace The namespace of the declared requirements to return or
+ * {@code null} to return the declared requirements from all
+ * namespaces.
* @return An unmodifiable list containing the declared {@link Requirement}
- * s from the specified name space. The returned list will be empty
- * if this resource declares no requirements in the specified name
- * space.
+ * s from the specified namespace. The returned list will be empty
+ * if this resource declares no requirements in the specified
+ * namespace.
*/
List<Requirement> getRequirements(String namespace);
@@ -63,10 +63,10 @@ public interface Resource {
* Compares this {@code Resource} to another {@code Resource}.
*
* <p>
- * This {@code Resource} is equal to another {@code Resource} if they have
- * they both have the same content and come from the same location. Location
- * may be defined as the bundle location if the resource is an installed
- * bundle or the repository location if the resource is in a repository.
+ * This {@code Resource} is equal to another {@code Resource} if both have
+ * the same content and come from the same location. Location may be defined
+ * as the bundle location if the resource is an installed bundle or the
+ * repository location if the resource is in a repository.
*
* @param obj The object to compare against this {@code Resource}.
* @return {@code true} if this {@code Resource} is equal to the other
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/Wire.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/resource/Wire.java
index 7cab76f1c..965c12752 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/Wire.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/resource/Wire.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.osgi.framework.resource;
+package org.osgi.resource;
/**
* A wire connecting a {@link Capability} to a {@link Requirement}.
@@ -23,7 +23,7 @@ package org.osgi.framework.resource;
* Instances of this type must be <i>effectively immutable</i>. That is, for a
* given instance of this interface, the methods defined by this interface must
* always return the same result.
- *
+ *
* @ThreadSafe
* @version $Id$
*/
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/Wiring.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/resource/Wiring.java
index ac9bdc86f..3fce7b49b 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/resource/Wiring.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/resource/Wiring.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.osgi.framework.resource;
+package org.osgi.resource;
import java.util.List;
@@ -26,25 +26,24 @@ import java.util.List;
* Instances of this type must be <i>effectively immutable</i>. That is, for a
* given instance of this interface, the methods defined by this interface must
* always return the same result.
- *
+ *
* @ThreadSafe
* @version $Id$
*/
public interface Wiring {
/**
* Returns the capabilities provided by this wiring.
- *
+ *
* <p>
* Only capabilities considered by the resolver are returned. For example,
- * capabilities with
- * {@link ResourceConstants#CAPABILITY_EFFECTIVE_DIRECTIVE effective}
- * directive not equal to {@link ResourceConstants#EFFECTIVE_RESOLVE
+ * capabilities with {@link Namespace#CAPABILITY_EFFECTIVE_DIRECTIVE
+ * effective} directive not equal to {@link Namespace#EFFECTIVE_RESOLVE
* resolve} are not returned.
- *
+ *
* <p>
* A capability may not be required by any wiring and thus there may be no
* {@link #getProvidedResourceWires(String) wires} for the capability.
- *
+ *
* <p>
* A wiring for a non-fragment resource provides a subset of the declared
* capabilities from the resource and all attached fragment
@@ -54,22 +53,21 @@ public interface Wiring {
* other is discarded.
* <p>
* A wiring for a fragment resource with a symbolic name must provide
- * exactly one {@link ResourceConstants#IDENTITY_NAMESPACE identity}
- * capability.
+ * exactly one {@code osgi.identity} capability.
* <p>
- * &#8224; The {@link ResourceConstants#IDENTITY_NAMESPACE identity}
- * capability provided by attached fragment resource must not be included in
- * the capabilities of the host wiring.
- *
- * @param namespace The name space of the capabilities to return or
- * {@code null} to return the capabilities from all name spaces.
+ * &#8224; The {@code osgi.identity} capability provided by attached
+ * fragment resource must not be included in the capabilities of the host
+ * wiring.
+ *
+ * @param namespace The namespace of the capabilities to return or
+ * {@code null} to return the capabilities from all namespaces.
* @return A list containing a snapshot of the {@link Capability}s, or an
* empty list if this wiring provides no capabilities in the
- * specified name space. For a given name space, the list contains
- * the wires in the order the capabilities were specified in the
+ * specified namespace. For a given namespace, the list contains the
+ * wires in the order the capabilities were specified in the
* manifests of the {@link #getResource() resource} and the attached
* fragment resources<sup>&#8224;</sup> of this wiring. There is no
- * ordering defined between capabilities in different name spaces.
+ * ordering defined between capabilities in different namespaces.
*/
List<Capability> getResourceCapabilities(String namespace);
@@ -79,8 +77,8 @@ public interface Wiring {
* <p>
* Only requirements considered by the resolver are returned. For example,
* requirements with
- * {@link ResourceConstants#REQUIREMENT_EFFECTIVE_DIRECTIVE effective}
- * directive not equal to {@link ResourceConstants#EFFECTIVE_RESOLVE
+ * {@link Namespace#REQUIREMENT_EFFECTIVE_DIRECTIVE effective}
+ * directive not equal to {@link Namespace#EFFECTIVE_RESOLVE
* resolve} are not returned.
*
* <p>
@@ -90,33 +88,33 @@ public interface Wiring {
* example, if a package is declared to be optionally imported and is not
* actually imported, the requirement must be discarded.
*
- * @param namespace The name space of the requirements to return or
- * {@code null} to return the requirements from all name spaces.
+ * @param namespace The namespace of the requirements to return or
+ * {@code null} to return the requirements from all namespaces.
* @return A list containing a snapshot of the {@link Requirement}s, or an
* empty list if this wiring uses no requirements in the specified
- * name space. For a given name space, the list contains the wires
- * in the order the requirements were specified in the manifests of
- * the {@link #getResource() resource} and the attached fragment
+ * namespace. For a given namespace, the list contains the wires in
+ * the order the requirements were specified in the manifests of the
+ * {@link #getResource() resource} and the attached fragment
* resources of this wiring. There is no ordering defined between
- * requirements in different name spaces.
+ * requirements in different namespaces.
*/
List<Requirement> getResourceRequirements(String namespace);
/**
* Returns the {@link Wire}s to the provided {@link Capability capabilities}
* of this wiring.
- *
- * @param namespace The name space of the capabilities for which to return
+ *
+ * @param namespace The namespace of the capabilities for which to return
* wires or {@code null} to return the wires for the capabilities in
- * all name spaces.
+ * all namespaces.
* @return A list containing a snapshot of the {@link Wire}s for the
* {@link Capability capabilities} of this wiring, or an empty list
- * if this wiring has no capabilities in the specified name space.
- * For a given name space, the list contains the wires in the order
+ * if this wiring has no capabilities in the specified namespace.
+ * For a given namespace, the list contains the wires in the order
* the capabilities were specified in the manifests of the
* {@link #getResource() resource} and the attached fragment
* resources of this wiring. There is no ordering defined between
- * capabilities in different name spaces.
+ * capabilities in different namespaces.
*/
List<Wire> getProvidedResourceWires(String namespace);
@@ -124,23 +122,23 @@ public interface Wiring {
* Returns the {@link Wire}s to the {@link Requirement requirements} in use
* by this wiring.
*
- * @param namespace The name space of the requirements for which to return
+ * @param namespace The namespace of the requirements for which to return
* wires or {@code null} to return the wires for the requirements in
- * all name spaces.
+ * all namespaces.
* @return A list containing a snapshot of the {@link Wire}s for the
* {@link Requirement requirements} of this wiring, or an empty list
- * if this wiring has no requirements in the specified name space.
- * For a given name space, the list contains the wires in the order
+ * if this wiring has no requirements in the specified namespace.
+ * For a given namespace, the list contains the wires in the order
* the requirements were specified in the manifests of the
* {@link #getResource() resource} and the attached fragment
* resources of this wiring. There is no ordering defined between
- * requirements in different name spaces.
+ * requirements in different namespaces.
*/
List<Wire> getRequiredResourceWires(String namespace);
/**
* Returns the resource associated with this wiring.
- *
+ *
* @return The resource associated with this wiring.
*/
Resource getResource();
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverBundle.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverBundle.java
index b928a918a..0e6f865d7 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverBundle.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverBundle.java
@@ -15,7 +15,7 @@ import java.util.Map.Entry;
import org.eclipse.osgi.internal.resolver.*;
import org.eclipse.osgi.service.resolver.*;
import org.osgi.framework.Constants;
-import org.osgi.framework.resource.ResourceConstants;
+import org.osgi.framework.namespace.IdentityNamespace;
/*
* A companion to BundleDescription from the state used while resolving.
@@ -71,7 +71,7 @@ public class ResolverBundle extends VersionSupplier implements Comparable<Resolv
GenericDescription[] capabilities = getBundleDescription().getGenericCapabilities();
GenericCapability identity = null;
for (GenericDescription capability : capabilities) {
- if (ResourceConstants.IDENTITY_NAMESPACE.equals(capability.getType())) {
+ if (IdentityNamespace.IDENTITY_NAMESPACE.equals(capability.getType())) {
identity = new GenericCapability(this, capability);
break;
}
@@ -388,7 +388,7 @@ public class ResolverBundle extends VersionSupplier implements Comparable<Resolv
List<GenericCapability> hostCapabilities = new ArrayList<GenericCapability>(newGenericCapabilities.length);
if (newGenericCapabilities.length > 0 && dynamicAttach) {
for (GenericDescription capability : newGenericCapabilities) {
- if (!ResourceConstants.IDENTITY_NAMESPACE.equals(capability.getType())) {
+ if (!IdentityNamespace.IDENTITY_NAMESPACE.equals(capability.getType())) {
GenericDescription hostCapabililty = new GenericDescriptionImpl(getBundleDescription(), capability);
hostCapabilities.add(new GenericCapability(this, hostCapabililty));
}
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 346a7eda9..0f0653a66 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
@@ -27,7 +27,7 @@ import org.eclipse.osgi.util.ManifestElement;
import org.osgi.framework.Filter;
import org.osgi.framework.InvalidSyntaxException;
import org.osgi.framework.hooks.resolver.ResolverHook;
-import org.osgi.framework.resource.ResourceConstants;
+import org.osgi.framework.namespace.IdentityNamespace;
import org.osgi.framework.wiring.BundleCapability;
import org.osgi.framework.wiring.BundleRevision;
@@ -760,7 +760,7 @@ public class ResolverImpl implements Resolver {
}
private BundleCapability getIdentity(ResolverBundle bundle) {
- List<BundleCapability> identities = bundle.getBundleDescription().getDeclaredCapabilities(ResourceConstants.IDENTITY_NAMESPACE);
+ List<BundleCapability> identities = bundle.getBundleDescription().getDeclaredCapabilities(IdentityNamespace.IDENTITY_NAMESPACE);
return identities.size() == 1 ? identities.get(0) : bundle.getCapability();
}
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/BundleDescriptionImpl.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/BundleDescriptionImpl.java
index 233688919..73ca260b3 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/BundleDescriptionImpl.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/BundleDescriptionImpl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2011 IBM Corporation and others.
+ * Copyright (c) 2003, 2012 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
@@ -22,8 +22,8 @@ import org.eclipse.osgi.framework.util.KeyedElement;
import org.eclipse.osgi.internal.loader.BundleLoaderProxy;
import org.eclipse.osgi.service.resolver.*;
import org.osgi.framework.*;
-import org.osgi.framework.resource.*;
import org.osgi.framework.wiring.*;
+import org.osgi.resource.*;
public final class BundleDescriptionImpl extends BaseDescriptionImpl implements BundleDescription, KeyedElement {
static final String[] EMPTY_STRING = new String[0];
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/GenericSpecificationImpl.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/GenericSpecificationImpl.java
index 34a9c71ab..e887f0622 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/GenericSpecificationImpl.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/GenericSpecificationImpl.java
@@ -15,7 +15,7 @@ import java.util.*;
import org.eclipse.osgi.framework.internal.core.FilterImpl;
import org.eclipse.osgi.service.resolver.*;
import org.osgi.framework.*;
-import org.osgi.framework.resource.ResourceConstants;
+import org.osgi.resource.Namespace;
public class GenericSpecificationImpl extends VersionConstraintImpl implements GenericSpecification {
private Filter matchingFilter;
@@ -176,7 +176,7 @@ public class GenericSpecificationImpl extends VersionConstraintImpl implements G
if ((resolution & GenericSpecification.RESOLUTION_OPTIONAL) != 0)
result.put(Constants.RESOLUTION_DIRECTIVE, Constants.RESOLUTION_OPTIONAL);
if ((resolution & GenericSpecification.RESOLUTION_MULTIPLE) != 0)
- result.put(ResourceConstants.REQUIREMENT_CARDINALITY_DIRECTIVE, ResourceConstants.REQUIREMENT_CARDINALITY_MULTIPLE);
+ result.put(Namespace.REQUIREMENT_CARDINALITY_DIRECTIVE, Namespace.CARDINALITY_MULTIPLE);
if (matchingFilter != null) {
result.put(Constants.FILTER_DIRECTIVE, matchingFilter.toString());
}
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 bde0d203f..b6964980a 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
@@ -20,7 +20,9 @@ import org.eclipse.osgi.service.resolver.VersionRange;
import org.eclipse.osgi.util.ManifestElement;
import org.eclipse.osgi.util.NLS;
import org.osgi.framework.*;
-import org.osgi.framework.resource.ResourceConstants;
+import org.osgi.framework.namespace.BundleNamespace;
+import org.osgi.framework.namespace.IdentityNamespace;
+import org.osgi.resource.Namespace;
/**
* This class builds bundle description objects from manifests
@@ -33,7 +35,7 @@ public class StateBuilder {
private static final String[] DEFINED_FRAGMENT_HOST_DIRECTIVES = {Constants.EXTENSION_DIRECTIVE};
static final String[] DEFINED_BSN_DIRECTIVES = {Constants.SINGLETON_DIRECTIVE, Constants.FRAGMENT_ATTACHMENT_DIRECTIVE, Constants.MANDATORY_DIRECTIVE};
static final String[] DEFINED_BSN_MATCHING_ATTRS = {Constants.BUNDLE_VERSION_ATTRIBUTE, Constants.OPTIONAL_ATTRIBUTE, Constants.REPROVIDE_ATTRIBUTE};
- private static final String[] DEFINED_REQUIRE_CAPABILITY_DIRECTIVES = {Constants.RESOLUTION_DIRECTIVE, Constants.FILTER_DIRECTIVE, ResourceConstants.REQUIREMENT_CARDINALITY_DIRECTIVE};
+ private static final String[] DEFINED_REQUIRE_CAPABILITY_DIRECTIVES = {Constants.RESOLUTION_DIRECTIVE, Constants.FILTER_DIRECTIVE, Namespace.REQUIREMENT_CARDINALITY_DIRECTIVE};
private static final String[] DEFINED_REQUIRE_CAPABILITY_ATTRS = {};
private static final String[] DEFINED_OSGI_VALIDATE_HEADERS = {Constants.IMPORT_PACKAGE, Constants.DYNAMICIMPORT_PACKAGE, Constants.EXPORT_PACKAGE, Constants.FRAGMENT_HOST, Constants.BUNDLE_SYMBOLICNAME, Constants.REQUIRE_BUNDLE};
static final String GENERIC_REQUIRE = "Eclipse-GenericRequire"; //$NON-NLS-1$
@@ -628,8 +630,8 @@ public class StateBuilder {
int resolution = 0;
if (Constants.RESOLUTION_OPTIONAL.equals(resolutionDirective))
resolution |= GenericSpecification.RESOLUTION_OPTIONAL;
- String cardinality = element.getDirective(ResourceConstants.REQUIREMENT_CARDINALITY_DIRECTIVE);
- if (ResourceConstants.REQUIREMENT_CARDINALITY_MULTIPLE.equals(cardinality))
+ String cardinality = element.getDirective(Namespace.REQUIREMENT_CARDINALITY_DIRECTIVE);
+ if (Namespace.CARDINALITY_MULTIPLE.equals(cardinality))
resolution |= GenericSpecification.RESOLUTION_MULTIPLE;
spec.setResolution(resolution);
spec.setAttributes(getAttributes(element, DEFINED_REQUIRE_CAPABILITY_ATTRS));
@@ -700,8 +702,8 @@ public class StateBuilder {
for (ManifestElement element : osgiCapabilities) {
String[] namespaces = element.getValueComponents();
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$
+ if (IdentityNamespace.IDENTITY_NAMESPACE.equals(namespace))
+ throw new BundleException("A bundle is not allowed to define a capability in the " + IdentityNamespace.IDENTITY_NAMESPACE + " name space."); //$NON-NLS-1$ //$NON-NLS-2$
GenericDescriptionImpl desc = new GenericDescriptionImpl();
desc.setType(namespace);
@@ -737,8 +739,8 @@ public class StateBuilder {
if (colonIdx > 0) {
name = genericNames[j].substring(0, colonIdx);
desc.setType(genericNames[j].substring(colonIdx + 1));
- if (ResourceConstants.IDENTITY_NAMESPACE.equals(desc.getType()))
- 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$
+ if (IdentityNamespace.IDENTITY_NAMESPACE.equals(desc.getType()))
+ throw new BundleException("A bundle is not allowed to define a capability in the " + IdentityNamespace.IDENTITY_NAMESPACE + " name space."); //$NON-NLS-1$ //$NON-NLS-2$
}
Map<String, Object> mapAttrs = getAttributes(equinoxCapabilities[i], new String[] {Constants.VERSION_ATTRIBUTE});
Dictionary<String, Object> attrs = mapAttrs == null ? new Hashtable<String, Object>() : new Hashtable<String, Object>(mapAttrs);
@@ -888,14 +890,14 @@ public class StateBuilder {
if (description.getSymbolicName() == null)
return null;
GenericDescriptionImpl result = new GenericDescriptionImpl();
- result.setType(ResourceConstants.IDENTITY_NAMESPACE);
+ result.setType(IdentityNamespace.IDENTITY_NAMESPACE);
Dictionary<String, Object> attributes = new Hashtable<String, Object>(description.getDeclaredAttributes());
// remove osgi.wiring.bundle and bundle-version attributes
- attributes.remove(ResourceConstants.WIRING_BUNDLE_NAMESPACE);
+ attributes.remove(BundleNamespace.BUNDLE_NAMESPACE);
attributes.remove(Constants.BUNDLE_VERSION_ATTRIBUTE);
- attributes.put(ResourceConstants.IDENTITY_NAMESPACE, description.getSymbolicName());
- attributes.put(ResourceConstants.IDENTITY_TYPE_ATTRIBUTE, description.getHost() == null ? ResourceConstants.IDENTITY_TYPE_BUNDLE : ResourceConstants.IDENTITY_TYPE_FRAGMENT);
- attributes.put(ResourceConstants.IDENTITY_VERSION_ATTRIBUTE, description.getVersion());
+ attributes.put(IdentityNamespace.IDENTITY_NAMESPACE, description.getSymbolicName());
+ attributes.put(IdentityNamespace.CAPABILITY_TYPE_ATTRIBUTE, description.getHost() == null ? IdentityNamespace.TYPE_BUNDLE : IdentityNamespace.TYPE_FRAGMENT);
+ attributes.put(IdentityNamespace.CAPABILITY_VERSION_ATTRIBUTE, description.getVersion());
result.setAttributes(attributes);
Map<String, String> directives = new HashMap<String, String>(description.getDeclaredDirectives());
// remove defaults directive values
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/VersionConstraintImpl.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/VersionConstraintImpl.java
index 34f7698b6..1cc7e5eeb 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/VersionConstraintImpl.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/VersionConstraintImpl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2011 IBM Corporation and others.
+ * Copyright (c) 2003, 2012 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
@@ -17,13 +17,14 @@ import java.util.Map;
import org.eclipse.osgi.framework.internal.core.Constants;
import org.eclipse.osgi.internal.resolver.BaseDescriptionImpl.BaseCapability;
import org.eclipse.osgi.service.resolver.*;
-import org.eclipse.osgi.service.resolver.VersionRange;
import org.eclipse.osgi.service.resolver.extras.SpecificationReference;
import org.eclipse.osgi.util.ManifestElement;
-import org.osgi.framework.*;
-import org.osgi.framework.resource.Capability;
-import org.osgi.framework.resource.ResourceConstants;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.namespace.AbstractWiringNamespace;
import org.osgi.framework.wiring.*;
+import org.osgi.resource.Capability;
+import org.osgi.resource.Namespace;
abstract class VersionConstraintImpl implements VersionConstraint {
@@ -179,14 +180,14 @@ abstract class VersionConstraintImpl implements VersionConstraint {
// now we must do the generic thing
if (!namespace.equals(capability.getNamespace()))
return false;
- String filterSpec = getDirectives().get(ResourceConstants.REQUIREMENT_FILTER_DIRECTIVE);
+ String filterSpec = getDirectives().get(Namespace.REQUIREMENT_FILTER_DIRECTIVE);
try {
if (filterSpec != null && !FrameworkUtil.createFilter(filterSpec).matches(capability.getAttributes()))
return false;
} catch (InvalidSyntaxException e) {
return false;
}
- return hasMandatoryAttributes(ManifestElement.getArrayFromList(capability.getDirectives().get(ResourceConstants.CAPABILITY_MANDATORY_DIRECTIVE)));
+ return hasMandatoryAttributes(ManifestElement.getArrayFromList(capability.getDirectives().get(AbstractWiringNamespace.CAPABILITY_MANDATORY_DIRECTIVE)));
}
public BundleRevision getResource() {
@@ -209,27 +210,10 @@ abstract class VersionConstraintImpl implements VersionConstraint {
return addFilterAttribute(filter, attr, value, true);
}
- static private final Version MAX_VERSION = new Version(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE);
-
- // TODO this is coupled to the implementation detail of version range for open range check
- // TODO we need to create a new method on VersionRange to get a filter string and likely should add a FilterBuilder.
static StringBuffer addFilterAttribute(StringBuffer filter, String attr, Object value, boolean escapeWildCard) {
if (value instanceof VersionRange) {
VersionRange range = (VersionRange) value;
- if (range.getIncludeMinimum()) {
- filter.append('(').append(attr).append(">=").append(escapeValue(range.getMinimum(), escapeWildCard)).append(')'); //$NON-NLS-1$
- } else {
- filter.append("(!(").append(attr).append("<=").append(escapeValue(range.getMinimum(), escapeWildCard)).append("))"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- // only include the maximum check if this is not an open range
- // this check is a bit hacky because we have no method on VersionRange to check if the range really is open
- if (!(MAX_VERSION.equals(range.getMaximum()) && range.getIncludeMaximum())) {
- if (range.getIncludeMaximum()) {
- filter.append('(').append(attr).append("<=").append(escapeValue(range.getMaximum(), escapeWildCard)).append(')'); //$NON-NLS-1$
- } else {
- filter.append("(!(").append(attr).append(">=").append(escapeValue(range.getMaximum(), escapeWildCard)).append("))"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- }
+ filter.append(range.toFilterString(attr));
} else {
filter.append('(').append(attr).append('=').append(escapeValue(value, escapeWildCard)).append(')');
}

Back to the top