00001 /* 00002 * File: Reading.h 00003 * 00004 * Copyright Jonathan Schaeffer 2009-2010, 00005 * CC-IN2P3, CNRS <jonathan.schaeffer@cc.in2p3.fr> 00006 * Contributors : Andres Gomez, 00007 * CC-IN2P3, CNRS <andres.gomez@cc.in2p3.fr> 00008 * 00009 * This software is a computer program whose purpose is to schedule, sort 00010 * and submit file requests to the hierarchical storage system HPSS. 00011 * 00012 * This software is governed by the CeCILL license under French law and 00013 * abiding by the rules of distribution of free software. You can use, 00014 * modify and/or redistribute the software under the terms of the CeCILL 00015 * license as circulated by CEA, CNRS and INRIA at the following URL 00016 * "http://www.cecill.info". 00017 * 00018 * As a counterpart to the access to the source code and rights to copy, 00019 * modify and redistribute granted by the license, users are provided only 00020 * with a limited warranty and the software's author, the holder of the 00021 * economic rights, and the successive licensors have only limited 00022 * liability. 00023 * 00024 * In this respect, the user's attention is drawn to the risks associated 00025 * with loading, using, modifying and/or developing or reproducing the 00026 * software by the user in light of its specific status of free software, 00027 * that may mean that it is complicated to manipulate, and that also 00028 * therefore means that it is reserved for developers and experienced 00029 * professionals having in-depth computer knowledge. Users are therefore 00030 * encouraged to load and test the software's suitability as regards their 00031 * requirements in conditions enabling the security of their systems and/or 00032 * data to be ensured and, more generally, to use and operate it in the 00033 * same conditions as regards security. 00034 * 00035 * The fact that you are presently reading this means that you have had 00036 * knowledge of the CeCILL license and that you accept its terms. 00037 * 00038 */ 00039 00040 #ifndef READING_H_ 00041 #define READING_H_ 00042 00043 #define READING_MAXTRIES 3 00044 00045 #include "FileStatus.h" 00046 #include "HPSSBridge.h" 00047 #include "ReadingDAO.h" 00048 #include "FilePositionOnTape.h" 00049 #include "FilePositionOnTapesController.h" 00050 #include <time.h> 00051 00052 namespace treqs { 00053 00055 class Reading { 00056 public: 00058 Reading(); 00068 Reading(FilePositionOnTape* fp, FileStatus fs, int tries, int maxtries, 00069 long qid); 00071 ~Reading(); 00072 00074 int getErrorCode() const; 00076 treqs::FileStatus getFileState() const; 00078 treqs::FilePositionOnTape* getMetaData() const; 00080 int getNbTries() const; 00082 int getMaxTries() const; 00084 time_t getStartTime() const; 00086 time_t getEndTime() const; 00088 std::string getErrorMessage() const; 00090 void setErrorCode(int ErrorCode); 00096 void setFileState(treqs::FileStatus FileState); 00098 void setMetaData(treqs::FilePositionOnTape* MetaData); 00100 void setNbTries(int NbTries); 00102 void setMaxTries(int MaxTries); 00104 void setErrorMessage(std::string); 00106 00124 int stage() throw (HPSSResourceError); 00125 00127 00133 bool operator<(const Reading& r); 00134 00136 00139 void prepareCleanup(); 00140 00141 private: 00143 static log4cxx::LoggerPtr logger; 00145 treqs::FileStatus FileState; 00147 treqs::FilePositionOnTape* MetaData; 00149 int ErrorCode; 00151 std::string ErrorMessage; 00153 int NbTries; 00155 int MaxTries; 00157 time_t StartTime; 00159 time_t EndTime; 00161 long QueueId; 00162 00164 void sendUpdate(); 00165 }; 00166 00167 } 00168 00169 #endif /* READING_H_ */