Java 类org.apache.commons.net.ftp.FTPFileEntryParser 实例源码

项目:cyberduck    文件:UnixFTPEntryParserTest.java   
@Test
public void testParseFTPEntryExpected() {
    FTPFileEntryParser parser = new FTPParserSelector().getParser("UNIX");

    FTPFile parsed;

    parsed = parser.parseFTPEntry(
            "drw-rw-rw-   1 user      ftp             0  Mar 11 20:56 ADMIN_Documentation");
    assertNotNull(parsed);
    assertEquals(parsed.getType(), FTPFile.DIRECTORY_TYPE);
    assertEquals("user", parsed.getUser());
    assertEquals("ftp", parsed.getGroup());
    assertEquals("ADMIN_Documentation", parsed.getName());

    parsed = parser.parseFTPEntry(
            "drwxr--r--   1 user     group          0 Feb 14 18:14 Downloads");
    assertNotNull(parsed);
    assertEquals("Downloads", parsed.getName());
}
项目:cyberduck    文件:UnixFTPEntryParserTest.java   
@Test
public void testCurrentYear() {
    FTPFileEntryParser parser = new FTPParserSelector().getParser("UNIX");

    FTPFile parsed;

    parsed = parser.parseFTPEntry(
            "-rw-r--r--   1 20708    205             194 Oct 17 14:40 D3I0_805.fixlist");
    assertNotNull(parsed);
    assertTrue(parsed.isFile());
    assertNotNull(parsed.getTimestamp());
    assertEquals(Calendar.OCTOBER, parsed.getTimestamp().get(Calendar.MONTH));
    assertEquals(17, parsed.getTimestamp().get(Calendar.DAY_OF_MONTH));
    assertEquals(14, parsed.getTimestamp().get(Calendar.HOUR_OF_DAY));
    assertEquals(40, parsed.getTimestamp().get(Calendar.MINUTE));
}
项目:cyberduck    文件:UnixFTPEntryParserTest.java   
@Test
public void testLowerCaseMonths() {
    FTPFileEntryParser parser = new FTPParserSelector().getParser("UNIX");

    FTPFile parsed;

    parsed = parser.parseFTPEntry(
            "drwxrwxrwx    41 spinkb  spinkb      1394 jan 21 20:57 Desktop");
    assertNotNull(parsed);
    assertEquals("Desktop", parsed.getName());
    assertEquals(FTPFile.DIRECTORY_TYPE, parsed.getType());
    assertEquals("spinkb", parsed.getUser());
    assertEquals("spinkb", parsed.getGroup());
    assertNotNull(parsed.getTimestamp());
    assertEquals(Calendar.JANUARY, parsed.getTimestamp().get(Calendar.MONTH));
    assertEquals(21, parsed.getTimestamp().get(Calendar.DAY_OF_MONTH));
}
项目:cyberduck    文件:UnixFTPEntryParserTest.java   
@Test
public void testUpperCaseMonths() {
    FTPFileEntryParser parser = new FTPParserSelector().getParser("UNIX");

    FTPFile parsed;

    parsed = parser.parseFTPEntry(
            "drwxrwxrwx    41 spinkb  spinkb      1394 Feb 21 20:57 Desktop");
    assertNotNull(parsed);
    assertEquals("Desktop", parsed.getName());
    assertEquals(FTPFile.DIRECTORY_TYPE, parsed.getType());
    assertEquals("spinkb", parsed.getUser());
    assertEquals("spinkb", parsed.getGroup());
    assertEquals(Calendar.FEBRUARY, parsed.getTimestamp().get(Calendar.MONTH));
    assertEquals(21, parsed.getTimestamp().get(Calendar.DAY_OF_MONTH));
}
项目:cyberduck    文件:UnixFTPEntryParserTest.java   
@Test
public void testSolarisAcl() {
    FTPFileEntryParser parser = new FTPParserSelector().getParser("UNIX");

    FTPFile parsed;

    //#215
    parsed = parser.parseFTPEntry(
            "drwxrwsr-x+ 34 cristol  molvis      3072 Jul 12 20:16 molvis");
    assertNotNull(parsed);
    assertEquals(parsed.getName(), "molvis");
    assertEquals(FTPFile.DIRECTORY_TYPE, parsed.getType());
    assertEquals("cristol", parsed.getUser());
    assertEquals("molvis", parsed.getGroup());
    assertNotNull(parsed.getTimestamp());
    assertEquals(Calendar.JULY, parsed.getTimestamp().get(Calendar.MONTH));
    assertEquals(12, parsed.getTimestamp().get(Calendar.DAY_OF_MONTH));
}
项目:cyberduck    文件:UnixFTPEntryParserTest.java   
@Test
public void testSetuid() {
    FTPFileEntryParser parser = new FTPParserSelector().getParser("UNIX");

    FTPFile parsed;

    parsed = parser.parseFTPEntry(
            "drwsr--r--   1 user     group          0 Feb 29 18:14 Filename"
    );
    assertNotNull(parsed);
    assertTrue(parsed.hasPermission(FTPFile.USER_ACCESS, FTPFile.EXECUTE_PERMISSION));

    parsed = parser.parseFTPEntry(
            "drwSr--r--   1 user     group          0 Feb 29 18:14 Filename"
    );
    assertNotNull(parsed);
    assertFalse(parsed.hasPermission(FTPFile.USER_ACCESS, FTPFile.EXECUTE_PERMISSION));
}
项目:cyberduck    文件:UnixFTPEntryParserTest.java   
@Test
public void testSetgid() {
    FTPFileEntryParser parser = new FTPParserSelector().getParser("UNIX");

    FTPFile parsed;

    parsed = parser.parseFTPEntry(
            "drwxr-sr--   1 user     group          0 Feb 29 18:14 Filename"
    );
    assertNotNull(parsed);
    assertTrue(parsed.hasPermission(FTPFile.GROUP_ACCESS, FTPFile.EXECUTE_PERMISSION));

    parsed = parser.parseFTPEntry(
            "drwxr-Sr--   1 user     group          0 Feb 29 18:14 Filename"
    );
    assertNotNull(parsed);
    assertFalse(parsed.hasPermission(FTPFile.GROUP_ACCESS, FTPFile.EXECUTE_PERMISSION));
}
项目:cyberduck    文件:UnixFTPEntryParserTest.java   
@Test
public void testStickyBit() {
    FTPFileEntryParser parser = new FTPParserSelector().getParser("UNIX");

    FTPFile parsed;

    parsed = parser.parseFTPEntry(
            "drwxr--r-t   1 user     group          0 Feb 29 18:14 Filename"
    );
    assertNotNull(parsed);
    assertTrue(parsed.hasPermission(FTPFile.WORLD_ACCESS, FTPFile.EXECUTE_PERMISSION));

    parsed = parser.parseFTPEntry(
            "drwxr--r-T   1 user     group          0 Feb 29 18:14 Filename"
    );
    assertNotNull(parsed);
    assertFalse(parsed.hasPermission(FTPFile.WORLD_ACCESS, FTPFile.EXECUTE_PERMISSION));
}
项目:cyberduck    文件:UnixFTPEntryParserTest.java   
@Test
public void testMVSParser() {
    FTPFileEntryParser parser = new FTPParserSelector().getParser("MVS is the operating system of this server. FTP Server is running on z/OS.");

    FTPFile parsed;

    final String entry = "drwxr-xr-x   6 START2   SYS1        8192 Oct 28  2008 ADCD";
    parser.preParse(new ArrayList<String>(Arrays.asList("total 66", entry)));
    // #7717
    parsed = parser.parseFTPEntry(entry);
    assertNotNull(parsed);
    assertEquals("ADCD", parsed.getName());
    assertEquals("START2", parsed.getUser());
    assertEquals("SYS1", parsed.getGroup());
    assertNotNull(parsed.getTimestamp());
    assertEquals(Calendar.OCTOBER, parsed.getTimestamp().get(Calendar.MONTH));
    assertEquals(28, parsed.getTimestamp().get(Calendar.DAY_OF_MONTH));
    assertEquals(2008, parsed.getTimestamp().get(Calendar.YEAR));
}
项目:cyberduck    文件:FTPStatListServiceTest.java   
@Test
public void testParse8006() throws Exception {
    final List<String> lines = Arrays.asList(
            "212-Status of /cgi-bin:",
            " drwxr-xr-x   3 1564466  15000           4 Jan 19 19:56 .",
            " drwxr-x---  13 1564466  15000          44 Jun 13 18:36 ..",
            " drwxr-xr-x   2 1564466  15000           2 May 25  2009 tmp",
            " End of status",
            "212 -rw-r--r--   1 1564466  15000        9859 Jan 19 19:56 adoptees.php");
    final FTPFileEntryParser parser = new UnixFTPEntryParser();
    final List<String> list = new FTPStatListService(null, parser).parse(
            212, lines.toArray(new String[lines.size()]));
    assertEquals(6, list.size());
    final Path parent = new Path("/cgi-bin", EnumSet.of(Path.Type.directory));
    final AttributedList<Path> parsed = new FTPListResponseReader(parser, true).read(
            parent, list, new DisabledListProgressListener()
    );
    assertEquals(2, parsed.size());
    assertTrue(parsed.contains(new Path(parent, "tmp", EnumSet.of(Path.Type.directory))));
    assertTrue(parsed.contains(new Path(parent, "adoptees.php", EnumSet.of(Path.Type.file))));
}
项目:cyberduck    文件:FTPStatListServiceTest.java   
@Test
public void testParseEgnyte() throws Exception {
    final List<String> lines = Arrays.asList(
            "200-drwx------   0 - -            0 Jun 17 07:59 core",
            "200 -rw-------   0 David-Kocher -          529 Jun 17 07:59 App.config");
    final FTPFileEntryParser parser = new LaxUnixFTPEntryParser();
    final List<String> list = new FTPStatListService(null, parser).parse(
            200, lines.toArray(new String[lines.size()]));
    assertEquals(2, list.size());
    assertTrue(list.contains("drwx------   0 - -            0 Jun 17 07:59 core"));
    assertTrue(list.contains("-rw-------   0 David-Kocher -          529 Jun 17 07:59 App.config"));
    final Path parent = new Path("/cyberduck", EnumSet.of(Path.Type.directory));
    final AttributedList<Path> parsed = new FTPListResponseReader(parser, true).read(
            parent, list, new DisabledListProgressListener());
    assertEquals(2, parsed.size());
}
项目:xdm    文件:CompositeFileEntryParser.java   
public FTPFile parseFTPEntry(String listEntry) {
   if(this.cachedFtpFileEntryParser != null) {
      FTPFile ftpFileEntryParser = this.cachedFtpFileEntryParser.parseFTPEntry(listEntry);
      if(ftpFileEntryParser != null) {
         return ftpFileEntryParser;
      }
   } else {
      FTPFileEntryParser[] var5 = this.ftpFileEntryParsers;
      int var4 = this.ftpFileEntryParsers.length;

      for(int var3 = 0; var3 < var4; ++var3) {
         FTPFileEntryParser var7 = var5[var3];
         FTPFile matched = var7.parseFTPEntry(listEntry);
         if(matched != null) {
            this.cachedFtpFileEntryParser = var7;
            return matched;
         }
      }
   }

   return null;
}
项目:xdm    文件:FTPClient.java   
private FTPListParseEngine initiateListParsing(FTPFileEntryParser parser, String pathname) throws IOException {
   Socket socket = this._openDataConnection_(26, this.getListArguments(pathname));
   FTPListParseEngine engine = new FTPListParseEngine(parser);
   if(socket == null) {
      return engine;
   } else {
      try {
         engine.readServerList(socket.getInputStream(), this.getControlEncoding());
      } finally {
         Util.closeQuietly(socket);
      }

      this.completePendingCommand();
      return engine;
   }
}
项目:aos-FileCoreLibrary    文件:CompositeFileEntryParser.java   
public CompositeFileEntryParser(FTPFileEntryParser[] ftpFileEntryParsers)
{
    super();

    this.cachedFtpFileEntryParser = null;
    this.ftpFileEntryParsers = ftpFileEntryParsers;
}
项目:aos-FileCoreLibrary    文件:DefaultFTPFileEntryParserFactory.java   
/**
 * Creates an NT FTP parser: if the config exists, and the system key equals
 * {@link FTPClientConfig.SYST_NT} then a plain {@link org.apache.commons.net.ftp.parser.NTFTPEntryParser} is used,
 * otherwise a composite of {@link org.apache.commons.net.ftp.parser.NTFTPEntryParser} and {@link org.apache.commons.net.ftp.parser.UnixFTPEntryParser} is used.
 * @param config the config to use, may be {@code null}
 * @return the parser
 */
private FTPFileEntryParser createNTFTPEntryParser(FTPClientConfig config)
{
    if (config != null && FTPClientConfig.SYST_NT.equals(
            config.getServerSystemKey()))
    {
        return new NTFTPEntryParser(config);
    } else {
        return new CompositeFileEntryParser(new FTPFileEntryParser[]
               {
                   new NTFTPEntryParser(config),
                   new UnixFTPEntryParser(config)
               });
    }
}
项目:aos-FileCoreLibrary    文件:DefaultFTPFileEntryParserFactory.java   
/**
 * Creates an OS400 FTP parser: if the config exists, and the system key equals
 * {@link FTPClientConfig.SYST_OS400} then a plain {@link org.apache.commons.net.ftp.parser.OS400FTPEntryParser} is used,
 * otherwise a composite of {@link org.apache.commons.net.ftp.parser.OS400FTPEntryParser} and {@link org.apache.commons.net.ftp.parser.UnixFTPEntryParser} is used.
 * @param config the config to use, may be {@code null}
 * @return the parser
 */
private FTPFileEntryParser createOS400FTPEntryParser(FTPClientConfig config)
    {
    if (config != null &&
            FTPClientConfig.SYST_OS400.equals(config.getServerSystemKey()))
    {
        return new OS400FTPEntryParser(config);
    } else {
        return new CompositeFileEntryParser(new FTPFileEntryParser[]
            {
                new OS400FTPEntryParser(config),
                new UnixFTPEntryParser(config)
            });
    }
}
项目:cyberduck    文件:CompositeFileEntryParser.java   
@Override
public List<String> preParse(final List<String> original) {
    for(FTPFileEntryParser parser : parsers) {
        parser.preParse(original);
    }
    return original;
}
项目:cyberduck    文件:CompositeFileEntryParser.java   
@Override
public FTPFile parseFTPEntry(final String line) {
    if(log.isDebugEnabled()) {
        log.debug(String.format("Parse %s", line));
    }
    if(current != null) {
        final FTPFile parsed = current.parseFTPEntry(line);
        if(null != parsed) {
            return parsed;
        }
        if(log.isInfoEnabled()) {
            log.info(String.format("Switching parser implementation because %s failed", current));
        }
        current = null;
    }
    for(FTPFileEntryParser parser : parsers) {
        final FTPFile matched = parser.parseFTPEntry(line);
        if(matched != null) {
            current = parser;
            if(log.isInfoEnabled()) {
                log.info(String.format("Caching %s parser implementation", current));
            }
            return matched;
        }
    }
    log.warn(String.format("Failure parsing line %s", line));
    return null;
}
项目:cyberduck    文件:CompositeFileEntryParser.java   
@Override
public void configure(final FTPClientConfig config) {
    for(FTPFileEntryParser parser : parsers) {
        if(parser instanceof Configurable) {
            ((Configurable) parser).configure(config);
        }
    }
}
项目:cyberduck    文件:UnixFTPEntryParserTest.java   
@Test
public void testParseTimestamp() {
    FTPFileEntryParser parser = new FTPParserSelector().getParser("UNIX");

    FTPFile parsed;

    parsed = parser.parseFTPEntry(
            "drw-rw-rw-   1 user      ftp             0  DEC 11 20:56 ADMIN_Documentation");
    assertNotNull(parsed);
    assertNotNull(parsed.getTimestamp());
    assertEquals(Calendar.DECEMBER, parsed.getTimestamp().get(Calendar.MONTH));
    assertEquals(11, parsed.getTimestamp().get(Calendar.DAY_OF_MONTH));
    assertEquals(20, parsed.getTimestamp().get(Calendar.HOUR_OF_DAY));
    assertEquals(56, parsed.getTimestamp().get(Calendar.MINUTE));

    parsed = parser.parseFTPEntry(
            "drwxr-xr-x    3 ftp      ftp           512 Mar 15  2004 doc");
    assertNotNull(parsed);
    assertNotNull(parsed.getTimestamp());
    assertEquals(2004, parsed.getTimestamp().get(Calendar.YEAR));
    assertEquals(Calendar.MARCH, parsed.getTimestamp().get(Calendar.MONTH));
    assertEquals(15, parsed.getTimestamp().get(Calendar.DAY_OF_MONTH));

    parsed = parser.parseFTPEntry(
            "drwxrwxr-x    2 ftp      ftp           512 Oct 23  2007 aurox");
    assertNotNull(parsed);
    assertNotNull(parsed.getTimestamp());
    assertEquals(2007, parsed.getTimestamp().get(Calendar.YEAR));
    assertEquals(Calendar.OCTOBER, parsed.getTimestamp().get(Calendar.MONTH));
    assertEquals(23, parsed.getTimestamp().get(Calendar.DAY_OF_MONTH));
}
项目:cyberduck    文件:UnixFTPEntryParserTest.java   
/**
 * http://trac.cyberduck.ch/ticket/1066
 */
@Test
public void testParseNameWithBeginningWhitespace() {
    FTPFileEntryParser parser = new FTPParserSelector().getParser("UNIX");

    FTPFile parsed;

    parsed = parser.parseFTPEntry(
            "drw-rw-rw-   1 user      ftp             0  Mar 11 20:56  ADMIN_Documentation");
    assertNotNull(parsed);
    assertEquals(" ADMIN_Documentation", parsed.getName());
}
项目:cyberduck    文件:UnixFTPEntryParserTest.java   
/**
 * http://trac.cyberduck.ch/ticket/1118
 */
@Test
public void testParseNameWithEndingWhitespace() {
    FTPFileEntryParser parser = new FTPParserSelector().getParser("UNIX");

    FTPFile parsed;

    parsed = parser.parseFTPEntry(
            "drw-rw-rw-   1 user      ftp             0  Mar 11 20:56 ADMIN_Documentation ");
    assertNotNull(parsed);
    assertEquals("ADMIN_Documentation ", parsed.getName());
}
项目:cyberduck    文件:UnixFTPEntryParserTest.java   
public void testUnknownTimestampFormat() {
    FTPFileEntryParser parser = new FTPParserSelector().getParser("UNIX");

    FTPFile parsed;

    parsed = parser.parseFTPEntry(
            "-rw-rw-rw- 1 hoerspiel hoerspiel  3722053 19. Sep 13:24 Offenbarung 23 - Menschenopfer - 02.mp3"
    );
    assertNotNull(parsed);
    assertEquals(parsed.getName(), "Offenbarung 23 - Menschenopfer - 02.mp3");

    parsed = parser.parseFTPEntry(
            "-rw-rw-rw- 1 hoerspiel hoerspiel 10128531 19. Sep 13:24 Offenbarung 23 - Menschenopfer - 01.mp3"
    );
    assertNotNull(parsed);
    assertEquals(parsed.getName(), "Offenbarung 23 - Menschenopfer - 01.mp3");
    parsed = parser.parseFTPEntry(
            "-rw-rw-rw- 1 hoerspiel hoerspiel 11714687 19. Sep 13:25 Offenbarung 23 - Menschenopfer - 08.mp3"
    );
    assertNotNull(parsed);
    assertEquals(parsed.getName(), "Offenbarung 23 - Menschenopfer - 08.mp3");

    parsed = parser.parseFTPEntry(
            "-rw-r--r--   1 www-data www-data      10089849 Dec 20 09:30 Stone Catalog"
    );
    assertNotNull(parsed);
    assertEquals(parsed.getName(), "Stone Catalog");
    assertEquals(parsed.getUser(), "www-data");
    assertEquals(parsed.getGroup(), "www-data");
    assertEquals(parsed.getSize(), 10089849);

    parsed = parser.parseFTPEntry(
            "-rw-r--r--   1 www-data www-data      34524204 Dec 20 13:41 Winter 2008 Newsletter.sit"
    );
    assertNotNull(parsed);
    assertEquals(parsed.getName(), "Winter 2008 Newsletter.sit");
    assertEquals(parsed.getUser(), "www-data");
    assertEquals(parsed.getGroup(), "www-data");
    assertEquals(parsed.getSize(), 34524204);
}
项目:cyberduck    文件:UnixFTPEntryParserTest.java   
@Test
@Ignore
public void testLeapYear() {
    FTPFileEntryParser parser = new FTPParserSelector().getParser("UNIX");

    FTPFile parsed;

    parsed = parser.parseFTPEntry(
            "drwxr--r--   1 user     group          0 Feb 29 18:14 Downloads"
    );
    assertNotNull(parsed);
    assertNotNull(parsed.getTimestamp());
}
项目:cyberduck    文件:UnixFTPEntryParserTest.java   
@Test
public void testCarriageReturn() {
    FTPFileEntryParser parser = new FTPParserSelector().getParser("UNIX");

    FTPFile parsed;

    // #1521
    parsed = parser.parseFTPEntry(
            "drwxr--r--   1 user     group          0 Feb 29 18:14 Icon\r"
    );
    assertNotNull(parsed);
    assertEquals("Icon\r", parsed.getName());
}
项目:cyberduck    文件:UnixFTPEntryParserTest.java   
@Test
public void testWindowsNTSystem() {
    FTPFileEntryParser parser = new FTPParserSelector().getParser("Windows_NT version 5.0");

    FTPFile parsed;

    // #5505
    parsed = parser.parseFTPEntry(
            "drwxrwxrwx   1 owner    group               0 Dec  5  0:45 adele.handmadebyflloyd.com"
    );
    assertNotNull(parsed);
    assertEquals("adele.handmadebyflloyd.com", parsed.getName());
    assertEquals("owner", parsed.getUser());
    assertEquals("group", parsed.getGroup());
    assertNotNull(parsed.getTimestamp());
    assertEquals(Calendar.DECEMBER, parsed.getTimestamp().get(Calendar.MONTH));
    assertEquals(5, parsed.getTimestamp().get(Calendar.DAY_OF_MONTH));

    // #5505
    parsed = parser.parseFTPEntry(
            "drwxrwxrwx   1 owner    group               0 Jan 22  2009 contact"
    );
    assertNotNull(parsed);
    assertEquals("contact", parsed.getName());
    assertEquals("owner", parsed.getUser());
    assertEquals("group", parsed.getGroup());
    assertNotNull(parsed.getTimestamp());
    assertEquals(Calendar.JANUARY, parsed.getTimestamp().get(Calendar.MONTH));
    assertEquals(22, parsed.getTimestamp().get(Calendar.DAY_OF_MONTH));
    assertEquals(2009, parsed.getTimestamp().get(Calendar.YEAR));
}
项目:xdman    文件:CompositeFileEntryParser.java   
public CompositeFileEntryParser(FTPFileEntryParser[] ftpFileEntryParsers)
{
    super();

    this.cachedFtpFileEntryParser = null;
    this.ftpFileEntryParsers = ftpFileEntryParsers;
}
项目:xdman    文件:DefaultFTPFileEntryParserFactory.java   
/**
 * Creates an NT FTP parser: if the config exists, and the system key equals
 * {@link FTPClientConfig.SYST_NT} then a plain {@link NTFTPEntryParser} is used,
 * otherwise a composite of {@link NTFTPEntryParser} and {@link UnixFTPEntryParser} is used.
 * @param config the config to use, may be {@code null}
 * @return the parser
 */
private FTPFileEntryParser createNTFTPEntryParser(FTPClientConfig config)
{
    if (config != null && FTPClientConfig.SYST_NT.equals(
            config.getServerSystemKey()))
    {
        return new NTFTPEntryParser(config);
    } else {
        return new CompositeFileEntryParser(new FTPFileEntryParser[]
               {
                   new NTFTPEntryParser(config),
                   new UnixFTPEntryParser(config)
               });
    }
}
项目:xdman    文件:DefaultFTPFileEntryParserFactory.java   
/**
 * Creates an OS400 FTP parser: if the config exists, and the system key equals
 * {@link FTPClientConfig.SYST_OS400} then a plain {@link OS400FTPEntryParser} is used,
 * otherwise a composite of {@link OS400FTPEntryParser} and {@link UnixFTPEntryParser} is used.
 * @param config the config to use, may be {@code null}
 * @return the parser
 */
private FTPFileEntryParser createOS400FTPEntryParser(FTPClientConfig config)
    {
    if (config != null &&
            FTPClientConfig.SYST_OS400.equals(config.getServerSystemKey()))
    {
        return new OS400FTPEntryParser(config);
    } else {
        return new CompositeFileEntryParser(new FTPFileEntryParser[]
            {
                new OS400FTPEntryParser(config),
                new UnixFTPEntryParser(config)
            });
    }
}
项目:xdm    文件:DefaultFTPFileEntryParserFactory.java   
public FTPFileEntryParser createFileEntryParser(String key) {
   if(key == null) {
      throw new ParserInitializationException("Parser key cannot be null");
   } else {
      return this.createFileEntryParser(key, (FTPClientConfig)null);
   }
}
项目:Aria    文件:DefaultFTPFileEntryParserFactory.java   
/**
 * Creates an NT FTP parser: if the config exists, and the system key equals
 * {@link FTPClientConfig.SYST_NT} then a plain {@link NTFTPEntryParser} is used,
 * otherwise a composite of {@link NTFTPEntryParser} and {@link UnixFTPEntryParser} is used.
 *
 * @param config the config to use, may be {@code null}
 * @return the parser
 */
private FTPFileEntryParser createNTFTPEntryParser(FTPClientConfig config) {
  if (config != null && FTPClientConfig.SYST_NT.equals(config.getServerSystemKey())) {
    return new NTFTPEntryParser(config);
  } else {
    // clone the config as it may be changed by the parsers (NET-602)
    final FTPClientConfig config2 = (config != null) ? new FTPClientConfig(config) : null;
    return new CompositeFileEntryParser(new FTPFileEntryParser[] {
        new NTFTPEntryParser(config), new UnixFTPEntryParser(config2,
        config2 != null && FTPClientConfig.SYST_UNIX_TRIM_LEADING.equals(
            config2.getServerSystemKey()))
    });
  }
}
项目:Aria    文件:DefaultFTPFileEntryParserFactory.java   
/**
 * Creates an OS400 FTP parser: if the config exists, and the system key equals
 * {@link FTPClientConfig.SYST_OS400} then a plain {@link OS400FTPEntryParser} is used,
 * otherwise a composite of {@link OS400FTPEntryParser} and {@link UnixFTPEntryParser} is used.
 *
 * @param config the config to use, may be {@code null}
 * @return the parser
 */
private FTPFileEntryParser createOS400FTPEntryParser(FTPClientConfig config) {
  if (config != null && FTPClientConfig.SYST_OS400.equals(config.getServerSystemKey())) {
    return new OS400FTPEntryParser(config);
  } else {
    // clone the config as it may be changed by the parsers (NET-602)
    final FTPClientConfig config2 = (config != null) ? new FTPClientConfig(config) : null;
    return new CompositeFileEntryParser(new FTPFileEntryParser[] {
        new OS400FTPEntryParser(config), new UnixFTPEntryParser(config2,
        config2 != null && FTPClientConfig.SYST_UNIX_TRIM_LEADING.equals(
            config2.getServerSystemKey()))
    });
  }
}
项目:Camel    文件:OsgiParserFactory.java   
@Override
public FTPFileEntryParser createFileEntryParser(String key) {
    if (key == null) {
        throw new ParserInitializationException("Parser key cannot be null");
    }
    return createFileEntryParser(key, null);
}
项目:Camel    文件:OsgiParserFactory.java   
/**
 * Creates an NT FTP parser: if the config exists, and the system key equals
 * {@link FTPClientConfig#SYST_NT} then a plain {@link NTFTPEntryParser} is used,
 * otherwise a composite of {@link NTFTPEntryParser} and {@link UnixFTPEntryParser} is used.
 * @param config the config to use, may be {@code null}
 * @return the parser
 */
private FTPFileEntryParser createNTFTPEntryParser(FTPClientConfig config) {
    if (config != null && FTPClientConfig.SYST_NT.equals(
            config.getServerSystemKey())) {
        return new NTFTPEntryParser(config);
    } else {
        return new CompositeFileEntryParser(new FTPFileEntryParser[] {
            new NTFTPEntryParser(config),
            new UnixFTPEntryParser(config)
        });
    }
}
项目:Camel    文件:OsgiParserFactory.java   
/**
 * Creates an OS400 FTP parser: if the config exists, and the system key equals
 * {@link FTPClientConfig#SYST_OS400} then a plain {@link OS400FTPEntryParser} is used,
 * otherwise a composite of {@link OS400FTPEntryParser} and {@link UnixFTPEntryParser} is used.
 * @param config the config to use, may be {@code null}
 * @return the parser
 */
private FTPFileEntryParser createOS400FTPEntryParser(FTPClientConfig config) {
    if (config != null
        && FTPClientConfig.SYST_OS400.equals(config.getServerSystemKey())) {
        return new OS400FTPEntryParser(config);
    } else {
        return new CompositeFileEntryParser(new FTPFileEntryParser[] {
            new OS400FTPEntryParser(config),
            new UnixFTPEntryParser(config)
        });
    }
}
项目:aos-FileCoreLibrary    文件:DefaultFTPFileEntryParserFactory.java   
public FTPFileEntryParser createUnixFTPEntryParser()
{
    return new UnixFTPEntryParser();
}
项目:aos-FileCoreLibrary    文件:DefaultFTPFileEntryParserFactory.java   
public FTPFileEntryParser createVMSVersioningFTPEntryParser()
{
    return new VMSVersioningFTPEntryParser();
}
项目:aos-FileCoreLibrary    文件:DefaultFTPFileEntryParserFactory.java   
public FTPFileEntryParser createNetwareFTPEntryParser() {
    return new NetwareFTPEntryParser();
}
项目:aos-FileCoreLibrary    文件:DefaultFTPFileEntryParserFactory.java   
public FTPFileEntryParser createNTFTPEntryParser()
{
    return createNTFTPEntryParser(null);
}
项目:aos-FileCoreLibrary    文件:DefaultFTPFileEntryParserFactory.java   
public FTPFileEntryParser createOS2FTPEntryParser()
{
    return new OS2FTPEntryParser();
}