mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Darryl Miles <darryl-mailingli...@netbauds.net>
Subject Re: Apache FTP Server Lock Incoming Files
Date Tue, 28 Aug 2012 14:28:59 GMT
Niklas Gustavsson wrote:
> On Mon, Aug 27, 2012 at 12:08 PM, Richard Stokes
> <richard@livestudios.com> wrote:
>>          I'm currently using this library as my ftp server in a system I am developing
but I need all uploading files to be locked until that are completed so that they are not
processed prematurely.
>>          Does anyone know how to do this. I've tried looking for the javadocs online
to look myself but cannot seem to find them.
>>          Any help would be much appreciated!
> The usual way of doing this with FTP is to upload the file to a
> temporary file name and then rename it when the upload is complete.

Yes indeed this is the way.

Traditional FTP server does not have a mechanism to atomically replace a 
file using STOR.

Also the Unix like systems allowed multiple writers to delete/overwrite 
the current file at the same time, even if some other users was 
uploading and/or downloading that file at that moment.

On Windows it is usually not possible to delete a file that is opened by 
another user (all other users have to have provided non-default flags to 
the OS system call when opening the file and this is usually not the case).

Maybe you should upload using the STRU (Store Uniquely Named) RFC949 and 
the client parse back the filename given to then perform the rename 
after a successful transfer.

Your spool pickup mechanism should ignore files not matching an expected 
glob pattern.


View raw message