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 > >
