Class MVSFTPEntryParser
- 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.MVSFTPEntryParser
-
- All Implemented Interfaces:
Configurable,FTPFileEntryParser
public class MVSFTPEntryParser extends ConfigurableFTPFileEntryParserImpl
Implementation of FTPFileEntryParser and FTPFileListParser for IBM zOS/MVS Systems.- Version:
- $Id: MVSFTPEntryParser.java 1752660 2016-07-14 13:25:39Z sebb $
- See Also:
FTPFileEntryParser (for usage instructions)
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static java.lang.StringDEFAULT_DATE_FORMATDates are ignored for file lists, but are used for member lists where possible(package private) static java.lang.StringFILE_LIST_REGEXMatches these entries:(package private) static intFILE_LIST_TYPEprivate intisType(package private) static java.lang.StringJES_LEVEL_1_LIST_REGEXMatches these entries, note: no header:(package private) static intJES_LEVEL_1_LIST_TYPE(package private) static java.lang.StringJES_LEVEL_2_LIST_REGEXJES INTERFACE LEVEL 2 parser Matches these entries:(package private) static intJES_LEVEL_2_LIST_TYPE(package private) static java.lang.StringMEMBER_LIST_REGEXMatches these entries:(package private) static intMEMBER_LIST_TYPE(package private) static intUNIX_LIST_TYPEprivate UnixFTPEntryParserunixFTPEntryParserFallback parser for Unix-style listings(package private) static intUNKNOWN_LIST_TYPE-
Fields inherited from class org.apache.commons.net.ftp.parser.RegexFTPFileEntryParserImpl
_matcher_
-
-
Constructor Summary
Constructors Constructor Description MVSFTPEntryParser()The sole constructor for a MVSFTPEntryParser object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected FTPClientConfiggetDefaultConfiguration()Each concrete subclass must define this member to create a default configuration to be used when that subclass is instantiated without aFTPClientConfigparameter being specified.private booleanparseFileList(FTPFile file, java.lang.String entry)Parse entries representing a dataset list.FTPFileparseFTPEntry(java.lang.String entry)Parses a line of an z/OS - MVS FTP server file listing and converts it into a usable format in the form of anFTPFileinstance.private booleanparseJeslevel1List(FTPFile file, java.lang.String entry)Matches these entries, note: no header:private booleanparseJeslevel2List(FTPFile file, java.lang.String entry)Matches these entries:private booleanparseMemberList(FTPFile file, java.lang.String entry)Parse entries within a partitioned dataset.private booleanparseSimpleEntry(FTPFile file, java.lang.String entry)Assigns the name to the first word of the entry.private booleanparseUnixList(FTPFile file, java.lang.String entry)Parse the entry as a standard unix file.java.util.List<java.lang.String>preParse(java.util.List<java.lang.String> orig)preParse is called as part of the interface.(package private) voidsetType(int type)Explicitly set the type of listing being processed.-
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
readNextEntry
-
-
-
-
Field Detail
-
UNKNOWN_LIST_TYPE
static final int UNKNOWN_LIST_TYPE
- See Also:
- Constant Field Values
-
FILE_LIST_TYPE
static final int FILE_LIST_TYPE
- See Also:
- Constant Field Values
-
MEMBER_LIST_TYPE
static final int MEMBER_LIST_TYPE
- See Also:
- Constant Field Values
-
UNIX_LIST_TYPE
static final int UNIX_LIST_TYPE
- See Also:
- Constant Field Values
-
JES_LEVEL_1_LIST_TYPE
static final int JES_LEVEL_1_LIST_TYPE
- See Also:
- Constant Field Values
-
JES_LEVEL_2_LIST_TYPE
static final int JES_LEVEL_2_LIST_TYPE
- See Also:
- Constant Field Values
-
isType
private int isType
-
unixFTPEntryParser
private UnixFTPEntryParser unixFTPEntryParser
Fallback parser for Unix-style listings
-
DEFAULT_DATE_FORMAT
static final java.lang.String DEFAULT_DATE_FORMAT
Dates are ignored for file lists, but are used for member lists where possible- See Also:
- Constant Field Values
-
FILE_LIST_REGEX
static final java.lang.String FILE_LIST_REGEX
Matches these entries:Volume Unit Referred Ext Used Recfm Lrecl BlkSz Dsorg Dsname B10142 3390 2006/03/20 2 31 F 80 80 PS MDI.OKL.WORK
- See Also:
- Constant Field Values
-
MEMBER_LIST_REGEX
static final java.lang.String MEMBER_LIST_REGEX
Matches these entries:Name VV.MM Created Changed Size Init Mod Id TBSHELF 01.03 2002/09/12 2002/10/11 09:37 11 11 0 KIL001
- See Also:
- Constant Field Values
-
JES_LEVEL_1_LIST_REGEX
static final java.lang.String JES_LEVEL_1_LIST_REGEX
Matches these entries, note: no header:IBMUSER1 JOB01906 OUTPUT 3 Spool Files 012345678901234567890123456789012345678901234 1 2 3 4- See Also:
- Constant Field Values
-
JES_LEVEL_2_LIST_REGEX
static final java.lang.String JES_LEVEL_2_LIST_REGEX
JES INTERFACE LEVEL 2 parser Matches these entries:JOBNAME JOBID OWNER STATUS CLASS IBMUSER1 JOB01906 IBMUSER OUTPUT A RC=0000 3 spool files IBMUSER TSU01830 IBMUSER OUTPUT TSU ABEND=522 3 spool files
Sample output from FTP session:ftp> quote site filetype=jes 200 SITE command was accepted ftp> ls 200 Port request OK. 125 List started OK for JESJOBNAME=IBMUSER*, JESSTATUS=ALL and JESOWNER=IBMUSER JOBNAME JOBID OWNER STATUS CLASS IBMUSER1 JOB01906 IBMUSER OUTPUT A RC=0000 3 spool files IBMUSER TSU01830 IBMUSER OUTPUT TSU ABEND=522 3 spool files 250 List completed successfully. ftp> ls job01906 200 Port request OK. 125 List started OK for JESJOBNAME=IBMUSER*, JESSTATUS=ALL and JESOWNER=IBMUSER JOBNAME JOBID OWNER STATUS CLASS IBMUSER1 JOB01906 IBMUSER OUTPUT A RC=0000 -------- ID STEPNAME PROCSTEP C DDNAME BYTE-COUNT 001 JES2 A JESMSGLG 858 002 JES2 A JESJCL 128 003 JES2 A JESYSMSG 443 3 spool files 250 List completed successfully.
- See Also:
- Constant Field Values
-
-
Method Detail
-
parseFTPEntry
public FTPFile parseFTPEntry(java.lang.String entry)
Parses a line of an z/OS - MVS 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, thennullis returned. Otherwise aFTPFileinstance representing the file is returned.- Parameters:
entry- A line of text from the file listing- Returns:
- An FTPFile instance corresponding to the supplied entry
-
parseFileList
private boolean parseFileList(FTPFile file, java.lang.String entry)
Parse entries representing a dataset list. Only datasets with DSORG PS or PO or PO-E and with RECFM F* or V* will be parsed. Format of ZOS/MVS file list: 1 2 3 4 5 6 7 8 9 10 Volume Unit Referred Ext Used Recfm Lrecl BlkSz Dsorg Dsname B10142 3390 2006/03/20 2 31 F 80 80 PS MDI.OKL.WORK ARCIVE Not Direct Access Device KJ.IOP998.ERROR.PL.UNITTEST B1N231 3390 2006/03/20 1 15 VB 256 27998 PO PLU B1N231 3390 2006/03/20 1 15 VB 256 27998 PO-E PLB ----------------------------------- Group within Regex [1] Volume [2] Unit [3] Referred [4] Ext: number of extents [5] Used [6] Recfm: Record format [7] Lrecl: Logical record length [8] BlkSz: Block size [9] Dsorg: Dataset organisation. Many exists but only support: PS, PO, PO-E [10] Dsname: Dataset name Note: When volume is ARCIVE, it means the dataset is stored somewhere in a tape archive. These entries is currently not supported by this parser. A null value is returned.- Parameters:
file- will be updated with Name, Type, Timestamp if parsed.entry- zosDirectoryEntry- Returns:
- true: entry was parsed, false: entry was not parsed.
-
parseMemberList
private boolean parseMemberList(FTPFile file, java.lang.String entry)
Parse entries within a partitioned dataset. Format of a memberlist within a PDS:0 1 2 3 4 5 6 7 8 Name VV.MM Created Changed Size Init Mod Id TBSHELF 01.03 2002/09/12 2002/10/11 09:37 11 11 0 KIL001 TBTOOL 01.12 2002/09/12 2004/11/26 19:54 51 28 0 KIL001 ------------------------------------------- [1] Name [2] VV.MM: Version . modification [3] Created: yyyy / MM / dd [4,5] Changed: yyyy / MM / dd HH:mm [6] Size: number of lines [7] Init: number of lines when first created [8] Mod: number of modified lines a last save [9] Id: User id for last update- Parameters:
file- will be updated with Name, Type and Timestamp if parsed.entry- zosDirectoryEntry- Returns:
- true: entry was parsed, false: entry was not parsed.
-
parseSimpleEntry
private boolean parseSimpleEntry(FTPFile file, java.lang.String entry)
Assigns the name to the first word of the entry. Only to be used from a safe context, for example from a memberlist, where the regex for some reason fails. Then just assign the name field of FTPFile.- Parameters:
file-entry-- Returns:
- true if the entry string is non-null and non-empty
-
parseUnixList
private boolean parseUnixList(FTPFile file, java.lang.String entry)
Parse the entry as a standard unix file. Using the UnixFTPEntryParser.- Parameters:
file-entry-- Returns:
- true: entry is parsed, false: entry could not be parsed.
-
parseJeslevel1List
private boolean parseJeslevel1List(FTPFile file, java.lang.String entry)
Matches these entries, note: no header:[1] [2] [3] [4] [5] IBMUSER1 JOB01906 OUTPUT 3 Spool Files 012345678901234567890123456789012345678901234 1 2 3 4 ------------------------------------------- Group in regex [1] Job name [2] Job number [3] Job status (INPUT,ACTIVE,OUTPUT) [4] Number of sysout files [5] The string "Spool Files"- Parameters:
file- will be updated with Name, Type and Timestamp if parsed.entry- zosDirectoryEntry- Returns:
- true: entry was parsed, false: entry was not parsed.
-
parseJeslevel2List
private boolean parseJeslevel2List(FTPFile file, java.lang.String entry)
Matches these entries:[1] [2] [3] [4] [5] JOBNAME JOBID OWNER STATUS CLASS IBMUSER1 JOB01906 IBMUSER OUTPUT A RC=0000 3 spool files IBMUSER TSU01830 IBMUSER OUTPUT TSU ABEND=522 3 spool files 012345678901234567890123456789012345678901234 1 2 3 4 ------------------------------------------- Group in regex [1] Job name [2] Job number [3] Owner [4] Job status (INPUT,ACTIVE,OUTPUT) [5] Job Class [6] The rest- Parameters:
file- will be updated with Name, Type and Timestamp if parsed.entry- zosDirectoryEntry- Returns:
- true: entry was parsed, false: entry was not parsed.
-
preParse
public java.util.List<java.lang.String> preParse(java.util.List<java.lang.String> orig)
preParse is called as part of the interface. Per definition is is called before the parsing takes place. Three kind of lists is recognize: z/OS-MVS File lists z/OS-MVS Member lists unix file lists- Specified by:
preParsein interfaceFTPFileEntryParser- Overrides:
preParsein classFTPFileEntryParserImpl- Parameters:
orig- Original list after it has been created from the server stream- Returns:
originalunmodified.- Since:
- 2.0
-
setType
void setType(int type)
Explicitly set the type of listing being processed.- Parameters:
type- The listing type.
-
getDefaultConfiguration
protected FTPClientConfig getDefaultConfiguration()
Description copied from class:ConfigurableFTPFileEntryParserImplEach concrete subclass must define this member to create a default configuration to be used when that subclass is instantiated without aFTPClientConfigparameter being specified.- Specified by:
getDefaultConfigurationin classConfigurableFTPFileEntryParserImpl- Returns:
- the default configuration for the subclass.
-
-