File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Pointcut expression

 
Buddhadeb Ghosh
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am new to JBoss AOP. I am behind a logger aspect which should log every methods
under "com.mycompany" and it's sub packages. I got a expr
execution(* com.mycompany.mn.dc.common.client..->*(..))
working which takes care of only the classes/methods inside "client" package. But I need to take care of all the methods of "com.mycompany" and it's sub packages. So I tried with
execution(com.mycompany.* *->*(..))
but failed to do so. I come from spring background where
execution(* com.mycompany..*.*(..))
works. But I dont know how to make it work in JBoss AOP. Could anybody help me out?
 
Jaikiran Pai
Marshal
Pie
Posts: 10444
227
IntelliJ IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Buddhadeb Ghosh wrote:So I tried with
execution(com.mycompany.* *->*(..))
but failed to do so.


Does this work:



Also see if this documentation helps
 
Buddhadeb Ghosh
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No...That does not work. It says
org.jboss.aop.pointcut.ast.ParseException: Encountered "execution( com.mycompany.* -> *" at line 1, column 1.
 
Buddhadeb Ghosh
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The documentation says
.. following a package-name is used to specify all classes from within a given package ut not within sub-packages
but it nowhere says what should be done to include sub-packages. I did a lot of googling on that.But could not find it.The below expr runs without error but never intercepts.
execution(* com.mycompany..->*(..))

Any expr expert would like see??
Any idea where can i find tutorial for jboss aop expr?
 
Buddhadeb Ghosh
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jaikiran

I saw a similar sample here.

It also suggests the same way
execution(* com.*->*(..))
as you.

But I am not getting why it is not running in my application... By the way.. I am running in a standalone application with jboss-aop-single.jar in classpath
and along with vm args :


Could it be a env issue? but as I mentioned in my first post... my application works fine with
execution(* com.mycompany.mn.dc.common.client..->*(..))


Would appreciate for any help.
 
Jaikiran Pai
Marshal
Pie
Posts: 10444
227
IntelliJ IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For those watching this thread, this question has now been answered here
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic