Niklas Gustavsson wrote:
On Thu, Oct 9, 2008 at 2:07 PM, Andrea Francia <[EMAIL PROTECTED]> wrote:
It's harmful for those ftplet implementations that are not designed to be
used for any clients and don't want implement ordering.
As I asked for before, could you please describe why ordering the
files is a problem for you.
It's not a problem for me but it can be a problem for some ftplet
implementor that doesn't needs, wouldn't, can't implement this.
I'm not asking to change this MUST requirement in a suggestion for me
but for creating a much flexible ftpserver API.
I understand that ordering files for alphabetical order is a benefit for
the command line ftp client, and I think that the standard NativeFtpFile
should implement this. It's ok for me that NativeFtpFile#listFiles()
MUST returns an alphabetical ordered list.
Also I understand that is more efficient let the FtpFile#list()
implementation orders the list.
I don't understand why this features should be compulsory, even for
ftpserver that doesn't need, can't implement this.
Maybe an ftplet implementor has a problem implementing this features
(memory usage) and does not need this features (because its ftpserver is
designed to be used in a situation where clients doesn't need
alphabetical order). To make life easier to this people we should say
that the ordering is not compulsory, but suggested.
For example I don't need this features. My FTPServer is an FtpServerStub
designed to be used for unit testing of ftp clients and crawlers.
My FTPserver is used only in these situations, I don't need to make the
life easier to command line ftp users, why should I bother with
ordering? For my testing pourpuse I don't require the file are in
alphabetical orders.
Maybe I need to the reverse. Maybe I need to test my clients even if the
list returned by the server is ordered or not. How I can test if my
clients works well even if the the list is unoredered?
Then maybe we would have a better
understanding of the problem and how to resolve it. To me, in most
cases, this comes down to having this code in the implementation:
Arrays.sort(files, new Comparator<FtpFile>() {
public int compare(FtpFile f1, FtpFile f2) {
return f1.getShortName().compareTo(f2.getShortName());
}
});
Thanks for the hint.
Besides, I don't understand why you need to implement this method at
all if your doing an Ftplet implementation. The method is part of the
FileSystem API (which might be used by an Ftplet).
AFAIK the method works for native files, this is not my case.
I'm working with mock classes that represents files and directories.
--
Andrea Francia
http://andreafrancia.blogspot.com/2008/07/colinux-linux-dentro-windows.html