[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-users] Not catching all methods

Title: Message
I think you want execution here as well. 
-----Original Message-----
From: Seaman, Sloan [mailto:Sloan.Seaman@xxxxxxxxxxx]
Sent: Tuesday, September 07, 2004 12:16 PM
To: 'aspectj-users@xxxxxxxxxxx'
Subject: RE: [aspectj-users] Not catching all methods

Changing things over to execution seems to have fixed the first questions issues.
 
Things still aren't working for the other question.
 
If you have a method such as:
public static void setAuditable(Subject subject) {}
 
will
execution (public static void AspectAuditProxy.setAuditable(Subject))
 
work?
 
Thanks!
--
Sloan
-----Original Message-----
From: DiFrango, Ron [mailto:ron.difrango@xxxxxxxxxxxxxx]
Sent: Tuesday, September 07, 2004 11:13 AM
To: 'aspectj-users@xxxxxxxxxxx'
Subject: RE: [aspectj-users] Not catching all methods

I believe that because you are using a call join point, you need to weave into your JDO package.  You should maybe try switching to execution join points and it will work properly.
-----Original Message-----
From: Seaman, Sloan [mailto:Sloan.Seaman@xxxxxxxxxxx]
Sent: Tuesday, September 07, 2004 10:52 AM
To: 'aspectj-users@xxxxxxxxxxx'
Subject: RE: [aspectj-users] Not catching all methods

I'm weaving it into the oracle jdbc implementation (classes12.zip).
 
I figure that if I do it that way I get down to the lowest level and can record the info if the developer uses JDO, straight JDBC, or something else :)
 
--
Sloan
 
-----Original Message-----
From: DiFrango, Ron [mailto:ron.difrango@xxxxxxxxxxxxxx]
Sent: Tuesday, September 07, 2004 10:35 AM
To: 'aspectj-users@xxxxxxxxxxx'
Subject: RE: [aspectj-users] Not catching all methods

For your 1st question, Are you weaving you aspect into the JDO code? If not then you need to be in order to get these calls logged.
-----Original Message-----
From: Seaman, Sloan [mailto:Sloan.Seaman@xxxxxxxxxxx]
Sent: Tuesday, September 07, 2004 10:01 AM
To: 'aspectj-users@xxxxxxxxxxx'
Subject: [aspectj-users] Not catching all methods

Two questions:

First:
I seem to be hitting some odd behavior with AspectJ.

As discussed earlier, I have an Aspect that watches all the SQL calls to my JDBC Driver (Oracle).  It then logs the statements to a log file via Log4j.

It seems to only be doing this some of the time though.  Here is my aspect:
    private static AuditLogger LOG =
        AuditLogger.getLogger(StatementAspect.class, LDAPPrincipal.class);
   
    pointcut executeSql(String sql):
                (
                call (public CallableStatement Connection.prepareCall(..)) ||
                call (public PreparedStatement Connection.prepareStatement(..)) ||
                call (public boolean Statement.execute(..)) ||
                call (public ResultSet Statement.executeQuery(..)) ||
                call (public int Statement.executeUpdate(..)) ||
                call (public void Statement.addBatch(..))
                ) &&
                args(sql, ..);
       
       
        before(String sql): executeSql(sql) {
                recordSqlStmt(sql);
        }
        private void recordSqlStmt(String sql) {
                // custom level
            LOG.audit((Subject)currentSubjectHolder.get(), sql);
        }

It seems to log it initiailly but when my JDO implementation (XORM) does anything, it doesn't get logged.  I've looked at XORM's src and it is using Connection.prepareStatement(String)....

Any one know what this would be happening?


Second question:

I have a class, AspectAuditProxy that has the following:
    public static void setAuditable(Subject subject) {}

    public static void setAuditable(Subject subject, Class principalClass) {}
   
    public static void setAuditable(Class auditingClass,
        Subject subject, Class principalClass)
    {}

I then have an Aspect like so:
        before (Subject subject):
            call (public static void AspectAuditProxy.setAuditable(Subject)) &&
            args(subject)
        {
            currentSubjectHolder.set(subject);
        }

        before (Subject subject, Class principalClass):
            call (public static void AspectAuditProxy.setAuditable(Subject, Class)) &&
            args(subject, principalClass)
        {
            currentSubjectHolder.set(subject);
            LOG = AuditLogger.getLogger(StatementAspect.class, principalClass);
        }

        before (Class auditingClass, Subject subject, Class principalClass):
            call (public static void AspectAuditProxy.setAuditable(Class, Subject, Class)) &&
            args(auditingClass, subject, principalClass)
        {
            currentSubjectHolder.set(subject);
            LOG = AuditLogger.getLogger(auditingClass, principalClass);
        }

But it doesn't seem to be catching anything.  I use AspectAuditProxy as a way to get the Subject object to the Aspect system for logging purposes like so (in my Login.class):

LoginContext lc = new LoginContext("Ldap",
            new SimpleCallbackHandler(username, password));
lc.login();
AspectAuditProxy.setAuditable(lc.getSubject());

Any ideas about this one?

Sorry for the long email...

--
Sloan

************************************************************************** The information transmitted herewith is sensitive information intended only for use by the individual or entity to which it is addressed. If the reader of this message is not the intended recipient, you are hereby notified that any review, retransmission, dissemination, distribution, copying or other use of, or taking of any action in reliance upon this information is strictly prohibited. If you have received this communication in error, please contact the sender and delete the material from your computer.

************************************************************************** The information transmitted herewith is sensitive information intended only for use by the individual or entity to which it is addressed. If the reader of this message is not the intended recipient, you are hereby notified that any review, retransmission, dissemination, distribution, copying or other use of, or taking of any action in reliance upon this information is strictly prohibited. If you have received this communication in error, please contact the sender and delete the material from your computer.

************************************************************************** The information transmitted herewith is sensitive information intended only for use by the individual or entity to which it is addressed. If the reader of this message is not the intended recipient, you are hereby notified that any review, retransmission, dissemination, distribution, copying or other use of, or taking of any action in reliance upon this information is strictly prohibited. If you have received this communication in error, please contact the sender and delete the material from your computer.