Skip to content

File Browser for commands API

Created by: osbornjd

Summary

This PR introduces a file browsing API within the Commands API, in reference to issue 413. The FileBrowser is designed to work in hand with the IFileHandler class. Tests are introduced that build a directory/file structure underneath a new directory, and then look for and confirm that the FileBrowser returns the files/directories that are created (depending on the test).

Design

A FileBrowser interface is introduced, from which a local and remote FileBrowser implement from. These subclasses contain the logic for the file browsing API on the local or remote host. They are called from the FileHandler like the other abstract IFileHandler classes, for example, supposing you have an object handler of type FileHandler

ArrayList<String> files = handler.listFiles("/some/top/directory");

The function returns a vector of strings containing the paths of all of the files below the given directory. Similarly, one could ask for the directories by calling

ArrayList<String> directories = handler.listDirectories("/some/top/directory");

to be given the directories underneath the given top directory.

Merge request reports

Loading