Class OS400FTPEntryParser
- java.lang.Object
-
- org.apache.commons.net.ftp.FTPFileEntryParserImpl
-
- org.apache.commons.net.ftp.parser.RegexFTPFileEntryParserImpl
-
- org.apache.commons.net.ftp.parser.ConfigurableFTPFileEntryParserImpl
-
- org.apache.commons.net.ftp.parser.OS400FTPEntryParser
-
- All Implemented Interfaces:
Configurable,FTPFileEntryParser
public class OS400FTPEntryParser extends ConfigurableFTPFileEntryParserImpl
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 listedExample 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 listedExample 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 retrievedExample 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 retrievedExample 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
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.StringDEFAULT_DATE_FORMATprivate static java.lang.StringREGEX-
Fields inherited from class org.apache.commons.net.ftp.parser.RegexFTPFileEntryParserImpl
_matcher_
-
-
Constructor Summary
Constructors Constructor Description OS400FTPEntryParser()Constructs a new instance.OS400FTPEntryParser(FTPClientConfig config)Constructs a new instance with something other than the default configuration.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected FTPClientConfiggetDefaultConfiguration()Gets a new default configuration to be used when this class is instantiated without aFTPClientConfigparameter being specified.private booleanisNullOrEmpty(java.lang.String string)FTPFileparseFTPEntry(java.lang.String entry)Parses a line of an FTP server file listing and converts it into a usable format in the form of anFTPFileinstance.-
Methods inherited from class org.apache.commons.net.ftp.parser.ConfigurableFTPFileEntryParserImpl
configure, parseTimestamp
-
Methods inherited from class org.apache.commons.net.ftp.parser.RegexFTPFileEntryParserImpl
getGroupCnt, getGroupsAsString, group, matches, setRegex, setRegex
-
Methods inherited from class org.apache.commons.net.ftp.FTPFileEntryParserImpl
preParse, readNextEntry
-
-
-
-
Field Detail
-
DEFAULT_DATE_FORMAT
private static final java.lang.String DEFAULT_DATE_FORMAT
- See Also:
- Constant Field Values
-
REGEX
private static final java.lang.String REGEX
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
OS400FTPEntryParser
public OS400FTPEntryParser()
Constructs a new instance.- Throws:
java.lang.IllegalArgumentException- Thrown if the regular expression is unparseable. Should not be seen under normal conditions. If it is seen, this is a sign thatREGEXis not a valid regular expression.
-
OS400FTPEntryParser
public OS400FTPEntryParser(FTPClientConfig config)
Constructs a new instance with something other than the default configuration.- Parameters:
config- Theconfigurationobject used to configure this parser.- Throws:
java.lang.IllegalArgumentException- Thrown if the regular expression is unparseable. Should not be seen under normal conditions. If it is seen, this is a sign thatREGEXis not a valid regular expression.- Since:
- 1.4
-
-
Method Detail
-
getDefaultConfiguration
protected FTPClientConfig getDefaultConfiguration()
Gets a new default configuration to be used when this class is instantiated without aFTPClientConfigparameter being specified.- Specified by:
getDefaultConfigurationin classConfigurableFTPFileEntryParserImpl- Returns:
- the default configuration for this parser.
-
isNullOrEmpty
private boolean isNullOrEmpty(java.lang.String string)
- Parameters:
string- String value that is checked fornullor empty.- Returns:
truefornullor empty values, elsefalse.
-
parseFTPEntry
public FTPFile parseFTPEntry(java.lang.String entry)
Description copied from interface:FTPFileEntryParserParses a line of an FTP server file listing and converts it into a usable format in the form of anFTPFileinstance. If the file listing line doesn't describe a file,nullshould be returned, otherwise aFTPFileinstance 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
-
-