org.apache.commons.net.ftp.parser
Class OS2FTPEntryParser

java.lang.Object
  |
  +--org.apache.commons.net.ftp.FTPFileListParserImpl
        |
        +--org.apache.commons.net.ftp.parser.OS2FTPEntryParser
All Implemented Interfaces:
FTPFileEntryParser, FTPFileListParser

public class OS2FTPEntryParser
extends FTPFileListParserImpl

This Class uses the ListParser class to validate the input string. It also requires the NetComponents library version 1.3.7 or later and the OROMatcher library for the regualar expressions stuff.

USAGE:

  • Create an instance of OS2FTPEntryParser
  • OS2FTPEntryParser parser = new OS2FTPEntryParser();
  • Create an instance of FTPClient
  • FTPClient FTPClientObj = new FTPClient();
  • Connect to the NODE
  • FTPClientObj.connect();
  • Login to the NODE
  • FTPClientObj.login(username,password);
  • Switch directories if you have to
  • FTPClientObj.changeWorkingDirectory(thePath);
  • You might want to check if you are truly in a OS2 System
  • String am_I_OS2 = FTPClientObj.getSystemName()
    parse am_I_OS2 to find out
  • Call listFiles passing the newly created parser and a filename or a mask to look for
  • FTPClientObj.listFiles(parser,filename);
  • You'll get back the list as an array of FTPFiles like this
    FTPFile[] myOS2Files = FTPClientObj.listFiles(parser,filename); (or)
    FTPFile[] myOS2Files = FTPClientObj.listFiles(parser);

    That's all there is to it.

    Each FTPFile object is populated just like any other FTPFile object. The only thing not implemented at this time is the file permissions, but I can do it if there is a real need for it.

    !NOTE/WARNING!:Before you pass the parser to listFiles, make sure you are in the directory that you need to be. This parser will return the filtered files from the directory it is in. This becomes specially crucial if your goal is to delete the output of the parser.

    Version:
    $Id: OS2FTPEntryParser.java,v 1.3 2003/03/06 03:28:36 scohen Exp $
    Author:
    Winston Ojeda, Steve Cohen
    See Also:
    FTPFileListParser

    Field Summary
    private static java.lang.String REGEX
              this is the regular expression used by this parser.
     
    Fields inherited from class org.apache.commons.net.ftp.FTPFileListParserImpl
    _matcher_
     
    Constructor Summary
    OS2FTPEntryParser()
              The sole constructor for a OS2FTPEntryParser object.
     
    Method Summary
     FTPFile parseFTPEntry(java.lang.String entry)
              Parses a line of an OS2 FTP server file listing and converts it into a usable format in the form of an FTPFile instance.
     
    Methods inherited from class org.apache.commons.net.ftp.FTPFileListParserImpl
    getGroupCnt, getGroupsAsString, group, matches, parseFileList, readNextEntry
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Field Detail

    REGEX

    private static final java.lang.String REGEX
    this is the regular expression used by this parser.

    See Also:
    Constant Field Values
    Constructor Detail

    OS2FTPEntryParser

    public OS2FTPEntryParser()
    The sole constructor for a OS2FTPEntryParser object.

    Throws:
    java.lang.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.
    Method Detail

    parseFTPEntry

    public FTPFile parseFTPEntry(java.lang.String entry)
    Parses a line of an OS2 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.

    Parameters:
    entry - A line of text from the file listing
    Returns:
    An FTPFile instance corresponding to the supplied entry