Karl Pauls wrote:
On Mon, Jun 16, 2008 at 8:47 PM, Lucas Galfaso <[EMAIL PROTECTED]> wrote:
Hi All,
I find myself many times checking the spec on how a Bundle.update()
should behave so I end up reading Felix code. The spec is not very
clear (and a lot of times it is asking for the proper definition of
what Felix call IModule.)
Anyhow I find the following inconsistencies that I think are based
on discussions of the spec that I did not read.
The spec reads
<quote>
6.1.4.32 public void update( ) throws BundleException
[...]
If this bundle has exported any packages, these packages must not be
updated. Instead, the previous package version must remain exported
until the PackageAdmin.refreshPackages method has been has been called
or the Framework is relaunched.
</quote>
now this is consistent with
http://cwiki.apache.org/FELIX/apache-felix-osgi-faq.html#ApacheFelixOSGiFAQ-ApacheFelixOSGiFrequentlyAskedQuestions
This is, existing modules wired to the old module of the bundle that
was just updated, should remain wired with the old module. Right?
Correct.
The standard also reads
<quote>
4.3.10 Updating Bundles
[...]
The update process supports migration from one version of a bundle to
a newer version of the same bundle. The exports of an updated bundle
must be immediately available to the Framework. If none of the old
exports are used, then the old exports must be removed. Otherwise, all
old exports must remain available for existing bundles and future
resolves until the refreshPackages method is called or the Framework
is restarted.
</quote>
Now, this is somehow different from what
http://cwiki.apache.org/FELIX/apache-felix-osgi-faq.html#ApacheFelixOSGiFAQ-ApacheFelixOSGiFrequentlyAskedQuestions
reads, this may not be too bad as you may say that the wiki is just
slightly incomplete. Just as I said, not Not too bad.
Why is it incomplete?
The standard implies that if a package this module exports is used by
any other bundle, then the old package must remain available for
future resolves. This is how Felix behaves even when the wiki reads
something slightly different.
Where does it read differently?
Now, the issue is that using the Felix IModule naming, would it be
correct to say that the spec implies that:
- If we have a module X that is being updated, and there is another
module Y that is wired to X, then X must remain available to future
resolves. This future resolves includes new bundles.
?
Yes.
I would say "no" as
Felix._updateBundle(FelixBundle bundle, InputStream is)
reads (this action is performed if the new module is loaded properly)
// Mark previous the bundle's old module for removal since
// it can no longer be used to resolve other modules per the spec.
((ModuleImpl) info.getModules()[info.getModules().length -
2]).setRemovalPending(true);
This internal comment might be out of date (there has been a
clarification of the spec a while ago). If an export is used it
remains available for existing bundles and future resolves until a
refresh.
Yes, the comment it out of date. As Karl says, this was clarified in the
spec.
-> richard
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]