Package org.apache.commons.net.ftp.parser

# Class DefaultFTPFileEntryParserFactory

java.lang.Object
org.apache.commons.net.ftp.parser.DefaultFTPFileEntryParserFactory

All Implemented Interfaces:
  `FTPFileEntryParserFactory`

public class DefaultFTPFileEntryParserFactory extends Object implements FTPFileEntryParserFactory
This is the default implementation of the FTPFileEntryParserFactory interface. This is the implementation that will be used by org.apache.commons.net.ftp.FTPClient.listFiles() if no other implementation has been specified.

See Also:
  - `FTPClient.listFiles()`
  - `FTPClient.setParserFactory(org.apache.commons.net.ftp.parser.FTPFileEntryParserFactory)`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DefaultFTPFileEntryParserFactory()`
  Constructs a new instance.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `FTPFileEntryParser`
  `createFileEntryParser(String key)`
  This default implementation of the FTPFileEntryParserFactory interface works according to the following logic: First it attempts to interpret the supplied key as a fully qualified class name (default package is not allowed) of a class implementing the FTPFileEntryParser interface.
  `FTPFileEntryParser`
  `createFileEntryParser(FTPClientConfig config)`
  Implementation extracts a key from the supplied `FTPClientConfig` parameter and creates an object implementing the interface FTPFileEntryParser and uses the supplied configuration to configure it.
  `FTPFileEntryParser`
  `createMVSEntryParser()`
  Creates a new MVSFTPEntryParser.
  `FTPFileEntryParser`
  `createNetwareFTPEntryParser()`
  Creates a new NetwareFTPEntryParser.
  `FTPFileEntryParser`
  `createNTFTPEntryParser()`
  Creates a new FTPFileEntryParser.
  `FTPFileEntryParser`
  `createOS2FTPEntryParser()`
  Creates a new OS2FTPEntryParser.
  `FTPFileEntryParser`
  `createOS400FTPEntryParser()`
  Creates a new FTPFileEntryParser.
  `FTPFileEntryParser`
  `createUnixFTPEntryParser()`
  Creates a new UnixFTPEntryParser.
  `FTPFileEntryParser`
  `createVMSVersioningFTPEntryParser()`
  Creates a new VMSVersioningFTPEntryParser.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### DefaultFTPFileEntryParserFactory

    public DefaultFTPFileEntryParserFactory()
    Constructs a new instance.

- ## Method Details

  - ### createFileEntryParser

    public FTPFileEntryParser createFileEntryParser(FTPClientConfig config) throws ParserInitializationException
    Implementation extracts a key from the supplied `FTPClientConfig` parameter and creates an object implementing the interface FTPFileEntryParser and uses the supplied configuration to configure it.

    Note that this method will generally not be called in scenarios that call for autodetection of parser type but rather, for situations where the user knows that the server uses a non-default configuration and knows what that configuration is.

    Specified by:
      `createFileEntryParser` in interface `FTPFileEntryParserFactory`
    Parameters:
      `config` - A `FTPClientConfig` used to configure the parser created
    Returns:
      the `FTPFileEntryParser` so created.
    Throws:
      `ParserInitializationException` - Thrown on any exception in instantiation
      `NullPointerException` - if `config` is `null`
    Since:
      1.4

  - ### createFileEntryParser

    public FTPFileEntryParser createFileEntryParser(String key)
    This default implementation of the FTPFileEntryParserFactory interface works according to the following logic: First it attempts to interpret the supplied key as a fully qualified class name (default package is not allowed) of a class implementing the FTPFileEntryParser interface. If that succeeds, a parser object of this class is instantiated and is returned; otherwise it attempts to interpret the key as an identifier commonly used by the FTP SYST command to identify systems.

    If `key` is not recognized as a fully qualified class name known to the system, this method will then attempt to see whether it contains a string identifying one of the known parsers. This comparison is case-insensitive. The intent here is where possible, to select as keys strings which are returned by the SYST command on the systems which the corresponding parser successfully parses. This enables this factory to be used in the auto-detection system.

    Specified by:
      `createFileEntryParser` in interface `FTPFileEntryParserFactory`
    Parameters:
      `key` - should be a fully qualified class name corresponding to a class implementing the FTPFileEntryParser interface
      OR
      a string containing (case-insensitively) one of the following keywords:
      - `UNIX`
      - `WINDOWS`
      - `OS/2`
      - `OS/400`
      - `AS/400`
      - `VMS`
      - `MVS`
      - `NETWARE`
      - `TYPE:L8`
    Returns:
      the FTPFileEntryParser corresponding to the supplied key.
    Throws:
      `ParserInitializationException` - thrown if for any reason the factory cannot resolve the supplied key into an FTPFileEntryParser.
    See Also:
      - `FTPFileEntryParser`

  - ### createMVSEntryParser

    public FTPFileEntryParser createMVSEntryParser()
    Creates a new MVSFTPEntryParser.
    Returns:
      a new MVSFTPEntryParser.

  - ### createNetwareFTPEntryParser

    public FTPFileEntryParser createNetwareFTPEntryParser()
    Creates a new NetwareFTPEntryParser.
    Returns:
      a new NetwareFTPEntryParser.

  - ### createNTFTPEntryParser

    public FTPFileEntryParser createNTFTPEntryParser()
    Creates a new FTPFileEntryParser.
    Returns:
      a new FTPFileEntryParser.

  - ### createOS2FTPEntryParser

    public FTPFileEntryParser createOS2FTPEntryParser()
    Creates a new OS2FTPEntryParser.
    Returns:
      a new OS2FTPEntryParser.

  - ### createOS400FTPEntryParser

    public FTPFileEntryParser createOS400FTPEntryParser()
    Creates a new FTPFileEntryParser.
    Returns:
      a new FTPFileEntryParser.

  - ### createUnixFTPEntryParser

    public FTPFileEntryParser createUnixFTPEntryParser()
    Creates a new UnixFTPEntryParser.
    Returns:
      a new UnixFTPEntryParser.

  - ### createVMSVersioningFTPEntryParser

    public FTPFileEntryParser createVMSVersioningFTPEntryParser()
    Creates a new VMSVersioningFTPEntryParser.
    Returns:
      a new VMSVersioningFTPEntryParser.