That is odd; I know we have tests for multiple interceptors so I can't
imagine why it would fail.

Enable logging for your module; you'll see details as each service is
constructed and interceptor is applied.



----- Original Message -----
From: Ilia Honsali <[EMAIL PROTECTED]>
Date: Wed, 4 Aug 2004 18:17:33 -0000
Subject: interceptors
To: [email protected]

 

Hi,

I am experimenting interceptors, and testing the "after" "before"
attributes, so I create two interceptors like the NullInterceptor
mentionned in the doc
---------------------------------------------------------------------------------------------------------------
I just modify the class to be added to the ClassFab in order to have some logs
classFab.addMethod(Modifier.PUBLIC,
                        sig,
                       
"{_inner.getLog().info(\"---------Interceptor_Name\");  return ($r)
_inner." + methodName + "($$) ; }");
 
---------------------------------------------------------------------------------------------------------------
in the example.sdl I add these declarations:

 service-point (id=SecurityInterceptor
interface=org.apache.hivemind.ServiceInterceptorFactory) {
        invoke-factory (service-id=hivemind.BuilderFactory ){
                construct
(class=org.apache.hivemind.examples.impl.SecurityInterceptor)
        }
  }
 

  service-point (id=TestInterceptor
interface=org.apache.hivemind.ServiceInterceptorFactory) {
          invoke-factory (service-id=hivemind.BuilderFactory ){
                  construct
(class=org.apache.hivemind.examples.impl.TestInterceptor )
          }
        } 
--------------------------------------------------------------------------------------------------------------
and I add these interceptors to  Calculator  declaration 
service-point (id=Calculator interface=org.apache.hivemind.examples.Calculator) 
{ 
    invoke-factory (service-id=hivemind.BuilderFactory) 
    { 
        construct (class= org.apache.hivemind.examples.impl.CalculatorImpl) 
        { 
        } 
    } 
    interceptor (service-id=hivemind.LoggingInterceptor ) 
    interceptor (service-id=SecurityInterceptor ) 
    interceptor (service-id=TestInterceptor) 
} 
  
my question is : 
why hivemind call twice one of my interceptors? 
Calculator [DEBUG] BEGIN divide(1.0, 2.0) 
Calculator [INFO] ---------test 
Calculator [INFO] ---------security 
Calculator [INFO] ---------test 
Divider [DEBUG] Constructing core service implementation for service
examples.Divider
Divider [DEBUG] Applying interceptor factory hivemind.LoggingInterceptor 
Divider [DEBUG] BEGIN divide(1.0, 2.0) 
Divider [DEBUG] END divide() [0.5] 
Calculator [DEBUG] END divide() [0.5] 
--------------------------------------------------------------------------------------------------------------
 
thanks a lot for your patience 



-- 
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind
http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to