hivemind-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Howard Lewis Ship <hls...@gmail.com>
Subject Re: interceptors
Date Thu, 05 Aug 2004 12:25:32 GMT
Either you've figured it out yourself, or you need to post your code.

On Thu, 5 Aug 2004 09:29:33 -0000, Ilia Honsali <ihonsali@omnidata.co.ma> wrote:
> maybe I'am wrong but what I understand is that:
> the double call of the last service is due to what I add :".._inner.getLog().."
> 
> I have 3 interceptor
> Logging --> Test --> Security --> Calculator
> 
> as I add
> "_inner.getLog().info(\"---------Interceptor_Name\");"
> to
> "return ($r)_inner." + methodName + "($$) ; }");"
> 
> so when I call calculator.add();
> TestInterceptor call twice SecurityInterceptor first for the .getLog() and secund for
the .add()
> 
> in conclusion, the n interceptor call the n-1 interceptor not only for the original call
--here the calculator.add()--
> but also for the generated call --_inner.getLog()--
> 
> sorry for my very very bad english explanation
> 
> -----Message d'origine-----
> De : Howard Lewis Ship [mailto:hlship@gmail.com]
> Envoyé : mercredi 4 août 2004 18:49
> À : hivemind-user@jakarta.apache.org
> Objet : Re: interceptors
> 
> 
> 
> 
> 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 <ihonsali@omnidata.co.ma>
> Date: Wed, 4 Aug 2004 18:17:33 -0000
> Subject: interceptors
> To: hivemind-user@jakarta.apache.org
> 
> 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: hivemind-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: hivemind-user-help@jakarta.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: hivemind-user-help@jakarta.apache.org
> 
> 


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

---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-user-help@jakarta.apache.org


Mime
View raw message