glite/jdl/extractfiles.h

Go to the documentation of this file.
00001 /*
00002 Copyright (c) Members of the EGEE Collaboration. 2004.
00003 See http://www.eu-egee.org/partners/ for details on the
00004 copyright holders.
00005 
00006 Licensed under the Apache License, Version 2.0 (the "License");
00007 you may not use this file except in compliance with the License.
00008 You may obtain a copy of the License at
00009 
00010     http://www.apache.org/licenses/LICENSE-2.0
00011 
00012 Unless required by applicable law or agreed to in writing, software
00013 distributed under the License is distributed on an "AS IS" BASIS,
00014 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
00015 either express or implied.
00016 See the License for the specific language governing permissions and
00017 limitations under the License.
00018 */
00019 
00020 #ifndef GLITE_WMS_COMMON_REQUESTAD_EXTRACTFILES_H
00021 #define GLITE_WMS_COMMON_REQUESTAD_EXTRACTFILES_H
00022 /*
00023 * extractfiles.h
00024 * Copyright (c) 2001 The European Datagrid Project - IST programme, all rights reserved.
00025 * Contributors are mentioned in the code where appropriate.
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                 // STATIC METHOD
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                 // Main instance GET methods
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                         // mapping nodeNames and jobids
00196                         // std::map<std::string,ExtractedAd*> nodesMapppy ; // TBD
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 } // jdl namespace
00284 } // glite namespace
00285 #endif
00286 //EOF

Generated on 7 Mar 2013 for jdl-api-cpp-3.4.1 by  doxygen 1.4.7