commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwins...@apache.org
Subject svn commit: r678940 - in /commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp: FTPClientConfig.java parser/DefaultFTPFileEntryParserFactory.java
Date Tue, 22 Jul 2008 23:13:30 GMT
Author: rwinston
Date: Tue Jul 22 16:13:30 2008
New Revision: 678940

URL: http://svn.apache.org/viewvc?rev=678940&view=rev
Log:
Add AS/400 identifier

Modified:
    commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPClientConfig.java
    commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/parser/DefaultFTPFileEntryParserFactory.java

Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPClientConfig.java
URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPClientConfig.java?rev=678940&r1=678939&r2=678940&view=diff
==============================================================================
--- commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPClientConfig.java
(original)
+++ commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/FTPClientConfig.java
Tue Jul 22 16:13:30 2008
@@ -173,6 +173,12 @@
     public static final String SYST_OS400 = "OS/400";
     
     /**
+     * Identifier by which an AS/400-based ftp server is known throughout
+     * the commons-net ftp system.
+     */
+    public static final String SYST_AS400 = "AS/400";
+    
+    /**
      * Identifier by which an MVS-based ftp server is known throughout
      * the commons-net ftp system.
      */

Modified: commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/parser/DefaultFTPFileEntryParserFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/parser/DefaultFTPFileEntryParserFactory.java?rev=678940&r1=678939&r2=678940&view=diff
==============================================================================
--- commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/parser/DefaultFTPFileEntryParserFactory.java
(original)
+++ commons/proper/net/branches/NET_2_0/src/main/java/org/apache/commons/net/ftp/parser/DefaultFTPFileEntryParserFactory.java
Tue Jul 22 16:13:30 2008
@@ -35,9 +35,9 @@
 public class DefaultFTPFileEntryParserFactory
     implements FTPFileEntryParserFactory
 {
-    private FTPClientConfig config = null;
+	private FTPClientConfig config = null;
 
-    /**
+	/**
      * This default implementation of the FTPFileEntryParserFactory
      * interface works according to the following logic:
      * First it attempts to interpret the supplied key as a fully
@@ -78,9 +78,9 @@
      */
     public FTPFileEntryParser createFileEntryParser(String key)
     {
-        if (key == null)
-            throw new ParserInitializationException("Parser key cannot be null");
-            
+    	if (key == null)
+    		throw new ParserInitializationException("Parser key cannot be null");
+    		
         Class<?> parserClass = null;
         FTPFileEntryParser parser = null;
         try
@@ -92,44 +92,45 @@
         {
             try 
             {
-                String ukey = null;
-                if (null != key)
-                {
-                    ukey = key.toUpperCase(java.util.Locale.ENGLISH);
-                }
-                if ((ukey.indexOf(FTPClientConfig.SYST_UNIX) >= 0) 
-                        || (ukey.indexOf(FTPClientConfig.SYST_L8) >= 0))
-                {
-                    parser = createUnixFTPEntryParser();
-                }
-                else if (ukey.indexOf(FTPClientConfig.SYST_VMS) >= 0)
-                {
-                    parser = createVMSVersioningFTPEntryParser();
-                }
-                else if (ukey.indexOf(FTPClientConfig.SYST_NT) >= 0)
-                {
-                    parser = createNTFTPEntryParser();
-                }
-                else if (ukey.indexOf(FTPClientConfig.SYST_OS2) >= 0)
-                {
-                    parser = createOS2FTPEntryParser();
-                }
-                else if (ukey.indexOf(FTPClientConfig.SYST_OS400) >= 0)
-                {
-                    parser = createOS400FTPEntryParser();
-                }
-                else if (ukey.indexOf(FTPClientConfig.SYST_MVS) >= 0)
-                {
-                    parser = createMVSEntryParser();
-                }
-                else if (ukey.indexOf(FTPClientConfig.SYST_NETWARE) >= 0) 
-                {
-                    parser = createNetwareFTPEntryParser();
-                }
-                else
-                {
-                    throw new ParserInitializationException("Unknown parser type: " + key);
-                }
+	            String ukey = null;
+	            if (null != key)
+	            {
+	                ukey = key.toUpperCase(java.util.Locale.ENGLISH);
+	            }
+	            if ((ukey.indexOf(FTPClientConfig.SYST_UNIX) >= 0) 
+	            		|| (ukey.indexOf(FTPClientConfig.SYST_L8) >= 0))
+	            {
+	                parser = createUnixFTPEntryParser();
+	            }
+	            else if (ukey.indexOf(FTPClientConfig.SYST_VMS) >= 0)
+	            {
+	                parser = createVMSVersioningFTPEntryParser();
+	            }
+	            else if (ukey.indexOf(FTPClientConfig.SYST_NT) >= 0)
+	            {
+	                parser = createNTFTPEntryParser();
+	            }
+	            else if (ukey.indexOf(FTPClientConfig.SYST_OS2) >= 0)
+	            {
+	                parser = createOS2FTPEntryParser();
+	            }
+	            else if (ukey.indexOf(FTPClientConfig.SYST_OS400) >= 0 ||
+	            		ukey.indexOf(FTPClientConfig.SYST_AS400) >= 0)
+	            {
+	                parser = createOS400FTPEntryParser();
+	            }
+	            else if (ukey.indexOf(FTPClientConfig.SYST_MVS) >= 0)
+	            {
+	                parser = createMVSEntryParser();
+	        	}
+	            else if (ukey.indexOf(FTPClientConfig.SYST_NETWARE) >= 0) 
+	            {
+	            	parser = createNetwareFTPEntryParser();
+	            }
+	            else
+	            {
+	                throw new ParserInitializationException("Unknown parser type: " + key);
+	            }
             } 
             catch (NoClassDefFoundError nf) {
                     throw new ParserInitializationException("Error initializing parser",
nf);
@@ -137,7 +138,7 @@
 
         }
         catch (NoClassDefFoundError e)
-        {
+        { 	
             throw new ParserInitializationException("Error initializing parser", e);
         }
         catch (ClassCastException e)
@@ -177,13 +178,13 @@
      *                   Thrown on any exception in instantiation
      * @since 1.4
      */
-    public FTPFileEntryParser createFileEntryParser(FTPClientConfig config) 
-    throws ParserInitializationException 
-    {
-        this.config = config;
-        String key = config.getServerSystemKey();
-        return createFileEntryParser(key);
-    }
+	public FTPFileEntryParser createFileEntryParser(FTPClientConfig config) 
+	throws ParserInitializationException 
+	{
+	    this.config = config;
+		String key = config.getServerSystemKey();
+		return createFileEntryParser(key);
+	}
 
 
     public FTPFileEntryParser createUnixFTPEntryParser()
@@ -196,26 +197,23 @@
         return new VMSVersioningFTPEntryParser();
     }
     
-    /**
-     * @since 1.5
-     */
     public FTPFileEntryParser createNetwareFTPEntryParser() {
-        return new NetwareFTPEntryParser();
+    	return new NetwareFTPEntryParser();
     }
 
     public FTPFileEntryParser createNTFTPEntryParser()
     {
-        if (config != null && FTPClientConfig.SYST_NT.equals(
-                config.getServerSystemKey())) 
-        {
+    	if (config != null && FTPClientConfig.SYST_NT.equals(
+    	        config.getServerSystemKey())) 
+    	{
             return new NTFTPEntryParser();
-        } else {
+    	} else {
             return new CompositeFileEntryParser(new FTPFileEntryParser[]
-                {
-                    new NTFTPEntryParser(),
-                    new UnixFTPEntryParser()
-                });
-        }
+	   	        {
+	   	            new NTFTPEntryParser(),
+	   	            new UnixFTPEntryParser()
+	   	        });
+    	}
     }
     
      public FTPFileEntryParser createOS2FTPEntryParser()
@@ -225,17 +223,17 @@
 
     public FTPFileEntryParser createOS400FTPEntryParser()
     {
-        if (config != null && 
-                FTPClientConfig.SYST_OS400.equals(config.getServerSystemKey())) 
-        {
+    	if (config != null && 
+    	        FTPClientConfig.SYST_OS400.equals(config.getServerSystemKey())) 
+    	{
             return new OS400FTPEntryParser();
-        } else {
-            return new CompositeFileEntryParser(new FTPFileEntryParser[]
-                {
-                    new OS400FTPEntryParser(),
-                    new UnixFTPEntryParser()
-                });
-        }
+    	} else {
+	        return new CompositeFileEntryParser(new FTPFileEntryParser[]
+	            {
+	                new OS400FTPEntryParser(),
+	                new UnixFTPEntryParser()
+	            });
+    	}
     }
 
     public FTPFileEntryParser createMVSEntryParser()
@@ -244,6 +242,6 @@
     }
 
 
-    
+	
 }
 



Mime
View raw message