Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 349618 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/equinox/internal/region/hook/RegionResolverHookTests.java (+32 lines)
Lines 403-408 Link Here
403
		}
403
		}
404
404
405
		@Override
405
		@Override
406
		public BundleRevision getResource() {
407
			return getRevision();
408
		}
409
410
		@Override
406
		public BundleRevision getRevision() {
411
		public BundleRevision getRevision() {
407
			return new StubBundleRevision(bundle(this.bundleSymbolicName));
412
			return new StubBundleRevision(bundle(this.bundleSymbolicName));
408
		}
413
		}
Lines 481-486 Link Here
481
		}
486
		}
482
487
483
		@Override
488
		@Override
489
		public BundleRevision getResource() {
490
			return getRevision();
491
		}
492
493
		@Override
484
		public BundleRevision getRevision() {
494
		public BundleRevision getRevision() {
485
			return new StubBundleRevision(bundle(this.bundleSymbolicName));
495
			return new StubBundleRevision(bundle(this.bundleSymbolicName));
486
		}
496
		}
Lines 543-548 Link Here
543
		}
553
		}
544
554
545
		@Override
555
		@Override
556
		public BundleRevision getResource() {
557
			return getRevision();
558
		}
559
560
		@Override
546
		public BundleRevision getRevision() {
561
		public BundleRevision getRevision() {
547
			return this.bundleRevision;
562
			return this.bundleRevision;
548
		}
563
		}
Lines 552-557 Link Here
552
			throw new UnsupportedOperationException();
567
			throw new UnsupportedOperationException();
553
		}
568
		}
554
569
570
		@Override
571
		public boolean matches(Capability capability) {
572
			if (!(capability instanceof BundleCapability))
573
				return false;
574
			return matches((BundleCapability) capability);
575
		}
555
	}
576
	}
556
577
557
	final class StubBundleRevision implements BundleRevision {
578
	final class StubBundleRevision implements BundleRevision {
Lines 597-602 Link Here
597
			throw new UnsupportedOperationException();
618
			throw new UnsupportedOperationException();
598
		}
619
		}
599
620
621
		@SuppressWarnings({"cast", "unchecked", "rawtypes"})
622
		@Override
623
		public List<Capability> getCapabilities(String namespace) {
624
			return (List<Capability>) (List) getDeclaredCapabilities(namespace);
625
		}
626
627
		@SuppressWarnings({"cast", "unchecked", "rawtypes"})
628
		@Override
629
		public List<Requirement> getRequirements(String namespace) {
630
			return (List<Requirement>) (List) getDeclaredRequirements(namespace);
631
		}
600
	}
632
	}
601
633
602
}
634
}
(-).settings/.api_filters (+55 lines)
Lines 989-994 Link Here
989
<message_argument value="org.osgi.framework.wiring.BundleCapability"/>
989
<message_argument value="org.osgi.framework.wiring.BundleCapability"/>
990
</message_arguments>
990
</message_arguments>
991
</filter>
991
</filter>
992
<filter comment="Ignore osgi API." id="1211105284">
993
<message_arguments>
994
<message_argument value="getResource()"/>
995
</message_arguments>
996
</filter>
992
</resource>
997
</resource>
993
<resource path="osgi/src/org/osgi/framework/wiring/BundleRequirement.java" type="org.osgi.framework.wiring.BundleRequirement">
998
<resource path="osgi/src/org/osgi/framework/wiring/BundleRequirement.java" type="org.osgi.framework.wiring.BundleRequirement">
994
<filter comment="Ignore OSGi API" id="1110441988">
999
<filter comment="Ignore OSGi API" id="1110441988">
Lines 996-1001 Link Here
996
<message_argument value="org.osgi.framework.wiring.BundleRequirement"/>
1001
<message_argument value="org.osgi.framework.wiring.BundleRequirement"/>
997
</message_arguments>
1002
</message_arguments>
998
</filter>
1003
</filter>
1004
<filter comment="Ignore osgi API." id="1211105284">
1005
<message_arguments>
1006
<message_argument value="getResource()"/>
1007
</message_arguments>
1008
</filter>
999
</resource>
1009
</resource>
1000
<resource path="osgi/src/org/osgi/framework/wiring/BundleRevision.java" type="org.osgi.framework.wiring.BundleRevision">
1010
<resource path="osgi/src/org/osgi/framework/wiring/BundleRevision.java" type="org.osgi.framework.wiring.BundleRevision">
1001
<filter comment="Ignore OSGi API" id="1110441988">
1011
<filter comment="Ignore OSGi API" id="1110441988">
Lines 1017-1022 Link Here
1017
<message_argument value="org.osgi.framework.wiring.BundleWire"/>
1027
<message_argument value="org.osgi.framework.wiring.BundleWire"/>
1018
</message_arguments>
1028
</message_arguments>
1019
</filter>
1029
</filter>
1030
<filter comment="Ignore osgi API." id="1211105284">
1031
<message_arguments>
1032
<message_argument value="getProvider()"/>
1033
</message_arguments>
1034
</filter>
1035
<filter comment="Ignore osgi API." id="1211105284">
1036
<message_arguments>
1037
<message_argument value="getRequirer()"/>
1038
</message_arguments>
1039
</filter>
1020
</resource>
1040
</resource>
1021
<resource path="osgi/src/org/osgi/framework/wiring/BundleWiring.java" type="org.osgi.framework.wiring.BundleWiring">
1041
<resource path="osgi/src/org/osgi/framework/wiring/BundleWiring.java" type="org.osgi.framework.wiring.BundleWiring">
1022
<filter comment="Ignore OSGi API" id="1110441988">
1042
<filter comment="Ignore OSGi API" id="1110441988">
Lines 1025-1030 Link Here
1025
</message_arguments>
1045
</message_arguments>
1026
</filter>
1046
</filter>
1027
</resource>
1047
</resource>
1048
<resource path="osgi/src/org/osgi/framework/wiring/Capability.java" type="org.osgi.framework.wiring.Capability">
1049
<filter comment="Ignore osgi API." id="1110441988">
1050
<message_arguments>
1051
<message_argument value="org.osgi.framework.wiring.Capability"/>
1052
</message_arguments>
1053
</filter>
1054
</resource>
1028
<resource path="osgi/src/org/osgi/framework/wiring/FrameworkWiring.java" type="org.osgi.framework.wiring.FrameworkWiring">
1055
<resource path="osgi/src/org/osgi/framework/wiring/FrameworkWiring.java" type="org.osgi.framework.wiring.FrameworkWiring">
1029
<filter comment="Ignore OSGi API" id="1110441988">
1056
<filter comment="Ignore OSGi API" id="1110441988">
1030
<message_arguments>
1057
<message_arguments>
Lines 1032-1037 Link Here
1032
</message_arguments>
1059
</message_arguments>
1033
</filter>
1060
</filter>
1034
</resource>
1061
</resource>
1062
<resource path="osgi/src/org/osgi/framework/wiring/Requirement.java" type="org.osgi.framework.wiring.Requirement">
1063
<filter comment="Ignore osgi API." id="1110441988">
1064
<message_arguments>
1065
<message_argument value="org.osgi.framework.wiring.Requirement"/>
1066
</message_arguments>
1067
</filter>
1068
</resource>
1069
<resource path="osgi/src/org/osgi/framework/wiring/Resource.java" type="org.osgi.framework.wiring.Resource">
1070
<filter comment="Ignore osgi API." id="1110441988">
1071
<message_arguments>
1072
<message_argument value="org.osgi.framework.wiring.Resource"/>
1073
</message_arguments>
1074
</filter>
1075
</resource>
1076
<resource path="osgi/src/org/osgi/framework/wiring/ResourceConstants.java" type="org.osgi.framework.wiring.ResourceConstants">
1077
<filter comment="Ignore osgi API." id="1110441988">
1078
<message_arguments>
1079
<message_argument value="org.osgi.framework.wiring.ResourceConstants"/>
1080
</message_arguments>
1081
</filter>
1082
</resource>
1083
<resource path="osgi/src/org/osgi/framework/wiring/Wire.java" type="org.osgi.framework.wiring.Wire">
1084
<filter comment="Ignore osgi API." id="1110441988">
1085
<message_arguments>
1086
<message_argument value="org.osgi.framework.wiring.Wire"/>
1087
</message_arguments>
1088
</filter>
1089
</resource>
1035
<resource path="osgi/src/org/osgi/service/condpermadmin/ConditionalPermissionAdmin.java" type="org.osgi.service.condpermadmin.ConditionalPermissionAdmin">
1090
<resource path="osgi/src/org/osgi/service/condpermadmin/ConditionalPermissionAdmin.java" type="org.osgi.service.condpermadmin.ConditionalPermissionAdmin">
1036
<filter comment="Ignore OSGi API" id="403853384">
1091
<filter comment="Ignore OSGi API" id="403853384">
1037
<message_arguments>
1092
<message_arguments>
(-)META-INF/MANIFEST.MF (-2 / +2 lines)
Lines 25-31 Link Here
25
 org.osgi.framework.hooks.service; version="1.1",
25
 org.osgi.framework.hooks.service; version="1.1",
26
 org.osgi.framework.hooks.weaving; version="1.0",
26
 org.osgi.framework.hooks.weaving; version="1.0",
27
 org.osgi.framework.startlevel; version="1.0",
27
 org.osgi.framework.startlevel; version="1.0",
28
 org.osgi.framework.wiring; version="1.0",
28
 org.osgi.framework.wiring; version="1.1",
29
 org.osgi.service.condpermadmin;version="1.1.1",
29
 org.osgi.service.condpermadmin;version="1.1.1",
30
 org.osgi.service.framework; version="1.0"; x-internal:=true,
30
 org.osgi.service.framework; version="1.0"; x-internal:=true,
31
 org.osgi.service.log; version="1.3",
31
 org.osgi.service.log; version="1.3",
Lines 75-81 Link Here
75
Bundle-Description: %systemBundle
75
Bundle-Description: %systemBundle
76
Bundle-Copyright: %copyright
76
Bundle-Copyright: %copyright
77
Bundle-Vendor: %eclipse.org
77
Bundle-Vendor: %eclipse.org
78
Bundle-Version: 3.7.100.qualifier
78
Bundle-Version: 3.8.0.qualifier
79
Bundle-Localization: systembundle
79
Bundle-Localization: systembundle
80
Bundle-DocUrl: http://www.eclipse.org
80
Bundle-DocUrl: http://www.eclipse.org
81
Eclipse-ExtensibleAPI: true
81
Eclipse-ExtensibleAPI: true
(-)osgi/src/org/osgi/framework/wiring/BundleCapability.java (-2 / +5 lines)
Lines 18-32 Link Here
18
18
19
import java.util.Map;
19
import java.util.Map;
20
20
21
21
/**
22
/**
22
 * A capability that has been declared from a {@link BundleRevision bundle
23
 * A capability that has been declared from a {@link BundleRevision bundle
23
 * revision}.
24
 * revision}.
24
 * 
25
 * 
25
 * @ThreadSafe
26
 * @ThreadSafe
26
 * @noimplement
27
 * @noimplement
27
 * @version $Id: 0fde13c3228af1aa97872b37ccf0aa6e23123b11 $
28
 * @version $Id: 6bbc1e645f927531d40fb245c95f5d26ad189db3 $
28
 */
29
 */
29
public interface BundleCapability {
30
public interface BundleCapability extends Capability{
30
	/**
31
	/**
31
	 * Returns the name space of this capability.
32
	 * Returns the name space of this capability.
32
	 * 
33
	 * 
Lines 58-61 Link Here
58
	 * @return The bundle revision declaring this capability.
59
	 * @return The bundle revision declaring this capability.
59
	 */
60
	 */
60
	BundleRevision getRevision();
61
	BundleRevision getRevision();
62
63
	BundleRevision getResource();
61
}
64
}
(-)osgi/src/org/osgi/framework/wiring/BundleRequirement.java (-2 / +8 lines)
Lines 18-32 Link Here
18
18
19
import java.util.Map;
19
import java.util.Map;
20
20
21
21
/**
22
/**
22
 * A requirement that has been declared from a {@link BundleRevision bundle
23
 * A requirement that has been declared from a {@link BundleRevision bundle
23
 * revision}.
24
 * revision}.
24
 * 
25
 * 
25
 * @ThreadSafe
26
 * @ThreadSafe
26
 * @noimplement
27
 * @noimplement
27
 * @version $Id: 659132c1fac7526240df377ead0e1bc8d4af2e77 $
28
 * @version $Id: 3ee254a3c0d5516b56affaa66544c892f3d522cb $
28
 */
29
 */
29
public interface BundleRequirement {
30
public interface BundleRequirement extends Requirement{
30
	/**
31
	/**
31
	 * Returns the name space of this requirement.
32
	 * Returns the name space of this requirement.
32
	 * 
33
	 * 
Lines 60-65 Link Here
60
	BundleRevision getRevision();
61
	BundleRevision getRevision();
61
62
62
	/**
63
	/**
64
	 * {@inheritDoc}
65
	 */
66
	BundleRevision getResource();
67
68
	/**
63
	 * Returns whether the specified capability matches this requirement.
69
	 * Returns whether the specified capability matches this requirement.
64
	 * 
70
	 * 
65
	 * @param capability The capability to match to this requirement.
71
	 * @param capability The capability to match to this requirement.
(-)osgi/src/org/osgi/framework/wiring/BundleRevision.java (-5 / +5 lines)
Lines 47-55 Link Here
47
 * 
47
 * 
48
 * @ThreadSafe
48
 * @ThreadSafe
49
 * @noimplement
49
 * @noimplement
50
 * @version $Id: 139b3046ebd46c48b03dda8d36f2f9d79e2e616d $
50
 * @version $Id: 2eb450f15fc9d4fe1b611dc55e2238b972b4c486 $
51
 */
51
 */
52
public interface BundleRevision extends BundleReference {
52
public interface BundleRevision extends BundleReference, Resource {
53
	/**
53
	/**
54
	 * Returns the symbolic name for this bundle revision.
54
	 * Returns the symbolic name for this bundle revision.
55
	 * 
55
	 * 
Lines 137-143 Link Here
137
	 * package wires required by a bundle wiring may change as the bundle wiring
137
	 * package wires required by a bundle wiring may change as the bundle wiring
138
	 * may dynamically import additional packages.
138
	 * may dynamically import additional packages.
139
	 */
139
	 */
140
	String	PACKAGE_NAMESPACE	= "osgi.wiring.package";
140
	String	PACKAGE_NAMESPACE	= ResourceConstants.WIRING_PACKAGE_NAMESPACE;
141
141
142
	/**
142
	/**
143
	 * Name space for bundle capabilities and requirements.
143
	 * Name space for bundle capabilities and requirements.
Lines 175-181 Link Here
175
	 * {@link Constants#BUNDLE_MANIFESTVERSION Bundle-ManifestVersion}
175
	 * {@link Constants#BUNDLE_MANIFESTVERSION Bundle-ManifestVersion}
176
	 * {@literal <} 2) must not provide a bundle capability.
176
	 * {@literal <} 2) must not provide a bundle capability.
177
	 */
177
	 */
178
	String	BUNDLE_NAMESPACE	= "osgi.wiring.bundle";
178
	String	BUNDLE_NAMESPACE	= ResourceConstants.WIRING_BUNDLE_NAMESPACE;
179
179
180
	/**
180
	/**
181
	 * Name space for host capabilities and requirements.
181
	 * Name space for host capabilities and requirements.
Lines 216-222 Link Here
216
	 * {@link Constants#BUNDLE_MANIFESTVERSION Bundle-ManifestVersion}
216
	 * {@link Constants#BUNDLE_MANIFESTVERSION Bundle-ManifestVersion}
217
	 * {@literal <} 2) must not provide a host capability.
217
	 * {@literal <} 2) must not provide a host capability.
218
	 */
218
	 */
219
	String	HOST_NAMESPACE		= "osgi.wiring.host";
219
	String	HOST_NAMESPACE		= ResourceConstants.WIRING_HOST_NAMESPACE;
220
220
221
	/**
221
	/**
222
	 * Returns the special types of this bundle revision. The bundle revision
222
	 * Returns the special types of this bundle revision. The bundle revision
(-)osgi/src/org/osgi/framework/wiring/BundleWire.java (-2 / +13 lines)
Lines 16-29 Link Here
16
16
17
package org.osgi.framework.wiring;
17
package org.osgi.framework.wiring;
18
18
19
19
/**
20
/**
20
 * A wire connecting a {@link BundleCapability} to a {@link BundleRequirement}.
21
 * A wire connecting a {@link BundleCapability} to a {@link BundleRequirement}.
21
 * 
22
 * 
22
 * @ThreadSafe
23
 * @ThreadSafe
23
 * @noimplement
24
 * @noimplement
24
 * @version $Id: 4f936a84065762ec3267a44f86ae01b0150e44ce $
25
 * @version $Id: aca8642cea91995d0b178129cba1131ed327c7e7 $
25
 */
26
 */
26
public interface BundleWire {
27
public interface BundleWire extends Wire {
27
	/**
28
	/**
28
	 * Returns the {@link BundleCapability} for this wire.
29
	 * Returns the {@link BundleCapability} for this wire.
29
	 * 
30
	 * 
Lines 69-72 Link Here
69
	 *         returned.
70
	 *         returned.
70
	 */
71
	 */
71
	BundleWiring getRequirerWiring();
72
	BundleWiring getRequirerWiring();
73
74
	/**
75
	 * {@inheritDoc}
76
	 */
77
	BundleRevision getProvider();
78
79
	/**
80
	 * {@inheritDoc}
81
	 */
82
	BundleRevision getRequirer();
72
}
83
}
(-)osgi/src/org/osgi/framework/wiring/Capability.java (+82 lines)
Added Link Here
1
/*
2
 * Copyright (c) OSGi Alliance (2010, 2011). All Rights Reserved.
3
 * 
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *      http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16
17
package org.osgi.framework.wiring;
18
19
import java.util.Map;
20
21
/**
22
 * A capability that has been declared from a {@link Resource}.
23
 * 
24
 * @ThreadSafe
25
 * @version $Id: f8bd10002691537806e4bc3cf08f3fce37510121 $
26
 */
27
public interface Capability {
28
29
	/**
30
	 * Returns the name space of this capability.
31
	 * 
32
	 * @return The name space of this capability.
33
	 */
34
	String getNamespace();
35
36
	/**
37
	 * Returns the directives of this capability. Only the following list of
38
	 * directives have semantic meaning in the returned {@link Map map} of
39
	 * directives:
40
	 * <ul>
41
	 * <li> {@link ResourceConstants#CAPABILITY_EFFECTIVE_DIRECTIVE effective}
42
	 * <li> {@link ResourceConstants#CAPABILITY_USES_DIRECTIVE uses}
43
	 * <li> {@link ResourceConstants#CAPABILITY_MANDATORY_DIRECTIVE mandatory} -
44
	 * only recognized for the
45
	 * {@link ResourceConstants#WIRING_BUNDLE_NAMESPACE osgi.wiring.bundle} and
46
	 * {@link ResourceConstants#WIRING_PACKAGE_NAMESPACE osgi.wiring.package}
47
	 * name spaces.
48
	 * <li> {@link ResourceConstants#CAPABILITY_EXCLUDE_DIRECTIVE exclude} -
49
	 * only recognized for the
50
	 * {@link ResourceConstants#WIRING_PACKAGE_NAMESPACE osgi.wiring.package}
51
	 * name space.
52
	 * <li> {@link ResourceConstants#CAPABILITY_INCLUDE_DIRECTIVE include} -
53
	 * only recognized for the
54
	 * {@link ResourceConstants#WIRING_PACKAGE_NAMESPACE osgi.wiring.package}
55
	 * name space.
56
	 * </ul>
57
	 * All other directive are considered extra user defined information that
58
	 * has no semantic meaning. OSGi Alliance reserves the right to extend the
59
	 * set of directives which have semantic meaning.
60
	 * 
61
	 * @return An unmodifiable map of directive names to directive values for
62
	 *         this capability, or an empty map if this capability has no
63
	 *         directives.
64
	 */
65
	Map<String, String> getDirectives();
66
67
	/**
68
	 * Returns the attributes of this capability.
69
	 * 
70
	 * @return An unmodifiable map of attribute names to attribute values for
71
	 *         this capability, or an empty map if this capability has no
72
	 *         attributes.
73
	 */
74
	Map<String, Object> getAttributes();
75
76
	/**
77
	 * The resource that declares this capability.
78
	 * 
79
	 * @return the resource
80
	 */
81
	Resource getResource();
82
}
(-)osgi/src/org/osgi/framework/wiring/Requirement.java (+104 lines)
Added Link Here
1
/*
2
 * Copyright (c) OSGi Alliance (2010, 2011). All Rights Reserved.
3
 * 
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *      http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16
17
package org.osgi.framework.wiring;
18
19
import java.util.Map;
20
21
import org.osgi.framework.Constants;
22
23
/**
24
 * A requirement that has been declared from a {@link Resource} .
25
 * 
26
 * @ThreadSafe
27
 * @version $Id: 6a5c3253e257d6f503a39d94563d7d656ce05e1d $
28
 */
29
public interface Requirement {
30
	/**
31
	 * Returns the name space of this requirement.
32
	 * 
33
	 * @return The name space of this requirement.
34
	 */
35
	String getNamespace();
36
37
	/**
38
	 * Returns the directives of this requirement. Only the following list of
39
	 * directives have semantic meaning in the returned {@link Map map} of
40
	 * directives:
41
	 * <ul>
42
	 * <li> {@link ResourceConstants#REQUIREMENT_EFFECTIVE_DIRECTIVE effective}
43
	 * <li> {@link ResourceConstants#REQUIREMENT_FILTER_DIRECTIVE filter}
44
	 * <li> {@link ResourceConstants#REQUIREMENT_CARDINALITY_DIRECTIVE
45
	 * cardinality}
46
	 * <li> {@link ResourceConstants#REQUIREMENT_RESOLUTION_DIRECTIVE resolution}
47
	 * <li> {@link ResourceConstants#REQUIREMENT_VISIBILITY_DIRECTIVE visibility}
48
	 * - only recognized for the
49
	 * {@link ResourceConstants#WIRING_BUNDLE_NAMESPACE osgi.wiring.bundle} name
50
	 * space.
51
	 * </ul>
52
	 * All other directive are considered extra user defined information that
53
	 * has no semantic meaning. OSGi Alliance reserves the right to extend the
54
	 * set of directives which have semantic meaning.
55
	 * 
56
	 * @return An unmodifiable map of directive names to directive values for
57
	 *         this requirement, or an empty map if this requirement has no
58
	 *         directives.
59
	 */
60
	Map<String, String> getDirectives();
61
62
	/**
63
	 * Returns the attributes of this requirement. Requirement attributes have
64
	 * no semantic meaning and are considered extra user defined information.
65
	 * 
66
	 * @return An unmodifiable map of attribute names to attribute values for
67
	 *         this requirement, or an empty map if this requirement has no
68
	 *         attributes.
69
	 */
70
	Map<String, Object> getAttributes();
71
72
	/**
73
	 * Returns the resource declaring this requirement.
74
	 * 
75
	 * @return The resource declaring this requirement.
76
	 */
77
	Resource getResource();
78
79
	/**
80
	 * Returns whether the specified capability matches this requirement. A
81
	 * capability matches this requirement when all of the following are true:
82
	 * <ul>
83
	 * <li>The specified capability has the same {@link #getNamespace() name
84
	 * space} as this requirement.
85
	 * <li>The filter specified by the {@link Constants#FILTER_DIRECTIVE filter}
86
	 * directive of this requirement matches the
87
	 * {@link Capability#getAttributes() attributes of the specified capability}.
88
	 * <li>The {@link #getDirectives() requirement directives} and the
89
	 * {@link Capability#getDirectives() capability directives} that apply to
90
	 * the name space are satisfied.
91
	 * </ul>
92
	 * 
93
	 * 
94
	 * @param capability
95
	 *            The capability to match to this requirement.
96
	 * @return {@code true} if the specified capability matches this this
97
	 *         requirement. {@link #getNamespace() name space} as this
98
	 *         requirement and the filter for this requirement matches the
99
	 *         {@link BundleCapability#getAttributes() attributes of the
100
	 *         specified capability}; {@code false} otherwise.
101
	 */
102
	// TODO much debate on the placement and need for this method.
103
	boolean matches(Capability capability);
104
}
(-)osgi/src/org/osgi/framework/wiring/Resource.java (+46 lines)
Added Link Here
1
package org.osgi.framework.wiring;
2
3
import java.util.List;
4
5
6
/**
7
 * A resource is the representation of a uniquely identified and typed data.
8
 * 
9
 * A resources can be wired together via capabilities and requirements.
10
 * 
11
 * TODO decide on identity characteristics of a revision. Given in OSGi multiple
12
 * bundles can be installed with same bsn/version this cannot be used as a key.
13
 * 
14
 * What then is identity of a resource? Object identity? URI (needs getter
15
 * method?)
16
 * 
17
 * @ThreadSafe
18
 * @version $Id: 0d09cf5655002b7b2f1d37d413788892ad2dfedf $
19
 */
20
public interface Resource {
21
	/**
22
	 * Returns the capabilities declared by this resource.
23
	 * 
24
	 * @param namespace
25
	 *            The name space of the declared capabilities to return or
26
	 *            {@code null} to return the declared capabilities from all name
27
	 *            spaces.
28
	 * @return A list containing a snapshot of the declared {@link Capability}s,
29
	 *         or an empty list if this resource declares no capabilities in the
30
	 *         specified name space.
31
	 */
32
	List<Capability> getCapabilities(String namespace);
33
34
	/**
35
	 * Returns the requirements declared by this bundle resource.
36
	 * 
37
	 * @param namespace
38
	 *            The name space of the declared requirements to return or
39
	 *            {@code null} to return the declared requirements from all name
40
	 *            spaces.
41
	 * @return A list containing a snapshot of the declared {@link Requirement}
42
	 *         s, or an empty list if this resource declares no requirements in
43
	 *         the specified name space.
44
	 */
45
	List<Requirement> getRequirements(String namespace);
46
}
(-)osgi/src/org/osgi/framework/wiring/ResourceConstants.java (+364 lines)
Added Link Here
1
/*
2
 * Copyright (c) OSGi Alliance (2011). All Rights Reserved.
3
 * 
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *      http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16
package org.osgi.framework.wiring;
17
18
import org.osgi.framework.Constants;
19
import org.osgi.framework.Version;
20
21
/**
22
 * Defines standard names for the attributes, directives and name spaces for
23
 * resources, capabilities and requirements.
24
 * 
25
 * <p>
26
 * The values associated with these keys are of type {@code String}, unless
27
 * otherwise indicated.
28
 * 
29
 * @version $Id: 6a0df41f82a587eb72c0c513fdd0411f18564586 $
30
 */
31
public final class ResourceConstants {
32
33
	private ResourceConstants() {
34
		// keep others from creating objects of this type.
35
	}
36
37
	/**
38
	 * Name space for the identity capability.  Each {@link Resource resource} 
39
	 * should provide an identity capability that can be used to identify the
40
	 * resource.
41
	 * 
42
	 * For identity capability attributes the following applies:
43
	 * <ul>
44
	 * <li>The
45
	 * <q>osgi.identity</q> attribute contains the symbolic name of the
46
	 * resource.
47
	 * <li>The {@link #IDENTITY_VERSION_ATTRIBUTE version} attribute contains
48
	 * the {@link Version} of the resource.
49
	 * <li>The {@link #IDENTITY_TYPE_ATTRIBUTE type} attribute contains the
50
	 * resource type.
51
	 * </ul>
52
	 * <p>
53
	 * A resource with a symbolic name provides exactly one <sup>&#8224;</sup> identity
54
	 * {@link Resource#getCapabilities(String) capability}.
55
	 * <p>
56
	 * &#8224; A resource with no symbolic name must not provide an identity
57
	 * capability.
58
	 */
59
	public static final String IDENTITY_NAMESPACE = "osgi.identity";
60
61
	/**
62
	 * An {@link #IDENTITY_NAMESPACE identity} capability attribute identifying the
63
	 * {@link Version version} of the resource.  This attribute must be set to a value of
64
	 * type {@link Version}.  If the resource has no version then the value 
65
	 * {@link Version#emptyVersion 0.0.0} must be used for the attribute.
66
	 */
67
	public static final String IDENTITY_VERSION_ATTRIBUTE = Constants.VERSION_ATTRIBUTE;
68
69
	/**
70
	 * An {@link #IDENTITY_NAMESPACE identity} capability attribute identifying the
71
	 * resource type.  This attribute must be set to a value of type {@link String}.
72
	 * if the resource has no type then the value 
73
	 * {@link ResourceConstants#IDENTITY_TYPE_UNKNOWN unknown} must be used for the
74
	 * attribute.
75
	 */
76
	public static final String IDENTITY_TYPE_ATTRIBUTE = "type";
77
78
	/**
79
	 * An {@link #IDENTITY_NAMESPACE identity} capability {@link #IDENTITY_TYPE_ATTRIBUTE type}
80
	 * attribute value identifying the resource type as an OSGi bundle.
81
	 */
82
	public static final String IDENTITY_TYPE_BUNDLE = "osgi.bundle";
83
84
	/**
85
	 * An {@link #IDENTITY_NAMESPACE identity} capability {@link #IDENTITY_TYPE_ATTRIBUTE type}
86
	 * attribute value identifying the resource type as an OSGi fragment.
87
	 */
88
	public static final String IDENTITY_TYPE_FRAGMENT = "osgi.fragment";
89
90
	/**
91
	 * An {@link #IDENTITY_NAMESPACE identity} capability {@link #IDENTITY_TYPE_ATTRIBUTE type}
92
	 * attribute value identifying the resource type as unknown.
93
	 */
94
	public static final String IDENTITY_TYPE_UNKNOWN = "unknown";
95
96
	/**
97
	 * An {@link #IDENTITY_NAMESPACE identity} capability {@link Requirement#getDirectives() directive}
98
	 * identifying if the resource is a singleton.  A {@link String} value of &quot;true&quot; indicates
99
	 * the resource is a singleton; any other value or <code>null</code> indicates the resource is not a 
100
	 * singleton.
101
	 */
102
	public static final String IDENTITY_SINGLETON_DIRECTIVE = Constants.SINGLETON_DIRECTIVE;
103
104
	/**
105
	 * Name space for package capabilities and requirements.
106
	 * 
107
	 * For capability attributes the following applies:
108
	 * <ul>
109
	 * <li>The
110
	 * <q>osgi.wiring.package</q> attribute contains the name of the package.
111
	 * <li>The {@link Constants#VERSION_ATTRIBUTE version} attribute contains
112
	 * the the {@link Version} of the package if one is specified or
113
	 * {@link Version#emptyVersion} if not specified.
114
	 * <li>The {@link Constants#BUNDLE_SYMBOLICNAME_ATTRIBUTE
115
	 * bundle-symbolic-name} attribute contains the symbolic name of the
116
	 * resource providing the package if one is specified.
117
	 * <li>The {@link Constants#BUNDLE_VERSION_ATTRIBUTE bundle-version}
118
	 * attribute contains the {@link Version} of resource providing the package
119
	 * if one is specified or {@link Version#emptyVersion} if not specified.
120
	 * <li>All other attributes are of type {@link String} and are used as
121
	 * arbitrary matching attributes for the capability.
122
	 * </ul>
123
	 * <p>
124
	 * A resource provides zero or more package
125
	 * {@link Resource#getCapabilities(String) capabilities} (this is, exported
126
	 * packages) and requires zero or more package
127
	 * {@link Resource#getRequirements(String) requirements} (that is, imported
128
	 * packages).
129
	 */
130
	public static final String WIRING_PACKAGE_NAMESPACE = "osgi.wiring.package";
131
132
	/**
133
	 * Name space for bundle capabilities and requirements.
134
	 * 
135
	 * For capability attributes the following applies:
136
	 * <ul>
137
	 * <li>The
138
	 * <q>osgi.wiring.bundle</q> attribute contains the symbolic name of the
139
	 * bundle.
140
	 * <li>The {@link Constants#BUNDLE_VERSION_ATTRIBUTE bundle-version}
141
	 * attribute contains the {@link Version} of the bundle if one is specified
142
	 * or {@link Version#emptyVersion} if not specified.
143
	 * <li>All other attributes are of type {@link String} and are used as
144
	 * arbitrary matching attributes for the capability.
145
	 * </ul>
146
	 * <p>
147
	 * A non-fragment resource with the {@link #IDENTITY_TYPE_BUNDLE
148
	 * osgi.bundle} type {@link #IDENTITY_TYPE_ATTRIBUTE identity} provides 
149
	 * exactly one <sup>&#8224;</sup> bundle
150
	 * {@link Resource#getCapabilities(String) capability} (that is, the bundle
151
	 * can be required by another bundle). A fragment resource with the 
152
	 * {@link #IDENTITY_TYPE_FRAGMENT osgi.fragment} type 
153
	 * {@link #IDENTITY_TYPE_ATTRIBUTE identity} must not declare
154
	 * a bundle capability. A resource requires zero or more bundle
155
	 * {@link Resource#getRequirements(String) requirements} (that is, required
156
	 * bundles).
157
	 * <p>
158
	 * &#8224; A resource with no symbolic name must not provide a bundle
159
	 * capability.
160
	 */
161
	public static final String WIRING_BUNDLE_NAMESPACE = "osgi.wiring.bundle";
162
163
	/**
164
	 * Name space for host capabilities and requirements.
165
	 * 
166
	 * For capability attributes the following applies:
167
	 * <ul>
168
	 * <li>The
169
	 * <q>osgi.wiring.host</q> attribute contains the symbolic name of the
170
	 * bundle.
171
	 * <li>The {@link Constants#BUNDLE_VERSION_ATTRIBUTE bundle-version}
172
	 * attribute contains the {@link Version} of the bundle if one is specified
173
	 * or {@link Version#emptyVersion} if not specified.
174
	 * <li>All other attributes are of type {@link String} and are used as
175
	 * arbitrary matching attributes for the capability.
176
	 * </ul>
177
	 * <p>
178
	 * <p>
179
	 * A non-fragment resource with the with the {@link #IDENTITY_TYPE_BUNDLE
180
	 * osgi.bundle} type {@link #IDENTITY_TYPE_ATTRIBUTE identity} provides 
181
	 * zero or one <sup>&#8224;</sup> host
182
	 * {@link Resource#getCapabilities(String) capabilities}. 
183
	 * A fragment resource with the 
184
	 * {@link #IDENTITY_TYPE_FRAGMENT osgi.fragment} type 
185
	 * {@link #IDENTITY_TYPE_ATTRIBUTE identity} must not declare
186
	 * a host capability and must 
187
	 * {@link Resource#getRequirements(String) declare} exactly one host
188
	 * requirement.
189
	 * <p>
190
	 * &#8224; A resource with no bundle symbolic name must not provide a host
191
	 * capability.
192
	 */
193
	public static final String WIRING_HOST_NAMESPACE = "osgi.wiring.host";
194
195
	/**
196
	 * A requirement {@link Requirement#getDirectives() directive} used to
197
	 * specify a capability filter. This filter is used to match against a
198
	 * capability's {@link Capability#getAttributes() attributes}.
199
	 */
200
	public final static String REQUIREMENT_FILTER_DIRECTIVE = Constants.FILTER_DIRECTIVE;
201
202
	/**
203
	 * A requirement {@link Requirement#getDirectives() directive} used to
204
	 * specify the resolution type for a requirement. The default value is
205
	 * {@link #REQUIREMENT_RESOLUTION_MANDATORY mandatory}.
206
	 * 
207
	 * @see #REQUIREMENT_RESOLUTION_MANDATORY mandatory
208
	 * @see #REQUIREMENT_RESOLUTION_OPTIONAL optional
209
	 */
210
	public final static String REQUIREMENT_RESOLUTION_DIRECTIVE = Constants.RESOLUTION_DIRECTIVE;
211
	/**
212
	 * A directive value identifying a mandatory
213
	 * {@link Resource#getRequirements(String) requirement} resolution type. A
214
	 * mandatory resolution type indicates that the requirement must be resolved
215
	 * when the {@link Resource resource} is resolved. If such requirement
216
	 * cannot be resolved, the resource fails to resolve.
217
	 * 
218
	 * @see #REQUIREMENT_RESOLUTION_DIRECTIVE
219
	 */
220
	public final static String REQUIREMENT_RESOLUTION_MANDATORY = Constants.RESOLUTION_MANDATORY;
221
222
	/**
223
	 * A directive value identifying an optional
224
	 * {@link Resource#getRequirements(String) requirement} resolution type. An
225
	 * optional resolution type indicates that the requirement is optional and
226
	 * the {@link Resource resource} may be resolved without requirement being
227
	 * resolved.
228
	 * 
229
	 * @see #REQUIREMENT_RESOLUTION_DIRECTIVE
230
	 */
231
	public final static String REQUIREMENT_RESOLUTION_OPTIONAL = Constants.RESOLUTION_OPTIONAL;
232
233
	/**
234
	 * A requirement {@link Requirement#getDirectives() directive} used to
235
	 * specify the effective time for the requirement. The default value is
236
	 * {@link #EFFECTIVE_RESOLVE resolve}.
237
	 * 
238
	 * @see #EFFECTIVE_RESOLVE resolve
239
	 * @see #EFFECTIVE_ACTIVE active
240
	 */
241
	public final static String REQUIREMENT_EFFECTIVE_DIRECTIVE = Constants.EFFECTIVE_DIRECTIVE;
242
243
	/**
244
	 * A directive value identifying a {@link #CAPABILITY_EFFECTIVE_DIRECTIVE
245
	 * capability} or {@link #REQUIREMENT_EFFECTIVE_DIRECTIVE requirement} that
246
	 * is effective at resolve time. Capabilities and requirements with an
247
	 * effective time of resolve are the only capabilities which are processed
248
	 * while resolving a resource.
249
	 * 
250
	 * @see #REQUIREMENT_EFFECTIVE_DIRECTIVE
251
	 * @see #CAPABILITY_EFFECTIVE_DIRECTIVE
252
	 */
253
	public final static String EFFECTIVE_RESOLVE = Constants.EFFECTIVE_RESOLVE;
254
255
	/**
256
	 * A directive value identifying a {@link #CAPABILITY_EFFECTIVE_DIRECTIVE
257
	 * capability} or {@link #REQUIREMENT_EFFECTIVE_DIRECTIVE requirement} that
258
	 * is effective at active time. Capabilities and requirements with an
259
	 * effective time of active are ignored while resolving a resource.
260
	 * 
261
	 * @see #REQUIREMENT_EFFECTIVE_DIRECTIVE
262
	 * @see #CAPABILITY_EFFECTIVE_DIRECTIVE
263
	 */
264
	public final static String EFFECTIVE_ACTIVE = Constants.EFFECTIVE_ACTIVE;
265
266
	/**
267
	 * A requirement {@link Requirement#getDirectives() directive} used to
268
	 * specify the visibility type for a requirement. The default value is
269
	 * {@link #REQUIREMENT_VISIBILITY_PRIVATE private}. This directive must only
270
	 * be used for requirements with the require
271
	 * {@link #WIRING_BUNDLE_NAMESPACE bundle} name space.
272
	 * 
273
	 * @see #REQUIREMENT_VISIBILITY_PRIVATE private
274
	 * @see #REQUIREMENT_VISIBILITY_REEXPORT reexport
275
	 */
276
	public final static String REQUIREMENT_VISIBILITY_DIRECTIVE = Constants.VISIBILITY_DIRECTIVE;
277
278
	/**
279
	 * A directive value identifying a private
280
	 * {@link #REQUIREMENT_VISIBILITY_DIRECTIVE visibility} type. A private
281
	 * visibility type indicates that any {@link #WIRING_PACKAGE_NAMESPACE
282
	 * packages} that are exported by the required
283
	 * {@link #WIRING_BUNDLE_NAMESPACE bundle} are not made visible on the
284
	 * export signature of the requiring {@link #WIRING_BUNDLE_NAMESPACE bundle}
285
	 * .
286
	 * 
287
	 * @see #REQUIREMENT_VISIBILITY_DIRECTIVE
288
	 */
289
	public final static String REQUIREMENT_VISIBILITY_PRIVATE = Constants.VISIBILITY_PRIVATE;
290
291
	/**
292
	 * A directive value identifying a reexport
293
	 * {@link #REQUIREMENT_VISIBILITY_DIRECTIVE visibility} type. A reexport
294
	 * visibility type indicates any {@link #WIRING_PACKAGE_NAMESPACE packages}
295
	 * that are exported by the required {@link #WIRING_BUNDLE_NAMESPACE bundle}
296
	 * are re-exported by the requiring {@link #WIRING_BUNDLE_NAMESPACE bundle}.
297
	 */
298
	public final static String REQUIREMENT_VISIBILITY_REEXPORT = Constants.VISIBILITY_REEXPORT;
299
300
	/**
301
	 * A requirement {@link Requirement#getDirectives() directive} used to
302
	 * specify the cardinality for a requirement. The default value is
303
	 * {@link #REQUIREMENT_CARDINALITY_SINGULAR singular}.
304
	 * 
305
	 * @see #REQUIREMENT_CARDINALITY_MULTIPLE multiple
306
	 * @see #REQUIREMENT_CARDINALITY_SINGULAR singular
307
	 */
308
	public final static String REQUIREMENT_CARDINALITY_DIRECTIVE = "cardinality";
309
310
	/**
311
	 * A directive value identifying a multiple
312
	 * {@link #REQUIREMENT_CARDINALITY_DIRECTIVE cardinality} type.
313
	 */
314
	public final static String REQUIREMENT_CARDINALITY_MULTIPLE = "multiple";
315
316
	/**
317
	 * A directive value identifying a singular
318
	 * {@link #REQUIREMENT_CARDINALITY_DIRECTIVE cardinality} type.
319
	 */
320
	public final static String REQUIREMENT_CARDINALITY_SINGULAR = "singular";
321
322
	/**
323
	 * A capability {@link Capability#getDirectives() directive} used to specify
324
	 * the comma separated list of {@link #WIRING_PACKAGE_NAMESPACE package}
325
	 * names a capability uses.
326
	 */
327
	public final static String CAPABILITY_USES_DIRECTIVE = Constants.USES_DIRECTIVE;
328
329
	/**
330
	 * A capability {@link Capability#getDirectives() directive} used to specify
331
	 * the effective time for the capability. The default value is
332
	 * {@link #EFFECTIVE_RESOLVE resolve}.
333
	 * 
334
	 * @see #EFFECTIVE_RESOLVE resolve
335
	 * @see #EFFECTIVE_ACTIVE active
336
	 */
337
	public final static String CAPABILITY_EFFECTIVE_DIRECTIVE = Constants.EFFECTIVE_DIRECTIVE;
338
339
	/**
340
	 * A capability {@link Capability#getDirectives() directive} used to specify
341
	 * the comma separated list of mandatory attributes which must be specified
342
	 * in the {@link #REQUIREMENT_FILTER_DIRECTIVE filter} of a requirement in
343
	 * order for the capability to match the requirement. This directive must
344
	 * only be used for capabilities with the {@link #WIRING_PACKAGE_NAMESPACE
345
	 * package} name space.
346
	 */
347
	public final static String CAPABILITY_MANDATORY_DIRECTIVE = "mandatory";
348
349
	/**
350
	 * A capability {@link Capability#getDirectives() directive} used to specify
351
	 * the comma separated list of classes which must be allowed to be exported.
352
	 * This directive must only be used for capabilities with the
353
	 * {@link #WIRING_PACKAGE_NAMESPACE package} name space.
354
	 */
355
	public final static String CAPABILITY_INCLUDE_DIRECTIVE = "include";
356
357
	/**
358
	 * A capability {@link Capability#getDirectives() directive} used to specify
359
	 * the comma separated list of classes which must not be allowed to be
360
	 * exported. This directive must only be used for capabilities with the
361
	 * {@link #WIRING_PACKAGE_NAMESPACE package} name space.
362
	 */
363
	public final static String CAPABILITY_EXCLUDE_DIRECTIVE = "exclude";
364
}
(-)osgi/src/org/osgi/framework/wiring/Wire.java (+57 lines)
Added Link Here
1
/*
2
 * Copyright (c) OSGi Alliance (2011). All Rights Reserved.
3
 * 
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *      http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16
17
package org.osgi.framework.wiring;
18
19
/**
20
 * A wire connecting a {@link Capability} to a {@link Requirement}.
21
 * 
22
 * @ThreadSafe
23
 * @version $Id: 328ede0f8ddf3795594a8e0fc2cb11bbe7fa38fc $
24
 */
25
public interface Wire {
26
	/**
27
	 * Returns the {@link Capability} for this wire.
28
	 * 
29
	 * @return The {@link Capability} for this wire.
30
	 */
31
	Capability getCapability();
32
33
	/**
34
	 * Return the {@link Requirement} for this wire.
35
	 * 
36
	 * @return The {@link Requirement} for this wire.
37
	 */
38
	Requirement getRequirement();
39
40
	/**
41
	 * Return the providing {@link Resource resource} of the {@link #getCapability() capability}.
42
	 * <p>
43
	 * The resource returned may differ from the resource referenced by the {@link #getCapability()
44
	 * capability}.
45
	 * @return the providing {@link Resource resource}.
46
	 */
47
	Resource getProvider();
48
49
	/**
50
	 * Return the requiring {@link Resource resource} of the {@link #getRequirement() requirement}.
51
	 * <p>
52
	 * The resource returned my differ from the resource referenced by the {@link #getRequirement()
53
	 * requirement}
54
	 * @return the requiring {@link Resource resource}.
55
	 */
56
	Resource getRequirer();
57
}
(-)resolver/src/org/eclipse/osgi/internal/module/ResolverImpl.java (-1 / +1 lines)
Lines 1333-1339 Link Here
1333
		if (namespace == null)
1333
		if (namespace == null)
1334
			capabilities = Collections.EMPTY_LIST;
1334
			capabilities = Collections.EMPTY_LIST;
1335
		else
1335
		else
1336
			capabilities = name == null || "*".equals(name) ? namespace.getAllValues() : namespace.get(name); //$NON-NLS-1$
1336
			capabilities = name == null || name.indexOf('*') >= 0 ? namespace.getAllValues() : namespace.get(name);
1337
		List<GenericCapability> candidates = new ArrayList<GenericCapability>(capabilities);
1337
		List<GenericCapability> candidates = new ArrayList<GenericCapability>(capabilities);
1338
		List<BundleCapability> genCapabilities = new ArrayList<BundleCapability>(candidates.size());
1338
		List<BundleCapability> genCapabilities = new ArrayList<BundleCapability>(candidates.size());
1339
		// Must remove candidates that do not match before calling hooks.
1339
		// Must remove candidates that do not match before calling hooks.
(-)resolver/src/org/eclipse/osgi/internal/resolver/BaseDescriptionImpl.java (+4 lines)
Lines 156-160 Link Here
156
		public String toString() {
156
		public String toString() {
157
			return getNamespace() + BaseDescriptionImpl.toString(getAttributes(), false) + BaseDescriptionImpl.toString(getDirectives(), true);
157
			return getNamespace() + BaseDescriptionImpl.toString(getAttributes(), false) + BaseDescriptionImpl.toString(getDirectives(), true);
158
		}
158
		}
159
160
		public BundleRevision getResource() {
161
			return getRevision();
162
		}
159
	}
163
	}
160
}
164
}
(-)resolver/src/org/eclipse/osgi/internal/resolver/BundleDescriptionImpl.java (+18 lines)
Lines 1031-1036 Link Here
1031
		public String toString() {
1031
		public String toString() {
1032
			return getRequirement() + " -> " + getCapability(); //$NON-NLS-1$
1032
			return getRequirement() + " -> " + getCapability(); //$NON-NLS-1$
1033
		}
1033
		}
1034
1035
		public BundleRevision getProvider() {
1036
			return getCapability().getRevision();
1037
		}
1038
1039
		public BundleRevision getRequirer() {
1040
			return getRequirement().getRevision();
1041
		}
1034
	}
1042
	}
1035
1043
1036
	// Note that description wiring are identity equality based
1044
	// Note that description wiring are identity equality based
Lines 1230-1233 Link Here
1230
			return BundleDescriptionImpl.this.toString();
1238
			return BundleDescriptionImpl.this.toString();
1231
		}
1239
		}
1232
	}
1240
	}
1241
1242
	@SuppressWarnings({"cast", "unchecked", "rawtypes"})
1243
	public List<Capability> getCapabilities(String namespace) {
1244
		return (List<Capability>) (List) getDeclaredCapabilities(namespace);
1245
	}
1246
1247
	@SuppressWarnings({"cast", "unchecked", "rawtypes"})
1248
	public List<Requirement> getRequirements(String namespace) {
1249
		return (List<Requirement>) (List) getDeclaredRequirements(namespace);
1250
	}
1233
}
1251
}
(-)resolver/src/org/eclipse/osgi/internal/resolver/StateBuilder.java (-5 / +41 lines)
Lines 19-24 Link Here
19
import org.eclipse.osgi.util.ManifestElement;
19
import org.eclipse.osgi.util.ManifestElement;
20
import org.eclipse.osgi.util.NLS;
20
import org.eclipse.osgi.util.NLS;
21
import org.osgi.framework.*;
21
import org.osgi.framework.*;
22
import org.osgi.framework.wiring.ResourceConstants;
22
23
23
/**
24
/**
24
 * This class builds bundle description objects from manifests
25
 * This class builds bundle description objects from manifests
Lines 118-124 Link Here
118
		result.setGenericRequires(createGenericRequires(genericRequires, osgiRequires));
119
		result.setGenericRequires(createGenericRequires(genericRequires, osgiRequires));
119
		ManifestElement[] genericCapabilities = getGenericCapabilities(manifest, genericAliases);
120
		ManifestElement[] genericCapabilities = getGenericCapabilities(manifest, genericAliases);
120
		ManifestElement[] osgiCapabilities = ManifestElement.parseHeader(Constants.PROVIDE_CAPABILITY, manifest.get(Constants.PROVIDE_CAPABILITY));
121
		ManifestElement[] osgiCapabilities = ManifestElement.parseHeader(Constants.PROVIDE_CAPABILITY, manifest.get(Constants.PROVIDE_CAPABILITY));
121
		result.setGenericCapabilities(createGenericCapabilities(genericCapabilities, osgiCapabilities));
122
		result.setGenericCapabilities(createGenericCapabilities(genericCapabilities, osgiCapabilities, result));
122
		ManifestElement[] nativeCode = ManifestElement.parseHeader(Constants.BUNDLE_NATIVECODE, manifest.get(Constants.BUNDLE_NATIVECODE));
123
		ManifestElement[] nativeCode = ManifestElement.parseHeader(Constants.BUNDLE_NATIVECODE, manifest.get(Constants.BUNDLE_NATIVECODE));
123
		result.setNativeCodeSpecification(createNativeCode(nativeCode));
124
		result.setNativeCodeSpecification(createNativeCode(nativeCode));
124
		return result;
125
		return result;
Lines 554-566 Link Here
554
		return results;
555
		return results;
555
	}
556
	}
556
557
557
	private static GenericDescription[] createGenericCapabilities(ManifestElement[] equinoxCapabilities, ManifestElement[] osgiCapabilities) {
558
	private static GenericDescription[] createGenericCapabilities(ManifestElement[] equinoxCapabilities, ManifestElement[] osgiCapabilities, BundleDescription description) throws BundleException {
558
		List<GenericDescription> result = createEquinoxCapabilities(equinoxCapabilities);
559
		List<GenericDescription> result = createEquinoxCapabilities(equinoxCapabilities);
559
		result = createOSGiCapabilities(osgiCapabilities, result);
560
		result = createOSGiCapabilities(osgiCapabilities, result, description);
560
		return result == null ? null : result.toArray(new GenericDescription[result.size()]);
561
		return result == null ? null : result.toArray(new GenericDescription[result.size()]);
561
	}
562
	}
562
563
563
	static List<GenericDescription> createOSGiCapabilities(ManifestElement[] osgiCapabilities, List<GenericDescription> result) {
564
	private static List<GenericDescription> createOSGiCapabilities(ManifestElement[] osgiCapabilities, List<GenericDescription> result, BundleDescription description) throws BundleException {
565
		if (result == null)
566
			result = new ArrayList<GenericDescription>(osgiCapabilities == null ? 1 : osgiCapabilities.length + 1);
567
		// Always have an osgi.identity capability if there is a symbolic name.
568
		GenericDescription osgiIdentity = createOsgiIdentityCapability(description);
569
		if (osgiIdentity != null)
570
			// always add the capability to the front
571
			result.add(0, osgiIdentity);
572
		return createOSGiCapabilities(osgiCapabilities, result);
573
	}
574
575
	static List<GenericDescription> createOSGiCapabilities(ManifestElement[] osgiCapabilities, List<GenericDescription> result) throws BundleException {
564
		if (osgiCapabilities == null)
576
		if (osgiCapabilities == null)
565
			return result;
577
			return result;
566
		if (result == null)
578
		if (result == null)
Lines 570-577 Link Here
570
			String[] namespaces = element.getValueComponents();
582
			String[] namespaces = element.getValueComponents();
571
			types: for (String namespace : namespaces) {
583
			types: for (String namespace : namespaces) {
572
				String effective = element.getDirective(Constants.EFFECTIVE_DIRECTIVE);
584
				String effective = element.getDirective(Constants.EFFECTIVE_DIRECTIVE);
585
				// Any declared osgi.identity capability with an effective directive value of "resolve" will be overridden.
573
				if (effective != null && !Constants.EFFECTIVE_RESOLVE.equals(effective))
586
				if (effective != null && !Constants.EFFECTIVE_RESOLVE.equals(effective))
574
					break types; // ignore any namespace that is not effective at resolve time.
587
					break types; // ignore any namespace that is not effective at resolve time.
588
				if (ResourceConstants.IDENTITY_NAMESPACE.equals(namespace))
589
					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$
590
575
				GenericDescriptionImpl desc = new GenericDescriptionImpl();
591
				GenericDescriptionImpl desc = new GenericDescriptionImpl();
576
				desc.setType(namespace);
592
				desc.setType(namespace);
577
				Map<String, Object> mapAttrs = getAttributes(element, new String[0]);
593
				Map<String, Object> mapAttrs = getAttributes(element, new String[0]);
Lines 591-597 Link Here
591
		return result;
607
		return result;
592
	}
608
	}
593
609
594
	private static List<GenericDescription> createEquinoxCapabilities(ManifestElement[] equinoxCapabilities) {
610
	private static List<GenericDescription> createEquinoxCapabilities(ManifestElement[] equinoxCapabilities) throws BundleException {
595
		if (equinoxCapabilities == null)
611
		if (equinoxCapabilities == null)
596
			return null;
612
			return null;
597
		ArrayList<GenericDescription> results = new ArrayList<GenericDescription>(equinoxCapabilities.length);
613
		ArrayList<GenericDescription> results = new ArrayList<GenericDescription>(equinoxCapabilities.length);
Lines 604-609 Link Here
604
				if (colonIdx > 0) {
620
				if (colonIdx > 0) {
605
					name = genericNames[j].substring(0, colonIdx);
621
					name = genericNames[j].substring(0, colonIdx);
606
					desc.setType(genericNames[j].substring(colonIdx + 1));
622
					desc.setType(genericNames[j].substring(colonIdx + 1));
623
					if (ResourceConstants.IDENTITY_NAMESPACE.equals(desc.getType()))
624
						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$
607
				}
625
				}
608
				Map<String, Object> mapAttrs = getAttributes(equinoxCapabilities[i], new String[] {Constants.VERSION_ATTRIBUTE});
626
				Map<String, Object> mapAttrs = getAttributes(equinoxCapabilities[i], new String[] {Constants.VERSION_ATTRIBUTE});
609
				Dictionary<String, Object> attrs = mapAttrs == null ? new Hashtable<String, Object>() : new Hashtable<String, Object>(mapAttrs);
627
				Dictionary<String, Object> attrs = mapAttrs == null ? new Hashtable<String, Object>() : new Hashtable<String, Object>(mapAttrs);
Lines 748-751 Link Here
748
			throw new BundleException(message + " : " + NLS.bind(StateMsg.HEADER_EXTENSION_ERROR, hostName), BundleException.MANIFEST_ERROR); //$NON-NLS-1$
766
			throw new BundleException(message + " : " + NLS.bind(StateMsg.HEADER_EXTENSION_ERROR, hostName), BundleException.MANIFEST_ERROR); //$NON-NLS-1$
749
		}
767
		}
750
	}
768
	}
769
770
	private static GenericDescription createOsgiIdentityCapability(BundleDescription description) {
771
		if (description.getSymbolicName() == null)
772
			return null;
773
		GenericDescriptionImpl result = new GenericDescriptionImpl();
774
		result.setType(ResourceConstants.IDENTITY_NAMESPACE);
775
		Dictionary<String, Object> attributes = new Hashtable<String, Object>();
776
		attributes.put(ResourceConstants.IDENTITY_NAMESPACE, description.getSymbolicName());
777
		attributes.put(ResourceConstants.IDENTITY_TYPE_ATTRIBUTE, description.getHost() == null ? ResourceConstants.IDENTITY_TYPE_BUNDLE : ResourceConstants.IDENTITY_TYPE_FRAGMENT);
778
		attributes.put(ResourceConstants.IDENTITY_VERSION_ATTRIBUTE, description.getVersion());
779
		result.setAttributes(attributes);
780
		Map<String, String> directives = new HashMap<String, String>();
781
		directives.put(ResourceConstants.IDENTITY_SINGLETON_DIRECTIVE, String.valueOf(description.isSingleton()));
782
		// The effective directive should be resolve
783
		directives.put(ResourceConstants.CAPABILITY_EFFECTIVE_DIRECTIVE, ResourceConstants.EFFECTIVE_RESOLVE);
784
		result.setDirectives(directives);
785
		return result;
786
	}
751
}
787
}
(-)resolver/src/org/eclipse/osgi/internal/resolver/StateImpl.java (-1 / +5 lines)
Lines 871-877 Link Here
871
	}
871
	}
872
872
873
	private void addSystemCapabilities(List<GenericDescription> capabilities, ManifestElement[] elements) {
873
	private void addSystemCapabilities(List<GenericDescription> capabilities, ManifestElement[] elements) {
874
		StateBuilder.createOSGiCapabilities(elements, capabilities);
874
		try {
875
			StateBuilder.createOSGiCapabilities(elements, capabilities);
876
		} catch (BundleException e) {
877
			throw new RuntimeException("Unexpected exception adding system capabilities.", e); //$NON-NLS-1$
878
		}
875
	}
879
	}
876
880
877
	@SuppressWarnings("rawtypes")
881
	@SuppressWarnings("rawtypes")
(-)resolver/src/org/eclipse/osgi/internal/resolver/VersionConstraintImpl.java (+10 lines)
Lines 156-161 Link Here
156
		public String toString() {
156
		public String toString() {
157
			return getNamespace() + BaseDescriptionImpl.toString(getAttributes(), false) + BaseDescriptionImpl.toString(getDirectives(), true);
157
			return getNamespace() + BaseDescriptionImpl.toString(getAttributes(), false) + BaseDescriptionImpl.toString(getDirectives(), true);
158
		}
158
		}
159
160
		public boolean matches(Capability capability) {
161
			if (!(capability instanceof BundleCapability))
162
				return false;
163
			return matches((BundleCapability) capability);
164
		}
165
166
		public BundleRevision getResource() {
167
			return getRevision();
168
		}
159
	}
169
	}
160
170
161
	static StringBuffer addFilterAttributes(StringBuffer filter, Map<String, ?> attributes) {
171
	static StringBuffer addFilterAttributes(StringBuffer filter, Map<String, ?> attributes) {
(-)src/org/eclipse/osgi/tests/services/resolver/GenericCapabilityTest.java (-42 / +74 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2003, 2010 IBM Corporation and others.
2
 * Copyright (c) 2003, 2011 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 10-17 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.osgi.tests.services.resolver;
11
package org.eclipse.osgi.tests.services.resolver;
12
12
13
import java.util.Dictionary;
13
import java.util.*;
14
import java.util.Hashtable;
15
import junit.framework.Test;
14
import junit.framework.Test;
16
import junit.framework.TestSuite;
15
import junit.framework.TestSuite;
17
import org.eclipse.osgi.service.resolver.*;
16
import org.eclipse.osgi.service.resolver.*;
Lines 19-26 Link Here
19
import org.osgi.framework.Constants;
18
import org.osgi.framework.Constants;
20
19
21
public class GenericCapabilityTest extends AbstractStateTest {
20
public class GenericCapabilityTest extends AbstractStateTest {
22
	private static final String GENERIC_REQUIRE = "Eclipse-GenericRequire"; //$NON-NLS-1$
21
	static final String GENERIC_REQUIRE = "Eclipse-GenericRequire"; //$NON-NLS-1$
23
	private static final String GENERIC_CAPABILITY = "Eclipse-GenericCapability"; //$NON-NLS-1$
22
	static final String GENERIC_CAPABILITY = "Eclipse-GenericCapability"; //$NON-NLS-1$
24
23
25
	public static Test suite() {
24
	public static Test suite() {
26
		return new TestSuite(GenericCapabilityTest.class);
25
		return new TestSuite(GenericCapabilityTest.class);
Lines 35-41 Link Here
35
		Hashtable manifest = new Hashtable();
34
		Hashtable manifest = new Hashtable();
36
		long bundleID = 0;
35
		long bundleID = 0;
37
		manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2");
36
		manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2");
38
		manifest.put(Constants.BUNDLE_SYMBOLICNAME, "genericCapablity");
37
		manifest.put(Constants.BUNDLE_SYMBOLICNAME, "genericCapability");
39
		manifest.put(Constants.BUNDLE_VERSION, "1.0.0");
38
		manifest.put(Constants.BUNDLE_VERSION, "1.0.0");
40
		StringBuffer capabililty = new StringBuffer();
39
		StringBuffer capabililty = new StringBuffer();
41
		capabililty.append("foo; version=\"1.3.1\"; attr1=\"value1\"; attr2=\"value2\",");
40
		capabililty.append("foo; version=\"1.3.1\"; attr1=\"value1\"; attr2=\"value2\",");
Lines 55-60 Link Here
55
		manifest.put(Constants.BUNDLE_SYMBOLICNAME, "genericRequire");
54
		manifest.put(Constants.BUNDLE_SYMBOLICNAME, "genericRequire");
56
		manifest.put(Constants.BUNDLE_VERSION, "1.0.0");
55
		manifest.put(Constants.BUNDLE_VERSION, "1.0.0");
57
		StringBuffer required = new StringBuffer();
56
		StringBuffer required = new StringBuffer();
57
		required.append("genericCapability:osgi.identity; selection-filter=\"(version=1.0)\",");
58
		required.append("foo; selection-filter=\"(version>=1.3.0)\",");
58
		required.append("foo; selection-filter=\"(version>=1.3.0)\",");
59
		required.append("bar:bartype; selection-filter=\"(attr1=value1)\",");
59
		required.append("bar:bartype; selection-filter=\"(attr1=value1)\",");
60
		required.append("test.types:testtype; selection-filter=\"(&(aVersion>=2.0.0)(aLong>=5555)(aDouble>=1.00)(aUri=file:/test)(aSet=c)(aString=someString))\"");
60
		required.append("test.types:testtype; selection-filter=\"(&(aVersion>=2.0.0)(aLong>=5555)(aDouble>=1.00)(aUri=file:/test)(aSet=c)(aString=someString))\"");
Lines 68-80 Link Here
68
		assertTrue("1.0", genCap.isResolved());
68
		assertTrue("1.0", genCap.isResolved());
69
		assertTrue("1.1", genReq.isResolved());
69
		assertTrue("1.1", genReq.isResolved());
70
		GenericSpecification[] genSpecs = genReq.getGenericRequires();
70
		GenericSpecification[] genSpecs = genReq.getGenericRequires();
71
		assertTrue("2.0", genSpecs.length == 3);
71
		assertTrue("2.0", genSpecs.length == 4);
72
		assertTrue("2.1", genSpecs[0].isResolved());
72
		assertTrue("2.1", genSpecs[0].isResolved());
73
		assertEquals("2.1.1", genSpecs[0].getSupplier(), genCap.getGenericCapabilities()[0]);
73
		assertEquals("2.1.1", genSpecs[0].getSupplier(), genCap.getGenericCapabilities()[0]);
74
		assertTrue("2.2", genSpecs[1].isResolved());
74
		assertTrue("2.2", genSpecs[1].isResolved());
75
		assertEquals("2.2.1", genSpecs[1].getSupplier(), genCap.getGenericCapabilities()[1]);
75
		assertEquals("2.2.1", genSpecs[1].getSupplier(), genCap.getGenericCapabilities()[1]);
76
		assertTrue("2.3", genSpecs[2].isResolved());
76
		assertTrue("2.3", genSpecs[2].isResolved());
77
		assertEquals("2.3.1", genSpecs[2].getSupplier(), genCap.getGenericCapabilities()[2]);
77
		assertEquals("2.3.1", genSpecs[2].getSupplier(), genCap.getGenericCapabilities()[2]);
78
		assertTrue("2.4", genSpecs[3].isResolved());
79
		assertEquals("2.4.1", genSpecs[3].getSupplier(), genCap.getGenericCapabilities()[3]);
78
	}
80
	}
79
81
80
	public void testGenericsUpdate() throws BundleException {
82
	public void testGenericsUpdate() throws BundleException {
Lines 82-88 Link Here
82
		Hashtable manifest = new Hashtable();
84
		Hashtable manifest = new Hashtable();
83
		long bundleID = 0;
85
		long bundleID = 0;
84
		manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2");
86
		manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2");
85
		manifest.put(Constants.BUNDLE_SYMBOLICNAME, "genericCapablity");
87
		manifest.put(Constants.BUNDLE_SYMBOLICNAME, "genericCapability");
86
		manifest.put(Constants.BUNDLE_VERSION, "1.0.0");
88
		manifest.put(Constants.BUNDLE_VERSION, "1.0.0");
87
		StringBuffer capabililty = new StringBuffer();
89
		StringBuffer capabililty = new StringBuffer();
88
		capabililty.append("foo; version=\"1.3.1\"; attr1=\"value1\"; attr2=\"value2\",");
90
		capabililty.append("foo; version=\"1.3.1\"; attr1=\"value1\"; attr2=\"value2\",");
Lines 102-107 Link Here
102
		manifest.put(Constants.BUNDLE_SYMBOLICNAME, "genericRequire");
104
		manifest.put(Constants.BUNDLE_SYMBOLICNAME, "genericRequire");
103
		manifest.put(Constants.BUNDLE_VERSION, "1.0.0");
105
		manifest.put(Constants.BUNDLE_VERSION, "1.0.0");
104
		StringBuffer required = new StringBuffer();
106
		StringBuffer required = new StringBuffer();
107
		required.append("genericCapability:osgi.identity; selection-filter=\"(version>=1.0)\",");
105
		required.append("foo; selection-filter=\"(version>=1.3.0)\",");
108
		required.append("foo; selection-filter=\"(version>=1.3.0)\",");
106
		required.append("bar:bartype; selection-filter=\"(attr1=value1)\",");
109
		required.append("bar:bartype; selection-filter=\"(attr1=value1)\",");
107
		required.append("test.types:testtype; selection-filter=\"(&(aVersion>=2.0.0)(aLong>=5555)(aDouble>=1.00)(aUri=file:/test)(aSet=c)(aString=someString))\"");
110
		required.append("test.types:testtype; selection-filter=\"(&(aVersion>=2.0.0)(aLong>=5555)(aDouble>=1.00)(aUri=file:/test)(aSet=c)(aString=someString))\"");
Lines 115-131 Link Here
115
		assertTrue("1.0", genCap.isResolved());
118
		assertTrue("1.0", genCap.isResolved());
116
		assertTrue("1.1", genReq.isResolved());
119
		assertTrue("1.1", genReq.isResolved());
117
		GenericSpecification[] genSpecs = genReq.getGenericRequires();
120
		GenericSpecification[] genSpecs = genReq.getGenericRequires();
118
		assertTrue("2.0", genSpecs.length == 3);
121
		assertTrue("2.0", genSpecs.length == 4);
119
		assertTrue("2.1", genSpecs[0].isResolved());
122
		assertTrue("2.1", genSpecs[0].isResolved());
120
		assertEquals("2.1.1", genSpecs[0].getSupplier(), genCap.getGenericCapabilities()[0]);
123
		assertEquals("2.1.1", genSpecs[0].getSupplier(), genCap.getGenericCapabilities()[0]);
121
		assertTrue("2.2", genSpecs[1].isResolved());
124
		assertTrue("2.2", genSpecs[1].isResolved());
122
		assertEquals("2.2.1", genSpecs[1].getSupplier(), genCap.getGenericCapabilities()[1]);
125
		assertEquals("2.2.1", genSpecs[1].getSupplier(), genCap.getGenericCapabilities()[1]);
123
		assertTrue("2.3", genSpecs[2].isResolved());
126
		assertTrue("2.3", genSpecs[2].isResolved());
124
		assertEquals("2.3.1", genSpecs[2].getSupplier(), genCap.getGenericCapabilities()[2]);
127
		assertEquals("2.3.1", genSpecs[2].getSupplier(), genCap.getGenericCapabilities()[2]);
128
		assertTrue("2.4", genSpecs[3].isResolved());
129
		assertEquals("2.4.1", genSpecs[3].getSupplier(), genCap.getGenericCapabilities()[3]);
125
130
126
		manifest.clear();
131
		manifest.clear();
127
		manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2");
132
		manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2");
128
		manifest.put(Constants.BUNDLE_SYMBOLICNAME, "genericCapablity");
133
		manifest.put(Constants.BUNDLE_SYMBOLICNAME, "genericCapability");
129
		manifest.put(Constants.BUNDLE_VERSION, "2.0.0");
134
		manifest.put(Constants.BUNDLE_VERSION, "2.0.0");
130
		capabililty = new StringBuffer();
135
		capabililty = new StringBuffer();
131
		capabililty.append("foo; version=\"1.3.2\"; attr1=\"value1\"; attr2=\"value2\",");
136
		capabililty.append("foo; version=\"1.3.2\"; attr1=\"value1\"; attr2=\"value2\",");
Lines 146-158 Link Here
146
		assertTrue("3.0", genCap2.isResolved());
151
		assertTrue("3.0", genCap2.isResolved());
147
		assertTrue("3.1", genReq.isResolved());
152
		assertTrue("3.1", genReq.isResolved());
148
		genSpecs = genReq.getGenericRequires();
153
		genSpecs = genReq.getGenericRequires();
149
		assertTrue("4.0", genSpecs.length == 3);
154
		assertTrue("4.0", genSpecs.length == 4);
150
		assertTrue("4.1", genSpecs[0].isResolved());
155
		assertTrue("4.1", genSpecs[0].isResolved());
151
		assertEquals("4.1.1", genSpecs[0].getSupplier(), genCap2.getGenericCapabilities()[0]);
156
		assertEquals("4.1.1", genSpecs[0].getSupplier(), genCap2.getGenericCapabilities()[0]);
152
		assertTrue("4.2", genSpecs[1].isResolved());
157
		assertTrue("4.2", genSpecs[1].isResolved());
153
		assertEquals("4.2.1", genSpecs[1].getSupplier(), genCap2.getGenericCapabilities()[1]);
158
		assertEquals("4.2.1", genSpecs[1].getSupplier(), genCap2.getGenericCapabilities()[1]);
154
		assertTrue("4.3", genSpecs[2].isResolved());
159
		assertTrue("4.3", genSpecs[2].isResolved());
155
		assertEquals("4.3.1", genSpecs[2].getSupplier(), genCap2.getGenericCapabilities()[2]);
160
		assertEquals("4.3.1", genSpecs[2].getSupplier(), genCap2.getGenericCapabilities()[2]);
161
		assertTrue("4.4", genSpecs[3].isResolved());
162
		assertEquals("4.4.1", genSpecs[3].getSupplier(), genCap2.getGenericCapabilities()[3]);
156
163
157
	}
164
	}
158
165
Lines 161-167 Link Here
161
		Hashtable manifest = new Hashtable();
168
		Hashtable manifest = new Hashtable();
162
		long bundleID = 0;
169
		long bundleID = 0;
163
		manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2");
170
		manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2");
164
		manifest.put(Constants.BUNDLE_SYMBOLICNAME, "genericCapablity");
171
		manifest.put(Constants.BUNDLE_SYMBOLICNAME, "genericCapability");
165
		manifest.put(Constants.BUNDLE_VERSION, "1.0.0");
172
		manifest.put(Constants.BUNDLE_VERSION, "1.0.0");
166
		StringBuffer capabililty = new StringBuffer();
173
		StringBuffer capabililty = new StringBuffer();
167
		capabililty.append("foo; version=\"1.3.1\"; attr1=\"value1\"; attr2=\"value2\",");
174
		capabililty.append("foo; version=\"1.3.1\"; attr1=\"value1\"; attr2=\"value2\",");
Lines 181-186 Link Here
181
		manifest.put(Constants.BUNDLE_SYMBOLICNAME, "genericRequire");
188
		manifest.put(Constants.BUNDLE_SYMBOLICNAME, "genericRequire");
182
		manifest.put(Constants.BUNDLE_VERSION, "1.0.0");
189
		manifest.put(Constants.BUNDLE_VERSION, "1.0.0");
183
		StringBuffer required = new StringBuffer();
190
		StringBuffer required = new StringBuffer();
191
		required.append("genericCapability:osgi.identity; selection-filter=\"(version>=1.0)\",");
184
		required.append("foo; selection-filter=\"(version>=1.3.0)\",");
192
		required.append("foo; selection-filter=\"(version>=1.3.0)\",");
185
		required.append("bar:bartype; selection-filter=\"(attr1=value1)\",");
193
		required.append("bar:bartype; selection-filter=\"(attr1=value1)\",");
186
		required.append("test.types:testtype; selection-filter=\"(&(aVersion>=2.0.0)(aLong>=5555)(aDouble>=1.00)(aUri=file:/test)(aSet=c)(aString=someString))\"");
194
		required.append("test.types:testtype; selection-filter=\"(&(aVersion>=2.0.0)(aLong>=5555)(aDouble>=1.00)(aUri=file:/test)(aSet=c)(aString=someString))\"");
Lines 194-219 Link Here
194
		assertTrue("1.0", genCap.isResolved());
202
		assertTrue("1.0", genCap.isResolved());
195
		assertTrue("1.1", genReq.isResolved());
203
		assertTrue("1.1", genReq.isResolved());
196
		GenericSpecification[] genSpecs = genReq.getGenericRequires();
204
		GenericSpecification[] genSpecs = genReq.getGenericRequires();
197
		assertTrue("2.0", genSpecs.length == 3);
205
		assertTrue("2.0", genSpecs.length == 4);
198
		assertTrue("2.1", genSpecs[0].isResolved());
206
		assertTrue("2.1", genSpecs[0].isResolved());
199
		assertEquals("2.1.1", genSpecs[0].getSupplier(), genCap.getGenericCapabilities()[0]);
207
		assertEquals("2.1.1", genSpecs[0].getSupplier(), genCap.getGenericCapabilities()[0]);
200
		assertTrue("2.2", genSpecs[1].isResolved());
208
		assertTrue("2.2", genSpecs[1].isResolved());
201
		assertEquals("2.2.1", genSpecs[1].getSupplier(), genCap.getGenericCapabilities()[1]);
209
		assertEquals("2.2.1", genSpecs[1].getSupplier(), genCap.getGenericCapabilities()[1]);
202
		assertTrue("2.3", genSpecs[2].isResolved());
210
		assertTrue("2.3", genSpecs[2].isResolved());
203
		assertEquals("2.3.1", genSpecs[2].getSupplier(), genCap.getGenericCapabilities()[2]);
211
		assertEquals("2.3.1", genSpecs[2].getSupplier(), genCap.getGenericCapabilities()[2]);
212
		assertTrue("2.4", genSpecs[3].isResolved());
213
		assertEquals("2.4.1", genSpecs[3].getSupplier(), genCap.getGenericCapabilities()[3]);
204
214
205
		state.resolve(new BundleDescription[] {genCap});
215
		state.resolve(new BundleDescription[] {genCap});
206
216
207
		assertTrue("3.0", genCap.isResolved());
217
		assertTrue("3.0", genCap.isResolved());
208
		assertTrue("3.1", genReq.isResolved());
218
		assertTrue("3.1", genReq.isResolved());
209
		genSpecs = genReq.getGenericRequires();
219
		genSpecs = genReq.getGenericRequires();
210
		assertTrue("4.0", genSpecs.length == 3);
220
		assertTrue("4.0", genSpecs.length == 4);
211
		assertTrue("4.1", genSpecs[0].isResolved());
221
		assertTrue("4.1", genSpecs[0].isResolved());
212
		assertEquals("4.1.1", genSpecs[0].getSupplier(), genCap.getGenericCapabilities()[0]);
222
		assertEquals("4.1.1", genSpecs[0].getSupplier(), genCap.getGenericCapabilities()[0]);
213
		assertTrue("4.2", genSpecs[1].isResolved());
223
		assertTrue("4.2", genSpecs[1].isResolved());
214
		assertEquals("4.2.1", genSpecs[1].getSupplier(), genCap.getGenericCapabilities()[1]);
224
		assertEquals("4.2.1", genSpecs[1].getSupplier(), genCap.getGenericCapabilities()[1]);
215
		assertTrue("4.3", genSpecs[2].isResolved());
225
		assertTrue("4.3", genSpecs[2].isResolved());
216
		assertEquals("4.3.1", genSpecs[2].getSupplier(), genCap.getGenericCapabilities()[2]);
226
		assertEquals("4.3.1", genSpecs[2].getSupplier(), genCap.getGenericCapabilities()[2]);
227
		assertTrue("4.4", genSpecs[3].isResolved());
228
		assertEquals("4.4.1", genSpecs[3].getSupplier(), genCap.getGenericCapabilities()[3]);
217
229
218
	}
230
	}
219
231
Lines 223-229 Link Here
223
		long bundleID = 0;
235
		long bundleID = 0;
224
236
225
		manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2");
237
		manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2");
226
		manifest.put(Constants.BUNDLE_SYMBOLICNAME, "genericCapablity");
238
		manifest.put(Constants.BUNDLE_SYMBOLICNAME, "genericCapability");
227
		manifest.put(Constants.BUNDLE_VERSION, "1.0.0");
239
		manifest.put(Constants.BUNDLE_VERSION, "1.0.0");
228
		StringBuffer capabililty = new StringBuffer();
240
		StringBuffer capabililty = new StringBuffer();
229
		capabililty.append("foo; version=\"1.3.1\"; attr1=\"value1\"; attr2=\"value2\",");
241
		capabililty.append("foo; version=\"1.3.1\"; attr1=\"value1\"; attr2=\"value2\",");
Lines 241-247 Link Here
241
		manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2");
253
		manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2");
242
		manifest.put(Constants.BUNDLE_SYMBOLICNAME, "genericCapability.frag1");
254
		manifest.put(Constants.BUNDLE_SYMBOLICNAME, "genericCapability.frag1");
243
		manifest.put(Constants.BUNDLE_VERSION, "1.0.0");
255
		manifest.put(Constants.BUNDLE_VERSION, "1.0.0");
244
		manifest.put(Constants.FRAGMENT_HOST, "genericCapablity;bundle-version=\"[1.0.0,2.0.0)\"");
256
		manifest.put(Constants.FRAGMENT_HOST, "genericCapability;bundle-version=\"[1.0.0,2.0.0)\"");
245
		capabililty = new StringBuffer();
257
		capabililty = new StringBuffer();
246
		capabililty.append("fragmentStuff");
258
		capabililty.append("fragmentStuff");
247
		manifest.put(GENERIC_CAPABILITY, capabililty.toString());
259
		manifest.put(GENERIC_CAPABILITY, capabililty.toString());
Lines 252-260 Link Here
252
		manifest.put(Constants.BUNDLE_SYMBOLICNAME, "genericRequire");
264
		manifest.put(Constants.BUNDLE_SYMBOLICNAME, "genericRequire");
253
		manifest.put(Constants.BUNDLE_VERSION, "1.0.0");
265
		manifest.put(Constants.BUNDLE_VERSION, "1.0.0");
254
		StringBuffer required = new StringBuffer();
266
		StringBuffer required = new StringBuffer();
267
		required.append("genericCapability:osgi.identity; selection-filter=\"(&(version=1.0.0)(type=osgi.bundle))\",");
255
		required.append("foo; selection-filter=\"(version>=1.3.0)\",");
268
		required.append("foo; selection-filter=\"(version>=1.3.0)\",");
256
		required.append("bar:bartype; selection-filter=\"(attr1=value1)\",");
269
		required.append("bar:bartype; selection-filter=\"(attr1=value1)\",");
257
		required.append("test.types:testtype; selection-filter=\"(&(aVersion>=2.0.0)(aLong>=5555)(aDouble>=1.00)(aUri=file:/test)(aSet=c)(aString=someString))\",");
270
		required.append("test.types:testtype; selection-filter=\"(&(aVersion>=2.0.0)(aLong>=5555)(aDouble>=1.00)(aUri=file:/test)(aSet=c)(aString=someString))\",");
271
		required.append("genericCapability.frag1:osgi.identity; selection-filter=\"(&(version=1.0.0)(type=osgi.fragment))\",");
258
		required.append("fragmentStuff");
272
		required.append("fragmentStuff");
259
		manifest.put(GENERIC_REQUIRE, required.toString());
273
		manifest.put(GENERIC_REQUIRE, required.toString());
260
		BundleDescription genReq = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++);
274
		BundleDescription genReq = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++);
Lines 269-276 Link Here
269
		assertTrue("1.2", genCapFrag.isResolved());
283
		assertTrue("1.2", genCapFrag.isResolved());
270
		GenericSpecification[] genSpecs = genReq.getGenericRequires();
284
		GenericSpecification[] genSpecs = genReq.getGenericRequires();
271
		GenericDescription[] selectedCapabilities = genCap.getSelectedGenericCapabilities();
285
		GenericDescription[] selectedCapabilities = genCap.getSelectedGenericCapabilities();
272
		assertTrue("2.0", genSpecs.length == 4);
286
		assertTrue("2.0", genSpecs.length == 6);
273
		assertEquals("Wrong number of selected capabilities", 4, selectedCapabilities.length);
287
		assertEquals("Wrong number of selected capabilities", 6, selectedCapabilities.length);
274
		assertTrue("2.1", genSpecs[0].isResolved());
288
		assertTrue("2.1", genSpecs[0].isResolved());
275
		assertEquals("2.1.1", genSpecs[0].getSupplier(), selectedCapabilities[0]);
289
		assertEquals("2.1.1", genSpecs[0].getSupplier(), selectedCapabilities[0]);
276
		assertTrue("2.2", genSpecs[1].isResolved());
290
		assertTrue("2.2", genSpecs[1].isResolved());
Lines 279-284 Link Here
279
		assertEquals("2.3.1", genSpecs[2].getSupplier(), selectedCapabilities[2]);
293
		assertEquals("2.3.1", genSpecs[2].getSupplier(), selectedCapabilities[2]);
280
		assertTrue("2.4", genSpecs[3].isResolved());
294
		assertTrue("2.4", genSpecs[3].isResolved());
281
		assertEquals("2.4.1", genSpecs[3].getSupplier(), selectedCapabilities[3]);
295
		assertEquals("2.4.1", genSpecs[3].getSupplier(), selectedCapabilities[3]);
296
		assertTrue("2.5", genSpecs[4].isResolved());
297
		assertEquals("2.5.1", genSpecs[4].getSupplier(), selectedCapabilities[4]);
298
		assertTrue("2.6", genSpecs[5].isResolved());
299
		assertEquals("2.6.1", genSpecs[5].getSupplier(), selectedCapabilities[5]);
282
	}
300
	}
283
301
284
	public void testGenericsIntraFrags() throws BundleException {
302
	public void testGenericsIntraFrags() throws BundleException {
Lines 304-310 Link Here
304
		manifest.put(Constants.BUNDLE_SYMBOLICNAME, "org.eclipse.equinox.generic.frag.b");
322
		manifest.put(Constants.BUNDLE_SYMBOLICNAME, "org.eclipse.equinox.generic.frag.b");
305
		manifest.put(Constants.BUNDLE_VERSION, "1.0.0");
323
		manifest.put(Constants.BUNDLE_VERSION, "1.0.0");
306
		manifest.put(Constants.FRAGMENT_HOST, "org.eclipse.equinox.generic.host;bundle-version=\"1.0.0\"");
324
		manifest.put(Constants.FRAGMENT_HOST, "org.eclipse.equinox.generic.host;bundle-version=\"1.0.0\"");
307
		manifest.put("Eclipse-GenericRequire", "frag.a");
325
		StringBuffer required = new StringBuffer();
326
		required.append("org.eclipse.equinox.generic.host:osgi.identity; selection-filter=\"(&(version=1.0.0)(type=osgi.bundle))\",");
327
		required.append("frag.a,");
328
		required.append("org.eclipse.equinox.generic.frag.a:osgi.identity; selection-filter=\"(&(version=1.0.0)(type=osgi.fragment))\",");
329
		required.append("org.eclipse.equinox.generic.frag.b:osgi.identity; selection-filter=\"(&(version=1.0.0)(type=osgi.fragment))\"");
330
		manifest.put(GENERIC_REQUIRE, required.toString());
308
		BundleDescription genFragB = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++);
331
		BundleDescription genFragB = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++);
309
332
310
		state.addBundle(genHost);
333
		state.addBundle(genHost);
Lines 317-326 Link Here
317
		assertTrue("1.2", genFragB.isResolved());
340
		assertTrue("1.2", genFragB.isResolved());
318
		GenericSpecification[] genSpecs = genFragB.getGenericRequires();
341
		GenericSpecification[] genSpecs = genFragB.getGenericRequires();
319
		GenericDescription[] selected = genHost.getSelectedGenericCapabilities();
342
		GenericDescription[] selected = genHost.getSelectedGenericCapabilities();
320
		assertEquals("Wrong number of selected", 1, selected.length);
343
		assertEquals("Wrong number of selected", 1 + 3, selected.length); // + 3 for host frabA and fragB osgi.identity cap
321
		assertTrue("2.0", genSpecs.length == 1);
344
		assertTrue("2.0", genSpecs.length == 4);
322
		assertTrue("2.1", genSpecs[0].isResolved());
345
		Collection providedCollection = new ArrayList(Arrays.asList(selected));
323
		assertEquals("2.1.1", genSpecs[0].getSupplier(), selected[0]);
346
		for (int i = 0; i < genSpecs.length; i++) {
347
			assertTrue("2.1." + i, genSpecs[i].isResolved());
348
			assertTrue("Wrong provider for requirement: " + genSpecs[i], providedCollection.remove(genSpecs[i].getSupplier()));
349
		}
324
	}
350
	}
325
351
326
	public void testGenericsAliases() throws BundleException {
352
	public void testGenericsAliases() throws BundleException {
Lines 333-339 Link Here
333
		Hashtable manifest = new Hashtable();
359
		Hashtable manifest = new Hashtable();
334
		long bundleID = 0;
360
		long bundleID = 0;
335
		manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2");
361
		manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2");
336
		manifest.put(Constants.BUNDLE_SYMBOLICNAME, "genericCapablity");
362
		manifest.put(Constants.BUNDLE_SYMBOLICNAME, "genericCapability");
337
		manifest.put(Constants.BUNDLE_VERSION, "1.0.0");
363
		manifest.put(Constants.BUNDLE_VERSION, "1.0.0");
338
		manifest.put(Constants.EXPORT_SERVICE, "org.osgi.service.log.LogService; version=1.2");
364
		manifest.put(Constants.EXPORT_SERVICE, "org.osgi.service.log.LogService; version=1.2");
339
		manifest.put("TJW-Export", "my.great.stuff; aLong:long=5150; aDouble:double=3.14; aVersion:version=1.2.0");
365
		manifest.put("TJW-Export", "my.great.stuff; aLong:long=5150; aDouble:double=3.14; aVersion:version=1.2.0");
Lines 345-350 Link Here
345
		manifest.put(Constants.BUNDLE_VERSION, "1.0.0");
371
		manifest.put(Constants.BUNDLE_VERSION, "1.0.0");
346
		manifest.put(Constants.IMPORT_SERVICE, "org.osgi.service.log.LogService; selection-filter=(version>=1.0.0)");
372
		manifest.put(Constants.IMPORT_SERVICE, "org.osgi.service.log.LogService; selection-filter=(version>=1.0.0)");
347
		manifest.put("TJW-Import", "my.great.stuff; selection-filter=(&(aLong<=10000)(aLong>=5000))");
373
		manifest.put("TJW-Import", "my.great.stuff; selection-filter=(&(aLong<=10000)(aLong>=5000))");
374
		manifest.put(GENERIC_REQUIRE, "genericCapability:osgi.identity; selection-filter=\"(&(version=1.0.0)(type=osgi.bundle))\"");
348
		BundleDescription genReq = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++);
375
		BundleDescription genReq = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++);
349
376
350
		state.addBundle(genCap);
377
		state.addBundle(genCap);
Lines 354-364 Link Here
354
		assertTrue("1.0", genCap.isResolved());
381
		assertTrue("1.0", genCap.isResolved());
355
		assertTrue("1.1", genReq.isResolved());
382
		assertTrue("1.1", genReq.isResolved());
356
		GenericSpecification[] genSpecs = genReq.getGenericRequires();
383
		GenericSpecification[] genSpecs = genReq.getGenericRequires();
357
		assertTrue("2.0", genSpecs.length == 2);
384
		assertTrue("2.0", genSpecs.length == 3);
358
		assertTrue("2.1", genSpecs[0].isResolved());
385
		assertTrue("2.1", genSpecs[0].isResolved());
359
		assertEquals("2.1.1", genSpecs[0].getSupplier(), genCap.getGenericCapabilities()[0]);
386
		assertEquals("2.1.1", genSpecs[0].getSupplier(), genCap.getGenericCapabilities()[1]);
360
		assertTrue("2.2", genSpecs[1].isResolved());
387
		assertTrue("2.2", genSpecs[1].isResolved());
361
		assertEquals("2.2.1", genSpecs[1].getSupplier(), genCap.getGenericCapabilities()[1]);
388
		assertEquals("2.2.1", genSpecs[1].getSupplier(), genCap.getGenericCapabilities()[2]);
389
		assertTrue("2.3", genSpecs[2].isResolved());
390
		assertEquals("2.3.1", genSpecs[2].getSupplier(), genCap.getGenericCapabilities()[0]);
362
	}
391
	}
363
392
364
	public void testGenericsOptionalMultiple() throws BundleException {
393
	public void testGenericsOptionalMultiple() throws BundleException {
Lines 366-372 Link Here
366
		Hashtable manifest = new Hashtable();
395
		Hashtable manifest = new Hashtable();
367
		long bundleID = 0;
396
		long bundleID = 0;
368
		manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2");
397
		manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2");
369
		manifest.put(Constants.BUNDLE_SYMBOLICNAME, "genericCapablity");
398
		manifest.put(Constants.BUNDLE_SYMBOLICNAME, "genericCapability");
370
		manifest.put(Constants.BUNDLE_VERSION, "1.0.0");
399
		manifest.put(Constants.BUNDLE_VERSION, "1.0.0");
371
		StringBuffer capabililty = new StringBuffer();
400
		StringBuffer capabililty = new StringBuffer();
372
		capabililty.append("foo; version=\"1.3.1\"; attr1=\"value1\"; attr2=\"value2\",");
401
		capabililty.append("foo; version=\"1.3.1\"; attr1=\"value1\"; attr2=\"value2\",");
Lines 389-394 Link Here
389
		manifest.put(Constants.BUNDLE_SYMBOLICNAME, "genericRequire");
418
		manifest.put(Constants.BUNDLE_SYMBOLICNAME, "genericRequire");
390
		manifest.put(Constants.BUNDLE_VERSION, "1.0.0");
419
		manifest.put(Constants.BUNDLE_VERSION, "1.0.0");
391
		StringBuffer required = new StringBuffer();
420
		StringBuffer required = new StringBuffer();
421
		required.append("genericCapability:osgi.identity; selection-filter=\"(&(version=1.0.0)(type=osgi.bundle))\",");
392
		required.append("foo; selection-filter=\"(version>=1.3.0)\",");
422
		required.append("foo; selection-filter=\"(version>=1.3.0)\",");
393
		required.append("bar:bartype; selection-filter=\"(attr1=value1)\",");
423
		required.append("bar:bartype; selection-filter=\"(attr1=value1)\",");
394
		required.append("test.types:testtype; selection-filter=\"(&(aVersion>=2.0.0)(aLong>=5555)(aDouble>=1.00)(aUri=file:/test)(aSet=c)(aString=someString))\",");
424
		required.append("test.types:testtype; selection-filter=\"(&(aVersion>=2.0.0)(aLong>=5555)(aDouble>=1.00)(aUri=file:/test)(aSet=c)(aString=someString))\",");
Lines 405-425 Link Here
405
		assertTrue("1.0", genCap.isResolved());
435
		assertTrue("1.0", genCap.isResolved());
406
		assertTrue("1.1", genReq.isResolved());
436
		assertTrue("1.1", genReq.isResolved());
407
		GenericSpecification[] genSpecs = genReq.getGenericRequires();
437
		GenericSpecification[] genSpecs = genReq.getGenericRequires();
408
		assertTrue("2.0", genSpecs.length == 6);
438
		assertTrue("2.0", genSpecs.length == 7);
409
		assertTrue("2.1", genSpecs[0].isResolved());
439
		assertTrue("2.1", genSpecs[0].isResolved());
410
		assertEquals("2.1.1", genSpecs[0].getSupplier(), genCap.getGenericCapabilities()[0]);
440
		assertEquals("2.1.1", genSpecs[0].getSupplier(), genCap.getGenericCapabilities()[0]);
411
		assertTrue("2.2", genSpecs[1].isResolved());
441
		assertTrue("2.2", genSpecs[1].isResolved());
412
		assertEquals("2.2.1", genSpecs[1].getSupplier(), genCap.getGenericCapabilities()[1]);
442
		assertEquals("2.2.1", genSpecs[1].getSupplier(), genCap.getGenericCapabilities()[1]);
413
		assertTrue("2.3", genSpecs[2].isResolved());
443
		assertTrue("2.3", genSpecs[2].isResolved());
414
		assertEquals("2.3.1", genSpecs[2].getSupplier(), genCap.getGenericCapabilities()[2]);
444
		assertEquals("2.3.1", genSpecs[2].getSupplier(), genCap.getGenericCapabilities()[2]);
415
		assertFalse("2.4", genSpecs[3].isResolved());
445
		assertTrue("2.3", genSpecs[3].isResolved());
416
		assertTrue("2.5", genSpecs[4].isResolved());
446
		assertEquals("2.3.1", genSpecs[3].getSupplier(), genCap.getGenericCapabilities()[3]);
417
		assertEquals("2.5.1", genSpecs[4].getSupplier(), genCap.getGenericCapabilities()[3]);
447
		assertFalse("2.4", genSpecs[4].isResolved());
418
		assertTrue("2.6", genSpecs[5].isResolved());
448
		assertTrue("2.5", genSpecs[5].isResolved());
419
		GenericDescription[] suppliers = genSpecs[5].getSuppliers();
449
		assertEquals("2.5.1", genSpecs[5].getSupplier(), genCap.getGenericCapabilities()[4]);
450
		assertTrue("2.6", genSpecs[6].isResolved());
451
		GenericDescription[] suppliers = genSpecs[6].getSuppliers();
420
		assertTrue("2.6.1", suppliers != null && suppliers.length == 2);
452
		assertTrue("2.6.1", suppliers != null && suppliers.length == 2);
421
		assertEquals("2.6.2", suppliers[0], genCap.getGenericCapabilities()[5]);
453
		assertEquals("2.6.2", suppliers[0], genCap.getGenericCapabilities()[6]);
422
		assertEquals("2.6.3", suppliers[1], genCap.getGenericCapabilities()[4]);
454
		assertEquals("2.6.3", suppliers[1], genCap.getGenericCapabilities()[5]);
423
	}
455
	}
424
456
425
	public void testGenericsCycles() throws BundleException {
457
	public void testGenericsCycles() throws BundleException {
Lines 481-498 Link Here
481
		GenericSpecification[] genSpecs = genReq.getGenericRequires();
513
		GenericSpecification[] genSpecs = genReq.getGenericRequires();
482
		GenericDescription[] selected = genCap.getSelectedGenericCapabilities();
514
		GenericDescription[] selected = genCap.getSelectedGenericCapabilities();
483
		assertTrue("2.0", genSpecs.length == 4);
515
		assertTrue("2.0", genSpecs.length == 4);
484
		assertEquals("Wrong number of selected", 4, selected.length);
516
		assertEquals("Wrong number of selected", 4 + 2, selected.length); // + 2 for host and frag osgi.identity caps
485
		assertTrue("2.1", genSpecs[0].isResolved());
517
		assertTrue("2.1", genSpecs[0].isResolved());
486
		assertEquals("2.1.1", genSpecs[0].getSupplier(), selected[0]);
518
		assertEquals("2.1.1", genSpecs[0].getSupplier(), selected[1]);
487
		assertTrue("2.2", genSpecs[1].isResolved());
519
		assertTrue("2.2", genSpecs[1].isResolved());
488
		assertEquals("2.2.1", genSpecs[1].getSupplier(), selected[1]);
520
		assertEquals("2.2.1", genSpecs[1].getSupplier(), selected[2]);
489
		assertTrue("2.3", genSpecs[2].isResolved());
521
		assertTrue("2.3", genSpecs[2].isResolved());
490
		assertEquals("2.3.1", genSpecs[2].getSupplier(), selected[2]);
522
		assertEquals("2.3.1", genSpecs[2].getSupplier(), selected[3]);
491
		assertTrue("2.4", genSpecs[3].isResolved());
523
		assertTrue("2.4", genSpecs[3].isResolved());
492
		assertEquals("2.4.1", genSpecs[3].getSupplier(), selected[3]);
524
		assertEquals("2.4.1", genSpecs[3].getSupplier(), selected[5]);
493
		genSpecs = genCap.getGenericRequires();
525
		genSpecs = genCap.getGenericRequires();
494
		assertTrue("3.0", genSpecs.length == 1);
526
		assertTrue("3.0", genSpecs.length == 1);
495
		assertTrue("3.1", genSpecs[0].isResolved());
527
		assertTrue("3.1", genSpecs[0].isResolved());
496
		assertEquals("3.1.1", genSpecs[0].getSupplier(), genReq.getGenericCapabilities()[0]);
528
		assertEquals("3.1.1", genSpecs[0].getSupplier(), genReq.getGenericCapabilities()[1]);
497
	}
529
	}
498
}
530
}
(-)src/org/eclipse/osgi/tests/services/resolver/OSGiCapabilityTest.java (-17 / +47 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2010 IBM Corporation and others.
2
 * Copyright (c) 2010, 2011 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 13-19 Link Here
13
import java.io.File;
13
import java.io.File;
14
import java.io.IOException;
14
import java.io.IOException;
15
import java.net.URL;
15
import java.net.URL;
16
import java.util.Dictionary;
16
import java.util.*;
17
import junit.framework.Test;
17
import junit.framework.Test;
18
import junit.framework.TestSuite;
18
import junit.framework.TestSuite;
19
import org.eclipse.osgi.framework.util.Headers;
19
import org.eclipse.osgi.framework.util.Headers;
Lines 105-113 Link Here
105
		assertTrue("c2", c2.isResolved());
105
		assertTrue("c2", c2.isResolved());
106
		assertTrue("c3", c3.isResolved());
106
		assertTrue("c3", c3.isResolved());
107
107
108
		checkGenericBasics(3, c1.getResolvedGenericRequires(), p1.getSelectedGenericCapabilities());
108
		checkGenericBasics(4, c1.getResolvedGenericRequires(), p1.getSelectedGenericCapabilities());
109
		checkGenericBasics(3, c2.getResolvedGenericRequires(), p2.getSelectedGenericCapabilities());
109
		checkGenericBasics(4, c2.getResolvedGenericRequires(), p2.getSelectedGenericCapabilities());
110
		checkGenericBasics(3, c3.getResolvedGenericRequires(), p3.getSelectedGenericCapabilities());
110
		checkGenericBasics(4, c3.getResolvedGenericRequires(), p3.getSelectedGenericCapabilities());
111
111
112
		File stateDir = getContext().getDataFile(getName()); //$NON-NLS-1$
112
		File stateDir = getContext().getDataFile(getName()); //$NON-NLS-1$
113
		stateDir.mkdirs();
113
		stateDir.mkdirs();
Lines 130-145 Link Here
130
		assertTrue("c2", c2.isResolved());
130
		assertTrue("c2", c2.isResolved());
131
		assertTrue("c3", c3.isResolved());
131
		assertTrue("c3", c3.isResolved());
132
132
133
		checkGenericBasics(3, c1.getResolvedGenericRequires(), p1.getSelectedGenericCapabilities());
133
		checkGenericBasics(4, c1.getResolvedGenericRequires(), p1.getSelectedGenericCapabilities());
134
		checkGenericBasics(3, c2.getResolvedGenericRequires(), p2.getSelectedGenericCapabilities());
134
		checkGenericBasics(4, c2.getResolvedGenericRequires(), p2.getSelectedGenericCapabilities());
135
		checkGenericBasics(3, c3.getResolvedGenericRequires(), p3.getSelectedGenericCapabilities());
135
		checkGenericBasics(4, c3.getResolvedGenericRequires(), p3.getSelectedGenericCapabilities());
136
	}
136
	}
137
137
138
	private void checkGenericBasics(int expectedCnt, GenericDescription[] genRequired, GenericDescription[] genProvided) {
138
	private void checkGenericBasics(int expectedCnt, GenericDescription[] genRequired, GenericDescription[] genProvided) {
139
		assertEquals("Expected number of capabilities do not match", expectedCnt, genRequired.length);
139
		assertEquals("Expected number of capabilities do not match", expectedCnt, genRequired.length);
140
		assertEquals("Specs do not match Descs", genRequired.length, genProvided.length);
140
		assertEquals("Specs do not match Descs", genRequired.length, genProvided.length);
141
		Collection providedCollection = new ArrayList(Arrays.asList(genProvided));
141
		for (int i = 0; i < genRequired.length; i++) {
142
		for (int i = 0; i < genRequired.length; i++) {
142
			assertEquals("Wrong provider for requirement.", genProvided[i], genRequired[i]);
143
			assertTrue("Wrong provider for requirement: " + genRequired[i], providedCollection.remove(genRequired[i]));
143
		}
144
		}
144
	}
145
	}
145
146
Lines 172-178 Link Here
172
		assertTrue("c1Frag", c1Frag.isResolved());
173
		assertTrue("c1Frag", c1Frag.isResolved());
173
		assertTrue("p4", p4.isResolved());
174
		assertTrue("p4", p4.isResolved());
174
175
175
		checkGenericBasics(4, c1.getResolvedGenericRequires(), p1.getSelectedGenericCapabilities());
176
		checkGenericBasics(6, c1.getResolvedGenericRequires(), p1.getSelectedGenericCapabilities());
176
177
177
		File stateDir = getContext().getDataFile(getName()); //$NON-NLS-1$
178
		File stateDir = getContext().getDataFile(getName()); //$NON-NLS-1$
178
		stateDir.mkdirs();
179
		stateDir.mkdirs();
Lines 194-200 Link Here
194
		assertTrue("c1Frag", c1Frag.isResolved());
195
		assertTrue("c1Frag", c1Frag.isResolved());
195
		assertTrue("p4", p4.isResolved());
196
		assertTrue("p4", p4.isResolved());
196
197
197
		checkGenericBasics(4, c1.getResolvedGenericRequires(), p1.getSelectedGenericCapabilities());
198
		checkGenericBasics(6, c1.getResolvedGenericRequires(), p1.getSelectedGenericCapabilities());
198
199
199
		state.setResolver(platformAdmin.createResolver());
200
		state.setResolver(platformAdmin.createResolver());
200
		state.resolve(new BundleDescription[] {p1});
201
		state.resolve(new BundleDescription[] {p1});
Lines 205-211 Link Here
205
		assertTrue("c1Frag", c1Frag.isResolved());
206
		assertTrue("c1Frag", c1Frag.isResolved());
206
		assertTrue("p4", p4.isResolved());
207
		assertTrue("p4", p4.isResolved());
207
208
208
		checkGenericBasics(4, c1.getResolvedGenericRequires(), p1.getSelectedGenericCapabilities());
209
		checkGenericBasics(6, c1.getResolvedGenericRequires(), p1.getSelectedGenericCapabilities());
209
	}
210
	}
210
211
211
	public void testGenericFragments02() throws BundleException {
212
	public void testGenericFragments02() throws BundleException {
Lines 233-239 Link Here
233
		assertTrue("c1", c1.isResolved());
234
		assertTrue("c1", c1.isResolved());
234
		assertFalse("c1Frag", c1Frag.isResolved());
235
		assertFalse("c1Frag", c1Frag.isResolved());
235
236
236
		checkGenericBasics(3, c1.getResolvedGenericRequires(), p1.getSelectedGenericCapabilities());
237
		checkGenericBasics(4, c1.getResolvedGenericRequires(), p1.getSelectedGenericCapabilities());
237
238
238
		File stateDir = getContext().getDataFile(getName() + 1); //$NON-NLS-1$
239
		File stateDir = getContext().getDataFile(getName() + 1); //$NON-NLS-1$
239
		stateDir.mkdirs();
240
		stateDir.mkdirs();
Lines 253-259 Link Here
253
		assertTrue("c1", c1.isResolved());
254
		assertTrue("c1", c1.isResolved());
254
		assertFalse("c1Frag", c1Frag.isResolved());
255
		assertFalse("c1Frag", c1Frag.isResolved());
255
256
256
		checkGenericBasics(3, c1.getResolvedGenericRequires(), p1.getSelectedGenericCapabilities());
257
		checkGenericBasics(4, c1.getResolvedGenericRequires(), p1.getSelectedGenericCapabilities());
257
258
258
		manifest = loadManifest("p4.osgi.MF");
259
		manifest = loadManifest("p4.osgi.MF");
259
		BundleDescription p4 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++);
260
		BundleDescription p4 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++);
Lines 267-273 Link Here
267
		assertTrue("c1Frag", c1Frag.isResolved());
268
		assertTrue("c1Frag", c1Frag.isResolved());
268
		assertTrue("p4", p4.isResolved());
269
		assertTrue("p4", p4.isResolved());
269
270
270
		checkGenericBasics(4, c1.getResolvedGenericRequires(), p1.getSelectedGenericCapabilities());
271
		checkGenericBasics(6, c1.getResolvedGenericRequires(), p1.getSelectedGenericCapabilities());
271
272
272
		stateDir = getContext().getDataFile(getName() + 2); //$NON-NLS-1$
273
		stateDir = getContext().getDataFile(getName() + 2); //$NON-NLS-1$
273
		stateDir.mkdirs();
274
		stateDir.mkdirs();
Lines 288-294 Link Here
288
		assertTrue("c1Frag", c1Frag.isResolved());
289
		assertTrue("c1Frag", c1Frag.isResolved());
289
		assertTrue("p4", p4.isResolved());
290
		assertTrue("p4", p4.isResolved());
290
291
291
		checkGenericBasics(4, c1.getResolvedGenericRequires(), p1.getSelectedGenericCapabilities());
292
		checkGenericBasics(6, c1.getResolvedGenericRequires(), p1.getSelectedGenericCapabilities());
292
	}
293
	}
293
294
294
	public void testGenericUses() throws BundleException {
295
	public void testGenericUses() throws BundleException {
Lines 362-367 Link Here
362
		checkUsedCapability(c4v130, p5v100Capability);
363
		checkUsedCapability(c4v130, p5v100Capability);
363
	}
364
	}
364
365
366
	public void testDeclaringIdentityCapability() throws BundleException {
367
		State state = buildEmptyState();
368
		Hashtable manifest = new Hashtable();
369
		long bundleID = 0;
370
		manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2");
371
		manifest.put(Constants.BUNDLE_SYMBOLICNAME, "genericCapability");
372
		manifest.put(Constants.BUNDLE_VERSION, "1.0.0");
373
		StringBuffer capabililty = new StringBuffer();
374
		capabililty.append("testFailure:osgi.identity; test=failure");
375
		manifest.put(GenericCapabilityTest.GENERIC_CAPABILITY, capabililty.toString());
376
377
		try {
378
			state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++);
379
			fail("Expected failure to create description that specifies osgi.identity capability");
380
		} catch (BundleException e) {
381
			// expected
382
		}
383
384
		manifest.remove(GenericCapabilityTest.GENERIC_CAPABILITY);
385
		manifest.put(Constants.PROVIDE_CAPABILITY, "osgi.identity; osgi.identity=testFailure; test=failure");
386
		try {
387
			state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++);
388
			fail("Expected failure to create description that specifies osgi.identity capability");
389
		} catch (BundleException e) {
390
			// expected
391
		}
392
	}
393
365
	private void checkUsedImports(BundleDescription importer, ExportPackageDescription[] expectedPackages) {
394
	private void checkUsedImports(BundleDescription importer, ExportPackageDescription[] expectedPackages) {
366
		ExportPackageDescription[] imported = importer.getResolvedImports();
395
		ExportPackageDescription[] imported = importer.getResolvedImports();
367
		assertEquals("Wrong number of imports for bundle: " + importer, expectedPackages.length, imported.length);
396
		assertEquals("Wrong number of imports for bundle: " + importer, expectedPackages.length, imported.length);
Lines 381-388 Link Here
381
	private void checkUsedCapability(BundleDescription requirer, GenericDescription[] expectedCapabilities) {
410
	private void checkUsedCapability(BundleDescription requirer, GenericDescription[] expectedCapabilities) {
382
		GenericDescription[] required = requirer.getResolvedGenericRequires();
411
		GenericDescription[] required = requirer.getResolvedGenericRequires();
383
		assertEquals("Wrong number of capabilities for bundle: " + requirer, expectedCapabilities.length, required.length);
412
		assertEquals("Wrong number of capabilities for bundle: " + requirer, expectedCapabilities.length, required.length);
413
		Collection providedCollection = new ArrayList(Arrays.asList(expectedCapabilities));
384
		for (int i = 0; i < required.length; i++) {
414
		for (int i = 0; i < required.length; i++) {
385
			assertEquals("Wrong required capability from bundle: " + requirer, expectedCapabilities[i], required[i]);
415
			assertTrue("Wrong provider for requirement: " + required[i], providedCollection.remove(required[i]));
386
		}
416
		}
387
	}
417
	}
388
}
418
}
(-)test_files/genericCapability/c1.equinox.MF (-1 / +3 lines)
Lines 17-20 Link Here
17
  selection-filter="(&(rank>=100)(!(rank>=200))
17
  selection-filter="(&(rank>=100)(!(rank>=200))
18
          (percent>=0.1)(!(percent>=0.2))
18
          (percent>=0.1)(!(percent>=0.2))
19
          (test.version>=1.0)(!(test.version>=2.0))
19
          (test.version>=1.0)(!(test.version>=2.0))
20
          (test.string~=abc))"
20
          (test.string~=abc))",
21
 *:osgi.identity;
22
  selection-filter="(&(osgi.identity=p1.*)(version=1.0)(type=osgi.bundle))"
(-)test_files/genericCapability/c1.equinox.name.MF (-1 / +3 lines)
Lines 17-20 Link Here
17
  selection-filter="(&(rank>=100)(!(rank>=200))
17
  selection-filter="(&(rank>=100)(!(rank>=200))
18
          (percent>=0.1)(!(percent>=0.2))
18
          (percent>=0.1)(!(percent>=0.2))
19
          (test.version>=1.0)(!(test.version>=2.0))
19
          (test.version>=1.0)(!(test.version>=2.0))
20
          (test.string~=abc))"
20
          (test.string~=abc))",
21
 p1.*:osgi.identity;
22
  selection-filter="(&(version=1.0)(type=osgi.bundle))"
(-)test_files/genericCapability/c1.osgi.MF (-1 / +3 lines)
Lines 17-20 Link Here
17
  filter:="(&(rank>=100)(!(rank>=200))
17
  filter:="(&(rank>=100)(!(rank>=200))
18
          (percent>=0.1)(!(percent>=0.2))
18
          (percent>=0.1)(!(percent>=0.2))
19
          (test.version>=1.0)(!(test.version>=2.0))
19
          (test.version>=1.0)(!(test.version>=2.0))
20
          (test.string~=abc))"
20
          (test.string~=abc))",
21
 osgi.identity;
22
  filter:="(&(osgi.identity=p1.*)(version=1.0)(type=osgi.bundle))"
(-)test_files/genericCapability/c1.osgi.frag.MF (-1 / +3 lines)
Lines 8-11 Link Here
8
  filter:="(&(rank>=100)(!(rank>=200))
8
  filter:="(&(rank>=100)(!(rank>=200))
9
          (percent>=0.1)(!(percent>=0.2))
9
          (percent>=0.1)(!(percent>=0.2))
10
          (test.version>=1.0)(!(test.version>=2.0))
10
          (test.version>=1.0)(!(test.version>=2.0))
11
          (test.string~=abc))"
11
          (test.string~=abc))",
12
 osgi.identity;
13
  filter:="(&(osgi.identity=p1.*.frag)(version=1.0)(type=osgi.fragment))"
(-)test_files/genericCapability/c2.equinox.MF (-1 / +3 lines)
Lines 17-20 Link Here
17
  selection-filter="(&(rank>=200)(!(rank>=300))
17
  selection-filter="(&(rank>=200)(!(rank>=300))
18
          (percent>=0.2)(!(percent>=0.3))
18
          (percent>=0.2)(!(percent>=0.3))
19
          (test.version>=2.0)(!(test.version>=3.0))
19
          (test.version>=2.0)(!(test.version>=3.0))
20
          (test.string~=abc))"
20
          (test.string~=abc))",
21
 *:osgi.identity;
22
  selection-filter="(&(osgi.identity=p2.*)(version=1.0)(type=osgi.bundle))"
(-)test_files/genericCapability/c2.equinox.name.MF (-1 / +3 lines)
Lines 17-20 Link Here
17
  selection-filter="(&(rank>=200)(!(rank>=300))
17
  selection-filter="(&(rank>=200)(!(rank>=300))
18
          (percent>=0.2)(!(percent>=0.3))
18
          (percent>=0.2)(!(percent>=0.3))
19
          (test.version>=2.0)(!(test.version>=3.0))
19
          (test.version>=2.0)(!(test.version>=3.0))
20
          (test.string~=abc))"
20
          (test.string~=abc))",
21
 p2.*:osgi.identity;
22
  selection-filter="(&(version=1.0)(type=osgi.bundle))"
(-)test_files/genericCapability/c2.osgi.MF (-1 / +3 lines)
Lines 17-20 Link Here
17
  filter:="(&(rank>=200)(!(rank>=300))
17
  filter:="(&(rank>=200)(!(rank>=300))
18
          (percent>=0.2)(!(percent>=0.3))
18
          (percent>=0.2)(!(percent>=0.3))
19
          (test.version>=2.0)(!(test.version>=3.0))
19
          (test.version>=2.0)(!(test.version>=3.0))
20
          (test.string~=abc))"
20
          (test.string~=abc))",
21
 osgi.identity;
22
  filter:="(&(osgi.identity=p2.*)(version=1.0)(type=osgi.bundle))"
(-)test_files/genericCapability/c3.equinox.MF (-1 / +3 lines)
Lines 17-20 Link Here
17
  selection-filter="(&(rank>=300)(!(rank>=400))
17
  selection-filter="(&(rank>=300)(!(rank>=400))
18
          (percent>=0.3)(!(percent>=0.4))
18
          (percent>=0.3)(!(percent>=0.4))
19
          (test.version>=3.0)(!(test.version>=4.0))
19
          (test.version>=3.0)(!(test.version>=4.0))
20
          (test.string~=abc))"
20
          (test.string~=abc))",
21
 *:osgi.identity;
22
  selection-filter="(&(osgi.identity=p3.*)(version=1.0)(type=osgi.bundle))"
(-)test_files/genericCapability/c3.equinox.name.MF (-1 / +3 lines)
Lines 17-20 Link Here
17
  selection-filter="(&(rank>=300)(!(rank>=400))
17
  selection-filter="(&(rank>=300)(!(rank>=400))
18
          (percent>=0.3)(!(percent>=0.4))
18
          (percent>=0.3)(!(percent>=0.4))
19
          (test.version>=3.0)(!(test.version>=4.0))
19
          (test.version>=3.0)(!(test.version>=4.0))
20
          (test.string~=abc))"
20
          (test.string~=abc))",
21
 p3.*:osgi.identity;
22
  selection-filter="(&(version=1.0)(type=osgi.bundle))"
(-)test_files/genericCapability/c3.osgi.MF (-1 / +3 lines)
Lines 17-20 Link Here
17
  filter:="(&(rank>=300)(!(rank>=400))
17
  filter:="(&(rank>=300)(!(rank>=400))
18
          (percent>=0.3)(!(percent>=0.4))
18
          (percent>=0.3)(!(percent>=0.4))
19
          (test.version>=3.0)(!(test.version>=4.0))
19
          (test.version>=3.0)(!(test.version>=4.0))
20
          (test.string~=abc))"
20
          (test.string~=abc))",
21
 osgi.identity;
22
  filter:="(&(osgi.identity=p3.*)(version=1.0)(type=osgi.bundle))"
(-)test_files/genericCapability/c4.v100.osgi.MF (-1 / +2 lines)
Lines 3-7 Link Here
3
Bundle-SymbolicName: c4.osgi
3
Bundle-SymbolicName: c4.osgi
4
Bundle-Version: 1.0
4
Bundle-Version: 1.0
5
Require-Capability: 
5
Require-Capability: 
6
 namespace.5; filter:="(version=1.0)"
6
 namespace.5; filter:="(version=1.0)",
7
 osgi.identity; filter:="(&(osgi.identity=p5.osgi)(version=1.0)(type=osgi.bundle))"
7
Import-Package: p6, p7
8
Import-Package: p6, p7
(-)test_files/genericCapability/c4.v110.osgi.MF (-1 / +2 lines)
Lines 3-7 Link Here
3
Bundle-SymbolicName: c4.osgi
3
Bundle-SymbolicName: c4.osgi
4
Bundle-Version: 1.1
4
Bundle-Version: 1.1
5
Require-Capability: 
5
Require-Capability: 
6
 namespace.5; filter:="(namespace.5=test)"
6
 namespace.5; filter:="(namespace.5=test)",
7
 osgi.identity; filter:="(&(osgi.identity=p5.osgi)(version=1.0)(type=osgi.bundle))"
7
Import-Package: p6; p7; version="[1.0,1.1)"
8
Import-Package: p6; p7; version="[1.0,1.1)"
(-)test_files/genericCapability/c4.v120.osgi.MF (-1 / +2 lines)
Lines 3-7 Link Here
3
Bundle-SymbolicName: c4.osgi
3
Bundle-SymbolicName: c4.osgi
4
Bundle-Version: 1.2
4
Bundle-Version: 1.2
5
Require-Capability: 
5
Require-Capability: 
6
 namespace.5; filter:="(version=1.0)"
6
 namespace.5; filter:="(version=1.0)",
7
 osgi.identity; filter:="(&(osgi.identity=p5.osgi)(version=1.0)(type=osgi.bundle))"
7
DynamicImport-Package: p6, p7
8
DynamicImport-Package: p6, p7
(-)test_files/genericCapability/c4.v130.osgi.MF (-1 / +2 lines)
Lines 3-7 Link Here
3
Bundle-SymbolicName: c4.osgi
3
Bundle-SymbolicName: c4.osgi
4
Bundle-Version: 1.3
4
Bundle-Version: 1.3
5
Require-Capability: 
5
Require-Capability: 
6
 namespace.5; filter:="(version=1.0)"
6
 namespace.5; filter:="(version=1.0)",
7
 osgi.identity; filter:="(&(osgi.identity=p5.osgi)(version=1.0)(type=osgi.bundle))"
7
Require-Bundle: p6.osgi, p7.osgi
8
Require-Bundle: p6.osgi, p7.osgi

Return to bug 349618