This was our culminating project for an Introduction to Computer Science class at Bucknell University. It uses Java to launch a GUI that connects to an FTP server and allows a user to search for and download files on the server.
- Run GUI.java in eclipse or compile and run on the command line. A window will appear with fields to input login credentials.
- Click the 'Connect' button, and a dialog box will indicate that a connection has been established.
- Search for a filename in the search box and click the Search button.
- If multiple files are found with the same filename, a numbered list showing the filename and absolute path will appear. Choose which file number to download in the dropdown and click the 'Download' button.
- If the filename and path are known, it may be input in the bottom text box and downloaded via the 'Download' button, forgoing the search process.
- After the 'Download' button is clicked, a chooser will appear to designate the save location and name of the file to be downloaded.
- To terminate the connection with the server, click the 'Logoff' button. A dialog box will indicate that the logoff was successful.
There are three main components of this program:
FTPConn
- Handles all integration with the server. This class obtains information about the server's contents, file information, and is used to download files.
Parser
- Retrieves an
ArrayList
ofString
s fromFTPConn
, containing every file and directory path, and creates anArrayList
ofFileObject
s to be sent to theTree
.
Tree
- Reads the
Parser
s output and generates a tree ofFileObject
s. This is used to search the server's contents efficiently. When a search is performed, anArrayList
ofFileObject
s are sent to theGUI
, and the chosenFileObject
is sent to the download method of theFTPConn
.
Each class is tested with the JUnit framework.
After a connection to a server has been established, the program recursively iterates through all of the directories on the server and generates a Tree, containing FileObject
s. A FileObject
contains the file name, path, and a boolean flag that indicates if it is a directory.