Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef GLITE_WMS_COMMON_REQUESTAD_EXTRACTFILES_H
00021 #define GLITE_WMS_COMMON_REQUESTAD_EXTRACTFILES_H
00022
00023
00024
00025
00026
00027
00028 namespace glite {
00029 namespace jdl {
00030
00034 struct FileAd {
00036 FileAd(const std::string& protocol,const std::string& file, unsigned int size);
00038 std::string protocol;
00040 std::string file;
00042 unsigned int size;
00043
00048 inline static void setMaxFileSize(unsigned int maxFileSize){maxFileSize_i=maxFileSize;}
00049 private:
00050 static unsigned int maxFileSize_i;
00051 };
00056 class ExtractedAd{
00058 public:
00060 ExtractedAd() ;
00062 ExtractedAd(const ExtractedAd& jobad);
00066 virtual void operator=(const ExtractedAd& extractedAd);
00071 static void ExtractedAdCopy(const ExtractedAd& source, ExtractedAd* dest);
00073 virtual ~ExtractedAd() throw(){};
00079 ExtractedAd* Copy();
00081
00082
00088 static void setMaxTotalSize(unsigned int maxTotalSize);
00093 void setNodeName(const std::string& nodeName);
00099 void setNodeName(const std::string& nodeName,const std::string& jobid);
00104 void setJobId(const std::string& jobid);
00110 void setJobId(const std::string& nodeName,const std::string& jobid);
00111
00116 void setFiles(const std::vector<FileAd>& files);
00121 void addFileAd(const FileAd& file);
00126 void addFileAd(const std::string& path);
00131 void addNode(ExtractedAd* extracted);
00133
00134
00136
00137
00141 const std::string getNodeName();
00145 const std::string getJobId();
00149 const std::vector<FileAd> getFiles();
00153 unsigned int getTotalSize();
00157 unsigned long getMaxJobFileSize();
00163 ExtractedAd* getNode (const std::string& nodeName);
00169 ExtractedAd* getJobId(const std::string& jobid);
00174 std::vector<ExtractedAd*> getChildren();
00180 const std::vector<FileAd> getNodeNameFiles(const std::string& nodeName);
00186 const std::vector<FileAd> getJobIdFiles(const std::string& jobid);
00192 bool hasFiles();
00194 private:
00195
00196
00197 std::string nodeName_s;
00198 std::string jobid_s;
00199 std::vector<FileAd> files_v;
00200 std::vector<ExtractedAd*> children_v;
00201 unsigned int totalSize_i;
00202 unsigned long maxJobFileSize_i;
00203 static unsigned int maxTotalSize_i;
00204 bool hasFiles_b;
00205 };
00206
00215 enum checkType {
00216 EXISTENCE,
00217 WMPROXY,
00218 TRANSFER,
00219 ONLYLOCAL
00220 };
00233 bool extractFiles(const std::string& attr_name , const std::string& path ,
00234 std::vector<std::string> &extracted,checkType lookInto_b,
00235 const std::string &wmpURI, const std::string &isbURI,ExtractedAd *extractedAd=NULL) ;
00248 bool extractFiles(const std::string& attr_name , std::vector<std::string>& paths ,
00249 std::vector<std::string> &extracted,checkType lookInto_b,
00250 const std::string &wmpURI, const std::string &isbURI,ExtractedAd *extractedAd=NULL);
00251
00262 void toBcopied(const std::string& attr_name , const std::string& path ,
00263 std::vector<std::pair < std::string, std::string> > &result,
00264 const std::string &wmpURI, const std::string &isbURI);
00274 void toBcopied(const std::string& attr_name , std::vector<std::string> paths ,
00275 std::vector<std::pair < std::string, std::string> > &result,
00276 const std::string &wmpURI, const std::string &isbURI);
00282 bool hasWildCards(const std::string& path);
00283 }
00284 }
00285 #endif
00286