agave-systems/systems-core/src/main/java/org/iplantc/service/transfer/ftp/FTP2.java
/**
	 * Uses legacy list command with file filter to get a directory listing
	 * 
	 * @param resolvedPath absolute path to file or folder on the system
	 * @return
	 * @throws RemoteDataException
	 * @throws IOException
	 */
Uses legacy list command with file filter to get a directory listing

@param resolvedPath absolute path to file or folder on the system
@return
@throws RemoteDataException
@throws IOException
Uses legacy list command with file filter to get a directory listing @param resolvedPath absolute path to file or folder on the system @return @throws RemoteDataException @throws IOException
private List<RemoteFileInfo> doLegacyLs(String resolvedPath) 
	throws RemoteDataException, IOException
	{
		List<RemoteFileInfo> listing = new ArrayList<RemoteFileInfo>();
		BufferedReader reader = null;
		try 
		{
			changeDir(resolvedPath);
			ByteArrayDataSink sink = new ByteArrayDataSink();
			if (isWindowsSystem()) {
				list("*", "-a", sink);
			} else {
				list("*", "-d", sink);
			}
	        ByteArrayOutputStream received = sink.getData();
	        reader = new BufferedReader(new StringReader(received.toString()));
	        String line = null;
	        while ((line = reader.readLine()) != null) {
	            line = line.trim();
	            if(line.equals(""))
	            {
	                continue;
	            }
	            if (line.startsWith("total"))
	                continue;
	            RemoteFileInfo childInfo = new RemoteFileInfo(line);
				if (!StringUtils.equals(childInfo.getName(), ".") && 
						!StringUtils.equals(childInfo.getName(), FilenameUtils.getName(StringUtils.removeEnd(resolvedPath, "/")))) 
				{
		            fileInfoCache.put(resolvedPath + "/" + childInfo.getName(), childInfo);
		            listing.add(childInfo);
				}
	        }
		} 
		catch (IOException e) {
			throw e;
		}
		catch (RemoteDataException e) {
			throw e;
		}
		catch (Exception e) {
		    if (e.getMessage().contains("425 No data connection")) {
                throw new RemoteConnectionException("Connection closed by server during listing. Resetting transfer.", e);
            }
            else {
                throw new RemoteDataException("Failed to obtain directory listing from remote system.", e);
            }
		} 
		finally {
			try {changeDir(resolvePath(""));} catch (Exception e) {}
			try {reader.close();} catch (Exception e) {}
		}
        return listing;
	}
private List < RemoteFileInfo > doLegacyLs ( String resolvedPath ) throws RemoteDataException , IOException { List < RemoteFileInfo > listing = new ArrayList < RemoteFileInfo > ( ) ; BufferedReader reader = null ; try { changeDir ( resolvedPath ) ; ByteArrayDataSink sink = new ByteArrayDataSink ( ) ; if ( isWindowsSystem ( ) ) { list ( "*" , "-a" , sink ) ; } else { list ( "*" , "-d" , sink ) ; } ByteArrayOutputStream received = sink . getData ( ) ; reader = new BufferedReader ( new StringReader ( received . toString ( ) ) ) ; String line = null ; while ( ( line = reader . readLine ( ) ) != null ) { line = line . trim ( ) ; if ( line . equals ( "" ) ) { continue ; } if ( line . startsWith ( "total" ) ) continue ; RemoteFileInfo childInfo = new RemoteFileInfo ( line ) ; if ( ! StringUtils . equals ( childInfo . getName ( ) , "." ) && ! StringUtils . equals ( childInfo . getName ( ) , FilenameUtils . getName ( StringUtils . removeEnd ( resolvedPath , "/" ) ) ) ) { fileInfoCache . put ( resolvedPath + "/" + childInfo . getName ( ) , childInfo ) ; listing . add ( childInfo ) ; } } } catch ( IOException e ) { throw e ; } catch ( RemoteDataException e ) { throw e ; } catch ( Exception e ) { if ( e . getMessage ( ) . contains ( "425 No data connection" ) ) { throw new RemoteConnectionException ( "Connection closed by server during listing. Resetting transfer." , e ) ; } else { throw new RemoteDataException ( "Failed to obtain directory listing from remote system." , e ) ; } } finally { try { changeDir ( resolvePath ( "" ) ) ; } catch ( Exception e ) { } try { reader . close ( ) ; } catch ( Exception e ) { } } return listing ; }
Uses legacy list command with file filter to get a directory listing
Uses legacy list command with file filter to get a directory listing
// transfer done. Data is in received stream. // convert it to a vector. // add to cache since this file may have changed