Greg, Thanks for the help and I guess it will definitely work.
Without any code to build stringreader on server side or construct a URL object on the remote site, is there any way to just put the file into code base directory on the server(just like those task object class file) so a worker can download it automatically to local machine before opening it whenever necessary? Thanks a lot, Andrew > Date: Sat, 24 Oct 2009 15:30:34 -0500 > From: [email protected] > To: [email protected] > Subject: Re: File Serializaton in JavaSpace. > > Andrew Meng wrote: > > Hello, > > > > I am working a JavaSpace applicaton in which one of the task needs to open > > and read a text files in its execute() method. It seems that there are two > options here: > > > > 1)Reading the text file to a StringReader(which is a member variable in the > > task object) > > > > 2)Puting the text file into the codebase root directory for the normal > > class or > > jar files but I could not figure out how to do it for a normal text file. > > > > Can anyone share what you would do in this case? > > If the file is part of the work item that execute() will process, then put a > URL > (String value that you can construct a URL object with in execute()). Then > you can change where you put it and how it is accessed over time by using a > different URL, changing the protocol (jar:, http:, ftp:, or your own custom > protocol handler that you inject into the JVM runtime with > -Djava.protocol.handler.pkgs etc). > > Definitely try not to send the data in the Entry so that you don't end up > slinging data all over the network until you need it. > > Gregg Wonderly _________________________________________________________________ CDN College or University student? Get Windows 7 for only $39.99 before Jan 3! Buy it now! http://go.microsoft.com/?linkid=9691636
