Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 198857 Details for
Bug 349618
[R4.4] Framework support for Resource, etc. in OSGi 4.4
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
proposed patch
349618_20010629-1437.txt (text/plain), 140.46 KB, created by
John Ross
on 2011-06-29 15:46:53 EDT
(
hide
)
Description:
proposed patch
Filename:
MIME Type:
Creator:
John Ross
Created:
2011-06-29 15:46:53 EDT
Size:
140.46 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.equinox.region.tests >Index: regionTestTarget.target >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/components/bundles/org.eclipse.equinox.region.tests/regionTestTarget.target,v >retrieving revision 1.1 >diff -u -r1.1 regionTestTarget.target >--- regionTestTarget.target 13 Apr 2011 16:20:13 -0000 1.1 >+++ regionTestTarget.target 29 Jun 2011 19:37:42 -0000 >@@ -1,7 +1,7 @@ >-<?xml version="1.0" encoding="UTF-8"?> >+<?xml version="1.0" encoding="UTF-8" standalone="no"?> > <?pde version="3.6"?> > >-<target name="Region Test Target" sequenceNumber="6"> >+<target name="Region Test Target" sequenceNumber="14"> > <locations> > <location path="${eclipse_home}" type="Profile"/> > <location includeAllPlatforms="false" includeMode="slicer" includeSource="true" type="InstallableUnit"> >@@ -15,8 +15,8 @@ > </location> > </locations> > <environment> >-<os>macosx</os> >-<ws>cocoa</ws> >+<os>win32</os> >+<ws>win32</ws> > <arch>x86</arch> > <nl>en_US</nl> > </environment> >Index: src/org/eclipse/equinox/internal/region/hook/RegionResolverHookTests.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/components/bundles/org.eclipse.equinox.region.tests/src/org/eclipse/equinox/internal/region/hook/RegionResolverHookTests.java,v >retrieving revision 1.3 >diff -u -r1.3 RegionResolverHookTests.java >--- src/org/eclipse/equinox/internal/region/hook/RegionResolverHookTests.java 4 May 2011 03:14:44 -0000 1.3 >+++ src/org/eclipse/equinox/internal/region/hook/RegionResolverHookTests.java 29 Jun 2011 19:37:42 -0000 >@@ -403,6 +403,11 @@ > } > > @Override >+ public BundleRevision getResource() { >+ return getRevision(); >+ } >+ >+ @Override > public BundleRevision getRevision() { > return new StubBundleRevision(bundle(this.bundleSymbolicName)); > } >@@ -481,6 +486,11 @@ > } > > @Override >+ public BundleRevision getResource() { >+ return getRevision(); >+ } >+ >+ @Override > public BundleRevision getRevision() { > return new StubBundleRevision(bundle(this.bundleSymbolicName)); > } >@@ -543,6 +553,11 @@ > } > > @Override >+ public BundleRevision getResource() { >+ return getRevision(); >+ } >+ >+ @Override > public BundleRevision getRevision() { > return this.bundleRevision; > } >@@ -552,6 +567,12 @@ > throw new UnsupportedOperationException(); > } > >+ @Override >+ public boolean matches(Capability capability) { >+ if (!(capability instanceof BundleCapability)) >+ return false; >+ return matches((BundleCapability) capability); >+ } > } > > final class StubBundleRevision implements BundleRevision { >@@ -597,6 +618,17 @@ > throw new UnsupportedOperationException(); > } > >+ @SuppressWarnings({"cast", "unchecked", "rawtypes"}) >+ @Override >+ public List<Capability> getCapabilities(String namespace) { >+ return (List<Capability>) (List) getDeclaredCapabilities(namespace); >+ } >+ >+ @SuppressWarnings({"cast", "unchecked", "rawtypes"}) >+ @Override >+ public List<Requirement> getRequirements(String namespace) { >+ return (List<Requirement>) (List) getDeclaredRequirements(namespace); >+ } > } > > } >#P org.eclipse.osgi >Index: .settings/.api_filters >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/framework/bundles/org.eclipse.osgi/.settings/.api_filters,v >retrieving revision 1.52 >diff -u -r1.52 .api_filters >--- .settings/.api_filters 16 Feb 2011 20:45:18 -0000 1.52 >+++ .settings/.api_filters 29 Jun 2011 19:37:42 -0000 >@@ -989,6 +989,11 @@ > <message_argument value="org.osgi.framework.wiring.BundleCapability"/> > </message_arguments> > </filter> >+<filter comment="Ignore osgi API." id="1211105284"> >+<message_arguments> >+<message_argument value="getResource()"/> >+</message_arguments> >+</filter> > </resource> > <resource path="osgi/src/org/osgi/framework/wiring/BundleRequirement.java" type="org.osgi.framework.wiring.BundleRequirement"> > <filter comment="Ignore OSGi API" id="1110441988"> >@@ -996,6 +1001,11 @@ > <message_argument value="org.osgi.framework.wiring.BundleRequirement"/> > </message_arguments> > </filter> >+<filter comment="Ignore osgi API." id="1211105284"> >+<message_arguments> >+<message_argument value="getResource()"/> >+</message_arguments> >+</filter> > </resource> > <resource path="osgi/src/org/osgi/framework/wiring/BundleRevision.java" type="org.osgi.framework.wiring.BundleRevision"> > <filter comment="Ignore OSGi API" id="1110441988"> >@@ -1017,6 +1027,16 @@ > <message_argument value="org.osgi.framework.wiring.BundleWire"/> > </message_arguments> > </filter> >+<filter comment="Ignore osgi API." id="1211105284"> >+<message_arguments> >+<message_argument value="getProvider()"/> >+</message_arguments> >+</filter> >+<filter comment="Ignore osgi API." id="1211105284"> >+<message_arguments> >+<message_argument value="getRequirer()"/> >+</message_arguments> >+</filter> > </resource> > <resource path="osgi/src/org/osgi/framework/wiring/BundleWiring.java" type="org.osgi.framework.wiring.BundleWiring"> > <filter comment="Ignore OSGi API" id="1110441988"> >@@ -1025,6 +1045,13 @@ > </message_arguments> > </filter> > </resource> >+<resource path="osgi/src/org/osgi/framework/wiring/Capability.java" type="org.osgi.framework.wiring.Capability"> >+<filter comment="Ignore osgi API." id="1110441988"> >+<message_arguments> >+<message_argument value="org.osgi.framework.wiring.Capability"/> >+</message_arguments> >+</filter> >+</resource> > <resource path="osgi/src/org/osgi/framework/wiring/FrameworkWiring.java" type="org.osgi.framework.wiring.FrameworkWiring"> > <filter comment="Ignore OSGi API" id="1110441988"> > <message_arguments> >@@ -1032,6 +1059,34 @@ > </message_arguments> > </filter> > </resource> >+<resource path="osgi/src/org/osgi/framework/wiring/Requirement.java" type="org.osgi.framework.wiring.Requirement"> >+<filter comment="Ignore osgi API." id="1110441988"> >+<message_arguments> >+<message_argument value="org.osgi.framework.wiring.Requirement"/> >+</message_arguments> >+</filter> >+</resource> >+<resource path="osgi/src/org/osgi/framework/wiring/Resource.java" type="org.osgi.framework.wiring.Resource"> >+<filter comment="Ignore osgi API." id="1110441988"> >+<message_arguments> >+<message_argument value="org.osgi.framework.wiring.Resource"/> >+</message_arguments> >+</filter> >+</resource> >+<resource path="osgi/src/org/osgi/framework/wiring/ResourceConstants.java" type="org.osgi.framework.wiring.ResourceConstants"> >+<filter comment="Ignore osgi API." id="1110441988"> >+<message_arguments> >+<message_argument value="org.osgi.framework.wiring.ResourceConstants"/> >+</message_arguments> >+</filter> >+</resource> >+<resource path="osgi/src/org/osgi/framework/wiring/Wire.java" type="org.osgi.framework.wiring.Wire"> >+<filter comment="Ignore osgi API." id="1110441988"> >+<message_arguments> >+<message_argument value="org.osgi.framework.wiring.Wire"/> >+</message_arguments> >+</filter> >+</resource> > <resource path="osgi/src/org/osgi/service/condpermadmin/ConditionalPermissionAdmin.java" type="org.osgi.service.condpermadmin.ConditionalPermissionAdmin"> > <filter comment="Ignore OSGi API" id="403853384"> > <message_arguments> >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/framework/bundles/org.eclipse.osgi/META-INF/MANIFEST.MF,v >retrieving revision 1.102 >diff -u -r1.102 MANIFEST.MF >--- META-INF/MANIFEST.MF 10 Jun 2011 13:04:38 -0000 1.102 >+++ META-INF/MANIFEST.MF 29 Jun 2011 19:37:42 -0000 >@@ -25,7 +25,7 @@ > org.osgi.framework.hooks.service; version="1.1", > org.osgi.framework.hooks.weaving; version="1.0", > org.osgi.framework.startlevel; version="1.0", >- org.osgi.framework.wiring; version="1.0", >+ org.osgi.framework.wiring; version="1.1", > org.osgi.service.condpermadmin;version="1.1.1", > org.osgi.service.framework; version="1.0"; x-internal:=true, > org.osgi.service.log; version="1.3", >@@ -75,7 +75,7 @@ > Bundle-Description: %systemBundle > Bundle-Copyright: %copyright > Bundle-Vendor: %eclipse.org >-Bundle-Version: 3.7.100.qualifier >+Bundle-Version: 3.8.0.qualifier > Bundle-Localization: systembundle > Bundle-DocUrl: http://www.eclipse.org > Eclipse-ExtensibleAPI: true >Index: osgi/src/org/osgi/framework/wiring/BundleCapability.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/framework/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleCapability.java,v >retrieving revision 1.3 >diff -u -r1.3 BundleCapability.java >--- osgi/src/org/osgi/framework/wiring/BundleCapability.java 28 Feb 2011 19:52:42 -0000 1.3 >+++ osgi/src/org/osgi/framework/wiring/BundleCapability.java 29 Jun 2011 19:37:42 -0000 >@@ -18,15 +18,16 @@ > > import java.util.Map; > >+ > /** > * A capability that has been declared from a {@link BundleRevision bundle > * revision}. > * > * @ThreadSafe > * @noimplement >- * @version $Id: 0fde13c3228af1aa97872b37ccf0aa6e23123b11 $ >+ * @version $Id: 6bbc1e645f927531d40fb245c95f5d26ad189db3 $ > */ >-public interface BundleCapability { >+public interface BundleCapability extends Capability{ > /** > * Returns the name space of this capability. > * >@@ -58,4 +59,6 @@ > * @return The bundle revision declaring this capability. > */ > BundleRevision getRevision(); >+ >+ BundleRevision getResource(); > } >Index: osgi/src/org/osgi/framework/wiring/BundleRequirement.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/framework/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleRequirement.java,v >retrieving revision 1.3 >diff -u -r1.3 BundleRequirement.java >--- osgi/src/org/osgi/framework/wiring/BundleRequirement.java 28 Feb 2011 19:52:42 -0000 1.3 >+++ osgi/src/org/osgi/framework/wiring/BundleRequirement.java 29 Jun 2011 19:37:42 -0000 >@@ -18,15 +18,16 @@ > > import java.util.Map; > >+ > /** > * A requirement that has been declared from a {@link BundleRevision bundle > * revision}. > * > * @ThreadSafe > * @noimplement >- * @version $Id: 659132c1fac7526240df377ead0e1bc8d4af2e77 $ >+ * @version $Id: 3ee254a3c0d5516b56affaa66544c892f3d522cb $ > */ >-public interface BundleRequirement { >+public interface BundleRequirement extends Requirement{ > /** > * Returns the name space of this requirement. > * >@@ -60,6 +61,11 @@ > BundleRevision getRevision(); > > /** >+ * {@inheritDoc} >+ */ >+ BundleRevision getResource(); >+ >+ /** > * Returns whether the specified capability matches this requirement. > * > * @param capability The capability to match to this requirement. >Index: osgi/src/org/osgi/framework/wiring/BundleRevision.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/framework/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleRevision.java,v >retrieving revision 1.4 >diff -u -r1.4 BundleRevision.java >--- osgi/src/org/osgi/framework/wiring/BundleRevision.java 28 Feb 2011 19:52:42 -0000 1.4 >+++ osgi/src/org/osgi/framework/wiring/BundleRevision.java 29 Jun 2011 19:37:42 -0000 >@@ -47,9 +47,9 @@ > * > * @ThreadSafe > * @noimplement >- * @version $Id: 139b3046ebd46c48b03dda8d36f2f9d79e2e616d $ >+ * @version $Id: 2eb450f15fc9d4fe1b611dc55e2238b972b4c486 $ > */ >-public interface BundleRevision extends BundleReference { >+public interface BundleRevision extends BundleReference, Resource { > /** > * Returns the symbolic name for this bundle revision. > * >@@ -137,7 +137,7 @@ > * package wires required by a bundle wiring may change as the bundle wiring > * may dynamically import additional packages. > */ >- String PACKAGE_NAMESPACE = "osgi.wiring.package"; >+ String PACKAGE_NAMESPACE = ResourceConstants.WIRING_PACKAGE_NAMESPACE; > > /** > * Name space for bundle capabilities and requirements. >@@ -175,7 +175,7 @@ > * {@link Constants#BUNDLE_MANIFESTVERSION Bundle-ManifestVersion} > * {@literal <} 2) must not provide a bundle capability. > */ >- String BUNDLE_NAMESPACE = "osgi.wiring.bundle"; >+ String BUNDLE_NAMESPACE = ResourceConstants.WIRING_BUNDLE_NAMESPACE; > > /** > * Name space for host capabilities and requirements. >@@ -216,7 +216,7 @@ > * {@link Constants#BUNDLE_MANIFESTVERSION Bundle-ManifestVersion} > * {@literal <} 2) must not provide a host capability. > */ >- String HOST_NAMESPACE = "osgi.wiring.host"; >+ String HOST_NAMESPACE = ResourceConstants.WIRING_HOST_NAMESPACE; > > /** > * Returns the special types of this bundle revision. The bundle revision >Index: osgi/src/org/osgi/framework/wiring/BundleWire.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/framework/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleWire.java,v >retrieving revision 1.3 >diff -u -r1.3 BundleWire.java >--- osgi/src/org/osgi/framework/wiring/BundleWire.java 28 Feb 2011 19:52:42 -0000 1.3 >+++ osgi/src/org/osgi/framework/wiring/BundleWire.java 29 Jun 2011 19:37:42 -0000 >@@ -16,14 +16,15 @@ > > package org.osgi.framework.wiring; > >+ > /** > * A wire connecting a {@link BundleCapability} to a {@link BundleRequirement}. > * > * @ThreadSafe > * @noimplement >- * @version $Id: 4f936a84065762ec3267a44f86ae01b0150e44ce $ >+ * @version $Id: aca8642cea91995d0b178129cba1131ed327c7e7 $ > */ >-public interface BundleWire { >+public interface BundleWire extends Wire { > /** > * Returns the {@link BundleCapability} for this wire. > * >@@ -69,4 +70,14 @@ > * returned. > */ > BundleWiring getRequirerWiring(); >+ >+ /** >+ * {@inheritDoc} >+ */ >+ BundleRevision getProvider(); >+ >+ /** >+ * {@inheritDoc} >+ */ >+ BundleRevision getRequirer(); > } >Index: osgi/src/org/osgi/framework/wiring/BundleWiring.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/framework/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/wiring/BundleWiring.java,v >retrieving revision 1.7 >diff -u -r1.7 BundleWiring.java >--- osgi/src/org/osgi/framework/wiring/BundleWiring.java 28 Feb 2011 19:52:42 -0000 1.7 >+++ osgi/src/org/osgi/framework/wiring/BundleWiring.java 29 Jun 2011 19:37:42 -0000 >@@ -83,9 +83,16 @@ > * <p> > * A bundle wiring for a non-fragment revision provides a subset of the > * declared capabilities from the bundle revision and all attached fragment >- * revisions. Not all declared capabilities may be provided since some may >+ * revisions<sup>†</sup>. Not all declared capabilities may be provided since some may > * be discarded. For example, if a package is declared to be exported and > * import, only one is selected and the other is discarded. >+ * <p> >+ * A bundle wiring for a fragment revision with a symbolic name must >+ * provide exactly one {@link ResourceConstants#IDENTITY_NAMESPACE identity} capability. >+ * <p> >+ * † The {@link ResourceConstants#IDENTITY_NAMESPACE identity} capability >+ * provided by attached fragment revisions must not be included in the capabilities of the >+ * host bundle wiring. > * > * @param namespace The name space of the capabilities to return or > * {@code null} to return the capabilities from all name spaces. >@@ -95,7 +102,7 @@ > * {@link #isInUse() in use}, {@code null} will be returned. For a > * given name space, the list contains the wires in the order the > * capabilities were specified in the manifests of the >- * {@link #getRevision() bundle revision} and the attached fragments >+ * {@link #getRevision() bundle revision} and the attached fragments<sup>†</sup> > * of this bundle wiring. There is no ordering defined between > * capabilities in different name spaces. > */ >Index: osgi/src/org/osgi/framework/wiring/Capability.java >=================================================================== >RCS file: osgi/src/org/osgi/framework/wiring/Capability.java >diff -N osgi/src/org/osgi/framework/wiring/Capability.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ osgi/src/org/osgi/framework/wiring/Capability.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,82 @@ >+/* >+ * Copyright (c) OSGi Alliance (2010, 2011). All Rights Reserved. >+ * >+ * Licensed under the Apache License, Version 2.0 (the "License"); >+ * you may not use this file except in compliance with the License. >+ * You may obtain a copy of the License at >+ * >+ * http://www.apache.org/licenses/LICENSE-2.0 >+ * >+ * Unless required by applicable law or agreed to in writing, software >+ * distributed under the License is distributed on an "AS IS" BASIS, >+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. >+ * See the License for the specific language governing permissions and >+ * limitations under the License. >+ */ >+ >+package org.osgi.framework.wiring; >+ >+import java.util.Map; >+ >+/** >+ * A capability that has been declared from a {@link Resource}. >+ * >+ * @ThreadSafe >+ * @version $Id: f8bd10002691537806e4bc3cf08f3fce37510121 $ >+ */ >+public interface Capability { >+ >+ /** >+ * Returns the name space of this capability. >+ * >+ * @return The name space of this capability. >+ */ >+ String getNamespace(); >+ >+ /** >+ * Returns the directives of this capability. Only the following list of >+ * directives have semantic meaning in the returned {@link Map map} of >+ * directives: >+ * <ul> >+ * <li> {@link ResourceConstants#CAPABILITY_EFFECTIVE_DIRECTIVE effective} >+ * <li> {@link ResourceConstants#CAPABILITY_USES_DIRECTIVE uses} >+ * <li> {@link ResourceConstants#CAPABILITY_MANDATORY_DIRECTIVE mandatory} - >+ * only recognized for the >+ * {@link ResourceConstants#WIRING_BUNDLE_NAMESPACE osgi.wiring.bundle} and >+ * {@link ResourceConstants#WIRING_PACKAGE_NAMESPACE osgi.wiring.package} >+ * name spaces. >+ * <li> {@link ResourceConstants#CAPABILITY_EXCLUDE_DIRECTIVE exclude} - >+ * only recognized for the >+ * {@link ResourceConstants#WIRING_PACKAGE_NAMESPACE osgi.wiring.package} >+ * name space. >+ * <li> {@link ResourceConstants#CAPABILITY_INCLUDE_DIRECTIVE include} - >+ * only recognized for the >+ * {@link ResourceConstants#WIRING_PACKAGE_NAMESPACE osgi.wiring.package} >+ * name space. >+ * </ul> >+ * All other directive are considered extra user defined information that >+ * has no semantic meaning. OSGi Alliance reserves the right to extend the >+ * set of directives which have semantic meaning. >+ * >+ * @return An unmodifiable map of directive names to directive values for >+ * this capability, or an empty map if this capability has no >+ * directives. >+ */ >+ Map<String, String> getDirectives(); >+ >+ /** >+ * Returns the attributes of this capability. >+ * >+ * @return An unmodifiable map of attribute names to attribute values for >+ * this capability, or an empty map if this capability has no >+ * attributes. >+ */ >+ Map<String, Object> getAttributes(); >+ >+ /** >+ * The resource that declares this capability. >+ * >+ * @return the resource >+ */ >+ Resource getResource(); >+} >Index: osgi/src/org/osgi/framework/wiring/Requirement.java >=================================================================== >RCS file: osgi/src/org/osgi/framework/wiring/Requirement.java >diff -N osgi/src/org/osgi/framework/wiring/Requirement.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ osgi/src/org/osgi/framework/wiring/Requirement.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,105 @@ >+/* >+ * Copyright (c) OSGi Alliance (2010, 2011). All Rights Reserved. >+ * >+ * Licensed under the Apache License, Version 2.0 (the "License"); >+ * you may not use this file except in compliance with the License. >+ * You may obtain a copy of the License at >+ * >+ * http://www.apache.org/licenses/LICENSE-2.0 >+ * >+ * Unless required by applicable law or agreed to in writing, software >+ * distributed under the License is distributed on an "AS IS" BASIS, >+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. >+ * See the License for the specific language governing permissions and >+ * limitations under the License. >+ */ >+ >+package org.osgi.framework.wiring; >+ >+import java.util.Map; >+ >+import org.osgi.framework.Constants; >+ >+/** >+ * A requirement that has been declared from a {@link Resource} . >+ * >+ * @ThreadSafe >+ * @version $Id: 3a6b0afb063fa288c07b68e0de742af291f869cc $ >+ */ >+public interface Requirement { >+ /** >+ * Returns the name space of this requirement. >+ * >+ * @return The name space of this requirement. >+ */ >+ String getNamespace(); >+ >+ /** >+ * Returns the directives of this requirement. Only the following list of >+ * directives have semantic meaning in the returned {@link Map map} of >+ * directives: >+ * <ul> >+ * <li> {@link ResourceConstants#REQUIREMENT_EFFECTIVE_DIRECTIVE effective} >+ * <li> {@link ResourceConstants#REQUIREMENT_FILTER_DIRECTIVE filter} >+ * <li> {@link ResourceConstants#REQUIREMENT_CARDINALITY_DIRECTIVE >+ * cardinality} >+ * <li> {@link ResourceConstants#REQUIREMENT_RESOLUTION_DIRECTIVE resolution} >+ * <li> {@link ResourceConstants#REQUIREMENT_VISIBILITY_DIRECTIVE visibility} >+ * - only recognized for the >+ * {@link ResourceConstants#WIRING_BUNDLE_NAMESPACE osgi.wiring.bundle} name >+ * space. >+ * </ul> >+ * All other directive are considered extra user defined information that >+ * has no semantic meaning. OSGi Alliance reserves the right to extend the >+ * set of directives which have semantic meaning. >+ * >+ * @return An unmodifiable map of directive names to directive values for >+ * this requirement, or an empty map if this requirement has no >+ * directives. >+ */ >+ Map<String, String> getDirectives(); >+ >+ /** >+ * Returns the attributes of this requirement. Requirement attributes have >+ * no semantic meaning and are considered extra user defined information. >+ * >+ * @return An unmodifiable map of attribute names to attribute values for >+ * this requirement, or an empty map if this requirement has no >+ * attributes. >+ */ >+ Map<String, Object> getAttributes(); >+ >+ /** >+ * Returns the resource declaring this requirement. If there is no resource >+ * declaring this requirement, {@code null} is returned. >+ * >+ * @return The resource declaring this requirement, if any. >+ */ >+ Resource getResource(); >+ >+ /** >+ * Returns whether the specified capability matches this requirement. A >+ * capability matches this requirement when all of the following are true: >+ * <ul> >+ * <li>The specified capability has the same {@link #getNamespace() name >+ * space} as this requirement. >+ * <li>The filter specified by the {@link Constants#FILTER_DIRECTIVE filter} >+ * directive of this requirement matches the >+ * {@link Capability#getAttributes() attributes of the specified capability}. >+ * <li>The {@link #getDirectives() requirement directives} and the >+ * {@link Capability#getDirectives() capability directives} that apply to >+ * the name space are satisfied. >+ * </ul> >+ * >+ * >+ * @param capability >+ * The capability to match to this requirement. >+ * @return {@code true} if the specified capability matches this this >+ * requirement. {@link #getNamespace() name space} as this >+ * requirement and the filter for this requirement matches the >+ * {@link BundleCapability#getAttributes() attributes of the >+ * specified capability}; {@code false} otherwise. >+ */ >+ // TODO much debate on the placement and need for this method. >+ boolean matches(Capability capability); >+} >Index: osgi/src/org/osgi/framework/wiring/Resource.java >=================================================================== >RCS file: osgi/src/org/osgi/framework/wiring/Resource.java >diff -N osgi/src/org/osgi/framework/wiring/Resource.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ osgi/src/org/osgi/framework/wiring/Resource.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,46 @@ >+package org.osgi.framework.wiring; >+ >+import java.util.List; >+ >+ >+/** >+ * A resource is the representation of a uniquely identified and typed data. >+ * >+ * A resources can be wired together via capabilities and requirements. >+ * >+ * TODO decide on identity characteristics of a revision. Given in OSGi multiple >+ * bundles can be installed with same bsn/version this cannot be used as a key. >+ * >+ * What then is identity of a resource? Object identity? URI (needs getter >+ * method?) >+ * >+ * @ThreadSafe >+ * @version $Id: ec3a00454c760f49059b1890f5212e528e65926e $ >+ */ >+public interface Resource { >+ /** >+ * Returns the capabilities declared by this resource. >+ * >+ * @param namespace >+ * The name space of the declared capabilities to return or >+ * {@code null} to return the declared capabilities from all name >+ * spaces. >+ * @return A list containing a snapshot of the declared {@link Capability}s, >+ * or an empty list if this resource declares no capabilities in the >+ * specified name space. >+ */ >+ List<Capability> getCapabilities(String namespace); >+ >+ /** >+ * Returns the requirements declared by this bundle resource. >+ * >+ * @param namespace >+ * The name space of the declared requirements to return or >+ * {@code null} to return the declared requirements from all name >+ * spaces. >+ * @return A list containing a snapshot of the declared {@link Requirement} >+ * s, or an empty list if this resource declares no requirements in >+ * the specified name space. >+ */ >+ List<Requirement> getRequirements(String namespace); >+} >Index: osgi/src/org/osgi/framework/wiring/ResourceConstants.java >=================================================================== >RCS file: osgi/src/org/osgi/framework/wiring/ResourceConstants.java >diff -N osgi/src/org/osgi/framework/wiring/ResourceConstants.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ osgi/src/org/osgi/framework/wiring/ResourceConstants.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,372 @@ >+/* >+ * Copyright (c) OSGi Alliance (2011). All Rights Reserved. >+ * >+ * Licensed under the Apache License, Version 2.0 (the "License"); >+ * you may not use this file except in compliance with the License. >+ * You may obtain a copy of the License at >+ * >+ * http://www.apache.org/licenses/LICENSE-2.0 >+ * >+ * Unless required by applicable law or agreed to in writing, software >+ * distributed under the License is distributed on an "AS IS" BASIS, >+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. >+ * See the License for the specific language governing permissions and >+ * limitations under the License. >+ */ >+package org.osgi.framework.wiring; >+ >+import org.osgi.framework.Constants; >+import org.osgi.framework.Version; >+ >+/** >+ * Defines standard names for the attributes, directives and name spaces for >+ * resources, capabilities and requirements. >+ * >+ * <p> >+ * The values associated with these keys are of type {@code String}, unless >+ * otherwise indicated. >+ * >+ * @version $Id: 6a0df41f82a587eb72c0c513fdd0411f18564586 $ >+ */ >+public final class ResourceConstants { >+ >+ private ResourceConstants() { >+ // keep others from creating objects of this type. >+ } >+ >+ /** >+ * Name space for the identity capability. Each {@link Resource resource} >+ * provides exactly one<sup>†</sup> identity capability that can be >+ * used to identify the resource. >+ * >+ * For identity capability attributes the following applies: >+ * <ul> >+ * <li>The >+ * <q>osgi.identity</q> attribute contains the symbolic name of the >+ * resource. >+ * <li>The {@link #IDENTITY_VERSION_ATTRIBUTE version} attribute contains >+ * the {@link Version} of the resource. >+ * <li>The {@link #IDENTITY_TYPE_ATTRIBUTE type} attribute contains the >+ * resource type. >+ * </ul> >+ * <p> >+ * A resource with a symbolic name >+ * {@link Resource#getCapabilities(String) provides} exactly one >+ * <sup>†</sup> identity >+ * {@link Resource#getCapabilities(String) capability}. >+ * <p> >+ * For a {@link BundleRevision revision} with a symbolic name the >+ * {@link BundleWiring wiring} for the revision >+ * {@link BundleWiring#getCapabilities(String) provides} exactly >+ * one<sup>†</sup> identity capability. >+ * <p> >+ * † A resource with no symbolic name must not provide an identity >+ * capability. >+ */ >+ public static final String IDENTITY_NAMESPACE = "osgi.identity"; >+ >+ /** >+ * An {@link #IDENTITY_NAMESPACE identity} capability attribute identifying the >+ * {@link Version version} of the resource. This attribute must be set to a value of >+ * type {@link Version}. If the resource has no version then the value >+ * {@link Version#emptyVersion 0.0.0} must be used for the attribute. >+ */ >+ public static final String IDENTITY_VERSION_ATTRIBUTE = Constants.VERSION_ATTRIBUTE; >+ >+ /** >+ * An {@link #IDENTITY_NAMESPACE identity} capability attribute identifying the >+ * resource type. This attribute must be set to a value of type {@link String}. >+ * if the resource has no type then the value >+ * {@link ResourceConstants#IDENTITY_TYPE_UNKNOWN unknown} must be used for the >+ * attribute. >+ */ >+ public static final String IDENTITY_TYPE_ATTRIBUTE = "type"; >+ >+ /** >+ * An {@link #IDENTITY_NAMESPACE identity} capability {@link #IDENTITY_TYPE_ATTRIBUTE type} >+ * attribute value identifying the resource type as an OSGi bundle. >+ */ >+ public static final String IDENTITY_TYPE_BUNDLE = "osgi.bundle"; >+ >+ /** >+ * An {@link #IDENTITY_NAMESPACE identity} capability {@link #IDENTITY_TYPE_ATTRIBUTE type} >+ * attribute value identifying the resource type as an OSGi fragment. >+ */ >+ public static final String IDENTITY_TYPE_FRAGMENT = "osgi.fragment"; >+ >+ /** >+ * An {@link #IDENTITY_NAMESPACE identity} capability {@link #IDENTITY_TYPE_ATTRIBUTE type} >+ * attribute value identifying the resource type as unknown. >+ */ >+ public static final String IDENTITY_TYPE_UNKNOWN = "unknown"; >+ >+ /** >+ * An {@link #IDENTITY_NAMESPACE identity} capability {@link Requirement#getDirectives() directive} >+ * identifying if the resource is a singleton. A {@link String} value of "true" indicates >+ * the resource is a singleton; any other value or <code>null</code> indicates the resource is not a >+ * singleton. >+ */ >+ public static final String IDENTITY_SINGLETON_DIRECTIVE = Constants.SINGLETON_DIRECTIVE; >+ >+ /** >+ * Name space for package capabilities and requirements. >+ * >+ * For capability attributes the following applies: >+ * <ul> >+ * <li>The >+ * <q>osgi.wiring.package</q> attribute contains the name of the package. >+ * <li>The {@link Constants#VERSION_ATTRIBUTE version} attribute contains >+ * the the {@link Version} of the package if one is specified or >+ * {@link Version#emptyVersion} if not specified. >+ * <li>The {@link Constants#BUNDLE_SYMBOLICNAME_ATTRIBUTE >+ * bundle-symbolic-name} attribute contains the symbolic name of the >+ * resource providing the package if one is specified. >+ * <li>The {@link Constants#BUNDLE_VERSION_ATTRIBUTE bundle-version} >+ * attribute contains the {@link Version} of resource providing the package >+ * if one is specified or {@link Version#emptyVersion} if not specified. >+ * <li>All other attributes are of type {@link String} and are used as >+ * arbitrary matching attributes for the capability. >+ * </ul> >+ * <p> >+ * A resource provides zero or more package >+ * {@link Resource#getCapabilities(String) capabilities} (this is, exported >+ * packages) and requires zero or more package >+ * {@link Resource#getRequirements(String) requirements} (that is, imported >+ * packages). >+ */ >+ public static final String WIRING_PACKAGE_NAMESPACE = "osgi.wiring.package"; >+ >+ /** >+ * Name space for bundle capabilities and requirements. >+ * >+ * For capability attributes the following applies: >+ * <ul> >+ * <li>The >+ * <q>osgi.wiring.bundle</q> attribute contains the symbolic name of the >+ * bundle. >+ * <li>The {@link Constants#BUNDLE_VERSION_ATTRIBUTE bundle-version} >+ * attribute contains the {@link Version} of the bundle if one is specified >+ * or {@link Version#emptyVersion} if not specified. >+ * <li>All other attributes are of type {@link String} and are used as >+ * arbitrary matching attributes for the capability. >+ * </ul> >+ * <p> >+ * A non-fragment resource with the {@link #IDENTITY_TYPE_BUNDLE >+ * osgi.bundle} type {@link #IDENTITY_TYPE_ATTRIBUTE identity} provides >+ * exactly one <sup>†</sup> bundle >+ * {@link Resource#getCapabilities(String) capability} (that is, the bundle >+ * can be required by another bundle). A fragment resource with the >+ * {@link #IDENTITY_TYPE_FRAGMENT osgi.fragment} type >+ * {@link #IDENTITY_TYPE_ATTRIBUTE identity} must not declare >+ * a bundle capability. A resource requires zero or more bundle >+ * {@link Resource#getRequirements(String) requirements} (that is, required >+ * bundles). >+ * <p> >+ * † A resource with no symbolic name must not provide a bundle >+ * capability. >+ */ >+ public static final String WIRING_BUNDLE_NAMESPACE = "osgi.wiring.bundle"; >+ >+ /** >+ * Name space for host capabilities and requirements. >+ * >+ * For capability attributes the following applies: >+ * <ul> >+ * <li>The >+ * <q>osgi.wiring.host</q> attribute contains the symbolic name of the >+ * bundle. >+ * <li>The {@link Constants#BUNDLE_VERSION_ATTRIBUTE bundle-version} >+ * attribute contains the {@link Version} of the bundle if one is specified >+ * or {@link Version#emptyVersion} if not specified. >+ * <li>All other attributes are of type {@link String} and are used as >+ * arbitrary matching attributes for the capability. >+ * </ul> >+ * <p> >+ * <p> >+ * A non-fragment resource with the with the {@link #IDENTITY_TYPE_BUNDLE >+ * osgi.bundle} type {@link #IDENTITY_TYPE_ATTRIBUTE identity} provides >+ * zero or one <sup>†</sup> host >+ * {@link Resource#getCapabilities(String) capabilities}. >+ * A fragment resource with the >+ * {@link #IDENTITY_TYPE_FRAGMENT osgi.fragment} type >+ * {@link #IDENTITY_TYPE_ATTRIBUTE identity} must not declare >+ * a host capability and must >+ * {@link Resource#getRequirements(String) declare} exactly one host >+ * requirement. >+ * <p> >+ * † A resource with no bundle symbolic name must not provide a host >+ * capability. >+ */ >+ public static final String WIRING_HOST_NAMESPACE = "osgi.wiring.host"; >+ >+ /** >+ * A requirement {@link Requirement#getDirectives() directive} used to >+ * specify a capability filter. This filter is used to match against a >+ * capability's {@link Capability#getAttributes() attributes}. >+ */ >+ public final static String REQUIREMENT_FILTER_DIRECTIVE = Constants.FILTER_DIRECTIVE; >+ >+ /** >+ * A requirement {@link Requirement#getDirectives() directive} used to >+ * specify the resolution type for a requirement. The default value is >+ * {@link #REQUIREMENT_RESOLUTION_MANDATORY mandatory}. >+ * >+ * @see #REQUIREMENT_RESOLUTION_MANDATORY mandatory >+ * @see #REQUIREMENT_RESOLUTION_OPTIONAL optional >+ */ >+ public final static String REQUIREMENT_RESOLUTION_DIRECTIVE = Constants.RESOLUTION_DIRECTIVE; >+ /** >+ * A directive value identifying a mandatory >+ * {@link Resource#getRequirements(String) requirement} resolution type. A >+ * mandatory resolution type indicates that the requirement must be resolved >+ * when the {@link Resource resource} is resolved. If such requirement >+ * cannot be resolved, the resource fails to resolve. >+ * >+ * @see #REQUIREMENT_RESOLUTION_DIRECTIVE >+ */ >+ public final static String REQUIREMENT_RESOLUTION_MANDATORY = Constants.RESOLUTION_MANDATORY; >+ >+ /** >+ * A directive value identifying an optional >+ * {@link Resource#getRequirements(String) requirement} resolution type. An >+ * optional resolution type indicates that the requirement is optional and >+ * the {@link Resource resource} may be resolved without requirement being >+ * resolved. >+ * >+ * @see #REQUIREMENT_RESOLUTION_DIRECTIVE >+ */ >+ public final static String REQUIREMENT_RESOLUTION_OPTIONAL = Constants.RESOLUTION_OPTIONAL; >+ >+ /** >+ * A requirement {@link Requirement#getDirectives() directive} used to >+ * specify the effective time for the requirement. The default value is >+ * {@link #EFFECTIVE_RESOLVE resolve}. >+ * >+ * @see #EFFECTIVE_RESOLVE resolve >+ * @see #EFFECTIVE_ACTIVE active >+ */ >+ public final static String REQUIREMENT_EFFECTIVE_DIRECTIVE = Constants.EFFECTIVE_DIRECTIVE; >+ >+ /** >+ * A directive value identifying a {@link #CAPABILITY_EFFECTIVE_DIRECTIVE >+ * capability} or {@link #REQUIREMENT_EFFECTIVE_DIRECTIVE requirement} that >+ * is effective at resolve time. Capabilities and requirements with an >+ * effective time of resolve are the only capabilities which are processed >+ * while resolving a resource. >+ * >+ * @see #REQUIREMENT_EFFECTIVE_DIRECTIVE >+ * @see #CAPABILITY_EFFECTIVE_DIRECTIVE >+ */ >+ public final static String EFFECTIVE_RESOLVE = Constants.EFFECTIVE_RESOLVE; >+ >+ /** >+ * A directive value identifying a {@link #CAPABILITY_EFFECTIVE_DIRECTIVE >+ * capability} or {@link #REQUIREMENT_EFFECTIVE_DIRECTIVE requirement} that >+ * is effective at active time. Capabilities and requirements with an >+ * effective time of active are ignored while resolving a resource. >+ * >+ * @see #REQUIREMENT_EFFECTIVE_DIRECTIVE >+ * @see #CAPABILITY_EFFECTIVE_DIRECTIVE >+ */ >+ public final static String EFFECTIVE_ACTIVE = Constants.EFFECTIVE_ACTIVE; >+ >+ /** >+ * A requirement {@link Requirement#getDirectives() directive} used to >+ * specify the visibility type for a requirement. The default value is >+ * {@link #REQUIREMENT_VISIBILITY_PRIVATE private}. This directive must only >+ * be used for requirements with the require >+ * {@link #WIRING_BUNDLE_NAMESPACE bundle} name space. >+ * >+ * @see #REQUIREMENT_VISIBILITY_PRIVATE private >+ * @see #REQUIREMENT_VISIBILITY_REEXPORT reexport >+ */ >+ public final static String REQUIREMENT_VISIBILITY_DIRECTIVE = Constants.VISIBILITY_DIRECTIVE; >+ >+ /** >+ * A directive value identifying a private >+ * {@link #REQUIREMENT_VISIBILITY_DIRECTIVE visibility} type. A private >+ * visibility type indicates that any {@link #WIRING_PACKAGE_NAMESPACE >+ * packages} that are exported by the required >+ * {@link #WIRING_BUNDLE_NAMESPACE bundle} are not made visible on the >+ * export signature of the requiring {@link #WIRING_BUNDLE_NAMESPACE bundle} >+ * . >+ * >+ * @see #REQUIREMENT_VISIBILITY_DIRECTIVE >+ */ >+ public final static String REQUIREMENT_VISIBILITY_PRIVATE = Constants.VISIBILITY_PRIVATE; >+ >+ /** >+ * A directive value identifying a reexport >+ * {@link #REQUIREMENT_VISIBILITY_DIRECTIVE visibility} type. A reexport >+ * visibility type indicates any {@link #WIRING_PACKAGE_NAMESPACE packages} >+ * that are exported by the required {@link #WIRING_BUNDLE_NAMESPACE bundle} >+ * are re-exported by the requiring {@link #WIRING_BUNDLE_NAMESPACE bundle}. >+ */ >+ public final static String REQUIREMENT_VISIBILITY_REEXPORT = Constants.VISIBILITY_REEXPORT; >+ >+ /** >+ * A requirement {@link Requirement#getDirectives() directive} used to >+ * specify the cardinality for a requirement. The default value is >+ * {@link #REQUIREMENT_CARDINALITY_SINGULAR singular}. >+ * >+ * @see #REQUIREMENT_CARDINALITY_MULTIPLE multiple >+ * @see #REQUIREMENT_CARDINALITY_SINGULAR singular >+ */ >+ public final static String REQUIREMENT_CARDINALITY_DIRECTIVE = "cardinality"; >+ >+ /** >+ * A directive value identifying a multiple >+ * {@link #REQUIREMENT_CARDINALITY_DIRECTIVE cardinality} type. >+ */ >+ public final static String REQUIREMENT_CARDINALITY_MULTIPLE = "multiple"; >+ >+ /** >+ * A directive value identifying a singular >+ * {@link #REQUIREMENT_CARDINALITY_DIRECTIVE cardinality} type. >+ */ >+ public final static String REQUIREMENT_CARDINALITY_SINGULAR = "singular"; >+ >+ >+ /** >+ * A capability {@link Capability#getDirectives() directive} used to specify >+ * the comma separated list of {@link #WIRING_PACKAGE_NAMESPACE package} >+ * names a capability uses. >+ */ >+ public final static String CAPABILITY_USES_DIRECTIVE = Constants.USES_DIRECTIVE; >+ >+ /** >+ * A capability {@link Capability#getDirectives() directive} used to specify >+ * the effective time for the capability. The default value is >+ * {@link #EFFECTIVE_RESOLVE resolve}. >+ * >+ * @see #EFFECTIVE_RESOLVE resolve >+ * @see #EFFECTIVE_ACTIVE active >+ */ >+ public final static String CAPABILITY_EFFECTIVE_DIRECTIVE = Constants.EFFECTIVE_DIRECTIVE; >+ >+ /** >+ * A capability {@link Capability#getDirectives() directive} used to specify >+ * the comma separated list of mandatory attributes which must be specified >+ * in the {@link #REQUIREMENT_FILTER_DIRECTIVE filter} of a requirement in >+ * order for the capability to match the requirement. This directive must >+ * only be used for capabilities with the {@link #WIRING_PACKAGE_NAMESPACE >+ * package} name space. >+ */ >+ public final static String CAPABILITY_MANDATORY_DIRECTIVE = "mandatory"; >+ >+ /** >+ * A capability {@link Capability#getDirectives() directive} used to specify >+ * the comma separated list of classes which must be allowed to be exported. >+ * This directive must only be used for capabilities with the >+ * {@link #WIRING_PACKAGE_NAMESPACE package} name space. >+ */ >+ public final static String CAPABILITY_INCLUDE_DIRECTIVE = "include"; >+ >+ /** >+ * A capability {@link Capability#getDirectives() directive} used to specify >+ * the comma separated list of classes which must not be allowed to be >+ * exported. This directive must only be used for capabilities with the >+ * {@link #WIRING_PACKAGE_NAMESPACE package} name space. >+ */ >+ public final static String CAPABILITY_EXCLUDE_DIRECTIVE = "exclude"; >+} >Index: osgi/src/org/osgi/framework/wiring/Wire.java >=================================================================== >RCS file: osgi/src/org/osgi/framework/wiring/Wire.java >diff -N osgi/src/org/osgi/framework/wiring/Wire.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ osgi/src/org/osgi/framework/wiring/Wire.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,57 @@ >+/* >+ * Copyright (c) OSGi Alliance (2011). All Rights Reserved. >+ * >+ * Licensed under the Apache License, Version 2.0 (the "License"); >+ * you may not use this file except in compliance with the License. >+ * You may obtain a copy of the License at >+ * >+ * http://www.apache.org/licenses/LICENSE-2.0 >+ * >+ * Unless required by applicable law or agreed to in writing, software >+ * distributed under the License is distributed on an "AS IS" BASIS, >+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. >+ * See the License for the specific language governing permissions and >+ * limitations under the License. >+ */ >+ >+package org.osgi.framework.wiring; >+ >+/** >+ * A wire connecting a {@link Capability} to a {@link Requirement}. >+ * >+ * @ThreadSafe >+ * @version $Id: 328ede0f8ddf3795594a8e0fc2cb11bbe7fa38fc $ >+ */ >+public interface Wire { >+ /** >+ * Returns the {@link Capability} for this wire. >+ * >+ * @return The {@link Capability} for this wire. >+ */ >+ Capability getCapability(); >+ >+ /** >+ * Return the {@link Requirement} for this wire. >+ * >+ * @return The {@link Requirement} for this wire. >+ */ >+ Requirement getRequirement(); >+ >+ /** >+ * Return the providing {@link Resource resource} of the {@link #getCapability() capability}. >+ * <p> >+ * The resource returned may differ from the resource referenced by the {@link #getCapability() >+ * capability}. >+ * @return the providing {@link Resource resource}. >+ */ >+ Resource getProvider(); >+ >+ /** >+ * Return the requiring {@link Resource resource} of the {@link #getRequirement() requirement}. >+ * <p> >+ * The resource returned my differ from the resource referenced by the {@link #getRequirement() >+ * requirement} >+ * @return the requiring {@link Resource resource}. >+ */ >+ Resource getRequirer(); >+} >Index: resolver/src/org/eclipse/osgi/internal/module/ResolverBundle.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/framework/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverBundle.java,v >retrieving revision 1.43 >diff -u -r1.43 ResolverBundle.java >--- resolver/src/org/eclipse/osgi/internal/module/ResolverBundle.java 16 Feb 2011 20:45:18 -0000 1.43 >+++ resolver/src/org/eclipse/osgi/internal/module/ResolverBundle.java 29 Jun 2011 19:37:43 -0000 >@@ -16,6 +16,7 @@ > import org.eclipse.osgi.internal.resolver.GenericDescriptionImpl; > import org.eclipse.osgi.service.resolver.*; > import org.osgi.framework.Constants; >+import org.osgi.framework.wiring.ResourceConstants; > > /* > * A companion to BundleDescription from the state used while resolving. >@@ -62,7 +63,16 @@ > imports = new ResolverImport[0]; > requires = new BundleConstraint[0]; > genericReqiures = new GenericConstraint[0]; >- genericCapabilities = new GenericCapability[0]; >+ GenericDescription[] capabilities = getBundleDescription().getGenericCapabilities(); >+ GenericCapability identity = null; >+ for (GenericDescription capability : capabilities) { >+ if (ResourceConstants.IDENTITY_NAMESPACE.equals(capability.getType())) { >+ identity = new GenericCapability(this, capability); >+ break; >+ } >+ } >+ >+ genericCapabilities = identity == null ? new GenericCapability[0] : new GenericCapability[] {identity}; > return; > } > >@@ -311,8 +321,6 @@ > return; // do not allow fragments with conflicting constraints > if (isResolved() && newExports.length > 0) > fragment.setNewFragmentExports(true); >- if (isResolved() && newGenericCapabilities.length > 0) >- fragment.setNewFragmentCapabilities(true); > > initFragments(); > // need to make sure there is not already another version of this fragment >@@ -371,10 +379,16 @@ > List<GenericCapability> hostCapabilities = new ArrayList<GenericCapability>(newGenericCapabilities.length); > if (newGenericCapabilities.length > 0 && dynamicAttach) { > for (GenericDescription capability : newGenericCapabilities) { >- GenericDescription hostCapabililty = new GenericDescriptionImpl(getBundleDescription(), capability); >- hostCapabilities.add(new GenericCapability(this, hostCapabililty)); >+ if (!ResourceConstants.IDENTITY_NAMESPACE.equals(capability.getType())) { >+ GenericDescription hostCapabililty = new GenericDescriptionImpl(getBundleDescription(), capability); >+ hostCapabilities.add(new GenericCapability(this, hostCapabililty)); >+ } >+ } >+ if (hostCapabilities.size() > 0) { >+ fragmentGenericCapabilities.put(fragment.bundleID, hostCapabilities); >+ if (isResolved()) >+ fragment.setNewFragmentCapabilities(true); > } >- fragmentGenericCapabilities.put(fragment.bundleID, hostCapabilities); > } > if (dynamicAttach) { > resolver.getResolverExports().put(hostExports.toArray(new ResolverExport[hostExports.size()])); >Index: resolver/src/org/eclipse/osgi/internal/module/ResolverImpl.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/framework/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverImpl.java,v >retrieving revision 1.112 >diff -u -r1.112 ResolverImpl.java >--- resolver/src/org/eclipse/osgi/internal/module/ResolverImpl.java 9 Jun 2011 20:08:44 -0000 1.112 >+++ resolver/src/org/eclipse/osgi/internal/module/ResolverImpl.java 29 Jun 2011 19:37:43 -0000 >@@ -1333,7 +1333,7 @@ > if (namespace == null) > capabilities = Collections.EMPTY_LIST; > else >- capabilities = name == null || "*".equals(name) ? namespace.getAllValues() : namespace.get(name); //$NON-NLS-1$ >+ capabilities = name == null || name.indexOf('*') >= 0 ? namespace.getAllValues() : namespace.get(name); > List<GenericCapability> candidates = new ArrayList<GenericCapability>(capabilities); > List<BundleCapability> genCapabilities = new ArrayList<BundleCapability>(candidates.size()); > // Must remove candidates that do not match before calling hooks. >@@ -1359,14 +1359,25 @@ > result = true; // Wired to ourselves > continue; > } >- ResolverBundle supplier = capability.getResolverBundle(); >- // if in dev mode then allow a constraint to resolve to an unresolved bundle >- if (supplier.getState() == ResolverBundle.RESOLVED || (resolveBundle(supplier, cycle) || developmentMode)) { >- // Check cyclic dependencies >- if (supplier.getState() == ResolverBundle.RESOLVING) >- if (!cycle.contains(supplier)) >- cycle.add(supplier); >- } else { >+ VersionSupplier[] capabilityHosts = capability.getResolverBundle().isFragment() ? capability.getResolverBundle().getHost().getPossibleSuppliers() : new ResolverBundle[] {capability.getResolverBundle()}; >+ boolean foundResolvedMatch = false; >+ for (int i = 0; capabilityHosts != null && i < capabilityHosts.length; i++) { >+ ResolverBundle capabilitySupplier = capabilityHosts[i].getResolverBundle(); >+ if (capabilitySupplier == constraint.getBundle()) { >+ // the capability is from a fragment attached to this host do not recursively resolve the host again >+ foundResolvedMatch = true; >+ continue; >+ } >+ // if in dev mode then allow a constraint to resolve to an unresolved bundle >+ if (capabilitySupplier.getState() == ResolverBundle.RESOLVED || (resolveBundle(capabilitySupplier, cycle) || developmentMode)) { >+ foundResolvedMatch |= !capability.getResolverBundle().isFragment() ? true : capability.getResolverBundle().getHost().getPossibleSuppliers() != null; >+ // Check cyclic dependencies >+ if (capabilitySupplier.getState() == ResolverBundle.RESOLVING) >+ if (!cycle.contains(capabilitySupplier)) >+ cycle.add(capabilitySupplier); >+ } >+ } >+ if (!foundResolvedMatch) { > constraint.removePossibleSupplier(capability); > continue; // constraint hasn't resolved > } >Index: resolver/src/org/eclipse/osgi/internal/resolver/BaseDescriptionImpl.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/framework/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/BaseDescriptionImpl.java,v >retrieving revision 1.12 >diff -u -r1.12 BaseDescriptionImpl.java >--- resolver/src/org/eclipse/osgi/internal/resolver/BaseDescriptionImpl.java 10 Jun 2011 14:13:25 -0000 1.12 >+++ resolver/src/org/eclipse/osgi/internal/resolver/BaseDescriptionImpl.java 29 Jun 2011 19:37:43 -0000 >@@ -156,5 +156,9 @@ > public String toString() { > return getNamespace() + BaseDescriptionImpl.toString(getAttributes(), false) + BaseDescriptionImpl.toString(getDirectives(), true); > } >+ >+ public BundleRevision getResource() { >+ return getRevision(); >+ } > } > } >Index: resolver/src/org/eclipse/osgi/internal/resolver/BundleDescriptionImpl.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/framework/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/BundleDescriptionImpl.java,v >retrieving revision 1.68 >diff -u -r1.68 BundleDescriptionImpl.java >--- resolver/src/org/eclipse/osgi/internal/resolver/BundleDescriptionImpl.java 10 Jun 2011 14:13:25 -0000 1.68 >+++ resolver/src/org/eclipse/osgi/internal/resolver/BundleDescriptionImpl.java 29 Jun 2011 19:37:43 -0000 >@@ -1031,6 +1031,14 @@ > public String toString() { > return getRequirement() + " -> " + getCapability(); //$NON-NLS-1$ > } >+ >+ public BundleRevision getProvider() { >+ return provider.getRevision(); >+ } >+ >+ public BundleRevision getRequirer() { >+ return requirer.getRevision(); >+ } > } > > // Note that description wiring are identity equality based >@@ -1056,11 +1064,14 @@ > public List<BundleCapability> getCapabilities(String namespace) { > if (!isInUse()) > return null; >- @SuppressWarnings("unchecked") >- List<BundleCapability> result = Collections.EMPTY_LIST; >+ List<BundleCapability> result = new ArrayList<BundleCapability>(); >+ GenericDescription[] genericCapabilities = getSelectedGenericCapabilities(); >+ for (GenericDescription capabilitiy : genericCapabilities) { >+ if (namespace == null || namespace.equals(capabilitiy.getType())) >+ result.add(capabilitiy.getCapability()); >+ } > if (host != null) > return result; >- result = new ArrayList<BundleCapability>(); > if (getSymbolicName() != null) { > if (namespace == null || BundleRevision.BUNDLE_NAMESPACE.equals(namespace)) { > result.add(BundleDescriptionImpl.this.getCapability()); >@@ -1074,11 +1085,6 @@ > for (ExportPackageDescription exportPkg : exports) > result.add(exportPkg.getCapability()); > } >- GenericDescription[] genericCapabilities = getSelectedGenericCapabilities(); >- for (GenericDescription capabilitiy : genericCapabilities) { >- if (namespace == null || namespace.equals(capabilitiy.getType())) >- result.add(capabilitiy.getCapability()); >- } > return result; > } > >@@ -1093,7 +1099,8 @@ > requirements.add(wire.getRequirement()); > } > // get dynamic imports >- if (namespace == null || BundleRevision.PACKAGE_NAMESPACE.equals(namespace)) { >+ if (getHost() == null && (namespace == null || BundleRevision.PACKAGE_NAMESPACE.equals(namespace))) { >+ // TODO need to handle fragments that add dynamic imports > if (hasDynamicImports()) { > ImportPackageSpecification[] imports = getImportPackages(); > for (ImportPackageSpecification impPackage : imports) { >@@ -1230,4 +1237,14 @@ > return BundleDescriptionImpl.this.toString(); > } > } >+ >+ @SuppressWarnings({"cast", "unchecked", "rawtypes"}) >+ public List<Capability> getCapabilities(String namespace) { >+ return (List<Capability>) (List) getDeclaredCapabilities(namespace); >+ } >+ >+ @SuppressWarnings({"cast", "unchecked", "rawtypes"}) >+ public List<Requirement> getRequirements(String namespace) { >+ return (List<Requirement>) (List) getDeclaredRequirements(namespace); >+ } > } >Index: resolver/src/org/eclipse/osgi/internal/resolver/BundleSpecificationImpl.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/framework/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/BundleSpecificationImpl.java,v >retrieving revision 1.12 >diff -u -r1.12 BundleSpecificationImpl.java >--- resolver/src/org/eclipse/osgi/internal/resolver/BundleSpecificationImpl.java 10 Jun 2011 14:13:25 -0000 1.12 >+++ resolver/src/org/eclipse/osgi/internal/resolver/BundleSpecificationImpl.java 29 Jun 2011 19:37:43 -0000 >@@ -91,7 +91,17 @@ > } > } > String[] mandatory = (String[]) candidate.getDirective(Constants.MANDATORY_DIRECTIVE); >+ if (!hasMandatoryAttributes(mandatory)) >+ return false; >+ if (getName() != null && getName().equals(candidate.getSymbolicName()) && (getVersionRange() == null || getVersionRange().isIncluded(candidate.getVersion()))) >+ return true; >+ return false; >+ } >+ >+ @Override >+ protected boolean hasMandatoryAttributes(String[] mandatory) { > if (mandatory != null) { >+ Map<String, ?> requiredAttrs = getAttributes(); > for (String key : mandatory) { > if (Constants.BUNDLE_VERSION_ATTRIBUTE.equals(key)) > continue; // has a default value of 0.0.0 >@@ -99,9 +109,7 @@ > return false; > } > } >- if (getName() != null && getName().equals(candidate.getSymbolicName()) && (getVersionRange() == null || getVersionRange().isIncluded(candidate.getVersion()))) >- return true; >- return false; >+ return true; > } > > public String toString() { >Index: resolver/src/org/eclipse/osgi/internal/resolver/GenericSpecificationImpl.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/framework/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/GenericSpecificationImpl.java,v >retrieving revision 1.10 >diff -u -r1.10 GenericSpecificationImpl.java >--- resolver/src/org/eclipse/osgi/internal/resolver/GenericSpecificationImpl.java 10 Jun 2011 14:13:25 -0000 1.10 >+++ resolver/src/org/eclipse/osgi/internal/resolver/GenericSpecificationImpl.java 29 Jun 2011 19:37:43 -0000 >@@ -57,6 +57,11 @@ > return matchingFilter == null || matchingFilter.match(candidate.getAttributes()); > } > >+ @Override >+ protected boolean hasMandatoryAttributes(String[] mandatory) { >+ return true; >+ } >+ > public String toString() { > StringBuffer sb = new StringBuffer(); > sb.append(Constants.REQUIRE_CAPABILITY).append(": ").append(getType()); //$NON-NLS-1$ >Index: resolver/src/org/eclipse/osgi/internal/resolver/HostSpecificationImpl.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/framework/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/HostSpecificationImpl.java,v >retrieving revision 1.15 >diff -u -r1.15 HostSpecificationImpl.java >--- resolver/src/org/eclipse/osgi/internal/resolver/HostSpecificationImpl.java 10 Jun 2011 14:13:25 -0000 1.15 >+++ resolver/src/org/eclipse/osgi/internal/resolver/HostSpecificationImpl.java 29 Jun 2011 19:37:43 -0000 >@@ -69,14 +69,8 @@ > } > } > String[] mandatory = (String[]) candidate.getDirective(Constants.MANDATORY_DIRECTIVE); >- if (mandatory != null) { >- for (String key : mandatory) { >- if (Constants.BUNDLE_VERSION_ATTRIBUTE.equals(key)) >- continue; // has a default value of 0.0.0 >- if (requiredAttrs == null || requiredAttrs.get(key) == null) >- return false; >- } >- } >+ if (!hasMandatoryAttributes(mandatory)) >+ return false; > if (getName() != null && getName().equals(candidate.getSymbolicName()) && (getVersionRange() == null || getVersionRange().isIncluded(candidate.getVersion()))) > return true; > return false; >@@ -88,6 +82,20 @@ > } > } > >+ @Override >+ protected boolean hasMandatoryAttributes(String[] mandatory) { >+ if (mandatory != null) { >+ Map<String, ?> requiredAttrs = getAttributes(); >+ for (String key : mandatory) { >+ if (Constants.BUNDLE_VERSION_ATTRIBUTE.equals(key)) >+ continue; // has a default value of 0.0.0 >+ if (requiredAttrs == null || requiredAttrs.get(key) == null) >+ return false; >+ } >+ } >+ return true; >+ } >+ > public boolean isResolved() { > synchronized (this.monitor) { > return hosts != null && hosts.length > 0; >Index: resolver/src/org/eclipse/osgi/internal/resolver/ImportPackageSpecificationImpl.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/framework/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/ImportPackageSpecificationImpl.java,v >retrieving revision 1.24 >diff -u -r1.24 ImportPackageSpecificationImpl.java >--- resolver/src/org/eclipse/osgi/internal/resolver/ImportPackageSpecificationImpl.java 10 Jun 2011 14:13:25 -0000 1.24 >+++ resolver/src/org/eclipse/osgi/internal/resolver/ImportPackageSpecificationImpl.java 29 Jun 2011 19:37:43 -0000 >@@ -149,10 +149,22 @@ > } > } > String[] mandatory = (String[]) pkgDes.getDirective(Constants.MANDATORY_DIRECTIVE); >+ if (!hasMandatoryAttributes(mandatory)) >+ return false; >+ // finally check the ee index >+ if (((BundleDescriptionImpl) getBundle()).getEquinoxEE() < 0) >+ return true; >+ int eeIndex = ((Integer) pkgDes.getDirective(ExportPackageDescriptionImpl.EQUINOX_EE)).intValue(); >+ return eeIndex < 0 || eeIndex == ((BundleDescriptionImpl) getBundle()).getEquinoxEE(); >+ } >+ >+ @Override >+ protected boolean hasMandatoryAttributes(String[] mandatory) { > if (mandatory != null) { >+ Map<String, ?> importAttrs = getAttributes(); > for (int i = 0; i < mandatory.length; i++) { > if (Constants.BUNDLE_SYMBOLICNAME_ATTRIBUTE.equals(mandatory[i])) { >- if (exporterSymbolicName == null) >+ if (getBundleSymbolicName() == null) > return false; > } else if (Constants.BUNDLE_VERSION_ATTRIBUTE.equals(mandatory[i])) { > if (bundleVersionRange == null) >@@ -168,11 +180,7 @@ > } > } > } >- // finally check the ee index >- if (((BundleDescriptionImpl) getBundle()).getEquinoxEE() < 0) >- return true; >- int eeIndex = ((Integer) pkgDes.getDirective(ExportPackageDescriptionImpl.EQUINOX_EE)).intValue(); >- return eeIndex < 0 || eeIndex == ((BundleDescriptionImpl) getBundle()).getEquinoxEE(); >+ return true; > } > > protected void setBundleSymbolicName(String symbolicName) { >Index: resolver/src/org/eclipse/osgi/internal/resolver/NativeCodeSpecificationImpl.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/framework/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/NativeCodeSpecificationImpl.java,v >retrieving revision 1.7 >diff -u -r1.7 NativeCodeSpecificationImpl.java >--- resolver/src/org/eclipse/osgi/internal/resolver/NativeCodeSpecificationImpl.java 16 Feb 2011 20:45:17 -0000 1.7 >+++ resolver/src/org/eclipse/osgi/internal/resolver/NativeCodeSpecificationImpl.java 29 Jun 2011 19:37:44 -0000 >@@ -145,6 +145,11 @@ > return match; > } > >+ @Override >+ protected boolean hasMandatoryAttributes(String[] mandatory) { >+ return true; >+ } >+ > public String toString() { > StringBuffer sb = new StringBuffer(); > NativeCodeDescription[] suppliers = getPossibleSuppliers(); >Index: resolver/src/org/eclipse/osgi/internal/resolver/StateBuilder.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/framework/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateBuilder.java,v >retrieving revision 1.72 >diff -u -r1.72 StateBuilder.java >--- resolver/src/org/eclipse/osgi/internal/resolver/StateBuilder.java 10 Jun 2011 14:13:25 -0000 1.72 >+++ resolver/src/org/eclipse/osgi/internal/resolver/StateBuilder.java 29 Jun 2011 19:37:44 -0000 >@@ -19,6 +19,7 @@ > import org.eclipse.osgi.util.ManifestElement; > import org.eclipse.osgi.util.NLS; > import org.osgi.framework.*; >+import org.osgi.framework.wiring.ResourceConstants; > > /** > * This class builds bundle description objects from manifests >@@ -118,7 +119,7 @@ > result.setGenericRequires(createGenericRequires(genericRequires, osgiRequires)); > ManifestElement[] genericCapabilities = getGenericCapabilities(manifest, genericAliases); > ManifestElement[] osgiCapabilities = ManifestElement.parseHeader(Constants.PROVIDE_CAPABILITY, manifest.get(Constants.PROVIDE_CAPABILITY)); >- result.setGenericCapabilities(createGenericCapabilities(genericCapabilities, osgiCapabilities)); >+ result.setGenericCapabilities(createGenericCapabilities(genericCapabilities, osgiCapabilities, result)); > ManifestElement[] nativeCode = ManifestElement.parseHeader(Constants.BUNDLE_NATIVECODE, manifest.get(Constants.BUNDLE_NATIVECODE)); > result.setNativeCodeSpecification(createNativeCode(nativeCode)); > return result; >@@ -554,13 +555,24 @@ > return results; > } > >- private static GenericDescription[] createGenericCapabilities(ManifestElement[] equinoxCapabilities, ManifestElement[] osgiCapabilities) { >+ private static GenericDescription[] createGenericCapabilities(ManifestElement[] equinoxCapabilities, ManifestElement[] osgiCapabilities, BundleDescription description) throws BundleException { > List<GenericDescription> result = createEquinoxCapabilities(equinoxCapabilities); >- result = createOSGiCapabilities(osgiCapabilities, result); >+ result = createOSGiCapabilities(osgiCapabilities, result, description); > return result == null ? null : result.toArray(new GenericDescription[result.size()]); > } > >- static List<GenericDescription> createOSGiCapabilities(ManifestElement[] osgiCapabilities, List<GenericDescription> result) { >+ private static List<GenericDescription> createOSGiCapabilities(ManifestElement[] osgiCapabilities, List<GenericDescription> result, BundleDescription description) throws BundleException { >+ if (result == null) >+ result = new ArrayList<GenericDescription>(osgiCapabilities == null ? 1 : osgiCapabilities.length + 1); >+ // Always have an osgi.identity capability if there is a symbolic name. >+ GenericDescription osgiIdentity = createOsgiIdentityCapability(description); >+ if (osgiIdentity != null) >+ // always add the capability to the front >+ result.add(0, osgiIdentity); >+ return createOSGiCapabilities(osgiCapabilities, result); >+ } >+ >+ static List<GenericDescription> createOSGiCapabilities(ManifestElement[] osgiCapabilities, List<GenericDescription> result) throws BundleException { > if (osgiCapabilities == null) > return result; > if (result == null) >@@ -570,8 +582,12 @@ > String[] namespaces = element.getValueComponents(); > types: for (String namespace : namespaces) { > String effective = element.getDirective(Constants.EFFECTIVE_DIRECTIVE); >+ // Any declared osgi.identity capability with an effective directive value of "resolve" will be overridden. > if (effective != null && !Constants.EFFECTIVE_RESOLVE.equals(effective)) > break types; // ignore any namespace that is not effective at resolve time. >+ if (ResourceConstants.IDENTITY_NAMESPACE.equals(namespace)) >+ throw new BundleException("A bundle is not allowed to define a capability in the " + ResourceConstants.IDENTITY_NAMESPACE + " name space."); //$NON-NLS-1$ //$NON-NLS-2$ >+ > GenericDescriptionImpl desc = new GenericDescriptionImpl(); > desc.setType(namespace); > Map<String, Object> mapAttrs = getAttributes(element, new String[0]); >@@ -591,7 +607,7 @@ > return result; > } > >- private static List<GenericDescription> createEquinoxCapabilities(ManifestElement[] equinoxCapabilities) { >+ private static List<GenericDescription> createEquinoxCapabilities(ManifestElement[] equinoxCapabilities) throws BundleException { > if (equinoxCapabilities == null) > return null; > ArrayList<GenericDescription> results = new ArrayList<GenericDescription>(equinoxCapabilities.length); >@@ -604,6 +620,8 @@ > if (colonIdx > 0) { > name = genericNames[j].substring(0, colonIdx); > desc.setType(genericNames[j].substring(colonIdx + 1)); >+ if (ResourceConstants.IDENTITY_NAMESPACE.equals(desc.getType())) >+ throw new BundleException("A bundle is not allowed to define a capability in the " + ResourceConstants.IDENTITY_NAMESPACE + " name space."); //$NON-NLS-1$ //$NON-NLS-2$ > } > Map<String, Object> mapAttrs = getAttributes(equinoxCapabilities[i], new String[] {Constants.VERSION_ATTRIBUTE}); > Dictionary<String, Object> attrs = mapAttrs == null ? new Hashtable<String, Object>() : new Hashtable<String, Object>(mapAttrs); >@@ -748,4 +766,22 @@ > throw new BundleException(message + " : " + NLS.bind(StateMsg.HEADER_EXTENSION_ERROR, hostName), BundleException.MANIFEST_ERROR); //$NON-NLS-1$ > } > } >+ >+ private static GenericDescription createOsgiIdentityCapability(BundleDescription description) { >+ if (description.getSymbolicName() == null) >+ return null; >+ GenericDescriptionImpl result = new GenericDescriptionImpl(); >+ result.setType(ResourceConstants.IDENTITY_NAMESPACE); >+ Dictionary<String, Object> attributes = new Hashtable<String, Object>(); >+ attributes.put(ResourceConstants.IDENTITY_NAMESPACE, description.getSymbolicName()); >+ attributes.put(ResourceConstants.IDENTITY_TYPE_ATTRIBUTE, description.getHost() == null ? ResourceConstants.IDENTITY_TYPE_BUNDLE : ResourceConstants.IDENTITY_TYPE_FRAGMENT); >+ attributes.put(ResourceConstants.IDENTITY_VERSION_ATTRIBUTE, description.getVersion()); >+ result.setAttributes(attributes); >+ Map<String, String> directives = new HashMap<String, String>(); >+ directives.put(ResourceConstants.IDENTITY_SINGLETON_DIRECTIVE, String.valueOf(description.isSingleton())); >+ // The effective directive should be resolve >+ directives.put(ResourceConstants.CAPABILITY_EFFECTIVE_DIRECTIVE, ResourceConstants.EFFECTIVE_RESOLVE); >+ result.setDirectives(directives); >+ return result; >+ } > } >Index: resolver/src/org/eclipse/osgi/internal/resolver/StateImpl.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/framework/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateImpl.java,v >retrieving revision 1.100 >diff -u -r1.100 StateImpl.java >--- resolver/src/org/eclipse/osgi/internal/resolver/StateImpl.java 9 Jun 2011 20:08:44 -0000 1.100 >+++ resolver/src/org/eclipse/osgi/internal/resolver/StateImpl.java 29 Jun 2011 19:37:44 -0000 >@@ -871,7 +871,11 @@ > } > > private void addSystemCapabilities(List<GenericDescription> capabilities, ManifestElement[] elements) { >- StateBuilder.createOSGiCapabilities(elements, capabilities); >+ try { >+ StateBuilder.createOSGiCapabilities(elements, capabilities); >+ } catch (BundleException e) { >+ throw new RuntimeException("Unexpected exception adding system capabilities.", e); //$NON-NLS-1$ >+ } > } > > @SuppressWarnings("rawtypes") >Index: resolver/src/org/eclipse/osgi/internal/resolver/VersionConstraintImpl.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/framework/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/VersionConstraintImpl.java,v >retrieving revision 1.18 >diff -u -r1.18 VersionConstraintImpl.java >--- resolver/src/org/eclipse/osgi/internal/resolver/VersionConstraintImpl.java 10 Jun 2011 14:13:25 -0000 1.18 >+++ resolver/src/org/eclipse/osgi/internal/resolver/VersionConstraintImpl.java 29 Jun 2011 19:37:44 -0000 >@@ -17,7 +17,8 @@ > import org.eclipse.osgi.framework.internal.core.Constants; > import org.eclipse.osgi.internal.resolver.BaseDescriptionImpl.BaseCapability; > import org.eclipse.osgi.service.resolver.*; >-import org.osgi.framework.Version; >+import org.eclipse.osgi.util.ManifestElement; >+import org.osgi.framework.*; > import org.osgi.framework.wiring.*; > > abstract class VersionConstraintImpl implements VersionConstraint { >@@ -101,6 +102,8 @@ > > protected abstract Map<String, Object> getInteralAttributes(); > >+ protected abstract boolean hasMandatoryAttributes(String[] mandatory); >+ > public BundleRequirement getRequirement() { > String namespace = getInternalNameSpace(); > if (namespace == null) >@@ -156,6 +159,26 @@ > public String toString() { > return getNamespace() + BaseDescriptionImpl.toString(getAttributes(), false) + BaseDescriptionImpl.toString(getDirectives(), true); > } >+ >+ public boolean matches(Capability capability) { >+ if (capability instanceof BundleCapability) >+ return matches((BundleCapability) capability); >+ // now we must do the generic thing >+ String filterSpec = getDirectives().get(ResourceConstants.REQUIREMENT_FILTER_DIRECTIVE); >+ boolean match; >+ try { >+ match = FrameworkUtil.createFilter(filterSpec).matches(capability.getAttributes()); >+ } catch (InvalidSyntaxException e) { >+ return false; >+ } >+ if (!match) >+ return false; >+ return hasMandatoryAttributes(ManifestElement.getArrayFromList(capability.getDirectives().get(ResourceConstants.CAPABILITY_MANDATORY_DIRECTIVE))); >+ } >+ >+ public BundleRevision getResource() { >+ return getRevision(); >+ } > } > > static StringBuffer addFilterAttributes(StringBuffer filter, Map<String, ?> attributes) { >#P org.eclipse.osgi.tests >Index: .classpath >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/framework/bundles/org.eclipse.osgi.tests/.classpath,v >retrieving revision 1.30 >diff -u -r1.30 .classpath >--- .classpath 25 Mar 2011 13:22:59 -0000 1.30 >+++ .classpath 29 Jun 2011 19:37:44 -0000 >@@ -111,6 +111,12 @@ > <classpathentry kind="src" output="bundle_tests/test.bug306181b" path="bundles_src/test.bug306181b"/> > <classpathentry kind="src" output="bundle_tests/test.logging.a" path="bundles_src/test.logging.a"/> > <classpathentry kind="src" output="bundle_tests/console.test" path="bundles_src/console.test"/> >+ <classpathentry kind="src" output="bundle_tests/resource.tb1" path="bundles_src/resource.tb1"/> >+ <classpathentry kind="src" output="bundle_tests/resource.tb2" path="bundles_src/resource.tb2"/> >+ <classpathentry kind="src" output="bundle_tests/resource.tf1" path="bundles_src/resource.tf1"/> >+ <classpathentry kind="src" output="bundle_tests/resource.tf2" path="bundles_src/resource.tf2"/> >+ <classpathentry kind="src" output="bundle_tests/resource.tb3" path="bundles_src/resource.tb3"/> >+ <classpathentry kind="src" output="bundle_tests/resource.tb4" path="bundles_src/resource.tb4"/> > <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/> > <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> > <classpathentry kind="output" path="bin"/> >Index: bundles_src/resource.tb1/META-INF/MANIFEST.MF >=================================================================== >RCS file: bundles_src/resource.tb1/META-INF/MANIFEST.MF >diff -N bundles_src/resource.tb1/META-INF/MANIFEST.MF >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ bundles_src/resource.tb1/META-INF/MANIFEST.MF 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,5 @@ >+Manifest-Version: 1.0 >+Bundle-ManifestVersion: 2 >+Bundle-SymbolicName: resource.tb1 >+Bundle-Version: 1.0.0 >+ >Index: bundles_src/resource.tb2/META-INF/MANIFEST.MF >=================================================================== >RCS file: bundles_src/resource.tb2/META-INF/MANIFEST.MF >diff -N bundles_src/resource.tb2/META-INF/MANIFEST.MF >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ bundles_src/resource.tb2/META-INF/MANIFEST.MF 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,3 @@ >+Manifest-Version: 1.0 >+Bundle-ManifestVersion: 1 >+ >Index: bundles_src/resource.tb3/META-INF/MANIFEST.MF >=================================================================== >RCS file: bundles_src/resource.tb3/META-INF/MANIFEST.MF >diff -N bundles_src/resource.tb3/META-INF/MANIFEST.MF >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ bundles_src/resource.tb3/META-INF/MANIFEST.MF 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,9 @@ >+Manifest-Version: 1.0 >+Bundle-ManifestVersion: 2 >+Bundle-SymbolicName: resource.tb3 >+Bundle-Version: 1.0.0 >+Require-Capability: osgi.identity; >+ filter:=(&(osgi.identity=resource.tb1)(version=1.0.0)(type=osgi.bundle)), >+ osgi.identity; >+ filter:=(&(osgi.identity=resource.tf1)(version=1.0.0)(type=osgi.fragment)) >+ >Index: bundles_src/resource.tb4/META-INF/MANIFEST.MF >=================================================================== >RCS file: bundles_src/resource.tb4/META-INF/MANIFEST.MF >diff -N bundles_src/resource.tb4/META-INF/MANIFEST.MF >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ bundles_src/resource.tb4/META-INF/MANIFEST.MF 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,5 @@ >+Manifest-Version: 1.0 >+Bundle-ManifestVersion: 2 >+Bundle-SymbolicName: resource.tb4 >+Bundle-Version: 1.0.0 >+ >Index: bundles_src/resource.tf1/META-INF/MANIFEST.MF >=================================================================== >RCS file: bundles_src/resource.tf1/META-INF/MANIFEST.MF >diff -N bundles_src/resource.tf1/META-INF/MANIFEST.MF >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ bundles_src/resource.tf1/META-INF/MANIFEST.MF 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,8 @@ >+Manifest-Version: 1.0 >+Bundle-ManifestVersion: 2 >+Bundle-SymbolicName: resource.tf1 >+Bundle-Version: 1.0.0 >+Fragment-Host: resource.tb1 >+Require-Capability: osgi.identity; >+ filter:=(&(osgi.identity=resource.tb4)(version=1.0.0)(type=osgi.bundle)) >+ >Index: bundles_src/resource.tf2/META-INF/MANIFEST.MF >=================================================================== >RCS file: bundles_src/resource.tf2/META-INF/MANIFEST.MF >diff -N bundles_src/resource.tf2/META-INF/MANIFEST.MF >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ bundles_src/resource.tf2/META-INF/MANIFEST.MF 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,4 @@ >+Manifest-Version: 1.0 >+Bundle-ManifestVersion: 1 >+Fragment-Host: resource.tb1 >+ >Index: src/org/eclipse/osgi/tests/AutomatedTests.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/framework/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/AutomatedTests.java,v >retrieving revision 1.27 >diff -u -r1.27 AutomatedTests.java >--- src/org/eclipse/osgi/tests/AutomatedTests.java 25 Mar 2011 13:22:59 -0000 1.27 >+++ src/org/eclipse/osgi/tests/AutomatedTests.java 29 Jun 2011 19:37:45 -0000 >@@ -63,6 +63,7 @@ > suite.addTest(AllCompositeTests.suite()); > suite.addTest(org.eclipse.osgi.tests.securityadmin.AllSecurityAdminTests.suite()); > suite.addTest(AllConsoleTests.suite()); >+ suite.addTest(org.eclipse.osgi.tests.resource.AllTests.suite()); > return suite; > } > } >Index: src/org/eclipse/osgi/tests/resource/AbstractResourceTest.java >=================================================================== >RCS file: src/org/eclipse/osgi/tests/resource/AbstractResourceTest.java >diff -N src/org/eclipse/osgi/tests/resource/AbstractResourceTest.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/osgi/tests/resource/AbstractResourceTest.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,42 @@ >+/******************************************************************************* >+ * Copyright (c) 2011 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.osgi.tests.resource; >+ >+import org.eclipse.osgi.tests.OSGiTest; >+import org.eclipse.osgi.tests.OSGiTestsActivator; >+import org.eclipse.osgi.tests.bundles.BundleInstaller; >+import org.osgi.framework.InvalidSyntaxException; >+ >+public abstract class AbstractResourceTest extends OSGiTest { >+ protected BundleInstaller installer; >+ >+ public AbstractResourceTest() { >+ super(); >+ } >+ >+ public AbstractResourceTest(String name) { >+ super(name); >+ } >+ >+ protected void setUp() throws Exception { >+ super.setUp(); >+ try { >+ installer = new BundleInstaller("bundle_tests", OSGiTestsActivator.getContext()); //$NON-NLS-1$ >+ } catch (InvalidSyntaxException e) { >+ fail("Failed to create bundle installer", e); //$NON-NLS-1$ >+ } >+ } >+ >+ protected void tearDown() throws Exception { >+ installer.shutdown(); >+ super.tearDown(); >+ } >+} >Index: src/org/eclipse/osgi/tests/resource/AllTests.java >=================================================================== >RCS file: src/org/eclipse/osgi/tests/resource/AllTests.java >diff -N src/org/eclipse/osgi/tests/resource/AllTests.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/osgi/tests/resource/AllTests.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,22 @@ >+/******************************************************************************* >+ * Copyright (c) 2011 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.osgi.tests.resource; >+ >+import junit.framework.Test; >+import junit.framework.TestSuite; >+ >+public class AllTests { >+ public static Test suite() { >+ TestSuite suite = new TestSuite(AllTests.class.getName()); >+ suite.addTest(IdentityTest.suite()); >+ return suite; >+ } >+} >Index: src/org/eclipse/osgi/tests/resource/IdentityTest.java >=================================================================== >RCS file: src/org/eclipse/osgi/tests/resource/IdentityTest.java >diff -N src/org/eclipse/osgi/tests/resource/IdentityTest.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/osgi/tests/resource/IdentityTest.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,413 @@ >+/******************************************************************************* >+ * Copyright (c) 2011 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.osgi.tests.resource; >+ >+import java.util.List; >+import junit.framework.*; >+import org.osgi.framework.Bundle; >+import org.osgi.framework.Version; >+import org.osgi.framework.wiring.*; >+ >+public class IdentityTest extends AbstractResourceTest { >+ private interface CapabilityProvider { >+ List getCapabilities(String namespace); >+ } >+ >+ private Bundle tb1; >+ private Bundle tb2; >+ private Bundle tb3; >+ private Bundle tb4; >+ private Bundle tf1; >+ private Bundle tf2; >+ >+ public static Test suite() { >+ return new TestSuite(IdentityTest.class); >+ } >+ >+ public IdentityTest(String name) { >+ super(name); >+ } >+ >+ public void testIdentityNamespace() throws Exception { >+ assertTb1(); >+ assertTb2(); >+ assertTb3(); >+ assertTb4(); >+ assertTf1(); >+ assertTf2(); >+ } >+ >+ protected void setUp() throws Exception { >+ super.setUp(); >+ tb1 = installer.installBundle("resource.tb1"); >+ tb2 = installer.installBundle("resource.tb2"); >+ tb3 = installer.installBundle("resource.tb3"); >+ tb4 = installer.installBundle("resource.tb4"); >+ tf1 = installer.installBundle("resource.tf1"); >+ tf2 = installer.installBundle("resource.tf2"); >+ tb1.start(); >+ tb2.start(); >+ tb3.start(); >+ tb4.start(); >+ } >+ >+ /* >+ * TB1 >+ * Requirements: >+ * None >+ * Capabilities: >+ * osgi.identity;osgi.identity=resource.tb1;version=1.0.0;type=osgi.bundle >+ * osgi.wiring.host;osgi.wiring.host=resource.tb1;version=1.0.0 >+ * Wires: >+ * osgi.identity <-> TB3 >+ * osgi.wiring.host <-> TF1 >+ * TB4 <-> osgi.identity (via TF1) >+ */ >+ private void assertTb1() { >+ // Get the revision for TB1. >+ BundleRevision revision = (BundleRevision) tb1.adapt(BundleRevision.class); >+ // Make sure TB1's symbolic name and version match the manifest. >+ String symbolicName = revision.getSymbolicName(); >+ assertSymbolicName("resource.tb1", symbolicName); >+ Version version = revision.getVersion(); >+ assertVersion("1.0.0", version); >+ // Make sure TB1's type is correct. >+ String type = getType(revision); >+ assertType(ResourceConstants.IDENTITY_TYPE_BUNDLE, type); >+ // Check TB1's osgi.identity capability from the revision. >+ Capability capability = getIdentityCapability(revision); >+ assertIdentityCapability(capability, symbolicName, version, type); >+ // Check TB1's osgi.identity capability from the resource. >+ Resource resource = revision; >+ capability = getIdentityCapability(resource); >+ assertIdentityCapability(capability, symbolicName, version, type); >+ // Check TB1's osgi.identity capability from the wiring. >+ BundleWiring wiring = (BundleWiring) tb1.adapt(BundleWiring.class); >+ capability = getIdentityCapability(wiring); >+ assertIdentityCapability(capability, symbolicName, version, type); >+ // There should be 1 provided osgi.identity wire (TB1 -> TB3). >+ List wires = wiring.getProvidedWires(ResourceConstants.IDENTITY_NAMESPACE); >+ assertWires(wires, 1); >+ // Check the osgi.identity wire between TB1 and TB3. >+ Wire wire = (Wire) wires.get(0); >+ BundleRevision requirer = (BundleRevision) tb3.adapt(BundleRevision.class); >+ Requirement requirement = getIdentityRequirement(requirer, 0); >+ assertIdentityWire(wire, capability, revision, requirement, requirer); >+ // There should be 1 required osgi.identity wire (TB4 -> TB1 via TF1). >+ wires = wiring.getRequiredWires(ResourceConstants.IDENTITY_NAMESPACE); >+ assertWires(wires, 1); >+ // Check the osgi.identity wire between TB4 and TB1 (via TF1). >+ wire = (Wire) wires.get(0); >+ BundleRevision provider = (BundleRevision) tb4.adapt(BundleRevision.class); >+ capability = getIdentityCapability(provider); >+ requirement = getIdentityRequirement((BundleRevision) tf1.adapt(BundleRevision.class), 0); >+ assertIdentityWire(wire, capability, provider, requirement, revision); >+ } >+ >+ /* >+ * TB2 >+ * Requirements: >+ * None >+ * Capabilities: >+ * None >+ * Wires: >+ * None >+ */ >+ private void assertTb2() { >+ final BundleRevision revision = (BundleRevision) tb2.adapt(BundleRevision.class); >+ assertNotIdentityCapability(new CapabilityProvider() { >+ public List getCapabilities(String namespace) { >+ return revision.getDeclaredCapabilities(namespace); >+ } >+ }); >+ final Resource resource = revision; >+ assertNotIdentityCapability(new CapabilityProvider() { >+ public List getCapabilities(String namespace) { >+ return resource.getCapabilities(namespace); >+ } >+ }); >+ final BundleWiring wiring = (BundleWiring) tb2.adapt(BundleWiring.class); >+ assertNotIdentityCapability(new CapabilityProvider() { >+ public List getCapabilities(String namespace) { >+ return wiring.getCapabilities(namespace); >+ } >+ }); >+ } >+ >+ /* >+ * TB3 >+ * Requirements: >+ * osgi.identity;osgi.identity=resource.tb1;version=1.0.0;type=osgi.bundle >+ * osgi.identity;osgi.identity=resource.tf1;version=1.0.0;type=osgi.fragment >+ * Capabilities: >+ * osgi.identity;osgi.identity=resource.tb3;version=1.0.0;type=osgi.bundle >+ * osgi.wiring.host;osgi.wiring.host=resource.tb3;version=1.0.0 >+ * Wires: >+ * TB1 <-> osgi.identity >+ * TF1 <-> osgi.identity >+ */ >+ private void assertTb3() { >+ // Get the revision for TB3. >+ BundleRevision revision = (BundleRevision) tb3.adapt(BundleRevision.class); >+ // Make sure TB3's symbolic name and version match the manifest. >+ String symbolicName = revision.getSymbolicName(); >+ assertSymbolicName("resource.tb3", symbolicName); >+ Version version = revision.getVersion(); >+ assertVersion("1.0.0", version); >+ // Make sure TB3's type is correct. >+ String type = getType(revision); >+ assertType(ResourceConstants.IDENTITY_TYPE_BUNDLE, type); >+ // Check TB3's osgi.identity capability from the revision. >+ Capability capability = getIdentityCapability(revision); >+ assertIdentityCapability(capability, symbolicName, version, type); >+ Resource resource = revision; >+ // Check TB3's osgi.identity capability from the resource. >+ capability = getIdentityCapability(resource); >+ assertIdentityCapability(capability, symbolicName, version, type); >+ // Check TB3's osgi.identity capability from the wiring. >+ BundleWiring wiring = (BundleWiring) tb3.adapt(BundleWiring.class); >+ capability = getIdentityCapability(wiring); >+ assertIdentityCapability(capability, symbolicName, version, type); >+ // There should be 2 required osgi.identity wires (TB1 -> TB3 and TF1 -> TB3). >+ List wires = wiring.getRequiredWires(ResourceConstants.IDENTITY_NAMESPACE); >+ assertWires(wires, 2); >+ // Check the osgi.identity wire between TB1 and TB3. >+ Wire wire = (Wire) wires.get(0); >+ Requirement requirement = getIdentityRequirement(revision, 0); >+ BundleRevision provider = (BundleRevision) tb1.adapt(BundleRevision.class); >+ capability = getIdentityCapability(provider); >+ assertIdentityWire(wire, capability, provider, requirement, revision); >+ // Check the osgi.identity wire between TF1 and TB3. >+ wire = (Wire) wires.get(1); >+ requirement = getIdentityRequirement(revision, 1); >+ provider = (BundleRevision) tf1.adapt(BundleRevision.class); >+ capability = getIdentityCapability(provider); >+ assertIdentityWire(wire, capability, provider, requirement, revision); >+ } >+ >+ /* >+ * TB4 >+ * Requirements: >+ * None >+ * Capabilities: >+ * osgi.identity;osgi.identity=resource.tb4;version=1.0.0;type=osgi.bundle >+ * osgi.wiring.host;osgi.wiring.host=resource.tb4;version=1.0.0 >+ * Wires: >+ * osgi.identity <-> TB1 (via TF1) >+ */ >+ private void assertTb4() { >+ // Get the revision for TB4. >+ BundleRevision revision = (BundleRevision) tb4.adapt(BundleRevision.class); >+ // Make sure TB4's symbolic name and version match the manifest. >+ String symbolicName = revision.getSymbolicName(); >+ assertSymbolicName("resource.tb4", symbolicName); >+ Version version = revision.getVersion(); >+ assertVersion("1.0.0", version); >+ // Make sure TB4's type is correct. >+ String type = getType(revision); >+ assertType(ResourceConstants.IDENTITY_TYPE_BUNDLE, type); >+ // Check TB4's osgi.identity capability from the revision. >+ Capability capability = getIdentityCapability(revision); >+ assertIdentityCapability(capability, symbolicName, version, type); >+ Resource resource = revision; >+ // Check TB4's osgi.identity capability from the resource. >+ capability = getIdentityCapability(resource); >+ assertIdentityCapability(capability, symbolicName, version, type); >+ BundleWiring wiring = (BundleWiring) tb4.adapt(BundleWiring.class); >+ // Check TB4's osgi.identity capability from the wiring. >+ capability = getIdentityCapability(wiring); >+ assertIdentityCapability(capability, symbolicName, version, type); >+ // There should be 1 provided osgi.identity wire (TB4 -> TB1 via TF1). >+ List wires = wiring.getProvidedWires(ResourceConstants.IDENTITY_NAMESPACE); >+ assertWires(wires, 1); >+ // Check the osgi.identity wire between TB4 and TB1 (via TF1). >+ Wire wire = (Wire) wires.get(0); >+ // The requirer will be TB1's revision since fragment requirements are merged into the host... >+ BundleRevision requirer = (BundleRevision) tb1.adapt(BundleRevision.class); >+ // ...but the requirement will come from the fragment. >+ Requirement requirement = getIdentityRequirement((BundleRevision) tf1.adapt(BundleRevision.class), 0); >+ assertIdentityWire(wire, capability, revision, requirement, requirer); >+ } >+ >+ /* >+ * TF1 >+ * Requirements: >+ * osgi.wiring.host;osgi.wiring.host=resource.tb1;version=1.0.0 >+ * osgi.identity;osgi.identity=resource.tb4;version=1.0.0;type=osgi.bundle >+ * Capabilities: >+ * osgi.identity;osgi.identity=resource.tf1;version=1.0.0;type=osgi.fragment >+ * Wires: >+ * TB1 <-> osgi.wiring.host >+ * osgi.identity <-> TB3 >+ */ >+ private void assertTf1() { >+ // Get the revision for TF1. >+ BundleRevision revision = (BundleRevision) tf1.adapt(BundleRevision.class); >+ // Make sure TF1's symbolic name and version match the manifest. >+ String symbolicName = revision.getSymbolicName(); >+ assertSymbolicName("resource.tf1", symbolicName); >+ Version version = revision.getVersion(); >+ assertVersion("1.0.0", version); >+ // Make sure TF1's type is correct. >+ String type = getType(revision); >+ assertType(ResourceConstants.IDENTITY_TYPE_FRAGMENT, type); >+ // Check TF1's osgi.identity capability from the revision. >+ Capability capability = getIdentityCapability(revision); >+ assertIdentityCapability(capability, symbolicName, version, type); >+ // Check TF1's osgi.identity capability from the resource. >+ Resource resource = revision; >+ capability = getIdentityCapability(resource); >+ assertIdentityCapability(capability, symbolicName, version, type); >+ // Check TF1's osgi.identity capability from the wiring. >+ BundleWiring wiring = (BundleWiring) tf1.adapt(BundleWiring.class); >+ capability = getIdentityCapability(wiring); >+ assertIdentityCapability(capability, symbolicName, version, type); >+ // There should be 1 provided osgi.identity wire (TF1 -> TB3). >+ List wires = wiring.getProvidedWires(ResourceConstants.IDENTITY_NAMESPACE); >+ assertWires(wires, 1); >+ // Check the osgi.identity wire between TF1 and TB3. >+ Wire wire = (Wire) wires.get(0); >+ BundleRevision requirer = (BundleRevision) tb3.adapt(BundleRevision.class); >+ Requirement requirement = getIdentityRequirement(requirer, 1); >+ assertIdentityWire(wire, capability, revision, requirement, requirer); >+ } >+ >+ /* >+ * TF2 >+ * Requirements: >+ * osgi.wiring.host;osgi.wiring.host=resource.tb1;version=1.0.0 >+ * Capabilities: >+ * None >+ * Wires: >+ * TB1 <-> osgi.wiring.host >+ */ >+ private void assertTf2() { >+ final BundleRevision revision = (BundleRevision) tf2.adapt(BundleRevision.class); >+ assertNotIdentityCapability(new CapabilityProvider() { >+ public List getCapabilities(String namespace) { >+ return revision.getDeclaredCapabilities(namespace); >+ } >+ }); >+ final Resource resource = revision; >+ assertNotIdentityCapability(new CapabilityProvider() { >+ public List getCapabilities(String namespace) { >+ return resource.getCapabilities(namespace); >+ } >+ }); >+ final BundleWiring wiring = (BundleWiring) tf2.adapt(BundleWiring.class); >+ assertNotIdentityCapability(new CapabilityProvider() { >+ public List getCapabilities(String namespace) { >+ return wiring.getCapabilities(namespace); >+ } >+ }); >+ } >+ >+ private void assertCapabilities(List capabilities, int size) { >+ assertNotNull("Null capabilities", capabilities); >+ assertEquals("Wrong number of capabilities", size, capabilities.size()); >+ } >+ >+ private void assertIdentityCapability(Capability capability, String symbolicName, Version version, String type) { >+ assertEquals("Wrong namespace", ResourceConstants.IDENTITY_NAMESPACE, capability.getNamespace()); >+ assertEquals("Wrong number of attributes", 3, capability.getAttributes().size()); >+ // The osgi.identity attribute contains the symbolic name of the resource. >+ assertSymbolicName(symbolicName, (String) capability.getAttributes().get(ResourceConstants.IDENTITY_NAMESPACE)); >+ // The version attribute must be of type Version. >+ // The version attribute contains the version of the resource. >+ assertVersion(version, (Version) capability.getAttributes().get(ResourceConstants.IDENTITY_VERSION_ATTRIBUTE)); >+ // The type attribute must be of type String. >+ // The type attribute contains the resource type. >+ assertType(type, (String) capability.getAttributes().get(ResourceConstants.IDENTITY_TYPE_ATTRIBUTE)); >+ } >+ >+ private void assertIdentityWire(Wire wire, Capability capability, Resource provider, Requirement requirement, Resource requirer) { >+ assertEquals("Wrong capability", capability, wire.getCapability()); >+ assertEquals("Wrong provider", provider, wire.getProvider()); >+ assertEquals("Wrong requirement", requirement, wire.getRequirement()); >+ assertEquals("Wrong requirer", requirer, wire.getRequirer()); >+ } >+ >+ private void assertNotIdentityCapability(CapabilityProvider provider) { >+ List capabilities = provider.getCapabilities(ResourceConstants.IDENTITY_NAMESPACE); >+ // A resource with no symbolic name must not provide an identity capability. >+ assertCapabilities(capabilities, 0); >+ } >+ >+ private void assertNotNull(Capability capability) { >+ Assert.assertNotNull("Null capability", capability); >+ } >+ >+ private void assertNotNull(Requirement requirement) { >+ Assert.assertNotNull("Null requirement", requirement); >+ } >+ >+ private void assertRequirements(List requirements, int index) { >+ assertNotNull("Null requirements", requirements); >+ assertTrue("Wrong number of requirements", requirements.size() > index); >+ } >+ >+ private void assertSymbolicName(String expected, String actual) { >+ assertEquals("Wrong symbolic name", expected, actual); >+ } >+ >+ private void assertType(String expected, String actual) { >+ assertEquals("Wrong type", expected, actual); >+ } >+ >+ private void assertVersion(String expected, Version actual) { >+ assertVersion(Version.parseVersion(expected), actual); >+ } >+ >+ private void assertVersion(Version expected, Version actual) { >+ assertEquals("Wrong version", expected, actual); >+ } >+ >+ private void assertWires(List wires, int size) { >+ assertNotNull("Null wires", wires); >+ assertEquals("Wrong number of wires", size, wires.size()); >+ } >+ >+ private Capability getIdentityCapability(BundleRevision revision) { >+ List capabilities = revision.getDeclaredCapabilities(ResourceConstants.IDENTITY_NAMESPACE); >+ assertCapabilities(capabilities, 1); >+ Capability capability = (Capability) capabilities.get(0); >+ assertNotNull(capability); >+ return capability; >+ } >+ >+ private Capability getIdentityCapability(BundleWiring wiring) { >+ List capabilities = wiring.getCapabilities(ResourceConstants.IDENTITY_NAMESPACE); >+ assertCapabilities(capabilities, 1); >+ Capability capability = (Capability) capabilities.get(0); >+ assertNotNull(capability); >+ return capability; >+ } >+ >+ private Capability getIdentityCapability(Resource resource) { >+ List capabilities = resource.getCapabilities(ResourceConstants.IDENTITY_NAMESPACE); >+ assertCapabilities(capabilities, 1); >+ Capability capability = (Capability) capabilities.get(0); >+ assertNotNull(capability); >+ return capability; >+ } >+ >+ private Requirement getIdentityRequirement(BundleRevision revision, int index) { >+ List requirements = revision.getDeclaredRequirements(ResourceConstants.IDENTITY_NAMESPACE); >+ assertRequirements(requirements, index); >+ Requirement requirement = (Requirement) requirements.get(index); >+ assertNotNull(requirement); >+ return requirement; >+ } >+ >+ private String getType(BundleRevision revision) { >+ return (revision.getTypes() & BundleRevision.TYPE_FRAGMENT) == 0 ? ResourceConstants.IDENTITY_TYPE_BUNDLE : ResourceConstants.IDENTITY_TYPE_FRAGMENT; >+ } >+} >Index: src/org/eclipse/osgi/tests/services/resolver/AbstractStateTest.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/framework/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/AbstractStateTest.java,v >retrieving revision 1.10 >diff -u -r1.10 AbstractStateTest.java >--- src/org/eclipse/osgi/tests/services/resolver/AbstractStateTest.java 3 Jun 2005 19:18:04 -0000 1.10 >+++ src/org/eclipse/osgi/tests/services/resolver/AbstractStateTest.java 29 Jun 2011 19:37:46 -0000 >@@ -106,9 +106,9 @@ > if (original.getSupplier() != null) { > Object o = original.getSupplier(); > if (o instanceof BundleDescription) >- assertEquals(tag + ".5", (BundleDescription)original.getSupplier(), (BundleDescription)copy.getSupplier()); >+ assertEquals(tag + ".5", (BundleDescription) original.getSupplier(), (BundleDescription) copy.getSupplier()); > else >- assertEquals(tag + ".5", (ExportPackageDescription)original.getSupplier(), (ExportPackageDescription)copy.getSupplier()); >+ assertEquals(tag + ".5", (ExportPackageDescription) original.getSupplier(), (ExportPackageDescription) copy.getSupplier()); > } > } > >Index: src/org/eclipse/osgi/tests/services/resolver/GenericCapabilityTest.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/framework/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/GenericCapabilityTest.java,v >retrieving revision 1.4 >diff -u -r1.4 GenericCapabilityTest.java >--- src/org/eclipse/osgi/tests/services/resolver/GenericCapabilityTest.java 27 Aug 2010 21:47:22 -0000 1.4 >+++ src/org/eclipse/osgi/tests/services/resolver/GenericCapabilityTest.java 29 Jun 2011 19:37:46 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2003, 2010 IBM Corporation and others. >+ * Copyright (c) 2003, 2011 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -19,8 +19,8 @@ > import org.osgi.framework.Constants; > > public class GenericCapabilityTest extends AbstractStateTest { >- private static final String GENERIC_REQUIRE = "Eclipse-GenericRequire"; //$NON-NLS-1$ >- private static final String GENERIC_CAPABILITY = "Eclipse-GenericCapability"; //$NON-NLS-1$ >+ static final String GENERIC_REQUIRE = "Eclipse-GenericRequire"; //$NON-NLS-1$ >+ static final String GENERIC_CAPABILITY = "Eclipse-GenericCapability"; //$NON-NLS-1$ > > public static Test suite() { > return new TestSuite(GenericCapabilityTest.class); >@@ -35,7 +35,7 @@ > Hashtable manifest = new Hashtable(); > long bundleID = 0; > manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); >- manifest.put(Constants.BUNDLE_SYMBOLICNAME, "genericCapablity"); >+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "genericCapability"); > manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); > StringBuffer capabililty = new StringBuffer(); > capabililty.append("foo; version=\"1.3.1\"; attr1=\"value1\"; attr2=\"value2\","); >@@ -55,6 +55,7 @@ > manifest.put(Constants.BUNDLE_SYMBOLICNAME, "genericRequire"); > manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); > StringBuffer required = new StringBuffer(); >+ required.append("genericCapability:osgi.identity; selection-filter=\"(version=1.0)\","); > required.append("foo; selection-filter=\"(version>=1.3.0)\","); > required.append("bar:bartype; selection-filter=\"(attr1=value1)\","); > required.append("test.types:testtype; selection-filter=\"(&(aVersion>=2.0.0)(aLong>=5555)(aDouble>=1.00)(aUri=file:/test)(aSet=c)(aString=someString))\""); >@@ -68,13 +69,15 @@ > assertTrue("1.0", genCap.isResolved()); > assertTrue("1.1", genReq.isResolved()); > GenericSpecification[] genSpecs = genReq.getGenericRequires(); >- assertTrue("2.0", genSpecs.length == 3); >+ assertTrue("2.0", genSpecs.length == 4); > assertTrue("2.1", genSpecs[0].isResolved()); > assertEquals("2.1.1", genSpecs[0].getSupplier(), genCap.getGenericCapabilities()[0]); > assertTrue("2.2", genSpecs[1].isResolved()); > assertEquals("2.2.1", genSpecs[1].getSupplier(), genCap.getGenericCapabilities()[1]); > assertTrue("2.3", genSpecs[2].isResolved()); > assertEquals("2.3.1", genSpecs[2].getSupplier(), genCap.getGenericCapabilities()[2]); >+ assertTrue("2.4", genSpecs[3].isResolved()); >+ assertEquals("2.4.1", genSpecs[3].getSupplier(), genCap.getGenericCapabilities()[3]); > } > > public void testGenericsUpdate() throws BundleException { >@@ -82,7 +85,7 @@ > Hashtable manifest = new Hashtable(); > long bundleID = 0; > manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); >- manifest.put(Constants.BUNDLE_SYMBOLICNAME, "genericCapablity"); >+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "genericCapability"); > manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); > StringBuffer capabililty = new StringBuffer(); > capabililty.append("foo; version=\"1.3.1\"; attr1=\"value1\"; attr2=\"value2\","); >@@ -102,6 +105,7 @@ > manifest.put(Constants.BUNDLE_SYMBOLICNAME, "genericRequire"); > manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); > StringBuffer required = new StringBuffer(); >+ required.append("genericCapability:osgi.identity; selection-filter=\"(version>=1.0)\","); > required.append("foo; selection-filter=\"(version>=1.3.0)\","); > required.append("bar:bartype; selection-filter=\"(attr1=value1)\","); > required.append("test.types:testtype; selection-filter=\"(&(aVersion>=2.0.0)(aLong>=5555)(aDouble>=1.00)(aUri=file:/test)(aSet=c)(aString=someString))\""); >@@ -115,17 +119,19 @@ > assertTrue("1.0", genCap.isResolved()); > assertTrue("1.1", genReq.isResolved()); > GenericSpecification[] genSpecs = genReq.getGenericRequires(); >- assertTrue("2.0", genSpecs.length == 3); >+ assertTrue("2.0", genSpecs.length == 4); > assertTrue("2.1", genSpecs[0].isResolved()); > assertEquals("2.1.1", genSpecs[0].getSupplier(), genCap.getGenericCapabilities()[0]); > assertTrue("2.2", genSpecs[1].isResolved()); > assertEquals("2.2.1", genSpecs[1].getSupplier(), genCap.getGenericCapabilities()[1]); > assertTrue("2.3", genSpecs[2].isResolved()); > assertEquals("2.3.1", genSpecs[2].getSupplier(), genCap.getGenericCapabilities()[2]); >+ assertTrue("2.4", genSpecs[3].isResolved()); >+ assertEquals("2.4.1", genSpecs[3].getSupplier(), genCap.getGenericCapabilities()[3]); > > manifest.clear(); > manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); >- manifest.put(Constants.BUNDLE_SYMBOLICNAME, "genericCapablity"); >+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "genericCapability"); > manifest.put(Constants.BUNDLE_VERSION, "2.0.0"); > capabililty = new StringBuffer(); > capabililty.append("foo; version=\"1.3.2\"; attr1=\"value1\"; attr2=\"value2\","); >@@ -146,13 +152,15 @@ > assertTrue("3.0", genCap2.isResolved()); > assertTrue("3.1", genReq.isResolved()); > genSpecs = genReq.getGenericRequires(); >- assertTrue("4.0", genSpecs.length == 3); >+ assertTrue("4.0", genSpecs.length == 4); > assertTrue("4.1", genSpecs[0].isResolved()); > assertEquals("4.1.1", genSpecs[0].getSupplier(), genCap2.getGenericCapabilities()[0]); > assertTrue("4.2", genSpecs[1].isResolved()); > assertEquals("4.2.1", genSpecs[1].getSupplier(), genCap2.getGenericCapabilities()[1]); > assertTrue("4.3", genSpecs[2].isResolved()); > assertEquals("4.3.1", genSpecs[2].getSupplier(), genCap2.getGenericCapabilities()[2]); >+ assertTrue("4.4", genSpecs[3].isResolved()); >+ assertEquals("4.4.1", genSpecs[3].getSupplier(), genCap2.getGenericCapabilities()[3]); > > } > >@@ -161,7 +169,7 @@ > Hashtable manifest = new Hashtable(); > long bundleID = 0; > manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); >- manifest.put(Constants.BUNDLE_SYMBOLICNAME, "genericCapablity"); >+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "genericCapability"); > manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); > StringBuffer capabililty = new StringBuffer(); > capabililty.append("foo; version=\"1.3.1\"; attr1=\"value1\"; attr2=\"value2\","); >@@ -181,6 +189,7 @@ > manifest.put(Constants.BUNDLE_SYMBOLICNAME, "genericRequire"); > manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); > StringBuffer required = new StringBuffer(); >+ required.append("genericCapability:osgi.identity; selection-filter=\"(version>=1.0)\","); > required.append("foo; selection-filter=\"(version>=1.3.0)\","); > required.append("bar:bartype; selection-filter=\"(attr1=value1)\","); > required.append("test.types:testtype; selection-filter=\"(&(aVersion>=2.0.0)(aLong>=5555)(aDouble>=1.00)(aUri=file:/test)(aSet=c)(aString=someString))\""); >@@ -194,26 +203,30 @@ > assertTrue("1.0", genCap.isResolved()); > assertTrue("1.1", genReq.isResolved()); > GenericSpecification[] genSpecs = genReq.getGenericRequires(); >- assertTrue("2.0", genSpecs.length == 3); >+ assertTrue("2.0", genSpecs.length == 4); > assertTrue("2.1", genSpecs[0].isResolved()); > assertEquals("2.1.1", genSpecs[0].getSupplier(), genCap.getGenericCapabilities()[0]); > assertTrue("2.2", genSpecs[1].isResolved()); > assertEquals("2.2.1", genSpecs[1].getSupplier(), genCap.getGenericCapabilities()[1]); > assertTrue("2.3", genSpecs[2].isResolved()); > assertEquals("2.3.1", genSpecs[2].getSupplier(), genCap.getGenericCapabilities()[2]); >+ assertTrue("2.4", genSpecs[3].isResolved()); >+ assertEquals("2.4.1", genSpecs[3].getSupplier(), genCap.getGenericCapabilities()[3]); > > state.resolve(new BundleDescription[] {genCap}); > > assertTrue("3.0", genCap.isResolved()); > assertTrue("3.1", genReq.isResolved()); > genSpecs = genReq.getGenericRequires(); >- assertTrue("4.0", genSpecs.length == 3); >+ assertTrue("4.0", genSpecs.length == 4); > assertTrue("4.1", genSpecs[0].isResolved()); > assertEquals("4.1.1", genSpecs[0].getSupplier(), genCap.getGenericCapabilities()[0]); > assertTrue("4.2", genSpecs[1].isResolved()); > assertEquals("4.2.1", genSpecs[1].getSupplier(), genCap.getGenericCapabilities()[1]); > assertTrue("4.3", genSpecs[2].isResolved()); > assertEquals("4.3.1", genSpecs[2].getSupplier(), genCap.getGenericCapabilities()[2]); >+ assertTrue("4.4", genSpecs[3].isResolved()); >+ assertEquals("4.4.1", genSpecs[3].getSupplier(), genCap.getGenericCapabilities()[3]); > > } > >@@ -223,7 +236,7 @@ > long bundleID = 0; > > manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); >- manifest.put(Constants.BUNDLE_SYMBOLICNAME, "genericCapablity"); >+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "genericCapability"); > manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); > StringBuffer capabililty = new StringBuffer(); > capabililty.append("foo; version=\"1.3.1\"; attr1=\"value1\"; attr2=\"value2\","); >@@ -241,7 +254,7 @@ > manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); > manifest.put(Constants.BUNDLE_SYMBOLICNAME, "genericCapability.frag1"); > manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); >- manifest.put(Constants.FRAGMENT_HOST, "genericCapablity;bundle-version=\"[1.0.0,2.0.0)\""); >+ manifest.put(Constants.FRAGMENT_HOST, "genericCapability;bundle-version=\"[1.0.0,2.0.0)\""); > capabililty = new StringBuffer(); > capabililty.append("fragmentStuff"); > manifest.put(GENERIC_CAPABILITY, capabililty.toString()); >@@ -252,10 +265,12 @@ > manifest.put(Constants.BUNDLE_SYMBOLICNAME, "genericRequire"); > manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); > StringBuffer required = new StringBuffer(); >+ required.append("genericCapability:osgi.identity; selection-filter=\"(&(version=1.0.0)(type=osgi.bundle))\","); > required.append("foo; selection-filter=\"(version>=1.3.0)\","); > required.append("bar:bartype; selection-filter=\"(attr1=value1)\","); > required.append("test.types:testtype; selection-filter=\"(&(aVersion>=2.0.0)(aLong>=5555)(aDouble>=1.00)(aUri=file:/test)(aSet=c)(aString=someString))\","); >- required.append("fragmentStuff"); >+ required.append("fragmentStuff,"); >+ required.append("genericCapability.frag1:osgi.identity; selection-filter=\"(&(version=1.0.0)(type=osgi.fragment))\""); > manifest.put(GENERIC_REQUIRE, required.toString()); > BundleDescription genReq = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); > >@@ -268,17 +283,23 @@ > assertTrue("1.1", genReq.isResolved()); > assertTrue("1.2", genCapFrag.isResolved()); > GenericSpecification[] genSpecs = genReq.getGenericRequires(); >- GenericDescription[] selectedCapabilities = genCap.getSelectedGenericCapabilities(); >- assertTrue("2.0", genSpecs.length == 4); >- assertEquals("Wrong number of selected capabilities", 4, selectedCapabilities.length); >+ GenericDescription[] selectedHostCapabilities = genCap.getSelectedGenericCapabilities(); >+ GenericDescription[] selectedFragCapabilities = genCapFrag.getSelectedGenericCapabilities(); >+ assertTrue("2.0", genSpecs.length == 6); >+ assertEquals("Wrong number of selected capabilities", 5, selectedHostCapabilities.length); >+ assertEquals("Wrong number of selected capabilities", 1, selectedFragCapabilities.length); > assertTrue("2.1", genSpecs[0].isResolved()); >- assertEquals("2.1.1", genSpecs[0].getSupplier(), selectedCapabilities[0]); >+ assertEquals("2.1.1", genSpecs[0].getSupplier(), selectedHostCapabilities[0]); > assertTrue("2.2", genSpecs[1].isResolved()); >- assertEquals("2.2.1", genSpecs[1].getSupplier(), selectedCapabilities[1]); >+ assertEquals("2.2.1", genSpecs[1].getSupplier(), selectedHostCapabilities[1]); > assertTrue("2.3", genSpecs[2].isResolved()); >- assertEquals("2.3.1", genSpecs[2].getSupplier(), selectedCapabilities[2]); >+ assertEquals("2.3.1", genSpecs[2].getSupplier(), selectedHostCapabilities[2]); > assertTrue("2.4", genSpecs[3].isResolved()); >- assertEquals("2.4.1", genSpecs[3].getSupplier(), selectedCapabilities[3]); >+ assertEquals("2.4.1", genSpecs[3].getSupplier(), selectedHostCapabilities[3]); >+ assertTrue("2.5", genSpecs[4].isResolved()); >+ assertEquals("2.5.1", genSpecs[4].getSupplier(), selectedHostCapabilities[4]); >+ assertTrue("2.6", genSpecs[5].isResolved()); >+ assertEquals("2.6.1", genSpecs[5].getSupplier(), selectedFragCapabilities[0]); > } > > public void testGenericsIntraFrags() throws BundleException { >@@ -304,7 +325,12 @@ > manifest.put(Constants.BUNDLE_SYMBOLICNAME, "org.eclipse.equinox.generic.frag.b"); > manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); > manifest.put(Constants.FRAGMENT_HOST, "org.eclipse.equinox.generic.host;bundle-version=\"1.0.0\""); >- manifest.put("Eclipse-GenericRequire", "frag.a"); >+ StringBuffer required = new StringBuffer(); >+ required.append("org.eclipse.equinox.generic.host:osgi.identity; selection-filter=\"(&(version=1.0.0)(type=osgi.bundle))\","); >+ required.append("frag.a,"); >+ required.append("org.eclipse.equinox.generic.frag.a:osgi.identity; selection-filter=\"(&(version=1.0.0)(type=osgi.fragment))\","); >+ required.append("org.eclipse.equinox.generic.frag.b:osgi.identity; selection-filter=\"(&(version=1.0.0)(type=osgi.fragment))\""); >+ manifest.put(GENERIC_REQUIRE, required.toString()); > BundleDescription genFragB = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); > > state.addBundle(genHost); >@@ -317,10 +343,22 @@ > assertTrue("1.2", genFragB.isResolved()); > GenericSpecification[] genSpecs = genFragB.getGenericRequires(); > GenericDescription[] selected = genHost.getSelectedGenericCapabilities(); >- assertEquals("Wrong number of selected", 1, selected.length); >- assertTrue("2.0", genSpecs.length == 1); >+ assertEquals("Wrong number of selected", 1 + 1, selected.length); // + 1 for host osgi.identity cap >+ assertTrue("2.0", genSpecs.length == 4); >+ GenericDescription[] selectedHostCapabilities = genHost.getSelectedGenericCapabilities(); >+ GenericDescription[] selectedFragACapabilities = genFragA.getSelectedGenericCapabilities(); >+ GenericDescription[] selectedFragBCapabilities = genFragB.getSelectedGenericCapabilities(); >+ assertEquals("Wrong number of selected capabilities", 2, selectedHostCapabilities.length); >+ assertEquals("Wrong number of selected capabilities", 1, selectedFragACapabilities.length); >+ assertEquals("Wrong number of selected capabilities", 1, selectedFragBCapabilities.length); > assertTrue("2.1", genSpecs[0].isResolved()); >- assertEquals("2.1.1", genSpecs[0].getSupplier(), selected[0]); >+ assertEquals("2.1.1", genSpecs[0].getSupplier(), selectedHostCapabilities[0]); >+ assertTrue("2.2", genSpecs[1].isResolved()); >+ assertEquals("2.2.1", genSpecs[1].getSupplier(), selectedHostCapabilities[1]); >+ assertTrue("2.3", genSpecs[2].isResolved()); >+ assertEquals("2.3.1", genSpecs[2].getSupplier(), selectedFragACapabilities[0]); >+ assertTrue("2.4", genSpecs[3].isResolved()); >+ assertEquals("2.4.1", genSpecs[3].getSupplier(), selectedFragBCapabilities[0]); > } > > public void testGenericsAliases() throws BundleException { >@@ -333,7 +371,7 @@ > Hashtable manifest = new Hashtable(); > long bundleID = 0; > manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); >- manifest.put(Constants.BUNDLE_SYMBOLICNAME, "genericCapablity"); >+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "genericCapability"); > manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); > manifest.put(Constants.EXPORT_SERVICE, "org.osgi.service.log.LogService; version=1.2"); > manifest.put("TJW-Export", "my.great.stuff; aLong:long=5150; aDouble:double=3.14; aVersion:version=1.2.0"); >@@ -345,6 +383,7 @@ > manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); > manifest.put(Constants.IMPORT_SERVICE, "org.osgi.service.log.LogService; selection-filter=(version>=1.0.0)"); > manifest.put("TJW-Import", "my.great.stuff; selection-filter=(&(aLong<=10000)(aLong>=5000))"); >+ manifest.put(GENERIC_REQUIRE, "genericCapability:osgi.identity; selection-filter=\"(&(version=1.0.0)(type=osgi.bundle))\""); > BundleDescription genReq = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); > > state.addBundle(genCap); >@@ -354,11 +393,13 @@ > assertTrue("1.0", genCap.isResolved()); > assertTrue("1.1", genReq.isResolved()); > GenericSpecification[] genSpecs = genReq.getGenericRequires(); >- assertTrue("2.0", genSpecs.length == 2); >+ assertTrue("2.0", genSpecs.length == 3); > assertTrue("2.1", genSpecs[0].isResolved()); >- assertEquals("2.1.1", genSpecs[0].getSupplier(), genCap.getGenericCapabilities()[0]); >+ assertEquals("2.1.1", genSpecs[0].getSupplier(), genCap.getGenericCapabilities()[1]); > assertTrue("2.2", genSpecs[1].isResolved()); >- assertEquals("2.2.1", genSpecs[1].getSupplier(), genCap.getGenericCapabilities()[1]); >+ assertEquals("2.2.1", genSpecs[1].getSupplier(), genCap.getGenericCapabilities()[2]); >+ assertTrue("2.3", genSpecs[2].isResolved()); >+ assertEquals("2.3.1", genSpecs[2].getSupplier(), genCap.getGenericCapabilities()[0]); > } > > public void testGenericsOptionalMultiple() throws BundleException { >@@ -366,7 +407,7 @@ > Hashtable manifest = new Hashtable(); > long bundleID = 0; > manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); >- manifest.put(Constants.BUNDLE_SYMBOLICNAME, "genericCapablity"); >+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "genericCapability"); > manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); > StringBuffer capabililty = new StringBuffer(); > capabililty.append("foo; version=\"1.3.1\"; attr1=\"value1\"; attr2=\"value2\","); >@@ -389,6 +430,7 @@ > manifest.put(Constants.BUNDLE_SYMBOLICNAME, "genericRequire"); > manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); > StringBuffer required = new StringBuffer(); >+ required.append("genericCapability:osgi.identity; selection-filter=\"(&(version=1.0.0)(type=osgi.bundle))\","); > required.append("foo; selection-filter=\"(version>=1.3.0)\","); > required.append("bar:bartype; selection-filter=\"(attr1=value1)\","); > required.append("test.types:testtype; selection-filter=\"(&(aVersion>=2.0.0)(aLong>=5555)(aDouble>=1.00)(aUri=file:/test)(aSet=c)(aString=someString))\","); >@@ -405,21 +447,23 @@ > assertTrue("1.0", genCap.isResolved()); > assertTrue("1.1", genReq.isResolved()); > GenericSpecification[] genSpecs = genReq.getGenericRequires(); >- assertTrue("2.0", genSpecs.length == 6); >+ assertTrue("2.0", genSpecs.length == 7); > assertTrue("2.1", genSpecs[0].isResolved()); > assertEquals("2.1.1", genSpecs[0].getSupplier(), genCap.getGenericCapabilities()[0]); > assertTrue("2.2", genSpecs[1].isResolved()); > assertEquals("2.2.1", genSpecs[1].getSupplier(), genCap.getGenericCapabilities()[1]); > assertTrue("2.3", genSpecs[2].isResolved()); > assertEquals("2.3.1", genSpecs[2].getSupplier(), genCap.getGenericCapabilities()[2]); >- assertFalse("2.4", genSpecs[3].isResolved()); >- assertTrue("2.5", genSpecs[4].isResolved()); >- assertEquals("2.5.1", genSpecs[4].getSupplier(), genCap.getGenericCapabilities()[3]); >- assertTrue("2.6", genSpecs[5].isResolved()); >- GenericDescription[] suppliers = genSpecs[5].getSuppliers(); >+ assertTrue("2.3", genSpecs[3].isResolved()); >+ assertEquals("2.3.1", genSpecs[3].getSupplier(), genCap.getGenericCapabilities()[3]); >+ assertFalse("2.4", genSpecs[4].isResolved()); >+ assertTrue("2.5", genSpecs[5].isResolved()); >+ assertEquals("2.5.1", genSpecs[5].getSupplier(), genCap.getGenericCapabilities()[4]); >+ assertTrue("2.6", genSpecs[6].isResolved()); >+ GenericDescription[] suppliers = genSpecs[6].getSuppliers(); > assertTrue("2.6.1", suppliers != null && suppliers.length == 2); >- assertEquals("2.6.2", suppliers[0], genCap.getGenericCapabilities()[5]); >- assertEquals("2.6.3", suppliers[1], genCap.getGenericCapabilities()[4]); >+ assertEquals("2.6.2", suppliers[0], genCap.getGenericCapabilities()[6]); >+ assertEquals("2.6.3", suppliers[1], genCap.getGenericCapabilities()[5]); > } > > public void testGenericsCycles() throws BundleException { >@@ -481,18 +525,18 @@ > GenericSpecification[] genSpecs = genReq.getGenericRequires(); > GenericDescription[] selected = genCap.getSelectedGenericCapabilities(); > assertTrue("2.0", genSpecs.length == 4); >- assertEquals("Wrong number of selected", 4, selected.length); >+ assertEquals("Wrong number of selected", 4 + 1, selected.length); // + 1 for host osgi.identity caps > assertTrue("2.1", genSpecs[0].isResolved()); >- assertEquals("2.1.1", genSpecs[0].getSupplier(), selected[0]); >+ assertEquals("2.1.1", genSpecs[0].getSupplier(), selected[1]); > assertTrue("2.2", genSpecs[1].isResolved()); >- assertEquals("2.2.1", genSpecs[1].getSupplier(), selected[1]); >+ assertEquals("2.2.1", genSpecs[1].getSupplier(), selected[2]); > assertTrue("2.3", genSpecs[2].isResolved()); >- assertEquals("2.3.1", genSpecs[2].getSupplier(), selected[2]); >+ assertEquals("2.3.1", genSpecs[2].getSupplier(), selected[3]); > assertTrue("2.4", genSpecs[3].isResolved()); >- assertEquals("2.4.1", genSpecs[3].getSupplier(), selected[3]); >+ assertEquals("2.4.1", genSpecs[3].getSupplier(), selected[4]); > genSpecs = genCap.getGenericRequires(); > assertTrue("3.0", genSpecs.length == 1); > assertTrue("3.1", genSpecs[0].isResolved()); >- assertEquals("3.1.1", genSpecs[0].getSupplier(), genReq.getGenericCapabilities()[0]); >+ assertEquals("3.1.1", genSpecs[0].getSupplier(), genReq.getGenericCapabilities()[1]); > } > } >Index: src/org/eclipse/osgi/tests/services/resolver/OSGiCapabilityTest.java >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/framework/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/OSGiCapabilityTest.java,v >retrieving revision 1.4 >diff -u -r1.4 OSGiCapabilityTest.java >--- src/org/eclipse/osgi/tests/services/resolver/OSGiCapabilityTest.java 10 Sep 2010 21:07:21 -0000 1.4 >+++ src/org/eclipse/osgi/tests/services/resolver/OSGiCapabilityTest.java 29 Jun 2011 19:37:46 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2010 IBM Corporation and others. >+ * Copyright (c) 2010, 2011 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -13,13 +13,14 @@ > import java.io.File; > import java.io.IOException; > import java.net.URL; >-import java.util.Dictionary; >+import java.util.*; > import junit.framework.Test; > import junit.framework.TestSuite; > import org.eclipse.osgi.framework.util.Headers; > import org.eclipse.osgi.service.resolver.*; > import org.osgi.framework.BundleException; > import org.osgi.framework.Constants; >+import org.osgi.framework.wiring.ResourceConstants; > > public class OSGiCapabilityTest extends AbstractStateTest { > private static final String MANIFEST_ROOT = "test_files/genericCapability/"; >@@ -105,9 +106,9 @@ > assertTrue("c2", c2.isResolved()); > assertTrue("c3", c3.isResolved()); > >- checkGenericBasics(3, c1.getResolvedGenericRequires(), p1.getSelectedGenericCapabilities()); >- checkGenericBasics(3, c2.getResolvedGenericRequires(), p2.getSelectedGenericCapabilities()); >- checkGenericBasics(3, c3.getResolvedGenericRequires(), p3.getSelectedGenericCapabilities()); >+ checkGenericBasics(4, c1.getResolvedGenericRequires(), p1.getSelectedGenericCapabilities()); >+ checkGenericBasics(4, c2.getResolvedGenericRequires(), p2.getSelectedGenericCapabilities()); >+ checkGenericBasics(4, c3.getResolvedGenericRequires(), p3.getSelectedGenericCapabilities()); > > File stateDir = getContext().getDataFile(getName()); //$NON-NLS-1$ > stateDir.mkdirs(); >@@ -130,16 +131,24 @@ > assertTrue("c2", c2.isResolved()); > assertTrue("c3", c3.isResolved()); > >- checkGenericBasics(3, c1.getResolvedGenericRequires(), p1.getSelectedGenericCapabilities()); >- checkGenericBasics(3, c2.getResolvedGenericRequires(), p2.getSelectedGenericCapabilities()); >- checkGenericBasics(3, c3.getResolvedGenericRequires(), p3.getSelectedGenericCapabilities()); >+ checkGenericBasics(4, c1.getResolvedGenericRequires(), p1.getSelectedGenericCapabilities()); >+ checkGenericBasics(4, c2.getResolvedGenericRequires(), p2.getSelectedGenericCapabilities()); >+ checkGenericBasics(4, c3.getResolvedGenericRequires(), p3.getSelectedGenericCapabilities()); > } > > private void checkGenericBasics(int expectedCnt, GenericDescription[] genRequired, GenericDescription[] genProvided) { >+ checkGenericBasics(expectedCnt, genRequired, genProvided, null); >+ } >+ >+ private void checkGenericBasics(int expectedCnt, GenericDescription[] genRequired, GenericDescription[] genProvided, GenericDescription fragIdentity) { > assertEquals("Expected number of capabilities do not match", expectedCnt, genRequired.length); >- assertEquals("Specs do not match Descs", genRequired.length, genProvided.length); >+ assertEquals("Specs do not match Descs", genRequired.length, genProvided.length + (fragIdentity == null ? 0 : 1)); >+ Collection providedCollection = new ArrayList(Arrays.asList(genProvided)); > for (int i = 0; i < genRequired.length; i++) { >- assertEquals("Wrong provider for requirement.", genProvided[i], genRequired[i]); >+ if (ResourceConstants.IDENTITY_NAMESPACE.equals(genRequired[i].getType()) && genRequired[i].getSupplier().getHost() != null) >+ assertEquals("Wrong fragment provider: " + genRequired[i], fragIdentity, genRequired[i]); >+ else >+ assertTrue("Wrong provider for requirement: " + genRequired[i], providedCollection.remove(genRequired[i])); > } > } > >@@ -172,7 +181,7 @@ > assertTrue("c1Frag", c1Frag.isResolved()); > assertTrue("p4", p4.isResolved()); > >- checkGenericBasics(4, c1.getResolvedGenericRequires(), p1.getSelectedGenericCapabilities()); >+ checkGenericBasics(6, c1.getResolvedGenericRequires(), p1.getSelectedGenericCapabilities(), p1Frag.getSelectedGenericCapabilities()[0]); > > File stateDir = getContext().getDataFile(getName()); //$NON-NLS-1$ > stateDir.mkdirs(); >@@ -194,7 +203,7 @@ > assertTrue("c1Frag", c1Frag.isResolved()); > assertTrue("p4", p4.isResolved()); > >- checkGenericBasics(4, c1.getResolvedGenericRequires(), p1.getSelectedGenericCapabilities()); >+ checkGenericBasics(6, c1.getResolvedGenericRequires(), p1.getSelectedGenericCapabilities(), p1Frag.getSelectedGenericCapabilities()[0]); > > state.setResolver(platformAdmin.createResolver()); > state.resolve(new BundleDescription[] {p1}); >@@ -205,7 +214,7 @@ > assertTrue("c1Frag", c1Frag.isResolved()); > assertTrue("p4", p4.isResolved()); > >- checkGenericBasics(4, c1.getResolvedGenericRequires(), p1.getSelectedGenericCapabilities()); >+ checkGenericBasics(6, c1.getResolvedGenericRequires(), p1.getSelectedGenericCapabilities(), p1Frag.getSelectedGenericCapabilities()[0]); > } > > public void testGenericFragments02() throws BundleException { >@@ -233,7 +242,7 @@ > assertTrue("c1", c1.isResolved()); > assertFalse("c1Frag", c1Frag.isResolved()); > >- checkGenericBasics(3, c1.getResolvedGenericRequires(), p1.getSelectedGenericCapabilities()); >+ checkGenericBasics(4, c1.getResolvedGenericRequires(), p1.getSelectedGenericCapabilities()); > > File stateDir = getContext().getDataFile(getName() + 1); //$NON-NLS-1$ > stateDir.mkdirs(); >@@ -253,7 +262,7 @@ > assertTrue("c1", c1.isResolved()); > assertFalse("c1Frag", c1Frag.isResolved()); > >- checkGenericBasics(3, c1.getResolvedGenericRequires(), p1.getSelectedGenericCapabilities()); >+ checkGenericBasics(4, c1.getResolvedGenericRequires(), p1.getSelectedGenericCapabilities()); > > manifest = loadManifest("p4.osgi.MF"); > BundleDescription p4 = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); >@@ -267,7 +276,7 @@ > assertTrue("c1Frag", c1Frag.isResolved()); > assertTrue("p4", p4.isResolved()); > >- checkGenericBasics(4, c1.getResolvedGenericRequires(), p1.getSelectedGenericCapabilities()); >+ checkGenericBasics(6, c1.getResolvedGenericRequires(), p1.getSelectedGenericCapabilities(), p1Frag.getSelectedGenericCapabilities()[0]); > > stateDir = getContext().getDataFile(getName() + 2); //$NON-NLS-1$ > stateDir.mkdirs(); >@@ -288,7 +297,7 @@ > assertTrue("c1Frag", c1Frag.isResolved()); > assertTrue("p4", p4.isResolved()); > >- checkGenericBasics(4, c1.getResolvedGenericRequires(), p1.getSelectedGenericCapabilities()); >+ checkGenericBasics(6, c1.getResolvedGenericRequires(), p1.getSelectedGenericCapabilities(), p1Frag.getSelectedGenericCapabilities()[0]); > } > > public void testGenericUses() throws BundleException { >@@ -362,6 +371,34 @@ > checkUsedCapability(c4v130, p5v100Capability); > } > >+ public void testDeclaringIdentityCapability() { >+ State state = buildEmptyState(); >+ Hashtable manifest = new Hashtable(); >+ long bundleID = 0; >+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); >+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "genericCapability"); >+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); >+ StringBuffer capabililty = new StringBuffer(); >+ capabililty.append("testFailure:osgi.identity; test=failure"); >+ manifest.put(GenericCapabilityTest.GENERIC_CAPABILITY, capabililty.toString()); >+ >+ try { >+ state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); >+ fail("Expected failure to create description that specifies osgi.identity capability"); >+ } catch (BundleException e) { >+ // expected >+ } >+ >+ manifest.remove(GenericCapabilityTest.GENERIC_CAPABILITY); >+ manifest.put(Constants.PROVIDE_CAPABILITY, "osgi.identity; osgi.identity=testFailure; test=failure"); >+ try { >+ state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME), bundleID++); >+ fail("Expected failure to create description that specifies osgi.identity capability"); >+ } catch (BundleException e) { >+ // expected >+ } >+ } >+ > private void checkUsedImports(BundleDescription importer, ExportPackageDescription[] expectedPackages) { > ExportPackageDescription[] imported = importer.getResolvedImports(); > assertEquals("Wrong number of imports for bundle: " + importer, expectedPackages.length, imported.length); >@@ -381,8 +418,9 @@ > private void checkUsedCapability(BundleDescription requirer, GenericDescription[] expectedCapabilities) { > GenericDescription[] required = requirer.getResolvedGenericRequires(); > assertEquals("Wrong number of capabilities for bundle: " + requirer, expectedCapabilities.length, required.length); >+ Collection providedCollection = new ArrayList(Arrays.asList(expectedCapabilities)); > for (int i = 0; i < required.length; i++) { >- assertEquals("Wrong required capability from bundle: " + requirer, expectedCapabilities[i], required[i]); >+ assertTrue("Wrong provider for requirement: " + required[i], providedCollection.remove(required[i])); > } > } > } >Index: test_files/genericCapability/c1.equinox.MF >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/framework/bundles/org.eclipse.osgi.tests/test_files/genericCapability/c1.equinox.MF,v >retrieving revision 1.1 >diff -u -r1.1 c1.equinox.MF >--- test_files/genericCapability/c1.equinox.MF 25 Aug 2010 21:43:59 -0000 1.1 >+++ test_files/genericCapability/c1.equinox.MF 29 Jun 2011 19:37:46 -0000 >@@ -17,4 +17,6 @@ > selection-filter="(&(rank>=100)(!(rank>=200)) > (percent>=0.1)(!(percent>=0.2)) > (test.version>=1.0)(!(test.version>=2.0)) >- (test.string~=abc))" >+ (test.string~=abc))", >+ *:osgi.identity; >+ selection-filter="(&(osgi.identity=p1.*)(version=1.0)(type=osgi.bundle))" >Index: test_files/genericCapability/c1.equinox.name.MF >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/framework/bundles/org.eclipse.osgi.tests/test_files/genericCapability/c1.equinox.name.MF,v >retrieving revision 1.1 >diff -u -r1.1 c1.equinox.name.MF >--- test_files/genericCapability/c1.equinox.name.MF 25 Aug 2010 21:43:59 -0000 1.1 >+++ test_files/genericCapability/c1.equinox.name.MF 29 Jun 2011 19:37:46 -0000 >@@ -17,4 +17,6 @@ > selection-filter="(&(rank>=100)(!(rank>=200)) > (percent>=0.1)(!(percent>=0.2)) > (test.version>=1.0)(!(test.version>=2.0)) >- (test.string~=abc))" >+ (test.string~=abc))", >+ p1.*:osgi.identity; >+ selection-filter="(&(version=1.0)(type=osgi.bundle))" >Index: test_files/genericCapability/c1.osgi.MF >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/framework/bundles/org.eclipse.osgi.tests/test_files/genericCapability/c1.osgi.MF,v >retrieving revision 1.3 >diff -u -r1.3 c1.osgi.MF >--- test_files/genericCapability/c1.osgi.MF 1 Feb 2011 20:47:33 -0000 1.3 >+++ test_files/genericCapability/c1.osgi.MF 29 Jun 2011 19:37:46 -0000 >@@ -17,4 +17,6 @@ > filter:="(&(rank>=100)(!(rank>=200)) > (percent>=0.1)(!(percent>=0.2)) > (test.version>=1.0)(!(test.version>=2.0)) >- (test.string~=abc))" >+ (test.string~=abc))", >+ osgi.identity; >+ filter:="(&(osgi.identity=p1.*)(version=1.0)(type=osgi.bundle))" >Index: test_files/genericCapability/c1.osgi.frag.MF >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/framework/bundles/org.eclipse.osgi.tests/test_files/genericCapability/c1.osgi.frag.MF,v >retrieving revision 1.3 >diff -u -r1.3 c1.osgi.frag.MF >--- test_files/genericCapability/c1.osgi.frag.MF 1 Feb 2011 20:47:33 -0000 1.3 >+++ test_files/genericCapability/c1.osgi.frag.MF 29 Jun 2011 19:37:46 -0000 >@@ -8,4 +8,6 @@ > filter:="(&(rank>=100)(!(rank>=200)) > (percent>=0.1)(!(percent>=0.2)) > (test.version>=1.0)(!(test.version>=2.0)) >- (test.string~=abc))" >+ (test.string~=abc))", >+ osgi.identity; >+ filter:="(&(osgi.identity=p1.*.frag)(version=1.0)(type=osgi.fragment))" >Index: test_files/genericCapability/c2.equinox.MF >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/framework/bundles/org.eclipse.osgi.tests/test_files/genericCapability/c2.equinox.MF,v >retrieving revision 1.1 >diff -u -r1.1 c2.equinox.MF >--- test_files/genericCapability/c2.equinox.MF 25 Aug 2010 21:43:59 -0000 1.1 >+++ test_files/genericCapability/c2.equinox.MF 29 Jun 2011 19:37:46 -0000 >@@ -17,4 +17,6 @@ > selection-filter="(&(rank>=200)(!(rank>=300)) > (percent>=0.2)(!(percent>=0.3)) > (test.version>=2.0)(!(test.version>=3.0)) >- (test.string~=abc))" >+ (test.string~=abc))", >+ *:osgi.identity; >+ selection-filter="(&(osgi.identity=p2.*)(version=1.0)(type=osgi.bundle))" >Index: test_files/genericCapability/c2.equinox.name.MF >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/framework/bundles/org.eclipse.osgi.tests/test_files/genericCapability/c2.equinox.name.MF,v >retrieving revision 1.1 >diff -u -r1.1 c2.equinox.name.MF >--- test_files/genericCapability/c2.equinox.name.MF 25 Aug 2010 21:43:59 -0000 1.1 >+++ test_files/genericCapability/c2.equinox.name.MF 29 Jun 2011 19:37:46 -0000 >@@ -17,4 +17,6 @@ > selection-filter="(&(rank>=200)(!(rank>=300)) > (percent>=0.2)(!(percent>=0.3)) > (test.version>=2.0)(!(test.version>=3.0)) >- (test.string~=abc))" >+ (test.string~=abc))", >+ p2.*:osgi.identity; >+ selection-filter="(&(version=1.0)(type=osgi.bundle))" >Index: test_files/genericCapability/c2.osgi.MF >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/framework/bundles/org.eclipse.osgi.tests/test_files/genericCapability/c2.osgi.MF,v >retrieving revision 1.3 >diff -u -r1.3 c2.osgi.MF >--- test_files/genericCapability/c2.osgi.MF 1 Feb 2011 20:47:33 -0000 1.3 >+++ test_files/genericCapability/c2.osgi.MF 29 Jun 2011 19:37:46 -0000 >@@ -17,4 +17,6 @@ > filter:="(&(rank>=200)(!(rank>=300)) > (percent>=0.2)(!(percent>=0.3)) > (test.version>=2.0)(!(test.version>=3.0)) >- (test.string~=abc))" >+ (test.string~=abc))", >+ osgi.identity; >+ filter:="(&(osgi.identity=p2.*)(version=1.0)(type=osgi.bundle))" >Index: test_files/genericCapability/c3.equinox.MF >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/framework/bundles/org.eclipse.osgi.tests/test_files/genericCapability/c3.equinox.MF,v >retrieving revision 1.1 >diff -u -r1.1 c3.equinox.MF >--- test_files/genericCapability/c3.equinox.MF 25 Aug 2010 21:43:59 -0000 1.1 >+++ test_files/genericCapability/c3.equinox.MF 29 Jun 2011 19:37:46 -0000 >@@ -17,4 +17,6 @@ > selection-filter="(&(rank>=300)(!(rank>=400)) > (percent>=0.3)(!(percent>=0.4)) > (test.version>=3.0)(!(test.version>=4.0)) >- (test.string~=abc))" >+ (test.string~=abc))", >+ *:osgi.identity; >+ selection-filter="(&(osgi.identity=p3.*)(version=1.0)(type=osgi.bundle))" >Index: test_files/genericCapability/c3.equinox.name.MF >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/framework/bundles/org.eclipse.osgi.tests/test_files/genericCapability/c3.equinox.name.MF,v >retrieving revision 1.1 >diff -u -r1.1 c3.equinox.name.MF >--- test_files/genericCapability/c3.equinox.name.MF 25 Aug 2010 21:43:59 -0000 1.1 >+++ test_files/genericCapability/c3.equinox.name.MF 29 Jun 2011 19:37:46 -0000 >@@ -17,4 +17,6 @@ > selection-filter="(&(rank>=300)(!(rank>=400)) > (percent>=0.3)(!(percent>=0.4)) > (test.version>=3.0)(!(test.version>=4.0)) >- (test.string~=abc))" >+ (test.string~=abc))", >+ p3.*:osgi.identity; >+ selection-filter="(&(version=1.0)(type=osgi.bundle))" >Index: test_files/genericCapability/c3.osgi.MF >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/framework/bundles/org.eclipse.osgi.tests/test_files/genericCapability/c3.osgi.MF,v >retrieving revision 1.3 >diff -u -r1.3 c3.osgi.MF >--- test_files/genericCapability/c3.osgi.MF 1 Feb 2011 20:47:33 -0000 1.3 >+++ test_files/genericCapability/c3.osgi.MF 29 Jun 2011 19:37:46 -0000 >@@ -17,4 +17,6 @@ > filter:="(&(rank>=300)(!(rank>=400)) > (percent>=0.3)(!(percent>=0.4)) > (test.version>=3.0)(!(test.version>=4.0)) >- (test.string~=abc))" >+ (test.string~=abc))", >+ osgi.identity; >+ filter:="(&(osgi.identity=p3.*)(version=1.0)(type=osgi.bundle))" >Index: test_files/genericCapability/c4.v100.osgi.MF >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/framework/bundles/org.eclipse.osgi.tests/test_files/genericCapability/c4.v100.osgi.MF,v >retrieving revision 1.2 >diff -u -r1.2 c4.v100.osgi.MF >--- test_files/genericCapability/c4.v100.osgi.MF 1 Feb 2011 20:47:33 -0000 1.2 >+++ test_files/genericCapability/c4.v100.osgi.MF 29 Jun 2011 19:37:46 -0000 >@@ -3,5 +3,6 @@ > Bundle-SymbolicName: c4.osgi > Bundle-Version: 1.0 > Require-Capability: >- namespace.5; filter:="(version=1.0)" >+ namespace.5; filter:="(version=1.0)", >+ osgi.identity; filter:="(&(osgi.identity=p5.osgi)(version=1.0)(type=osgi.bundle))" > Import-Package: p6, p7 >Index: test_files/genericCapability/c4.v110.osgi.MF >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/framework/bundles/org.eclipse.osgi.tests/test_files/genericCapability/c4.v110.osgi.MF,v >retrieving revision 1.2 >diff -u -r1.2 c4.v110.osgi.MF >--- test_files/genericCapability/c4.v110.osgi.MF 1 Feb 2011 20:47:33 -0000 1.2 >+++ test_files/genericCapability/c4.v110.osgi.MF 29 Jun 2011 19:37:46 -0000 >@@ -3,5 +3,6 @@ > Bundle-SymbolicName: c4.osgi > Bundle-Version: 1.1 > Require-Capability: >- namespace.5; filter:="(namespace.5=test)" >+ namespace.5; filter:="(namespace.5=test)", >+ osgi.identity; filter:="(&(osgi.identity=p5.osgi)(version=1.0)(type=osgi.bundle))" > Import-Package: p6; p7; version="[1.0,1.1)" >Index: test_files/genericCapability/c4.v120.osgi.MF >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/framework/bundles/org.eclipse.osgi.tests/test_files/genericCapability/c4.v120.osgi.MF,v >retrieving revision 1.2 >diff -u -r1.2 c4.v120.osgi.MF >--- test_files/genericCapability/c4.v120.osgi.MF 1 Feb 2011 20:47:33 -0000 1.2 >+++ test_files/genericCapability/c4.v120.osgi.MF 29 Jun 2011 19:37:46 -0000 >@@ -3,5 +3,6 @@ > Bundle-SymbolicName: c4.osgi > Bundle-Version: 1.2 > Require-Capability: >- namespace.5; filter:="(version=1.0)" >+ namespace.5; filter:="(version=1.0)", >+ osgi.identity; filter:="(&(osgi.identity=p5.osgi)(version=1.0)(type=osgi.bundle))" > DynamicImport-Package: p6, p7 >Index: test_files/genericCapability/c4.v130.osgi.MF >=================================================================== >RCS file: /cvsroot/rt/org.eclipse.equinox/framework/bundles/org.eclipse.osgi.tests/test_files/genericCapability/c4.v130.osgi.MF,v >retrieving revision 1.2 >diff -u -r1.2 c4.v130.osgi.MF >--- test_files/genericCapability/c4.v130.osgi.MF 1 Feb 2011 20:47:33 -0000 1.2 >+++ test_files/genericCapability/c4.v130.osgi.MF 29 Jun 2011 19:37:46 -0000 >@@ -3,5 +3,6 @@ > Bundle-SymbolicName: c4.osgi > Bundle-Version: 1.3 > Require-Capability: >- namespace.5; filter:="(version=1.0)" >+ namespace.5; filter:="(version=1.0)", >+ osgi.identity; filter:="(&(osgi.identity=p5.osgi)(version=1.0)(type=osgi.bundle))" > Require-Bundle: p6.osgi, p7.osgi
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 349618
:
198155
|
198209
|
198272
|
198420
|
198779
|
198857
|
198921
|
199140
|
199146