Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [orbit-dev] Question on details of export, import, and requires

Hi, David,

These are good questions. See some comments in-line, below. I'm not an expert.

Cheers,

Christian

On 3-Nov-08, at 2:18 AM, David M Williams wrote:

I've been thinking of improving the constraints specified by our xerces,
and javax.xml bundles, etc. and have a few questions.

1. If "import-packages" is specified, is there any reason to also specify
"require-bundle"? I'd suspect not, but would it be wrong to? In
particular, I'm thinking of the "Require-Bundle: system.bundle" technique we've used. We do that so our bundle would "override" anything found from
the java VM, so am wondering it there's an equivalent concept with
Import-package, or if it would not be required in that case.

I would expect that, as require-bundle indicates a specific *source* from which we want to consume packages, that also specifying Import- Package (with dependency ranges) would be redundant and, worse, would increase the likelihood of resolution conflicts.


2. How to specify ranges? When we 'require bundles' we always specify a range, such as [1.3.4, 2.0.0). Is that still important when using import
package? I'd assume so ... but, sure seems tedious. :) What about on
"uses" ... any ranges to specify there?

Yes, these ranges work in package imports much as they do in require- bundles. At least, they did in my Batik bundles before I had to resort to Require-Bundle to resolve grievous class-loading issues when multiple qualifier versions of the same bundles were installed.

The "uses" directive doesn't specify version, because the imports do that. The "uses" is only a constraint on the package-wiring algorithm to help OSGi determine which dependency ranges to match with which export versions.


3. I've heard, as I'm sure we all have, we should import what we export.
See
http://www.osgi.org/blog/2007/04/importance-of-exporting-nd-importing.html
While counter-intuitive, I can see the rationale to be a "good osgi
citizen" ... but, what to do about ranges then? We are obviously only
exporting exactly one version ... I assume we'd import only that exact
same version ... even if ranges specified on other imports?

Hmmm ... I remember hearing this advice, trying it in Apache Batik, and finding that it failed miserably, again in the multiple-qualifiers- of-the-same-version scenario. Class-path inconsistency grief abounded. Certain OSGi experts advised me to desist in importing my exports, IIRC.

I wish I understood better what the issues were that I ran into.

Is this, then, the generally recommended practice? Should we make it standard for Orbit bundles? If so, I'll have a lot of work on my hands ...


Thanks for any insights.

Wish I had some to offer.  :-(


_______________________________________________
orbit-dev mailing list
orbit-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/orbit-dev

--
Christian W. Damus
Senior Software Developer, Zeligsoft Inc.
Component Lead, Eclipse MDT OCL and EMF-QTV
E-mail: cdamus@xxxxxxxxxxxxx





Back to the top