16#include <Poco/Exception.h>
23Kernel::Logger
g_log(
"ISISDataArchive");
30const char *URL_PREFIX =
"http://data.isis.rl.ac.uk/where.py/windir?name=";
32const char *URL_PREFIX =
"http://data.isis.rl.ac.uk/where.py/unixdir?name=";
45 const std::vector<std::string> &exts)
const {
46 if (
g_log.
is(Kernel::Logger::Priority::PRIO_DEBUG)) {
47 for (
const auto &filename : filenames) {
50 for (
const auto &ext : exts) {
55 for (
const auto &filename : filenames) {
56 const std::string path_without_extension =
getPath(filename);
57 if (!path_without_extension.empty()) {
59 if (!fullPath.empty())
72 g_log.
debug() <<
"ISISDataArchive::getPath() - fName=" << fName <<
"\n";
77 os << Poco::Path::separator() << fName;
78 const std::string expectedPath = os.str();
92 std::ostringstream os;
111 for (
const auto &ext : exts) {
112 std::string temp_path = path + ext;
128 if (Poco::File(path).
exists())
130 }
catch (Poco::Exception &) {
#define DECLARE_ARCHIVESEARCH(classname, facility)
std::string getPath(const std::string &fName) const
Gets the path to the file, or most recent set of files.
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.
virtual std::string getCorrectExtension(const std::string &path, const std::vector< std::string > &exts) const
Public and virtual for testing purposes.
virtual bool fileExists(const std::string &path) const
Checks if the given file path exists or not.
virtual std::ostringstream sendRequest(const std::string &fName) const
Queries the archive & returns the path to a single file.
Exception thrown when error occurs accessing an internet resource.
const char * what() const noexcept override
Overloaded reporting method.
InternetHelper : A helper class for supporting access to resources through HTTP and HTTPS.
virtual HTTPStatus sendRequest(const std::string &url, std::ostream &responseStream)
Performs a request using http or https depending on the url.
void debug(const std::string &msg)
Logs at debug level.
void warning(const std::string &msg)
Logs at warning level.
bool is(int level) const
Returns true if at least the given log level is set.
Kernel::Logger g_log("ExperimentInfo")
static logger object
bool exists(::NeXus::File &file, const std::string &name)
Based on the current group in the file, does the named sub-entry exist?