1 2 3 Previous Next 37 Replies Latest reply on Aug 18, 2008 9:31 AM by alesj Go to original post
      • 30. Re: Integrating aop-mc-int bean metadata with AS5
        kabirkhan

        While I get the correct AspectMaager, scoped aop (with my WIP) is broken in AS, following the latest MC update. I think it is because the aliases are not working as they used to so e.g. my aspect bindings are not installed since the dependencies are not satisfied since it cannot find the dependencies. I have had a look at DescribeAction.applyAnnotations(), and from what I can see the resulting AliasesAnnotationPlugin.internalApplyAnnotation() returns immediately due to no @Aliases found in MDR, so the aliases are never set in the bean metadata. Of course, I could be looking in the wrong place :-)

        As we discussed a while ago, I am adding the @Aliases to the bean metadata:

         private void massageScopedBean(BeanMetaData bean)
         {
         if (scoped)
         {
         String name = bean.getName();
         String newName = "ScopedAlias_" + sequence + "_" + name;
        
         BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(bean);
        
         //Set the alias to the original name
         builder.addAnnotation(new AliasesImpl(name));
        

        Should this instead be added to MDR? Or are aliases handled some other way?

        • 31. Re: Integrating aop-mc-int bean metadata with AS5
          alesj

          I've added bean that has @Aliases to this test:
          - http://anonsvn.jboss.org/repos/jbossas/projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/bean/test/AnnotatedBeansUnitTestCase.java
          and it works as it should.

          But this one has annotation directly on the class,
          I'll try to do the same as you - adding it via BMDBuilder.

          • 32. Re: Integrating aop-mc-int bean metadata with AS5
            alesj

             

            "alesj" wrote:

            But this one has annotation directly on the class,
            I'll try to do the same as you - adding it via BMDBuilder.

            This works as well:
            - http://anonsvn.jboss.org/repos/jbossas/projects/jboss-deployers/trunk/deployers-vfs/src/tests/org/jboss/test/deployers/vfs/deployer/bean/test/BuilderBeansUnitTestCase.java

            • 33. Re: Integrating aop-mc-int bean metadata with AS5
              kabirkhan

              Seems it was getting confused about the scopes. In the standalone version, the Bean MetaData annotations are added to the mutable scope by

              [INSTANCE=SomeRandomName]
              


              In the AS version the mutable scope was
              [APPLICATION=vfszip:/Users/kabir/sourcecontrol/jboss-head/testsuite/output/lib/aop-scopeddependency-scoped.sar, INSTANCE=ScopedAlias_17_Factory$ScopedInterceptor]
              


              When calling BasicKernelMetaDataRepository.getMetaData() with the context's scope
              [JVM=THIS, CLASS=class org.jboss.aop.asintegration.jboss5.ScopedVFSClassLoaderDomain, INSTANCE=ScopedManager_4_vfszip:/Users/kabir/sourcecontrol/jboss-head/testsuite/output/lib/aop-scopeddependency-scoped.sar]
              

              the returned MetaData does not contain the added annotations in AS.

              Modifying the code I copied from BeanMetaDataDeployer to
               KernelControllerContext context = new AbstractKernelControllerContext(null, deployment, null);
               //Make sure that the metadata from the deployment gets put into the context
               ScopeInfo scopeInfo = context.getScopeInfo();
               if (scopeInfo != null)
               {
               mergeScopes(scopeInfo.getScope(), unit.getScope());
               //mergeScopes(scopeInfo.getMutableScope(), unit.getMutableScope());
               }
              
               try
               {
               controller.install(context);
               }
              

              So that the scope is simply
              [INSTANCE=ScopedAlias_17_Factory$ScopedInterceptor]
              

              seems to get the aliases installed.
              So that the alias is

              • 34. Re: Integrating aop-mc-int bean metadata with AS5
                kabirkhan

                 

                "kabir.khan@jboss.com" wrote:

                So that the scope is simply
                [INSTANCE=ScopedAlias_17_Factory$ScopedInterceptor]
                

                seems to get the aliases installed.
                So that the alias is


                Should read:
                So that the mutable scope is simply
                [INSTANCE=ScopedAlias_17_Factory$ScopedInterceptor]
                

                seems to get the aliases installed.



                • 35. Re: Integrating aop-mc-int bean metadata with AS5
                  alesj

                   

                  "kabir.khan@jboss.com" wrote:

                  Modifying the code I copied from BeanMetaDataDeployer to
                   KernelControllerContext context = new AbstractKernelControllerContext(null, deployment, null);
                   //Make sure that the metadata from the deployment gets put into the context
                   ScopeInfo scopeInfo = context.getScopeInfo();
                   if (scopeInfo != null)
                   {
                   mergeScopes(scopeInfo.getScope(), unit.getScope());
                   //mergeScopes(scopeInfo.getMutableScope(), unit.getMutableScope());
                   }
                  
                   try
                   {
                   controller.install(context);
                   }
                  


                  This is old code.
                  Adrian fixed this in JBMICROCONT-330.

                  • 36. Re: Integrating aop-mc-int bean metadata with AS5
                    kabirkhan

                    I have worked through the issues above, but have reached the final hurdle with my new scope tests. I am deploying the following in a deployment using classloader scoping

                    <?xml version="1.0" encoding="UTF-8"?>
                    <deployment xmlns="urn:jboss:bean-deployer:2.0">
                    
                     <interceptor xmlns="urn:jboss:aop-beans:1.0"
                     name="ScopedInterceptor"
                     class="org.jboss.test.aop.scopeddependency.ScopedInterceptor">
                     </interceptor>
                    
                     <bind xmlns="urn:jboss:aop-beans:1.0"
                     pointcut="execution(* org.jboss.test.aop.scopeddependency.ScopedTester->*(..))">
                     <interceptor-ref name="ScopedInterceptor"/>
                     </bind>
                    
                     <bean name="ScopedTester" class="org.jboss.test.aop.scopeddependency.ScopedTester"/>
                    
                    </deployment>
                    


                    The aop beans from interceptor and bind get deployed into a scoped controller. The ScopedTester gets deployed into the main controller, and gets a dependency on Factory$ScopedInterceptor from the binding. However, ScopedTester is deployed in the main controller and cannot see Factory$ScopedInterceptor since that is deployed in the scoped controller, which gives this exception:
                    org.jboss.deployers.client.spi.IncompleteDeploymentException: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):
                    
                    *** CONTEXTS MISSING DEPENDENCIES: Name -> Dependency{Required State:Actual State}
                    
                    ScopedTester
                     -> Factory$ScopedInterceptor{Instantiated:** NOT FOUND Depends on 'Factory$ScopedInterceptor' **}
                    
                    
                    *** CONTEXTS IN ERROR: Name -> Error
                    
                    Factory$ScopedInterceptor -> ** NOT FOUND Depends on 'Factory$ScopedInterceptor' **
                    


                    As mentioned I am deploying all the aop beans myself and ripping them out of the deployment. A solution would be to handle all beans in a deployment myself if it is scoped and contains some aop beans, but that feels a bit hacky to me? Alternatively, would it be possible to place the annotation causing a scoped controller on all the beans in the deployment if it is scoped and contains some aop beans? I don't know how I would determine that the deployment is scoped and contains some aop beans though if the aop stuff is in an -aop.xml and the other beans in a -beans.xml?

                    • 37. Re: Integrating aop-mc-int bean metadata with AS5
                      alesj

                       

                      "kabir.khan@jboss.com" wrote:
                      Alternatively, would it be possible to place the annotation causing a scoped controller on all the beans in the deployment if it is scoped and contains some aop beans?

                      You can already put annotation on deployment,
                      and it's added to all beans included in this deployment.

                      "kabir.khan@jboss.com" wrote:
                      I don't know how I would determine that the deployment is scoped and contains some aop beans though if the aop stuff is in an -aop.xml and the other beans in a -beans.xml?

                      Perhaps new suffix, e.g. scoped-beans.xml,
                      where you add scoped annotation to parsed KernelDeployment.

                      Dunno how you would do it in the split case; -aop.xml vs. -beans.xml.

                      1 2 3 Previous Next