Salome HOME
7f2baed33960ae6617d50ed5a29e51de40c11ecc
[modules/kernel.git] / src / Batch / Batch_BatchManager.cxx
1 // Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
3 // 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either 
7 // version 2.1 of the License.
8 // 
9 // This library is distributed in the hope that it will be useful 
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
12 // Lesser General Public License for more details.
13 //
14 // You should have received a copy of the GNU Lesser General Public  
15 // License along with this library; if not, write to the Free Software 
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 //
18 // See http://www.salome-platform.org/
19 //
20 /*
21  * BatchManager.cxx : 
22  *
23  * Auteur : Ivan DUTKA-MALEN - EDF R&D
24  * Date   : Septembre 2003
25  * Projet : SALOME 2
26  *
27  */
28
29 #include <iostream>
30 #include <sstream>
31 #include <string>
32 #include <netdb.h>
33 //#include "MEDMEM_STRING.hxx"
34 #include "Batch_Job.hxx"
35 #include "Batch_JobId.hxx"
36 #include "Batch_JobInfo.hxx"
37 #include "Batch_InvalidArgumentException.hxx"
38 #include "Batch_FactBatchManager.hxx"
39 #include "Batch_BatchManager.hxx"
40 using namespace std;
41
42 namespace Batch {
43
44   // Constructeur
45 //   BatchManager::BatchManager(string host) throw(InvalidArgumentException) : _hostname(host), jobid_map()
46 //   {
47 //     // On verifie que le hostname est correct
48 //     if (!gethostbyname(_hostname.c_str())) { // hostname unknown from network
49 //       string msg = "hostname \"";
50 //       msg += _hostname;
51 //       msg += "\" unknown from the network";
52 //       throw InvalidArgumentException(msg.c_str());
53 //     }
54 //   }
55   BatchManager::BatchManager(const FactBatchManager * parent, const char * host) throw(InvalidArgumentException) : _hostname(host), jobid_map(), _parent(parent)
56   {
57     // On verifie que le hostname est correct
58     if (!gethostbyname(_hostname.c_str())) { // hostname unknown from network
59       string msg = "hostname \"";
60       msg += _hostname;
61       msg += "\" unknown from the network";
62       throw InvalidArgumentException(msg.c_str());
63     }
64   }
65
66   // Destructeur
67   BatchManager::~BatchManager()
68   {
69     // Nothing to do
70   }
71
72   string BatchManager::__repr__() const
73   {
74     ostringstream oss;
75     oss << "<BatchManager of type '" << (_parent ? _parent->getType() : "unknown (no factory)") << "' connected to server '" << _hostname << "'>";
76     return oss.str();
77   }
78
79   // Recupere le l'identifiant d'un job deja soumis au BatchManager
80 //   const JobId BatchManager::getJobIdByReference(const string & ref)
81 //   {
82 //     return JobId(this, ref);
83 //   }
84   const JobId BatchManager::getJobIdByReference(const char * ref)
85   {
86     return JobId(this, ref);
87   }
88
89 //   // Methode pour le controle des jobs : soumet un job au gestionnaire
90 //   const JobId BatchManager::submitJob(const Job & job)
91 //   {
92 //     static int idx = 0;
93 //     //MEDMEM::STRING sst;
94 //     ostringstream sst;
95 //     sst << "Jobid_" << idx++;
96 //     JobId id(this, sst.str());
97 //     return id;
98 //   }
99
100 //   // Methode pour le controle des jobs : retire un job du gestionnaire
101 //   void BatchManager::deleteJob(const JobId & jobid)
102 //   {
103 //     // Nothing to do
104 //   }
105    
106 //   // Methode pour le controle des jobs : suspend un job en file d'attente
107 //   void BatchManager::holdJob(const JobId & jobid)
108 //   {
109 //     // Nothing to do
110 //   }
111
112 //   // Methode pour le controle des jobs : relache un job suspendu
113 //   void BatchManager::releaseJob(const JobId & jobid)
114 //   {
115 //     // Nothing to do
116 //   }
117
118 //   // Methode pour le controle des jobs : modifie un job en file d'attente
119 //   void BatchManager::alterJob(const JobId & jobid, const Parametre & param, const Environnement & env)
120 //   {
121 //     // Nothing to do
122 //   }
123
124 //   // Methode pour le controle des jobs : modifie un job en file d'attente
125 //   void BatchManager::alterJob(const JobId & jobid, const Parametre & param)
126 //   {
127 //     // Nothing to do
128 //   }
129
130 //   // Methode pour le controle des jobs : modifie un job en file d'attente
131 //   void BatchManager::alterJob(const JobId & jobid, const Environnement & env)
132 //   {
133 //     // Nothing to do
134 //   }
135
136 //   // Methode pour le controle des jobs : renvoie l'etat du job
137 //   JobInfo BatchManager::queryJob(const JobId & jobid)
138 //   {
139 //     return JobInfo();
140 //   }
141
142 }