On 21/10/2013 21:15, Gentian Hila wrote: > Is there any way to make sure that when one file is downloaded from the > user, a second connection from the same user won't be able to download it > again?
An Ftplet implementation should be able to handle this. You could physically move/remove the file in the afterCommand method, but that would mean that only 1 user ever downloads the file. The advantage is that you've nothing further to monitor. Alternatively you could monitor the downloads per user with some map field, as you suggest. You can add to this when afterCommand is passed a 226 (as per your other query from yesterday). Then in the beforeCommand method, you check if the file already exists in the map for that user. Or to lock the file, add the reference in the beforeCommand, and remove it on failure in the afterCommand. The user information can be obtained from the FtpSession passed in to both methods. Obviously you'll need some means of expiring entries from the Map otherwise it will grow continually. Anything more elaborate (like filtering out the downloaded file names from any file listing), you'll need to provide your own FileSystemFactory etc. implementation or extend the existing Native one.
