1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 * BatchManager_Local_SH.cxx :
25 * Auteur : Ivan DUTKA-MALEN - EDF R&D
26 * Mail : mailto:ivan.dutka-malen@der.edf.fr
27 * Date : Thu Nov 6 10:17:22 2003
33 # include <SALOMEconfig.h>
40 #include <sys/types.h>
50 #include "Batch_IOMutex.hxx"
51 #include "Batch_BatchManager_Local_SH.hxx"
54 #error "RM undefined. You must set RM to a valid path to a rm-like command."
58 #error "CP undefined. You must set CP to a valid path to a cp-like command."
62 #error "SH undefined. You must set SH to a valid path to a sh-like command."
71 BatchManager_Local_SH::BatchManager_Local_SH(const FactBatchManager * parent, const char * host) throw(InvalidArgumentException,ConnexionFailureException) : BatchManager_Local(parent, host)
76 BatchManager_Local_SH::~BatchManager_Local_SH()
81 // Methode qui renvoie la commande de copie du fichier source en destination
82 string BatchManager_Local_SH::copy_command(const string & host_source, const string & source, const string & host_destination, const string & destination) const
84 ostringstream copy_cmd;
85 copy_cmd << CP << " " << source << " " << destination;
86 return copy_cmd.str();
89 // Methode qui renvoie la commande a executer
90 string BatchManager_Local_SH::exec_command(Parametre & param) const
92 ostringstream exec_sub_cmd;
93 exec_sub_cmd << param[EXECUTABLE];
95 if (param.find(ARGUMENTS) != param.end()) {
96 Versatile V = param[ARGUMENTS];
97 for(Versatile::const_iterator it=V.begin(); it!=V.end(); it++) {
98 StringType argt = * static_cast<StringType *>(*it);
100 exec_sub_cmd << " " << arg;
104 param[ARGUMENTS] = "-c";
105 param[ARGUMENTS] += exec_sub_cmd.str();
110 // Methode qui renvoie la commande d'effacement du fichier
111 string BatchManager_Local_SH::remove_command(const string & host_destination, const string & destination) const
113 ostringstream remove_cmd;
114 remove_cmd << RM << " " << destination;
115 return remove_cmd.str();