On Mar 10, 2008, at 4:51 PM, Mirko Jahn wrote:

On Mon, Mar 10, 2008 at 11:34 PM, Alan Cabrera <[EMAIL PROTECTED]> wrote:


IIUC, Fragments become resolved as a byproduct of the host, to which
it has been attached to, becoming resolved.  If this is true then
resolving Fragments should be essentially a do nothing operation?
Well, fragments don't have their own class loader and they are seen as
part of the host. I think the spec is not 100% precise here (unless I
overlooked something), but I suspect it to be the same behavior as
with updating of already attached fragments. Here the spec states that
the host has to be refreshed. The spec also states that attaching is
part of the resolving process of the host, so I guess the host has to
be resolved again, but I am not sure on that one. Maybe someone else
can answer that one better.

Re-reading the spec I think that the only consistent interpretation is that both hosts fragments can be resolved.

One thing I was always curious about is the resolving process together
with fragments. The spec states that the class path of the host has to
be searched first, so far so good, but how does this relate to the
whole lookup process? When we are using a fragment will first the
lookup process of the host finish from beginning to the end
(Import-Package --> Require-Bundle -->...) before the fragment is
asked or will it be like a ping pong affect (look for Import-Package
in the host before the fragment, then look for Require-Bundle in the
host before the fragment and so on).

A fragment's imports, required bundles, and exports that do not conflict are added to the host bundle's set when it's being attached. The resulting wires are added to the host bundle. These are added to the end of the existing set of wires and so the host bundle's wires are searched first. So, it's kinda like the latter.

If the later is true, a fragment
can be used to replace an internal class by defining an Import-Package
(or Require-Bundle) statement and providing that one with a third
bundle. If so, this might be useful as a pattern in order to replace
corrupted implementations without violating licenses, because you do
not have to touch the 3rd party bundle. If it is the first behavior,
it is fine as well, because with that a bundle is more robust and
resistant against other potentially malicious bundles.

Host bundles are protected by perms that are required for a fragment to attach itself. So, for the latter, you get the best of both worlds.

It  would just
be good to know. Sorry for bringing up my question in your thread, but
I though it kinda fits in here.

No worries.


Regards,
Alan


_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to