From: tcofoegbu Date: Wed, 27 May 2015 17:01:16 +0000 (+0100) Subject: Removed redundant classes and dependencies pulled in from last merge of features... X-Git-Tag: Release_2_10_0~656 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=ca4e251a5e7dfb71109a8328d60bb237a6ce9944;p=jalview.git Removed redundant classes and dependencies pulled in from last merge of features/JAL-1740_Decoup-BioJS branch --- diff --git a/.classpath b/.classpath index 442795d..b7c26a4 100644 --- a/.classpath +++ b/.classpath @@ -66,6 +66,5 @@ - diff --git a/lib/commons-net-3.3.jar b/lib/commons-net-3.3.jar deleted file mode 100644 index f4f19a9..0000000 Binary files a/lib/commons-net-3.3.jar and /dev/null differ diff --git a/src/jalview/ftp/FtpClient.java b/src/jalview/ftp/FtpClient.java deleted file mode 100644 index 8c9b3e1..0000000 --- a/src/jalview/ftp/FtpClient.java +++ /dev/null @@ -1,134 +0,0 @@ -package jalview.ftp; - -import java.io.BufferedOutputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.net.SocketException; - -import org.apache.commons.net.ftp.FTPClient; -import org.apache.commons.net.ftp.FTPFile; - -public class FtpClient -{ - - public static boolean authenticateUser(FTPClient ftpClient, - String username, String password) - { - boolean loggedIn = false; - - try - { - loggedIn = ftpClient.login(username, password); - } catch (IOException e) - { - e.printStackTrace(); - } - disconectFTP(ftpClient); - - return loggedIn; - } - - public static FTPClient getFtpClient(String serverHost) - { - FTPClient ftpClient = new FTPClient(); - try - { - ftpClient.connect(serverHost); - } catch (SocketException e) - { - e.printStackTrace(); - } catch (IOException e) - { - e.printStackTrace(); - } - return ftpClient; - } - - public static void disconectFTP(FTPClient ftpClient) - { - try - { - if (ftpClient.isConnected()) - { - ftpClient.logout(); - ftpClient.disconnect(); - } - } catch (IOException e) - { - e.printStackTrace(); - } - } - - public static void listDirectory(FTPClient ftpClient, String parentDir, - String currentDir, int level) throws IOException - { - String dirToList = parentDir; - if (!currentDir.equals("")) - { - dirToList += "/" + currentDir; - } - FTPFile[] subFiles = ftpClient.listFiles(dirToList); - if (subFiles != null && subFiles.length > 0) - { - for (FTPFile aFile : subFiles) - { - String currentFileName = aFile.getName(); - if (currentFileName.equals(".") || currentFileName.equals("..")) - { - // skip parent directory and directory itself - continue; - } - for (int i = 0; i < level; i++) - { - System.out.print("\t"); - } - if (aFile.isDirectory()) - { - System.out.println("[" + currentFileName + "]"); - listDirectory(ftpClient, dirToList, currentFileName, level + 1); - } - else - { - System.out.println(currentFileName); - } - } - } - } - - public static boolean downloadFile(FTPClient client, String remoteFile, - String local) - { - boolean success = false; - File downloadFile = new File(local); - OutputStream outputStream = null; - try - { - outputStream = new BufferedOutputStream(new FileOutputStream( - downloadFile)); - - success = client.retrieveFile(remoteFile, outputStream); - } catch (IOException e) - { - e.printStackTrace(); - } finally - { - try - { - if (outputStream != null) - { - outputStream.close(); - } - } catch (IOException e) - { - e.printStackTrace(); - } - } - if (success) - { - System.out.println(remoteFile + " has been downloaded successfully."); - } - return success; - } -}