The specification only mandates that the exports and constraints added by a fragment bundle must not result in an inconsistent class space. Other sections in the specification go into great details on what a consistent class space is. The rest of this note explains what the RI does to determine fragment constraint and export conflicts:
There are two situations to consider with a host bundle. 1) The host
already resolved 2) The host is unresolved.
1) Resolved host. The specification leaves this as an implementation
detail. Many implementations simply do not allow a fragment to dynamically
attach to an already resolved host. This is perfectly acceptable from a
specification point of views. The RI allows this to happen if the
following is true:
a) The fragment adds no new exports. We do not allow a host bundle to
dynamically add new exports from fragments. These types of fragments must
be resolved at the same time as their host.
b) Any Import-Package or Require-Bundle constraints must be satisfied by
existing constraint wires which the resolved host is currently using. In
other words a fragment is not allowed to dynamically add new imports to a
resolved host which results in the host having access to new classes.
2) Unresolved host. In this case we are resolving the host and the
fragment at the "same time". In this case the resolver needs to do the
following:
a) For Import-Package statements if the host imports the same package name
then a single export must be picked which satisfies the Import-Package
statement from both the host and fragment (by satisfy I mean satisfies both
version ranges and matching attributes etc.). If no export exists that can
satisfy both then the fragment is dropped. If the host does not import the
same package name then the Import-Package statement is appended to the rest
of the host import-packages. In both cases a consistent class space check
is made to ensure that the export picked to satisfy the import provides a
consistent class space for the host.
b) For Require-Bundle statements if the host requires the same symbolic
name then a single bundle must be picked which satisfies the Require-Bundle
statement from both the host and fragment (by satisfy I mean satisfies both
version ranges). If no bundle exists that can satisfy both then the
fragment is dropped. If the host does not require the same symbolic name
then the Require-Bundle statement is appended to the rest of the host
require-bundles. In both cases a consistent class space check is made to
ensure that the bundle picked to satisfy the require-bundle provides a
consistent class space host.
Again, the spec goes into great detail on what a consistent class space is
with respect to the uses clause.
Tom
From: "Alan D. Cabrera" <[email protected]>
To: "[email protected]" <[email protected]>
Date: 04/03/2009 08:23 PM
Subject: [osgi-dev] Conflicting fragment imports/exports
Not sure if I have asked this before but, what is the exact criteria
used to determine when a fragment's imports and export conflict with a
potential host?
Regards,
Alan
Sent from my iPhone
_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev
<<inline: graycol.gif>>
<<inline: ecblank.gif>>
_______________________________________________ OSGi Developer Mail List [email protected] https://mail.osgi.org/mailman/listinfo/osgi-dev
