0 Replies Latest reply on Sep 24, 2008 12:22 PM by kabirkhan

    Updated to new AOP deployers in AS trunk

    kabirkhan

      Moved from http://www.jboss.com/index.html?module=bb&op=viewtopic&t=139015

      "kabir.khan@jboss.com" wrote:
      I have almost completed the new AOP deployers. The aim was to install the AOP artifacts via MC beans rather than directly into the aspect manager as was the case previously. Locally, with my changes here I am able to get the full AOP testsuite passing. I have yet to try out ejb3-interceptors-aop.xml, which I will look at on Monday.

      Before I can upgrade AS trunk I need to do another AOP release, then we need a release of MC (aop-mc-int). Once upgraded in AS, and switched over to use the new deployers the following two things apply to all jboss-aop.xml files used in AS

      1) The aop namespace must be defined, so the contents of the file must be as follows:
      <?xml version="1.0" encoding="UTF-8"?>
      <aop xmlns="urn:jboss:aop-beans:1.0">
      ...
      </aop>
      


      2) interceptors can only be defined at the top level. We don't support:
      <?xml version="1.0" encoding="UTF-8"?>
      <aop xmlns="urn:jboss:aop-beans:1.0">
       <bind pointcut="all(@Test1)">
       <interceptor class="MyInterceptor"/>
       </bind>
       <bind pointcut="all(@Test2)">
       <interceptor class="MyInterceptor"/>
       </bind>
      </aop>
      


      instead you must use the alternative syntax (which is similar to how aspects/advice-bindings work)
      <?xml version="1.0" encoding="UTF-8"?>
      <aop xmlns="urn:jboss:aop-beans:1.0">
       <interceptor class="MyInterceptor"/>
       <bind pointcut="all(@Test1)">
       <interceptor-ref name="MyInterceptor"/>
       </bind>
       <bind pointcut="all(@Test2)">
       <interceptor-ref name="MyInterceptor"/>
       </bind>
      </aop>
      





      I have updated AS trunk to use this now. An additional constraint is now is that since everything maps onto MC beans in the background, names must be unique within a classloader domain. So, the following is not allowed
      <?xml version="1.0" encoding="UTF-8"?>
      <aop xmlns="urn:jboss:aop-beans:1.0">
       <interceptor name="Blah" class="x"/>
       <bind name="Blah" pointcut="...">
       <interceptor-ref name="Blah"/>
       </bind>
      </aop>
      

      Since both the interceptor and the binding result in an underlying MCBean called "Blah". Duplicate bean names are not allowed within a controller. Rather you need to do
      <?xml version="1.0" encoding="UTF-8"?>
      <aop xmlns="urn:jboss:aop-beans:1.0">
       <interceptor name="Blah" class="x"/>
       <bind name="BlahBind" pointcut="...">
       <interceptor-ref name="Blah"/>
       </bind>
      </aop>
      



      I ran the smoke and some other tests, but in case this breaks something unforeseen for somebody while I am out this evening, you can undo the changes by reverting
      https://svn.jboss.org/repos/jbossas/trunk/server/src/etc/conf/default/deployers.xml
      to revision 78640.