Mantid
|
This class is for searching the ISIS data archive. More...
#include <ISISDataArchive.h>
Public Member Functions | |
std::string | getArchivePath (const std::set< std::string > &filenames, const std::vector< std::string > &exts) const override |
Returns the path to a filename given the list of extensions to try. More... | |
virtual std::string | getCorrectExtension (const std::string &path, const std::vector< std::string > &exts) const |
Public and virtual for testing purposes. More... | |
std::string | getPath (const std::string &fName) const |
Gets the path to the file, or most recent set of files. More... | |
Public Member Functions inherited from Mantid::API::IArchiveSearch | |
virtual std::string | getArchivePath (const std::set< std::string > &filenames, const std::vector< std::string > &exts) const =0 |
Return the full path to a data file in an archive. More... | |
virtual | ~IArchiveSearch ()=default |
Virtual destructor. More... | |
Protected Member Functions | |
virtual bool | fileExists (const std::string &path) const |
Checks if the given file path exists or not. More... | |
virtual std::ostringstream | sendRequest (const std::string &fName) const |
Queries the archive & returns the path to a single file. More... | |
This class is for searching the ISIS data archive.
Definition at line 27 of file ISISDataArchive.h.
|
protectedvirtual |
Checks if the given file path exists or not.
This code is in a separate function so it can be mocked out in testing.
path | :: The path to the file (including extension) |
Definition at line 126 of file ISISDataArchive.cpp.
References Mantid::DataHandling::exists().
Referenced by getCorrectExtension().
|
overridevirtual |
Returns the path to a filename given the list of extensions to try.
Query the ISIS archive for a set of filenames and vector of extensions.
The method gets a path to each of the filenames, and then loops over the extensions to find the correct file.
filenames | :: A set of filenames without extensions |
exts | :: A vector of file extensions to search over. |
Implements Mantid::API::IArchiveSearch.
Definition at line 44 of file ISISDataArchive.cpp.
References Mantid::Kernel::Logger::debug(), Mantid::API::g_log, getCorrectExtension(), getPath(), and Mantid::Kernel::Logger::is().
|
virtual |
Public and virtual for testing purposes.
Given a path to a file, this searches over possible extensions to find the full path.
Only returns a full path string if the file exists.
path | :: The path to the file without an extension. |
exts | :: vector of possible file extensions to search over. |
Definition at line 110 of file ISISDataArchive.cpp.
References fileExists().
Referenced by getArchivePath().
std::string Mantid::DataHandling::ISISDataArchive::getPath | ( | const std::string & | fName | ) | const |
Gets the path to the file, or most recent set of files.
fName | :: The file name. |
Definition at line 71 of file ISISDataArchive.cpp.
References Mantid::Kernel::Logger::debug(), Mantid::API::g_log, and sendRequest().
Referenced by getArchivePath().
|
protectedvirtual |
Queries the archive & returns the path to a single file.
Calls a web service to get a path to a file.
If the file does not exist, returns path to most recent run. The ISIS web service return a path independent of the file extension of the file provided. Thus the call to web service uses a file WITHOUT an extension.
fName | :: The file name. |
Definition at line 90 of file ISISDataArchive.cpp.
References Mantid::API::g_log, Mantid::Kernel::InternetHelper::sendRequest(), Mantid::Kernel::Logger::warning(), and Mantid::Kernel::Exception::InternetError::what().
Referenced by getPath().