[jboss-dev-forums] [Design of POJO Server] - Re: Integrating aop-mc-int bean metadata with AS5

kabir.khan@jboss.com do-not-reply at jboss.com
Wed May 28 12:55:09 EDT 2008


Another problem when attempting to run the scoped aop tests is that both deployments try to install an interceptor with the same name.

  | Caused by: java.lang.IllegalStateException: Factory$org.jboss.test.aop.scoped.ScopedInterceptor is already installed.
  | 	at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:577)
  | 	at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:443)
  | 	at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:88)
  | 

Once I have got the domains set up this should be fine at the aop level, but I need to resolve this somehow on the MC level. The following "nice" xml


  | <aop xmlns="urn:jboss:aop-beans:1.0">
  |    <interceptor class="org.jboss.test.aop.scoped.ScopedInterceptor" scope="PER_INSTANCE"/>
  |    <bind pointcut="all(org.jboss.test.aop.scoped.POJO)">
  |       <interceptor-ref name="org.jboss.test.aop.scoped.ScopedInterceptor"/>
  |    </bind>
  | 

will resolve to something along the lines of


  |   <!-- The following 2 are the interceptor definition -->
  |    <beanfactory name="Factory$org.jboss.test.aop.scoped.ScopedInterceptor" class="org.jboss.test.aop.scoped.ScopedInterceptor"/>
  | 
  |       <!-- BY DEFAULT THE INTERCEPTOR TAKES THE NAME OF THE CLASS-->
  |    <bean name="org.jboss.test.aop.scoped.ScopedInterceptor" class="org.jboss.aop.microcontainer.beans.Aspect">
  |       <property name="advice"><inject bean="Factory$org.jboss.test.aop.scoped.ScopedInterceptor"/></property>
  |       <property name="manager"><inject bean="AspectManager" property="manager"/></property>
  |    </bean>
  | 
  |   <!-- The following 2 are the binding and interceptor-ref entries -->
  |    <bean name="TestAspectBinding" class="org.jboss.aop.microcontainer.beans.AspectBinding">
  |       <property name="pointcut">execution(* org.jboss.test.microcontainer.beans.POJO->*(..))</property>
  |       <property name="manager"><inject bean="AspectManager" property="manager"/></property>
  |      	<property name="advices">
  |          <list>
  |          	<inject bean="TestAspectBinding$1"/>
  |          </list>
  |    	</property>
  |    </bean>
  | 
  |    <bean name="TestAspectBinding$1" class="org.jboss.aop.microcontainer.beans.InterceptorEntry">
  |       <property name="manager"><inject bean="AspectManager" property="manager"/></property>
  |       <!-- THIS IS THE NAME OF THE INTERCEPTOR -->
  |       <property name="aspect"><inject bean="org.jboss.test.aop.scoped.ScopedInterceptor"/></property>
  |       <property name="binding"><inject bean="TestAspectBinding" state="Instantiated"/></property>
  |    </bean>
  | 

I could give each deployment it's own prefix or something for the names used, but that will cause problems if the interceptor is declared in one -aop.xml and used in another. One option might be to maintain my own registry in the AOP BeanMetaDataFactory layer, but I don't see how this will work for scoped deployments, since the BMDF is ignorant of scoping at parsing time?




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

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



More information about the jboss-dev-forums mailing list