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_JOBAD_H
00021 #define GLITE_WMS_COMMON_REQUESTAD_JOBAD_H
00022
00023
00024
00025
00026
00027 #include "Ad.h"
00028 #include "JobAdSchema.h"
00029 #include "classad_distribution.h"
00030 #include "JdlAttributeList.h"
00031 #include "extractfiles.h"
00032 #include <boost/scoped_ptr.hpp>
00033 namespace glite{
00034 namespace jdl {
00035
00054
00055 class JobAd : public glite::jdl::Ad{
00056 public:
00060 JobAd() ;
00062 virtual ~JobAd() throw();
00065 JobAd( const std::string& jdl_string);
00070 JobAd(const classad::ClassAd& classAd);
00073 JobAd(const JobAd& jobad);
00075 void operator=(const JobAd& jobad);
00080 void fromClassAd(const classad::ClassAd& classAd);
00084 void fromJobAd(const JobAd& jobad);
00086
00091 std::string toSubmissionString();
00095 void toFile(const std::string& file_path) ;
00097
00104 void setLocalAccess(bool lookInto);
00109 void setDefaultRank (const std::string& attr_value ) ;
00114 void setDefaultReq (const std::string& attr_value ) ;
00119 void setDefaultRank (classad::ExprTree* attr_value);
00120
00125 void setDefaultReq (classad::ExprTree* attr_value );
00126
00131 void setAllowedProtocols (const std::vector<std::string>& attr_value ) ;
00136 const std::vector<std::string> getAllowedProtocols ();
00143 void setAttributeExpr (const std::string& attr_name, const std::string& attr_value);
00150 void setAttributeExpr (const std::string& attr_name, ExprTree* attr_value);
00151
00152
00153
00155
00163 Ad getAd(const std::string& attr_name);
00170 std::string getString(const std::string& attr_name) ;
00177 int getInt(const std::string& attr_name) ;
00184 double getDouble(const std::string& attr_name) ;
00191 bool getBool(const std::string& attr_name) ;
00196 bool gettoBretrieved(){return toBretrieved;}
00202 ExtractedAd* getExtractedAd();
00204
00210 virtual void checkSyntax(const std::string& attr_name, classad::ExprTree* attr_value);
00211 virtual void checkSyntax(const std::string& attr_name, classad::Value attr_value);
00215 void checkMultiAttribute ( const std::vector<std::string> &multi ) ;
00221 classad::ExprTree* delAttribute(const std::string& attr_name) ;
00230 void check( const bool& restore = true ) ;
00232 protected:
00237 virtual void checkInputSandbox( std::vector<std::string>& extracted );
00241 virtual void checkRankReq () ;
00247 virtual void insertAttribute(const std::string& attr_name , classad::ExprTree* val);
00263 classad::ClassAd user ;
00265 checkType lookInto_b;
00266 bool checking,toBretrieved;
00268
00269 boost::scoped_ptr<ExtractedAd> extractedAd ;
00270 private:
00271 void reset();
00272
00273 boost::scoped_ptr<JobAdSchema> schema ;
00274 JdlAttributeList jdlist ;
00275
00276 void checkJobType(const std::vector<std::string> & attr_value) ;
00277 void checkDataManagement( ) ;
00278
00279 virtual void checkSpecials( ) ;
00280
00281 classad::ExprTree *defaultRank ;
00282 classad::ExprTree *defaultReq ;
00283
00284 void checkSemantic() ;
00285
00286 void restore () ;
00287
00288 friend class Job ;
00289 friend class ExpDagAd ;
00290 std::vector < std::string > allowed_protocols ;
00291 static bool isAbsolutePath(const std::string &path , bool platform_dependence = true) ;
00292 static const std::string getName (const std::string &path , bool platform_dependence = true) ;
00293 };
00294
00295 }
00296 }
00297
00298 #endif
00299
00300