1
// -*- indent-tabs-mode: nil -*-
7
#include <arc/StringConv.h>
8
#include <arc/data/DataBuffer.h>
9
#include <arc/data/DataHandle.h>
11
#include "JobListRetrieverPluginARC1.h"
15
Logger JobListRetrieverPluginARC1::logger(Logger::getRootLogger(), "JobListRetrieverPlugin.WSRFGLUE2");
17
bool JobListRetrieverPluginARC1::isEndpointNotSupported(const Endpoint& endpoint) const {
18
const std::string::size_type pos = endpoint.URLString.find("://");
19
if (pos != std::string::npos) {
20
const std::string proto = lower(endpoint.URLString.substr(0, pos));
21
return ((proto != "http") && (proto != "https"));
27
static URL CreateURL(std::string service) {
28
std::string::size_type pos1 = service.find("://");
29
if (pos1 == std::string::npos) {
30
service = "https://" + service;
32
std::string proto = lower(service.substr(0,pos1));
33
if((proto != "http") && (proto != "https")) return URL();
35
// Default port other than 443?
41
EndpointQueryingStatus JobListRetrieverPluginARC1::Query(const UserConfig& uc, const Endpoint& endpoint, std::list<Job>& jobs, const EndpointQueryOptions<Job>&) const {
42
EndpointQueryingStatus s(EndpointQueryingStatus::FAILED);
44
URL url(CreateURL(endpoint.URLString));
49
logger.msg(DEBUG, "Collecting Job (A-REX jobs) information.");
51
DataHandle dir_url(url, uc);
53
logger.msg(INFO, "Failed retrieving job IDs: Unsupported url (%s) given", url.str());
57
dir_url->SetSecure(false);
58
std::list<FileInfo> files;
59
if (!dir_url->List(files, DataPoint::INFO_TYPE_NAME)) {
61
logger.msg(INFO, "Failed retrieving job IDs");
64
logger.msg(VERBOSE, "Error encoutered during job ID retrieval. All job IDs might not have been retrieved");
67
for (std::list<FileInfo>::const_iterator file = files.begin();
68
file != files.end(); file++) {
71
j.JobID.ChangePath(j.JobID.Path() + "/" + file->GetName());
72
j.InterfaceName = "org.nordugrid.xbes";
73
j.IDFromEndpoint = "<ActivityIdentifier><Address>" + url.fullstr() + "</Address></ActivityIdentifier>";
78
s = EndpointQueryingStatus::SUCCESSFUL;