FileDocCategorySizeDatePackage
MVSFTPEntryParser.javaAPI DocApache Commons NET 1.4.1 API4399Sat Dec 03 10:05:48 GMT 2005org.apache.commons.net.ftp.parser

MVSFTPEntryParser

public class MVSFTPEntryParser extends ConfigurableFTPFileEntryParserImpl
Implementation of FTPFileEntryParser and FTPFileListParser for IBM MVS Systems.
author
Jeff Nadler
author
William Noto
version
$Id$
see
org.apache.commons.net.ftp.FTPFileEntryParser FTPFileEntryParser (for usage instructions)

Fields Summary
private static final String
REGEX
This is the regular expression used by this parser.
static final String
DEFAULT_DATE_FORMAT
Although this parser is now ignoring dates, someone may someday figure out a way to accomodate this and this appears to be the format used. For now, it won't be used. SMC 2005/04/08
Constructors Summary
public MVSFTPEntryParser()
The sole constructor for a MVSFTPEntryParser object.

exception
IllegalArgumentException Thrown if the regular expression is unparseable. Should not be seen under normal conditions. It it is seen, this is a sign that REGEX is not a valid regular expression.

 // 2001/11/09

        
 	// This is not at all the tightest possible regexp for MVS LIST
	// output, but I'm not a mainframe guru so I have little idea what the
	// range of valid values are.  I just needed to get the filename (Dsname);
	// note that no other FTPFile fields can be filled in with the results of
	// a LIST on MVS.  The 'Referred' date seems to be 'last accessed date'
	// and not 'last modified date' so I didn't bother parsing it.
	//
	// Of course it works perfectly as-is and it distinguishes header lines from
	// file results so that's the important thing.  
	//
	// This parser should be used when SYST returns:
	// 'MVS is the operating system of this server. FTP Server is running on z/OS.'
	//
	// Also note that there is no concept of directories in MVS, just datasets,
	// which have names composed of four dot separated names of up to 8 chars.
	// As a result, FTPFile.FILE_TYPE is always used. -JN 6/2004 jnadler<at>srcginc<dotcom>

	// Sample LIST results from MVS:
	//
	//Volume Unit    Referred Ext Used Recfm Lrecl BlkSz Dsorg Dsname
	//FPFS42 3390   2004/06/23  1    1  FB     128  6144  PS  INCOMING.RPTBM023.D061704
	//FPFS41 3390   2004/06/23  1    1  FB     128  6144  PS  INCOMING.RPTBM056.D061704
	//FPFS25 3390   2004/06/23  1    1  FB     128  6144  PS  INCOMING.WTM204.D061704

                                                   
     
    
        super(REGEX);
    
Methods Summary
protected org.apache.commons.net.ftp.FTPClientConfiggetDefaultConfiguration()

        return new FTPClientConfig(
                FTPClientConfig.SYST_MVS,
                DEFAULT_DATE_FORMAT,
                null, null, null, null);
    
public org.apache.commons.net.ftp.FTPFileparseFTPEntry(java.lang.String entry)
Parses a line of an MVS FTP server file listing and converts it into a usable format in the form of an FTPFile instance. If the file listing line doesn't describe a file, null is returned, otherwise a FTPFile instance representing the files in the directory is returned.

param
entry A line of text from the file listing
return
An FTPFile instance corresponding to the supplied entry

       
        FTPFile f = null;
        if (matches(entry))          
        {
            f = new FTPFile();
            String dataSetName = group(2);
            f.setType(FTPFile.FILE_TYPE);
			f.setName(dataSetName);

			return (f);
        }
        return null;