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 = "")
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__
Arc namespace contains all core ARC classes.
Definition: ArcConfig.h:11
std::string HealthStateInfo
GLUE2 HealthStateInfo
Definition: Endpoint.h:236
std::string ServiceID
ID of service this Endpoint belongs to.
Definition: Endpoint.h:253
std::string URLString
The string representation of the URL of the Endpoint.
Definition: Endpoint.h:230
Represents the status in the EntityRetriever of the query process of an Endpoint (service registry...
Definition: EndpointQueryingStatus.h:19
EndpointStatusMap()
Creates a std::map with the key comparison object set to Endpoint::ServiceIDCompare.
bool(* EndpointCompareFn)(const Endpoint &, const Endpoint &)
Key comparison object definition for Endpoint objects.
Definition: Endpoint.h:26
static std::pair< EndpointStatusMap::const_iterator, EndpointStatusMap::const_iterator > getServiceEndpoints(const Endpoint &, const EndpointStatusMap &)
Get bounds in EndpointStatusMap corresponding to Endpoint.
Endpoint & operator=(const ConfigEndpoint &e)
Set from a ConfigEndpoint object.
Represents the endpoint of service with a given type and GLUE2 InterfaceName.
Definition: UserConfig.h:36
std::string HealthState
GLUE2 HealthState
Definition: Endpoint.h:234
Endpoint(const std::string &URLString="", const std::set< std::string > &Capability=std::set< std::string >(), const std::string &InterfaceName="")
Create a new Endpoint with a list of capability strings.
Definition: Endpoint.h:113
Interface of a computing element where jobs can be managed.
Definition: Endpoint.h:86
Local information system of a computing element capable of returning the list of jobs on the resource...
Definition: Endpoint.h:77
Represents an endpoint of a service with a given interface type and capabilities. ...
Definition: Endpoint.h:68
CapabilityEnum
Values for classifying capabilities of services.
Definition: Endpoint.h:71
std::set< std::string > Capability
Set of GLUE2 Capability strings.
Definition: Endpoint.h:240
static std::string GetStringForCapability(Endpoint::CapabilityEnum cap)
Get string representation of CapabilityEnum.
Definition: Endpoint.h:96
bool operator<(const Endpoint &other) const
Key comparison method.
EndpointStatusMap(const EndpointStatusMap &m)
Copy constructor.
Definition: Endpoint.h:45
bool HasCapability(Endpoint::CapabilityEnum cap) const
Check for capability.
std::string QualityLevel
GLUE2 QualityLevel
Definition: Endpoint.h:238
Endpoint(const ConfigEndpoint &endpoint)
Create a new Endpoint from a ConfigEndpoint.
Definition: Endpoint.h:158
std::string str() const
Get string representation of this object.
ExecutionTarget.
Definition: ExecutionTarget.h:494
Interface of a computing element where jobs can be created.
Definition: Endpoint.h:84
std::string RequestedSubmissionInterfaceName
A GLUE2 InterfaceName requesting an InterfaceName used for job submission.
Definition: Endpoint.h:248
std::string getServiceName() const
Get name of service from URLString attribute.
EndpointStatusMap(EndpointCompareFn fn)
Creates a std::map using fn as key comparison object.
Definition: Endpoint.h:43
Definition: ExecutionTarget.h:321
Interface of a computing element where jobs can be submitted.
Definition: Endpoint.h:79
static bool ServiceIDCompare(const Endpoint &a, const Endpoint &b)
Key comparison function for comparing Endpoint objects.
Status map for Endpoint objects.
Definition: Endpoint.h:38
Endpoint(const std::string &URLString, const Endpoint::CapabilityEnum cap, const std::string &InterfaceName="")
Create a new Endpoint with a single capability specified by the CapabilityEnum.
Definition: Endpoint.h:124
Unspecified capability.
Definition: Endpoint.h:88
std::string InterfaceName
The type of the interface (GLUE2 InterfaceName)
Definition: Endpoint.h:232
Service registry capable of returning endpoints.
Definition: Endpoint.h:73
Local information system of a computing element capable of returning information about the resource...
Definition: Endpoint.h:75