cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremy Quinn <jer...@media.demon.co.uk>
Subject Re: FileWritingTransformer
Date Sat, 16 Feb 2002 13:27:22 GMT
At 6:44 pm +0000 15/2/02, Jeremy Quinn wrote:
>At 6:24 pm +0100 15/2/02, Stefano Mazzocchi wrote:
>>Jeremy Quinn wrote:

>Currently there is a load of code in FileWritingTransformer that is File
>specific.

I just though of a potential problem with my file handling code.

Maybe someone could advise me, I am not that familiar with file
manipulation, or threading.


FileWritingTransformer opens a FileOutputStream on the File, as soon as it
receives the StartElement call with the <xfwt> tag and closes it with the
EndElement.

If there is a Parsing (or similar) error before the FileOutputStream is
closed, you loose the original file, right?

I suspect I ought to be Serialising into a temporary file and replacing the
original only after everything has worked.

I was thinking this could be an advantage because it could provide a signal
for a blocking mechanism to make sure more than one user did not attempt to
Serialise to the same file at the same time.

I could just put '.xfwt-temp' on the end of the file, and rename it after,
but I think this would be a bit untidy, I should probably make my own space
in the work directory to do this right?

How do I block the process of a second simultaneous request?
Do I 'syncronize' the temporary file?
I don't have a clue how to do this ..... help ;)


Thanks

regards Jeremy
-- 
   ___________________________________________________________________

   Jeremy Quinn                                           Karma Divers
                                                       webSpace Design
                                            HyperMedia Research Centre

   <mailto:sharkbait@mac.com>     		 <http://www.media.demon.co.uk>
   <phone:+44.[0].20.7737.6831>             <pager:jermq@vizzavi.net>

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message