Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

JobAd.h

00001 #ifndef  EDG_WORKLOAD_COMMON_REQUESTAD_JOBAD_H
00002 #define EDG_WORKLOAD_COMMON_REQUESTAD_JOBAD_H
00003 /*
00004  * JobAd.h
00005  * Copyright (c) 2001 The European Datagrid Project - IST programme, all rights reserved.
00006  * Contributors are mentioned in the code where appropriate.
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  //Defining UserInterFace NameSpace
00014 
00015 // class JdlAttributeList ;
00034 // class JobAd : private classad::ClassAd{
00035 // class JobAd : public edg::workload::common::requestad::Ad{
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                 // std::std::string toLines();
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                 // Not yet implemented, left for future implementation like DAG
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                 // Check Only the syntax of the Jdl
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                 // This method is not yet implemented, used for future implementation (like DagAd)
00207                 virtual void checkSpecials( ) ;
00208                 // Default special attributes:
00209                 classad::ExprTree *defaultRank ;
00210                 classad::ExprTree  *defaultReq ;
00211                 // Check Jdl semantic co-existance rules
00212                 void checkSemantic() ;
00213                 // Add an attribute, this method is used by all public addAttribute methods
00214                 void restore () ;
00215 
00216                 //  Extract all files from a specified path
00217 
00218                 bool checking ;
00219                 //This Variable is utilized to iterate over the threads
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 }  // requestad namespace
00227 COMMON_NAMESPACE_END } //Closing  UserInterFace NameSpace
00228 #endif
00229 
00230 //EOF

Generated on Fri May 14 14:18:25 2004 for COMMON API - configuration, jobid, ldif2classadi, logger, process, requestad, socket++i, task, utilities by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002