glite/jdl/JobAd.h

Go to the documentation of this file.
00001 /*
00002 Copyright (c) Members of the EGEE Collaboration. 2004.
00003 See http://www.eu-egee.org/partners/ for details on the
00004 copyright holders.
00005 
00006 Licensed under the Apache License, Version 2.0 (the "License");
00007 you may not use this file except in compliance with the License.
00008 You may obtain a copy of the License at
00009 
00010     http://www.apache.org/licenses/LICENSE-2.0
00011 
00012 Unless required by applicable law or agreed to in writing, software
00013 distributed under the License is distributed on an "AS IS" BASIS,
00014 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
00015 either express or implied.
00016 See the License for the specific language governing permissions and
00017 limitations under the License.
00018 */
00019 
00020 #ifndef GLITE_WMS_COMMON_REQUESTAD_JOBAD_H
00021 #define GLITE_WMS_COMMON_REQUESTAD_JOBAD_H
00022 /*
00023  * JobAd.h
00024  * Copyright (c) 2001 The European Datagrid Project - IST programme, all rights reserved.
00025  * Contributors are mentioned in the code where appropriate.
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 // class JdlAttributeList ;
00054 // class JobAd : private classad::ClassAd{
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                 //ExtractedAd *extractedAd ;
00269                 boost::scoped_ptr<ExtractedAd> extractedAd  ;
00270         private:
00271                 void reset();
00272                 //JobAdSchema *schema ;
00273                 boost::scoped_ptr<JobAdSchema> schema ;
00274                 JdlAttributeList jdlist ;
00275                 // Check Only the syntax of the Jdl
00276                 void checkJobType(const std::vector<std::string> & attr_value) ;
00277                 void checkDataManagement( ) ;
00278                 // This method is not yet implemented, used for future implementation (like DagAd)
00279                 virtual void checkSpecials( ) ;
00280                 // Default special attributes:
00281                 classad::ExprTree *defaultRank ;
00282                 classad::ExprTree  *defaultReq ;
00283                 // Check Jdl semantic co-existance rules
00284                 void checkSemantic() ;
00285                 // Add an attribute, this method is used by all public addAttribute methods
00286                 void restore () ;
00287                 //This Variable is utilized to iterate over the threads
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 } // jdl namespace
00296 } // glite namespace
00297 
00298 #endif
00299 
00300 //EOF

Generated on 7 Mar 2013 for jdl-api-cpp-3.4.1 by  doxygen 1.4.7