Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] AspectJ and Eclipse RCP

Users;

I'm trying to use AspectJ with an Eclipse RCP program.  I want to use aspects for the normal things, i.e. authorization and logging.

My failures seem to fall into 2 broad types: crash and burn or don't do anything.

My first try aspect looks like this:

Public aspect MyAspect
{
    pointcut mypointcut: call(* *.myMethod());

    before(): mypointcut()
    {
        System.out.println("Hello Aspect oriented programming");
    }
}

I have extensive logging turned on, but am not really sure what I'm looking for.
I get this: info register aspect <MyAspect>
I also get this: info weaving bundle '<my bundle>' with a bunch of stuff in between.
I even get: debug weaving '<MyService>'

MyService registers with OSGi Declarative Services, and is injected into the RCP object, but when I call myMethod on MyService the aspect isn't called.

On the other hand, when I set up an aspect like this:
Public aspect MyAspect
{
    pointcut mypointcut: call(* *.myMethod());

    before(): mypointcut()
    {
        System.out.println("Hello Aspect oriented programming");
    }
}

The RCP code freaks out, and doesn't run.

All the debug type output from AspectJ suggests that the AspectJ runtime is loaded and running.

BTW, where I eventually plan to go with this is to tie it to a Runtime Annotation, as follows:
Public aspect MyAspect
{
    pointcut mypointcut: call(@MyAnnotation * *());

    before(): mypointcut()
    {
        System.out.println("Hello Aspect oriented programming");
    }
}

But this too generates no aspect output.

Any thoughts?

Thank you,

Dominic L. Hilsbos, MBA, CSDA 
Director - Information Technology 
Perform Air International Inc.




Back to the top