Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [equinox-dev] [aspects] Pointcuts over types in separate bundle

Hi Yang!

I assume your target bundle defines an Import-Package on the common bundle as well as your aspect bundle. But how are the dependencies for your aspect bundle defined? There are two common cases:

- target bundle defines a Require-Bundle on the aspect bundle. Then your aspects get applied.

- your aspect bundle defines, for example, a "Eclipse-SupplementBundle" header in the manifest that points to your target bundle.

Which use case do you use?

-Martin




Meyer, Yang wrote:
Hi,

I am having problems defining pointcuts over an interface declared in a separate bundle:

I would like to weave an "aspects" bundle into a "target" bundle, using types in the "common" bundle for defining my pointcuts. The "common" bundle contains an interface that the target bundle uses and implements. Here's an example:

* The "common" bundle contains IServiceInterface, which declares two methods: void foo() and void bar().

* The target bundle has a class MyServiceImpl that implements the IServiceInterface. The target bundle also contains a class that uses the interface, something like this:
        IServiceInterface myServiceImpl = new MyServiceImpl();
        myServiceImpl.foo();

* The aspects bundle contains an aspect with the following advice:
        before() : call(* IServiceInterface+.*(..)) {
                // a service was invoked, do something else first
        }

Obviously what I want is for the aspect to apply the advice to all invocations of all methods declared in IServiceInterface. However, the pointcut does not seem to match anything. (I first thought there was something wrong with my set-up/config, because the whole bundle wasn't woven, but it turned out that was just because none of the pointcuts matched.)

Is this sort of thing outright impossible, or am I just doing it wrong?

Thanks for your help,

Yang
_______________________________________________
equinox-dev mailing list
equinox-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/equinox-dev




Back to the top