This content has been marked as final.
Show 5 replies
-
1. Re: Multiples Interceptor with the same class
kabirkhan Oct 13, 2005 4:56 AM (in response to fredmaster)What you have pasted in should not work at all :-) I think you are looking for:
<bind pointcut="all(package.Class1)"> <interceptor name="Inter1" class="package.MyInterceptor" scope="PER_INSTANCE"> <attribute name="attributeA">A</attribute> </interceptor> </bind> <bind pointcut="all(package.Class2)"> <interceptor name="Inter1" class="package.MyInterceptor" scope="PER_INSTANCE"> <attribute name="attributeA">B</attribute> </interceptor> </bind>
OR<interceptor name="Inter1" class="package.MyInterceptor" scope="PER_INSTANCE"> <attribute name="attributeA">A</attribute> </interceptor> <interceptor name="Inter2" class="package.MyInterceptor" scope="PER_INSTANCE"> <attribute name="attributeA">B</attribute> </interceptor> <bind pointcut="all(package.Class1)"> <interceptor-ref name="Inter1"/> </bind> <bind pointcut="all(package.Class2)"> <interceptor-ref name="Inter2"/> </bind>
If you do not explicitly use a name attribute in your intertceptor declaration it will use the fully qualified name of the class as the name -
2. Re: Multiples Interceptor with the same class
fredmaster Oct 13, 2005 9:34 AM (in response to fredmaster)The problem not is a sintax.
See
I have two projects ".aop" with a file "jboss-aop.xml"
The frist "jboss-aop.xml" have<bind pointcut="execution(private void br.com.singu.pessoa.facade.PessoaSessionFacadeBean->setPessoaFromPessoaDto(..))"> <interceptor name="interceptor1" class="br.com.singu.aop.FieldChangedInterceptor" scope="PER_INSTANCE"> <attribute name="fieldName">getIdSituacaoPessoa</attribute> <attribute name="observerId">br.com.singu.pessoa.facade.PessoaSessionFacadeBean.setPessoaFromPessoaDto</attribute> </interceptor> </bind>
The second "jboss-aop.xml" have<bind pointcut="execution(private void br.com.singu.academico.aluno.facade.AlunoCursoSessionFacadeBean->setAlunoCursoFromAlunoCursoDto(..))"> <interceptor name="interceptor2" class="br.com.singu.aop.FieldChangedInterceptor" scope="PER_INSTANCE"> <attribute name="fieldName">getIdSituacaoAlunoCurso</attribute> <attribute name="observerId">br.com.singu.academico.observer.SituacaoAlunoCursoObserver</attribute> </interceptor> </bind>
Execution
1 - method "setAlunoCursoFromAlunoCursoDto" the value of the fieldName is "getIdSituacaoAlunoCurso"
2 - method "setPessoaFromPessoaDto" the value of the fieldName is "getIdSituacaoPessoa"
3 - method "setAlunoCursoFromAlunoCursoDto" the value of the fieldName is "getIdSituacaoPessoa"
The execution of the method "setPessoaFromPessoaDto" interceptor1 overrrides the value of the interceptor2. -
3. Re: Multiples Interceptor with the same class
kabirkhan Oct 13, 2005 4:25 PM (in response to fredmaster)Can you try to change the scope of the interceptor and let me know if that behaves any differently? I'm wondering if there could be an error in how per instance interceptors are handled for this.
Thanks -
4. Re: Multiples Interceptor with the same class
fredmaster Oct 13, 2005 5:54 PM (in response to fredmaster)I tried changes the scope for PER_CLASS and PER_JOINPOINT but the error persists.
-
5. Re: Multiples Interceptor with the same class
kabirkhan Oct 14, 2005 5:30 AM (in response to fredmaster)A simple standalone example works for me. Can you provide some more details about your packaging and if you're running within JBoss or not?
Or even better create a jira issue with a test case showing the behaviour: http://jira.jboss.com/jira/browse/JBAOP