Skip to main content

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

Martin,

Thanks for your quick response.

> I assume your target bundle defines an Import-Package on the common
> bundle as well as your aspect bundle.

My target bundle imports the common bundle, but doesn't import any package from the aspect bundle (should it? why?).

> But how are the dependencies for your aspect bundle defined?
...
> - your aspect bundle defines, for example, a "Eclipse-SupplementBundle"
> header in the manifest that points to your target bundle.

I put both the common and the target bundles in the aspect bundle's "Eclipse-SupplementBundle" manifest header.

The way I see it, the problem is not that the *aspect* doesn't get woven, but that the *pointcut* isn't matched. I verified that the aspect is woven by writing an advice like before():call(* *.*(..)) && !within(MyAspect) {...}, which IS applied correctly.

Any ideas?

Yang


> 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
> >
> >
> _______________________________________________
> equinox-dev mailing list
> equinox-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/equinox-dev


Back to the top