[jboss-user] [JBoss AOP] - Re: jboss aop

flavia.rainone@jboss.com do-not-reply at jboss.com
Fri Sep 14 07:44:11 EDT 2007


Hi!

You need to use one or more prepare expressions on the target application at startup so that the runtime changes become effective.

The prepare expression must match all the joinpoints you intend to intercept at runtime (as result of a dynamic operation). These prepare expressions must be on a jboss-aop.xml file to be detected at loadtime by JBoss AOP.

So, if you want to add dynamically a pointcut like the following:
execution(public void myPackage.MyClass->myMethod())"

Any one of the following prepare expressions, to name a few, would be enough:
execution(public void myPackage.MyClass->myMethod())"
  | execution(* * myPackage.MyClass->myMethod())"
  | execution(* * *->myMethod())"
  | execution(* * *.MyClass->myMethod())"
  | execution(* * *.MyClass->*(..))"
  | all(myPackage.MyClass)
  | all(*.MyClass)
  | all(myPackage.*)
  | all(*)
  | 

The more restrictive the prepare expressions you use, the less performance impact you will see on your code. The more generic your prepare expressions, the more joinpoints you can start intercepting at runtime.

To see more on this, take a look at the Dynamic AOP example of our tutorial. The Per Instance Interception part of this example does something very similar to what you're trying to do, except for the fact that it affects only one instance of POJO, while you are adding the bindings to AspectManager to affect all instances of a class.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4084400#4084400

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4084400



More information about the jboss-user mailing list