Hey Rishi,

> I think my question is whether there exists some specification allowing for 
> processing of an entire product to occur before bytes of a product are 
> returned. The processing should occur before the product is returned via 
> "retrieveChunk" and only occur once.  The only way I can think of enabling 
> this kind of feature to have special code within "retreiveChunk" which 
> 'processes' the product only during the first invocation of 'retrieveChunk', 
> and subsequently returns the processed bytes in any following invocations. Do 
> you have any recommendations on a better technique or does the webgrid 
> infrastructure support for something like this?

Yeah, actually one thing you *can* assume is that there will always be a first 
call to query(XMLQuery q), even in the case of the LargeProductQueryHandler. 
So, one thing that I've done in the past is to realize what the user is asking 
for on query(XMLQuery q), then cook up some id to shove into the LargeResult 
returned as part of XMLQuery.getResults().add(LargeResult...). That id can then 
be used (and is actually used later) when retrieveChunk is called. 

So, then you'll know at the query(XMLQuery q) time what the user is going to 
next ask for in a series of subsequent calls to retrieveChunk, so in the 
initial query(XMLQuery q) method, you may try doing the initial (and 1-time 
only) processing required for the query *first*, then cache the result or 
something that you make available in retrieveChunk next. Of course, if you 
cache it you'll have to clean it up after the last retrieveChunk call, but the 
good news is, you've got one more method call in there to take care of that 
(the close(id) method that's part of the interface). You can take care of the 
release of resources in that method and you're good!

Cheers,
Chris

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Chris Mattmann, Ph.D.
Senior Computer Scientist
NASA Jet Propulsion Laboratory Pasadena, CA 91109 USA
Office: 171-266B, Mailstop: 171-246
Email: [email protected]
WWW:   http://sunset.usc.edu/~mattmann/
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Adjunct Assistant Professor, Computer Science Department
University of Southern California, Los Angeles, CA 90089 USA
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Reply via email to