Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 349618 - [R4.4] Framework support for Resource, etc. in OSGi 4.4
Summary: [R4.4] Framework support for Resource, etc. in OSGi 4.4
Status: RESOLVED FIXED
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: Framework (show other bugs)
Version: 3.7   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: Juno M1   Edit
Assignee: Thomas Watson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 354191
  Show dependency tree
 
Reported: 2011-06-16 15:41 EDT by John Ross CLA
Modified: 2011-08-08 17:36 EDT (History)
1 user (show)

See Also:


Attachments
Work In Progress (168.01 KB, patch)
2011-06-16 19:17 EDT, John Ross CLA
no flags Details | Diff
Work In Progress 2 (50.66 KB, patch)
2011-06-17 15:05 EDT, John Ross CLA
no flags Details | Diff
updated work in progress (90.51 KB, patch)
2011-06-20 13:37 EDT, Thomas Watson CLA
no flags Details | Diff
updated work in progress (108.66 KB, patch)
2011-06-22 12:40 EDT, Thomas Watson CLA
no flags Details | Diff
updated work in progress with new tests (136.25 KB, patch)
2011-06-28 19:04 EDT, John Ross CLA
no flags Details | Diff
proposed patch (140.46 KB, patch)
2011-06-29 15:46 EDT, John Ross CLA
no flags Details | Diff
proposed patch (145.69 KB, patch)
2011-06-30 12:20 EDT, John Ross CLA
no flags Details | Diff
latest patch (141.87 KB, patch)
2011-07-05 12:24 EDT, Thomas Watson CLA
no flags Details | Diff
updated patch (3.63 KB, patch)
2011-07-05 15:23 EDT, Thomas Watson CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description John Ross CLA 2011-06-16 15:41:41 EDT
OSGi 4.4 will introduce the following interfaces in support of Subsystems (RFC 152) and OBR (RFC 112) requirements.

Resource
Capability
Requirement
Wire

The latter three are simply generalizations of the existing BundleCapability, BundleRequirement, and BundleWire.

Resource is a new concept that supports the Subsystems and OBR requirement of working with resources other than bundles. A Resource is not a runtime object like a Bundle. Rather, it is descriptive information about a resource similar to BundleRevision.
Comment 1 John Ross CLA 2011-06-16 19:17:53 EDT
Created attachment 198155 [details]
Work In Progress

This patch is a work in progress.

org.eclipse.osgi has been updated with the latest org.osgi.framework.wiring API and the corresponding implementation changes made. The changes boil down to the effects of the following.

BundleWire extends Wire
BundleCapability extends Capability
BundleRequirement extends Requirement
BundleRevision extends Resource

So anything implementing the interfaces on the left had to be updated to support anything missing for the more general ones on the right.

I neglected to mention in the description that another API change in progress is the addition of a new capability with a namespace of osgi.identity. The capability must be synthesized by the framework based on a bundle's symbolic name and version. The patch includes this new functionality within the StateBuilder whenever a BundleDescription is created.

The patch also updates org.eclipse.equinox.region.tests to fix some compile errors resulting from the new interfaces.

This patch does not pass all of the tests in org.eclipse.osgi.tests. I have investigated some of the issues and fixed some of the failures. So far, the issues have all been related to the tests and not the implementation, but there's more to do.
Comment 2 John Ross CLA 2011-06-17 15:05:51 EDT
Created attachment 198209 [details]
Work In Progress 2

Updated patch that includes some modified files under test_files/genericCapability and removes the .api_filter file changes.
Comment 3 Thomas Watson CLA 2011-06-20 13:37:03 EDT
Created attachment 198272 [details]
updated work in progress

This patch fixes all the tests to pass.  I also changed the following:

1) Made the osgi.identity capability effective=resolve
2) Made it an error for a bundle to declare the osgi.identity capability in the Provide-Capability header.
Comment 4 John Ross CLA 2011-06-21 10:46:32 EDT
At the CPEG F2F, it was decided that a fragment's osgi.identity capability should not be merged into the host like other capabilities. I believe that decision will affect this patch at both the implementation and test level.
Comment 5 Thomas Watson CLA 2011-06-22 12:40:13 EDT
Created attachment 198420 [details]
updated work in progress

(In reply to comment #4)
> At the CPEG F2F, it was decided that a fragment's osgi.identity capability
> should not be merged into the host like other capabilities. I believe that
> decision will affect this patch at both the implementation and test level.

Here is an updated patch that implements this behavior.
Comment 6 John Ross CLA 2011-06-28 19:04:11 EDT
Created attachment 198779 [details]
updated work in progress with new tests

This patch adds some new tests focusing on resources and the identity capability.

Failures are occurring in the following areas.

(1) Merging an osgi.identity requirement within a fragment into its host. My understanding is although a fragment's identity capability is not merged into the host, identity requirements are treated like any other.

(2) Returning the osgi.identity capability of a fragment as part of BundleWiring.getCapabilities().

(3) Returning the wire associated with the osgi.identity capability of a fragment as part of BundleWiring.getProvidedWires().

With regard to (2) and (3), the wire actually exists and can be retrieved from the requirer's BundleWiring.

The parts of the test that are failing have been commented out and marked with a TODO.
Comment 7 John Ross CLA 2011-06-29 15:46:53 EDT
Created attachment 198857 [details]
proposed patch

This updated patch fixes some test and implementation issues. All tests now pass.

The test issues revolved around expecting a fragment's identity capability to be part of the host revision's capabilities, which is incorrect. A fragment's identity capability should be part of the host wiring's capabilities, however.

Fixes to the framework impl were as follows.

(1) BundleDescriptionImpl.DescriptionWiring.getCapabilities was changed to always return the selected generic capabilities for both bundles and fragments. Previously, it always returned an empty list for fragments which suppressed the fragment's identity capability.

(2) BundleDescriptionImpl.BundleWireImpl.getProvider and getRequirer now return the wiring's provider and requirer revisions, respectively, instead of the capability and requirement revisions.
Comment 8 John Ross CLA 2011-06-30 12:20:03 EDT
Created attachment 198921 [details]
proposed patch

This patch adds additional tests for generic requirement and capability matching.

Also adds a fix to VersionConstraintImpl.BundleRequirementImpl.matches which now checks the namespace and accepts a null filter in the generic case.
Comment 9 Thomas Watson CLA 2011-07-01 14:07:41 EDT
Thanks for the work on this John.  I am going to review this and plan to release.  I first want to run through the OSGi CT and see where we break.  I know we will break in some places because of the new osgi.identity capability we are adding.
Comment 10 Thomas Watson CLA 2011-07-05 12:24:54 EDT
Created attachment 199140 [details]
latest patch

This patch adds the arbitrary directives and attributes from the Bundle-SymbolicName header to the identity capability.
Comment 11 Thomas Watson CLA 2011-07-05 15:23:25 EDT
Created attachment 199146 [details]
updated patch

I updated the patch to move the test bundles out from the source folders.  There was no need to use real source folders for the tests since there is no java code in them.  The previous patches would have failed because the build.properties file was not modified to actually build these test bundles.
Comment 12 Thomas Watson CLA 2011-07-05 15:24:13 EDT
patch released.