Main Page | Class Hierarchy | Class List | File List | Class Members | Related Pages

dao/src/PGQueue.h

00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /*
00003 K-10 Distributed Processing - Lium, Le Mans
00004 Copyright (C) 2006
00005 
00006 This program is free software; you can redistribute it and/or
00007 modify it under the terms of the GNU General Public License
00008 as published by the Free Software Foundation; either version 2
00009 of the License, or (at your option) any later version.
00010 
00011 This program is distributed in the hope that it will be useful,
00012 but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 GNU General Public License for more details.
00015 
00016 You should have received a copy of the GNU General Public License
00017 along with this program; if not, write to the Free Software
00018 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
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 //#include "PGDistributionStrategy.h"
00031 
00032 using namespace std;
00033 
00045 class PGQueue:public Queue
00046 {
00047 private:
00048  //get the path for connection to a database
00049  string mPathDb;
00050  //get the path for connection to a database
00051  //PGDistributionStrategy * mStrategy;
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  /* States match with numbers :
00101     0 : in wait
00102     1 : in use
00103     2 : terminated
00104     3 : expired
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  // don't forget to put it in private after tests
00178  void addTask(  string& aId,
00179                 string& aCreationDate,// YYYY-MM-DD
00180                 int aExpiration,
00181                 int aPriority,
00182                 string& aTaskName,
00183                 string& aUserName,
00184                 string& aUserMail,
00185                 list<vector<string > > aFilters,//list of filters
00186                 list<vector<string > > aDatas,//list of datas
00187                 string& aResultLocalPath,
00188                 string& aResultStoragePath,
00189                 string& aBinSourcePath,
00190                 string& aResultCommand
00191                 );
00192 
00193  // TODO : create the interface of the agent
00194  //virtual void saveAgent(Agent& aAgent);
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

Generated on Fri May 19 22:56:55 2006 for k10-controller by  doxygen 1.4.4