[aosd-discuss] Flow control in aspectJ and wave control

Fabiano Ricci faricci at gmail.com
Thu Sep 28 08:02:23 EST 2006


Hi all,

I have another question, please. I have a Java application and some 
aspects (defined in AspectJ). The aspects serve to monitor the Java 
program. One aspect is responsible to take an input from user keyboard 
and pass it to another aspect that implement a filter on what I must 
trace. With simple aspect monitor and target program I don't have any 
problem because the weaving between aspects and target program is task 
of AJDT. Now I need an idea to have a flow control on my aspect (when I 
need to run the target program and when my aspect): first I need to run 
one particular aspect and than the target program with another aspect 
that catches the executions in the program. The problem is more 
complicated because the target program is a black-box application, so I 
cannot modify it. Anyone have any ideas?

An Example: (Catch all the execution in program target)

First I need to obtain what package I must trace
---------
public aspect GetTrace {
    ..
    pointcut Scope(): !within(nuovo..*);       
    ..
    pointcut mainPoint(): Scope() && call (public static void 
main(String[]));
    ..
    before() : mainPoint() {
        ..
        String INPUT = readMyInput();
        ..
    }
}
---------
and than I need to run target program and wave it with the follow aspect
---------
public aspect DynamicTrace {
    ..
    pointcut Scope(): !within(nuovo..*);       
    ..
    pointcut profile(): Scope() && call(* INPUT.*(..));
    ..
    Object around(): profile() {
        ..
        logTargetProgram();
        ..
    }
}

Target Program:
..
public static void main(String[] args) {      
       doSomething();
        ....
}
..
---------

What are the best method to pass a variable between two aspect? Can I 
control the flow of all my aspects and target program?
How can I execute GetTrace and than launch the target program with 
DynamicTrace aspect ( modified with result from GetTrace)? Is Ant 
suitable for this purpose?

sorry for the length  of this message and thank you in  advance for 
replies...

best regards

-- 
Fabiano Ricci

  HomePage   --:. http://www.stalsy.it
  Blog       --:. http://blog.stalsy.com
  Public Key --:. http://www.stalsy.it/key.php
  E-Mail     --:. faricci at gmail.com || stalsy at stalsy.it
  ICQ        --:. 302346155
  MSN        --:. faricci at lycos.it




More information about the discuss mailing list