commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve Cohen" <SCo...@sportvision.com>
Subject RE: questions about FTP LIST processing (FTPFileListParser)
Date Wed, 10 Dec 2003 21:54:57 GMT
No, that part of the system is not very well developed.  It is not as
currently developed, suitable for any sort of automated detection.
You'll have to try FTPClient.getSystemName() and work out the mappings
yourself.  Sorry.

This would be an excellent enhancement request, if not for the fact that
the FTP spec itself is so old and vague.  (Try looking for a standard
date format across different locales for example).  FTP was not designed
for automation.  

Also, be careful, that javadoc for NTFTPEntryParser is not quite
correct.  I've just entered a bug on that.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=25425

More up-to-date way is:
		
FTPClient f=FTPClient();
f.connect(server);
f.login(username, password);
FTPFileList list = createFTPFileList(directory, parser);
FTPFileIterator iter = list.iterator();

parser = new XXXFTPEntryParser(); // instantiate an FTPFileEntryParser
object of the appropriate type.
while (iter.hasNext()) {
     FTPFile[] files = iter.getNext(25);  // "page size" you want
       //do whatever you want with these files, display them, etc.
       //expensive FTPFile objects not created until needed.
}

-----Original Message-----
From: Chris Malley [mailto:malley_chris@emc.com] 
Sent: Wednesday, December 10, 2003 2:49 PM
To: Jakarta Commons Users List
Subject: Re: questions about FTP LIST processing (FTPFileListParser)


Thanks Steve.  Helpful to know that Default is UnixFTPEntryParser (this
should really be in the javadoc if anyone from commons-dev is
listening).

So part 2 of my question was: how do I decide which parser to use? The
javadoc for NTFTPEntryParser eludes to using 
FTPClient.getSystemName. Are there specific system name values (or parts
of the system name) that tell you to use a specific parser? Or am I
going to have to determine a parser via trial-and-error and keep a
mapping of hostname-to-parser? (yuck)

-Chris


Steve Cohen wrote:
> Default is UnixFTPEntryParser.  I don't know what's different about 
> EnterpriseUnixFTPEntryParser, someone contributed that. The others are

> pretty straightforward, NT, OS2, VMS.  No doubt there are others.  If 
> these don't fit your pattern, consider writing your own and 
> contributing it.  It's pretty straightforward, you can use the others 
> as models, if you understand regular expressions.
> 
> -----Original Message-----
> From: Chris Malley [mailto:malley_chris@emc.com]
> Sent: Wednesday, December 10, 2003 2:03 PM
> To: commons-user@jakarta.apache.org
> Subject: questions about FTP LIST processing (FTPFileListParser)
> 
> 
> I'm writing an FTP client that makes heavy use of the 'LIST' command,
> and I'm operating in an enviroment that has a wide range of FTP server

> types.  So the 'LIST' output is apt to vary.  The answers to these 
> questions have eluded me so far:
> 
> Which FTP servers does DefaultFTPFileListParser handle?
> 
> How do I decide when to use the various list parsers that are
provided? 
>   (i.e., EnterpriseUnixFTPEntryParser, NTFTPEntryParser,
> OS2FTPEntryParser, UnixFTPEntryParser, VMSFTPEntryParser) Should I
look
> at FTPClient.getSystemName()?...
> 
> Thanks,
> 
> -Chris
> 


-- 
Chris Malley
Contractor - PixelZoom, Inc.
Email @ EMC: malley_chris@emc.com
Voice @ EMC: (303)293-9331 x1235


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message