00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef PGQUEUE_H
00022 #define PGQUEUE_H
00023
00024 #include "Queue.h"
00025 #include "Task.h"
00026 #include "PGAgentInfo.h"
00027 #include "PGConnection.h"
00028 #include <map>
00029 #include <list>
00030
00031
00032 using namespace std;
00033
00045 class PGQueue:public Queue
00046 {
00047 private:
00048
00049 string mPathDb;
00050
00051
00052
00056 string mMailServerIp;
00057
00058 public:
00068 PGQueue(string aDbName,string aUser,string aPass,string aHostAddr,string aPort,string aMailServerIp);
00073 ~PGQueue();
00074
00080 list<string> getInWaitTasks();
00086 list<string> getTerminatedTasks();
00092 list<string> getInUseTasks();
00098 list<string> getExpiredTasks();
00099
00100
00101
00102
00103
00104
00105
00111 void changeStateToInWait(string& aIdTask);
00117 void changeStateToInUse(string& aIdTask);
00123 void changeStateToExpired(string& aIdTask);
00129 void changeStateToTerminated(string& aIdTask);
00130
00136 void saveTask(Task* aDescriptor);
00137
00144 void addTaskAgentInUse(string aTask,string aAgent);
00145
00152 void deleteTaskAgentInUse(string aAgent,bool aError);
00153
00158 void updateAging();
00159
00160
00178 void addTask( string& aId,
00179 string& aCreationDate,
00180 int aExpiration,
00181 int aPriority,
00182 string& aTaskName,
00183 string& aUserName,
00184 string& aUserMail,
00185 list<vector<string > > aFilters,
00186 list<vector<string > > aDatas,
00187 string& aResultLocalPath,
00188 string& aResultStoragePath,
00189 string& aBinSourcePath,
00190 string& aResultCommand
00191 );
00192
00193
00194
00195
00204 bool extractTaskToExec(PGAgentInfo * aAgent,Task * aDesc,string& aIp,string& aPort);
00205
00211 list<string> orderInWaitTasks();
00212
00219 void updateAdvanceTask(string& aTaskId,string& value);
00220
00227 list<vector<string > > getInformations(string aTaskId);
00228
00234 void checkTimeout();
00235
00240 string getPath();
00241
00248 void deleteErrorTask(string aTask,string aAgent);
00249
00254 void eraseBase();
00255
00263 bool getTaskInUse(string aAgent,string aTask);
00264
00271 string getMail(string aTask);
00272
00279 string getResultStorage(string aTask);
00280
00287 string getName(string aTask);
00288
00289 };
00290
00291 #endif