pcflow utility

"Nadia Belblidia-Guerroumi" <[email protected]>
Newsgroups gmane.comp.programming.aspect.general
Message-ID <[email protected]>
HI all,

I try to find an example that shows the utility of pcflow pointcut. Do you think that the following example is good?

Example: Adding security mechanism to all the getConnection calls that are in the predictive control flow of a Replace SQL execution query.  The advice and the java program where to incorporate the advice ae given in the following:

Aspect Secure {
    pointcut executQuery(String s): execution(*.executeQuery(...)) && args(*,s);
    pointcut getConnectionWithReplace(String s,Properties p): call(*.getConnection(...))&& args(*,p) && pcflow(executQuerywith(s))&& if(isFirstSubstring(s,"REPLACE"); 
    Before(Properties p, String s): getConnectionWithReplace(p,s)(): { 
                p.put("securityMechanism", new String("" + com.ibm.db2.jcc.DB2BaseDataSource.USER_ONLY_SECURITY + ""));
      }
}


import java.sql.*;

import com.ibm.db2.jcc.*;

public static void main(String[] args) {

     ...

Properties properties = new Properties();

 properties.put("user","db2adm");

 properties.put("password", "db2adm");

String url =..

....

Connection con =DriverManager.getConnection(url,properties);

Statement st = db2Conn.createStatement();

String query = "REPLACE... "

 ResultSet resultSet = st.executeQuery(query);

....

__________________________________________________
AOSD Discuss mailing list    -    [email protected]
To unsubscribe go to http://aosd.net

Check out the AOSD.net Wiki: http://aosd.net/wiki
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.