Skip to main content

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

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


Back to the top