Skip to main content



      Home
Home » Eclipse Projects » Equinox » Buddy Policy Question
Buddy Policy Question [message #86199] Wed, 04 April 2007 20:05 Go to next message
Eclipse UserFriend
Originally posted by: abhijit.sawant.ca.com

I've noticed that not only classes but also any other resources
available in a bundle become available to a bundle that has a "dependent"
buddy policy (Eclipse-BuddyPolicy: dependent).
So for instance, say I have a bundle named base.bundle that specifies it
uses dependent buddy policy, and I have a bundle named dependent.bundle
that depends on base.bundle, a resource such as META-INF/aop.xml from
dependent.bundle will be visible to base.bundle.
My first question is if this is by design or a bug? The reason it could
be a bug is that I see no way of making a resource that is not a class
available to a dependent bundle via the "Export-Package" mechanism (if
there is, please let me know), and therefore, by analogy I'd expect that
this would not work in the buddy model either.
For those familiar with AOSGI, what ends up happening because of this is
that the base.bundle gets weaved at runtime with its dependent bundle's
aspects, something that is not desirable (at least in my case).

Thnx.
Re: Buddy Policy Question [message #86292 is a reply to message #86199] Thu, 05 April 2007 01:37 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

Reading the javadoc for Bundle.getResource() it seems that if the bundle
is resolved, the imported packages will be searched too, so I think it
is possible to make resources available to other bundles via Export-Package.

In the case for Eclipse-BuddyPolicy I don't think it is strange that
resource are shared too. I'm not familiar with AspectJ, but it is enough
to provide META-INF/aop.xml in your bundle, in order to load the correct
aop.xml. The buddy policy is asked for a resource if it is not found in
the bundle classpath (imported packages and local classes).

Danail

Abhijit Sawant wrote:
> I've noticed that not only classes but also any other resources
> available in a bundle become available to a bundle that has a
> "dependent" buddy policy (Eclipse-BuddyPolicy: dependent).
> So for instance, say I have a bundle named base.bundle that specifies
> it uses dependent buddy policy, and I have a bundle named
> dependent.bundle that depends on base.bundle, a resource such as
> META-INF/aop.xml from dependent.bundle will be visible to base.bundle.
> My first question is if this is by design or a bug? The reason it could
> be a bug is that I see no way of making a resource that is not a class
> available to a dependent bundle via the "Export-Package" mechanism (if
> there is, please let me know), and therefore, by analogy I'd expect that
> this would not work in the buddy model either.
> For those familiar with AOSGI, what ends up happening because of this
> is that the base.bundle gets weaved at runtime with its dependent
> bundle's aspects, something that is not desirable (at least in my case).
>
> Thnx.
>
Re: Buddy Policy Question [message #86367 is a reply to message #86292] Fri, 06 April 2007 18:52 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: abhijit.sawant.ca.com

Danail,
Thanks for the answer. The problem is not that I want to access aop.xml
from another bundle, the problem is that I don't want the base bundle (the
one with buddy-policy set to dependent) to access it from a dependent
bundle (which is what is currently happening).
On the matter of discrepancy, I've clearly verified through testing that
there is one. If I add "META-INF" forcefully to the list of exported
packages, Eclipse shows an error on the Manifest file. On a side note,
droping a resource (say hello.txt) in a package that is exported does make
that resource available to dependent bundles.
Re: Buddy Policy Question [message #86472 is a reply to message #86367] Tue, 10 April 2007 02:09 Go to previous messageGo to next message
Eclipse UserFriend
Abhijit,

Have you tried to add aop.xml to the base.bundle, so when AspectJ is
looking for resource it will find the one in base.bundle and will not
try to search in dependent.bundle?

This should solve your problem. But there is a chance that I didn't get
your problem right:)

Danail

Abhijit Sawant wrote:
> Danail,
> Thanks for the answer. The problem is not that I want to access aop.xml
> from another bundle, the problem is that I don't want the base bundle
> (the one with buddy-policy set to dependent) to access it from a
> dependent bundle (which is what is currently happening).
> On the matter of discrepancy, I've clearly verified through testing
> that there is one. If I add "META-INF" forcefully to the list of
> exported packages, Eclipse shows an error on the Manifest file. On a
> side note, droping a resource (say hello.txt) in a package that is
> exported does make that resource available to dependent bundles.
>
Re: Buddy Policy Question [message #86512 is a reply to message #86472] Tue, 10 April 2007 21:11 Go to previous message
Eclipse UserFriend
Originally posted by: abhijit.sawant.ca.com

Danail,
You are absolutely right, that would work. The problem with this
approach is two fold though. First, this would be a hack (forcing a dummy
aop.xml to avoid using the dependent bundle's file). Secondly, I don't own
or control all of the base bundles (they are developed by other teams and
some might even be third party bundles), so I'd have to "post process" the
bundles and add content (not an elegant solution - so again, hacky).

Thanks,
Abhijit
Previous Topic:Newbie: OSGi questions
Next Topic:How to forward a request through the equinox bridge to OSGi
Goto Forum:
  


Current Time: Fri Jul 18 15:17:00 EDT 2025

Powered by FUDForum. Page generated in 0.44989 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top