1 2 Previous Next 23 Replies Latest reply on Jul 6, 2006 9:05 AM by kabirkhan Go to original post
      • 15. Re: KernelControllerContextAware

         

        "adrian@jboss.org" wrote:

        I was going to make a start on the aop xml today,


        Let me get the basic machinary working. Then we can
        discuss the rest.

        • 16. Re: KernelControllerContextAware
          kabirkhan

          Does the following work for you?

           <beanfactory name="InterceptedAdvice" class="org.jboss.test.microcontainer.support.InterceptorWithDependency">
           <property name="simpleBean"><inject bean="Dependency"/></property>
          
           <!-- Enables the deployed AspectDefinition and injects into the AspectFactory -->
           <install bean="InterceptedAspect" method="install">
           <parameter><this/></parameter>
           </install>
          
           <!-- undeploys the AspectDefinition, so it is not available when updating the interceptors -->
           <uninstall bean="InterceptedAspect" method="uninstall"/>
          
           <!-- Same as before: removes and reinstalls the AdviceBinding/AdviceFactory with the new
           AspectDefinition/AspectFactory -->
           <install bean="InterceptedBinding" method="rebind">
           <parameter><inject bean="InterceptedAspect" property="definition"/></parameter>
           </install>
           </beanfactory>
          


          I have got rid of the LazyGenericBeanAspectFactory, so we use GenericBeanAspectFactory regardless of if we do 1)
           <bean name="InterceptedAspect" class="org.jboss.aop.microcontainer.prototype.Aspect">
           <property name="adviceBean">InterceptedAdvice</property>
           <property name="manager"><inject bean="AspectManager"/></property>
           </bean>
          

          or 2)
           <bean name="InterceptedAspect" class="org.jboss.aop.microcontainer.prototype.Aspect">
           <property name="advice"><inject bean="InterceptedAdvice"/></property>
           <property name="manager"><inject bean="AspectManager"/></property>
           </bean>
          


          For the first variety of these we must have all the install/uninstall stuff in the beanfactory for the aspect to start. The second variety works without dependencies and injects this directly.

          • 17. Re: KernelControllerContextAware
            kabirkhan

            "The second variety works without dependencies and injects this directly." = injects the beanfactory directly

            • 18. Re: KernelControllerContextAware

              Looks ok to me.

              I made a start on the usecase xml.
              But obviously the aspect needs to be able to reuse the
              microcontainer bindings, so I'll have to factor these out
              of the microcontainer class so they can be reused.

              • 19. Re: KernelControllerContextAware

                By the way, we need a good way to differentiate the different cases.
                Except for the "lazy" rebinding of PER_VM aspects, the rebind is
                duplicate work under the current implementation.

                • 20. Re: KernelControllerContextAware

                  I've got this working as a prototype.

                  e.g. this test now becomes

                  <?xml version="1.0" encoding="UTF-8"?>
                  
                  <deployment xmlns="urn:jboss:bean-deployer:2.0">
                   <bean name="Repository" class="org.jboss.aop.microcontainer.prototype.AOPKernelRepository">
                   <constructor factoryClass="org.jboss.aop.microcontainer.prototype.AOPKernelRepository" factoryMethod="instance"/>
                   </bean>
                  
                   <aop:aspect xmlns:aop="urn:jboss:aop-beans:1.0"
                   name="InterceptedAdvice"
                   class="org.jboss.test.microcontainer.support.InterceptorWithDependency"
                   pointcut="execution(* @org.jboss.test.microcontainer.support.Test->*(..))">
                   <property name="simpleBean"><inject bean="Dependency"/></property>
                   </aop:aspect>
                  
                   <bean name="Intercepted" class="org.jboss.test.microcontainer.support.SimpleBeanImpl">
                   <annotation name="org.jboss.test.microcontainer.support.Test"/>
                   </bean>
                  
                  </deployment>
                  


                  It could do with some tidyup, but these are all internal implementation
                  details now. :-)

                  There is one outstanding in JBossXB, but I've worked around it for now.

                  • 21. Re: KernelControllerContextAware
                    kabirkhan

                    An easy way to do the differentiation would at first glance seem to be to have the AspectBeanMetaDataFactory check to see if the beanfactory has any dependencies. This information does not seem to be available in the BeanMetaData though and so does not appear to be available at the time AspectBeanMetaDataFactory.getBeans() is called. It does not seem to be available until later when it is populated in the KernelControllerContext?

                    • 22. Re: KernelControllerContextAware
                      kabirkhan

                      Ignore my previous post, I'm able to discover the dependencies

                      • 23. Re: KernelControllerContextAware
                        kabirkhan

                        I've made some changes to AspectBeanMetaDataFactory.

                         <aop:aspect xmlns:aop="urn:jboss:aop-beans:1.0"
                         name="InterceptedAdvice"
                         class="org.jboss.test.microcontainer.support.CalledInterceptor"
                         pointcut="execution(* $instanceof{org.jboss.test.microcontainer.support.SimpleBean}->*(..))">
                         </aop:aspect>
                        


                        has no dependencies and now becomes:

                         <beanfactory name="InterceptedAdvice" class="org.jboss.test.microcontainer.support.CalledInterceptor"/>
                        
                         <bean name="InterceptedAdvice$Aspect" class="org.jboss.aop.microcontainer.beans.Aspect">
                         <property name="advice"><inject bean="InterceptedAdvice"/></property>
                         <property name="manager"><inject bean="AspectManager"/></property>
                         </bean>
                        
                         <bean name="InterceptedBinding" class="org.jboss.aop.microcontainer.beans.AspectBinding">
                         <property name="pointcut">execution(* $instanceof{org.jboss.test.microcontainer.support.SimpleBean}->*(..))</property>
                         <property name="aspect"><inject bean="InterceptedAdvice$Aspect" property="definition"/></property>
                         <property name="manager"><inject bean="AspectManager"/></property>
                         </bean>
                        


                        And the following
                         <aop:aspect xmlns:aop="urn:jboss:aop-beans:1.0"
                         name="InterceptedAdvice"
                         class="org.jboss.test.microcontainer.support.InterceptorWithDependency"
                         pointcut="execution(* $instanceof{org.jboss.test.microcontainer.support.SimpleBean}->*(..))">
                         <property name="simpleBean"><inject bean="Dependency"/></property>
                         </aop:aspect>
                        

                        which has dependencies still becomes
                         <beanfactory name="InterceptedAdvice" class="org.jboss.test.microcontainer.support.InterceptorWithDependency">
                         <property name="simpleBean"><inject bean="Dependency"/></property>
                        
                         <!-- Enables the deployed AspectDefinition and injects into the AspectFactory -->
                         <install bean="InterceptedAdvice$Aspect" method="install">
                         <parameter><this/></parameter>
                         </install>
                        
                         <!-- undeploys the AspectDefinition, so it is not available when updating the interceptors -->
                         <uninstall bean="InterceptedAdvice$Aspect" method="uninstall"/>
                        
                         <!-- Same as before: removes and reinstalls the AdviceBinding/AdviceFactory with the new
                         AspectDefinition/AspectFactory -->
                         <install bean="InterceptedAdvice$AspectBinding" method="rebind">
                         <parameter><inject bean="InterceptedAdvice$Aspect" property="definition"/></parameter>
                         </install>
                         </beanfactory>
                        
                         <bean name="InterceptedAdvice$Aspect" class="org.jboss.aop.microcontainer.prototype.Aspect">
                         <property name="adviceBean">InterceptedAdvice</property>
                         <property name="manager"><inject bean="AspectManager"/></property>
                         </bean>
                        
                         <bean name="InterceptedAdvice$AspectBinding" class="org.jboss.aop.microcontainer.prototype.AspectBinding">
                         <property name="pointcut">execution(* @org.jboss.test.microcontainer.support.Test->*(..))</property>
                         <property name="aspect"><inject bean="InterceptedAdvice$Aspect" property="definition"/></property>
                         <property name="manager"><inject bean="AspectManager"/></property>
                         </bean>
                        


                        1 2 Previous Next