Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Passing in parameters from runtime code


In my case, I know that all interesting methods are called from a ControllerCommand which has session and other logon information.  So I declare a pointcut as:

pointcut perfExec(ControllerCommandImpl controller):
        cflowbelow(execution(* ControllerCommandImpl+.performExecute()))
        && this(controller) // ...

and log the session along with other statements as:

before(ControllerCommandImpl controller) : perfExecExec(controller) {
        String sessionId = "";
        try {
                sessionId = controller.getCommandContext().getSessionContext().getUniqueSessionTag();          
        } catch( Exception e ) {
                // ignore
        }
        // ...

If you expect to have some session information such as the authentication objects, likely you will have some central choke-points like this too.

cheers,
-adrian.
--
Adrian Powell
Centre for IBM e-Business Innovation :: Vancouver
apowell@xxxxxxxxxx / 604-297-3194



"Seaman, Sloan" <Sloan.Seaman@xxxxxxxxxxx>
Sent by: aspectj-users-admin@xxxxxxxxxxx

09/03/2004 10:54 AM

Please respond to
aspectj-users

To
"'aspectj-users@xxxxxxxxxxx'" <aspectj-users@xxxxxxxxxxx>
cc
Subject
[aspectj-users] Passing in parameters from runtime code





How do I get a variable from the running code into some Aspect?

What I mean to say is that I have an web app that for each user logged in, there is a javax.security.auth.Subject object for.  I'm using AspectJ to record all SQL statements that end up getting executed but how do I tie them to the Subject?

I.E. How do I get the .aj code to have an instance of the Subject object?  I can't put it in a static place in memory because since it is a web app, I have to worry about threading issues.

Anyone know how I can pull this off?

Thanks!

--
Sloan


Back to the top