Version 5

    Tutorial Part 2

     

    Navigation

    -


    Tutorial Part 1

    Tutorial Part 2

     

    JBoss-IDE/AOP Tutorial Part2

     

    In the real world, when developing AOP application across a development team, you can expect it will be hard to understand when and where aspects are applied in your codebase.

    JBoss-IDE/AOP has a few different strategies for notifying developers when an aspect is applied to a certain part of code.

     

    Advised Markers

    -


    A marker in eclipse is a small icon that appears on the left side of the editor. Most developers are familiar with the Java Error and Bookmark markers. The AOP IDE provides markers for methods and fields which are intercepted. To further facilitate this marking, anytime the developer presses Ctrl + 1 (the default key combination for the Eclipse Quick Fix functionality)), a list of interceptors and advice will be given for that method or field. This makes navigation between methods and their interceptors extremeley easy!

     

     

    The Advised Members View

    -


    The Advised Members view gives the developer an overview of every single method and field in the current class that is advised by an Aspect or Interceptor. Let's have a look.

    • From the Eclipse main menu, click on Window > Show View > Other...

    • In the window that opens, you should see a folder called "JBoss AOP". Press the "+" to expand it.

    • Double click on "Advised Members"

    Once you've done this, you should now make sure you are currently editing the HelloAOP class we created in the last tutorial. Once you have that class open in an editor, you should see something similar to this in the Advised Members view:

     

     

    Here we see that the method "callMe()" is intercepted by the interceptor "HelloInterceptor". Double clicking on HelloInterceptor will take you straight to it. This view is similar to the Outline view, except it only shows members in your class which are intercepted.

     

    The Aspect Manager View

    -


    WARNING This view is considered advanced.

    The Aspect Manager View is a graphical representation of the AOP descriptor file (jboss-aop.xml). It allows you to remove an Interceptor or advice from a pointcut, as well as apply new Interceptors and Advice to existing pointcuts.

    • From the Eclipse main menu, click on Window > Show View > Other...

    • In the window that opens, you should see a folder called "JBoss AOP". Press the "+" to expand it.

    • Double click on "Aspect Manager"

     

    Under Bindings, you'll notice that a pointcut is already defined that matches our "callMe()" method, and our "HelloInterceptor" is directly under it. Right Click on "HelloInterceptor" will provide you with this menu:

     

    You can remove the interceptor, or jump to it directly in code. If you right click on the binding (pointcut) itself, you'll be able to apply more interceptors and advice just like when right clicking on a field or method in the outline view. You can also remove the entire binding altogether (which subsequently removes all child interceptors and advice, be warned):