Source Code Cross Referenced for MVSFTPEntryParser.java in  » Net » Apache-commons-net-1.4.1 » org » apache » commons » net » ftp » parser » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Net » Apache commons net 1.4.1 » org.apache.commons.net.ftp.parser 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2005 The Apache Software Foundation
003:         *
004:         * Licensed under the Apache License, Version 2.0 (the "License");
005:         * you may not use this file except in compliance with the License.
006:         * You may obtain a copy of the License at
007:         *
008:         *     http://www.apache.org/licenses/LICENSE-2.0
009:         *
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS,
012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         * See the License for the specific language governing permissions and
014:         * limitations under the License.
015:         */
016:        package org.apache.commons.net.ftp.parser;
017:
018:        import org.apache.commons.net.ftp.FTPClientConfig;
019:        import org.apache.commons.net.ftp.FTPFile;
020:
021:        /**
022:         * Implementation of FTPFileEntryParser and FTPFileListParser for IBM MVS Systems.
023:         *
024:         * @author <a href="jnadler@srcginc.com">Jeff Nadler</a>
025:         * @author <a href="wnoto@openfinance.com">William Noto</a>
026:         * @version $Id$
027:         * @see org.apache.commons.net.ftp.FTPFileEntryParser FTPFileEntryParser (for usage instructions)
028:         */
029:        public class MVSFTPEntryParser extends
030:                ConfigurableFTPFileEntryParserImpl {
031:            /**
032:             * This is the regular expression used by this parser.
033:             */
034:            private static final String REGEX = "(.*)\\s+([^\\s]+)\\s*";
035:
036:            /**
037:             * Although this parser is now ignoring dates, someone may someday
038:             * figure out a way to accomodate this and this appears to be the 
039:             * format used.  For now, it won't be used.
040:             * SMC 2005/04/08
041:             */
042:            static final String DEFAULT_DATE_FORMAT = "yyyy/MM/dd"; // 2001/11/09
043:
044:            // This is not at all the tightest possible regexp for MVS LIST
045:            // output, but I'm not a mainframe guru so I have little idea what the
046:            // range of valid values are.  I just needed to get the filename (Dsname);
047:            // note that no other FTPFile fields can be filled in with the results of
048:            // a LIST on MVS.  The 'Referred' date seems to be 'last accessed date'
049:            // and not 'last modified date' so I didn't bother parsing it.
050:            //
051:            // Of course it works perfectly as-is and it distinguishes header lines from
052:            // file results so that's the important thing.  
053:            //
054:            // This parser should be used when SYST returns:
055:            // 'MVS is the operating system of this server. FTP Server is running on z/OS.'
056:            //
057:            // Also note that there is no concept of directories in MVS, just datasets,
058:            // which have names composed of four dot separated names of up to 8 chars.
059:            // As a result, FTPFile.FILE_TYPE is always used. -JN 6/2004 jnadler<at>srcginc<dotcom>
060:
061:            // Sample LIST results from MVS:
062:            //
063:            //Volume Unit    Referred Ext Used Recfm Lrecl BlkSz Dsorg Dsname
064:            //FPFS42 3390   2004/06/23  1    1  FB     128  6144  PS  INCOMING.RPTBM023.D061704
065:            //FPFS41 3390   2004/06/23  1    1  FB     128  6144  PS  INCOMING.RPTBM056.D061704
066:            //FPFS25 3390   2004/06/23  1    1  FB     128  6144  PS  INCOMING.WTM204.D061704
067:
068:            /**
069:             * The sole constructor for a MVSFTPEntryParser object.
070:             *
071:             * @exception IllegalArgumentException
072:             * Thrown if the regular expression is unparseable.  Should not be seen
073:             * under normal conditions.  It it is seen, this is a sign that
074:             * <code>REGEX</code> is  not a valid regular expression.
075:             */
076:            public MVSFTPEntryParser() {
077:                super (REGEX);
078:            }
079:
080:            /**
081:             * Parses a line of an MVS FTP server file listing and converts it into a
082:             * usable format in the form of an <code> FTPFile </code> instance.  If the
083:             * file listing line doesn't describe a file, <code> null </code> is
084:             * returned, otherwise a <code> FTPFile </code> instance representing the
085:             * files in the directory is returned.
086:             * <p>
087:             * @param entry A line of text from the file listing
088:             * @return An FTPFile instance corresponding to the supplied entry
089:             */
090:            public FTPFile parseFTPEntry(String entry) {
091:                FTPFile f = null;
092:                if (matches(entry)) {
093:                    f = new FTPFile();
094:                    String dataSetName = group(2);
095:                    f.setType(FTPFile.FILE_TYPE);
096:                    f.setName(dataSetName);
097:
098:                    return (f);
099:                }
100:                return null;
101:            }
102:
103:            /* 
104:             * @return
105:             */
106:            protected FTPClientConfig getDefaultConfiguration() {
107:                return new FTPClientConfig(FTPClientConfig.SYST_MVS,
108:                        DEFAULT_DATE_FORMAT, null, null, null, null);
109:            }
110:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.