Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[ajdt-dev] AOP question / wormhole

Hello all,
  sorry for this partially- off-topic question
i have following usecase..
I need to track changes to some database tables  (backed by EJBs), and for that i need to
get the user who did it as well as the data which has changed

My 'changes' are in a context of a webapplication, where the user first logs in to the application
and then will do all changes needed.

I have no problem in tracking changes (i can intercept hte methods of EJBs which do the changes), but
i m stuck in finding out how to get the user,.since the user who logs in is not passed down to the
EJB layer.

Obviously, i can write a LoginAspect that intercepts the login process, store locally the user and then make it available
to other aspects in my application
THis will work fine if the system will be used by only one user (considering the aspect will have default
association), but i have problems in undestanding
what will happen when there will be multiple users logging in,how to track them

I can't use anymore the 'default association'  LoginAspect, because (my opinion) if user1 logs in to the system,and
after that user2 logs in, the LoginAspect will have user2 'stored' as user. and if
user1 do changes, the ChangeAspect, invoking LoginAspect.getUser()  will get as user user2..
.
I have tried to use the wormhole pattern, but it didnt work out....

maybe i am missing something about association, but how can i have a 'Per User' association
for my LoginAspect?

does anyone have any idea on how to do that?

thanks in advance and regards
  Marco

Back to the top