00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef ReplicaOptimization_H
00014 #define ReplicaOptimization_H 1
00015
00023 #include <string>
00024 #include <vector>
00025
00026 #include "EdgReplicaOptimization/ReplicationExceptions.h"
00027 #include "edg_gsoap_baseH.h"
00028 #include "EdgReplicaOptimization/EdgReplicaOptimizationH.h"
00029
00030 namespace EdgReplicaOptimization {
00034 class AccessCost {
00035 public:
00036 typedef std::vector<std::string> BestSFN_t;
00037
00038 private:
00039 std::string ceId;
00040 BestSFN_t bestSFN;
00041 float totalTime;
00042 float sizeToBeReplicated;
00043
00044 public:
00045 AccessCost(tns1__AccessCost &soapAccessCost);
00046 const std::string & getCeId() { return ceId; }
00047 const BestSFN_t & getBestSFN() { return bestSFN; }
00048 float getTotalTime() { return totalTime; }
00049 float getSizeToBeReplicated() { return sizeToBeReplicated; }
00050 };
00051
00052 class BestNetworkCost {
00053 public:
00054 typedef std::vector<std::string> BestSFN_t;
00055
00056 private:
00057 std::string bestSFN;
00058 float time;
00059
00060 public:
00061 BestNetworkCost() {}
00062 void setBNC(tns1__BestNetworkCost &soapBestNetworkCost);
00063 const std::string & getBestSFN() { return bestSFN; }
00064 float getTime() { return time; }
00065 };
00066
00067
00068 class ROSFile {
00069 private:
00070 std::string name;
00071 std::vector<std::string> replicas;
00072 float sizeMB;
00073
00074 public:
00075 typedef std::vector<std::string> Replicas_t;
00076 ROSFile() {}
00077 const std::string& getName() { return name; }
00078 const Replicas_t& getReplicas() { return replicas; }
00079 float getSizeMB() { return sizeMB; }
00080
00081 void setName(const std::string &_name) {
00082 name = _name;
00083 }
00084
00085 void setReplicas(const Replicas_t & _replicas) {
00086 replicas = _replicas;
00087 }
00088
00089 void setSizeMB( const float _sizeMB) {
00090 sizeMB = _sizeMB;
00091 }
00092 };
00093
00094 class ROSComputingElement {
00095 private:
00096 std::string host;
00097 std::string closeSE;
00098
00099 public:
00100 ROSComputingElement() {}
00101 const std::string& getCEHost() { return host; }
00102 const std::string& getCloseSE() { return closeSE; }
00103
00104 void setCEHost(const std::string &_host) {
00105 host = _host;
00106 }
00107
00108 void setCloseSEs(const std::string & _closeSE) {
00109 closeSE = _closeSE;
00110 }
00111 };
00112
00113 typedef std::vector<ROSFile> ROSFiles_t;
00114 typedef std::vector<ROSComputingElement> ROSComputingElements_t;
00115 typedef std::vector<std::string> Protocols_t;
00116 typedef std::vector<AccessCost> AccessCosts_t;
00117
00118 class ReplicaOptimization
00119 {
00120 public:
00121
00130 ReplicaOptimization(const std::string& url,
00131 int timeOut=30
00132 #ifdef WITH_WP2_SECURITY
00133 ,char *passphrase = NULL,
00134 char *credentials = NULL,
00135 char *cacertdir = NULL,
00136 char *rseedfile = NULL,
00137 char *role = NULL,
00138 char *policy = NULL,
00139 char *defaultRole = NULL,
00140 char *defaultPolicy = NULL
00141 #endif
00142 ) {}
00143
00144 #ifdef WITH_WP2_SECURITY
00145 virtual int addRoleAndPolicy(char *role,
00146 char *policy,
00147 char *defaultrole,
00148 char *defaultpolicy) = 0;
00149
00150 virtual void clearRoleAndPolicy() = 0;
00151 #endif
00152
00155 virtual ~ReplicaOptimization() {};
00156
00161 virtual const std::string& getUrl() const =0;
00162
00163
00167 virtual const std::string getVersion() const
00168 throw(CommunicationException) =0;
00169
00173 virtual const std::string getInterfaceVersion() const
00174 throw(CommunicationException) =0;
00175
00176 virtual bool ping() = 0;
00177
00178 virtual void getAccessCost(ROSFiles_t &files,
00179 ROSComputingElements_t &ce,
00180 Protocols_t &protocol,
00181 AccessCosts_t &accessCost) = 0;
00182
00183 virtual void getBestNetworkCost(ROSFile &file,
00184 std::string &destinationSE,
00185 BestNetworkCost &networkCost) = 0;
00186 };
00187 }
00188
00189 #endif // ReplicaOptimization_H
00190