ARC SDK
Endpoint.h
1 #ifndef __ARC_ENDPOINT_H__
2 #define __ARC_ENDPOINT_H__
3 
4 #include <string>
5 #include <set>
6 #include <algorithm>
7 #include <map>
8 
9 #include <arc/URL.h>
10 #include <arc/compute/EndpointQueryingStatus.h>
11 
12 namespace Arc {
13 
14 class ConfigEndpoint;
15 class ExecutionTarget;
16 class Endpoint;
17 class EndpointQueryingStatus;
18 class ComputingEndpointAttributes;
19 
21 
26 typedef bool (*EndpointCompareFn)(const Endpoint&, const Endpoint&);
27 
29 
38 class EndpointStatusMap : public std::map<Endpoint, EndpointQueryingStatus, EndpointCompareFn> {
39 public:
46  ~EndpointStatusMap() {}
47 };
48 
50 
68 class Endpoint {
69 public:
81 
89  };
90 
92 
97  if (cap == Endpoint::REGISTRY) return "information.discovery.registry";
98  if (cap == Endpoint::COMPUTINGINFO) return "information.discovery.resource";
99  if (cap == Endpoint::JOBLIST) return "information.discovery.resource";
100  if (cap == Endpoint::JOBSUBMIT) return "executionmanagement.jobexecution";
101  if (cap == Endpoint::JOBCREATION) return "executionmanagement.jobcreation";
102  if (cap == Endpoint::JOBMANAGEMENT) return "executionmanagement.jobmanager";
103  return "";
104  }
105 
107 
113  Endpoint(const std::string& URLString = "",
114  const std::set<std::string>& Capability = std::set<std::string>(),
115  const std::string& InterfaceName = "")
117 
119 
124  Endpoint(const std::string& URLString,
125  const Endpoint::CapabilityEnum cap,
126  const std::string& InterfaceName = "")
127  : URLString(URLString), InterfaceName(InterfaceName), Capability() { Capability.insert(GetStringForCapability(cap)); }
128 
130 
136  Endpoint(const ExecutionTarget& e, const std::string& rsi = "");
137 
139 
145  Endpoint(const ComputingEndpointAttributes& cea, const std::string& rsi = "");
146 
148 
158  Endpoint(const ConfigEndpoint& endpoint) { *this = endpoint; }
159 
161 
168  bool HasCapability(Endpoint::CapabilityEnum cap) const;
169 
171 
177  bool HasCapability(const std::string& cap) const;
178 
180 
187  std::string str() const;
188 
190 
196  std::string getServiceName() const;
197 
199 
206  bool operator<(const Endpoint& other) const;
207 
209 
221  static bool ServiceIDCompare(const Endpoint& a, const Endpoint& b);
222 
224 
227  Endpoint& operator=(const ConfigEndpoint& e);
228 
230  std::string URLString;
232  std::string InterfaceName;
234  std::string HealthState;
236  std::string HealthStateInfo;
238  std::string QualityLevel;
240  std::set<std::string> Capability;
242 
250 
253  std::string ServiceID;
254 
256 
263  static std::pair<EndpointStatusMap::const_iterator, EndpointStatusMap::const_iterator> getServiceEndpoints(const Endpoint&, const EndpointStatusMap&);
264 };
265 
266 } // namespace Arc
267 
268 #endif // __ARC_ENDPOINT_H__