Class OS400FTPEntryParser

All Implemented Interfaces:
Configurable, FTPFileEntryParser

OS400 (IBM i) FTP entry parser.

Below are examples of the format of FTP entries on an IBM i.

Example *FILE/*MEM FTP entries, when the current working directory is a file of file system QSYS:
$ cwd /qsys.lib/rpgunit.lib/rpgunitc1.file
  250-NAMEFMT set to 1.
  250 "/QSYS.LIB/RPGUNIT.LIB/RPGUNITC1.FILE" is current directory.
$ dir
  227 Entering Passive Mode (10,200,36,33,40,249).
  125 List started.
  QPGMR          135168 22.06.13 13:18:19 *FILE
  QPGMR                                   *MEM       MKCMD.MBR
  QPGMR                                   *MEM       RUCALLTST.MBR
  QPGMR                                   *MEM       RUCMDHLP.MBR
  QPGMR                                   *MEM       RUCRTTST.MBR
  250 List completed.
Example *FILE entry of an OS/400 save file:
$ cwd /qsys.lib/rpgunit.lib
  250 "/QSYS.LIB/RPGUNIT.LIB" is current library.
$ dir rpgunit.file
  227 Entering Passive Mode (10,200,36,33,188,106).
  125 List started.
  QPGMR        16347136 29.06.13 15:45:09 *FILE      RPGUNIT.SAVF
  250 List completed.
Example *STMF/*DIR FTP entries, when the current working directory is in file system "root":
$ cwd /home/raddatz
  250 "/home/raddatz" is current directory.
$ dir test*
  227 Entering Passive Mode (10,200,36,33,200,189).
  125 List started.
  RADDATZ           200 21.05.11 12:31:18 *STMF      TEST_RG_02_CRLF.properties
  RADDATZ           187 08.05.11 12:31:40 *STMF      TEST_RG_02_LF.properties
  RADDATZ           187 08.05.11 12:31:52 *STMF      TEST_RG_02_CR.properties
  RADDATZ          8192 04.07.13 09:04:14 *DIR       testDir1/
  RADDATZ          8192 04.07.13 09:04:17 *DIR       testDir2/
  250 List completed.
Example 1, using ANT to list specific members of a file:
     <echo/>
     <echo>Listing members of a file:</echo>

     <ftp action="list"
          server="${ftp.server}"
          userid="${ftp.user}"
          password="${ftp.password}"
          binary="false"
          verbose="true"
          remotedir="/QSYS.LIB/RPGUNIT.LIB/RPGUNITY1.FILE"
          systemTypeKey="OS/400"
          listing="ftp-listing.txt"
          >
         <fileset dir="./i5-downloads-file" casesensitive="false">
             <include name="run*.mbr" />
         </fileset>
     </ftp>
Output:
  [echo] Listing members of a file:
   [ftp] listing files
   [ftp] listing RUN.MBR
   [ftp] listing RUNNER.MBR
   [ftp] listing RUNNERBND.MBR
   [ftp] 3 files listed
Example 2, using ANT to list specific members of all files of a library:
     <echo/>
     <echo>Listing members of all files of a library:</echo>

     <ftp action="list"
          server="${ftp.server}"
          userid="${ftp.user}"
          password="${ftp.password}"
          binary="false"
          verbose="true"
          remotedir="/QSYS.LIB/RPGUNIT.LIB"
          systemTypeKey="OS/400"
          listing="ftp-listing.txt"
          >
         <fileset dir="./i5-downloads-lib" casesensitive="false">
             <include name="**\run*.mbr" />
         </fileset>
     </ftp>
Output:
  [echo] Listing members of all files of a library:
   [ftp] listing files
   [ftp] listing RPGUNIT1.FILE\RUN.MBR
   [ftp] listing RPGUNIT1.FILE\RUNRMT.MBR
   [ftp] listing RPGUNITT1.FILE\RUNT.MBR
   [ftp] listing RPGUNITY1.FILE\RUN.MBR
   [ftp] listing RPGUNITY1.FILE\RUNNER.MBR
   [ftp] listing RPGUNITY1.FILE\RUNNERBND.MBR
   [ftp] 6 files listed
Example 3, using ANT to download specific members of a file:
     <echo/>
     <echo>Downloading members of a file:</echo>

     <ftp action="get"
          server="${ftp.server}"
          userid="${ftp.user}"
          password="${ftp.password}"
          binary="false"
          verbose="true"
          remotedir="/QSYS.LIB/RPGUNIT.LIB/RPGUNITY1.FILE"
          systemTypeKey="OS/400"
          >
         <fileset dir="./i5-downloads-file" casesensitive="false">
             <include name="run*.mbr" />
         </fileset>
     </ftp>
Output:
  [echo] Downloading members of a file:
   [ftp] getting files
   [ftp] transferring RUN.MBR to C:\workspaces\rdp_080\workspace\ANT - FTP\i5-downloads-file\RUN.MBR
   [ftp] transferring RUNNER.MBR to C:\workspaces\rdp_080\workspace\ANT - FTP\i5-downloads-file\RUNNER.MBR
   [ftp] transferring RUNNERBND.MBR to C:\workspaces\rdp_080\workspace\ANT - FTP\i5-downloads-file\RUNNERBND.MBR
   [ftp] 3 files retrieved
Example 4, using ANT to download specific members of all files of a library:
     <echo/>
     <echo>Downloading members of all files of a library:</echo>

     <ftp action="get"
          server="${ftp.server}"
          userid="${ftp.user}"
          password="${ftp.password}"
          binary="false"
          verbose="true"
          remotedir="/QSYS.LIB/RPGUNIT.LIB"
          systemTypeKey="OS/400"
          >
         <fileset dir="./i5-downloads-lib" casesensitive="false">
             <include name="**\run*.mbr" />
         </fileset>
     </ftp>
Output:
  [echo] Downloading members of all files of a library:
   [ftp] getting files
   [ftp] transferring RPGUNIT1.FILE\RUN.MBR to C:\work\rdp_080\space\ANT - FTP\i5-downloads\RPGUNIT1.FILE\RUN.MBR
   [ftp] transferring RPGUNIT1.FILE\RUNRMT.MBR to C:\work\rdp_080\space\ANT - FTP\i5-downloads\RPGUNIT1.FILE\RUNRMT.MBR
   [ftp] transferring RPGUNITT1.FILE\RUNT.MBR to C:\work\rdp_080\space\ANT - FTP\i5-downloads\RPGUNITT1.FILE\RUNT.MBR
   [ftp] transferring RPGUNITY1.FILE\RUN.MBR to C:\work\rdp_080\space\ANT - FTP\i5-downloads\RPGUNITY1.FILE\RUN.MBR
   [ftp] transferring RPGUNITY1.FILE\RUNNER.MBR to C:\work\rdp_080\space\ANT - FTP\i5-downloads\RPGUNITY1.FILE\RUNNER.MBR
   [ftp] transferring RPGUNITY1.FILE\RUNNERBND.MBR to C:\work\rdp_080\space\ANT - FTP\i5-downloads\RPGUNITY1.FILE\RUNNERBND.MBR
   [ftp] 6 files retrieved
Example 5, using ANT to download a save file of a library:
     <ftp action="get"
          server="${ftp.server}"
          userid="${ftp.user}"
          password="${ftp.password}"
          binary="true"
          verbose="true"
          remotedir="/QSYS.LIB/RPGUNIT.LIB"
          systemTypeKey="OS/400"
          >
       <fileset dir="./i5-downloads-savf" casesensitive="false">
           <include name="RPGUNIT.SAVF" />
       </fileset>
     </ftp>
Output:
  [echo] Downloading save file:
   [ftp] getting files
   [ftp] transferring RPGUNIT.SAVF to C:\workspaces\rdp_080\workspace\net-Test\i5-downloads-lib\RPGUNIT.SAVF
   [ftp] 1 files retrieved
  • Constructor Details

    • OS400FTPEntryParser

      Constructs a new instance.
      Throws:
      IllegalArgumentException - Thrown if the regular expression is unparseable. Should not be seen under normal conditions. If it is seen, this is a sign that REGEX is not a valid regular expression.
    • OS400FTPEntryParser

      Constructs a new instance with something other than the default configuration.
      Parameters:
      config - The configuration object used to configure this parser.
      Throws:
      IllegalArgumentException - Thrown if the regular expression is unparseable. Should not be seen under normal conditions. If it is seen, this is a sign that REGEX is not a valid regular expression.
      Since:
      1.4
  • Method Details

    • getDefaultConfiguration

      Gets a new default configuration to be used when this class is instantiated without a FTPClientConfig parameter being specified.
      Specified by:
      getDefaultConfiguration in class ConfigurableFTPFileEntryParserImpl
      Returns:
      the default configuration for this parser.
    • parseFTPEntry

      public FTPFile parseFTPEntry(String entry)
      Description copied from interface: FTPFileEntryParser
      Parses a line of an 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 should be 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