jdl-api-cpp-3.4.4
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JobAd.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_JOBAD_H
21 #define GLITE_WMS_COMMON_REQUESTAD_JOBAD_H
22 /*
23  * JobAd.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 #include "Ad.h"
28 #include "JobAdSchema.h"
29 #include "classad_distribution.h"
30 #include "JdlAttributeList.h"
31 #include "extractfiles.h"
32 #include <boost/scoped_ptr.hpp>
33 namespace glite{
34 namespace jdl {
35 // class JdlAttributeList ;
54 // class JobAd : private classad::ClassAd{
55 class JobAd : public glite::jdl::Ad{
56  public:
60  JobAd() ;
62  virtual ~JobAd() throw();
65  JobAd( const std::string& jdl_string);
70  JobAd(const classad::ClassAd& classAd);
73  JobAd(const JobAd& jobad);
75  void operator=(const JobAd& jobad);
80  void fromClassAd(const classad::ClassAd& classAd);
84  void fromJobAd(const JobAd& jobad);
86 
91  std::string toSubmissionString();
95  void toFile(const std::string& file_path) ;
97 
104  void setLocalAccess(bool lookInto);
109  void setDefaultRank (const std::string& attr_value ) ;
114  void setDefaultReq (const std::string& attr_value ) ;
119  void setDefaultRank (classad::ExprTree* attr_value);
120 
125  void setDefaultReq (classad::ExprTree* attr_value );
126 
131  void setAllowedProtocols (const std::vector<std::string>& attr_value ) ;
136  const std::vector<std::string> getAllowedProtocols ();
143  void setAttributeExpr (const std::string& attr_name, const std::string& attr_value);
150  void setAttributeExpr (const std::string& attr_name, ExprTree* attr_value);
151 
152 
153 
155 
163  Ad getAd(const std::string& attr_name);
170  std::string getString(const std::string& attr_name) ;
177  int getInt(const std::string& attr_name) ;
184  double getDouble(const std::string& attr_name) ;
191  bool getBool(const std::string& attr_name) ;
204 
210  virtual void checkSyntax(const std::string& attr_name, classad::ExprTree* attr_value);
211  virtual void checkSyntax(const std::string& attr_name, classad::Value attr_value);
215  void checkMultiAttribute ( const std::vector<std::string> &multi ) ;
221  classad::ExprTree* delAttribute(const std::string& attr_name) ;
230  void check( const bool& restore = true ) ;
232  protected:
237  virtual void checkInputSandbox( std::vector<std::string>& extracted );
241  virtual void checkRankReq () ;
247  virtual void insertAttribute(const std::string& attr_name , classad::ExprTree* val);
263  classad::ClassAd user ;
268  //ExtractedAd *extractedAd ;
269  boost::scoped_ptr<ExtractedAd> extractedAd ;
270  private:
271  void reset();
272  //JobAdSchema *schema ;
273  boost::scoped_ptr<JobAdSchema> schema ;
274  JdlAttributeList jdlist ;
275  // Check Only the syntax of the Jdl
276  void checkJobType(const std::vector<std::string> & attr_value) ;
277  void checkDataManagement( ) ;
278  // This method is not yet implemented, used for future implementation (like DagAd)
279  virtual void checkSpecials( ) ;
280  // Default special attributes:
281  classad::ExprTree *defaultRank ;
282  classad::ExprTree *defaultReq ;
283  // Check Jdl semantic co-existance rules
284  void checkSemantic() ;
285  // Add an attribute, this method is used by all public addAttribute methods
286  void restore () ;
287  //This Variable is utilized to iterate over the threads
288  friend class Job ;
289  friend class ExpDagAd ;
290  std::vector < std::string > allowed_protocols ;
291  static bool isAbsolutePath(const std::string &path , bool platform_dependence = true) ;
292  static const std::string getName (const std::string &path , bool platform_dependence = true) ;
293 };
294 
295 } // jdl namespace
296 } // glite namespace
297 
298 #endif
299 
300 //EOF
std::string toSubmissionString()
void setLocalAccess(bool lookInto)
bool getBool(const std::string &attr_name)
bool checking
Definition: JobAd.h:266
Provides a representation of the job description in the JDL language.
Definition: ExpDagAd.h:84
virtual void checkSyntax(const std::string &attr_name, classad::ExprTree *attr_value)
virtual void checkRankReq()
void setAttributeExpr(const std::string &attr_name, const std::string &attr_value)
Ad getAd(const std::string &attr_name)
Definition: Ad.h:67
int getInt(const std::string &attr_name)
checkType lookInto_b
Definition: JobAd.h:265
double getDouble(const std::string &attr_name)
void operator=(const JobAd &jobad)
Provides a representation of the job description in the JDL language.
Definition: JobAd.h:55
classad::ClassAd user
Definition: JobAd.h:263
classad::ExprTree * delAttribute(const std::string &attr_name)
virtual void checkInputSandbox(std::vector< std::string > &extracted)
virtual void insertAttribute(const std::string &attr_name, classad::ExprTree *val)
bool gettoBretrieved()
Definition: JobAd.h:196
friend class Job
Definition: JobAd.h:288
Definition: JdlAttributeList.h:47
void check(const bool &restore=true)
const std::vector< std::string > getAllowedProtocols()
Definition: extractfiles.h:56
void toFile(const std::string &file_path)
bool toBretrieved
Definition: JobAd.h:266
void setAllowedProtocols(const std::vector< std::string > &attr_value)
void setDefaultRank(const std::string &attr_value)
void setDefaultReq(const std::string &attr_value)
checkType
Provides a method for extracting files from a specified path.
Definition: extractfiles.h:215
void fromClassAd(const classad::ClassAd &classAd)
void fromJobAd(const JobAd &jobad)
std::string getString(const std::string &attr_name)
ExtractedAd * getExtractedAd()
boost::scoped_ptr< ExtractedAd > extractedAd
Definition: JobAd.h:269
void checkMultiAttribute(const std::vector< std::string > &multi)