-
1. Re: configuration problem
kabirkhan Feb 8, 2005 5:00 PM (in response to tom.baeyens)Hmm yeah,
it only injects stuff once, when the object is created. In the example given this will be on first access to each instance of Token (scope: PER_INSTANCE). Maybe I should make it fail more noisily if the XML implies injection more than once?
Are you trying to just log the name of the method in which case you could cast the Invocation to a MethodInvocation and then call getMethod()?
Or do you want to do something more advanced? -
2. Re: configuration problem
tom.baeyens Feb 9, 2005 2:01 AM (in response to tom.baeyens)i want something more advanced, i'm afraid.
the scoping is not the issue for me. it's more the configuration of the interceptor objects.
you say "XML implies injection". do you mean the configuration of the interceptor with this ? if yes, i don't think it should lead to noisy failure. but instead you should apply differently configured interceptors to the different pointcuts, right ?
are the interceptor objects pooled ? per classname ? is that the reason why the configuration ends up in the wrong interceptor ?
regards, tom. -
3. Re: configuration problem
kabirkhan Feb 9, 2005 8:14 AM (in response to tom.baeyens)Hi,
You can give the interceptors a name and they will be "pooled" by their name. If you do not give them a name, the name of the class will be used as the name internally, so they will effectively be pooled by class name.
So, the following should work<aop> <interceptor name="startInt" class="org.jbpmaop.LogInterceptor" scope="PER_INSTANCE"> <attribute name="method">start</attribute> </interceptor> <interceptor name="signalInt" class="org.jbpmaop.LogInterceptor" scope="PER_INSTANCE"> <attribute name="method">signal</attribute> </interceptor> <bind pointcut="execution(public void org.jbpmaop.Token->start())"> <interceptor-ref name="startInt"/> </bind> <bind pointcut="execution(public void org.jbpmaop.Token->signal())"> <interceptor-ref name="signalInt"/> </bind> </aop>
Or the equivalent:<aop> <bind pointcut="execution(public void org.jbpmaop.Token->start())"> <interceptor name="startInt" class="org.jbpmaop.LogInterceptor" scope="PER_INSTANCE"> <attribute name="method">start</attribute> </interceptor> </bind> <bind pointcut="execution(public void org.jbpmaop.Token->signal())"> <interceptor name="signalInt" class="org.jbpmaop.LogInterceptor" scope="PER_INSTANCE"> <attribute name="method">signal</attribute> </interceptor> </bind> </aop>
I prefer the first option, since it kind of splits the definition and usage of the interceptors.
Cheers,
Kabir -
4. Re: configuration problem
tom.baeyens Feb 9, 2005 6:05 PM (in response to tom.baeyens)fabulous !
thanks a lot, kabir.
see you soon.
regards, tom.