[jboss-dev-forums] [Design of AOP on JBoss (Aspects/JBoss)] - Re: ManagedObject stuff for AOP

kabir.khan@jboss.com do-not-reply at jboss.com
Thu Jan 31 08:00:15 EST 2008


I have most of this working, but need a bit of guidance on where to take it further.

The way it currently works is that you deploy similar xml to -aop.xml in a -beans.xml, for example:

  | <deployment xmlns="urn:jboss:bean-deployer:2.0">
  | 
  |    <bean name="AspectManager" class="org.jboss.aop.AspectManager">
  |       <constructor factoryClass="org.jboss.aop.AspectManager" factoryMethod="instance"/>
  |    </bean>
  | 
  | 	<interceptor xmlns="urn:jboss:aop-beans:1.0" class="org.jboss.test.microcontainer.beans.TestInterceptor"/>
  | 	
  | 	<bind xmlns="urn:jboss:aop-beans:1.0" pointcut="execution(* org.jboss.test.microcontainer.beans.POJO->*(..))">
  | 		<interceptor-ref name="org.jboss.test.microcontainer.beans.TestInterceptor"/>
  | 	</bind>
  |    
  |    <bean name="Bean" class="org.jboss.test.microcontainer.beans.POJO"/>
  |    
  | </deployment>
  | 

More examples can be found in http://anonsvn.jboss.org/repos/jbossas/projects/microcontainer/trunk/aop-mc-int/src/resources/tests/org/jboss/test/microcontainer/beans/test/. The *BeansTestCase.xml files show the underlying beans, while the *AopTestCase.xml files show the -aop.xml style configuration.

1) Am I ok using -beans.xml files for this? Or should I be using -aop.xml? If so, how do the -aop.xml files get recognised by the deployer that deploys -beans.xml files? I think that means scrapping the AspectDeployer?

2) I will probably need to do something similar for aspects configured via annotations. So we might need the AspectDeployer anyway. I should be able to easily create the BeanMetaDataFactory from the annotations, but what would the entry point of getting these beans into the MC be?

3) Is adding the ManagedObject/Operation stuff my task? How do I test that I am exposing the right stuff?

4) With the current xml it is by default looking for an org.jboss.aop.AspectManager called "AspectManager" (as shown in the example above), in AS 5 this does not exist, so instead we need to do (from http://anonsvn.jboss.org/repos/jbossas/trunk/testsuite/src/resources/aop/mcdefaultannotation/META-INF/jboss-beans.xml:

  | <deployment xmlns="urn:jboss:bean-deployer:2.0">
  | 
  |    <aop:aspect xmlns:aop="urn:jboss:aop-beans:1.0"
  |                name="DependencyAdvice"
  |                class="org.jboss.test.aop.mcdefaultannotation.AnnotationReaderInterceptor"
  |                manager-bean="AspectManager"
  |                manager-property="aspectManager">
  |    </aop:aspect>
  | 
  |    <aop:bind xmlns:aop="urn:jboss:aop-beans:1.0" 
  |            pointcut="execution(* @org.jboss.test.aop.mcdefaultannotation.TestAnnotation->getAnnotationValue())" 
  |            manager-bean="AspectManager" 
  |            manager-property="aspectManager">
  |       <aop:interceptor-ref name="DependencyAdvice"/>
  |    </aop:bind>
  | ...
  | </deployment>
  | 

i.e. we need to specify the manager-bean and manager-property attributes, which isn't ideal. I'd like to configure the name of where to find this somehow, maybe at the deployer level? Alternatively, something like:


  | <deployment xmlns="urn:jboss:bean-deployer:2.0">
  |    <aop:manager name="AspectManager" property="aspectManager"/>
  |    <aop:aspect xmlns:aop="urn:jboss:aop-beans:1.0"
  |                name="DependencyAdvice"
  |                class="org.jboss.test.aop.mcdefaultannotation.AnnotationReaderInterceptor">
  |    </aop:aspect>
  | 
  |    <aop:bind xmlns:aop="urn:jboss:aop-beans:1.0" 
  |             pointcut="execution(* @org.jboss.test.aop.mcdefaultannotation.TestAnnotation->getAnnotationValue())">
  |       <aop:interceptor-ref name="DependencyAdvice"/>
  |    </aop:bind>
  | ...
  | </deployment>
  | 


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4125127#4125127

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4125127



More information about the jboss-dev-forums mailing list