00001 #ifndef EDG_WORKLOAD_COMMON_REQUESTAD_JOBAD_H
00002 #define EDG_WORKLOAD_COMMON_REQUESTAD_JOBAD_H
00003
00004
00005
00006
00007
00008 #include "edg/workload/common/requestad/Ad.h"
00009 #include "edg/workload/common/requestad/JobAdSchema.h"
00010 #include "classad_distribution.h"
00011 #include "edg/workload/common/requestad/JdlAttributeList.h"
00012
00013 COMMON_REQUESTAD_NAMESPACE_BEGIN
00014
00015
00034
00035
00036 class JobAd : public edg::workload::common::requestad::Ad{
00037 public:
00041 JobAd() ;
00043 virtual ~JobAd() throw();
00051 JobAd( const std::string& jdl_string) ;
00056 JobAd( const classad::ClassAd& classAd);
00059 JobAd::JobAd(const JobAd& jobad);
00061 void JobAd::operator=(const JobAd& jobad);
00062
00063
00064
00065
00066
00068
00079 void fromStream(std::istream& jdl_in) ;
00082 std::string toString();
00086 std::string toString( const std::string & attr_name );
00087
00090
00094 std::string toSubmissionString();
00098 void toFile(const std::string& file_path) ;
00100
00107 void setDefaultRank (const std::string& attr_value ) ;
00108
00114 void setDefaultReq (const std::string& attr_value ) ;
00115
00122 void setAttributeExpr (const std::string& attr_name, const std::string& attr_value);
00124
00132 std::string getAd(const std::string& attr_name);
00139 std::string getString(const std::string& attr_name) ;
00146 int getInt(const std::string& attr_name) ;
00153 double getDouble(const std::string& attr_name) ;
00160 bool getBool(const std::string& attr_name) ;
00162
00163
00170 void checkSyntax( const std::string& attr_name , classad::ExprTree* attr_value ) ;
00174 void checkMultiAttribute ( const std::vector<std::string> &multi ) ;
00179 classad::ExprTree* delAttribute(const std::string& attr_name) ;
00188 void check() ;
00190 protected:
00191
00192 virtual void checkInputSandbox( std::vector<std::string>& extracted );
00193 virtual void insertAttribute(const std::string& attr_name , classad::ExprTree* val);
00194 std::vector<std::string> extractFiles(const std::string& attr_name , const std::string& path , std::vector<std::string> &extracted) ;
00197 classad::ClassAd user ;
00198 private:
00199 JobAdSchema* schema ;
00200 JdlAttributeList jdlist ;
00201
00202 void checkJobType(const std::vector<std::string> & attr_value) ;
00203 void checkDataManagement( ) ;
00204 void checkOutputData(const std::vector<Ad> & attr_value) ;
00205 void checkSyntax( const std::string& attr_name , classad::Value attr_value ) ;
00206
00207 virtual void checkSpecials( ) ;
00208
00209 classad::ExprTree *defaultRank ;
00210 classad::ExprTree *defaultReq ;
00211
00212 void checkSemantic() ;
00213
00214 void restore () ;
00215
00216
00217
00218 bool checking ;
00219
00220 friend class Job ;
00221 friend class ExpDagAd ;
00222 static bool isAbsolutePath(const std::string &path , bool platform_dependence = true) ;
00223 static const std::string getName (const std::string &path , bool platform_dependence = true) ;
00224 };
00225
00226 }
00227 COMMON_NAMESPACE_END }
00228 #endif
00229
00230