jdl-api-cpp-3.4.4
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
extractfiles.h
Go to the documentation of this file.
1 /*
2 Copyright (c) Members of the EGEE Collaboration. 2004.
3 See http://www.eu-egee.org/partners/ for details on the
4 copyright holders.
5 
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9 
10  http://www.apache.org/licenses/LICENSE-2.0
11 
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
15 either express or implied.
16 See the License for the specific language governing permissions and
17 limitations under the License.
18 */
19 
20 #ifndef GLITE_WMS_COMMON_REQUESTAD_EXTRACTFILES_H
21 #define GLITE_WMS_COMMON_REQUESTAD_EXTRACTFILES_H
22 /*
23 * extractfiles.h
24 * Copyright (c) 2001 The European Datagrid Project - IST programme, all rights reserved.
25 * Contributors are mentioned in the code where appropriate.
26 */
27 
28 namespace glite {
29 namespace jdl {
30 
34  struct FileAd {
36  FileAd(const std::string& protocol,const std::string& file, unsigned int size);
38  std::string protocol;
40  std::string file;
42  unsigned int size;
43  // STATIC METHOD
48  inline static void setMaxFileSize(unsigned int maxFileSize){maxFileSize_i=maxFileSize;}
49  private:
50  static unsigned int maxFileSize_i;
51  };
56  class ExtractedAd{ //@{
58  public:
60  ExtractedAd() ;
62  ExtractedAd(const ExtractedAd& jobad);
66  virtual void operator=(const ExtractedAd& extractedAd);
71  static void ExtractedAdCopy(const ExtractedAd& source, ExtractedAd* dest);
73  virtual ~ExtractedAd() throw(){};
79  ExtractedAd* Copy();
81 
82  //@{
88  static void setMaxTotalSize(unsigned int maxTotalSize);
93  void setNodeName(const std::string& nodeName);
99  void setNodeName(const std::string& nodeName,const std::string& jobid);
104  void setJobId(const std::string& jobid);
110  void setJobId(const std::string& nodeName,const std::string& jobid);
111 
116  void setFiles(const std::vector<FileAd>& files);
121  void addFileAd(const FileAd& file);
126  void addFileAd(const std::string& path);
131  void addNode(ExtractedAd* extracted);
133 
134  //@{
136 
137  // Main instance GET methods
141  const std::string getNodeName();
145  const std::string getJobId();
149  const std::vector<FileAd> getFiles();
153  unsigned int getTotalSize();
157  unsigned long getMaxJobFileSize();
163  ExtractedAd* getNode (const std::string& nodeName);
169  ExtractedAd* getJobId(const std::string& jobid);
174  std::vector<ExtractedAd*> getChildren();
180  const std::vector<FileAd> getNodeNameFiles(const std::string& nodeName);
186  const std::vector<FileAd> getJobIdFiles(const std::string& jobid);
192  bool hasFiles();
194  private:
195  // mapping nodeNames and jobids
196  // std::map<std::string,ExtractedAd*> nodesMapppy ; // TBD
197  std::string nodeName_s;
198  std::string jobid_s;
199  std::vector<FileAd> files_v;
200  std::vector<ExtractedAd*> children_v;
201  unsigned int totalSize_i;
202  unsigned long maxJobFileSize_i;
203  static unsigned int maxTotalSize_i;
204  bool hasFiles_b;
205  };
206 
215  enum checkType {
220  };
233  bool extractFiles(const std::string& attr_name , const std::string& path ,
234  std::vector<std::string> &extracted,checkType lookInto_b,
235  const std::string &wmpURI, const std::string &isbURI,ExtractedAd *extractedAd=NULL) ;
248  bool extractFiles(const std::string& attr_name , std::vector<std::string>& paths ,
249  std::vector<std::string> &extracted,checkType lookInto_b,
250  const std::string &wmpURI, const std::string &isbURI,ExtractedAd *extractedAd=NULL);
251 
262  void toBcopied(const std::string& attr_name , const std::string& path ,
263  std::vector<std::pair < std::string, std::string> > &result,
264  const std::string &wmpURI, const std::string &isbURI);
274  void toBcopied(const std::string& attr_name , std::vector<std::string> paths ,
275  std::vector<std::pair < std::string, std::string> > &result,
276  const std::string &wmpURI, const std::string &isbURI);
282  bool hasWildCards(const std::string& path);
283 } // jdl namespace
284 } // glite namespace
285 #endif
286 //EOF
bool hasWildCards(const std::string &path)
void addFileAd(const FileAd &file)
unsigned int getTotalSize()
Definition: extractfiles.h:217
const std::vector< FileAd > getNodeNameFiles(const std::string &nodeName)
ExtractedAd * Copy()
Definition: extractfiles.h:216
FileAd(const std::string &protocol, const std::string &file, unsigned int size)
void setNodeName(const std::string &nodeName)
std::string protocol
Definition: extractfiles.h:38
void addNode(ExtractedAd *extracted)
static void setMaxTotalSize(unsigned int maxTotalSize)
static void ExtractedAdCopy(const ExtractedAd &source, ExtractedAd *dest)
const std::vector< FileAd > getFiles()
void toBcopied(const std::string &attr_name, const std::string &path, std::vector< std::pair< std::string, std::string > > &result, const std::string &wmpURI, const std::string &isbURI)
const std::string getNodeName()
Definition: extractfiles.h:34
static void setMaxFileSize(unsigned int maxFileSize)
Definition: extractfiles.h:48
bool extractFiles(const std::string &attr_name, const std::string &path, std::vector< std::string > &extracted, checkType lookInto_b, const std::string &wmpURI, const std::string &isbURI, ExtractedAd *extractedAd=NULL)
std::string file
Definition: extractfiles.h:40
unsigned long getMaxJobFileSize()
unsigned int size
Definition: extractfiles.h:42
Definition: extractfiles.h:219
virtual ~ExtractedAd()
Definition: extractfiles.h:73
void setJobId(const std::string &jobid)
virtual void operator=(const ExtractedAd &extractedAd)
void setFiles(const std::vector< FileAd > &files)
Definition: extractfiles.h:56
const std::vector< FileAd > getJobIdFiles(const std::string &jobid)
const std::string getJobId()
std::vector< ExtractedAd * > getChildren()
checkType
Provides a method for extracting files from a specified path.
Definition: extractfiles.h:215
ExtractedAd * getNode(const std::string &nodeName)
Definition: extractfiles.h:218