Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.commons.net.ftp.ftp2.parser
Class VMSFTPEntryParser  view VMSFTPEntryParser download VMSFTPEntryParser.java

java.lang.Object
  extended byorg.apache.commons.net.ftp.ftp2.parser.MatchApparatus
      extended byorg.apache.commons.net.ftp.ftp2.parser.VMSFTPEntryParser
All Implemented Interfaces:
org.apache.commons.net.ftp.ftp2.FTPFileEntryParser

public class VMSFTPEntryParser
extends MatchApparatus
implements org.apache.commons.net.ftp.ftp2.FTPFileEntryParser

This Class uses the FTPEntryParser 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 VMSFTPEntryParser
  • VMSFTPEntryParser parser = new VMSFTPEntryParser(boolean);
    True = returns all versions of a file with the respective ;#
    False = only the last version will return (Default)
  • 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 VMS System
  • And how do I do that you ask? easy... VMS is such a wonderful OS that when we do
    String am_I_VMS = FTPClientObj.getSystemName()
    it returns NULL, while everyone else returns the FTP servername
  • 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 FTPFile objects like this
    FTPFile[] myVMSFiles = FTPClientObj.listFiles(parser,filename); (or)
    FTPFile[] myVMSFiles = FTPClientObj.listFiles(parser);
    If filename is a filename and versioning is OFF, the version
    you requested will come back without the ;#

    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 crucial specialy if your goal is to delete the output of the parser.

    Version:
    $Id: VMSFTPEntryParser.java,v 1.12 2004/06/29 04:54:29 dfs Exp $

    Field Summary
    private static java.lang.String MONTHS
               
    private  java.lang.String prefix
               
    private static java.lang.String REGEX
               
    private  boolean versioning
               
     
    Constructor Summary
    VMSFTPEntryParser()
              Convenience Constructor for a VMSFTPEntryParser object.
    VMSFTPEntryParser(boolean versioning)
              Constructor for a VMSFTPEntryParser object.
     
    Method Summary
     int getGroupCnt()
              Convenience method delegates to the internal MatchResult's groups() method.
     java.lang.String getGroupsAsString()
              For debugging purposes - returns a string shows each match group by number.
     java.lang.String group(int matchnum)
              Convenience method delegates to the internal MatchResult's group() method.
     boolean matches(java.lang.String s)
              Convenience method delegates to the internal MatchResult's matches() method.
     org.apache.commons.net.ftp.FTPFile parseFTPEntry(java.lang.String entry)
              Parses a line of a VMS FTP server file listing and converts it into a usable format in the form of an FTPFile instance.
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Field Detail

    prefix

    private java.lang.String prefix

    versioning

    private boolean versioning

    MONTHS

    private static final java.lang.String MONTHS
    See Also:
    Constant Field Values

    REGEX

    private static final java.lang.String REGEX
    See Also:
    Constant Field Values
    Constructor Detail

    VMSFTPEntryParser

    public VMSFTPEntryParser()
    Convenience Constructor for a VMSFTPEntryParser object. Sets the versioning member false


    VMSFTPEntryParser

    public VMSFTPEntryParser(boolean versioning)
    Constructor for a VMSFTPEntryParser object. Sets the versioning member to the supplied value.

    Method Detail

    parseFTPEntry

    public org.apache.commons.net.ftp.FTPFile parseFTPEntry(java.lang.String entry)
    Parses a line of a VMS 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.

    Specified by:
    parseFTPEntry in interface org.apache.commons.net.ftp.ftp2.FTPFileEntryParser

    matches

    public boolean matches(java.lang.String s)
    Convenience method delegates to the internal MatchResult's matches() method.


    getGroupCnt

    public int getGroupCnt()
    Convenience method delegates to the internal MatchResult's groups() method.


    group

    public java.lang.String group(int matchnum)
    Convenience method delegates to the internal MatchResult's group() method.


    getGroupsAsString

    public java.lang.String getGroupsAsString()
    For debugging purposes - returns a string shows each match group by number.