Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » AJDT » Scope of Aspect Defined in Fragment
Scope of Aspect Defined in Fragment [message #495337] Wed, 04 November 2009 10:40 Go to next message
No real name is currently offline No real name
Messages: 2
Registered: July 2009
Junior Member
Hi there,

in an Eclipse-RCP application I have defined an aspect in a fragment and want it to match joinpoints in the the fragment host bundle. This, however does not seem to work. If I move the aspect to the host bundle, everything works fine. Both host and fragment have an aspectj nature. Now I wonder if this is a principal limitation or if I got something wrong.

For those interested - the context is the following: I keep the JUnit tests for the host bundle in the fragment. The RCP application makes heavy use of jobs and this quite often causes trouble in unit tests, because some tests depend on the result of jobs and I have to artificially make them wait for the jobs to finish. So I thought, I could write an aspect which matches the Job.schedule() method and uses an around advice to block this method and instead run the Job in the main thread. This works fine, when the aspect is living in the host bundle (which again is bad because then it is deployed into the application unless I use ugly things like system properties to block/activate it).

Thanks for any help Smile
tarek
Re: Scope of Aspect Defined in Fragment [message #496393 is a reply to message #495337] Mon, 09 November 2009 15:57 Go to previous messageGo to next message
Andrew Eisenberg is currently offline Andrew Eisenberg
Messages: 368
Registered: July 2009
Senior Member
In order to make weaving work in an OSGi environment, you need to use Equinox Aspects. This is because the dynamic nature of Eclipse requires aspects that apply across bundles be applied at load time.

See here for a description of how EA works:
http://www.eclipse.org/equinox/incubator/aspects/index.php

EA is included with the distribution of AJDT.
Re: Scope of Aspect Defined in Fragment [message #600727 is a reply to message #495337] Mon, 09 November 2009 15:57 Go to previous message
Andrew Eisenberg is currently offline Andrew Eisenberg
Messages: 368
Registered: July 2009
Senior Member
In order to make weaving work in an OSGi environment, you need to use Equinox Aspects. This is because the dynamic nature of Eclipse requires aspects that apply across bundles be applied at load time.

See here for a description of how EA works:
http://www.eclipse.org/equinox/incubator/aspects/index.php

EA is included with the distribution of AJDT.
Previous Topic:ITD scope
Next Topic:Error when running the aspectj book examples
Goto Forum:
  


Current Time: Wed Jul 23 22:26:22 EDT 2014

Powered by FUDForum. Page generated in 0.01610 seconds