Classification: UNCLASSIFIED Caveats: NONE Hi, Raymond,
I assume you are talking about future enhancement, which is not yet available in 1.6.x, right? I can see this would allow handlers to pass information into component implementation using Message as the vehicle with the help of the injection extension. But how about passing information from component implementation to the downstream handlers? I'm wondering how much work it would be to simply pass a generic context object, which includes all the current messages involved in the invocation and allow get/set objects as added states, through all interceptors/handler and also inject it into component implementation if requested. Wouldn't it be simpler conceptually? Thanks, Gang > -----Original Message----- > From: Raymond Feng [mailto:[email protected]] > Sent: Friday, February 04, 2011 12:42 PM > To: [email protected] > Subject: Re: Can application code and interceptor/handler code in > Tuscany communicate with each other via some context? (UNCLASSIFIED) > > Another idea to explore: > > 1) SCA already has the @Context annotation which allows the application > code to be injected with certain context. Tuscany could potentially > extend that to allow pluggable contexts. This could be similar to what > JAX-RS does. > > for example: > > @Context > private MyContext myContext; > > > 2) The policy handler can put some information into the Message header > 3) Tuscany allows you to add extensions to the Dependency Injection > code to inject the value into the target implementation instance. > > Thanks, > Raymond > > ________________________________________________________________ > > Raymond Feng > [email protected] > Apache Tuscany PMC member and committer: tuscany.apache.org > Co-author of Tuscany SCA In Action book: www.tuscanyinaction.com > Personal Web Site: www.enjoyjava.com > > ________________________________________________________________ > > On Feb 4, 2011, at 9:28 AM, Yang, Gang CTR US USA wrote: > > > Classification: UNCLASSIFIED > Caveats: NONE > > Response follows. > > Gang > > > > -----Original Message----- > > > From: Simon Nash [mailto:[email protected]] > > > Sent: Friday, February 04, 2011 12:00 PM > > > To: [email protected] > > > Subject: Re: Can application code and interceptor/handler > code in > > > Tuscany communicate with each other via some context? > (UNCLASSIFIED) > > > > Yang, Gang CTR US USA wrote: > > > Classification: UNCLASSIFIED > > > Caveats: NONE > > > > (cut) > > > > Thanks! It's clear now. I looked up RequestContext > (don't know why I > > > missed it earlier). It does not seem to support > general state > > > propagation - I can set/get arbitrary objects. Can > this be opened up > > > to > > > allow arbitrary object states? > > > > Tuscany can't add any methods to this API because it's > defined by SCA. > > > > Tuscany could add some other API to propagate arbitrary > state but this > > > would be a major departure from the philosophy of SCA and I > would have > > > serious reservations about this. > > > > However, the Java ThreadLocal class should enable you to do > what you > > > need. > > > You can add an object to Java thead-local state in your > inbound > > > handler, > > > access or update this object (or add more objects) in your > application > > > code, and use the results in your outbound handler. > > > > I'm not sure about using ThreadLocal in a service framework > environment > for component implementation or even user-added handlers since I > don't > know how the framework manages the threads. > > Gang > > > > > Simon > > > > Gang > > > > Simon > > > > Simon > > > > Classification: UNCLASSIFIED > > > Caveats: NONE > > > > > > > > > Classification: UNCLASSIFIED > > > Caveats: NONE > > > > > > > > > Classification: UNCLASSIFIED > Caveats: NONE > > > > Classification: UNCLASSIFIED Caveats: NONE
