Salome HOME
Rename files:
authorbarate <barate>
Wed, 16 Jan 2013 17:26:31 +0000 (17:26 +0000)
committerbarate <barate>
Wed, 16 Jan 2013 17:26:31 +0000 (17:26 +0000)
- Remove prefix "Batch_" since headers are installed in their own directory "include/libbatch"
- Rename "eXXX" batch managers to "XXX"

259 files changed:
Batch_config.h.in [deleted file]
CMakeLists.txt
config.h.in [new file with mode: 0644]
misc/check_libbatch.m4
src/CCC/BatchManager_CCC.cxx [new file with mode: 0644]
src/CCC/BatchManager_CCC.hxx [new file with mode: 0644]
src/CCC/Batch_BatchManager_eCCC.cxx [deleted file]
src/CCC/Batch_BatchManager_eCCC.hxx [deleted file]
src/CCC/Batch_FactBatchManager_eCCC.cxx [deleted file]
src/CCC/Batch_FactBatchManager_eCCC.hxx [deleted file]
src/CCC/Batch_JobInfo_eCCC.cxx [deleted file]
src/CCC/Batch_JobInfo_eCCC.hxx [deleted file]
src/CCC/CMakeLists.txt
src/CCC/FactBatchManager_CCC.cxx [new file with mode: 0644]
src/CCC/FactBatchManager_CCC.hxx [new file with mode: 0644]
src/CCC/JobInfo_CCC.cxx [new file with mode: 0644]
src/CCC/JobInfo_CCC.hxx [new file with mode: 0644]
src/Core/APIInternalFailureException.cxx [new file with mode: 0644]
src/Core/APIInternalFailureException.hxx [new file with mode: 0644]
src/Core/BatchManager.cxx [new file with mode: 0644]
src/Core/BatchManager.hxx [new file with mode: 0644]
src/Core/BatchManagerCatalog.cxx [new file with mode: 0644]
src/Core/BatchManagerCatalog.hxx [new file with mode: 0644]
src/Core/Batch_APIInternalFailureException.cxx [deleted file]
src/Core/Batch_APIInternalFailureException.hxx [deleted file]
src/Core/Batch_BatchManager.cxx [deleted file]
src/Core/Batch_BatchManager.hxx [deleted file]
src/Core/Batch_BatchManagerCatalog.cxx [deleted file]
src/Core/Batch_BatchManagerCatalog.hxx [deleted file]
src/Core/Batch_BoolType.cxx [deleted file]
src/Core/Batch_BoolType.hxx [deleted file]
src/Core/Batch_CommunicationProtocol.cxx [deleted file]
src/Core/Batch_CommunicationProtocol.hxx [deleted file]
src/Core/Batch_CommunicationProtocolRSH.cxx [deleted file]
src/Core/Batch_CommunicationProtocolRSH.hxx [deleted file]
src/Core/Batch_CommunicationProtocolSH.cxx [deleted file]
src/Core/Batch_CommunicationProtocolSH.hxx [deleted file]
src/Core/Batch_CommunicationProtocolSSH.cxx [deleted file]
src/Core/Batch_CommunicationProtocolSSH.hxx [deleted file]
src/Core/Batch_Constants.cxx [deleted file]
src/Core/Batch_Constants.hxx [deleted file]
src/Core/Batch_Couple.cxx [deleted file]
src/Core/Batch_Couple.hxx [deleted file]
src/Core/Batch_CoupleType.cxx [deleted file]
src/Core/Batch_CoupleType.hxx [deleted file]
src/Core/Batch_Date.cxx [deleted file]
src/Core/Batch_Date.hxx [deleted file]
src/Core/Batch_Defines.hxx [deleted file]
src/Core/Batch_Environnement.cxx [deleted file]
src/Core/Batch_Environnement.hxx [deleted file]
src/Core/Batch_FactBatchManager.cxx [deleted file]
src/Core/Batch_FactBatchManager.hxx [deleted file]
src/Core/Batch_GenericException.cxx [deleted file]
src/Core/Batch_GenericException.hxx [deleted file]
src/Core/Batch_GenericType.cxx [deleted file]
src/Core/Batch_GenericType.hxx [deleted file]
src/Core/Batch_InvalidArgumentException.cxx [deleted file]
src/Core/Batch_InvalidArgumentException.hxx [deleted file]
src/Core/Batch_InvalidKeyException.cxx [deleted file]
src/Core/Batch_InvalidKeyException.hxx [deleted file]
src/Core/Batch_Job.cxx [deleted file]
src/Core/Batch_Job.hxx [deleted file]
src/Core/Batch_JobId.cxx [deleted file]
src/Core/Batch_JobId.hxx [deleted file]
src/Core/Batch_JobInfo.cxx [deleted file]
src/Core/Batch_JobInfo.hxx [deleted file]
src/Core/Batch_ListIsFullException.cxx [deleted file]
src/Core/Batch_ListIsFullException.hxx [deleted file]
src/Core/Batch_LongType.cxx [deleted file]
src/Core/Batch_LongType.hxx [deleted file]
src/Core/Batch_MpiImpl.cxx [deleted file]
src/Core/Batch_MpiImpl.hxx [deleted file]
src/Core/Batch_NotYetImplementedException.cxx [deleted file]
src/Core/Batch_NotYetImplementedException.hxx [deleted file]
src/Core/Batch_ParameterTypeMap.cxx [deleted file]
src/Core/Batch_ParameterTypeMap.hxx [deleted file]
src/Core/Batch_Parametre.cxx [deleted file]
src/Core/Batch_Parametre.hxx [deleted file]
src/Core/Batch_RunTimeException.cxx [deleted file]
src/Core/Batch_RunTimeException.hxx [deleted file]
src/Core/Batch_StringType.cxx [deleted file]
src/Core/Batch_StringType.hxx [deleted file]
src/Core/Batch_TypeMismatchException.cxx [deleted file]
src/Core/Batch_TypeMismatchException.hxx [deleted file]
src/Core/Batch_Utils.cxx [deleted file]
src/Core/Batch_Utils.hxx [deleted file]
src/Core/Batch_Versatile.cxx [deleted file]
src/Core/Batch_Versatile.hxx [deleted file]
src/Core/BoolType.cxx [new file with mode: 0644]
src/Core/BoolType.hxx [new file with mode: 0644]
src/Core/CMakeLists.txt
src/Core/CommunicationProtocol.cxx [new file with mode: 0644]
src/Core/CommunicationProtocol.hxx [new file with mode: 0644]
src/Core/CommunicationProtocolRSH.cxx [new file with mode: 0644]
src/Core/CommunicationProtocolRSH.hxx [new file with mode: 0644]
src/Core/CommunicationProtocolSH.cxx [new file with mode: 0644]
src/Core/CommunicationProtocolSH.hxx [new file with mode: 0644]
src/Core/CommunicationProtocolSSH.cxx [new file with mode: 0644]
src/Core/CommunicationProtocolSSH.hxx [new file with mode: 0644]
src/Core/Constants.cxx [new file with mode: 0644]
src/Core/Constants.hxx [new file with mode: 0644]
src/Core/Couple.cxx [new file with mode: 0644]
src/Core/Couple.hxx [new file with mode: 0644]
src/Core/CoupleType.cxx [new file with mode: 0644]
src/Core/CoupleType.hxx [new file with mode: 0644]
src/Core/Date.cxx [new file with mode: 0644]
src/Core/Date.hxx [new file with mode: 0644]
src/Core/Defines.hxx [new file with mode: 0644]
src/Core/Environnement.cxx [new file with mode: 0644]
src/Core/Environnement.hxx [new file with mode: 0644]
src/Core/FactBatchManager.cxx [new file with mode: 0644]
src/Core/FactBatchManager.hxx [new file with mode: 0644]
src/Core/GenericException.cxx [new file with mode: 0644]
src/Core/GenericException.hxx [new file with mode: 0644]
src/Core/GenericType.cxx [new file with mode: 0644]
src/Core/GenericType.hxx [new file with mode: 0644]
src/Core/InvalidArgumentException.cxx [new file with mode: 0644]
src/Core/InvalidArgumentException.hxx [new file with mode: 0644]
src/Core/InvalidKeyException.cxx [new file with mode: 0644]
src/Core/InvalidKeyException.hxx [new file with mode: 0644]
src/Core/Job.cxx [new file with mode: 0644]
src/Core/Job.hxx [new file with mode: 0644]
src/Core/JobId.cxx [new file with mode: 0644]
src/Core/JobId.hxx [new file with mode: 0644]
src/Core/JobInfo.cxx [new file with mode: 0644]
src/Core/JobInfo.hxx [new file with mode: 0644]
src/Core/ListIsFullException.cxx [new file with mode: 0644]
src/Core/ListIsFullException.hxx [new file with mode: 0644]
src/Core/LongType.cxx [new file with mode: 0644]
src/Core/LongType.hxx [new file with mode: 0644]
src/Core/MpiImpl.cxx [new file with mode: 0644]
src/Core/MpiImpl.hxx [new file with mode: 0644]
src/Core/NotYetImplementedException.cxx [new file with mode: 0644]
src/Core/NotYetImplementedException.hxx [new file with mode: 0644]
src/Core/ParameterTypeMap.cxx [new file with mode: 0644]
src/Core/ParameterTypeMap.hxx [new file with mode: 0644]
src/Core/Parametre.cxx [new file with mode: 0644]
src/Core/Parametre.hxx [new file with mode: 0644]
src/Core/RunTimeException.cxx [new file with mode: 0644]
src/Core/RunTimeException.hxx [new file with mode: 0644]
src/Core/StringType.cxx [new file with mode: 0644]
src/Core/StringType.hxx [new file with mode: 0644]
src/Core/Test/Test_BatchManager.cxx
src/Core/TypeMismatchException.cxx [new file with mode: 0644]
src/Core/TypeMismatchException.hxx [new file with mode: 0644]
src/Core/Utils.cxx [new file with mode: 0644]
src/Core/Utils.hxx [new file with mode: 0644]
src/Core/Versatile.cxx [new file with mode: 0644]
src/Core/Versatile.hxx [new file with mode: 0644]
src/LSF/BatchManager_LSF.cxx [new file with mode: 0644]
src/LSF/BatchManager_LSF.hxx [new file with mode: 0644]
src/LSF/Batch_BatchManager_eLSF.cxx [deleted file]
src/LSF/Batch_BatchManager_eLSF.hxx [deleted file]
src/LSF/Batch_FactBatchManager_eLSF.cxx [deleted file]
src/LSF/Batch_FactBatchManager_eLSF.hxx [deleted file]
src/LSF/Batch_JobInfo_eLSF.cxx [deleted file]
src/LSF/Batch_JobInfo_eLSF.hxx [deleted file]
src/LSF/CMakeLists.txt
src/LSF/FactBatchManager_LSF.cxx [new file with mode: 0644]
src/LSF/FactBatchManager_LSF.hxx [new file with mode: 0644]
src/LSF/JobInfo_LSF.cxx [new file with mode: 0644]
src/LSF/JobInfo_LSF.hxx [new file with mode: 0644]
src/LoadLeveler/BatchManager_LL.cxx [new file with mode: 0644]
src/LoadLeveler/BatchManager_LL.hxx [new file with mode: 0644]
src/LoadLeveler/Batch_BatchManager_eLL.cxx [deleted file]
src/LoadLeveler/Batch_BatchManager_eLL.hxx [deleted file]
src/LoadLeveler/Batch_FactBatchManager_eLL.cxx [deleted file]
src/LoadLeveler/Batch_FactBatchManager_eLL.hxx [deleted file]
src/LoadLeveler/Batch_JobInfo_eLL.cxx [deleted file]
src/LoadLeveler/Batch_JobInfo_eLL.hxx [deleted file]
src/LoadLeveler/CMakeLists.txt
src/LoadLeveler/FactBatchManager_LL.cxx [new file with mode: 0644]
src/LoadLeveler/FactBatchManager_LL.hxx [new file with mode: 0644]
src/LoadLeveler/JobInfo_LL.cxx [new file with mode: 0644]
src/LoadLeveler/JobInfo_LL.hxx [new file with mode: 0644]
src/LoadLeveler/Test/CMakeLists.txt
src/LoadLeveler/Test/Test_LL.cxx [new file with mode: 0644]
src/LoadLeveler/Test/Test_eLL.cxx [deleted file]
src/Local/BatchManager_Local.cxx [new file with mode: 0644]
src/Local/BatchManager_Local.hxx [new file with mode: 0644]
src/Local/Batch_BatchManager_Local.cxx [deleted file]
src/Local/Batch_BatchManager_Local.hxx [deleted file]
src/Local/Batch_FactBatchManager_Local.cxx [deleted file]
src/Local/Batch_FactBatchManager_Local.hxx [deleted file]
src/Local/Batch_IOMutex.cxx [deleted file]
src/Local/Batch_IOMutex.hxx [deleted file]
src/Local/Batch_JobInfo_Local.cxx [deleted file]
src/Local/Batch_JobInfo_Local.hxx [deleted file]
src/Local/Batch_Job_Local.cxx [deleted file]
src/Local/Batch_Job_Local.hxx [deleted file]
src/Local/CMakeLists.txt
src/Local/FactBatchManager_Local.cxx [new file with mode: 0644]
src/Local/FactBatchManager_Local.hxx [new file with mode: 0644]
src/Local/IOMutex.cxx [new file with mode: 0644]
src/Local/IOMutex.hxx [new file with mode: 0644]
src/Local/JobInfo_Local.cxx [new file with mode: 0644]
src/Local/JobInfo_Local.hxx [new file with mode: 0644]
src/Local/Job_Local.cxx [new file with mode: 0644]
src/Local/Job_Local.hxx [new file with mode: 0644]
src/Local/Test/Test_Local_RSH.cxx
src/Local/Test/Test_Local_SH.cxx
src/Local/Test/Test_Local_SSH.cxx
src/PBS/BatchManager_PBS.cxx [new file with mode: 0644]
src/PBS/BatchManager_PBS.hxx [new file with mode: 0644]
src/PBS/Batch_BatchManager_ePBS.cxx [deleted file]
src/PBS/Batch_BatchManager_ePBS.hxx [deleted file]
src/PBS/Batch_FactBatchManager_ePBS.cxx [deleted file]
src/PBS/Batch_FactBatchManager_ePBS.hxx [deleted file]
src/PBS/Batch_JobInfo_ePBS.cxx [deleted file]
src/PBS/Batch_JobInfo_ePBS.hxx [deleted file]
src/PBS/CMakeLists.txt
src/PBS/FactBatchManager_PBS.cxx [new file with mode: 0644]
src/PBS/FactBatchManager_PBS.hxx [new file with mode: 0644]
src/PBS/JobInfo_PBS.cxx [new file with mode: 0644]
src/PBS/JobInfo_PBS.hxx [new file with mode: 0644]
src/PBS/Test/CMakeLists.txt
src/PBS/Test/Test_PBS.cxx [new file with mode: 0644]
src/PBS/Test/Test_ePBS.cxx [deleted file]
src/Python/libBatch_Swig.i
src/Python/libBatch_Swig_typemap.i
src/SGE/BatchManager_SGE.cxx [new file with mode: 0644]
src/SGE/BatchManager_SGE.hxx [new file with mode: 0644]
src/SGE/Batch_BatchManager_eSGE.cxx [deleted file]
src/SGE/Batch_BatchManager_eSGE.hxx [deleted file]
src/SGE/Batch_FactBatchManager_eSGE.cxx [deleted file]
src/SGE/Batch_FactBatchManager_eSGE.hxx [deleted file]
src/SGE/Batch_JobInfo_eSGE.cxx [deleted file]
src/SGE/Batch_JobInfo_eSGE.hxx [deleted file]
src/SGE/CMakeLists.txt
src/SGE/FactBatchManager_SGE.cxx [new file with mode: 0644]
src/SGE/FactBatchManager_SGE.hxx [new file with mode: 0644]
src/SGE/JobInfo_SGE.cxx [new file with mode: 0644]
src/SGE/JobInfo_SGE.hxx [new file with mode: 0644]
src/Slurm/BatchManager_Slurm.cxx [new file with mode: 0644]
src/Slurm/BatchManager_Slurm.hxx [new file with mode: 0644]
src/Slurm/Batch_BatchManager_eSlurm.cxx [deleted file]
src/Slurm/Batch_BatchManager_eSlurm.hxx [deleted file]
src/Slurm/Batch_FactBatchManager_eSlurm.cxx [deleted file]
src/Slurm/Batch_FactBatchManager_eSlurm.hxx [deleted file]
src/Slurm/Batch_JobInfo_eSlurm.cxx [deleted file]
src/Slurm/Batch_JobInfo_eSlurm.hxx [deleted file]
src/Slurm/CMakeLists.txt
src/Slurm/FactBatchManager_Slurm.cxx [new file with mode: 0644]
src/Slurm/FactBatchManager_Slurm.hxx [new file with mode: 0644]
src/Slurm/JobInfo_Slurm.cxx [new file with mode: 0644]
src/Slurm/JobInfo_Slurm.hxx [new file with mode: 0644]
src/Vishnu/BatchManager_Vishnu.cxx [new file with mode: 0644]
src/Vishnu/BatchManager_Vishnu.hxx [new file with mode: 0644]
src/Vishnu/Batch_BatchManager_eVishnu.cxx [deleted file]
src/Vishnu/Batch_BatchManager_eVishnu.hxx [deleted file]
src/Vishnu/Batch_FactBatchManager_eVishnu.cxx [deleted file]
src/Vishnu/Batch_FactBatchManager_eVishnu.hxx [deleted file]
src/Vishnu/Batch_JobInfo_eVishnu.cxx [deleted file]
src/Vishnu/Batch_JobInfo_eVishnu.hxx [deleted file]
src/Vishnu/CMakeLists.txt
src/Vishnu/FactBatchManager_Vishnu.cxx [new file with mode: 0644]
src/Vishnu/FactBatchManager_Vishnu.hxx [new file with mode: 0644]
src/Vishnu/JobInfo_Vishnu.cxx [new file with mode: 0644]
src/Vishnu/JobInfo_Vishnu.hxx [new file with mode: 0644]

diff --git a/Batch_config.h.in b/Batch_config.h.in
deleted file mode 100644 (file)
index 83fdacf..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-
-#ifndef BATCH_CONFIG_H
-#define BATCH_CONFIG_H
-
-/* Defines the compiler used on Windows */
-#cmakedefine MSVC
-#cmakedefine MINGW
-
-/* SH tools (sh, cp, rm, mkdir) found on the system */
-#cmakedefine HAS_SH
-
-/* A path to a sh-like command */
-#cmakedefine SH_COMMAND "@SH_COMMAND@"
-
-/* A path to a rm-like command */
-#cmakedefine RM_COMMAND "@RM_COMMAND@"
-
-/* A path to a cp-like command */
-#cmakedefine CP_COMMAND "@CP_COMMAND@"
-
-/* A path to a mkdir-like command */
-#cmakedefine MKDIR_COMMAND "@MKDIR_COMMAND@"
-
-/* RSH tools (rsh, rcp) found on the system */
-#cmakedefine HAS_RSH
-
-/* A path to a rsh-like command */
-#cmakedefine RSH_COMMAND "@RSH_COMMAND@"
-
-/* A path to a rcp-like command */
-#cmakedefine RCP_COMMAND "@RCP_COMMAND@"
-
-/* SSH tools (ssh, scp) found on the system */
-#cmakedefine HAS_SSH
-
-/* A path to a ssh-like command */
-#cmakedefine SSH_COMMAND "@SSH_COMMAND@"
-
-/* A path to a scp-like command */
-#cmakedefine SCP_COMMAND "@SCP_COMMAND@"
-
-#endif
index 2a590c5295761fa0a7d1ada33dc521fe4f37ad8d..f671fce3c71b4d3ffbc9d772f2e2f116f9ed0567 100644 (file)
@@ -54,7 +54,7 @@ SET(CPACK_SOURCE_IGNORE_FILES /\\\\.;/CVS/;~)
 SET(CPACK_SOURCE_PACKAGE_FILE_NAME
     ${PROJECT_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH})
 
-configure_file (${CMAKE_CURRENT_SOURCE_DIR}/Batch_config.h.in ${CMAKE_CURRENT_BINARY_DIR}/Batch_config.h)
+configure_file (${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
 
 INCLUDE(Summary)
 
diff --git a/config.h.in b/config.h.in
new file mode 100644 (file)
index 0000000..83fdacf
--- /dev/null
@@ -0,0 +1,63 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef BATCH_CONFIG_H
+#define BATCH_CONFIG_H
+
+/* Defines the compiler used on Windows */
+#cmakedefine MSVC
+#cmakedefine MINGW
+
+/* SH tools (sh, cp, rm, mkdir) found on the system */
+#cmakedefine HAS_SH
+
+/* A path to a sh-like command */
+#cmakedefine SH_COMMAND "@SH_COMMAND@"
+
+/* A path to a rm-like command */
+#cmakedefine RM_COMMAND "@RM_COMMAND@"
+
+/* A path to a cp-like command */
+#cmakedefine CP_COMMAND "@CP_COMMAND@"
+
+/* A path to a mkdir-like command */
+#cmakedefine MKDIR_COMMAND "@MKDIR_COMMAND@"
+
+/* RSH tools (rsh, rcp) found on the system */
+#cmakedefine HAS_RSH
+
+/* A path to a rsh-like command */
+#cmakedefine RSH_COMMAND "@RSH_COMMAND@"
+
+/* A path to a rcp-like command */
+#cmakedefine RCP_COMMAND "@RCP_COMMAND@"
+
+/* SSH tools (ssh, scp) found on the system */
+#cmakedefine HAS_SSH
+
+/* A path to a ssh-like command */
+#cmakedefine SSH_COMMAND "@SSH_COMMAND@"
+
+/* A path to a scp-like command */
+#cmakedefine SCP_COMMAND "@SCP_COMMAND@"
+
+#endif
index 4e678874554a292b3a1f9a4fe9f10235bfb31551..bd2dd2b99062b9a47f94129c84d02195f0369a6d 100644 (file)
@@ -72,7 +72,7 @@ fi
 
 CPPFLAGS_old="$CPPFLAGS"
 CPPFLAGS="$CPPFLAGS $LOCAL_INCLUDES"
-AC_CHECK_HEADER(libbatch/Batch_BatchManager.hxx,
+AC_CHECK_HEADER(libbatch/BatchManager.hxx,
                                libbatch_ok="yes",
                                libbatch_ok="no")
 CPPFLAGS="$CPPFLAGS_old"
diff --git a/src/CCC/BatchManager_CCC.cxx b/src/CCC/BatchManager_CCC.cxx
new file mode 100644 (file)
index 0000000..1403704
--- /dev/null
@@ -0,0 +1,330 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * BatchManager_CCC.cxx : emulation of CCC client for CCRT machines
+ *
+ * Auteur : Bernard SECHER - CEA DEN
+ * Mail   : mailto:bernard.secher@cea.fr
+ * Date   : Thu Apr 24 10:17:22 2010
+ * Projet : PAL Salome
+ *
+ */
+
+#include <stdlib.h>
+#include <string.h>
+
+#include <iostream>
+#include <fstream>
+#include <sstream>
+#include <string>
+#include <sys/stat.h>
+
+#include <stdlib.h>
+#include <string.h>
+
+#ifdef WIN32
+#include <io.h>
+#else
+#include <libgen.h>
+#endif
+
+#include <Constants.hxx>
+#include <NotYetImplementedException.hxx>
+#include <Utils.hxx>
+
+#include "BatchManager_CCC.hxx"
+#include "JobInfo_CCC.hxx"
+
+using namespace std;
+
+namespace Batch {
+
+  BatchManager_CCC::BatchManager_CCC(const FactBatchManager * parent, const char * host,
+                                       const char * username,
+                                       CommunicationProtocolType protocolType, const char * mpiImpl)
+  : BatchManager(parent, host, username, protocolType, mpiImpl)
+  {
+    // Nothing to do
+  }
+
+  // Destructeur
+  BatchManager_CCC::~BatchManager_CCC()
+  {
+    // Nothing to do
+  }
+
+  // Methode pour le controle des jobs : soumet un job au gestionnaire
+  const JobId BatchManager_CCC::submitJob(const Job & job)
+  {
+    Parametre params = job.getParametre();
+    const std::string workDir = params[WORKDIR];
+    const string fileToExecute = params[EXECUTABLE];
+    string::size_type p1 = fileToExecute.find_last_of("/");
+    string::size_type p2 = fileToExecute.find_last_of(".");
+    std::string fileNameToExecute = fileToExecute.substr(p1+1,p2-p1-1);
+
+    // export input files on cluster
+    cerr << "Export des fichiers en entree" << endl;
+    exportInputFiles(job);
+
+    // build batch script for job
+    cerr << "Construction du script de batch" << endl;
+    buildBatchScript(job);
+    cerr << "Script envoye" << endl;
+
+    // define command to submit batch
+    string subCommand = string("bash -l -c \\\"cd ") + workDir + "; ccc_msub " + fileNameToExecute + "_Batch.sh\\\"";
+    string command = _protocol.getExecCommand(subCommand, _hostname, _username);
+    command += " 2>&1";
+    cerr << command.c_str() << endl;
+
+    // submit job
+    string output;
+    int status = Utils::getCommandOutput(command, output);
+    cout << output;
+    if (status != 0) throw RunTimeException("Can't submit job, error was: " + output);
+
+    // find id of submitted job in output
+    istringstream idfile(output);
+    string sidj;
+    idfile >> sidj;
+    idfile >> sidj;
+    idfile >> sidj;
+    idfile >> sidj;
+    if (sidj.size() == 0)
+      throw RunTimeException("Error in the submission of the job on the remote host");
+
+    JobId id(this, sidj);
+    return id;
+  }
+
+  // Ce manager permet de faire de la reprise
+  const Batch::JobId
+  BatchManager_CCC::addJob(const Batch::Job & job, const std::string reference)
+  {
+    return JobId(this, reference);
+  }
+
+  // Methode pour le controle des jobs : retire un job du gestionnaire
+  void BatchManager_CCC::deleteJob(const JobId & jobid)
+  {
+    int status;
+    int ref;
+    istringstream iss(jobid.getReference());
+    iss >> ref;
+
+    // define command to delete batch
+    string subCommand = string("bash -l -c \\\"ccc_mdel ") + iss.str() + string("\\\"");
+    string command = _protocol.getExecCommand(subCommand, _hostname, _username);
+    cerr << command.c_str() << endl;
+    status = system(command.c_str());
+    if (status)
+      throw RunTimeException("Error of connection on remote host");
+
+    cerr << "jobId = " << ref << "killed" << endl;
+  }
+
+  // Methode pour le controle des jobs : suspend un job en file d'attente
+  void BatchManager_CCC::holdJob(const JobId & jobid)
+  {
+    throw NotYetImplementedException("BatchManager_CCC::holdJob");
+  }
+
+  // Methode pour le controle des jobs : relache un job suspendu
+  void BatchManager_CCC::releaseJob(const JobId & jobid)
+  {
+    throw NotYetImplementedException("BatchManager_CCC::releaseJob");
+  }
+
+
+  // Methode pour le controle des jobs : modifie un job en file d'attente
+  void BatchManager_CCC::alterJob(const JobId & jobid, const Parametre & param, const Environnement & env)
+  {
+    throw NotYetImplementedException("BatchManager_CCC::alterJob");
+  }
+
+  // Methode pour le controle des jobs : modifie un job en file d'attente
+  void BatchManager_CCC::alterJob(const JobId & jobid, const Parametre & param)
+  {
+    alterJob(jobid, param, Environnement());
+  }
+
+  // Methode pour le controle des jobs : modifie un job en file d'attente
+  void BatchManager_CCC::alterJob(const JobId & jobid, const Environnement & env)
+  {
+    alterJob(jobid, Parametre(), env);
+  }
+
+  // Methode pour le controle des jobs : renvoie l'etat du job
+  JobInfo BatchManager_CCC::queryJob(const JobId & jobid)
+  {
+    int id;
+    istringstream iss(jobid.getReference());
+    iss >> id;
+
+    // define command to query batch
+    string subCommand = string("bash -l -c \\\"bjobs ") + iss.str() + string("\\\"");
+    string command = _protocol.getExecCommand(subCommand, _hostname, _username);
+    cerr << command.c_str() << endl;
+
+    string output;
+    int status = Utils::getCommandOutput(command, output);
+    if (status)
+      throw RunTimeException("Error of connection on remote host");
+
+    JobInfo_CCC ji = JobInfo_CCC(id, output);
+    return ji;
+  }
+
+
+
+  // Methode pour le controle des jobs : teste si un job est present en machine
+  bool BatchManager_CCC::isRunning(const JobId & jobid)
+  {
+    throw NotYetImplementedException("BatchManager_CCC::isRunning");
+  }
+
+  void BatchManager_CCC::buildBatchScript(const Job & job)
+  {
+#ifndef WIN32 //TODO: need for porting on Windows
+    Parametre params = job.getParametre();
+
+    // Job Parameters
+    string workDir       = "";
+    string fileToExecute = "";
+    int nbproc          = 0;
+    int edt             = 0;
+    int mem              = 0;
+    string queue         = "";
+
+    // Mandatory parameters
+    if (params.find(WORKDIR) != params.end()) 
+      workDir = params[WORKDIR].str();
+    else 
+      throw RunTimeException("params[WORKDIR] is not defined ! Please defined it, cannot submit this job");
+    if (params.find(EXECUTABLE) != params.end()) 
+      fileToExecute = params[EXECUTABLE].str();
+    else 
+      throw RunTimeException("params[EXECUTABLE] is not defined ! Please defined it, cannot submit this job");
+
+    // Optional parameters
+    if (params.find(NBPROC) != params.end()) 
+      nbproc = params[NBPROC];
+    if (params.find(MAXWALLTIME) != params.end()) 
+      edt = (long)params[MAXWALLTIME] * 60;
+    if (params.find(MAXRAMSIZE) != params.end()) 
+      mem = params[MAXRAMSIZE];
+    if (params.find(QUEUE) != params.end()) 
+      queue = params[QUEUE].str();
+
+    string::size_type p1 = fileToExecute.find_last_of("/");
+    string::size_type p2 = fileToExecute.find_last_of(".");
+    string rootNameToExecute = fileToExecute.substr(p1+1,p2-p1-1);
+    string fileNameToExecute = fileToExecute.substr(p1+1);
+    // Create batch submit file
+    ofstream tempOutputFile;
+    std::string TmpFileName = Utils::createAndOpenTemporaryFile("LSF-script", tempOutputFile);
+
+    tempOutputFile << "#!/bin/bash" << endl ;
+    if (queue != "")
+      tempOutputFile << "#MSUB -q " << queue << endl;
+    if( edt > 0 )
+      tempOutputFile << "#MSUB -T " << edt << endl ;
+    if( mem > 0 )
+      tempOutputFile << "#MSUB -M " << mem << endl ;
+    tempOutputFile << "#MSUB -n " << nbproc << endl ;
+    size_t pos = workDir.find("$HOME");
+    string baseDir;
+    if( pos != string::npos )
+      baseDir = getHomeDir(workDir) + workDir.substr(pos+5,workDir.length()-5);
+    else{
+      pos = workDir.find("~");
+      if( pos != string::npos )
+       baseDir = getHomeDir(workDir) + workDir.substr(pos+1,workDir.length()-1);
+      else
+       baseDir = workDir;
+    }
+    tempOutputFile << "#MSUB -o " << baseDir << "/logs/output.log." << rootNameToExecute << endl ;
+    tempOutputFile << "#MSUB -e " << baseDir << "/logs/error.log." << rootNameToExecute << endl ;
+
+    tempOutputFile << "cd " << workDir << endl ;
+
+    // generate nodes file
+    tempOutputFile << "bool=0" << endl;
+    tempOutputFile << "for i in $LSB_MCPU_HOSTS; do" << endl;
+    tempOutputFile << "  if test $bool = 0; then" << endl;
+    tempOutputFile << "    n=$i" << endl;
+    tempOutputFile << "    bool=1" << endl;
+    tempOutputFile << "  else" << endl;
+    tempOutputFile << "    for ((j=0;j<$i;j++)); do" << endl;
+    tempOutputFile << "      echo $n >> nodesFile." << rootNameToExecute << endl;
+    tempOutputFile << "    done" << endl;
+    tempOutputFile << "    bool=0" << endl;
+    tempOutputFile << "  fi" << endl;
+    tempOutputFile << "done" << endl;
+
+    // Abstraction of PBS_NODEFILE - TODO
+    tempOutputFile << "export LIBBATCH_NODEFILE=nodesFile." << rootNameToExecute << endl;
+
+    // Allow resource sharing in CCRT nodes
+    tempOutputFile << "export OMPI_MCA_orte_process_binding=none" << endl;
+
+    // Launch the executable
+    tempOutputFile << "./" + fileNameToExecute << endl;
+    tempOutputFile.flush();
+    tempOutputFile.close();
+
+    BATCH_CHMOD(TmpFileName.c_str(), 0x1ED);
+    cerr << "Batch script file generated is: " << TmpFileName.c_str() << endl;
+
+    int status = _protocol.copyFile(TmpFileName, "", "",
+                                    workDir + "/" + rootNameToExecute + "_Batch.sh",
+                                    _hostname, _username);
+    if (status)
+      throw RunTimeException("Error of connection on remote host");
+
+#endif
+
+  }
+
+  std::string BatchManager_CCC::getHomeDir(std::string tmpdir)
+  {
+    std::string home;
+
+    string subCommand = string("echo ");
+    subCommand += tmpdir;
+    string command = _protocol.getExecCommand(subCommand, _hostname, _username);
+    cerr << command.c_str() << endl;
+
+    string output;
+    int status = Utils::getCommandOutput(command, output);
+
+    if (status)
+      throw RunTimeException("Error of launching home command on remote host");
+
+    std::istringstream file_home(output);
+    std::getline(file_home, home);
+    return home;
+  }
+
+}
diff --git a/src/CCC/BatchManager_CCC.hxx b/src/CCC/BatchManager_CCC.hxx
new file mode 100644 (file)
index 0000000..b3dcf91
--- /dev/null
@@ -0,0 +1,90 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * BatchManager_CCC.hxx : emulation of CCC client for CCRT machines
+ *
+ * Auteur : Bernard SECHER - CEA DEN
+ * Mail   : mailto:bernard.secher@cea.fr
+ * Date   : Thu Apr 24 10:17:22 2010
+ * Projet : PAL Salome
+ *
+ */
+
+#ifndef _BATCHMANAGER_ECCC_H_
+#define _BATCHMANAGER_ECCC_H_
+
+#include "Defines.hxx"
+#include "JobId.hxx"
+#include "JobInfo.hxx"
+#include "FactBatchManager.hxx"
+#include "BatchManager.hxx"
+
+namespace Batch {
+
+  class BATCH_EXPORT BatchManager_CCC : public BatchManager
+  {
+  public:
+    // Constructeur et destructeur
+    BatchManager_CCC(const FactBatchManager * parent, const char * host="localhost",
+                      const char * username="",
+                      CommunicationProtocolType protocolType = SSH, const char * mpiImpl="nompi"); // connexion a la machine host
+    virtual ~BatchManager_CCC();
+
+    // Recupere le nom du serveur par defaut
+    // static string BatchManager_LSF::getDefaultServer();
+
+    // Methodes pour le controle des jobs
+    virtual const JobId submitJob(const Job & job); // soumet un job au gestionnaire
+    virtual void deleteJob(const JobId & jobid); // retire un job du gestionnaire
+    virtual void holdJob(const JobId & jobid); // suspend un job en file d'attente
+    virtual void releaseJob(const JobId & jobid); // relache un job suspendu
+    virtual void alterJob(const JobId & jobid, const Parametre & param, const Environnement & env); // modifie un job en file d'attente
+    virtual void alterJob(const JobId & jobid, const Parametre & param); // modifie un job en file d'attente
+    virtual void alterJob(const JobId & jobid, const Environnement & env); // modifie un job en file d'attente
+    virtual JobInfo queryJob(const JobId & jobid); // renvoie l'etat du job
+    virtual bool isRunning(const JobId & jobid); // teste si un job est present en machine
+
+    virtual void setParametre(const JobId & jobid, const Parametre & param) { return alterJob(jobid, param); } // modifie un job en file d'attente
+    virtual void setEnvironnement(const JobId & jobid, const Environnement & env) { return alterJob(jobid, env); } // modifie un job en file d'attente
+
+    virtual const Batch::JobId addJob(const Batch::Job & job, const std::string reference); // ajoute un nouveau job sans le soumettre
+
+  protected:
+    void buildBatchScript(const Job & job);
+    std::string getWallTime(const long edt);
+
+  private:
+
+    std::string getHomeDir(std::string tmpdir);
+
+#ifdef SWIG
+  public:
+    // Recupere le l'identifiant d'un job deja soumis au BatchManager
+    //virtual const JobId getJobIdByReference(const string & ref) { return BatchManager::getJobIdByReference(ref); }
+    virtual const JobId getJobIdByReference(const char * ref) { return BatchManager::getJobIdByReference(ref); }
+#endif
+
+  };
+
+}
+
+#endif
diff --git a/src/CCC/Batch_BatchManager_eCCC.cxx b/src/CCC/Batch_BatchManager_eCCC.cxx
deleted file mode 100644 (file)
index 0d8f509..0000000
+++ /dev/null
@@ -1,330 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * BatchManager_eCCC.cxx : emulation of CCC client for CCRT machines
- *
- * Auteur : Bernard SECHER - CEA DEN
- * Mail   : mailto:bernard.secher@cea.fr
- * Date   : Thu Apr 24 10:17:22 2010
- * Projet : PAL Salome
- *
- */
-
-#include <stdlib.h>
-#include <string.h>
-
-#include <iostream>
-#include <fstream>
-#include <sstream>
-#include <string>
-#include <sys/stat.h>
-
-#include <stdlib.h>
-#include <string.h>
-
-#ifdef WIN32
-#include <io.h>
-#else
-#include <libgen.h>
-#endif
-
-#include <Batch_Constants.hxx>
-#include <Batch_NotYetImplementedException.hxx>
-#include <Batch_Utils.hxx>
-
-#include "Batch_BatchManager_eCCC.hxx"
-#include "Batch_JobInfo_eCCC.hxx"
-
-using namespace std;
-
-namespace Batch {
-
-  BatchManager_eCCC::BatchManager_eCCC(const FactBatchManager * parent, const char * host,
-                                       const char * username,
-                                       CommunicationProtocolType protocolType, const char * mpiImpl)
-  : BatchManager(parent, host, username, protocolType, mpiImpl)
-  {
-    // Nothing to do
-  }
-
-  // Destructeur
-  BatchManager_eCCC::~BatchManager_eCCC()
-  {
-    // Nothing to do
-  }
-
-  // Methode pour le controle des jobs : soumet un job au gestionnaire
-  const JobId BatchManager_eCCC::submitJob(const Job & job)
-  {
-    Parametre params = job.getParametre();
-    const std::string workDir = params[WORKDIR];
-    const string fileToExecute = params[EXECUTABLE];
-    string::size_type p1 = fileToExecute.find_last_of("/");
-    string::size_type p2 = fileToExecute.find_last_of(".");
-    std::string fileNameToExecute = fileToExecute.substr(p1+1,p2-p1-1);
-
-    // export input files on cluster
-    cerr << "Export des fichiers en entree" << endl;
-    exportInputFiles(job);
-
-    // build batch script for job
-    cerr << "Construction du script de batch" << endl;
-    buildBatchScript(job);
-    cerr << "Script envoye" << endl;
-
-    // define command to submit batch
-    string subCommand = string("bash -l -c \\\"cd ") + workDir + "; ccc_msub " + fileNameToExecute + "_Batch.sh\\\"";
-    string command = _protocol.getExecCommand(subCommand, _hostname, _username);
-    command += " 2>&1";
-    cerr << command.c_str() << endl;
-
-    // submit job
-    string output;
-    int status = Utils::getCommandOutput(command, output);
-    cout << output;
-    if (status != 0) throw RunTimeException("Can't submit job, error was: " + output);
-
-    // find id of submitted job in output
-    istringstream idfile(output);
-    string sidj;
-    idfile >> sidj;
-    idfile >> sidj;
-    idfile >> sidj;
-    idfile >> sidj;
-    if (sidj.size() == 0)
-      throw RunTimeException("Error in the submission of the job on the remote host");
-
-    JobId id(this, sidj);
-    return id;
-  }
-
-  // Ce manager permet de faire de la reprise
-  const Batch::JobId
-  BatchManager_eCCC::addJob(const Batch::Job & job, const std::string reference)
-  {
-    return JobId(this, reference);
-  }
-
-  // Methode pour le controle des jobs : retire un job du gestionnaire
-  void BatchManager_eCCC::deleteJob(const JobId & jobid)
-  {
-    int status;
-    int ref;
-    istringstream iss(jobid.getReference());
-    iss >> ref;
-
-    // define command to delete batch
-    string subCommand = string("bash -l -c \\\"ccc_mdel ") + iss.str() + string("\\\"");
-    string command = _protocol.getExecCommand(subCommand, _hostname, _username);
-    cerr << command.c_str() << endl;
-    status = system(command.c_str());
-    if (status)
-      throw RunTimeException("Error of connection on remote host");
-
-    cerr << "jobId = " << ref << "killed" << endl;
-  }
-
-  // Methode pour le controle des jobs : suspend un job en file d'attente
-  void BatchManager_eCCC::holdJob(const JobId & jobid)
-  {
-    throw NotYetImplementedException("BatchManager_eCCC::holdJob");
-  }
-
-  // Methode pour le controle des jobs : relache un job suspendu
-  void BatchManager_eCCC::releaseJob(const JobId & jobid)
-  {
-    throw NotYetImplementedException("BatchManager_eCCC::releaseJob");
-  }
-
-
-  // Methode pour le controle des jobs : modifie un job en file d'attente
-  void BatchManager_eCCC::alterJob(const JobId & jobid, const Parametre & param, const Environnement & env)
-  {
-    throw NotYetImplementedException("BatchManager_eCCC::alterJob");
-  }
-
-  // Methode pour le controle des jobs : modifie un job en file d'attente
-  void BatchManager_eCCC::alterJob(const JobId & jobid, const Parametre & param)
-  {
-    alterJob(jobid, param, Environnement());
-  }
-
-  // Methode pour le controle des jobs : modifie un job en file d'attente
-  void BatchManager_eCCC::alterJob(const JobId & jobid, const Environnement & env)
-  {
-    alterJob(jobid, Parametre(), env);
-  }
-
-  // Methode pour le controle des jobs : renvoie l'etat du job
-  JobInfo BatchManager_eCCC::queryJob(const JobId & jobid)
-  {
-    int id;
-    istringstream iss(jobid.getReference());
-    iss >> id;
-
-    // define command to query batch
-    string subCommand = string("bash -l -c \\\"bjobs ") + iss.str() + string("\\\"");
-    string command = _protocol.getExecCommand(subCommand, _hostname, _username);
-    cerr << command.c_str() << endl;
-
-    string output;
-    int status = Utils::getCommandOutput(command, output);
-    if (status)
-      throw RunTimeException("Error of connection on remote host");
-
-    JobInfo_eCCC ji = JobInfo_eCCC(id, output);
-    return ji;
-  }
-
-
-
-  // Methode pour le controle des jobs : teste si un job est present en machine
-  bool BatchManager_eCCC::isRunning(const JobId & jobid)
-  {
-    throw NotYetImplementedException("BatchManager_eCCC::isRunning");
-  }
-
-  void BatchManager_eCCC::buildBatchScript(const Job & job)
-  {
-#ifndef WIN32 //TODO: need for porting on Windows
-    Parametre params = job.getParametre();
-
-    // Job Parameters
-    string workDir       = "";
-    string fileToExecute = "";
-    int nbproc          = 0;
-    int edt             = 0;
-    int mem              = 0;
-    string queue         = "";
-
-    // Mandatory parameters
-    if (params.find(WORKDIR) != params.end()) 
-      workDir = params[WORKDIR].str();
-    else 
-      throw RunTimeException("params[WORKDIR] is not defined ! Please defined it, cannot submit this job");
-    if (params.find(EXECUTABLE) != params.end()) 
-      fileToExecute = params[EXECUTABLE].str();
-    else 
-      throw RunTimeException("params[EXECUTABLE] is not defined ! Please defined it, cannot submit this job");
-
-    // Optional parameters
-    if (params.find(NBPROC) != params.end()) 
-      nbproc = params[NBPROC];
-    if (params.find(MAXWALLTIME) != params.end()) 
-      edt = (long)params[MAXWALLTIME] * 60;
-    if (params.find(MAXRAMSIZE) != params.end()) 
-      mem = params[MAXRAMSIZE];
-    if (params.find(QUEUE) != params.end()) 
-      queue = params[QUEUE].str();
-
-    string::size_type p1 = fileToExecute.find_last_of("/");
-    string::size_type p2 = fileToExecute.find_last_of(".");
-    string rootNameToExecute = fileToExecute.substr(p1+1,p2-p1-1);
-    string fileNameToExecute = fileToExecute.substr(p1+1);
-    // Create batch submit file
-    ofstream tempOutputFile;
-    std::string TmpFileName = Utils::createAndOpenTemporaryFile("LSF-script", tempOutputFile);
-
-    tempOutputFile << "#!/bin/bash" << endl ;
-    if (queue != "")
-      tempOutputFile << "#MSUB -q " << queue << endl;
-    if( edt > 0 )
-      tempOutputFile << "#MSUB -T " << edt << endl ;
-    if( mem > 0 )
-      tempOutputFile << "#MSUB -M " << mem << endl ;
-    tempOutputFile << "#MSUB -n " << nbproc << endl ;
-    size_t pos = workDir.find("$HOME");
-    string baseDir;
-    if( pos != string::npos )
-      baseDir = getHomeDir(workDir) + workDir.substr(pos+5,workDir.length()-5);
-    else{
-      pos = workDir.find("~");
-      if( pos != string::npos )
-       baseDir = getHomeDir(workDir) + workDir.substr(pos+1,workDir.length()-1);
-      else
-       baseDir = workDir;
-    }
-    tempOutputFile << "#MSUB -o " << baseDir << "/logs/output.log." << rootNameToExecute << endl ;
-    tempOutputFile << "#MSUB -e " << baseDir << "/logs/error.log." << rootNameToExecute << endl ;
-
-    tempOutputFile << "cd " << workDir << endl ;
-
-    // generate nodes file
-    tempOutputFile << "bool=0" << endl;
-    tempOutputFile << "for i in $LSB_MCPU_HOSTS; do" << endl;
-    tempOutputFile << "  if test $bool = 0; then" << endl;
-    tempOutputFile << "    n=$i" << endl;
-    tempOutputFile << "    bool=1" << endl;
-    tempOutputFile << "  else" << endl;
-    tempOutputFile << "    for ((j=0;j<$i;j++)); do" << endl;
-    tempOutputFile << "      echo $n >> nodesFile." << rootNameToExecute << endl;
-    tempOutputFile << "    done" << endl;
-    tempOutputFile << "    bool=0" << endl;
-    tempOutputFile << "  fi" << endl;
-    tempOutputFile << "done" << endl;
-
-    // Abstraction of PBS_NODEFILE - TODO
-    tempOutputFile << "export LIBBATCH_NODEFILE=nodesFile." << rootNameToExecute << endl;
-
-    // Allow resource sharing in CCRT nodes
-    tempOutputFile << "export OMPI_MCA_orte_process_binding=none" << endl;
-
-    // Launch the executable
-    tempOutputFile << "./" + fileNameToExecute << endl;
-    tempOutputFile.flush();
-    tempOutputFile.close();
-
-    BATCH_CHMOD(TmpFileName.c_str(), 0x1ED);
-    cerr << "Batch script file generated is: " << TmpFileName.c_str() << endl;
-
-    int status = _protocol.copyFile(TmpFileName, "", "",
-                                    workDir + "/" + rootNameToExecute + "_Batch.sh",
-                                    _hostname, _username);
-    if (status)
-      throw RunTimeException("Error of connection on remote host");
-
-#endif
-
-  }
-
-  std::string BatchManager_eCCC::getHomeDir(std::string tmpdir)
-  {
-    std::string home;
-
-    string subCommand = string("echo ");
-    subCommand += tmpdir;
-    string command = _protocol.getExecCommand(subCommand, _hostname, _username);
-    cerr << command.c_str() << endl;
-
-    string output;
-    int status = Utils::getCommandOutput(command, output);
-
-    if (status)
-      throw RunTimeException("Error of launching home command on remote host");
-
-    std::istringstream file_home(output);
-    std::getline(file_home, home);
-    return home;
-  }
-
-}
diff --git a/src/CCC/Batch_BatchManager_eCCC.hxx b/src/CCC/Batch_BatchManager_eCCC.hxx
deleted file mode 100644 (file)
index ac8f734..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * BatchManager_eCCC.hxx : emulation of CCC client for CCRT machines
- *
- * Auteur : Bernard SECHER - CEA DEN
- * Mail   : mailto:bernard.secher@cea.fr
- * Date   : Thu Apr 24 10:17:22 2010
- * Projet : PAL Salome
- *
- */
-
-#ifndef _BATCHMANAGER_ECCC_H_
-#define _BATCHMANAGER_ECCC_H_
-
-#include "Batch_Defines.hxx"
-#include "Batch_JobId.hxx"
-#include "Batch_JobInfo.hxx"
-#include "Batch_FactBatchManager.hxx"
-#include "Batch_BatchManager.hxx"
-
-namespace Batch {
-
-  class BATCH_EXPORT BatchManager_eCCC : public BatchManager
-  {
-  public:
-    // Constructeur et destructeur
-    BatchManager_eCCC(const FactBatchManager * parent, const char * host="localhost",
-                      const char * username="",
-                      CommunicationProtocolType protocolType = SSH, const char * mpiImpl="nompi"); // connexion a la machine host
-    virtual ~BatchManager_eCCC();
-
-    // Recupere le nom du serveur par defaut
-    // static string BatchManager_LSF::getDefaultServer();
-
-    // Methodes pour le controle des jobs
-    virtual const JobId submitJob(const Job & job); // soumet un job au gestionnaire
-    virtual void deleteJob(const JobId & jobid); // retire un job du gestionnaire
-    virtual void holdJob(const JobId & jobid); // suspend un job en file d'attente
-    virtual void releaseJob(const JobId & jobid); // relache un job suspendu
-    virtual void alterJob(const JobId & jobid, const Parametre & param, const Environnement & env); // modifie un job en file d'attente
-    virtual void alterJob(const JobId & jobid, const Parametre & param); // modifie un job en file d'attente
-    virtual void alterJob(const JobId & jobid, const Environnement & env); // modifie un job en file d'attente
-    virtual JobInfo queryJob(const JobId & jobid); // renvoie l'etat du job
-    virtual bool isRunning(const JobId & jobid); // teste si un job est present en machine
-
-    virtual void setParametre(const JobId & jobid, const Parametre & param) { return alterJob(jobid, param); } // modifie un job en file d'attente
-    virtual void setEnvironnement(const JobId & jobid, const Environnement & env) { return alterJob(jobid, env); } // modifie un job en file d'attente
-
-    virtual const Batch::JobId addJob(const Batch::Job & job, const std::string reference); // ajoute un nouveau job sans le soumettre
-
-  protected:
-    void buildBatchScript(const Job & job);
-    std::string getWallTime(const long edt);
-
-  private:
-
-    std::string getHomeDir(std::string tmpdir);
-
-#ifdef SWIG
-  public:
-    // Recupere le l'identifiant d'un job deja soumis au BatchManager
-    //virtual const JobId getJobIdByReference(const string & ref) { return BatchManager::getJobIdByReference(ref); }
-    virtual const JobId getJobIdByReference(const char * ref) { return BatchManager::getJobIdByReference(ref); }
-#endif
-
-  };
-
-}
-
-#endif
diff --git a/src/CCC/Batch_FactBatchManager_eCCC.cxx b/src/CCC/Batch_FactBatchManager_eCCC.cxx
deleted file mode 100644 (file)
index 74a4689..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * FactBatchManager_eCCC.cxx : 
- *
- * Auteur : Bernard SECHER - CEA DEN
- * Date   : Avril 2010
- * Projet : PAL Salome
- *
- */
-
-#include "Batch_BatchManager_eCCC.hxx"
-#include "Batch_FactBatchManager_eCCC.hxx"
-
-namespace Batch {
-
-  static FactBatchManager_eCCC sFBM_eCCC;
-
-  // Constructeur
-  FactBatchManager_eCCC::FactBatchManager_eCCC() : FactBatchManager("CCC")
-  {
-    // Nothing to do
-  }
-
-  // Destructeur
-  FactBatchManager_eCCC::~FactBatchManager_eCCC()
-  {
-    // Nothing to do
-  }
-
-  BatchManager * FactBatchManager_eCCC::operator() (const char * hostname,
-                                                    const char * username,
-                                                    CommunicationProtocolType protocolType,
-                                                    const char * mpiImpl) const
-  {
-    // MESSAGE("Building new BatchManager_CCC on host '" << hostname << "'");
-    return new BatchManager_eCCC(this, hostname, username, protocolType, mpiImpl);
-  }
-
-}
diff --git a/src/CCC/Batch_FactBatchManager_eCCC.hxx b/src/CCC/Batch_FactBatchManager_eCCC.hxx
deleted file mode 100644 (file)
index fe83053..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * FactBatchManager_eCCC.hxx : 
- *
- * Auteur : Bernard SECHER : CEA DEN
- * Date   : Avril 2010
- * Projet : PAL Salome
- *
- */
-
-#ifndef _FACTBATCHMANAGER_eCCC_H_
-#define _FACTBATCHMANAGER_eCCC_H_
-
-#include "Batch_Defines.hxx"
-#include "Batch_BatchManager.hxx"
-#include "Batch_FactBatchManager.hxx"
-
-namespace Batch {
-  
-  class BATCH_EXPORT FactBatchManager_eCCC : public FactBatchManager
-  {
-  public:
-    // Constructeur et destructeur
-    FactBatchManager_eCCC();
-    virtual ~FactBatchManager_eCCC();
-
-    virtual BatchManager * operator() (const char * hostname,
-                                       const char * username,
-                                       CommunicationProtocolType protocolType,
-                                       const char * mpiImpl) const;
-  };
-
-}
-
-#endif
diff --git a/src/CCC/Batch_JobInfo_eCCC.cxx b/src/CCC/Batch_JobInfo_eCCC.cxx
deleted file mode 100644 (file)
index edc646b..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * JobInfo_eCCC.cxx :  emulation of CCC client for CCRT machines
- *
- * Auteur : Bernard SECHER - CEA DEN
- * Mail   : mailto:bernard.secher@cea.fr
- * Date   : Thu Apr 24 10:17:22 2010
- * Projet : PAL Salome 
- *
- */
-
-#include <cstdio>
-#include <iostream>
-#include <sstream>
-
-#include "Batch_Constants.hxx"
-#include "Batch_Parametre.hxx"
-#include "Batch_Environnement.hxx"
-#include "Batch_JobInfo_eCCC.hxx"
-
-using namespace std;
-
-namespace Batch {
-
-
-
-  // Constructeurs
-  JobInfo_eCCC::JobInfo_eCCC(int id, string output) : JobInfo()
-  {
-    // On remplit les membres _param et _env
-    ostringstream oss;
-    oss << id;
-    _param[ID] = oss.str();
-
-    // read status of job in log file
-    char line[128];
-    istringstream fp(output);
-    fp.getline(line,80,'\n');
-    
-    string sjobid, username, status;
-    fp >> sjobid;
-    fp >> username;
-    fp >> status;
-
-    if (status == "PEND") {         // Pending
-      _param[STATE] = QUEUED;
-    } else if (status == "PSUSP") { // Suspended while pending
-      _param[STATE] = PAUSED;
-    } else if (status == "RUN") {   // Running
-      _param[STATE] = RUNNING;
-    } else if (status == "USUSP") { // Suspended while running
-      _param[STATE] = PAUSED;
-    } else if (status == "SSUSP") { // Suspended by CCC
-      _param[STATE] = PAUSED;
-    } else if (status == "DONE") {  // Finished successfully
-      _param[STATE] = FINISHED;
-    } else if (status == "EXIT") {  // Finished successfully
-      _param[STATE] = FINISHED;
-    } else if (status == "UNKWN") { // Lost contact
-      _param[STATE] = FAILED;
-    } else if (status == "ZOMBI") { // Zombie
-      _param[STATE] = FAILED;
-    } else {
-      cerr << "Unknown job state code: " << status << endl;
-    }
-
-    if( status.find("RUN") != string::npos)
-      _running = true;
-
-  }
-
-  // Teste si un job est present en machine
-  bool JobInfo_eCCC::isRunning() const
-  {
-    return _running;
-  }
-
-
-  // Destructeur
-  JobInfo_eCCC::~JobInfo_eCCC()
-  {
-    // Nothing to do
-  }
-
-  // Convertit une date HH:MM:SS en secondes
-  long JobInfo_eCCC::HMStoLong(const string & s)
-  {
-    long hour, min, sec;
-
-    sscanf( s.c_str(), "%ld:%ld:%ld", &hour, &min, &sec);
-    return ( ( ( hour * 60L ) + min ) * 60L ) + sec;
-  }
-
-  // Methode pour l'interfacage avec Python (SWIG) : affichage en Python
-  string JobInfo_eCCC::__str__() const
-  {
-    ostringstream sst;
-    sst << "<JobInfo_eCCC (" << this << ") :" << endl;
-    sst << " ID = " <<_param[ID] << endl;
-    sst << " STATE = " <<_param[STATE] << endl;
-
-    return sst.str();
-  }
-
-
-}
diff --git a/src/CCC/Batch_JobInfo_eCCC.hxx b/src/CCC/Batch_JobInfo_eCCC.hxx
deleted file mode 100644 (file)
index a728cb6..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * JobInfo_eCCC.hxx :  emulation of CCC client for CCRT machines
- *
- * Auteur : Bernard SECHER - CEA DEN
- * Mail   : mailto:bernard.secher@cea.fr
- * Date   : Thu Apr 24 10:17:22 2010
- * Projet : PAL Salome 
- *
- */
-
-#ifndef _JOBINFO_CCC_H_
-#define _JOBINFO_CCC_H_
-
-#include "Batch_RunTimeException.hxx"
-#include "Batch_JobInfo.hxx"
-
-#include <string>
-
-namespace Batch {
-
-  class JobInfo_eCCC : public JobInfo
-  {
-  public:
-    // Constructeurs et destructeur
-    JobInfo_eCCC() : _running(false) {};
-    JobInfo_eCCC(int id,std::string output);
-    virtual ~JobInfo_eCCC();
-
-    // Constructeur par recopie
-    JobInfo_eCCC(const JobInfo_eCCC & jinfo) : JobInfo(jinfo) {};
-
-    // Teste si un job est present en machine
-    virtual bool isRunning() const;
-
-    // Methodes pour l'interfacage avec Python (SWIG)
-    // TODO : supprimer ces methodes et transferer leur definitions dans SWIG
-    std::string  __str__() const; // SWIG : affichage en Python
-    std::string  __repr__() const { return __str__(); }; // SWIG : affichage en Python
-
-  protected:
-    bool _running; // etat du job en machine
-
-  private:
-    // Convertit une date HH:MM:SS en secondes
-    long HMStoLong(const std::string &);
-
-  };
-
-}
-
-#endif
index 272eadb6f7aba39efe0e81d264a3dbf2f6e179d4..55c1e271eeda34f018a6c7f642cf5a0af33f2ef6 100644 (file)
@@ -20,9 +20,9 @@
 #  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-SET(CLASS_LIST CCC/Batch_BatchManager_eCCC
-               CCC/Batch_FactBatchManager_eCCC
-               CCC/Batch_JobInfo_eCCC
+SET(CLASS_LIST CCC/BatchManager_CCC
+               CCC/FactBatchManager_CCC
+               CCC/JobInfo_CCC
    )
 
 APPEND_CLASSES_TO_SRC_FILES(${CLASS_LIST})
diff --git a/src/CCC/FactBatchManager_CCC.cxx b/src/CCC/FactBatchManager_CCC.cxx
new file mode 100644 (file)
index 0000000..a065daa
--- /dev/null
@@ -0,0 +1,59 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * FactBatchManager_CCC.cxx : 
+ *
+ * Auteur : Bernard SECHER - CEA DEN
+ * Date   : Avril 2010
+ * Projet : PAL Salome
+ *
+ */
+
+#include "BatchManager_CCC.hxx"
+#include "FactBatchManager_CCC.hxx"
+
+namespace Batch {
+
+  static FactBatchManager_CCC sFBM_CCC;
+
+  // Constructeur
+  FactBatchManager_CCC::FactBatchManager_CCC() : FactBatchManager("CCC")
+  {
+    // Nothing to do
+  }
+
+  // Destructeur
+  FactBatchManager_CCC::~FactBatchManager_CCC()
+  {
+    // Nothing to do
+  }
+
+  BatchManager * FactBatchManager_CCC::operator() (const char * hostname,
+                                                    const char * username,
+                                                    CommunicationProtocolType protocolType,
+                                                    const char * mpiImpl) const
+  {
+    // MESSAGE("Building new BatchManager_CCC on host '" << hostname << "'");
+    return new BatchManager_CCC(this, hostname, username, protocolType, mpiImpl);
+  }
+
+}
diff --git a/src/CCC/FactBatchManager_CCC.hxx b/src/CCC/FactBatchManager_CCC.hxx
new file mode 100644 (file)
index 0000000..dafabae
--- /dev/null
@@ -0,0 +1,55 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * FactBatchManager_CCC.hxx : 
+ *
+ * Auteur : Bernard SECHER : CEA DEN
+ * Date   : Avril 2010
+ * Projet : PAL Salome
+ *
+ */
+
+#ifndef _FACTBATCHMANAGER_CCC_H_
+#define _FACTBATCHMANAGER_CCC_H_
+
+#include "Defines.hxx"
+#include "BatchManager.hxx"
+#include "FactBatchManager.hxx"
+
+namespace Batch {
+  
+  class BATCH_EXPORT FactBatchManager_CCC : public FactBatchManager
+  {
+  public:
+    // Constructeur et destructeur
+    FactBatchManager_CCC();
+    virtual ~FactBatchManager_CCC();
+
+    virtual BatchManager * operator() (const char * hostname,
+                                       const char * username,
+                                       CommunicationProtocolType protocolType,
+                                       const char * mpiImpl) const;
+  };
+
+}
+
+#endif
diff --git a/src/CCC/JobInfo_CCC.cxx b/src/CCC/JobInfo_CCC.cxx
new file mode 100644 (file)
index 0000000..947d366
--- /dev/null
@@ -0,0 +1,126 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * JobInfo_CCC.cxx :  emulation of CCC client for CCRT machines
+ *
+ * Auteur : Bernard SECHER - CEA DEN
+ * Mail   : mailto:bernard.secher@cea.fr
+ * Date   : Thu Apr 24 10:17:22 2010
+ * Projet : PAL Salome 
+ *
+ */
+
+#include <cstdio>
+#include <iostream>
+#include <sstream>
+
+#include "Constants.hxx"
+#include "Parametre.hxx"
+#include "Environnement.hxx"
+#include "JobInfo_CCC.hxx"
+
+using namespace std;
+
+namespace Batch {
+
+
+
+  // Constructeurs
+  JobInfo_CCC::JobInfo_CCC(int id, string output) : JobInfo()
+  {
+    // On remplit les membres _param et _nv
+    ostringstream oss;
+    oss << id;
+    _param[ID] = oss.str();
+
+    // read status of job in log file
+    char line[128];
+    istringstream fp(output);
+    fp.getline(line,80,'\n');
+    
+    string sjobid, username, status;
+    fp >> sjobid;
+    fp >> username;
+    fp >> status;
+
+    if (status == "PEND") {         // Pending
+      _param[STATE] = QUEUED;
+    } else if (status == "PSUSP") { // Suspended while pending
+      _param[STATE] = PAUSED;
+    } else if (status == "RUN") {   // Running
+      _param[STATE] = RUNNING;
+    } else if (status == "USUSP") { // Suspended while running
+      _param[STATE] = PAUSED;
+    } else if (status == "SSUSP") { // Suspended by CCC
+      _param[STATE] = PAUSED;
+    } else if (status == "DONE") {  // Finished successfully
+      _param[STATE] = FINISHED;
+    } else if (status == "EXIT") {  // Finished successfully
+      _param[STATE] = FINISHED;
+    } else if (status == "UNKWN") { // Lost contact
+      _param[STATE] = FAILED;
+    } else if (status == "ZOMBI") { // Zombie
+      _param[STATE] = FAILED;
+    } else {
+      cerr << "Unknown job state code: " << status << endl;
+    }
+
+    if( status.find("RUN") != string::npos)
+      _running = true;
+
+  }
+
+  // Teste si un job est present en machine
+  bool JobInfo_CCC::isRunning() const
+  {
+    return _running;
+  }
+
+
+  // Destructeur
+  JobInfo_CCC::~JobInfo_CCC()
+  {
+    // Nothing to do
+  }
+
+  // Convertit une date HH:MM:SS en secondes
+  long JobInfo_CCC::HMStoLong(const string & s)
+  {
+    long hour, min, sec;
+
+    sscanf( s.c_str(), "%ld:%ld:%ld", &hour, &min, &sec);
+    return ( ( ( hour * 60L ) + min ) * 60L ) + sec;
+  }
+
+  // Methode pour l'interfacage avec Python (SWIG) : affichage en Python
+  string JobInfo_CCC::__str__() const
+  {
+    ostringstream sst;
+    sst << "<JobInfo_CCC (" << this << ") :" << endl;
+    sst << " ID = " <<_param[ID] << endl;
+    sst << " STATE = " <<_param[STATE] << endl;
+
+    return sst.str();
+  }
+
+
+}
diff --git a/src/CCC/JobInfo_CCC.hxx b/src/CCC/JobInfo_CCC.hxx
new file mode 100644 (file)
index 0000000..10d8aff
--- /dev/null
@@ -0,0 +1,72 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * JobInfo_CCC.hxx :  emulation of CCC client for CCRT machines
+ *
+ * Auteur : Bernard SECHER - CEA DEN
+ * Mail   : mailto:bernard.secher@cea.fr
+ * Date   : Thu Apr 24 10:17:22 2010
+ * Projet : PAL Salome 
+ *
+ */
+
+#ifndef _JOBINFO_CCC_H_
+#define _JOBINFO_CCC_H_
+
+#include "RunTimeException.hxx"
+#include "JobInfo.hxx"
+
+#include <string>
+
+namespace Batch {
+
+  class JobInfo_CCC : public JobInfo
+  {
+  public:
+    // Constructeurs et destructeur
+    JobInfo_CCC() : _running(false) {};
+    JobInfo_CCC(int id,std::string output);
+    virtual ~JobInfo_CCC();
+
+    // Constructeur par recopie
+    JobInfo_CCC(const JobInfo_CCC & jinfo) : JobInfo(jinfo) {};
+
+    // Teste si un job est present en machine
+    virtual bool isRunning() const;
+
+    // Methodes pour l'interfacage avec Python (SWIG)
+    // TODO : supprimer ces methodes et transferer leur definitions dans SWIG
+    std::string  __str__() const; // SWIG : affichage en Python
+    std::string  __repr__() const { return __str__(); }; // SWIG : affichage en Python
+
+  protected:
+    bool _running; // etat du job en machine
+
+  private:
+    // Convertit une date HH:MM:SS en secondes
+    long HMStoLong(const std::string &);
+
+  };
+
+}
+
+#endif
diff --git a/src/Core/APIInternalFailureException.cxx b/src/Core/APIInternalFailureException.cxx
new file mode 100644 (file)
index 0000000..5170a7c
--- /dev/null
@@ -0,0 +1,37 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * APIInternalFailureException.cxx : 
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail   : mailto:ivan.dutka-malen@der.edf.fr
+ * Date   : Thu Nov 20 15:15:42 2003
+ * Projet : Salome 2
+ *
+ */
+
+#include "APIInternalFailureException.hxx"
+using namespace std;
+
+namespace Batch {
+
+}
diff --git a/src/Core/APIInternalFailureException.hxx b/src/Core/APIInternalFailureException.hxx
new file mode 100644 (file)
index 0000000..2e1a6d8
--- /dev/null
@@ -0,0 +1,51 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * APIInternalFailureException.hxx : 
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail   : mailto:ivan.dutka-malen@der.edf.fr
+ * Date   : Thu Nov 20 15:15:41 2003
+ * Projet : Salome 2
+ *
+ */
+
+#ifndef _APIINTERNALFAILUREEXCEPTION_H_
+#define _APIINTERNALFAILUREEXCEPTION_H_
+
+#include "Defines.hxx"
+
+#include "GenericException.hxx"
+#include "GenericException.hxx"
+
+namespace Batch {
+
+  class BATCH_EXPORT APIInternalFailureException : public GenericException
+  {
+  public:
+               // Constructeur
+    APIInternalFailureException(std::string ch = "undefined") : GenericException("APIInternalFailureException", ch) {}
+  };
+
+}
+
+#endif
diff --git a/src/Core/BatchManager.cxx b/src/Core/BatchManager.cxx
new file mode 100644 (file)
index 0000000..337fd91
--- /dev/null
@@ -0,0 +1,368 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * BatchManager.cxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date   : Septembre 2003
+ * Projet : SALOME 2
+ *
+ */
+
+#include <iostream>
+#include <sstream>
+#include <string>
+#ifdef WIN32
+# include<winsock2.h>
+#else
+#include <unistd.h>
+# include <netdb.h>
+#endif
+
+#include "Constants.hxx"
+#include "Job.hxx"
+#include "JobId.hxx"
+#include "JobInfo.hxx"
+#include "InvalidArgumentException.hxx"
+#include "FactBatchManager.hxx"
+#include "BatchManager.hxx"
+#include "Utils.hxx"
+
+#ifdef WIN32
+#define sleep(seconds) Sleep((seconds)*1000)
+#endif
+
+using namespace std;
+
+namespace Batch {
+
+  BatchManager::BatchManager(const Batch::FactBatchManager * parent, const char* host,
+                             const char * username,
+                             CommunicationProtocolType protocolType, const char* mpiImpl)
+    : _hostname(host), jobid_map(), _parent(parent),
+      _protocol(CommunicationProtocol::getInstance(protocolType)),
+      _username(username), _mpiImpl(FactoryMpiImpl(mpiImpl))
+  {
+  }
+
+
+  // Destructeur
+  BatchManager::~BatchManager()
+  {
+    delete _mpiImpl;
+  }
+
+  string BatchManager::__repr__() const
+  {
+    ostringstream oss;
+    oss << "<BatchManager of type '" << (_parent ? _parent->getType() : "unknown (no factory)") << "' connected to server '" << _hostname << "'>";
+    return oss.str();
+  }
+
+  // Recupere le l'identifiant d'un job deja soumis au BatchManager
+//   const JobId BatchManager::getJobIdByReference(const string & ref)
+//   {
+//     return JobId(this, ref);
+//   }
+  const JobId BatchManager::getJobIdByReference(const char * ref)
+  {
+    return JobId(this, ref);
+  }
+
+//   // Methode pour le controle des jobs : soumet un job au gestionnaire
+//   const JobId BatchManager::submitJob(const Job & job)
+//   {
+//     static int idx = 0;
+//     //MEDMEM::STRING sst;
+//     ostringstream sst;
+//     sst << "Jobid_" << idx++;
+//     JobId id(this, sst.str());
+//     return id;
+//   }
+
+//   // Methode pour le controle des jobs : retire un job du gestionnaire
+//   void BatchManager::deleteJob(const JobId & jobid)
+//   {
+//     // Nothing to do
+//   }
+
+//   // Methode pour le controle des jobs : suspend un job en file d'attente
+//   void BatchManager::holdJob(const JobId & jobid)
+//   {
+//     // Nothing to do
+//   }
+
+//   // Methode pour le controle des jobs : relache un job suspendu
+//   void BatchManager::releaseJob(const JobId & jobid)
+//   {
+//     // Nothing to do
+//   }
+
+//   // Methode pour le controle des jobs : modifie un job en file d'attente
+//   void BatchManager::alterJob(const JobId & jobid, const Parametre & param, const Environnement & env)
+//   {
+//     // Nothing to do
+//   }
+
+//   // Methode pour le controle des jobs : modifie un job en file d'attente
+//   void BatchManager::alterJob(const JobId & jobid, const Parametre & param)
+//   {
+//     // Nothing to do
+//   }
+
+//   // Methode pour le controle des jobs : modifie un job en file d'attente
+//   void BatchManager::alterJob(const JobId & jobid, const Environnement & env)
+//   {
+//     // Nothing to do
+//   }
+
+//   // Methode pour le controle des jobs : renvoie l'etat du job
+//   JobInfo BatchManager::queryJob(const JobId & jobid)
+//   {
+//     return JobInfo();
+//   }
+
+  //! Wait for the end of a job
+  /*!
+   *  This method is a simple way to wait for a job to end. It will query the job state at
+   *  increasing intervals and return when the job is finished (whether successfully or not) or
+   *  when the timeout is reached. This method is not intended to be generic. In many cases you
+   *  will have to write your own loop to wait for the end of a job.
+   *  \param jobid ID of the job to wait for.
+   *  \param timeout Maximum time to wait in seconds. If -1 (default), wait indefinitely.
+   *  \param initSleepTime Initial time in seconds between two queries for the job state (default is 1).
+   *  \param maxSleepTime Maximum time in seconds between two queries for the job state (default is 600).
+   *  \return The job state as returned by the last query.
+   */
+  string BatchManager::waitForJobEnd(const JobId & jobid, long timeout,
+                                     long initSleepTime, long maxSleepTime)
+  {
+    int time = 0;
+    int sleeptime = initSleepTime;
+    bool testTimeout = (timeout > -1);
+    bool timeoutReached = (testTimeout && time >= timeout);
+    JobInfo jinfo = jobid.queryJob();
+    string state = jinfo.getParametre()[STATE].str();
+    cout << "State is \"" << state << "\"";
+    while (!timeoutReached && state != FINISHED && state != FAILED) {
+      cout << ", sleeping " << sleeptime << "s..." << endl;
+      sleep(sleeptime);
+      time += sleeptime;
+      timeoutReached = (testTimeout && time >= timeout);
+      sleeptime *= 2;
+      if (testTimeout && sleeptime > timeout - time)
+        sleeptime = timeout - time;
+      if (sleeptime > maxSleepTime)
+        sleeptime = maxSleepTime;
+      jinfo = jobid.queryJob();
+      state = jinfo.getParametre()[STATE].str();
+      cout << "State is \"" << state << "\"";
+    }
+    cout << endl;
+    return state;
+  }
+
+
+  void BatchManager::exportInputFiles(const Job& job)
+  {
+    int status;
+    Parametre params = job.getParametre();
+    const Versatile & V = params[INFILE];
+    Versatile::const_iterator Vit;
+
+    // Create remote directories
+    string logdir = string(params[WORKDIR]) + "/logs";
+    status = _protocol.makeDirectory(logdir, _hostname, _username);
+    if (status) {
+      std::ostringstream oss;
+      oss << "Cannot create directory " << logdir << " on host " << _hostname;
+      oss << ". Return status is " << status;
+      throw RunTimeException(oss.str());
+    }
+
+    // Copy the file to execute into the remote working directory
+    string executeFile = params[EXECUTABLE];
+    if (executeFile.size() != 0) {
+      status = _protocol.copyFile(executeFile, "", "",
+                                  params[WORKDIR], _hostname, _username);
+      if (status) {
+        std::ostringstream oss;
+        oss << "Cannot copy file " << executeFile << " on host " << _hostname;
+        oss << ". Return status is " << status;
+        throw RunTimeException(oss.str());
+      }
+
+#ifdef WIN32
+      // On Windows, we make the remote file executable afterward because
+      // pscp does not preserve access permissions on files
+
+      string remoteExec = string(params[EXECUTABLE]);
+      remoteExec = remoteExec.substr(remoteExec.rfind("\\") + 1, remoteExec.length());
+      remoteExec = string(params[WORKDIR]) + "/" + executable;
+
+      string subCommand = string("chmod u+x ") + remoteExec;
+      string command = _protocol.getExecCommand(subCommand, _hostname, _username);
+      cerr << command.c_str() << endl;
+      status = system(command.c_str());
+      if (status) {
+        std::ostringstream oss;
+        oss << "Cannot change permissions of file " << remoteExec << " on host " << _hostname;
+        oss << ". Return status is " << status;
+        throw RunTimeException(oss.str());
+      }
+#endif
+    }
+
+    // Copy input files into the remote working directory
+    for (Vit=V.begin() ; Vit!=V.end() ; Vit++) {
+      CoupleType cpt = *static_cast< CoupleType * >(*Vit);
+      Couple inputFile = cpt;
+      string remotePath = inputFile.getRemote();
+      if (!Utils::isAbsolutePath(remotePath)) {
+        remotePath = params[WORKDIR].str() + "/" + remotePath;
+      }
+      status = _protocol.copyFile(inputFile.getLocal(), "", "",
+                                  remotePath, _hostname, _username);
+      if (status) {
+        std::ostringstream oss;
+        oss << "Cannot copy file " << inputFile.getLocal() << " on host " << _hostname;
+        oss << ". Return status is " << status;
+        throw RunTimeException(oss.str());
+      }
+    }
+
+  }
+
+  void BatchManager::importOutputFiles( const Job & job, const string directory )
+  {
+    Parametre params = job.getParametre();
+    const Versatile & V = params[OUTFILE];
+    Versatile::const_iterator Vit;
+
+    // Create local result directory
+    int status = CommunicationProtocol::getInstance(SH).makeDirectory(directory, "", "");
+    if (status) {
+      string mess("Directory creation failed. Status is :");
+      ostringstream status_str;
+      status_str << status;
+      mess += status_str.str();
+      cerr << mess << endl;
+    }
+
+    for(Vit=V.begin(); Vit!=V.end(); Vit++) {
+      CoupleType cpt  = *static_cast< CoupleType * >(*Vit);
+      Couple outputFile = cpt;
+      string remotePath = outputFile.getRemote();
+      if (!Utils::isAbsolutePath(remotePath)) {
+        remotePath = params[WORKDIR].str() + "/" + remotePath;
+      }
+      string localPath = outputFile.getLocal();
+      if (!Utils::isAbsolutePath(localPath)) {
+        localPath = directory + "/" + localPath;
+      }
+      status = _protocol.copyFile(remotePath, _hostname, _username,
+                                  localPath, "", "");
+      if (status) {
+        // Try to get what we can (logs files)
+        // throw BatchException("Error of connection on remote host");
+        std::string mess("Copy command failed ! status is :");
+        ostringstream status_str;
+        status_str << status;
+        mess += status_str.str();
+        cerr << mess << endl;
+      }
+    }
+
+    // Copy logs
+    status = _protocol.copyFile(string(params[WORKDIR]) + string("/logs"), _hostname, _username,
+                                directory, "", "");
+    if (status) {
+      std::string mess("Copy logs directory failed ! status is :");
+      ostringstream status_str;
+      status_str << status;
+      mess += status_str.str();
+      cerr << mess << endl;
+    }
+
+  }
+
+  bool BatchManager::importDumpStateFile( const Job & job, const string directory )
+  {
+    Parametre params = job.getParametre();
+
+    // Create local result directory
+    int status = CommunicationProtocol::getInstance(SH).makeDirectory(directory, "", "");
+    if (status) {
+      string mess("Directory creation failed. Status is :");
+      ostringstream status_str;
+      status_str << status;
+      mess += status_str.str();
+      cerr << mess << endl;
+    }
+
+    bool ret = true;
+    status = _protocol.copyFile(string(params[WORKDIR]) + string("/dumpState*.xml"), _hostname, _username,
+                                directory, "", "");
+    if (status) {
+      // Try to get what we can (logs files)
+      // throw BatchException("Error of connection on remote host");
+      std::string mess("Copy command failed ! status is :");
+      ostringstream status_str;
+      status_str << status;
+      mess += status_str.str();
+      cerr << mess << endl;
+      ret = false;
+    }
+    return ret;
+  }
+
+  MpiImpl *BatchManager::FactoryMpiImpl(string mpiImpl)
+  {
+    if(mpiImpl == "lam")
+      return new MpiImpl_LAM();
+    else if(mpiImpl == "mpich1")
+      return new MpiImpl_MPICH1();
+    else if(mpiImpl == "mpich2")
+      return new MpiImpl_MPICH2();
+    else if(mpiImpl == "openmpi")
+      return new MpiImpl_OPENMPI();
+    else if(mpiImpl == "ompi")
+      return new MpiImpl_OMPI();
+    else if(mpiImpl == "slurm")
+      return new MpiImpl_SLURM();
+    else if(mpiImpl == "prun")
+      return new MpiImpl_PRUN();
+    else if(mpiImpl == "nompi")
+      return NULL;
+    else{
+      ostringstream oss;
+      oss << mpiImpl << " : not yet implemented";
+      throw RunTimeException(oss.str().c_str());
+    }
+  }
+
+  const CommunicationProtocol & BatchManager::getProtocol() const
+  {
+    return _protocol;
+  }
+
+}
diff --git a/src/Core/BatchManager.hxx b/src/Core/BatchManager.hxx
new file mode 100644 (file)
index 0000000..e12332c
--- /dev/null
@@ -0,0 +1,102 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * BatchManager.hxx : 
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date   : Septembre 2003
+ * Projet : SALOME 2
+ *
+ */
+
+#ifndef _BATCHMANAGER_H_
+#define _BATCHMANAGER_H_
+
+#include "Defines.hxx"
+
+#include <string>
+#include <map>
+#include "Job.hxx"
+#include "JobId.hxx"
+#include "JobInfo.hxx"
+#include "InvalidArgumentException.hxx"
+#include "CommunicationProtocol.hxx"
+#include "MpiImpl.hxx"
+
+namespace Batch {
+
+  class Job;
+  class JobId;
+  class JobInfo;
+  class FactBatchManager;
+
+  class BATCH_EXPORT BatchManager
+  {
+  public:
+    // Constructeur et destructeur
+    BatchManager(const Batch::FactBatchManager * parent, const char * host = "localhost",
+                 const char * username = "",
+                 CommunicationProtocolType protocolType = SSH, const char * mpiImpl = "nompi");
+    virtual ~BatchManager();
+    virtual std::string __repr__() const;
+
+    // Recupere le l'identifiant d'un job deja soumis au BatchManager
+    //virtual const JobId getJobIdByReference(const std::string & ref);
+    virtual const Batch::JobId getJobIdByReference(const char * ref);
+
+    // Methodes pour le controle des jobs : virtuelles pures
+    virtual const Batch::JobId submitJob(const Batch::Job & job) = 0; // soumet un job au gestionnaire
+    virtual void deleteJob(const Batch::JobId & jobid) = 0; // retire un job du gestionnaire
+    virtual void holdJob(const Batch::JobId & jobid) = 0; // suspend un job en file d'attente
+    virtual void releaseJob(const Batch::JobId & jobid) = 0; // relache un job suspendu
+    virtual void alterJob(const Batch::JobId & jobid, const Batch::Parametre & param, const Batch::Environnement & env) = 0; // modifie un job en file d'attente
+    virtual void alterJob(const Batch::JobId & jobid, const Batch::Parametre & param) = 0; // modifie un job en file d'attente
+    virtual void alterJob(const Batch::JobId & jobid, const Batch::Environnement & env) = 0; // modifie un job en file d'attente
+    virtual Batch::JobInfo queryJob(const Batch::JobId & jobid) = 0; // renvoie l'etat du job
+    virtual const Batch::JobId addJob(const Batch::Job & job, const std::string reference) = 0; // ajoute un nouveau job sans le soumettre
+    virtual std::string waitForJobEnd(const Batch::JobId & jobid, long timeout = -1,
+                                      long initSleepTime = 1, long maxSleepTime = 600);
+    virtual void importOutputFiles( const Job & job, const std::string directory );
+    bool importDumpStateFile( const Job & job, const std::string directory );
+
+    // Get the underlying communication protocol
+    const CommunicationProtocol & getProtocol() const;
+
+  protected:
+    std::string _hostname; // serveur ou tourne le BatchManager
+    // std::map< const std::string, const Batch::JobId * > jobid_map; // table des jobs deja soumis
+    std::map< std::string, const Batch::JobId * > jobid_map; // table des jobs deja soumis
+    const Batch::FactBatchManager * _parent;
+    const CommunicationProtocol & _protocol; // protocol to access _hostname
+    const std::string _username; // username to access _hostname
+    MpiImpl *_mpiImpl; // Mpi implementation to launch executable in batch script
+
+    MpiImpl* FactoryMpiImpl(std::string mpiImpl);
+    void exportInputFiles(const Job & job);
+
+  private:
+
+  };
+
+}
+
+#endif
diff --git a/src/Core/BatchManagerCatalog.cxx b/src/Core/BatchManagerCatalog.cxx
new file mode 100644 (file)
index 0000000..44d2844
--- /dev/null
@@ -0,0 +1,108 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * BatchManagerCatalog.cxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date   : Septembre 2004
+ * Projet : SALOME 2
+ * Modified by Renaud Barate, April 2009
+ *
+ */
+
+#include <string>
+#include <sstream>
+#include <map>
+#include "BatchManagerCatalog.hxx"
+#include "FactBatchManager.hxx"
+using namespace std;
+
+namespace Batch {
+
+  // Constructeur
+  BatchManagerCatalog::BatchManagerCatalog()
+  {
+    pthread_mutex_init(&_mutex, NULL);
+  }
+
+  // Destructeur
+  BatchManagerCatalog::~BatchManagerCatalog()
+  {
+    pthread_mutex_destroy(&_mutex);
+  }
+
+  /**
+   * Returns the catalog singleton.
+   * We use the construct-on-first-use idiom here because otherwise there could be a problem with
+   * the initialization order between the factory singletons and this catalog. Note that since the
+   * destructors do not depend on the other objects, the order is not important for destruction.
+   */
+  BatchManagerCatalog& BatchManagerCatalog::getInstance () {
+    static BatchManagerCatalog instance;
+    return instance;
+  }
+
+  void BatchManagerCatalog::addFactBatchManager(const char * type, FactBatchManager * pFBM)
+  {
+    if (pFBM) { // *** section critique ***
+      pthread_mutex_lock(&_mutex);
+      _catalog[type] = pFBM;
+      pthread_mutex_unlock(&_mutex);
+    }
+  }
+
+  bool BatchManagerCatalog::hasFactBatchManager(const char * type)
+  {
+    pthread_mutex_lock(&_mutex);
+    bool result = (_catalog.find(type) != _catalog.end());
+    pthread_mutex_unlock(&_mutex);
+    return result;
+  }
+
+  // Functor
+  FactBatchManager * BatchManagerCatalog::operator() (const char * type)
+  {
+    FactBatchManager * result = NULL;
+    pthread_mutex_lock(&_mutex);
+    if (_catalog.find(type) != _catalog.end()) result = _catalog[type];
+    pthread_mutex_unlock(&_mutex);
+    return result;
+  }
+
+  std::map<string, FactBatchManager *> * BatchManagerCatalog::dict()
+  {
+    return &_catalog;
+  }
+
+  string BatchManagerCatalog::__repr__() const
+  {
+    ostringstream oss;
+    oss << "<BatchManagerCatalog contains {";
+    string sep;
+    for(std::map<string, FactBatchManager *>::const_iterator it = _catalog.begin(); it != _catalog.end(); it++, sep=", ") {
+      oss << sep << "'" << (*it).first << "' : '" << (*it).second->__repr__() << "'";
+    }
+    oss << "}>";
+    return oss.str();
+  }
+
+}
diff --git a/src/Core/BatchManagerCatalog.hxx b/src/Core/BatchManagerCatalog.hxx
new file mode 100644 (file)
index 0000000..a26a64e
--- /dev/null
@@ -0,0 +1,76 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * BatchManagerCatalog.hxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date   : Septembre 2004
+ * Projet : SALOME 2
+ * Modified by Renaud Barate, April 2009
+ *
+ */
+
+#ifndef _CATALOG_H_
+#define _CATALOG_H_
+
+#include "Defines.hxx"
+
+#include <string>
+#include <map>
+#include <pthread.h>
+
+namespace Batch {
+
+  class FactBatchManager;
+
+  class BATCH_EXPORT BatchManagerCatalog
+  {
+  public:
+    static BatchManagerCatalog& getInstance();
+
+    void addFactBatchManager(const char * type, Batch::FactBatchManager * pFBM);
+    bool hasFactBatchManager(const char * type);
+    Batch::FactBatchManager * operator() (const char * type);
+
+    virtual std::map<std::string, FactBatchManager *> * dict();
+    virtual std::string __repr__() const;
+
+  protected:
+    // Constructeur
+    BatchManagerCatalog();
+    // Destructeur
+    virtual ~BatchManagerCatalog();
+
+    std::map<std::string, FactBatchManager *> _catalog;
+    pthread_mutex_t _mutex;
+
+  private:
+
+    // Forbid the use of copy constructor and assignment operator
+    BatchManagerCatalog(const BatchManagerCatalog & orig) {}
+    void operator=(const BatchManagerCatalog & orig) {}
+
+  };
+
+}
+
+#endif
diff --git a/src/Core/Batch_APIInternalFailureException.cxx b/src/Core/Batch_APIInternalFailureException.cxx
deleted file mode 100644 (file)
index 515b554..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * APIInternalFailureException.cxx : 
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail   : mailto:ivan.dutka-malen@der.edf.fr
- * Date   : Thu Nov 20 15:15:42 2003
- * Projet : Salome 2
- *
- */
-
-#include "Batch_APIInternalFailureException.hxx"
-using namespace std;
-
-namespace Batch {
-
-}
diff --git a/src/Core/Batch_APIInternalFailureException.hxx b/src/Core/Batch_APIInternalFailureException.hxx
deleted file mode 100644 (file)
index c1a7dd6..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * APIInternalFailureException.hxx : 
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail   : mailto:ivan.dutka-malen@der.edf.fr
- * Date   : Thu Nov 20 15:15:41 2003
- * Projet : Salome 2
- *
- */
-
-#ifndef _APIINTERNALFAILUREEXCEPTION_H_
-#define _APIINTERNALFAILUREEXCEPTION_H_
-
-#include "Batch_Defines.hxx"
-
-#include "Batch_GenericException.hxx"
-#include "Batch_GenericException.hxx"
-
-namespace Batch {
-
-  class BATCH_EXPORT APIInternalFailureException : public GenericException
-  {
-  public:
-               // Constructeur
-    APIInternalFailureException(std::string ch = "undefined") : GenericException("APIInternalFailureException", ch) {}
-  };
-
-}
-
-#endif
diff --git a/src/Core/Batch_BatchManager.cxx b/src/Core/Batch_BatchManager.cxx
deleted file mode 100644 (file)
index 1af2bec..0000000
+++ /dev/null
@@ -1,368 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * BatchManager.cxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date   : Septembre 2003
- * Projet : SALOME 2
- *
- */
-
-#include <iostream>
-#include <sstream>
-#include <string>
-#ifdef WIN32
-# include<winsock2.h>
-#else
-#include <unistd.h>
-# include <netdb.h>
-#endif
-
-#include "Batch_Constants.hxx"
-#include "Batch_Job.hxx"
-#include "Batch_JobId.hxx"
-#include "Batch_JobInfo.hxx"
-#include "Batch_InvalidArgumentException.hxx"
-#include "Batch_FactBatchManager.hxx"
-#include "Batch_BatchManager.hxx"
-#include "Batch_Utils.hxx"
-
-#ifdef WIN32
-#define sleep(seconds) Sleep((seconds)*1000)
-#endif
-
-using namespace std;
-
-namespace Batch {
-
-  BatchManager::BatchManager(const Batch::FactBatchManager * parent, const char* host,
-                             const char * username,
-                             CommunicationProtocolType protocolType, const char* mpiImpl)
-    : _hostname(host), jobid_map(), _parent(parent),
-      _protocol(CommunicationProtocol::getInstance(protocolType)),
-      _username(username), _mpiImpl(FactoryMpiImpl(mpiImpl))
-  {
-  }
-
-
-  // Destructeur
-  BatchManager::~BatchManager()
-  {
-    delete _mpiImpl;
-  }
-
-  string BatchManager::__repr__() const
-  {
-    ostringstream oss;
-    oss << "<BatchManager of type '" << (_parent ? _parent->getType() : "unknown (no factory)") << "' connected to server '" << _hostname << "'>";
-    return oss.str();
-  }
-
-  // Recupere le l'identifiant d'un job deja soumis au BatchManager
-//   const JobId BatchManager::getJobIdByReference(const string & ref)
-//   {
-//     return JobId(this, ref);
-//   }
-  const JobId BatchManager::getJobIdByReference(const char * ref)
-  {
-    return JobId(this, ref);
-  }
-
-//   // Methode pour le controle des jobs : soumet un job au gestionnaire
-//   const JobId BatchManager::submitJob(const Job & job)
-//   {
-//     static int idx = 0;
-//     //MEDMEM::STRING sst;
-//     ostringstream sst;
-//     sst << "Jobid_" << idx++;
-//     JobId id(this, sst.str());
-//     return id;
-//   }
-
-//   // Methode pour le controle des jobs : retire un job du gestionnaire
-//   void BatchManager::deleteJob(const JobId & jobid)
-//   {
-//     // Nothing to do
-//   }
-
-//   // Methode pour le controle des jobs : suspend un job en file d'attente
-//   void BatchManager::holdJob(const JobId & jobid)
-//   {
-//     // Nothing to do
-//   }
-
-//   // Methode pour le controle des jobs : relache un job suspendu
-//   void BatchManager::releaseJob(const JobId & jobid)
-//   {
-//     // Nothing to do
-//   }
-
-//   // Methode pour le controle des jobs : modifie un job en file d'attente
-//   void BatchManager::alterJob(const JobId & jobid, const Parametre & param, const Environnement & env)
-//   {
-//     // Nothing to do
-//   }
-
-//   // Methode pour le controle des jobs : modifie un job en file d'attente
-//   void BatchManager::alterJob(const JobId & jobid, const Parametre & param)
-//   {
-//     // Nothing to do
-//   }
-
-//   // Methode pour le controle des jobs : modifie un job en file d'attente
-//   void BatchManager::alterJob(const JobId & jobid, const Environnement & env)
-//   {
-//     // Nothing to do
-//   }
-
-//   // Methode pour le controle des jobs : renvoie l'etat du job
-//   JobInfo BatchManager::queryJob(const JobId & jobid)
-//   {
-//     return JobInfo();
-//   }
-
-  //! Wait for the end of a job
-  /*!
-   *  This method is a simple way to wait for a job to end. It will query the job state at
-   *  increasing intervals and return when the job is finished (whether successfully or not) or
-   *  when the timeout is reached. This method is not intended to be generic. In many cases you
-   *  will have to write your own loop to wait for the end of a job.
-   *  \param jobid ID of the job to wait for.
-   *  \param timeout Maximum time to wait in seconds. If -1 (default), wait indefinitely.
-   *  \param initSleepTime Initial time in seconds between two queries for the job state (default is 1).
-   *  \param maxSleepTime Maximum time in seconds between two queries for the job state (default is 600).
-   *  \return The job state as returned by the last query.
-   */
-  string BatchManager::waitForJobEnd(const JobId & jobid, long timeout,
-                                     long initSleepTime, long maxSleepTime)
-  {
-    int time = 0;
-    int sleeptime = initSleepTime;
-    bool testTimeout = (timeout > -1);
-    bool timeoutReached = (testTimeout && time >= timeout);
-    JobInfo jinfo = jobid.queryJob();
-    string state = jinfo.getParametre()[STATE].str();
-    cout << "State is \"" << state << "\"";
-    while (!timeoutReached && state != FINISHED && state != FAILED) {
-      cout << ", sleeping " << sleeptime << "s..." << endl;
-      sleep(sleeptime);
-      time += sleeptime;
-      timeoutReached = (testTimeout && time >= timeout);
-      sleeptime *= 2;
-      if (testTimeout && sleeptime > timeout - time)
-        sleeptime = timeout - time;
-      if (sleeptime > maxSleepTime)
-        sleeptime = maxSleepTime;
-      jinfo = jobid.queryJob();
-      state = jinfo.getParametre()[STATE].str();
-      cout << "State is \"" << state << "\"";
-    }
-    cout << endl;
-    return state;
-  }
-
-
-  void BatchManager::exportInputFiles(const Job& job)
-  {
-    int status;
-    Parametre params = job.getParametre();
-    const Versatile & V = params[INFILE];
-    Versatile::const_iterator Vit;
-
-    // Create remote directories
-    string logdir = string(params[WORKDIR]) + "/logs";
-    status = _protocol.makeDirectory(logdir, _hostname, _username);
-    if (status) {
-      std::ostringstream oss;
-      oss << "Cannot create directory " << logdir << " on host " << _hostname;
-      oss << ". Return status is " << status;
-      throw RunTimeException(oss.str());
-    }
-
-    // Copy the file to execute into the remote working directory
-    string executeFile = params[EXECUTABLE];
-    if (executeFile.size() != 0) {
-      status = _protocol.copyFile(executeFile, "", "",
-                                  params[WORKDIR], _hostname, _username);
-      if (status) {
-        std::ostringstream oss;
-        oss << "Cannot copy file " << executeFile << " on host " << _hostname;
-        oss << ". Return status is " << status;
-        throw RunTimeException(oss.str());
-      }
-
-#ifdef WIN32
-      // On Windows, we make the remote file executable afterward because
-      // pscp does not preserve access permissions on files
-
-      string remoteExec = string(params[EXECUTABLE]);
-      remoteExec = remoteExec.substr(remoteExec.rfind("\\") + 1, remoteExec.length());
-      remoteExec = string(params[WORKDIR]) + "/" + executable;
-
-      string subCommand = string("chmod u+x ") + remoteExec;
-      string command = _protocol.getExecCommand(subCommand, _hostname, _username);
-      cerr << command.c_str() << endl;
-      status = system(command.c_str());
-      if (status) {
-        std::ostringstream oss;
-        oss << "Cannot change permissions of file " << remoteExec << " on host " << _hostname;
-        oss << ". Return status is " << status;
-        throw RunTimeException(oss.str());
-      }
-#endif
-    }
-
-    // Copy input files into the remote working directory
-    for (Vit=V.begin() ; Vit!=V.end() ; Vit++) {
-      CoupleType cpt = *static_cast< CoupleType * >(*Vit);
-      Couple inputFile = cpt;
-      string remotePath = inputFile.getRemote();
-      if (!Utils::isAbsolutePath(remotePath)) {
-        remotePath = params[WORKDIR].str() + "/" + remotePath;
-      }
-      status = _protocol.copyFile(inputFile.getLocal(), "", "",
-                                  remotePath, _hostname, _username);
-      if (status) {
-        std::ostringstream oss;
-        oss << "Cannot copy file " << inputFile.getLocal() << " on host " << _hostname;
-        oss << ". Return status is " << status;
-        throw RunTimeException(oss.str());
-      }
-    }
-
-  }
-
-  void BatchManager::importOutputFiles( const Job & job, const string directory )
-  {
-    Parametre params = job.getParametre();
-    const Versatile & V = params[OUTFILE];
-    Versatile::const_iterator Vit;
-
-    // Create local result directory
-    int status = CommunicationProtocol::getInstance(SH).makeDirectory(directory, "", "");
-    if (status) {
-      string mess("Directory creation failed. Status is :");
-      ostringstream status_str;
-      status_str << status;
-      mess += status_str.str();
-      cerr << mess << endl;
-    }
-
-    for(Vit=V.begin(); Vit!=V.end(); Vit++) {
-      CoupleType cpt  = *static_cast< CoupleType * >(*Vit);
-      Couple outputFile = cpt;
-      string remotePath = outputFile.getRemote();
-      if (!Utils::isAbsolutePath(remotePath)) {
-        remotePath = params[WORKDIR].str() + "/" + remotePath;
-      }
-      string localPath = outputFile.getLocal();
-      if (!Utils::isAbsolutePath(localPath)) {
-        localPath = directory + "/" + localPath;
-      }
-      status = _protocol.copyFile(remotePath, _hostname, _username,
-                                  localPath, "", "");
-      if (status) {
-        // Try to get what we can (logs files)
-        // throw BatchException("Error of connection on remote host");
-        std::string mess("Copy command failed ! status is :");
-        ostringstream status_str;
-        status_str << status;
-        mess += status_str.str();
-        cerr << mess << endl;
-      }
-    }
-
-    // Copy logs
-    status = _protocol.copyFile(string(params[WORKDIR]) + string("/logs"), _hostname, _username,
-                                directory, "", "");
-    if (status) {
-      std::string mess("Copy logs directory failed ! status is :");
-      ostringstream status_str;
-      status_str << status;
-      mess += status_str.str();
-      cerr << mess << endl;
-    }
-
-  }
-
-  bool BatchManager::importDumpStateFile( const Job & job, const string directory )
-  {
-    Parametre params = job.getParametre();
-
-    // Create local result directory
-    int status = CommunicationProtocol::getInstance(SH).makeDirectory(directory, "", "");
-    if (status) {
-      string mess("Directory creation failed. Status is :");
-      ostringstream status_str;
-      status_str << status;
-      mess += status_str.str();
-      cerr << mess << endl;
-    }
-
-    bool ret = true;
-    status = _protocol.copyFile(string(params[WORKDIR]) + string("/dumpState*.xml"), _hostname, _username,
-                                directory, "", "");
-    if (status) {
-      // Try to get what we can (logs files)
-      // throw BatchException("Error of connection on remote host");
-      std::string mess("Copy command failed ! status is :");
-      ostringstream status_str;
-      status_str << status;
-      mess += status_str.str();
-      cerr << mess << endl;
-      ret = false;
-    }
-    return ret;
-  }
-
-  MpiImpl *BatchManager::FactoryMpiImpl(string mpiImpl)
-  {
-    if(mpiImpl == "lam")
-      return new MpiImpl_LAM();
-    else if(mpiImpl == "mpich1")
-      return new MpiImpl_MPICH1();
-    else if(mpiImpl == "mpich2")
-      return new MpiImpl_MPICH2();
-    else if(mpiImpl == "openmpi")
-      return new MpiImpl_OPENMPI();
-    else if(mpiImpl == "ompi")
-      return new MpiImpl_OMPI();
-    else if(mpiImpl == "slurm")
-      return new MpiImpl_SLURM();
-    else if(mpiImpl == "prun")
-      return new MpiImpl_PRUN();
-    else if(mpiImpl == "nompi")
-      return NULL;
-    else{
-      ostringstream oss;
-      oss << mpiImpl << " : not yet implemented";
-      throw RunTimeException(oss.str().c_str());
-    }
-  }
-
-  const CommunicationProtocol & BatchManager::getProtocol() const
-  {
-    return _protocol;
-  }
-
-}
diff --git a/src/Core/Batch_BatchManager.hxx b/src/Core/Batch_BatchManager.hxx
deleted file mode 100644 (file)
index 12086f7..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * BatchManager.hxx : 
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date   : Septembre 2003
- * Projet : SALOME 2
- *
- */
-
-#ifndef _BATCHMANAGER_H_
-#define _BATCHMANAGER_H_
-
-#include "Batch_Defines.hxx"
-
-#include <string>
-#include <map>
-#include "Batch_Job.hxx"
-#include "Batch_JobId.hxx"
-#include "Batch_JobInfo.hxx"
-#include "Batch_InvalidArgumentException.hxx"
-#include "Batch_CommunicationProtocol.hxx"
-#include "Batch_MpiImpl.hxx"
-
-namespace Batch {
-
-  class Job;
-  class JobId;
-  class JobInfo;
-  class FactBatchManager;
-
-  class BATCH_EXPORT BatchManager
-  {
-  public:
-    // Constructeur et destructeur
-    BatchManager(const Batch::FactBatchManager * parent, const char * host = "localhost",
-                 const char * username = "",
-                 CommunicationProtocolType protocolType = SSH, const char * mpiImpl = "nompi");
-    virtual ~BatchManager();
-    virtual std::string __repr__() const;
-
-    // Recupere le l'identifiant d'un job deja soumis au BatchManager
-    //virtual const JobId getJobIdByReference(const std::string & ref);
-    virtual const Batch::JobId getJobIdByReference(const char * ref);
-
-    // Methodes pour le controle des jobs : virtuelles pures
-    virtual const Batch::JobId submitJob(const Batch::Job & job) = 0; // soumet un job au gestionnaire
-    virtual void deleteJob(const Batch::JobId & jobid) = 0; // retire un job du gestionnaire
-    virtual void holdJob(const Batch::JobId & jobid) = 0; // suspend un job en file d'attente
-    virtual void releaseJob(const Batch::JobId & jobid) = 0; // relache un job suspendu
-    virtual void alterJob(const Batch::JobId & jobid, const Batch::Parametre & param, const Batch::Environnement & env) = 0; // modifie un job en file d'attente
-    virtual void alterJob(const Batch::JobId & jobid, const Batch::Parametre & param) = 0; // modifie un job en file d'attente
-    virtual void alterJob(const Batch::JobId & jobid, const Batch::Environnement & env) = 0; // modifie un job en file d'attente
-    virtual Batch::JobInfo queryJob(const Batch::JobId & jobid) = 0; // renvoie l'etat du job
-    virtual const Batch::JobId addJob(const Batch::Job & job, const std::string reference) = 0; // ajoute un nouveau job sans le soumettre
-    virtual std::string waitForJobEnd(const Batch::JobId & jobid, long timeout = -1,
-                                      long initSleepTime = 1, long maxSleepTime = 600);
-    virtual void importOutputFiles( const Job & job, const std::string directory );
-    bool importDumpStateFile( const Job & job, const std::string directory );
-
-    // Get the underlying communication protocol
-    const CommunicationProtocol & getProtocol() const;
-
-  protected:
-    std::string _hostname; // serveur ou tourne le BatchManager
-    // std::map< const std::string, const Batch::JobId * > jobid_map; // table des jobs deja soumis
-    std::map< std::string, const Batch::JobId * > jobid_map; // table des jobs deja soumis
-    const Batch::FactBatchManager * _parent;
-    const CommunicationProtocol & _protocol; // protocol to access _hostname
-    const std::string _username; // username to access _hostname
-    MpiImpl *_mpiImpl; // Mpi implementation to launch executable in batch script
-
-    MpiImpl* FactoryMpiImpl(std::string mpiImpl);
-    void exportInputFiles(const Job & job);
-
-  private:
-
-  };
-
-}
-
-#endif
diff --git a/src/Core/Batch_BatchManagerCatalog.cxx b/src/Core/Batch_BatchManagerCatalog.cxx
deleted file mode 100644 (file)
index 8597688..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * BatchManagerCatalog.cxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date   : Septembre 2004
- * Projet : SALOME 2
- * Modified by Renaud Barate, April 2009
- *
- */
-
-#include <string>
-#include <sstream>
-#include <map>
-#include "Batch_BatchManagerCatalog.hxx"
-#include "Batch_FactBatchManager.hxx"
-using namespace std;
-
-namespace Batch {
-
-  // Constructeur
-  BatchManagerCatalog::BatchManagerCatalog()
-  {
-    pthread_mutex_init(&_mutex, NULL);
-  }
-
-  // Destructeur
-  BatchManagerCatalog::~BatchManagerCatalog()
-  {
-    pthread_mutex_destroy(&_mutex);
-  }
-
-  /**
-   * Returns the catalog singleton.
-   * We use the construct-on-first-use idiom here because otherwise there could be a problem with
-   * the initialization order between the factory singletons and this catalog. Note that since the
-   * destructors do not depend on the other objects, the order is not important for destruction.
-   */
-  BatchManagerCatalog& BatchManagerCatalog::getInstance () {
-    static BatchManagerCatalog instance;
-    return instance;
-  }
-
-  void BatchManagerCatalog::addFactBatchManager(const char * type, FactBatchManager * pFBM)
-  {
-    if (pFBM) { // *** section critique ***
-      pthread_mutex_lock(&_mutex);
-      _catalog[type] = pFBM;
-      pthread_mutex_unlock(&_mutex);
-    }
-  }
-
-  bool BatchManagerCatalog::hasFactBatchManager(const char * type)
-  {
-    pthread_mutex_lock(&_mutex);
-    bool result = (_catalog.find(type) != _catalog.end());
-    pthread_mutex_unlock(&_mutex);
-    return result;
-  }
-
-  // Functor
-  FactBatchManager * BatchManagerCatalog::operator() (const char * type)
-  {
-    FactBatchManager * result = NULL;
-    pthread_mutex_lock(&_mutex);
-    if (_catalog.find(type) != _catalog.end()) result = _catalog[type];
-    pthread_mutex_unlock(&_mutex);
-    return result;
-  }
-
-  std::map<string, FactBatchManager *> * BatchManagerCatalog::dict()
-  {
-    return &_catalog;
-  }
-
-  string BatchManagerCatalog::__repr__() const
-  {
-    ostringstream oss;
-    oss << "<BatchManagerCatalog contains {";
-    string sep;
-    for(std::map<string, FactBatchManager *>::const_iterator it = _catalog.begin(); it != _catalog.end(); it++, sep=", ") {
-      oss << sep << "'" << (*it).first << "' : '" << (*it).second->__repr__() << "'";
-    }
-    oss << "}>";
-    return oss.str();
-  }
-
-}
diff --git a/src/Core/Batch_BatchManagerCatalog.hxx b/src/Core/Batch_BatchManagerCatalog.hxx
deleted file mode 100644 (file)
index dad4388..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * BatchManagerCatalog.hxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date   : Septembre 2004
- * Projet : SALOME 2
- * Modified by Renaud Barate, April 2009
- *
- */
-
-#ifndef _CATALOG_H_
-#define _CATALOG_H_
-
-#include "Batch_Defines.hxx"
-
-#include <string>
-#include <map>
-#include <pthread.h>
-
-namespace Batch {
-
-  class FactBatchManager;
-
-  class BATCH_EXPORT BatchManagerCatalog
-  {
-  public:
-    static BatchManagerCatalog& getInstance();
-
-    void addFactBatchManager(const char * type, Batch::FactBatchManager * pFBM);
-    bool hasFactBatchManager(const char * type);
-    Batch::FactBatchManager * operator() (const char * type);
-
-    virtual std::map<std::string, FactBatchManager *> * dict();
-    virtual std::string __repr__() const;
-
-  protected:
-    // Constructeur
-    BatchManagerCatalog();
-    // Destructeur
-    virtual ~BatchManagerCatalog();
-
-    std::map<std::string, FactBatchManager *> _catalog;
-    pthread_mutex_t _mutex;
-
-  private:
-
-    // Forbid the use of copy constructor and assignment operator
-    BatchManagerCatalog(const BatchManagerCatalog & orig) {}
-    void operator=(const BatchManagerCatalog & orig) {}
-
-  };
-
-}
-
-#endif
diff --git a/src/Core/Batch_BoolType.cxx b/src/Core/Batch_BoolType.cxx
deleted file mode 100644 (file)
index a5dec46..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * BoolType.cxx : 
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date   : Septembre 2003
- * Projet : SALOME 2
- *
- */
-
-#include <string>
-#include <assert.h>
-#include "Batch_BoolType.hxx"
-using namespace std;
-
-namespace Batch {
-
-       // Conversion en chaine
-  string BoolType::affiche() const
-  {
-               return _data ? string("true") : string("false");
-  }
-
-       // Operateur d'affectation
-  BoolType & BoolType::operator =(bool b)
-  {
-    _data = b;
-    return *this;
-  }
-
-       // Conversion en bool
-  BoolType::operator bool() const
-  {
-    return this->_data;
-  }
-
-       // Clone duplique l'objet et en fabrique un nouveau a l'aide de new
-       // qu'il faudra detruire ensuite manuellement
-  GenericType * BoolType::clone() const
-  {
-    BoolType * pB = new BoolType(this->_data);
-    assert(pB != 0);
-    return pB;
-  }
-
-}
diff --git a/src/Core/Batch_BoolType.hxx b/src/Core/Batch_BoolType.hxx
deleted file mode 100644 (file)
index 7695320..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * BoolType.hxx : 
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date   : Septembre 2003
- * Projet : SALOME 2
- *
- */
-
-#ifndef _BOOLTYPE_H_
-#define _BOOLTYPE_H_
-
-#include "Batch_Defines.hxx"
-
-#include <string>
-#include "Batch_GenericType.hxx"
-
-namespace Batch {
-
-  class BATCH_EXPORT BoolType : public GenericType
-  {
-  public:
-               // Constructeur
-    BoolType(const bool b=false) : _data(b) {}
-
-               // Conversion en chaine
-    virtual std::string affiche() const;
-
-               // Operateur d'affectation
-    virtual BoolType & operator =(bool);
-
-               // Conversion en bool
-    virtual operator bool() const;
-
-               // Clone duplique l'objet et en fabrique un nouveau a l'aide de new
-               // qu'il faudra detruire ensuite manuellement
-    virtual GenericType * clone() const;
-
-  protected:
-    bool _data;
-
-  private:
-
-  };
-
-}
-
-#endif
diff --git a/src/Core/Batch_CommunicationProtocol.cxx b/src/Core/Batch_CommunicationProtocol.cxx
deleted file mode 100644 (file)
index 8a3ef6a..0000000
+++ /dev/null
@@ -1,167 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- *  Batch_CommunicationProtocol.cxx :
- *
- *  Created on: 14 sept. 2009
- *  Author : Renaud BARATE - EDF R&D
- */
-
-#include <stdlib.h>
-#include <iostream>
-#include <stdlib.h>
-
-#include <Batch_config.h>
-
-#include "Batch_CommunicationProtocol.hxx"
-#ifdef HAS_RSH
- #include "Batch_CommunicationProtocolRSH.hxx"
-#endif
-#ifdef HAS_SH
- #include "Batch_CommunicationProtocolSH.hxx"
-#endif
-#ifdef HAS_SSH
- #include "Batch_CommunicationProtocolSSH.hxx"
-#endif
-#include "Batch_APIInternalFailureException.hxx"
-#include "Batch_RunTimeException.hxx"
-
-using namespace std;
-
-namespace Batch {
-
-  CommunicationProtocol::~CommunicationProtocol()
-  {
-  }
-
-  const CommunicationProtocol & CommunicationProtocol::getInstance(CommunicationProtocolType protocolType)
-  {
-    if (protocolType == SH) {
-#ifdef HAS_SH
-      static CommunicationProtocolSH instanceSH;
-      return instanceSH;
-#else
-      throw RunTimeException("Can't use SH protocol (SH tools were "
-                             "not found on the system at compile time).");
-#endif
-    } else if (protocolType == RSH) {
-#ifdef HAS_RSH
-      static CommunicationProtocolRSH instanceRSH;
-      return instanceRSH;
-#else
-      throw RunTimeException("Can't use RSH protocol (RSH tools were "
-                             "not found on the system at compile time).");
-#endif
-    } else if (protocolType == SSH) {
-#ifdef HAS_SSH
-      static CommunicationProtocolSSH instanceSSH;
-      return instanceSSH;
-#else
-      throw RunTimeException("Can't use SSH protocol (SSH tools were "
-                             "not found on the system at compile time).");
-#endif
-    } else
-      throw APIInternalFailureException("Unknown communication protocol.");
-  }
-
-  string CommunicationProtocol::getExecCommand(const string & subCommand,
-                                               const string & host,
-                                               const string & user) const
-  {
-    return commandStringFromArgs(getExecCommandArgs(subCommand, host, user));
-  }
-
-  int CommunicationProtocol::copyFile(const std::string & sourcePath,
-                                      const std::string & sourceHost,
-                                      const std::string & sourceUser,
-                                      const std::string & destinationPath,
-                                      const std::string & destinationHost,
-                                      const std::string & destinationUser) const
-  {
-    string command = commandStringFromArgs(getCopyCommandArgs(sourcePath, sourceHost, sourceUser,
-                                                              destinationPath, destinationHost,
-                                                              destinationUser));
-    cout << command.c_str() << endl;
-    int status = system(command.c_str());
-    return status;
-  }
-
-  string CommunicationProtocol::getRemoveSubCommand(const string & path) const
-  {
-    return string("rm ") + path;
-  }
-
-  string CommunicationProtocol::getMakeDirectorySubCommand(const string & path) const
-  {
-    return string("mkdir -p ") + path;
-  }
-
-  int CommunicationProtocol::removeFile(const std::string & path,
-                                        const std::string & host,
-                                        const std::string & user) const
-  {
-    string command = getExecCommand(getRemoveSubCommand(path), host, user);
-    cout << command.c_str() << endl;
-    int status = system(command.c_str());
-    return status;
-  }
-
-  int CommunicationProtocol::makeDirectory(const std::string & path,
-                                           const std::string & host,
-                                           const std::string & user) const
-  {
-    string command = getExecCommand(getMakeDirectorySubCommand(path), host, user);
-    cout << command.c_str() << endl;
-    int status = system(command.c_str());
-    return status;
-  }
-
-  string CommunicationProtocol::commandStringFromArgs(const vector<string> & commandArgs) const
-  {
-    string commandStr;
-
-    // On Windows we surround the whole command with quotes to avoid problems when
-    // we have several quoted arguments.
-#ifdef WIN32
-    commandStr += "\"";
-#endif
-
-    for (unsigned int i=0 ; i<commandArgs.size() ; i++) {
-      if (i != 0) commandStr += " ";
-
-      // if the argument contains spaces, we surround it with simple quotes (Linux)
-      // or double quotes (Windows)
-      if (commandArgs[i].find(' ') != string::npos) {
-        commandStr += string("\"") + commandArgs[i] + "\"";
-      } else {
-        commandStr += commandArgs[i];
-      }
-    }
-
-#ifdef WIN32
-    commandStr += "\"";
-#endif
-
-    return commandStr;
-  }
-
-}
diff --git a/src/Core/Batch_CommunicationProtocol.hxx b/src/Core/Batch_CommunicationProtocol.hxx
deleted file mode 100644 (file)
index a300ff1..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- *  Batch_CommunicationProtocol.hxx :
- *
- *  Created on: 14 sept. 2009
- *  Author : Renaud BARATE - EDF R&D
- */
-
-#ifndef _BATCHCOMMUNICATIONPROTOCOL_H_
-#define _BATCHCOMMUNICATIONPROTOCOL_H_
-
-#include <string>
-#include <vector>
-
-#include "Batch_Defines.hxx"
-
-namespace Batch {
-
-  enum CommunicationProtocolType {SH, SSH, RSH};
-
-  class BATCH_EXPORT CommunicationProtocol
-  {
-  public:
-    virtual ~CommunicationProtocol();
-
-    static const CommunicationProtocol & getInstance(CommunicationProtocolType protocolType);
-
-    virtual std::string getExecCommand(const std::string & subCommand,
-                                       const std::string & host,
-                                       const std::string & user) const;
-
-    virtual std::vector<std::string> getExecCommandArgs(const std::string & subCommand,
-                                                        const std::string & host,
-                                                        const std::string & user) const=0;
-
-    virtual int copyFile(const std::string & sourcePath,
-                         const std::string & sourceHost,
-                         const std::string & sourceUser,
-                         const std::string & destinationPath,
-                         const std::string & destinationHost,
-                         const std::string & destinationUser) const;
-
-    virtual int removeFile(const std::string & path,
-                           const std::string & host,
-                           const std::string & user) const;
-
-    virtual int makeDirectory(const std::string & path,
-                              const std::string & host,
-                              const std::string & user) const;
-
-  protected:
-
-    virtual std::vector<std::string> getCopyCommandArgs(const std::string & sourcePath,
-                                                        const std::string & sourceHost,
-                                                        const std::string & sourceUser,
-                                                        const std::string & destinationPath,
-                                                        const std::string & destinationHost,
-                                                        const std::string & destinationUser) const=0;
-
-    virtual std::string getRemoveSubCommand(const std::string & path) const;
-
-    virtual std::string getMakeDirectorySubCommand(const std::string & path) const;
-
-    std::string commandStringFromArgs(const std::vector<std::string> & args) const;
-
-  };
-
-}
-
-#endif
diff --git a/src/Core/Batch_CommunicationProtocolRSH.cxx b/src/Core/Batch_CommunicationProtocolRSH.cxx
deleted file mode 100644 (file)
index 99f28ba..0000000
+++ /dev/null
@@ -1,192 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- *  Batch_CommunicationProtocolRSH.cxx :
- *
- *  Created on: 14 sept. 2009
- *  Author : Renaud BARATE - EDF R&D
- */
-
-#ifdef WIN32
-#include <direct.h>
-#include <iostream>
-
-#include <Batch_RunTimeException.hxx>
-#endif
-
-#include <Batch_config.h>
-
-#include "Batch_CommunicationProtocolRSH.hxx"
-
-using namespace std;
-
-namespace Batch {
-
-  vector<string> CommunicationProtocolRSH::getExecCommandArgs(const string & subCommand,
-                                                              const string & host,
-                                                              const string & user) const
-  {
-    vector<string> cmd;
-
-    cmd.push_back(RSH_COMMAND);
-    cmd.push_back(host);
-
-    if (user.size() > 0) {
-      cmd.push_back("-l");
-      cmd.push_back(user);
-    }
-
-#ifdef WIN32
-    cmd.push_back("-n");
-#endif
-
-    cmd.push_back(subCommand);
-
-    return cmd;
-  }
-
-  vector<string> CommunicationProtocolRSH::getCopyCommandArgs(const string & sourcePath,
-                                                              const string & sourceHost,
-                                                              const string & sourceUser,
-                                                              const string & destinationPath,
-                                                              const string & destinationHost,
-                                                              const string & destinationUser) const
-  {
-    vector<string> cmd;
-
-    string fullSource;
-    if (sourceHost.size() != 0) {
-      if (sourceUser.size() != 0) {
-#ifdef WIN32
-        fullSource += sourceHost + "." + sourceUser + ":";
-#else
-        fullSource += sourceUser + "@" + sourceHost + ":";
-#endif
-      } else {
-        fullSource += sourceHost + ":";
-      }
-    }
-    fullSource += sourcePath;
-
-    string fullDestination;
-    if (destinationHost.size() != 0) {
-      if (destinationUser.size() != 0) {
-#ifdef WIN32
-        fullDestination += destinationHost + "." + destinationUser + ":";
-#else
-        fullDestination += destinationUser + "@" + destinationHost + ":";
-#endif
-      } else {
-        fullDestination += destinationHost + ":";
-      }
-    }
-    fullDestination += destinationPath;
-
-    cmd.push_back(RCP_COMMAND);
-    cmd.push_back("-r");
-    cmd.push_back(fullSource);
-    cmd.push_back(fullDestination);
-
-    return cmd;
-  }
-
-#ifdef WIN32
-  int CommunicationProtocolRSH::copyFile(const std::string & sourcePath,
-                                         const std::string & sourceHost,
-                                         const std::string & sourceUser,
-                                         const std::string & destinationPath,
-                                         const std::string & destinationHost,
-                                         const std::string & destinationUser) const
-  {
-    // On Windows, we can't use drive letters in the paths of rcp command because they
-    // are confused with host names. So we must first change the working directory and
-    // then copy the file using its path without the drive letter.
-
-    // Extract the drive letter from the source path
-    string sourcePathWithoutDrive;
-    char sourceDriveLetter = getDriveLetter(sourcePath, &sourcePathWithoutDrive);
-    // Error if we have a drive letter and it is a remote path
-    if (sourceDriveLetter != '\0' && sourceHost.size() != 0)
-      throw RunTimeException(string("Invalid path: ") + sourcePath + " for host " + sourceHost);
-
-    // Extract the drive letter from the destination path
-    string destinationPathWithoutDrive;
-    char destinationDriveLetter = getDriveLetter(destinationPath, &destinationPathWithoutDrive);
-    // Error if we have a drive letter and it is a remote path
-    if (destinationDriveLetter != '\0' && destinationHost.size() != 0)
-      throw RunTimeException(string("Invalid path: ") + destinationPath + " for host " + destinationHost);
-
-    // Error if we have two drive letters and they are different
-    if (sourceDriveLetter != '\0' && destinationDriveLetter != '\0' &&
-        sourceDriveLetter != destinationDriveLetter)
-      throw RunTimeException(string("Can't use RCP to copy files between different drives: ") +
-                             sourcePath + (", ") + destinationPath);
-
-    // Now get the drive letter to use if there is one
-    char driveLetter = (sourceDriveLetter != '\0') ? sourceDriveLetter : destinationDriveLetter;
-
-    // Get the drive of the current working directory
-    char cwd[_MAX_PATH];
-    _getcwd(cwd, _MAX_PATH);
-    char currentDrive = getDriveLetter(cwd);
-
-    // Change working directory if necessary
-    if (driveLetter != '\0' && driveLetter != currentDrive) {
-      char newdir[3];
-      newdir[0] = driveLetter;
-      newdir[1] = ':';
-      newdir[2] = '\0';
-      cout << "Changing directory: " << newdir << endl;
-      _chdir(newdir);
-    }
-
-    int status = CommunicationProtocol::copyFile(sourcePathWithoutDrive, sourceHost, sourceUser,
-                                                 destinationPathWithoutDrive, destinationHost, destinationUser);
-
-    // Go back to previous directory if necessary
-    if (driveLetter != '\0' && driveLetter != currentDrive) {
-      cout << "Changing directory: " << cwd << endl;
-      _chdir(cwd);
-    }
-
-    return status;
-  }
-
-  char CommunicationProtocolRSH::getDriveLetter(const string & path, string * pathWithoutDrive) const
-  {
-    if (path.find(':') != string::npos) {
-      // Error if the colon is not the second character
-      if (path.size() < 2 || path[1] != ':')
-        throw RunTimeException(string("Invalid path: ") + path);
-      else {
-        if (pathWithoutDrive != NULL) *pathWithoutDrive = path.substr(2);
-        return path[0];
-      }
-    } else {
-      if (pathWithoutDrive != NULL) *pathWithoutDrive = path;
-      return '\0';
-    }
-  }
-
-#endif
-
-}
diff --git a/src/Core/Batch_CommunicationProtocolRSH.hxx b/src/Core/Batch_CommunicationProtocolRSH.hxx
deleted file mode 100644 (file)
index e2a475d..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- *  Batch_CommunicationProtocolRSH.hxx :
- *
- *  Created on: 14 sept. 2009
- *  Author : Renaud BARATE - EDF R&D
- */
-
-#ifndef _BATCHCOMMUNICATIONPROTOCOLRSH_H_
-#define _BATCHCOMMUNICATIONPROTOCOLRSH_H_
-
-#include <string>
-#include <vector>
-
-#include "Batch_Defines.hxx"
-#include "Batch_CommunicationProtocol.hxx"
-
-namespace Batch {
-
-  class BATCH_EXPORT CommunicationProtocolRSH : public CommunicationProtocol
-  {
-  public:
-    std::vector<std::string> getExecCommandArgs(const std::string & subCommand,
-                                                const std::string & host,
-                                                const std::string & user) const;
-
-    std::vector<std::string> getCopyCommandArgs(const std::string & sourcePath,
-                                                const std::string & sourceHost,
-                                                const std::string & sourceUser,
-                                                const std::string & destinationPath,
-                                                const std::string & destinationHost,
-                                                const std::string & destinationUser) const;
-
-#ifdef WIN32
-
-    // On Windows, we must reimplement copyFile because there are problems with absolute
-    // paths containing a colon.
-    int copyFile(const std::string & sourcePath,
-                 const std::string & sourceHost,
-                 const std::string & sourceUser,
-                 const std::string & destinationPath,
-                 const std::string & destinationHost,
-                 const std::string & destinationUser) const;
-
-  protected:
-
-    char getDriveLetter(const std::string & path, std::string * pathWithoutDrive = NULL) const;
-
-#endif
-
-  };
-
-}
-
-#endif
diff --git a/src/Core/Batch_CommunicationProtocolSH.cxx b/src/Core/Batch_CommunicationProtocolSH.cxx
deleted file mode 100644 (file)
index 3ef7180..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- *  Batch_CommunicationProtocolSH.cxx :
- *
- *  Created on: 16 sept. 2009
- *  Author : Renaud BARATE - EDF R&D
- */
-
-#include <Batch_config.h>
-
-#include "Batch_CommunicationProtocolSH.hxx"
-
-using namespace std;
-
-namespace Batch {
-
-  // Simple method to fix path strings depending on the platform. On Windows, it will replace
-  // forward slashes '/' by backslashes '\'. On Unix, the path is just copied without change.
-  string CommunicationProtocolSH::fixPath(const string & path) const
-  {
-    string fixedPath = path;
-  #ifdef WIN32
-    for (unsigned int i=0 ; i<fixedPath.size() ; i++) {
-      if (fixedPath[i] == '/') fixedPath[i] = '\\';
-    }
-  #endif
-    return fixedPath;
-  }
-
-  vector<string> CommunicationProtocolSH::getExecCommandArgs(const string & subCommand,
-                                                             const string & host,
-                                                             const string & user) const
-  {
-    vector<string> cmd;
-
-    cmd.push_back(fixPath(SH_COMMAND));
-
-#ifdef WIN32
-    cmd.push_back("/c");
-#else
-    cmd.push_back("-c");
-#endif
-
-    cmd.push_back(fixPath(subCommand));
-
-    return cmd;
-  }
-
-  vector<string> CommunicationProtocolSH::getCopyCommandArgs(const string & sourcePath,
-                                                             const string & sourceHost,
-                                                             const string & sourceUser,
-                                                             const string & destinationPath,
-                                                             const string & destinationHost,
-                                                             const string & destinationUser) const
-  {
-    vector<string> cmd;
-    cmd.push_back(CP_COMMAND);
-#ifndef WIN32
-    cmd.push_back("-r");
-#endif
-    cmd.push_back(fixPath(sourcePath));
-    cmd.push_back(fixPath(destinationPath));
-    return cmd;
-  }
-
-  string CommunicationProtocolSH::getRemoveSubCommand(const string & path) const
-  {
-    return string(RM_COMMAND) + " " + fixPath(path);
-  }
-
-  string CommunicationProtocolSH::getMakeDirectorySubCommand(const string & path) const
-  {
-    string subCommand = MKDIR_COMMAND;
-#ifndef WIN32
-    subCommand += " -p";
-#endif
-    subCommand += " " + fixPath(path);
-    return subCommand;
-  }
-
-}
diff --git a/src/Core/Batch_CommunicationProtocolSH.hxx b/src/Core/Batch_CommunicationProtocolSH.hxx
deleted file mode 100644 (file)
index 46e0d8c..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- *  Batch_CommunicationProtocolSH.hxx :
- *
- *  Created on: 16 sept. 2009
- *  Author : Renaud BARATE - EDF R&D
- */
-
-#ifndef _BATCHCOMMUNICATIONPROTOCOLSH_H_
-#define _BATCHCOMMUNICATIONPROTOCOLSH_H_
-
-#include <string>
-#include <vector>
-
-#include "Batch_Defines.hxx"
-#include "Batch_CommunicationProtocol.hxx"
-
-namespace Batch {
-
-  class BATCH_EXPORT CommunicationProtocolSH : public CommunicationProtocol
-  {
-  public:
-    std::vector<std::string> getExecCommandArgs(const std::string & subCommand,
-                                                const std::string & host,
-                                                const std::string & user) const;
-
-    std::vector<std::string> getCopyCommandArgs(const std::string & sourcePath,
-                                                const std::string & sourceHost,
-                                                const std::string & sourceUser,
-                                                const std::string & destinationPath,
-                                                const std::string & destinationHost,
-                                                const std::string & destinationUser) const;
-
-  protected:
-
-    std::string getRemoveSubCommand(const std::string & path) const;
-
-    std::string getMakeDirectorySubCommand(const std::string & path) const;
-
-    std::string fixPath(const std::string & path) const;
-
-  };
-
-}
-
-#endif
diff --git a/src/Core/Batch_CommunicationProtocolSSH.cxx b/src/Core/Batch_CommunicationProtocolSSH.cxx
deleted file mode 100644 (file)
index deac559..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- *  Batch_CommunicationProtocolSSH.cxx :
- *
- *  Created on: 14 sept. 2009
- *  Author : Renaud BARATE - EDF R&D
- */
-
-#include <Batch_config.h>
-
-#include "Batch_CommunicationProtocolSSH.hxx"
-
-using namespace std;
-
-namespace Batch {
-
-  vector<string> CommunicationProtocolSSH::getExecCommandArgs(const string & subCommand,
-                                                              const string & host,
-                                                              const string & user) const
-  {
-    vector<string> cmd;
-
-    cmd.push_back(SSH_COMMAND);
-    cmd.push_back(host);
-
-    if (user.size() != 0) {
-      cmd.push_back("-l");
-      cmd.push_back(user);
-    }
-
-    cmd.push_back(subCommand);
-
-    return cmd;
-  }
-
-  vector<string> CommunicationProtocolSSH::getCopyCommandArgs(const string & sourcePath,
-                                                              const string & sourceHost,
-                                                              const string & sourceUser,
-                                                              const string & destinationPath,
-                                                              const string & destinationHost,
-                                                              const string & destinationUser) const
-  {
-    vector<string> cmd;
-
-    string fullSource;
-    if (sourceHost.size() != 0) {
-      if (sourceUser.size() != 0) {
-        fullSource += sourceUser + "@";
-      }
-      fullSource += sourceHost + ":";
-    }
-#ifndef WIN32
-    fullSource += "'";
-#endif
-    fullSource += sourcePath;
-#ifndef WIN32
-    fullSource += "'";
-#endif
-
-    string fullDestination;
-    if (destinationHost.size() != 0) {
-      if (destinationUser.size() != 0) {
-        fullDestination += destinationUser + "@";
-      }
-      fullDestination += destinationHost + ":";
-    }
-#ifndef WIN32
-    fullDestination += "'";
-#endif
-    fullDestination += destinationPath;
-#ifndef WIN32
-    fullDestination += "'";
-#endif
-
-    // Option -p is used to keep the same permissions for the destination file
-    // (particularly useful to keep scripts executable when copying them)
-    cmd.push_back(SCP_COMMAND);
-    cmd.push_back("-p");
-    cmd.push_back("-r");
-    cmd.push_back(fullSource);
-    cmd.push_back(fullDestination);
-
-    return cmd;
-  }
-
-}
diff --git a/src/Core/Batch_CommunicationProtocolSSH.hxx b/src/Core/Batch_CommunicationProtocolSSH.hxx
deleted file mode 100644 (file)
index 24743ff..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- *  Batch_CommunicationProtocolSSH.hxx :
- *
- *  Created on: 14 sept. 2009
- *  Author : Renaud BARATE - EDF R&D
- */
-
-#ifndef _BATCHCOMMUNICATIONPROTOCOLSSH_H_
-#define _BATCHCOMMUNICATIONPROTOCOLSSH_H_
-
-#include <string>
-#include <vector>
-
-#include "Batch_Defines.hxx"
-#include "Batch_CommunicationProtocol.hxx"
-
-namespace Batch {
-
-  class BATCH_EXPORT CommunicationProtocolSSH : public CommunicationProtocol
-  {
-  public:
-    std::vector<std::string> getExecCommandArgs(const std::string & subCommand,
-                                                const std::string & host,
-                                                const std::string & user) const;
-
-    std::vector<std::string> getCopyCommandArgs(const std::string & sourcePath,
-                                                const std::string & sourceHost,
-                                                const std::string & sourceUser,
-                                                const std::string & destinationPath,
-                                                const std::string & destinationHost,
-                                                const std::string & destinationUser) const;
-
-  protected:
-
-  };
-
-}
-
-#endif
diff --git a/src/Core/Batch_Constants.cxx b/src/Core/Batch_Constants.cxx
deleted file mode 100644 (file)
index a39e390..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * Batch_Constants.cxx :
- *
- * Auteur : Renaud BARATE - EDF R&D
- * Date   : January 2010
- *
- */
-
-#include "Batch_Constants.hxx"
-
-namespace Batch {
-
-  // Definition of the string constants (keys for the parameter map)
-  def_Constant(ARGUMENTS);
-  def_Constant(EXECUTABLE);
-  def_Constant(ID);
-  def_Constant(INFILE);
-  def_Constant(MAXCPUTIME);
-  def_Constant(MAXDISKSIZE);
-  def_Constant(MAXRAMSIZE);
-  def_Constant(MAXWALLTIME);
-  def_Constant(NAME);
-  def_Constant(NBPROC);
-  def_Constant(NBPROCPERNODE);
-  def_Constant(OUTFILE);
-  def_Constant(PID);
-  def_Constant(QUEUE);
-  def_Constant(STATE);
-  def_Constant(USER);
-  def_Constant(WORKDIR);
-  def_Constant(HOMEDIR);
-  def_Constant(EXCLUSIVE);
-
-  // These constants define the status of a job (parameter STATE);
-  def_Constant(CREATED);
-  def_Constant(IN_PROCESS);
-  def_Constant(QUEUED);
-  def_Constant(RUNNING);
-  def_Constant(PAUSED);
-  def_Constant(FINISHED);
-  def_Constant(FAILED);
-
-}
diff --git a/src/Core/Batch_Constants.hxx b/src/Core/Batch_Constants.hxx
deleted file mode 100644 (file)
index 76b64f1..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * Batch_Constants.hxx :
- *
- * Auteur : Renaud BARATE - EDF R&D
- * Date   : January 2010
- *
- */
-
-#ifndef _CONSTANTS_H_
-#define _CONSTANTS_H_
-
-#include <string>
-
-#include "Batch_Defines.hxx"
-
-// These macros simplify the creation of new string constants for keys and
-// values in parameters map.
-// TODO: replace those static declarations by an external description file (XML for instance)
-#define decl_extern_Constant(constant) extern BATCH_EXPORT const std::string constant
-#define def_Constant(constant) const std::string constant = #constant
-
-namespace Batch {
-
-  // Declaration of the keys for the parameter map
-  decl_extern_Constant(ARGUMENTS);
-  decl_extern_Constant(EXECUTABLE);
-  decl_extern_Constant(ID);
-  decl_extern_Constant(INFILE);
-  decl_extern_Constant(MAXCPUTIME);
-  decl_extern_Constant(MAXDISKSIZE);
-  decl_extern_Constant(MAXRAMSIZE);
-  decl_extern_Constant(MAXWALLTIME);
-  decl_extern_Constant(NAME);
-  decl_extern_Constant(NBPROC);
-  decl_extern_Constant(NBPROCPERNODE);
-  decl_extern_Constant(OUTFILE);
-  decl_extern_Constant(PID);
-  decl_extern_Constant(QUEUE);
-  decl_extern_Constant(STATE);
-  decl_extern_Constant(USER);
-  decl_extern_Constant(WORKDIR);
-  decl_extern_Constant(HOMEDIR);
-  decl_extern_Constant(EXCLUSIVE);
-
-  // These constants define the status of a job (parameter STATE)
-  decl_extern_Constant(CREATED);
-  decl_extern_Constant(IN_PROCESS);
-  decl_extern_Constant(QUEUED);
-  decl_extern_Constant(RUNNING);
-  decl_extern_Constant(PAUSED);
-  decl_extern_Constant(FINISHED);
-  decl_extern_Constant(FAILED);
-
-}
-
-#endif
diff --git a/src/Core/Batch_Couple.cxx b/src/Core/Batch_Couple.cxx
deleted file mode 100644 (file)
index d1e49f3..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * Couple.cxx : 
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail   : mailto:ivan.dutka-malen@der.edf.fr
- * Date   : Tue Dec  9 15:00:35 2003
- * Projet : Salome 2
- *
- */
-
-#include "Batch_Couple.hxx"
-using namespace std;
-
-namespace Batch {
-
-       // Operateur d'affectation
-       Couple & Couple::operator =(const Couple & C)
-  {
-               _local  = C._local;
-               _remote = C._remote;
-    return *this;
-  }
-
-       // Conversion en chaine
-  string Couple::str()  const
-  {
-               string res;
-               res  = "Couple(local : ";
-               res += _local;
-               res += ", remote : ";
-               res += _remote;
-               res += ")";
-    return res;
-  }
-
-       // Operateur pour l'affichage sur un stream
-  ostream & operator << (ostream & os, const Couple & cp)
-  {
-    return os << cp.str();
-  }
-
-}
diff --git a/src/Core/Batch_Couple.hxx b/src/Core/Batch_Couple.hxx
deleted file mode 100644 (file)
index ec7238f..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * Couple.hxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail   : mailto:ivan.dutka-malen@der.edf.fr
- * Date   : Tue Dec  9 15:00:35 2003
- * Projet : Salome 2
- *
- */
-
-#ifndef _COUPLE_H_
-#define _COUPLE_H_
-
-#include "Batch_Defines.hxx"
-
-#include <string>
-
-namespace Batch {
-
-  class BATCH_EXPORT Couple
-  {
-  public:
-    // Constructeur standard
-    Couple(const std::string & local="", const std::string & remote="") : _local(local), _remote(remote) {}
-
-    // Constructeur par recopie
-    Couple(const Couple & C) : _local(C._local), _remote(C._remote) {}
-
-    // Destructeur
-    virtual ~Couple() {}
-
-    // Operateur pour l'affichage sur un stream
-    BATCH_EXPORT friend std::ostream & operator << (std::ostream & os, const Couple & cp);
-
-    // Operateur d'affectation
-    virtual Couple & operator =(const Couple &);
-
-    // Conversion en chaine
-    virtual std::string str() const;
-
-    // Accesseurs
-    virtual std::string getLocal() const { return _local; }
-    virtual std::string getRemote() const { return _remote; }
-
-  protected:
-    std::string _local;  // chemin d'acces au fichier local
-    std::string _remote; // chemin d'acees au fichier distant
-
-  private:
-
-  };
-
-}
-
-#endif
diff --git a/src/Core/Batch_CoupleType.cxx b/src/Core/Batch_CoupleType.cxx
deleted file mode 100644 (file)
index 20f1852..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * CoupleType.cxx : 
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail   : mailto:ivan.dutka-malen@der.edf.fr
- * Date   : Tue Dec  9 14:51:53 2003
- * Projet : Salome 2
- *
- */
-
-#include <assert.h>
-#include "Batch_CoupleType.hxx"
-using namespace std;
-
-namespace Batch {
-
-       // Conversion en chaine
-  string CoupleType::affiche() const
-  {
-    return _data.str();
-  }
-
-       // Operateur d'affectation
-  CoupleType & CoupleType::operator =(const Couple & C)
-  {
-    _data = C;
-    return *this;
-  }
-
-       // Conversion en char
-  CoupleType::operator Couple() const
-  {
-    return _data;
-  }
-
-       // Conversion en chaine
-  CoupleType::operator string() const
-  {
-    return _data.str();
-  }
-
-       // Clone duplique l'objet et en fabrique un nouveau a l'aide de new
-       // qu'il faudra detruire ensuite manuellement
-  GenericType * CoupleType::clone() const
-  {
-    CoupleType * pC = new CoupleType(this->_data);
-    assert(pC != 0);
-    return pC;
-  }
-
-}
-
diff --git a/src/Core/Batch_CoupleType.hxx b/src/Core/Batch_CoupleType.hxx
deleted file mode 100644 (file)
index 9b66562..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * CoupleType.hxx : 
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail   : mailto:ivan.dutka-malen@der.edf.fr
- * Date   : Tue Dec  9 14:51:53 2003
- * Projet : Salome 2
- *
- */
-
-#ifndef _COUPLETYPE_H_
-#define _COUPLETYPE_H_
-
-#include "Batch_Defines.hxx"
-
-#include <string>
-#include "Batch_GenericType.hxx"
-#include "Batch_Couple.hxx"
-
-namespace Batch {
-
-  class BATCH_EXPORT CoupleType : public GenericType
-  {
-  public:
-               // Constructeur
-    CoupleType(const Couple & C) : _data(C) {}
-
-               // Conversion en chaine
-    virtual std::string affiche() const;
-    virtual operator std::string() const;
-
-               // Operateur d'affectation
-    virtual CoupleType & operator =(const Couple & C);
-
-               // Conversion en char
-    virtual operator Couple() const;
-
-               // Clone duplique l'objet et en fabrique un nouveau a l'aide de new
-               // qu'il faudra detruire ensuite manuellement
-    virtual GenericType * clone() const;
-
-  protected:
-               Couple _data;
-
-  private:
-
-  };
-
-}
-
-#endif
diff --git a/src/Core/Batch_Date.cxx b/src/Core/Batch_Date.cxx
deleted file mode 100644 (file)
index a81bc87..0000000
+++ /dev/null
@@ -1,195 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * Date.cxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail   : mailto:ivan.dutka-malen@der.edf.fr
- * Date   : Wed Nov 26 14:11:42 2003
- * Projet : Salome 2
- *
- */
-
-#include <cstdio>
-#include <ctime>
-#include "Batch_Date.hxx"
-using namespace std;
-
-namespace Batch {
-
-  Date::Date(const long l)
-  {
-    time_t l_t = l;
-    struct tm * p_tm = localtime(&l_t);
-    _day   = p_tm->tm_mday;
-    _month = p_tm->tm_mon  + 1;
-    _year  = p_tm->tm_year + 1900;
-    _hour  = p_tm->tm_hour;
-    _min   = p_tm->tm_min;
-    _sec   = p_tm->tm_sec;
-  }
-
-  Date::Date(const string s)
-  {
-    if ((s == "now") ||        (s == "Now") || (s == "NOW")) {
-      long l = time(0);
-      time_t l_t = l;
-      struct tm * p_tm = localtime(&l_t);
-      _day   = p_tm->tm_mday;
-      _month = p_tm->tm_mon  + 1;
-      _year  = p_tm->tm_year + 1900;
-      _hour  = p_tm->tm_hour;
-      _min   = p_tm->tm_min;
-      _sec   = p_tm->tm_sec;
-
-    } else {
-//      char c;
-//       istringstream ist(s);
-//       ist >> _day   >> c
-//       >> _month >> c
-//       >> _year  >> c
-//       >> _hour  >> c
-//       >> _min   >> c
-//       >> _sec;
-      sscanf(s.c_str(), "%d/%d/%d-%d:%d:%d", &_day, &_month, &_year, &_hour, &_min, &_sec);
-    }
-  }
-
-  Date & Date::operator =(long l)
-  {
-    time_t l_t = l;
-    struct tm * p_tm = localtime(&l_t);
-    _day   = p_tm->tm_mday;
-    _month = p_tm->tm_mon  + 1;
-    _year  = p_tm->tm_year + 1900;
-    _hour  = p_tm->tm_hour;
-    _min   = p_tm->tm_min;
-    _sec   = p_tm->tm_sec;
-
-    return *this;
-  }
-
-  Date & Date::operator +(long l)
-  {
-    *this = epoch() + l;
-    return *this;
-  }
-
-  Date & Date::operator -(long l)
-  {
-    *this = epoch() - l;
-    return *this;
-  }
-
-  Date & Date::operator +=(long l)
-  {
-    *this = epoch() + l;
-    return *this;
-  }
-
-  Date & Date::operator -=(long l)
-  {
-    *this = epoch() - l;
-    return *this;
-  }
-
-  Date & Date::operator =(const string & s)
-  {
-    if ((s == "now") ||        (s == "Now") || (s == "NOW")) {
-      long l = time(0);
-      time_t l_t = l;
-      struct tm * p_tm = localtime(&l_t);
-      _day   = p_tm->tm_mday;
-      _month = p_tm->tm_mon  + 1;
-      _year  = p_tm->tm_year + 1900;
-      _hour  = p_tm->tm_hour;
-      _min   = p_tm->tm_min;
-      _sec   = p_tm->tm_sec;
-
-    } else {
-//       char c;
-//       istringstream ist(s);
-//       ist >> _day   >> c
-//       >> _month >> c
-//       >> _year  >> c
-//       >> _hour  >> c
-//       >> _min   >> c
-//       >> _sec;
-      sscanf(s.c_str(), "%d/%d/%d-%d:%d:%d", &_day, &_month, &_year, &_hour, &_min, &_sec);
-    }
-
-    return *this;
-  }
-
-  string Date::str() const
-  {
-    char buf[64];
-    string datestr;
-
-    // _day to char *
-    sprintf(buf, "%02d", _day);
-    datestr += buf;
-    datestr += "/";
-
-    // _month to char *
-    sprintf(buf, "%02d", _month);
-    datestr += buf;
-    datestr += "/";
-
-    // _year to char *
-    sprintf(buf, "%04d", _year);
-    datestr += buf;
-    datestr += "-";
-
-    // _hour to char *
-    sprintf(buf, "%02d", _hour);
-    datestr += buf;
-    datestr += ":";
-
-    // _min to char *
-    sprintf(buf, "%02d", _min);
-    datestr += buf;
-    datestr += ":";
-
-    // _sec to char *
-    sprintf(buf, "%02d", _sec);
-    datestr += buf;
-
-    return datestr;
-  }
-
-  long Date::epoch() const
-  {
-    struct tm T;
-    T.tm_mday = _day;
-    T.tm_mon  = _month - 1;
-    T.tm_year = _year  - 1900;
-    T.tm_hour = _hour;
-    T.tm_min  = _min;
-    T.tm_sec  = _sec;
-    return mktime(&T);
-  }
-
-}
-
-
-// COMMENTS
diff --git a/src/Core/Batch_Date.hxx b/src/Core/Batch_Date.hxx
deleted file mode 100644 (file)
index 0a38a91..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * Date.hxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail   : mailto:ivan.dutka-malen@der.edf.fr
- * Date   : Wed Nov 26 14:11:42 2003
- * Projet : Salome 2
- *
- */
-
-#ifndef _DATE_H_
-#define _DATE_H_
-
-#include "Batch_Defines.hxx"
-
-#include <string>
-
-namespace Batch {
-
-  class BATCH_EXPORT Date
-  {
-  public:
-    Date(const long l=0);
-    Date(const std::string s);
-    virtual ~Date() {}
-    virtual Date & operator =(long l);
-    virtual Date & operator +(long l);
-    virtual Date & operator -(long l);
-    virtual Date & operator +=(long l);
-    virtual Date & operator -=(long l);
-    virtual Date & operator =(const std::string & s);
-    virtual std::string str() const;
-    virtual long epoch() const;
-
-  protected:
-    int _day, _month, _year;
-    int _hour, _min, _sec;
-
-  private:
-
-  };
-
-}
-
-#endif
-
-// COMMENTS
diff --git a/src/Core/Batch_Defines.hxx b/src/Core/Batch_Defines.hxx
deleted file mode 100644 (file)
index d53cfdb..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-//  File   : Batch_Defines.hxx
-//  Author : Alexander A. BORODIN
-//  Module : SALOME
-//
-#ifndef _BATCH_Defines_HXX_
-#define _BATCH_Defines_HXX_
-
-#ifdef WIN32
-# if defined Batch_EXPORTS
-#  define BATCH_EXPORT __declspec( dllexport )
-# else
-#  define BATCH_EXPORT __declspec( dllimport )
-# endif
-#else
-# define BATCH_EXPORT
-#endif
-
-#ifdef WIN32
-#define BATCH_CHMOD(name, mode) _chmod(name, mode)
-#else
-#define BATCH_CHMOD(name, mode) chmod(name, mode)
-#endif
-
-#endif
diff --git a/src/Core/Batch_Environnement.cxx b/src/Core/Batch_Environnement.cxx
deleted file mode 100644 (file)
index 0f4dcdc..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * Environnement.cxx : 
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail   : mailto:ivan.dutka-malen@der.edf.fr
- * Date   : Thu Oct 16 11:37:47 2003
- * Projet : Salome 2
- *
- */
-
-#include "Batch_Environnement.hxx"
-using namespace std;
-
-namespace Batch {
-
-
-}
diff --git a/src/Core/Batch_Environnement.hxx b/src/Core/Batch_Environnement.hxx
deleted file mode 100644 (file)
index e99fc7f..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * Environnement.hxx : 
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail   : mailto:ivan.dutka-malen@der.edf.fr
- * Date   : Thu Oct 16 11:37:47 2003
- * Projet : Salome 2
- *
- */
-
-#ifndef _ENVIRONNEMENT_H_
-#define _ENVIRONNEMENT_H_
-
-#include "Batch_Defines.hxx"
-
-
-#include <string>
-#include <map>
-
-namespace Batch {
-
-  typedef std::map < std::string, std::string > Environnement;
-
-}
-
-#endif
-
diff --git a/src/Core/Batch_FactBatchManager.cxx b/src/Core/Batch_FactBatchManager.cxx
deleted file mode 100644 (file)
index df74a91..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * FactBatchManager.cxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date   : Septembre 2004
- * Projet : SALOME 2
- *
- */
-
-#include <string>
-#include <sstream>
-#include <iostream>
-#include "Batch_BatchManagerCatalog.hxx"
-#include "Batch_FactBatchManager.hxx"
-using namespace std;
-
-namespace Batch {
-
-  // Constructeur
-  FactBatchManager::FactBatchManager(const string & _t) : type(_t)
-  {
-    BatchManagerCatalog::getInstance().addFactBatchManager(type.c_str(), this);
-
-   /*
-    ostringstream msg;
-    msg << "FactBatchManager of type '" << type << "' inserted into catalog";
-    cerr << msg.str().c_str() << endl;
-    */
-  }
-
-  // Destructeur
-  FactBatchManager::~FactBatchManager()
-  {
-    // Nothing to do
-  }
-
-  // Accesseur
-  string FactBatchManager::getType() const
-  {
-    return type;
-  }
-
-  string FactBatchManager::__repr__() const
-  {
-    ostringstream oss;
-    oss << "<FactBatchManager of type '" << type << "'>";
-    return oss.str();
-  }
-
-}
diff --git a/src/Core/Batch_FactBatchManager.hxx b/src/Core/Batch_FactBatchManager.hxx
deleted file mode 100644 (file)
index 84ad191..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * FactBatchManager.hxx : 
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date   : Septembre 2004
- * Projet : SALOME 2
- *
- */
-
-#ifndef _FACTBATCHMANAGER_H_
-#define _FACTBATCHMANAGER_H_
-
-#include <string>
-
-#include "Batch_Defines.hxx"
-#include "Batch_CommunicationProtocol.hxx"
-
-namespace Batch {
-  
-  class BatchManager;
-
-  class BATCH_EXPORT FactBatchManager
-  {
-  public:
-    // Constructeur et destructeur
-    FactBatchManager(const std::string & type);
-    virtual ~FactBatchManager();
-
-    virtual Batch::BatchManager * operator() (const char * hostname,
-                                              const char * username = "",
-                                              CommunicationProtocolType protocolType = SSH,
-                                              const char * mpi = "nompi") const = 0;
-    std::string getType() const;
-    std::string __repr__() const;
-
-  protected:
-    std::string type;
-
-  };
-
-}
-
-#endif
diff --git a/src/Core/Batch_GenericException.cxx b/src/Core/Batch_GenericException.cxx
deleted file mode 100644 (file)
index 67b29c1..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * GenericException.cxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail   : mailto:ivan.dutka-malen@der.edf.fr
- * Date   : Wed Nov 26 10:15:57 2003
- * Projet : Salome 2
- *
- */
-
-#include <iostream>
-#include "Batch_GenericException.hxx"
-
-using namespace std;
-
-namespace Batch {
-
-// Operator for writing on a stream
-ostream & operator <<(ostream & os, const GenericException & e)
-{
-  return os << e.type << ": " << e.message;
-}
-
-}
diff --git a/src/Core/Batch_GenericException.hxx b/src/Core/Batch_GenericException.hxx
deleted file mode 100644 (file)
index 435911b..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * GenericException.hxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail   : mailto:ivan.dutka-malen@der.edf.fr
- * Date   : Wed Nov 26 10:15:56 2003
- * Projet : Salome 2
- *
- */
-
-#ifndef _GENERICEXCEPTION_H_
-#define _GENERICEXCEPTION_H_
-
-#include "Batch_Defines.hxx"
-
-
-#include <string>
-
-namespace Batch {
-
-  class BATCH_EXPORT GenericException
-  {
-  public:
-    const std::string type;    // la nature de l'exception
-    const std::string message; // la raison de l'exception
-
-               // Constructeur
-    GenericException(const std::string & tp = "GenericException",
-                     const std::string & ch = "undefined") : type(tp), message(ch) {}
-  };
-
-  // Operator for writing on a stream
-  BATCH_EXPORT std::ostream & operator <<(std::ostream & os, const GenericException & e);
-
-}
-
-#endif
diff --git a/src/Core/Batch_GenericType.cxx b/src/Core/Batch_GenericType.cxx
deleted file mode 100644 (file)
index 810d837..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * GenericType.cxx : 
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date   : Septembre 2003
- * Projet : SALOME 2
- *
- */
-
-
-#include <iostream>
-#include <string>
-#include <assert.h>
-#include "Batch_GenericType.hxx"
-using namespace std;
-
-namespace Batch {
-
-       // nombre total d'objet GenericType et al.
-       int GenericType::_nb = 0;
-
-       // Operateur pour l'affichage sur un stream
-  ostream & operator << (ostream & os, const GenericType & obj)
-  {
-    return os << obj.affiche();
-  }
-
-       // Conversion en chaine
-  string GenericType::affiche() const
-  {
-    return string("(GenericType : si ce message apparait, vous devez avoir un probleme)");
-  }
-
-       // Clone duplique l'objet et en fabrique un nouveau a l'aide de new
-       // qu'il faudra detruire ensuite manuellement
-  GenericType * GenericType::clone() const
-  {
-    GenericType * pG = new GenericType;
-    assert(pG != 0);
-    return pG;
-  }
-
-}
-
diff --git a/src/Core/Batch_GenericType.hxx b/src/Core/Batch_GenericType.hxx
deleted file mode 100644 (file)
index a2520d6..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * GenericType.hxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date   : Septembre 2003
- * Projet : SALOME 2
- *
- */
-
-#ifndef _GENERICTYPE_H_
-#define _GENERICTYPE_H_
-
-#include "Batch_Defines.hxx"
-
-
-#include <iostream>
-#include <string>
-
-namespace Batch {
-
-  class BATCH_EXPORT GenericType
-  {
-  public:
-               // Constructeur et destructeur
-    GenericType() { _nb++; }
-    virtual ~GenericType() { _nb--; }
-
-               // Operateur pour l'affichage sur un stream
-    BATCH_EXPORT friend std::ostream & operator << (std::ostream & os, const GenericType & obj);
-
-               // Conversion en chaine
-    virtual std::string affiche() const;
-
-               // Clone duplique l'objet et en fabrique un nouveau a l'aide de new
-               // qu'il faudra detruire ensuite manuellement
-    virtual GenericType * clone() const;
-
-               // Retourne le nombre d'objets GenericType et al.
-               static int getNb() { return _nb; }
-
-  protected:
-
-  private:
-               static int _nb; // nombre total d'objets GenericType et al.
-
-  };
-
-}
-
-#endif
-
diff --git a/src/Core/Batch_InvalidArgumentException.cxx b/src/Core/Batch_InvalidArgumentException.cxx
deleted file mode 100644 (file)
index a027307..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * InvalidArgumentException.cxx : 
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail   : mailto:ivan.dutka-malen@der.edf.fr
- * Date   : Thu Oct 16 16:18:00 2003
- * Projet : Salome 2
- *
- */
-
-#include "Batch_InvalidArgumentException.hxx"
-using namespace std;
-
-namespace Batch {
-
-}
diff --git a/src/Core/Batch_InvalidArgumentException.hxx b/src/Core/Batch_InvalidArgumentException.hxx
deleted file mode 100644 (file)
index fbd55b6..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * InvalidArgumentException.hxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail   : mailto:ivan.dutka-malen@der.edf.fr
- * Date   : Thu Oct 16 16:18:00 2003
- * Projet : Salome 2
- *
- */
-
-#ifndef _INVALIDARGUMENTEXCEPTION_H_
-#define _INVALIDARGUMENTEXCEPTION_H_
-
-
-#include "Batch_Defines.hxx"
-
-#include "Batch_GenericException.hxx"
-
-namespace Batch {
-
-  class BATCH_EXPORT InvalidArgumentException : public GenericException
-  {
-  public:
-       // Constructeur
-    InvalidArgumentException(const std::string & ch = "undefined")
-      : GenericException("InvalidArgumentException", ch) {}
-  };
-
-}
-
-#endif
-
diff --git a/src/Core/Batch_InvalidKeyException.cxx b/src/Core/Batch_InvalidKeyException.cxx
deleted file mode 100644 (file)
index 3f0b173..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * InvalidKeyException.cxx : 
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail   : mailto:ivan.dutka-malen@der.edf.fr
- * Date   : Wed Oct 15 10:39:51 2003
- * Projet : Salome 2
- *
- */
-
-#include "Batch_InvalidKeyException.hxx"
-using namespace std;
-
-namespace Batch {
-
-}
-
diff --git a/src/Core/Batch_InvalidKeyException.hxx b/src/Core/Batch_InvalidKeyException.hxx
deleted file mode 100644 (file)
index ff9dddc..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * InvalidKeyException.hxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail   : mailto:ivan.dutka-malen@der.edf.fr
- * Date   : Wed Oct 15 10:39:51 2003
- * Projet : Salome 2
- *
- */
-
-#ifndef _INVALIDKEYEXCEPTION_H_
-#define _INVALIDKEYEXCEPTION_H_
-
-#include "Batch_Defines.hxx"
-
-
-#include "Batch_GenericException.hxx"
-
-namespace Batch {
-
-  class BATCH_EXPORT InvalidKeyException : public GenericException
-  {
-  public:
-               // Constructeur
-    InvalidKeyException(std::string ch = "undefined") : GenericException("InvalidKeyException", ch) {}
-
-  protected:
-
-  private:
-
-  };
-
-}
-
-#endif
-
diff --git a/src/Core/Batch_Job.cxx b/src/Core/Batch_Job.cxx
deleted file mode 100644 (file)
index 9c93a3b..0000000
+++ /dev/null
@@ -1,117 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * Job.cxx : 
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date   : Septembre 2003
- * Projet : SALOME 2
- *
- */
-
-#include "Batch_Job.hxx"
-#include "Batch_Parametre.hxx"
-#include <sstream>
-//#include "MEDMEM_STRING.hxx"
-using namespace std;
-
-namespace Batch {
-
-  // Constructeur
-  Job::Job() : _param(), _env()
-  {
-    // Nothing to do
-  }
-
-
-  // Constructeur
-  Job::Job(Parametre param) : _param(param), _env()
-  {
-    // Nothing to do
-  }
-
-
-  // Constructeur
-  Job::Job(Environnement env) : _param(), _env(env)
-  {
-    // Nothing to do
-  }
-
-
-  // Constructeur
-  Job::Job(Parametre param, Environnement env) : _param(param), _env(env)
-  {
-    // Nothing to do
-  }
-
-  // Operateur pour l'affichage sur un stream
-  ostream & operator <<(ostream & os, const Job & job)
-  {
-    return os << job.__str__();
-  }
-
-  // Accesseur
-  Batch::Parametre Job::getParametre() const
-  {
-    return _param;
-  }
-
-  // Accesseur
-  void Job::setParametre(const Batch::Parametre & param)
-  {
-    _param = param;
-  }
-
-  // Accesseur
-  Environnement Job::getEnvironnement() const
-  {
-    return _env;
-  }
-
-  // Accesseur
-  void Job::setEnvironnement(const Environnement & env)
-  {
-    _env = env;
-  }
-
-
-  // Methode pour l'interfacage avec Python (SWIG) : affichage en Python
-  string Job::__str__() const {
-    //MEDMEM::STRING str;
-    ostringstream str;
-    str << "<Job (" << this << ") :" << endl;
-    str << "  Parametre :" << endl;
-    Parametre::const_iterator itp;
-    for(itp=_param.begin(); itp!=_param.end(); itp++) {
-      str << "   * " << (*itp).first << " : " << (*itp).second << endl;
-    }
-    str << "  Environnement :" << endl;
-    Environnement::const_iterator ite;
-    for(ite=_env.begin(); ite!=_env.end(); ite++) {
-      str << "   * " << (*ite).first << " : " << (*ite).second << endl;
-    }
-    str << " >";
-    return str.str();
-  }
-
-
-}
diff --git a/src/Core/Batch_Job.hxx b/src/Core/Batch_Job.hxx
deleted file mode 100644 (file)
index e3045c7..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * Job.hxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date   : Septembre 2003
- * Projet : SALOME 2
- *
- */
-
-#ifndef _JOB_H_
-#define _JOB_H_
-
-#include "Batch_Defines.hxx"
-
-
-#include "Batch_Parametre.hxx"
-#include "Batch_Environnement.hxx"
-
-namespace Batch {
-
-  class BATCH_EXPORT Job
-  {
-  public:
-    // Constructeurs et destructeur
-    Job();
-    Job(Batch::Parametre param);
-    Job(Batch::Environnement env);
-    Job(Batch::Parametre param, Batch::Environnement env);
-    virtual ~Job() {}
-
-    // Operateur pour l'affichage sur un stream
-    BATCH_EXPORT friend std::ostream & operator <<(std::ostream & os, const Job & job);
-
-    // Accesseurs
-    Batch::Parametre getParametre() const;
-    void setParametre(const Batch::Parametre &);
-
-    // Accesseurs
-    Batch::Environnement getEnvironnement() const;
-    void setEnvironnement(const Batch::Environnement &);
-
-    // Methodes pour l'interfacage avec Python (SWIG)
-    // TODO : supprimer ces methodes et transferer leur definitions dans SWIG
-    std::string  __str__() const; // SWIG : affichage en Python
-    std::string  __repr__() const { return __str__(); }; // SWIG : affichage en Python
-
-  protected:
-    Batch::Parametre _param; // table des parametres batch du job
-    Batch::Environnement _env; // table des variables d'environnement
-
-  private:
-
-  };
-
-}
-
-#endif
diff --git a/src/Core/Batch_JobId.cxx b/src/Core/Batch_JobId.cxx
deleted file mode 100644 (file)
index 048ef27..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * JobId.cxx : 
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date   : Septembre 2003
- * Projet : SALOME 2
- *
- */
-
-#include "Batch_JobId.hxx"
-#include "Batch_BatchManager.hxx"
-#include <sstream>
-#include <assert.h>
-//#include "MEDMEM_STRING.hxx"
-using namespace std;
-
-namespace Batch {
-
-  // Constructeur standard
-  JobId::JobId() : _p_batchmanager(), _reference("undefined")
-  {
-    // Nothing to do
-  }
-
-  // Constructeur avec le pointeur sur le BatchManager associe et avec une reference
-  JobId::JobId(BatchManager * _p_bm, string ref) : _p_batchmanager(_p_bm), _reference(ref)
-  {
-    // Nothing to do
-  }
-
-  // Destructeur
-  JobId::~JobId()
-  {
-    // Nothing to do
-  }
-
-  // Operateur d'affectation entre objets
-  JobId & JobId::operator =(const JobId & jobid)
-  {
-    _p_batchmanager = jobid._p_batchmanager;
-    _reference      = jobid._reference;
-
-    return *this;
-  }
-
-  // Constructeur par recopie
-  JobId::JobId(const JobId & jobid) : _p_batchmanager(jobid._p_batchmanager), _reference(jobid._reference)
-  {
-    // Nothing to do
-  }
-
-  // Accesseur pour la reference interne
-  string JobId::getReference() const
-  {
-    return _reference;
-  }
-
-  // Permet de recharger un job depuis un fichier
-  void JobId::setReference(const std::string & new_reference)
-  {
-    _reference = new_reference;
-  }
-
-  // Methode pour le controle du job : retire le job du gestionnaire
-  void JobId::deleteJob() const
-  {
-    assert(_p_batchmanager != 0);
-    _p_batchmanager->deleteJob(*this);
-  }
-   
-  // Methode pour le controle du job : suspend le job en file d'attente
-  void JobId::holdJob() const
-  {
-    assert(_p_batchmanager != 0);
-    _p_batchmanager->holdJob(*this);
-  }
-
-  // Methode pour le controle du job : relache le job suspendu
-  void JobId::releaseJob() const
-  {
-    assert(_p_batchmanager != 0);
-    _p_batchmanager->releaseJob(*this);
-  }
-
-  // Methode pour le controle du job : modifie le job en file d'attente
-  void JobId::alterJob(const Parametre & param, const Environnement & env) const
-  {
-    assert(_p_batchmanager != 0);
-    _p_batchmanager->alterJob(*this, param, env);
-  }
-
-  // Methode pour le controle du job : modifie le job en file d'attente
-  void JobId::alterJob(const Parametre & param) const
-  {
-    assert(_p_batchmanager != 0);
-    _p_batchmanager->alterJob(*this, param);
-  }
-
-  // Methode pour le controle du job : modifie le job en file d'attente
-  void JobId::alterJob(const Environnement & env) const
-  {
-    assert(_p_batchmanager != 0);
-    _p_batchmanager->alterJob(*this, env);
-  }
-
-  // Methode pour le controle du job : renvoie l'etat du job
-  JobInfo JobId::queryJob() const
-  {
-    assert(_p_batchmanager != 0);
-    return _p_batchmanager->queryJob(*this);
-  }
-
-
-  // Methode pour l'interfacage avec Python (SWIG) : affichage en Python
-  string JobId::__str__() const {
-    //MEDMEM::STRING str;
-    ostringstream str;
-    str << "<JobId (" << this << ") : referenced '" << _reference << "'>";
-    return str.str();
-  }
-
-}
diff --git a/src/Core/Batch_JobId.hxx b/src/Core/Batch_JobId.hxx
deleted file mode 100644 (file)
index 831c5cf..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * JobId.hxx : 
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date   : Septembre 2003
- * Projet : SALOME 2
- *
- */
-
-#ifndef _JOBID_H_
-#define _JOBID_H_
-
-
-#include "Batch_Defines.hxx"
-
-#include "Batch_JobInfo.hxx"
-#include "Batch_BatchManager.hxx"
-
-namespace Batch {
-
-  class BatchManager;
-
-  class BATCH_EXPORT JobId
-  {
-    friend class BatchManager;
-
-  public:
-    // Constructeur standard et destructeur
-    JobId();
-    virtual ~JobId();
-
-    // Constructeur avec le pointeur sur le BatchManager associe et avec une reference
-    JobId(Batch::BatchManager *, std::string ref);
-
-    // Operateur d'affectation entre objets
-    virtual JobId & operator =(const Batch::JobId &);
-
-    // Constructeur par recopie
-    JobId(const Batch::JobId &);
-
-    // Accesseur pour la reference interne
-    virtual std::string getReference() const;
-
-    // Permet de recharger un job depuis un fichier
-    virtual void setReference(const std::string & new_reference);
-
-    // Methodes pour le controle du job
-    virtual void deleteJob() const; // retire un job du gestionnaire
-    virtual void holdJob() const; // suspend un job en file d'attente
-    virtual void releaseJob() const; // relache un job suspendu
-    virtual void alterJob(const Batch::Parametre & param, const Batch::Environnement & env) const; // modifie un job en file d'attente
-    virtual void alterJob(const Batch::Parametre & param) const; // modifie un job en file d'attente
-    virtual void alterJob(const Batch::Environnement & env) const; // modifie un job en file d'attente
-    virtual void setParametre(const Batch::Parametre & param) { return alterJob(param); } // modifie un job en file d'attente
-    virtual void setEnvironnement(const Batch::Environnement & env) { return alterJob(env); } // modifie un job en file d'attente
-    virtual Batch::JobInfo queryJob() const; // renvoie l'etat du job
-
-    // Methodes pour l'interfacage avec Python (SWIG)
-    // TODO : supprimer ces methodes et transferer leur definitions dans SWIG
-    std::string  __str__() const; // SWIG : affichage en Python
-    std::string  __repr__() const { return __str__(); }; // SWIG : affichage en Python
-
-  protected:
-    Batch::BatchManager * _p_batchmanager; // pointeur sur le BatchManager qui controle le job
-    std::string _reference; // reference du job au sein du BatchManager
-
-  private:
-
-  };
-
-}
-
-#endif
diff --git a/src/Core/Batch_JobInfo.cxx b/src/Core/Batch_JobInfo.cxx
deleted file mode 100644 (file)
index 6f50309..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * JobInfo.cxx : 
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail   : mailto:ivan.dutka-malen@der.edf.fr
- * Date   : Thu Nov  6 10:05:30 2003
- * Projet : Salome 2
- *
- */
-
-#include <iostream>
-#include <string>
-#include <sstream>
-
-#include "Batch_Constants.hxx"
-#include "Batch_JobInfo.hxx"
-
-using namespace std;
-
-namespace Batch {
-
-  // Destructeur
-  JobInfo::~JobInfo()
-  {
-    // Nothing to do
-  }
-  
-
-  // Operateur pour l'affichage sur un stream
-  ostream & operator <<(ostream & os, const JobInfo & ji)
-  {
-    return os << ji.__str__();
-  }
-
-
-  // Methodes pour l'interfacage avec Python (SWIG) : affichage en Python
-  string JobInfo::__str__() const
-  {
-    //MEDMEM::STRING sst; 
-    ostringstream sst;
-    sst << "<JobInfo (" << this << ") :" << endl;
-    sst << " ID = " <<_param[ID] << endl;
-
-    sst << "  + Parametre :" << endl;
-    Parametre::const_iterator itp;
-    for(itp=_param.begin(); itp!=_param.end(); itp++) {
-      if ( (*itp).first != ID ) {
-       sst << "    * " << (*itp).first << " = " << (*itp).second << endl;
-      }
-    }
-
-    sst << "  + Environnement :" << endl;
-    Environnement::const_iterator ite;
-    for(ite=_env.begin(); ite!=_env.end(); ite++) {
-      sst << "    * " << (*ite).first << " = " << (*ite).second << endl;
-    }
-
-    sst << " >";
-
-    return sst.str();
-  }
-
-  // Accesseur
-  Parametre JobInfo::getParametre() const
-  {
-    return _param;
-  }
-
-  // Accesseur
-  Environnement JobInfo::getEnvironnement() const
-  {
-    return _env;
-  }
-
-
-}
diff --git a/src/Core/Batch_JobInfo.hxx b/src/Core/Batch_JobInfo.hxx
deleted file mode 100644 (file)
index 7e09a18..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * JobInfo.hxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail   : mailto:ivan.dutka-malen@der.edf.fr
- * Date   : Thu Nov  6 10:05:30 2003
- * Projet : Salome 2
- *
- */
-
-#ifndef _JOBINFO_H_
-#define _JOBINFO_H_
-
-#include "Batch_Defines.hxx"
-
-#include <iostream>
-#include <string>
-#include "Batch_Parametre.hxx"
-#include "Batch_Environnement.hxx"
-
-namespace Batch {
-
-  class BATCH_EXPORT JobInfo
-  {
-  public:
-    // Constructeur standard et destructeur
-    JobInfo() : _param(), _env() {};
-    virtual ~JobInfo();
-
-    // Constructeur par recopie
-    JobInfo(const JobInfo & jinfo) : _param(jinfo._param), _env(jinfo._env) {};
-
-    // Operateur pour l'affichage sur un stream
-    BATCH_EXPORT friend std::ostream & operator <<(std::ostream & os, const JobInfo & ji);
-
-    // Accesseurs
-    // _CS_gbo Ajout explicite du namespace pour les besoins de swig (mauvaise gestion
-    // des namespace par swig.
-    virtual Batch::Parametre getParametre() const;
-    virtual Batch::Environnement getEnvironnement() const;
-
-    // Methodes pour l'interfacage avec Python (SWIG)
-    // TODO : supprimer ces methodes et transferer leur definitions dans SWIG
-    std::string  __str__() const; // SWIG : affichage en Python
-    std::string  __repr__() const { return __str__(); }; // SWIG : affichage en Python
-
-  protected:
-    Parametre _param; // parametres du job
-    Environnement _env; // variables d'environnement du job
-    JobInfo(const Parametre & param, const Environnement & env) : _param(param), _env(env) {};
-
-  private:
-
-  };
-
-}
-
-#endif
diff --git a/src/Core/Batch_ListIsFullException.cxx b/src/Core/Batch_ListIsFullException.cxx
deleted file mode 100644 (file)
index 3a46ebc..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * ListIsFullException.cxx : 
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date   : Septembre 2003
- * Projet : SALOME 2
- *
- */
-
-#include "Batch_ListIsFullException.hxx"
-using namespace std;
-
-
-namespace Batch {
-
-}
diff --git a/src/Core/Batch_ListIsFullException.hxx b/src/Core/Batch_ListIsFullException.hxx
deleted file mode 100644 (file)
index 4020927..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * ListIsFullException.hxx : 
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date   : Septembre 2003
- * Projet : SALOME 2
- *
- */
-
-#ifndef _LISTISFULLEXCEPTION_H_
-#define _LISTISFULLEXCEPTION_H_
-
-#include "Batch_Defines.hxx"
-
-#include "Batch_GenericException.hxx"
-
-namespace Batch {
-
-  class BATCH_EXPORT ListIsFullException : public GenericException
-  {
-  public:
-               // Constructeur
-    ListIsFullException(std::string ch = "undefined") : GenericException("ListIsFullException", ch) {}
-  };
-
-}
-
-#endif
-
diff --git a/src/Core/Batch_LongType.cxx b/src/Core/Batch_LongType.cxx
deleted file mode 100644 (file)
index 48a9b86..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * LongType.cxx : 
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date   : Septembre 2003
- * Projet : SALOME 2
- *
- */
-
-#include <string>
-#include <sstream>
-#include <assert.h>
-//#include "MEDMEM_STRING.hxx"
-#include "Batch_LongType.hxx"
-using namespace std;
-
-namespace Batch {
-
-       // Conversion en chaine
-  string LongType::affiche() const
-  {
-    //MEDMEM::STRING sst;
-    ostringstream sst;
-    sst << _data;
-    return sst.str();
-  }
-
-       // Operateur d'affectation
-  LongType & LongType::operator =(long l)
-  {
-    _data = l;
-    return *this;
-  }
-
-       // Conversion en long
-  LongType::operator long() const
-  {
-    return this->_data;
-  }
-
-       // Clone duplique l'objet et en fabrique un nouveau a l'aide de new
-       // qu'il faudra detruire ensuite manuellement
-  GenericType * LongType::clone() const
-  {
-    LongType * pL = new LongType(this->_data);
-    assert(pL != 0);
-    return pL;
-  }
-
-}
diff --git a/src/Core/Batch_LongType.hxx b/src/Core/Batch_LongType.hxx
deleted file mode 100644 (file)
index 8e9f3ba..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * LongType.hxx : 
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date   : Septembre 2003
- * Projet : SALOME 2
- *
- */
-
-#ifndef _LONGTYPE_H_
-#define _LONGTYPE_H_
-
-#include "Batch_Defines.hxx"
-
-#include <string>
-#include "Batch_GenericType.hxx"
-
-namespace Batch {
-
-  class BATCH_EXPORT LongType : public GenericType
-  {
-  public:
-               // Constructeur
-    LongType(const long l=0L) : _data(l) {}
-
-               // Conversion en chaine
-    virtual std::string affiche() const;
-
-               // Operateur d'affectation
-    virtual LongType & operator =(long);
-
-               // Conversion en long
-    virtual operator long() const;
-
-               // Clone duplique l'objet et en fabrique un nouveau a l'aide de new
-               // qu'il faudra detruire ensuite manuellement
-    virtual GenericType * clone() const;
-
-  protected:
-    long _data;
-
-  private:
-
-  };
-
-}
-
-#endif
diff --git a/src/Core/Batch_MpiImpl.cxx b/src/Core/Batch_MpiImpl.cxx
deleted file mode 100644 (file)
index dcd68b0..0000000
+++ /dev/null
@@ -1,350 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-
-#include <iostream>
-#include <sstream>
-#include <string>
-#include "Batch_MpiImpl.hxx"
-
-using namespace std;
-
-// Constructor
-MpiImpl::MpiImpl()
-{
-}
-
-// Destructor
-MpiImpl::~MpiImpl()
-{
-}
-
-// lam implementation
-// Constructor
-MpiImpl_LAM::MpiImpl_LAM() : MpiImpl()
-{
-}
-
-// Destructor
-MpiImpl_LAM::~MpiImpl_LAM()
-{
-}
-
-string MpiImpl_LAM::size()
-{
-  return "${LAMWORLD}";
-}
-
-string MpiImpl_LAM::rank()
-{
-  return "${LAMRANK}";
-}
-
-string MpiImpl_LAM::boot(const string machinefile, const unsigned int nbnodes)
-{
-  ostringstream oss;
-  oss << "lamboot " << machinefile << endl;
-  return oss.str();
-}
-
-string MpiImpl_LAM::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute)
-{
-  ostringstream oss;
-  oss << "mpirun -np " << nbproc << " " << fileNameToExecute << endl;
-  return oss.str();
-}
-
-string MpiImpl_LAM::halt()
-{
-  ostringstream oss;
-  oss << "lamhalt" << endl;
-  return oss.str();
-}
-
-string MpiImpl_LAM::name()
-{
-  return "lam";
-}
-
-// mpich1 implementation
-// Constructor
-MpiImpl_MPICH1::MpiImpl_MPICH1() : MpiImpl()
-{
-}
-
-// Destructor
-MpiImpl_MPICH1::~MpiImpl_MPICH1()
-{
-}
-
-string MpiImpl_MPICH1::size()
-{
-  return "${MPIRUN_NPROCS}";
-}
-
-string MpiImpl_MPICH1::rank()
-{
-  return "${MPIRUN_RANK}";
-}
-
-string MpiImpl_MPICH1::boot(const string machinefile, const unsigned int nbnodes)
-{
-  return "";
-}
-
-string MpiImpl_MPICH1::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute)
-{
-  ostringstream oss;
-  oss << "mpirun -machinefile " << machinefile << " -np " << nbproc << " " << fileNameToExecute << endl;
-  return oss.str();
-}
-
-string MpiImpl_MPICH1::halt()
-{
-  return "";
-}
-
-string MpiImpl_MPICH1::name()
-{
-  return "mpich";
-}
-
-// mpich2 implementation
-// Constructor
-MpiImpl_MPICH2::MpiImpl_MPICH2() : MpiImpl()
-{
-}
-
-// Destructor
-MpiImpl_MPICH2::~MpiImpl_MPICH2()
-{
-}
-
-string MpiImpl_MPICH2::size()
-{
-  return "${PMI_SIZE}";
-}
-
-string MpiImpl_MPICH2::rank()
-{
-  return "${PMI_RANK}";
-}
-
-string MpiImpl_MPICH2::boot(const string machinefile, const unsigned int nbnodes)
-{
-  ostringstream oss;
-  oss << "mpdboot" << " -n " << nbnodes;
-  if (machinefile!="")
-    oss  << " -f " << machinefile;
-  oss << endl;
-  return oss.str();
-}
-
-string MpiImpl_MPICH2::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute)
-{
-  ostringstream oss;
-  oss << "mpirun -np " << nbproc << " " << fileNameToExecute << endl;
-  return oss.str();
-}
-
-string MpiImpl_MPICH2::halt()
-{
-  ostringstream oss;
-  oss << "mpdallexit" << endl;
-  return oss.str();
-}
-
-string MpiImpl_MPICH2::name()
-{
-  return "mpich";
-}
-
-// openmpi implementation
-// Constructor
-MpiImpl_OPENMPI::MpiImpl_OPENMPI() : MpiImpl()
-{
-}
-
-// Destructor
-MpiImpl_OPENMPI::~MpiImpl_OPENMPI()
-{
-}
-
-string MpiImpl_OPENMPI::size()
-{
-  return "${OMPI_MCA_ns_nds_num_procs}";
-}
-
-string MpiImpl_OPENMPI::rank()
-{
-  return "${OMPI_MCA_ns_nds_vpid}";
-}
-
-string MpiImpl_OPENMPI::boot(const string machinefile, const unsigned int nbnodes)
-{
-  return "";
-}
-
-string MpiImpl_OPENMPI::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute)
-{
-  ostringstream oss;
-  oss << "mpirun -hostfile " << machinefile << " -np " << nbproc << " " << fileNameToExecute << endl;
-  return oss.str();
-}
-
-string MpiImpl_OPENMPI::halt()
-{
-  return "";
-}
-
-string MpiImpl_OPENMPI::name()
-{
-  return "openmpi";
-}
-
-// ompi implementation
-// Constructor
-MpiImpl_OMPI::MpiImpl_OMPI() : MpiImpl()
-{
-}
-
-// Destructor
-MpiImpl_OMPI::~MpiImpl_OMPI()
-{
-}
-
-string MpiImpl_OMPI::size()
-{
-  return "${OMPI_MCA_ns_nds_num_procs}";
-}
-
-string MpiImpl_OMPI::rank()
-{
-  return "${OMPI_MCA_ns_nds_vpid}";
-}
-
-string MpiImpl_OMPI::boot(const string machinefile, const unsigned int nbnodes)
-{
-  return "";
-}
-
-string MpiImpl_OMPI::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute)
-{
-  ostringstream oss;
-  oss << "mpirun -hostfile " << machinefile << " -np " << nbproc << " " << fileNameToExecute << endl;
-  return oss.str();
-}
-
-string MpiImpl_OMPI::halt()
-{
-  return "";
-}
-
-string MpiImpl_OMPI::name()
-{
-  return "ompi";
-}
-
-// slurm implementation
-// Constructor
-MpiImpl_SLURM::MpiImpl_SLURM() : MpiImpl()
-{
-}
-
-// Destructor
-MpiImpl_SLURM::~MpiImpl_SLURM()
-{
-}
-
-string MpiImpl_SLURM::size()
-{
-  return "${SLURM_NPROCS}";
-}
-
-string MpiImpl_SLURM::rank()
-{
-  return "${SLURM_PROCID}";
-}
-
-string MpiImpl_SLURM::boot(const string machinefile, const unsigned int nbnodes)
-{
-  return "";
-}
-
-string MpiImpl_SLURM::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute)
-{
-  ostringstream oss;
-  oss << "srun " << fileNameToExecute << endl;
-  return oss.str();
-}
-
-string MpiImpl_SLURM::halt()
-{
-  return "";
-}
-
-string MpiImpl_SLURM::name()
-{
-  return "slurm";
-}
-
-// prun implementation
-// Constructor
-MpiImpl_PRUN::MpiImpl_PRUN() : MpiImpl()
-{
-}
-
-// Destructor
-MpiImpl_PRUN::~MpiImpl_PRUN()
-{
-}
-
-string MpiImpl_PRUN::size()
-{
-  return "${RMS_NPROCS}";
-}
-
-string MpiImpl_PRUN::rank()
-{
-  return "${RMS_RANK}";
-}
-
-string MpiImpl_PRUN::boot(const string machinefile, const unsigned int nbnodes)
-{
-  return "";
-}
-
-string MpiImpl_PRUN::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute)
-{
-  ostringstream oss;
-  oss << "prun -n " << nbproc << " " << "-p mpi " << fileNameToExecute << endl;
-  return oss.str();
-}
-
-string MpiImpl_PRUN::halt()
-{
-  return "";
-}
-
-string MpiImpl_PRUN::name()
-{
-  return "prun";
-}
diff --git a/src/Core/Batch_MpiImpl.hxx b/src/Core/Batch_MpiImpl.hxx
deleted file mode 100644 (file)
index 9bc323f..0000000
+++ /dev/null
@@ -1,197 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-
-#ifndef _BL_MPIIMPL_H_
-#define _BL_MPIIMPL_H_
-
-#include "Batch_Defines.hxx"
-#include <string>
-
-class BATCH_EXPORT MpiImplException
-{
-public:
-  const std::string msg;
-  
-  MpiImplException(const std::string m) : msg(m) {}
-};
-
-class BATCH_EXPORT MpiImpl
-{
-public:
-  // Constructeur et destructeur
-  MpiImpl(); // constrcuctor
-  virtual ~MpiImpl(); //Destructor
-  
-  virtual std::string size() = 0; // get number of process of current job
-  virtual std::string rank() = 0; // get process number of current job
-  virtual std::string boot(const std::string machinefile, const unsigned int nbnodes) = 0; // get boot command
-  virtual std::string run(const std::string machinefile, const unsigned int nbproc, const std::string fileNameToExecute) = 0; // get run command
-  virtual std::string halt() = 0; // get stop command
-  virtual std::string name() = 0; // name of mpi implementation
-
-protected:
-
-private:
-
-};
-
-class BATCH_EXPORT MpiImpl_LAM : public MpiImpl
-{
-public:
-  // Constructeur et destructeur
-  MpiImpl_LAM(); // constructor
-  virtual ~MpiImpl_LAM(); //Destructor
-
-  std::string size(); // get number of process of current job
-  std::string rank(); // get process number of current job
-  std::string boot( const std::string machinefile, const unsigned int nbnodes); // get boot command
-  std::string run( const std::string machinefile, const unsigned int nbproc, const std::string fileNameToExecute); // get run command
-  std::string halt(); // get stop command
-  std::string name(); // name of mpi implementation
-
-protected:
-  
-private:
-
-};
-
-class BATCH_EXPORT MpiImpl_MPICH1 : public MpiImpl
-{
-public:
-  // Constructeur et destructeur
-  MpiImpl_MPICH1(); // constructor
-  virtual ~MpiImpl_MPICH1(); //Destructor
-  
-  std::string size(); // get number of process of current job
-  std::string rank(); // get process number of current job
-  std::string boot( const std::string machinefile, const unsigned int nbnodes); // get boot command
-  std::string run( const std::string machinefile, const unsigned int nbproc, const std::string fileNameToExecute); // get run command
-  std::string halt(); // get stop command
-  std::string name(); // name of mpi implementation
-
-protected:
-  
-private:
-
-};
-
-class BATCH_EXPORT MpiImpl_MPICH2 : public MpiImpl
-{
-public:
-  // Constructeur et destructeur
-  MpiImpl_MPICH2(); // constructor
-  virtual ~MpiImpl_MPICH2(); //Destructor
-
-  std::string size(); // get number of process of current job
-  std::string rank(); // get process number of current job
-  std::string boot( const std::string machinefile, const unsigned int nbnodes); // get boot command
-  std::string run( const std::string machinefile, const unsigned int nbproc, const std::string fileNameToExecute); // get run command
-  std::string halt(); // get stop command
-  std::string name(); // name of mpi implementation
-
-protected:
-
-private:
-
-};
-
-class BATCH_EXPORT MpiImpl_OPENMPI : public MpiImpl
-{
-public:
-  // Constructeur et destructeur
-  MpiImpl_OPENMPI(); // constructor
-  virtual ~MpiImpl_OPENMPI(); //Destructor
-
-  std::string size(); // get number of process of current job
-  std::string rank(); // get process number of current job
-  std::string boot( const std::string machinefile, const unsigned int nbnodes); // get boot command
-  std::string run( const std::string machinefile, const unsigned int nbproc, const std::string fileNameToExecute); // get run command
-  std::string halt(); // get stop command
-  std::string name(); // name of mpi implementation
-
-protected:
-
-private:
-
-};
-
-class BATCH_EXPORT MpiImpl_OMPI : public MpiImpl
-{
-public:
-  // Constructeur et destructeur
-  MpiImpl_OMPI(); // constructor
-  virtual ~MpiImpl_OMPI(); //Destructor
-
-  std::string size(); // get number of process of current job
-  std::string rank(); // get process number of current job
-  std::string boot( const std::string machinefile, const unsigned int nbnodes); // get boot command
-  std::string run( const std::string machinefile, const unsigned int nbproc, const std::string fileNameToExecute); // get run command
-  std::string halt(); // get stop command
-  std::string name(); // name of mpi implementation
-
-protected:
-
-private:
-
-};
-
-class BATCH_EXPORT MpiImpl_SLURM : public MpiImpl
-{
-public:
-  // Constructeur et destructeur
-  MpiImpl_SLURM(); // constructor
-  virtual ~MpiImpl_SLURM(); //Destructor
-
-  std::string size(); // get number of process of current job
-  std::string rank(); // get process number of current job
-  std::string boot( const std::string machinefile, const unsigned int nbnodes); // get boot command
-  std::string run( const std::string machinefile, const unsigned int nbproc, const std::string fileNameToExecute); // get run command
-  std::string halt(); // get stop command
-  std::string name(); // name of mpi implementation
-
-protected:
-
-private:
-
-};
-
-class BATCH_EXPORT MpiImpl_PRUN : public MpiImpl
-{
-public:
-  // Constructeur et destructeur
-  MpiImpl_PRUN(); // constructor
-  virtual ~MpiImpl_PRUN(); //Destructor
-
-  std::string size(); // get number of process of current job
-  std::string rank(); // get process number of current job
-  std::string boot( const std::string machinefile, const unsigned int nbnodes); // get boot command
-  std::string run( const std::string machinefile, const unsigned int nbproc, const std::string fileNameToExecute); // get run command
-  std::string halt(); // get stop command
-  std::string name(); // name of mpi implementation
-
-protected:
-
-private:
-
-};
-
-#endif
diff --git a/src/Core/Batch_NotYetImplementedException.cxx b/src/Core/Batch_NotYetImplementedException.cxx
deleted file mode 100644 (file)
index 40df58b..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * NotYetImplementedException.cxx : 
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail   : mailto:ivan.dutka-malen@der.edf.fr
- * Date   : Tue Nov 25 11:35:07 2003
- * Projet : Salome 2
- *
- */
-
-#include "Batch_NotYetImplementedException.hxx"
-
-namespace Batch {
-
-}
-
diff --git a/src/Core/Batch_NotYetImplementedException.hxx b/src/Core/Batch_NotYetImplementedException.hxx
deleted file mode 100644 (file)
index 8e5ee7e..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * NotYetImplementedException.hxx : 
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail   : mailto:ivan.dutka-malen@der.edf.fr
- * Date   : Tue Nov 25 11:35:07 2003
- * Projet : Salome 2
- *
- */
-
-#ifndef _NOTYETIMPLEMENTEDEXCEPTION_H_
-#define _NOTYETIMPLEMENTEDEXCEPTION_H_
-
-#include "Batch_Defines.hxx"
-#include "Batch_GenericException.hxx"
-
-#include <string>
-
-namespace Batch {
-
-  class BATCH_EXPORT NotYetImplementedException : public GenericException
-  {
-  public:
-               // Constructeur
-    NotYetImplementedException(std::string ch = "undefined") : GenericException("NotYetImplementedException", ch) {}
-  };
-
-}
-
-#endif
-
diff --git a/src/Core/Batch_ParameterTypeMap.cxx b/src/Core/Batch_ParameterTypeMap.cxx
deleted file mode 100644 (file)
index 266ccad..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * Batch_ParameterTypeMap.cxx :
- *
- * Auteur : Renaud Barate - EDF R&D
- * Date   : Mars 2011
- *
- */
-
-#include <string>
-#include <map>
-
-#include "Batch_Constants.hxx"
-#include "Batch_InvalidKeyException.hxx"
-#include "Batch_ParameterTypeMap.hxx"
-
-using namespace std;
-
-namespace Batch {
-
-  /*!
-   * The values of this type map contain the type of the parameters and the maximum
-   * number of items in the corresponding Versatile object (0 means any number).
-   */
-  ParameterTypeMap::ParameterTypeMap()
-  {
-    // Don't use the string constants in this constructor because they might be uninitialized
-    addParameter("ARGUMENTS", STRING, 0);
-    addParameter("EXECUTABLE", STRING, 1);
-    addParameter("ID", STRING, 1);
-    addParameter("INFILE", COUPLE, 0);
-    addParameter("MAXCPUTIME", LONG, 1);
-    addParameter("MAXDISKSIZE", LONG, 1);
-    addParameter("MAXRAMSIZE", LONG, 1);
-    addParameter("MAXWALLTIME", LONG, 1);
-    addParameter("NAME", STRING, 1);
-    addParameter("NBPROC", LONG, 1);
-    addParameter("NBPROCPERNODE", LONG, 1);
-    addParameter("OUTFILE", COUPLE, 0);
-    addParameter("PID", LONG, 1);
-    addParameter("QUEUE", STRING, 1);
-    addParameter("STATE", STRING, 1);
-    addParameter("USER", STRING, 1);
-    addParameter("WORKDIR", STRING, 1);
-    addParameter("HOMEDIR", STRING, 1);
-    addParameter("EXCLUSIVE", BOOL, 1);
-  }
-
-  ParameterTypeMap::~ParameterTypeMap()
-  {
-  }
-
-  /*!
-   * Returns the ParameterTypeMap singleton.
-   * We use the construct-on-first-use idiom here because otherwise there could be a problem with
-   * the initialization order between the factory singletons and this type map. Note that since the
-   * destructors do not depend on the other objects, the order is not important for destruction.
-   */
-  ParameterTypeMap& ParameterTypeMap::getInstance () {
-    static ParameterTypeMap instance;
-    return instance;
-  }
-
-  bool ParameterTypeMap::hasKey(const string & key) const
-  {
-    return (_map.find(key) != _map.end());
-  }
-
-  void ParameterTypeMap::addParameter(const std::string & key, DiscriminatorType type, int maxelem)
-  {
-    if (hasKey(key)) throw InvalidKeyException(key + " is already present in type map");
-    _map[key].type = type;
-    _map[key].maxelem = maxelem;
-  }
-
-  Versatile ParameterTypeMap::createVersatile(const std::string & parameterName)
-  {
-    map<string, ParameterType>::const_iterator it = _map.find(parameterName);
-    if (it == _map.end()) throw InvalidKeyException(parameterName);
-    return Versatile(it->second.type, it->second.maxelem, parameterName);
-  }
-
-}
diff --git a/src/Core/Batch_ParameterTypeMap.hxx b/src/Core/Batch_ParameterTypeMap.hxx
deleted file mode 100644 (file)
index b565552..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * Batch_ParameterTypeMap.hxx :
- *
- * Auteur : Renaud Barate - EDF R&D
- * Date   : Mars 2011
- *
- */
-
-#ifndef _PARAMETERTYPEMAP_H_
-#define _PARAMETERTYPEMAP_H_
-
-#include "Batch_Defines.hxx"
-#include "Batch_Versatile.hxx"
-
-#include <string>
-#include <map>
-
-namespace Batch {
-
-  typedef struct {
-    DiscriminatorType type;
-    int maxelem;
-  } ParameterType;
-
-
-  /*!
-   * This class is used to control the type of the values associated with a parameter.
-   * It's a singleton that can be get only through the static method getInstance().
-   */
-  class BATCH_EXPORT ParameterTypeMap
-  {
-  public:
-    static ParameterTypeMap& getInstance();
-
-    bool hasKey(const std::string & key) const;
-    void addParameter(const std::string & key, DiscriminatorType type, int maxelem);
-    Versatile createVersatile(const std::string & parameterName);
-
-  protected:
-
-    ParameterTypeMap();
-    virtual ~ParameterTypeMap();
-
-    std::map<std::string, ParameterType> _map;
-
-  private:
-
-    // Forbid the use of copy constructor and assignment operator
-    ParameterTypeMap(const ParameterTypeMap & orig) {}
-    void operator=(const ParameterTypeMap & orig) {}
-
-  };
-
-}
-
-#endif
diff --git a/src/Core/Batch_Parametre.cxx b/src/Core/Batch_Parametre.cxx
deleted file mode 100644 (file)
index 70ffadd..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * Parametre.cxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date   : Septembre 2003
- * Projet : SALOME 2
- *
- */
-
-#include "Batch_Versatile.hxx"
-#include "Batch_InvalidKeyException.hxx"
-#include "Batch_ParameterTypeMap.hxx"
-#include "Batch_Parametre.hxx"
-
-using namespace std;
-
-namespace Batch {
-
-  // Constructeur standard
-  Parametre::Parametre() : map< string, Versatile >()
-  {
-  }
-
-  // Operateur de recherche dans la map
-  // Cet operateur agit sur les objets NON CONSTANTS, il autorise la modification de
-  // la valeur associée Ã  la clef car il retourne une reference non constante
-  Versatile & Parametre::operator [] (const string & mk)
-  {
-    // On controle que la clef est valide
-    if (!ParameterTypeMap::getInstance().hasKey(mk)) throw InvalidKeyException(mk);
-
-    Parametre::iterator it = find(mk);
-    if (it != end()) {
-      return it->second;
-    } else {
-      Versatile V = ParameterTypeMap::getInstance().createVersatile(mk);
-      pair<iterator, bool> result = insert(make_pair(mk, V));
-      return result.first->second;
-    }
-  }
-
-  // Operateur de recherche dans la map
-  // Cet operateur agit sur les objets CONSTANTS
-  const Versatile & Parametre::operator [] (const string & mk) const
-  {
-    // On controle que la clef est valide
-    if (!ParameterTypeMap::getInstance().hasKey(mk)) throw InvalidKeyException(mk);
-
-    // On recherche la valeur associee
-    Parametre::const_iterator it = find(mk);
-    if (it == end()) throw InvalidKeyException(mk);
-    const Versatile & V = (*it).second;
-
-    return V;
-  }
-
-  // Operateur d'affectation
-  Parametre & Parametre::operator =(const Parametre & PM)
-  {
-    // On ne reaffecte pas l'objet a lui-meme, sinon aie, aie, aie
-    if (this == &PM) return *this;
-
-    // On efface toute la map
-    erase(begin(), end());
-
-    // On recree la structure interne de la map avec les valeurs de celle passee en argument
-    Parametre::const_iterator it;
-    for(it=PM.begin(); it!=PM.end(); it++)
-      insert(make_pair((*it).first, Versatile((*it).second)));
-
-    return *this;
-  }
-
-  // Constructeur par recopie
-  Parametre::Parametre(const Parametre & PM) : map< string, Versatile >()
-  {
-    // On cree la structure interne de la map avec les valeurs de celle passee en argument
-    Parametre::const_iterator it;
-    for(it=PM.begin(); it!=PM.end(); it++)
-      insert(make_pair((*it).first, Versatile((*it).second)));
-  }
-
-}
diff --git a/src/Core/Batch_Parametre.hxx b/src/Core/Batch_Parametre.hxx
deleted file mode 100644 (file)
index 7312c0f..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * Parametre.hxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date   : Septembre 2003
- * Projet : SALOME 2
- *
- */
-
-#ifndef _PARAMETRE_H_
-#define _PARAMETRE_H_
-
-#include <map>
-#include <string>
-
-#include "Batch_Defines.hxx"
-#include "Batch_Versatile.hxx"
-
-namespace Batch {
-
-  class BATCH_EXPORT Parametre : public std::map< std::string, Versatile >
-  {
-  public:
-    // Constructeur standard
-    Parametre();
-
-    // Constructeur par recopie
-    Parametre(const Parametre & PM);
-
-    // Operateur de recherche dans la map
-    Versatile & operator [] (const std::string &);
-    const Versatile & operator [] (const std::string &) const;
-
-    // Operateur d'affectation
-    Parametre & operator =(const Parametre & PM);
-
-  };
-
-}
-
-#endif
diff --git a/src/Core/Batch_RunTimeException.cxx b/src/Core/Batch_RunTimeException.cxx
deleted file mode 100644 (file)
index a983e24..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * RunTimeException.cxx : 
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail   : mailto:ivan.dutka-malen@der.edf.fr
- * Date   : Tue Nov 25 14:04:13 2003
- * Projet : Salome 2
- *
- */
-
-#include "Batch_RunTimeException.hxx"
-using namespace std;
-
-namespace Batch {
-
-}
diff --git a/src/Core/Batch_RunTimeException.hxx b/src/Core/Batch_RunTimeException.hxx
deleted file mode 100644 (file)
index 87878bf..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * RunTimeException.hxx : 
- *
- * Auteur : %author% - EDF R&D
- * Mail   : mailto:ivan.dutka-malen@der.edf.fr
- * Date   : Tue Nov 25 14:04:13 2003
- * Projet : Salome 2
- *
- */
-
-#ifndef _RUNTIMEEXCEPTION_H_
-#define _RUNTIMEEXCEPTION_H_
-
-#include "Batch_Defines.hxx"
-
-
-#include "Batch_GenericException.hxx"
-
-namespace Batch {
-
-  class BATCH_EXPORT RunTimeException : public GenericException
-  {
-  public:
-               // Constructeur
-    RunTimeException(std::string ch = "undefined") : GenericException("RunTimeException", ch) {}
-  };
-
-}
-
-#endif
diff --git a/src/Core/Batch_StringType.cxx b/src/Core/Batch_StringType.cxx
deleted file mode 100644 (file)
index d7d418f..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * StringType.cxx : 
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date   : Septembre 2003
- * Projet : SALOME 2
- *
- */
-
-#include <string>
-#include <assert.h>
-#include "Batch_StringType.hxx"
-using namespace std;
-
-namespace Batch {
-
-       // Conversion en chaine
-  string StringType::affiche() const
-  {
-    return _data;
-  }
-
-       // Operateur d'affectation
-       StringType & StringType::operator =(string s)
-  {
-    _data = s;
-    return *this;
-  }
-
-       // Conversion en chaine
-  StringType::operator string() const
-  {
-    return this->_data;
-  }
-
-       // Clone duplique l'objet et en fabrique un nouveau a l'aide de new
-       // qu'il faudra detruire ensuite manuellement
-  GenericType * StringType::clone() const
-  {
-    StringType * pS = new StringType(this->_data);
-    assert(pS != 0);
-    return pS;
-  }
-
-}
diff --git a/src/Core/Batch_StringType.hxx b/src/Core/Batch_StringType.hxx
deleted file mode 100644 (file)
index ab7246c..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * StringType.hxx : 
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date   : Septembre 2003
- * Projet : SALOME 2
- *
- */
-
-#ifndef _STRINGTYPE_H_
-#define _STRINGTYPE_H_
-
-#include "Batch_Defines.hxx"
-
-#include <string>
-#include "Batch_GenericType.hxx"
-
-namespace Batch {
-
-  class BATCH_EXPORT StringType : public GenericType
-  {
-  public:
-               // Constructeur
-    StringType(const std::string & s="")  : _data(s) {}
-
-               // Conversion en chaine
-    virtual std::string affiche() const;
-    virtual operator std::string() const;
-
-               // Operateur d'affectation
-    virtual StringType & operator =(std::string);
-
-               // Clone duplique l'objet et en fabrique un nouveau a l'aide de new
-               // qu'il faudra detruire ensuite manuellement
-    virtual GenericType * clone() const;
-
-  protected:
-    std::string _data;
-
-  private:
-
-  };
-
-}
-
-#endif
diff --git a/src/Core/Batch_TypeMismatchException.cxx b/src/Core/Batch_TypeMismatchException.cxx
deleted file mode 100644 (file)
index 48884ae..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * TypeMismatchException.cxx : 
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date   : Septembre 2003
- * Projet : SALOME 2
- *
- */
-
-#include "Batch_TypeMismatchException.hxx"
-using namespace std;
-
-namespace Batch {
-
-}
diff --git a/src/Core/Batch_TypeMismatchException.hxx b/src/Core/Batch_TypeMismatchException.hxx
deleted file mode 100644 (file)
index cd24cc5..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * TypeMismatchException.hxx : 
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date   : Septembre 2003
- * Projet : SALOME 2
- *
- */
-
-#ifndef _TYPEMISMATCHEXCEPTION_H_
-#define _TYPEMISMATCHEXCEPTION_H_
-
-#include "Batch_Defines.hxx"
-
-
-#include "Batch_GenericException.hxx"
-
-namespace Batch {
-
-  class BATCH_EXPORT TypeMismatchException : public GenericException
-  {
-  public:
-               // Constructeur
-    TypeMismatchException(std::string ch = "undefined") : GenericException("TypeMismatchException", ch) {}
-  };
-
-}
-
-#endif
-
diff --git a/src/Core/Batch_Utils.cxx b/src/Core/Batch_Utils.cxx
deleted file mode 100644 (file)
index 5d173bc..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * Batch_Utils.cxx
- *
- *  Created on: 30 jan. 2012
- *  Author : Renaud BARATE - EDF R&D
- */
-
-#include <cstdlib>
-#include <cstdio>
-#include <unistd.h>
-#include <iostream>
-#include <fstream>
-
-#include <Batch_config.h>
-#include "Batch_Utils.hxx"
-#include "Batch_RunTimeException.hxx"
-
-#ifdef MSVC
-#define popen _popen
-#define pclose _pclose
-#endif
-
-using namespace std;
-namespace Batch {
-
-int Utils::getCommandOutput(const string & command, string & output)
-{
-  // Reinitialize output
-  output = "";
-
-  // Call command
-  FILE * fp = popen(command.c_str(), "r");
-  if (fp == NULL) {
-    return -1;
-  }
-
-  // Read the output and store it
-  char buf[1024];
-  while (fgets(buf, sizeof(buf), fp) != NULL) {
-    output += buf;
-  }
-
-  // close and get status
-  int status = pclose(fp);
-  return status;
-}
-
-bool Utils::isAbsolutePath(const string & path)
-{
-  if (path.size() == 0)
-    return false;
-  return path[0] == '/';
-}
-
-string Utils::createAndOpenTemporaryFile(const string & prefix, ofstream & outputStream)
-{
-  if (outputStream.is_open())
-    outputStream.close();
-
-  // Find directory for temporary files
-  const char * tmpDirName = getenv("TEMP");
-  if (tmpDirName == NULL) tmpDirName = getenv("TMP");
-  if (tmpDirName == NULL) tmpDirName = getenv("TEMPDIR");
-  if (tmpDirName == NULL) tmpDirName = getenv("TMPDIR");
-  if (tmpDirName == NULL) tmpDirName = "/tmp";
-
-  string fileName = (string)tmpDirName + "/libbatch-" + prefix + "-XXXXXX";
-
-#ifdef WIN32
-
-  char randstr[7];
-  srand(time(NULL));
-
-  do {
-    sprintf(randstr, "%06d", rand() % 1000000);
-    fileName.replace(fileName.size()-6, 6, randstr);
-  } while (EXISTS(fileName.c_str()));
-
-  // Open the file as binary to avoid problems with Windows newlines
-  outputStream.open(fileName.c_str(), ios_base::binary | ios_base::out);
-
-#else
-
-  char * buf = new char[fileName.size()+1];
-  fileName.copy(buf, fileName.size());
-  buf[fileName.size()] = '\0';
-
-  int fd = mkstemp(buf);
-  if (fd == -1) {
-    delete[] buf;
-    throw RunTimeException(string("Can't create temporary file ") + fileName);
-  }
-  fileName = buf;
-  delete[] buf;
-
-  outputStream.open(fileName.c_str());
-  close(fd);  // Close the file descriptor so that the file is not opened twice
-
-#endif
-
-  if (outputStream.fail())
-    throw RunTimeException(string("Can't open temporary file ") + fileName);
-
-  return fileName;
-}
-
-}
diff --git a/src/Core/Batch_Utils.hxx b/src/Core/Batch_Utils.hxx
deleted file mode 100644 (file)
index e0cdb23..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * Batch_Utils.hxx
- *
- *  Created on: 30 jan. 2012
- *  Author : Renaud BARATE - EDF R&D
- */
-
-#ifndef BATCH_UTILS_HXX_
-#define BATCH_UTILS_HXX_
-
-#include <string>
-
-namespace Batch {
-
-class Utils {
-public:
-
-  /**
-   * Call a command with the system shell and stores its output in parameter "output".
-   * Returns the return code of the command.
-   */
-  static int getCommandOutput(const std::string & command, std::string & output);
-
-  /**
-   * Test if the path in parameter is an absolute path (does not test the existence of
-   * a file or directory at this path).
-   */
-  static bool isAbsolutePath(const std::string & path);
-
-  /**
-   * Create a temporary file and open an output stream to write into this file.
-   * The file is created with the pattern "<tmpdir>/libbatch-<prefix>-XXXXXX" where <tmpdir> is the
-   * directory for temporary files and the X's are replaced by random characters. The caller is
-   * responsible for closing and deleting the file when it is no more used.
-   * <tmpdir> is found by looking for environment variables TEMP, TMP, TEMPDIR, TMPDIR, and defaults
-   * to "/tmp" if none of them is defined.
-   * \param prefix the prefix to use for the temporary file.
-   * \param outputStream an output stream that will be opened for writing in the temporary file. If
-   * the stream is already open, it will be closed first.
-   * \return the name of the created file.
-   */
-  static std::string createAndOpenTemporaryFile(const std::string & prefix,
-                                                std::ofstream & outputStream);
-
-private:
-
-  // No instanciation possible as this class provides only static methods
-  Utils() { }
-
-};
-
-}
-
-#endif /* BATCH_UTILS_HXX_ */
diff --git a/src/Core/Batch_Versatile.cxx b/src/Core/Batch_Versatile.cxx
deleted file mode 100644 (file)
index ecdde87..0000000
+++ /dev/null
@@ -1,271 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * Versatile.cxx : 
- *
- * Author : Ivan DUTKA-MALEN - EDF R&D
- * Date   : September 2003
- *
- */
-
-#include <iostream>
-#include <list>
-#include <string>
-#include <sstream>
-
-#include "Batch_GenericType.hxx"
-#include "Batch_BoolType.hxx"
-#include "Batch_LongType.hxx"
-#include "Batch_StringType.hxx"
-#include "Batch_Versatile.hxx"
-#include "Batch_TypeMismatchException.hxx"
-#include "Batch_ListIsFullException.hxx"
-
-using namespace std;
-
-namespace Batch {
-
-  Versatile::Versatile(DiscriminatorType discriminator, size_type maxsize, std::string name)
-    : _discriminator(discriminator),
-      _maxsize(maxsize),
-      _name(name)
-  {
-  }
-
-  Versatile::Versatile(const Versatile & V)
-   : _discriminator(V._discriminator),
-     _maxsize(V._maxsize),
-     _name(V._name)
-  {
-    Versatile::const_iterator it;
-    for(it=V.begin(); it!=V.end(); it++)
-      push_back( (*it)->clone() );
-  }
-
-  Versatile::~Versatile()
-  {
-    eraseAll();
-  }
-
-  Versatile & Versatile::operator = (const long l) throw(TypeMismatchException)
-  {
-    checkType(LONG);
-    eraseAll();
-    push_back(new LongType(l));
-    return *this;
-  }
-
-  Versatile & Versatile::operator = (const string & ch) throw(TypeMismatchException)
-  {
-    checkType(STRING);
-    eraseAll();
-    push_back(new StringType(ch));
-    return *this;
-  }
-
-  Versatile & Versatile::operator +=(const string & ch) throw(TypeMismatchException,ListIsFullException)
-  {
-    checkType(STRING);
-
-       // If max size is reached, throw a ListIsFullException
-    if (_maxsize == 0 || size() < _maxsize)
-      push_back(new StringType(ch));
-    else {
-      ostringstream msg;
-      msg << "Maximum size for \"" << _name << "\" is reached: " << _maxsize;
-      throw(ListIsFullException(msg.str()));
-    }
-    return *this;
-  }
-
-  Versatile & Versatile::operator , (const string & ch) throw(TypeMismatchException,ListIsFullException)
-  {
-    *this += ch;
-    return *this;
-  }
-
-  Versatile & Versatile::operator = (const char * ch) throw(TypeMismatchException)
-  {
-    return operator=(string(ch));
-  }
-
-  Versatile & Versatile::operator +=(const char * ch) throw(TypeMismatchException,ListIsFullException)
-  {
-    return operator+=(string(ch));
-  }
-
-  Versatile & Versatile::operator , (const char * ch) throw(TypeMismatchException,ListIsFullException)
-  {
-    return operator,(string(ch));
-  }
-
-  Versatile & Versatile::operator = (const Couple & cp) throw(TypeMismatchException)
-  {
-    checkType(COUPLE);
-    eraseAll();
-    push_back(new CoupleType(cp));
-    return *this;
-  }
-
-  Versatile & Versatile::operator +=(const Couple & cp) throw(TypeMismatchException,ListIsFullException)
-  {
-    checkType(COUPLE);
-    // If max size is reached, throw a ListIsFullException
-    if (_maxsize == 0 || size() < _maxsize)
-      push_back(new CoupleType(cp));
-    else {
-      ostringstream msg;
-      msg << "Maximum size for \"" << _name << "\" is reached: " << _maxsize;
-      throw(ListIsFullException(msg.str()));
-    }
-    return *this;
-  }
-
-  Versatile & Versatile::operator , (const Couple & cp) throw(TypeMismatchException,ListIsFullException)
-  {
-    *this += cp;
-    return *this;
-  }
-
-  ostream & operator << (ostream & os, const Versatile & V)
-  {
-    Versatile::const_iterator it;
-    const char * sep = "";
-
-    for(it=V.begin(); it!=V.end(); it++, sep=" ") {
-      string s = (*it)->affiche();
-      os << sep << s;
-    }
-    return os;
-  }
-
-  Versatile & Versatile::operator = (const int i) throw(TypeMismatchException)
-  {
-    checkType(LONG);
-    eraseAll();
-    push_back(new LongType((long)i));
-    return *this;
-  }
-
-  Versatile & Versatile::operator = (const bool b) throw(TypeMismatchException)
-  {
-    checkType(BOOL);
-    eraseAll();
-    push_back(new BoolType(b));
-    return *this;
-  }
-
-  void Versatile::checkType(DiscriminatorType t) const throw(TypeMismatchException)
-  {
-    if (_discriminator != t)
-      throw (TypeMismatchException("Trying to change type of Versatile object \"" + _name + "\""));
-  }
-
-  Versatile::operator long() const throw(TypeMismatchException)
-  {
-    // If the type does not correspond or if the list has more than one element,
-    // throw a TypeMismatchException
-    if ( _maxsize != 1 || _discriminator != LONG || size() == 0 ) {
-      ostringstream sst;
-      sst << "Cannot cast Versatile object \"" << _name << "\" to long";
-      throw (TypeMismatchException(sst.str()));
-    }
-       return *( static_cast<LongType *>(this->front()) );
-  }
-
-  Versatile::operator bool() const throw(TypeMismatchException)
-  {
-    // If the type does not correspond or if the list has more than one element,
-    // throw a TypeMismatchException
-    if ( _maxsize != 1 || _discriminator != BOOL || size() == 0 ) {
-      ostringstream sst;
-      sst << "Cannot cast Versatile object \"" << _name << "\" to bool";
-      throw(TypeMismatchException(sst.str()));
-    }
-    return *( static_cast<BoolType *>(this->front()) );
-  }
-
-  Versatile::operator int() const throw(TypeMismatchException)
-  {
-    return operator long();
-  }
-
-  Versatile::operator Couple() const throw(TypeMismatchException)
-  {
-    // If the type does not correspond or if the list has more than one element,
-    // throw a TypeMismatchException
-    if ( _maxsize != 1 || _discriminator != COUPLE || size() == 0 ) {
-      ostringstream sst;
-      sst << "Cannot cast Versatile object \"" << _name << "\" to Couple";
-      throw(TypeMismatchException(sst.str()));
-    }
-    return *( static_cast<CoupleType *>(this->front()) );
-  }
-
-  string Versatile::str() const throw(TypeMismatchException)
-  {
-    // If the type does not correspond, throw a TypeMismatchException
-    if ( _discriminator != STRING || size() == 0 ) {
-      ostringstream sst;
-      sst << "Cannot cast Versatile object \"" << _name << "\" to string";
-      throw(TypeMismatchException(sst.str()));
-    }
-
-       // The returned string is the concatenation of internal strings
-    string s;
-    Versatile::const_iterator it;
-    const char * sep = "";
-    for(it=begin(); it!=end(); it++, s+=sep, sep=" ")
-      s += *( static_cast<StringType *>(*it));
-
-    return s;
-  }
-
-  Versatile::operator string () const throw(TypeMismatchException)
-  {
-    return str();
-  }
-
-  void Versatile::eraseAll()
-  {
-    while(!empty()) {
-      delete back();
-      pop_back();
-    }
-  }
-
-  DiscriminatorType Versatile::getType() const
-  {
-    return _discriminator;
-  }
-
-  Versatile::size_type Versatile::getMaxSize() const
-  {
-    return _maxsize;
-  }
-
-  const string & Versatile::getName() const
-  {
-    return _name;
-  }
-
-}
diff --git a/src/Core/Batch_Versatile.hxx b/src/Core/Batch_Versatile.hxx
deleted file mode 100644 (file)
index 4c44b09..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * Versatile.hxx :
- *
- * Author : Ivan DUTKA-MALEN - EDF R&D
- * Date   : September 2003
- *
- */
-
-#ifndef _VERSATILE_H_
-#define _VERSATILE_H_
-
-#include "Batch_Defines.hxx"
-
-#include <iostream>
-#include <list>
-#include <string>
-#include "Batch_GenericType.hxx"
-#include "Batch_BoolType.hxx"
-#include "Batch_LongType.hxx"
-#include "Batch_StringType.hxx"
-#include "Batch_CoupleType.hxx"
-#include "Batch_TypeMismatchException.hxx"
-#include "Batch_ListIsFullException.hxx"
-#include "Batch_RunTimeException.hxx"
-
-namespace Batch {
-
-  // Authorized types
-  enum DiscriminatorType { BOOL, LONG, STRING, COUPLE };
-
-  class BATCH_EXPORT Versatile : public std::list< GenericType * >
-  {
-  public:
-
-    // Constructors
-    Versatile(DiscriminatorType discriminator, size_type maxsize, std::string name);
-    Versatile(const Versatile & V);
-
-    // Use of default constructor is forbidden but we cannot declare it private because
-    // compilation fails with VC8 on Windows
-    Versatile() { throw RunTimeException("Forbidden constructor"); }
-
-    // Destructor
-    virtual ~Versatile();
-
-    // Affectation and concatenation operators from base types
-    Versatile & operator = (const long     l)    throw(TypeMismatchException);
-    Versatile & operator = (const std::string & ch)   throw(TypeMismatchException);
-    Versatile & operator +=(const std::string & ch)   throw(TypeMismatchException,ListIsFullException);
-    Versatile & operator , (const std::string & ch)   throw(TypeMismatchException,ListIsFullException);
-    Versatile & operator = (const char * ch)   throw(TypeMismatchException);
-    Versatile & operator +=(const char * ch)   throw(TypeMismatchException,ListIsFullException);
-    Versatile & operator , (const char * ch)   throw(TypeMismatchException,ListIsFullException);
-    Versatile & operator = (const Couple & cp)   throw(TypeMismatchException);
-    Versatile & operator +=(const Couple & cp)   throw(TypeMismatchException,ListIsFullException);
-    Versatile & operator , (const Couple & cp)   throw(TypeMismatchException,ListIsFullException);
-    Versatile & operator = (const int i) throw(TypeMismatchException);
-    Versatile & operator = (const bool b) throw(TypeMismatchException);
-
-    // Type conversion to base types
-    operator long() const throw(TypeMismatchException);
-    operator std::string() const throw(TypeMismatchException);
-    operator Couple() const throw(TypeMismatchException);
-    std::string str() const throw(TypeMismatchException);
-    operator bool() const throw(TypeMismatchException);
-    operator int() const throw(TypeMismatchException);
-
-    // Display on a stream
-    BATCH_EXPORT friend std::ostream & operator << (std::ostream & os, const Versatile & );
-
-    // Check the type
-    void checkType(DiscriminatorType t) const throw (TypeMismatchException);
-
-    // Getter methods
-    DiscriminatorType getType() const;
-    size_type getMaxSize() const;
-    const std::string & getName() const;
-
-    // Erase all internal elements
-    void eraseAll();
-
-  protected:
-
-    DiscriminatorType _discriminator; // Internal element type
-    size_type _maxsize; // Maximum number of internal elements
-    std::string _name; // Object name (used for exceptions)
-
-  private:
-
-    // Forbid the use of affectation operator
-    void operator= (const Versatile & V) {}
-
-  };
-
-}
-
-#endif
diff --git a/src/Core/BoolType.cxx b/src/Core/BoolType.cxx
new file mode 100644 (file)
index 0000000..66b4f07
--- /dev/null
@@ -0,0 +1,66 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * BoolType.cxx : 
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date   : Septembre 2003
+ * Projet : SALOME 2
+ *
+ */
+
+#include <string>
+#include <assert.h>
+#include "BoolType.hxx"
+using namespace std;
+
+namespace Batch {
+
+       // Conversion en chaine
+  string BoolType::affiche() const
+  {
+               return _data ? string("true") : string("false");
+  }
+
+       // Operateur d'affectation
+  BoolType & BoolType::operator =(bool b)
+  {
+    _data = b;
+    return *this;
+  }
+
+       // Conversion en bool
+  BoolType::operator bool() const
+  {
+    return this->_data;
+  }
+
+       // Clone duplique l'objet et en fabrique un nouveau a l'aide de new
+       // qu'il faudra detruire ensuite manuellement
+  GenericType * BoolType::clone() const
+  {
+    BoolType * pB = new BoolType(this->_data);
+    assert(pB != 0);
+    return pB;
+  }
+
+}
diff --git a/src/Core/BoolType.hxx b/src/Core/BoolType.hxx
new file mode 100644 (file)
index 0000000..e7a27c3
--- /dev/null
@@ -0,0 +1,69 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * BoolType.hxx : 
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date   : Septembre 2003
+ * Projet : SALOME 2
+ *
+ */
+
+#ifndef _BOOLTYPE_H_
+#define _BOOLTYPE_H_
+
+#include "Defines.hxx"
+
+#include <string>
+#include "GenericType.hxx"
+
+namespace Batch {
+
+  class BATCH_EXPORT BoolType : public GenericType
+  {
+  public:
+               // Constructeur
+    BoolType(const bool b=false) : _data(b) {}
+
+               // Conversion en chaine
+    virtual std::string affiche() const;
+
+               // Operateur d'affectation
+    virtual BoolType & operator =(bool);
+
+               // Conversion en bool
+    virtual operator bool() const;
+
+               // Clone duplique l'objet et en fabrique un nouveau a l'aide de new
+               // qu'il faudra detruire ensuite manuellement
+    virtual GenericType * clone() const;
+
+  protected:
+    bool _data;
+
+  private:
+
+  };
+
+}
+
+#endif
index e4cb649e7c746da103caa90684372ef1295bc431..46e8703882ff7d0d6c9a83693af127bfc424e8e3 100644 (file)
 #  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-SET(CLASS_LIST Core/Batch_APIInternalFailureException
-               Core/Batch_BatchManager
-               Core/Batch_BatchManagerCatalog
-               Core/Batch_BoolType
-               Core/Batch_CommunicationProtocol
-               Core/Batch_Constants
-               Core/Batch_Couple
-               Core/Batch_CoupleType
-               Core/Batch_Date
-               Core/Batch_Environnement
-               Core/Batch_FactBatchManager
-               Core/Batch_GenericException
-               Core/Batch_GenericType
-               Core/Batch_InvalidArgumentException
-               Core/Batch_InvalidKeyException
-               Core/Batch_Job
-               Core/Batch_JobId
-               Core/Batch_JobInfo
-               Core/Batch_ListIsFullException
-               Core/Batch_LongType
-               Core/Batch_MpiImpl
-               Core/Batch_NotYetImplementedException
-               Core/Batch_ParameterTypeMap
-               Core/Batch_Parametre
-               Core/Batch_RunTimeException
-               Core/Batch_StringType
-               Core/Batch_TypeMismatchException
-               Core/Batch_Versatile
-               Core/Batch_Utils
+SET(CLASS_LIST Core/APIInternalFailureException
+               Core/BatchManager
+               Core/BatchManagerCatalog
+               Core/BoolType
+               Core/CommunicationProtocol
+               Core/Constants
+               Core/Couple
+               Core/CoupleType
+               Core/Date
+               Core/Environnement
+               Core/FactBatchManager
+               Core/GenericException
+               Core/GenericType
+               Core/InvalidArgumentException
+               Core/InvalidKeyException
+               Core/Job
+               Core/JobId
+               Core/JobInfo
+               Core/ListIsFullException
+               Core/LongType
+               Core/MpiImpl
+               Core/NotYetImplementedException
+               Core/ParameterTypeMap
+               Core/Parametre
+               Core/RunTimeException
+               Core/StringType
+               Core/TypeMismatchException
+               Core/Versatile
+               Core/Utils
    )
 
 APPEND_CLASSES_TO_SRC_FILES(${CLASS_LIST})
 APPEND_CLASSES_TO_HDR_FILES(${CLASS_LIST})
-APPEND_CLASSES_TO_HDR_FILES(Core/Batch_Defines)
+APPEND_CLASSES_TO_HDR_FILES(Core/Defines)
 
 IF (HAS_SH)
-    APPEND_CLASSES_TO_SRC_FILES(Core/Batch_CommunicationProtocolSH)
+    APPEND_CLASSES_TO_SRC_FILES(Core/CommunicationProtocolSH)
 ENDIF (HAS_SH)
 
 IF (HAS_RSH)
-    APPEND_CLASSES_TO_SRC_FILES(Core/Batch_CommunicationProtocolRSH)
+    APPEND_CLASSES_TO_SRC_FILES(Core/CommunicationProtocolRSH)
 ENDIF (HAS_RSH)
 
 IF (HAS_SSH)
-    APPEND_CLASSES_TO_SRC_FILES(Core/Batch_CommunicationProtocolSSH)
+    APPEND_CLASSES_TO_SRC_FILES(Core/CommunicationProtocolSSH)
 ENDIF (HAS_SSH)
 
 
diff --git a/src/Core/CommunicationProtocol.cxx b/src/Core/CommunicationProtocol.cxx
new file mode 100644 (file)
index 0000000..416b1ee
--- /dev/null
@@ -0,0 +1,167 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ *  CommunicationProtocol.cxx :
+ *
+ *  Created on: 14 sept. 2009
+ *  Author : Renaud BARATE - EDF R&D
+ */
+
+#include <stdlib.h>
+#include <iostream>
+#include <stdlib.h>
+
+#include <config.h>
+
+#include "CommunicationProtocol.hxx"
+#ifdef HAS_RSH
+ #include "CommunicationProtocolRSH.hxx"
+#endif
+#ifdef HAS_SH
+ #include "CommunicationProtocolSH.hxx"
+#endif
+#ifdef HAS_SSH
+ #include "CommunicationProtocolSSH.hxx"
+#endif
+#include "APIInternalFailureException.hxx"
+#include "RunTimeException.hxx"
+
+using namespace std;
+
+namespace Batch {
+
+  CommunicationProtocol::~CommunicationProtocol()
+  {
+  }
+
+  const CommunicationProtocol & CommunicationProtocol::getInstance(CommunicationProtocolType protocolType)
+  {
+    if (protocolType == SH) {
+#ifdef HAS_SH
+      static CommunicationProtocolSH instanceSH;
+      return instanceSH;
+#else
+      throw RunTimeException("Can't use SH protocol (SH tools were "
+                             "not found on the system at compile time).");
+#endif
+    } else if (protocolType == RSH) {
+#ifdef HAS_RSH
+      static CommunicationProtocolRSH instanceRSH;
+      return instanceRSH;
+#else
+      throw RunTimeException("Can't use RSH protocol (RSH tools were "
+                             "not found on the system at compile time).");
+#endif
+    } else if (protocolType == SSH) {
+#ifdef HAS_SSH
+      static CommunicationProtocolSSH instanceSSH;
+      return instanceSSH;
+#else
+      throw RunTimeException("Can't use SSH protocol (SSH tools were "
+                             "not found on the system at compile time).");
+#endif
+    } else
+      throw APIInternalFailureException("Unknown communication protocol.");
+  }
+
+  string CommunicationProtocol::getExecCommand(const string & subCommand,
+                                               const string & host,
+                                               const string & user) const
+  {
+    return commandStringFromArgs(getExecCommandArgs(subCommand, host, user));
+  }
+
+  int CommunicationProtocol::copyFile(const std::string & sourcePath,
+                                      const std::string & sourceHost,
+                                      const std::string & sourceUser,
+                                      const std::string & destinationPath,
+                                      const std::string & destinationHost,
+                                      const std::string & destinationUser) const
+  {
+    string command = commandStringFromArgs(getCopyCommandArgs(sourcePath, sourceHost, sourceUser,
+                                                              destinationPath, destinationHost,
+                                                              destinationUser));
+    cout << command.c_str() << endl;
+    int status = system(command.c_str());
+    return status;
+  }
+
+  string CommunicationProtocol::getRemoveSubCommand(const string & path) const
+  {
+    return string("rm ") + path;
+  }
+
+  string CommunicationProtocol::getMakeDirectorySubCommand(const string & path) const
+  {
+    return string("mkdir -p ") + path;
+  }
+
+  int CommunicationProtocol::removeFile(const std::string & path,
+                                        const std::string & host,
+                                        const std::string & user) const
+  {
+    string command = getExecCommand(getRemoveSubCommand(path), host, user);
+    cout << command.c_str() << endl;
+    int status = system(command.c_str());
+    return status;
+  }
+
+  int CommunicationProtocol::makeDirectory(const std::string & path,
+                                           const std::string & host,
+                                           const std::string & user) const
+  {
+    string command = getExecCommand(getMakeDirectorySubCommand(path), host, user);
+    cout << command.c_str() << endl;
+    int status = system(command.c_str());
+    return status;
+  }
+
+  string CommunicationProtocol::commandStringFromArgs(const vector<string> & commandArgs) const
+  {
+    string commandStr;
+
+    // On Windows we surround the whole command with quotes to avoid problems when
+    // we have several quoted arguments.
+#ifdef WIN32
+    commandStr += "\"";
+#endif
+
+    for (unsigned int i=0 ; i<commandArgs.size() ; i++) {
+      if (i != 0) commandStr += " ";
+
+      // if the argument contains spaces, we surround it with simple quotes (Linux)
+      // or double quotes (Windows)
+      if (commandArgs[i].find(' ') != string::npos) {
+        commandStr += string("\"") + commandArgs[i] + "\"";
+      } else {
+        commandStr += commandArgs[i];
+      }
+    }
+
+#ifdef WIN32
+    commandStr += "\"";
+#endif
+
+    return commandStr;
+  }
+
+}
diff --git a/src/Core/CommunicationProtocol.hxx b/src/Core/CommunicationProtocol.hxx
new file mode 100644 (file)
index 0000000..afd508e
--- /dev/null
@@ -0,0 +1,90 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ *  CommunicationProtocol.hxx :
+ *
+ *  Created on: 14 sept. 2009
+ *  Author : Renaud BARATE - EDF R&D
+ */
+
+#ifndef _BATCHCOMMUNICATIONPROTOCOL_H_
+#define _BATCHCOMMUNICATIONPROTOCOL_H_
+
+#include <string>
+#include <vector>
+
+#include "Defines.hxx"
+
+namespace Batch {
+
+  enum CommunicationProtocolType {SH, SSH, RSH};
+
+  class BATCH_EXPORT CommunicationProtocol
+  {
+  public:
+    virtual ~CommunicationProtocol();
+
+    static const CommunicationProtocol & getInstance(CommunicationProtocolType protocolType);
+
+    virtual std::string getExecCommand(const std::string & subCommand,
+                                       const std::string & host,
+                                       const std::string & user) const;
+
+    virtual std::vector<std::string> getExecCommandArgs(const std::string & subCommand,
+                                                        const std::string & host,
+                                                        const std::string & user) const=0;
+
+    virtual int copyFile(const std::string & sourcePath,
+                         const std::string & sourceHost,
+                         const std::string & sourceUser,
+                         const std::string & destinationPath,
+                         const std::string & destinationHost,
+                         const std::string & destinationUser) const;
+
+    virtual int removeFile(const std::string & path,
+                           const std::string & host,
+                           const std::string & user) const;
+
+    virtual int makeDirectory(const std::string & path,
+                              const std::string & host,
+                              const std::string & user) const;
+
+  protected:
+
+    virtual std::vector<std::string> getCopyCommandArgs(const std::string & sourcePath,
+                                                        const std::string & sourceHost,
+                                                        const std::string & sourceUser,
+                                                        const std::string & destinationPath,
+                                                        const std::string & destinationHost,
+                                                        const std::string & destinationUser) const=0;
+
+    virtual std::string getRemoveSubCommand(const std::string & path) const;
+
+    virtual std::string getMakeDirectorySubCommand(const std::string & path) const;
+
+    std::string commandStringFromArgs(const std::vector<std::string> & args) const;
+
+  };
+
+}
+
+#endif
diff --git a/src/Core/CommunicationProtocolRSH.cxx b/src/Core/CommunicationProtocolRSH.cxx
new file mode 100644 (file)
index 0000000..bb7a308
--- /dev/null
@@ -0,0 +1,192 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ *  CommunicationProtocolRSH.cxx :
+ *
+ *  Created on: 14 sept. 2009
+ *  Author : Renaud BARATE - EDF R&D
+ */
+
+#ifdef WIN32
+#include <direct.h>
+#include <iostream>
+
+#include <RunTimeException.hxx>
+#endif
+
+#include <config.h>
+
+#include "CommunicationProtocolRSH.hxx"
+
+using namespace std;
+
+namespace Batch {
+
+  vector<string> CommunicationProtocolRSH::getExecCommandArgs(const string & subCommand,
+                                                              const string & host,
+                                                              const string & user) const
+  {
+    vector<string> cmd;
+
+    cmd.push_back(RSH_COMMAND);
+    cmd.push_back(host);
+
+    if (user.size() > 0) {
+      cmd.push_back("-l");
+      cmd.push_back(user);
+    }
+
+#ifdef WIN32
+    cmd.push_back("-n");
+#endif
+
+    cmd.push_back(subCommand);
+
+    return cmd;
+  }
+
+  vector<string> CommunicationProtocolRSH::getCopyCommandArgs(const string & sourcePath,
+                                                              const string & sourceHost,
+                                                              const string & sourceUser,
+                                                              const string & destinationPath,
+                                                              const string & destinationHost,
+                                                              const string & destinationUser) const
+  {
+    vector<string> cmd;
+
+    string fullSource;
+    if (sourceHost.size() != 0) {
+      if (sourceUser.size() != 0) {
+#ifdef WIN32
+        fullSource += sourceHost + "." + sourceUser + ":";
+#else
+        fullSource += sourceUser + "@" + sourceHost + ":";
+#endif
+      } else {
+        fullSource += sourceHost + ":";
+      }
+    }
+    fullSource += sourcePath;
+
+    string fullDestination;
+    if (destinationHost.size() != 0) {
+      if (destinationUser.size() != 0) {
+#ifdef WIN32
+        fullDestination += destinationHost + "." + destinationUser + ":";
+#else
+        fullDestination += destinationUser + "@" + destinationHost + ":";
+#endif
+      } else {
+        fullDestination += destinationHost + ":";
+      }
+    }
+    fullDestination += destinationPath;
+
+    cmd.push_back(RCP_COMMAND);
+    cmd.push_back("-r");
+    cmd.push_back(fullSource);
+    cmd.push_back(fullDestination);
+
+    return cmd;
+  }
+
+#ifdef WIN32
+  int CommunicationProtocolRSH::copyFile(const std::string & sourcePath,
+                                         const std::string & sourceHost,
+                                         const std::string & sourceUser,
+                                         const std::string & destinationPath,
+                                         const std::string & destinationHost,
+                                         const std::string & destinationUser) const
+  {
+    // On Windows, we can't use drive letters in the paths of rcp command because they
+    // are confused with host names. So we must first change the working directory and
+    // then copy the file using its path without the drive letter.
+
+    // Extract the drive letter from the source path
+    string sourcePathWithoutDrive;
+    char sourceDriveLetter = getDriveLetter(sourcePath, &sourcePathWithoutDrive);
+    // Error if we have a drive letter and it is a remote path
+    if (sourceDriveLetter != '\0' && sourceHost.size() != 0)
+      throw RunTimeException(string("Invalid path: ") + sourcePath + " for host " + sourceHost);
+
+    // Extract the drive letter from the destination path
+    string destinationPathWithoutDrive;
+    char destinationDriveLetter = getDriveLetter(destinationPath, &destinationPathWithoutDrive);
+    // Error if we have a drive letter and it is a remote path
+    if (destinationDriveLetter != '\0' && destinationHost.size() != 0)
+      throw RunTimeException(string("Invalid path: ") + destinationPath + " for host " + destinationHost);
+
+    // Error if we have two drive letters and they are different
+    if (sourceDriveLetter != '\0' && destinationDriveLetter != '\0' &&
+        sourceDriveLetter != destinationDriveLetter)
+      throw RunTimeException(string("Can't use RCP to copy files between different drives: ") +
+                             sourcePath + (", ") + destinationPath);
+
+    // Now get the drive letter to use if there is one
+    char driveLetter = (sourceDriveLetter != '\0') ? sourceDriveLetter : destinationDriveLetter;
+
+    // Get the drive of the current working directory
+    char cwd[_MAX_PATH];
+    _getcwd(cwd, _MAX_PATH);
+    char currentDrive = getDriveLetter(cwd);
+
+    // Change working directory if necessary
+    if (driveLetter != '\0' && driveLetter != currentDrive) {
+      char newdir[3];
+      newdir[0] = driveLetter;
+      newdir[1] = ':';
+      newdir[2] = '\0';
+      cout << "Changing directory: " << newdir << endl;
+      _chdir(newdir);
+    }
+
+    int status = CommunicationProtocol::copyFile(sourcePathWithoutDrive, sourceHost, sourceUser,
+                                                 destinationPathWithoutDrive, destinationHost, destinationUser);
+
+    // Go back to previous directory if necessary
+    if (driveLetter != '\0' && driveLetter != currentDrive) {
+      cout << "Changing directory: " << cwd << endl;
+      _chdir(cwd);
+    }
+
+    return status;
+  }
+
+  char CommunicationProtocolRSH::getDriveLetter(const string & path, string * pathWithoutDrive) const
+  {
+    if (path.find(':') != string::npos) {
+      // Error if the colon is not the second character
+      if (path.size() < 2 || path[1] != ':')
+        throw RunTimeException(string("Invalid path: ") + path);
+      else {
+        if (pathWithoutDrive != NULL) *pathWithoutDrive = path.substr(2);
+        return path[0];
+      }
+    } else {
+      if (pathWithoutDrive != NULL) *pathWithoutDrive = path;
+      return '\0';
+    }
+  }
+
+#endif
+
+}
diff --git a/src/Core/CommunicationProtocolRSH.hxx b/src/Core/CommunicationProtocolRSH.hxx
new file mode 100644 (file)
index 0000000..6a32d08
--- /dev/null
@@ -0,0 +1,75 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ *  CommunicationProtocolRSH.hxx :
+ *
+ *  Created on: 14 sept. 2009
+ *  Author : Renaud BARATE - EDF R&D
+ */
+
+#ifndef _BATCHCOMMUNICATIONPROTOCOLRSH_H_
+#define _BATCHCOMMUNICATIONPROTOCOLRSH_H_
+
+#include <string>
+#include <vector>
+
+#include "Defines.hxx"
+#include "CommunicationProtocol.hxx"
+
+namespace Batch {
+
+  class BATCH_EXPORT CommunicationProtocolRSH : public CommunicationProtocol
+  {
+  public:
+    std::vector<std::string> getExecCommandArgs(const std::string & subCommand,
+                                                const std::string & host,
+                                                const std::string & user) const;
+
+    std::vector<std::string> getCopyCommandArgs(const std::string & sourcePath,
+                                                const std::string & sourceHost,
+                                                const std::string & sourceUser,
+                                                const std::string & destinationPath,
+                                                const std::string & destinationHost,
+                                                const std::string & destinationUser) const;
+
+#ifdef WIN32
+
+    // On Windows, we must reimplement copyFile because there are problems with absolute
+    // paths containing a colon.
+    int copyFile(const std::string & sourcePath,
+                 const std::string & sourceHost,
+                 const std::string & sourceUser,
+                 const std::string & destinationPath,
+                 const std::string & destinationHost,
+                 const std::string & destinationUser) const;
+
+  protected:
+
+    char getDriveLetter(const std::string & path, std::string * pathWithoutDrive = NULL) const;
+
+#endif
+
+  };
+
+}
+
+#endif
diff --git a/src/Core/CommunicationProtocolSH.cxx b/src/Core/CommunicationProtocolSH.cxx
new file mode 100644 (file)
index 0000000..546e97c
--- /dev/null
@@ -0,0 +1,101 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ *  CommunicationProtocolSH.cxx :
+ *
+ *  Created on: 16 sept. 2009
+ *  Author : Renaud BARATE - EDF R&D
+ */
+
+#include <config.h>
+
+#include "CommunicationProtocolSH.hxx"
+
+using namespace std;
+
+namespace Batch {
+
+  // Simple method to fix path strings depending on the platform. On Windows, it will replace
+  // forward slashes '/' by backslashes '\'. On Unix, the path is just copied without change.
+  string CommunicationProtocolSH::fixPath(const string & path) const
+  {
+    string fixedPath = path;
+  #ifdef WIN32
+    for (unsigned int i=0 ; i<fixedPath.size() ; i++) {
+      if (fixedPath[i] == '/') fixedPath[i] = '\\';
+    }
+  #endif
+    return fixedPath;
+  }
+
+  vector<string> CommunicationProtocolSH::getExecCommandArgs(const string & subCommand,
+                                                             const string & host,
+                                                             const string & user) const
+  {
+    vector<string> cmd;
+
+    cmd.push_back(fixPath(SH_COMMAND));
+
+#ifdef WIN32
+    cmd.push_back("/c");
+#else
+    cmd.push_back("-c");
+#endif
+
+    cmd.push_back(fixPath(subCommand));
+
+    return cmd;
+  }
+
+  vector<string> CommunicationProtocolSH::getCopyCommandArgs(const string & sourcePath,
+                                                             const string & sourceHost,
+                                                             const string & sourceUser,
+                                                             const string & destinationPath,
+                                                             const string & destinationHost,
+                                                             const string & destinationUser) const
+  {
+    vector<string> cmd;
+    cmd.push_back(CP_COMMAND);
+#ifndef WIN32
+    cmd.push_back("-r");
+#endif
+    cmd.push_back(fixPath(sourcePath));
+    cmd.push_back(fixPath(destinationPath));
+    return cmd;
+  }
+
+  string CommunicationProtocolSH::getRemoveSubCommand(const string & path) const
+  {
+    return string(RM_COMMAND) + " " + fixPath(path);
+  }
+
+  string CommunicationProtocolSH::getMakeDirectorySubCommand(const string & path) const
+  {
+    string subCommand = MKDIR_COMMAND;
+#ifndef WIN32
+    subCommand += " -p";
+#endif
+    subCommand += " " + fixPath(path);
+    return subCommand;
+  }
+
+}
diff --git a/src/Core/CommunicationProtocolSH.hxx b/src/Core/CommunicationProtocolSH.hxx
new file mode 100644 (file)
index 0000000..778d5f9
--- /dev/null
@@ -0,0 +1,66 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ *  CommunicationProtocolSH.hxx :
+ *
+ *  Created on: 16 sept. 2009
+ *  Author : Renaud BARATE - EDF R&D
+ */
+
+#ifndef _BATCHCOMMUNICATIONPROTOCOLSH_H_
+#define _BATCHCOMMUNICATIONPROTOCOLSH_H_
+
+#include <string>
+#include <vector>
+
+#include "Defines.hxx"
+#include "CommunicationProtocol.hxx"
+
+namespace Batch {
+
+  class BATCH_EXPORT CommunicationProtocolSH : public CommunicationProtocol
+  {
+  public:
+    std::vector<std::string> getExecCommandArgs(const std::string & subCommand,
+                                                const std::string & host,
+                                                const std::string & user) const;
+
+    std::vector<std::string> getCopyCommandArgs(const std::string & sourcePath,
+                                                const std::string & sourceHost,
+                                                const std::string & sourceUser,
+                                                const std::string & destinationPath,
+                                                const std::string & destinationHost,
+                                                const std::string & destinationUser) const;
+
+  protected:
+
+    std::string getRemoveSubCommand(const std::string & path) const;
+
+    std::string getMakeDirectorySubCommand(const std::string & path) const;
+
+    std::string fixPath(const std::string & path) const;
+
+  };
+
+}
+
+#endif
diff --git a/src/Core/CommunicationProtocolSSH.cxx b/src/Core/CommunicationProtocolSSH.cxx
new file mode 100644 (file)
index 0000000..3a40db1
--- /dev/null
@@ -0,0 +1,106 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ *  CommunicationProtocolSSH.cxx :
+ *
+ *  Created on: 14 sept. 2009
+ *  Author : Renaud BARATE - EDF R&D
+ */
+
+#include <config.h>
+
+#include "CommunicationProtocolSSH.hxx"
+
+using namespace std;
+
+namespace Batch {
+
+  vector<string> CommunicationProtocolSSH::getExecCommandArgs(const string & subCommand,
+                                                              const string & host,
+                                                              const string & user) const
+  {
+    vector<string> cmd;
+
+    cmd.push_back(SSH_COMMAND);
+    cmd.push_back(host);
+
+    if (user.size() != 0) {
+      cmd.push_back("-l");
+      cmd.push_back(user);
+    }
+
+    cmd.push_back(subCommand);
+
+    return cmd;
+  }
+
+  vector<string> CommunicationProtocolSSH::getCopyCommandArgs(const string & sourcePath,
+                                                              const string & sourceHost,
+                                                              const string & sourceUser,
+                                                              const string & destinationPath,
+                                                              const string & destinationHost,
+                                                              const string & destinationUser) const
+  {
+    vector<string> cmd;
+
+    string fullSource;
+    if (sourceHost.size() != 0) {
+      if (sourceUser.size() != 0) {
+        fullSource += sourceUser + "@";
+      }
+      fullSource += sourceHost + ":";
+    }
+#ifndef WIN32
+    fullSource += "'";
+#endif
+    fullSource += sourcePath;
+#ifndef WIN32
+    fullSource += "'";
+#endif
+
+    string fullDestination;
+    if (destinationHost.size() != 0) {
+      if (destinationUser.size() != 0) {
+        fullDestination += destinationUser + "@";
+      }
+      fullDestination += destinationHost + ":";
+    }
+#ifndef WIN32
+    fullDestination += "'";
+#endif
+    fullDestination += destinationPath;
+#ifndef WIN32
+    fullDestination += "'";
+#endif
+
+    // Option -p is used to keep the same permissions for the destination file
+    // (particularly useful to keep scripts executable when copying them)
+    cmd.push_back(SCP_COMMAND);
+    cmd.push_back("-p");
+    cmd.push_back("-r");
+    cmd.push_back(fullSource);
+    cmd.push_back(fullDestination);
+
+    return cmd;
+  }
+
+}
diff --git a/src/Core/CommunicationProtocolSSH.hxx b/src/Core/CommunicationProtocolSSH.hxx
new file mode 100644 (file)
index 0000000..54145ce
--- /dev/null
@@ -0,0 +1,60 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ *  CommunicationProtocolSSH.hxx :
+ *
+ *  Created on: 14 sept. 2009
+ *  Author : Renaud BARATE - EDF R&D
+ */
+
+#ifndef _BATCHCOMMUNICATIONPROTOCOLSSH_H_
+#define _BATCHCOMMUNICATIONPROTOCOLSSH_H_
+
+#include <string>
+#include <vector>
+
+#include "Defines.hxx"
+#include "CommunicationProtocol.hxx"
+
+namespace Batch {
+
+  class BATCH_EXPORT CommunicationProtocolSSH : public CommunicationProtocol
+  {
+  public:
+    std::vector<std::string> getExecCommandArgs(const std::string & subCommand,
+                                                const std::string & host,
+                                                const std::string & user) const;
+
+    std::vector<std::string> getCopyCommandArgs(const std::string & sourcePath,
+                                                const std::string & sourceHost,
+                                                const std::string & sourceUser,
+                                                const std::string & destinationPath,
+                                                const std::string & destinationHost,
+                                                const std::string & destinationUser) const;
+
+  protected:
+
+  };
+
+}
+
+#endif
diff --git a/src/Core/Constants.cxx b/src/Core/Constants.cxx
new file mode 100644 (file)
index 0000000..2968e6f
--- /dev/null
@@ -0,0 +1,64 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * Constants.cxx :
+ *
+ * Auteur : Renaud BARATE - EDF R&D
+ * Date   : January 2010
+ *
+ */
+
+#include "Constants.hxx"
+
+namespace Batch {
+
+  // Definition of the string constants (keys for the parameter map)
+  def_Constant(ARGUMENTS);
+  def_Constant(EXECUTABLE);
+  def_Constant(ID);
+  def_Constant(INFILE);
+  def_Constant(MAXCPUTIME);
+  def_Constant(MAXDISKSIZE);
+  def_Constant(MAXRAMSIZE);
+  def_Constant(MAXWALLTIME);
+  def_Constant(NAME);
+  def_Constant(NBPROC);
+  def_Constant(NBPROCPERNODE);
+  def_Constant(OUTFILE);
+  def_Constant(PID);
+  def_Constant(QUEUE);
+  def_Constant(STATE);
+  def_Constant(USER);
+  def_Constant(WORKDIR);
+  def_Constant(HOMEDIR);
+  def_Constant(EXCLUSIVE);
+
+  // These constants define the status of a job (parameter STATE);
+  def_Constant(CREATED);
+  def_Constant(IN_PROCESS);
+  def_Constant(QUEUED);
+  def_Constant(RUNNING);
+  def_Constant(PAUSED);
+  def_Constant(FINISHED);
+  def_Constant(FAILED);
+
+}
diff --git a/src/Core/Constants.hxx b/src/Core/Constants.hxx
new file mode 100644 (file)
index 0000000..5d16505
--- /dev/null
@@ -0,0 +1,77 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * Constants.hxx :
+ *
+ * Auteur : Renaud BARATE - EDF R&D
+ * Date   : January 2010
+ *
+ */
+
+#ifndef _CONSTANTS_H_
+#define _CONSTANTS_H_
+
+#include <string>
+
+#include "Defines.hxx"
+
+// These macros simplify the creation of new string constants for keys and
+// values in parameters map.
+// TODO: replace those static declarations by an external description file (XML for instance)
+#define decl_extern_Constant(constant) extern BATCH_EXPORT const std::string constant
+#define def_Constant(constant) const std::string constant = #constant
+
+namespace Batch {
+
+  // Declaration of the keys for the parameter map
+  decl_extern_Constant(ARGUMENTS);
+  decl_extern_Constant(EXECUTABLE);
+  decl_extern_Constant(ID);
+  decl_extern_Constant(INFILE);
+  decl_extern_Constant(MAXCPUTIME);
+  decl_extern_Constant(MAXDISKSIZE);
+  decl_extern_Constant(MAXRAMSIZE);
+  decl_extern_Constant(MAXWALLTIME);
+  decl_extern_Constant(NAME);
+  decl_extern_Constant(NBPROC);
+  decl_extern_Constant(NBPROCPERNODE);
+  decl_extern_Constant(OUTFILE);
+  decl_extern_Constant(PID);
+  decl_extern_Constant(QUEUE);
+  decl_extern_Constant(STATE);
+  decl_extern_Constant(USER);
+  decl_extern_Constant(WORKDIR);
+  decl_extern_Constant(HOMEDIR);
+  decl_extern_Constant(EXCLUSIVE);
+
+  // These constants define the status of a job (parameter STATE)
+  decl_extern_Constant(CREATED);
+  decl_extern_Constant(IN_PROCESS);
+  decl_extern_Constant(QUEUED);
+  decl_extern_Constant(RUNNING);
+  decl_extern_Constant(PAUSED);
+  decl_extern_Constant(FINISHED);
+  decl_extern_Constant(FAILED);
+
+}
+
+#endif
diff --git a/src/Core/Couple.cxx b/src/Core/Couple.cxx
new file mode 100644 (file)
index 0000000..4782efb
--- /dev/null
@@ -0,0 +1,63 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * Couple.cxx : 
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail   : mailto:ivan.dutka-malen@der.edf.fr
+ * Date   : Tue Dec  9 15:00:35 2003
+ * Projet : Salome 2
+ *
+ */
+
+#include "Couple.hxx"
+using namespace std;
+
+namespace Batch {
+
+       // Operateur d'affectation
+       Couple & Couple::operator =(const Couple & C)
+  {
+               _local  = C._local;
+               _remote = C._remote;
+    return *this;
+  }
+
+       // Conversion en chaine
+  string Couple::str()  const
+  {
+               string res;
+               res  = "Couple(local : ";
+               res += _local;
+               res += ", remote : ";
+               res += _remote;
+               res += ")";
+    return res;
+  }
+
+       // Operateur pour l'affichage sur un stream
+  ostream & operator << (ostream & os, const Couple & cp)
+  {
+    return os << cp.str();
+  }
+
+}
diff --git a/src/Core/Couple.hxx b/src/Core/Couple.hxx
new file mode 100644 (file)
index 0000000..fe41fbc
--- /dev/null
@@ -0,0 +1,76 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * Couple.hxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail   : mailto:ivan.dutka-malen@der.edf.fr
+ * Date   : Tue Dec  9 15:00:35 2003
+ * Projet : Salome 2
+ *
+ */
+
+#ifndef _COUPLE_H_
+#define _COUPLE_H_
+
+#include "Defines.hxx"
+
+#include <string>
+
+namespace Batch {
+
+  class BATCH_EXPORT Couple
+  {
+  public:
+    // Constructeur standard
+    Couple(const std::string & local="", const std::string & remote="") : _local(local), _remote(remote) {}
+
+    // Constructeur par recopie
+    Couple(const Couple & C) : _local(C._local), _remote(C._remote) {}
+
+    // Destructeur
+    virtual ~Couple() {}
+
+    // Operateur pour l'affichage sur un stream
+    BATCH_EXPORT friend std::ostream & operator << (std::ostream & os, const Couple & cp);
+
+    // Operateur d'affectation
+    virtual Couple & operator =(const Couple &);
+
+    // Conversion en chaine
+    virtual std::string str() const;
+
+    // Accesseurs
+    virtual std::string getLocal() const { return _local; }
+    virtual std::string getRemote() const { return _remote; }
+
+  protected:
+    std::string _local;  // chemin d'acces au fichier local
+    std::string _remote; // chemin d'acees au fichier distant
+
+  private:
+
+  };
+
+}
+
+#endif
diff --git a/src/Core/CoupleType.cxx b/src/Core/CoupleType.cxx
new file mode 100644 (file)
index 0000000..0b7144b
--- /dev/null
@@ -0,0 +1,73 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * CoupleType.cxx : 
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail   : mailto:ivan.dutka-malen@der.edf.fr
+ * Date   : Tue Dec  9 14:51:53 2003
+ * Projet : Salome 2
+ *
+ */
+
+#include <assert.h>
+#include "CoupleType.hxx"
+using namespace std;
+
+namespace Batch {
+
+       // Conversion en chaine
+  string CoupleType::affiche() const
+  {
+    return _data.str();
+  }
+
+       // Operateur d'affectation
+  CoupleType & CoupleType::operator =(const Couple & C)
+  {
+    _data = C;
+    return *this;
+  }
+
+       // Conversion en char
+  CoupleType::operator Couple() const
+  {
+    return _data;
+  }
+
+       // Conversion en chaine
+  CoupleType::operator string() const
+  {
+    return _data.str();
+  }
+
+       // Clone duplique l'objet et en fabrique un nouveau a l'aide de new
+       // qu'il faudra detruire ensuite manuellement
+  GenericType * CoupleType::clone() const
+  {
+    CoupleType * pC = new CoupleType(this->_data);
+    assert(pC != 0);
+    return pC;
+  }
+
+}
+
diff --git a/src/Core/CoupleType.hxx b/src/Core/CoupleType.hxx
new file mode 100644 (file)
index 0000000..b6fcf7a
--- /dev/null
@@ -0,0 +1,72 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * CoupleType.hxx : 
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail   : mailto:ivan.dutka-malen@der.edf.fr
+ * Date   : Tue Dec  9 14:51:53 2003
+ * Projet : Salome 2
+ *
+ */
+
+#ifndef _COUPLETYPE_H_
+#define _COUPLETYPE_H_
+
+#include "Defines.hxx"
+
+#include <string>
+#include "GenericType.hxx"
+#include "Couple.hxx"
+
+namespace Batch {
+
+  class BATCH_EXPORT CoupleType : public GenericType
+  {
+  public:
+               // Constructeur
+    CoupleType(const Couple & C) : _data(C) {}
+
+               // Conversion en chaine
+    virtual std::string affiche() const;
+    virtual operator std::string() const;
+
+               // Operateur d'affectation
+    virtual CoupleType & operator =(const Couple & C);
+
+               // Conversion en char
+    virtual operator Couple() const;
+
+               // Clone duplique l'objet et en fabrique un nouveau a l'aide de new
+               // qu'il faudra detruire ensuite manuellement
+    virtual GenericType * clone() const;
+
+  protected:
+               Couple _data;
+
+  private:
+
+  };
+
+}
+
+#endif
diff --git a/src/Core/Date.cxx b/src/Core/Date.cxx
new file mode 100644 (file)
index 0000000..7e73d49
--- /dev/null
@@ -0,0 +1,195 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * Date.cxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail   : mailto:ivan.dutka-malen@der.edf.fr
+ * Date   : Wed Nov 26 14:11:42 2003
+ * Projet : Salome 2
+ *
+ */
+
+#include <cstdio>
+#include <ctime>
+#include "Date.hxx"
+using namespace std;
+
+namespace Batch {
+
+  Date::Date(const long l)
+  {
+    time_t l_t = l;
+    struct tm * p_tm = localtime(&l_t);
+    _day   = p_tm->tm_mday;
+    _month = p_tm->tm_mon  + 1;
+    _year  = p_tm->tm_year + 1900;
+    _hour  = p_tm->tm_hour;
+    _min   = p_tm->tm_min;
+    _sec   = p_tm->tm_sec;
+  }
+
+  Date::Date(const string s)
+  {
+    if ((s == "now") ||        (s == "Now") || (s == "NOW")) {
+      long l = time(0);
+      time_t l_t = l;
+      struct tm * p_tm = localtime(&l_t);
+      _day   = p_tm->tm_mday;
+      _month = p_tm->tm_mon  + 1;
+      _year  = p_tm->tm_year + 1900;
+      _hour  = p_tm->tm_hour;
+      _min   = p_tm->tm_min;
+      _sec   = p_tm->tm_sec;
+
+    } else {
+//      char c;
+//       istringstream ist(s);
+//       ist >> _day   >> c
+//       >> _month >> c
+//       >> _year  >> c
+//       >> _hour  >> c
+//       >> _min   >> c
+//       >> _sec;
+      sscanf(s.c_str(), "%d/%d/%d-%d:%d:%d", &_day, &_month, &_year, &_hour, &_min, &_sec);
+    }
+  }
+
+  Date & Date::operator =(long l)
+  {
+    time_t l_t = l;
+    struct tm * p_tm = localtime(&l_t);
+    _day   = p_tm->tm_mday;
+    _month = p_tm->tm_mon  + 1;
+    _year  = p_tm->tm_year + 1900;
+    _hour  = p_tm->tm_hour;
+    _min   = p_tm->tm_min;
+    _sec   = p_tm->tm_sec;
+
+    return *this;
+  }
+
+  Date & Date::operator +(long l)
+  {
+    *this = epoch() + l;
+    return *this;
+  }
+
+  Date & Date::operator -(long l)
+  {
+    *this = epoch() - l;
+    return *this;
+  }
+
+  Date & Date::operator +=(long l)
+  {
+    *this = epoch() + l;
+    return *this;
+  }
+
+  Date & Date::operator -=(long l)
+  {
+    *this = epoch() - l;
+    return *this;
+  }
+
+  Date & Date::operator =(const string & s)
+  {
+    if ((s == "now") ||        (s == "Now") || (s == "NOW")) {
+      long l = time(0);
+      time_t l_t = l;
+      struct tm * p_tm = localtime(&l_t);
+      _day   = p_tm->tm_mday;
+      _month = p_tm->tm_mon  + 1;
+      _year  = p_tm->tm_year + 1900;
+      _hour  = p_tm->tm_hour;
+      _min   = p_tm->tm_min;
+      _sec   = p_tm->tm_sec;
+
+    } else {
+//       char c;
+//       istringstream ist(s);
+//       ist >> _day   >> c
+//       >> _month >> c
+//       >> _year  >> c
+//       >> _hour  >> c
+//       >> _min   >> c
+//       >> _sec;
+      sscanf(s.c_str(), "%d/%d/%d-%d:%d:%d", &_day, &_month, &_year, &_hour, &_min, &_sec);
+    }
+
+    return *this;
+  }
+
+  string Date::str() const
+  {
+    char buf[64];
+    string datestr;
+
+    // _day to char *
+    sprintf(buf, "%02d", _day);
+    datestr += buf;
+    datestr += "/";
+
+    // _month to char *
+    sprintf(buf, "%02d", _month);
+    datestr += buf;
+    datestr += "/";
+
+    // _year to char *
+    sprintf(buf, "%04d", _year);
+    datestr += buf;
+    datestr += "-";
+
+    // _hour to char *
+    sprintf(buf, "%02d", _hour);
+    datestr += buf;
+    datestr += ":";
+
+    // _min to char *
+    sprintf(buf, "%02d", _min);
+    datestr += buf;
+    datestr += ":";
+
+    // _sec to char *
+    sprintf(buf, "%02d", _sec);
+    datestr += buf;
+
+    return datestr;
+  }
+
+  long Date::epoch() const
+  {
+    struct tm T;
+    T.tm_mday = _day;
+    T.tm_mon  = _month - 1;
+    T.tm_year = _year  - 1900;
+    T.tm_hour = _hour;
+    T.tm_min  = _min;
+    T.tm_sec  = _sec;
+    return mktime(&T);
+  }
+
+}
+
+
+// COMMENTS
diff --git a/src/Core/Date.hxx b/src/Core/Date.hxx
new file mode 100644 (file)
index 0000000..cfd3b76
--- /dev/null
@@ -0,0 +1,68 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * Date.hxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail   : mailto:ivan.dutka-malen@der.edf.fr
+ * Date   : Wed Nov 26 14:11:42 2003
+ * Projet : Salome 2
+ *
+ */
+
+#ifndef _DATE_H_
+#define _DATE_H_
+
+#include "Defines.hxx"
+
+#include <string>
+
+namespace Batch {
+
+  class BATCH_EXPORT Date
+  {
+  public:
+    Date(const long l=0);
+    Date(const std::string s);
+    virtual ~Date() {}
+    virtual Date & operator =(long l);
+    virtual Date & operator +(long l);
+    virtual Date & operator -(long l);
+    virtual Date & operator +=(long l);
+    virtual Date & operator -=(long l);
+    virtual Date & operator =(const std::string & s);
+    virtual std::string str() const;
+    virtual long epoch() const;
+
+  protected:
+    int _day, _month, _year;
+    int _hour, _min, _sec;
+
+  private:
+
+  };
+
+}
+
+#endif
+
+// COMMENTS
diff --git a/src/Core/Defines.hxx b/src/Core/Defines.hxx
new file mode 100644 (file)
index 0000000..1a22c8d
--- /dev/null
@@ -0,0 +1,45 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//  File   : Defines.hxx
+//  Author : Alexander A. BORODIN
+//  Module : SALOME
+//
+#ifndef _BATCH_Defines_HXX_
+#define _BATCH_Defines_HXX_
+
+#ifdef WIN32
+# if defined EXPORTS
+#  define BATCH_EXPORT __declspec( dllexport )
+# else
+#  define BATCH_EXPORT __declspec( dllimport )
+# endif
+#else
+# define BATCH_EXPORT
+#endif
+
+#ifdef WIN32
+#define BATCH_CHMOD(name, mode) _chmod(name, mode)
+#else
+#define BATCH_CHMOD(name, mode) chmod(name, mode)
+#endif
+
+#endif
diff --git a/src/Core/Environnement.cxx b/src/Core/Environnement.cxx
new file mode 100644 (file)
index 0000000..db85263
--- /dev/null
@@ -0,0 +1,38 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * Environnement.cxx : 
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail   : mailto:ivan.dutka-malen@der.edf.fr
+ * Date   : Thu Oct 16 11:37:47 2003
+ * Projet : Salome 2
+ *
+ */
+
+#include "Environnement.hxx"
+using namespace std;
+
+namespace Batch {
+
+
+}
diff --git a/src/Core/Environnement.hxx b/src/Core/Environnement.hxx
new file mode 100644 (file)
index 0000000..75eb7a7
--- /dev/null
@@ -0,0 +1,48 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * Environnement.hxx : 
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail   : mailto:ivan.dutka-malen@der.edf.fr
+ * Date   : Thu Oct 16 11:37:47 2003
+ * Projet : Salome 2
+ *
+ */
+
+#ifndef _ENVIRONNEMENT_H_
+#define _ENVIRONNEMENT_H_
+
+#include "Defines.hxx"
+
+
+#include <string>
+#include <map>
+
+namespace Batch {
+
+  typedef std::map < std::string, std::string > Environnement;
+
+}
+
+#endif
+
diff --git a/src/Core/FactBatchManager.cxx b/src/Core/FactBatchManager.cxx
new file mode 100644 (file)
index 0000000..f926830
--- /dev/null
@@ -0,0 +1,71 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * FactBatchManager.cxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date   : Septembre 2004
+ * Projet : SALOME 2
+ *
+ */
+
+#include <string>
+#include <sstream>
+#include <iostream>
+#include "BatchManagerCatalog.hxx"
+#include "FactBatchManager.hxx"
+using namespace std;
+
+namespace Batch {
+
+  // Constructeur
+  FactBatchManager::FactBatchManager(const string & _t) : type(_t)
+  {
+    BatchManagerCatalog::getInstance().addFactBatchManager(type.c_str(), this);
+
+   /*
+    ostringstream msg;
+    msg << "FactBatchManager of type '" << type << "' inserted into catalog";
+    cerr << msg.str().c_str() << endl;
+    */
+  }
+
+  // Destructeur
+  FactBatchManager::~FactBatchManager()
+  {
+    // Nothing to do
+  }
+
+  // Accesseur
+  string FactBatchManager::getType() const
+  {
+    return type;
+  }
+
+  string FactBatchManager::__repr__() const
+  {
+    ostringstream oss;
+    oss << "<FactBatchManager of type '" << type << "'>";
+    return oss.str();
+  }
+
+}
diff --git a/src/Core/FactBatchManager.hxx b/src/Core/FactBatchManager.hxx
new file mode 100644 (file)
index 0000000..dd36f7f
--- /dev/null
@@ -0,0 +1,64 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * FactBatchManager.hxx : 
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date   : Septembre 2004
+ * Projet : SALOME 2
+ *
+ */
+
+#ifndef _FACTBATCHMANAGER_H_
+#define _FACTBATCHMANAGER_H_
+
+#include <string>
+
+#include "Defines.hxx"
+#include "CommunicationProtocol.hxx"
+
+namespace Batch {
+  
+  class BatchManager;
+
+  class BATCH_EXPORT FactBatchManager
+  {
+  public:
+    // Constructeur et destructeur
+    FactBatchManager(const std::string & type);
+    virtual ~FactBatchManager();
+
+    virtual Batch::BatchManager * operator() (const char * hostname,
+                                              const char * username = "",
+                                              CommunicationProtocolType protocolType = SSH,
+                                              const char * mpi = "nompi") const = 0;
+    std::string getType() const;
+    std::string __repr__() const;
+
+  protected:
+    std::string type;
+
+  };
+
+}
+
+#endif
diff --git a/src/Core/GenericException.cxx b/src/Core/GenericException.cxx
new file mode 100644 (file)
index 0000000..5636488
--- /dev/null
@@ -0,0 +1,45 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * GenericException.cxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail   : mailto:ivan.dutka-malen@der.edf.fr
+ * Date   : Wed Nov 26 10:15:57 2003
+ * Projet : Salome 2
+ *
+ */
+
+#include <iostream>
+#include "GenericException.hxx"
+
+using namespace std;
+
+namespace Batch {
+
+// Operator for writing on a stream
+ostream & operator <<(ostream & os, const GenericException & e)
+{
+  return os << e.type << ": " << e.message;
+}
+
+}
diff --git a/src/Core/GenericException.hxx b/src/Core/GenericException.hxx
new file mode 100644 (file)
index 0000000..cbeaa93
--- /dev/null
@@ -0,0 +1,58 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * GenericException.hxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail   : mailto:ivan.dutka-malen@der.edf.fr
+ * Date   : Wed Nov 26 10:15:56 2003
+ * Projet : Salome 2
+ *
+ */
+
+#ifndef _GENERICEXCEPTION_H_
+#define _GENERICEXCEPTION_H_
+
+#include "Defines.hxx"
+
+
+#include <string>
+
+namespace Batch {
+
+  class BATCH_EXPORT GenericException
+  {
+  public:
+    const std::string type;    // la nature de l'exception
+    const std::string message; // la raison de l'exception
+
+               // Constructeur
+    GenericException(const std::string & tp = "GenericException",
+                     const std::string & ch = "undefined") : type(tp), message(ch) {}
+  };
+
+  // Operator for writing on a stream
+  BATCH_EXPORT std::ostream & operator <<(std::ostream & os, const GenericException & e);
+
+}
+
+#endif
diff --git a/src/Core/GenericType.cxx b/src/Core/GenericType.cxx
new file mode 100644 (file)
index 0000000..b8aa499
--- /dev/null
@@ -0,0 +1,65 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * GenericType.cxx : 
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date   : Septembre 2003
+ * Projet : SALOME 2
+ *
+ */
+
+
+#include <iostream>
+#include <string>
+#include <assert.h>
+#include "GenericType.hxx"
+using namespace std;
+
+namespace Batch {
+
+       // nombre total d'objet GenericType et al.
+       int GenericType::_nb = 0;
+
+       // Operateur pour l'affichage sur un stream
+  ostream & operator << (ostream & os, const GenericType & obj)
+  {
+    return os << obj.affiche();
+  }
+
+       // Conversion en chaine
+  string GenericType::affiche() const
+  {
+    return string("(GenericType : si ce message apparait, vous devez avoir un probleme)");
+  }
+
+       // Clone duplique l'objet et en fabrique un nouveau a l'aide de new
+       // qu'il faudra detruire ensuite manuellement
+  GenericType * GenericType::clone() const
+  {
+    GenericType * pG = new GenericType;
+    assert(pG != 0);
+    return pG;
+  }
+
+}
+
diff --git a/src/Core/GenericType.hxx b/src/Core/GenericType.hxx
new file mode 100644 (file)
index 0000000..2b3ede3
--- /dev/null
@@ -0,0 +1,72 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * GenericType.hxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date   : Septembre 2003
+ * Projet : SALOME 2
+ *
+ */
+
+#ifndef _GENERICTYPE_H_
+#define _GENERICTYPE_H_
+
+#include "Defines.hxx"
+
+
+#include <iostream>
+#include <string>
+
+namespace Batch {
+
+  class BATCH_EXPORT GenericType
+  {
+  public:
+               // Constructeur et destructeur
+    GenericType() { _nb++; }
+    virtual ~GenericType() { _nb--; }
+
+               // Operateur pour l'affichage sur un stream
+    BATCH_EXPORT friend std::ostream & operator << (std::ostream & os, const GenericType & obj);
+
+               // Conversion en chaine
+    virtual std::string affiche() const;
+
+               // Clone duplique l'objet et en fabrique un nouveau a l'aide de new
+               // qu'il faudra detruire ensuite manuellement
+    virtual GenericType * clone() const;
+
+               // Retourne le nombre d'objets GenericType et al.
+               static int getNb() { return _nb; }
+
+  protected:
+
+  private:
+               static int _nb; // nombre total d'objets GenericType et al.
+
+  };
+
+}
+
+#endif
+
diff --git a/src/Core/InvalidArgumentException.cxx b/src/Core/InvalidArgumentException.cxx
new file mode 100644 (file)
index 0000000..9e7534d
--- /dev/null
@@ -0,0 +1,37 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * InvalidArgumentException.cxx : 
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail   : mailto:ivan.dutka-malen@der.edf.fr
+ * Date   : Thu Oct 16 16:18:00 2003
+ * Projet : Salome 2
+ *
+ */
+
+#include "InvalidArgumentException.hxx"
+using namespace std;
+
+namespace Batch {
+
+}
diff --git a/src/Core/InvalidArgumentException.hxx b/src/Core/InvalidArgumentException.hxx
new file mode 100644 (file)
index 0000000..fd7d77c
--- /dev/null
@@ -0,0 +1,53 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * InvalidArgumentException.hxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail   : mailto:ivan.dutka-malen@der.edf.fr
+ * Date   : Thu Oct 16 16:18:00 2003
+ * Projet : Salome 2
+ *
+ */
+
+#ifndef _INVALIDARGUMENTEXCEPTION_H_
+#define _INVALIDARGUMENTEXCEPTION_H_
+
+
+#include "Defines.hxx"
+
+#include "GenericException.hxx"
+
+namespace Batch {
+
+  class BATCH_EXPORT InvalidArgumentException : public GenericException
+  {
+  public:
+       // Constructeur
+    InvalidArgumentException(const std::string & ch = "undefined")
+      : GenericException("InvalidArgumentException", ch) {}
+  };
+
+}
+
+#endif
+
diff --git a/src/Core/InvalidKeyException.cxx b/src/Core/InvalidKeyException.cxx
new file mode 100644 (file)
index 0000000..7e6f49a
--- /dev/null
@@ -0,0 +1,38 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * InvalidKeyException.cxx : 
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail   : mailto:ivan.dutka-malen@der.edf.fr
+ * Date   : Wed Oct 15 10:39:51 2003
+ * Projet : Salome 2
+ *
+ */
+
+#include "InvalidKeyException.hxx"
+using namespace std;
+
+namespace Batch {
+
+}
+
diff --git a/src/Core/InvalidKeyException.hxx b/src/Core/InvalidKeyException.hxx
new file mode 100644 (file)
index 0000000..d70466a
--- /dev/null
@@ -0,0 +1,57 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * InvalidKeyException.hxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail   : mailto:ivan.dutka-malen@der.edf.fr
+ * Date   : Wed Oct 15 10:39:51 2003
+ * Projet : Salome 2
+ *
+ */
+
+#ifndef _INVALIDKEYEXCEPTION_H_
+#define _INVALIDKEYEXCEPTION_H_
+
+#include "Defines.hxx"
+
+
+#include "GenericException.hxx"
+
+namespace Batch {
+
+  class BATCH_EXPORT InvalidKeyException : public GenericException
+  {
+  public:
+               // Constructeur
+    InvalidKeyException(std::string ch = "undefined") : GenericException("InvalidKeyException", ch) {}
+
+  protected:
+
+  private:
+
+  };
+
+}
+
+#endif
+
diff --git a/src/Core/Job.cxx b/src/Core/Job.cxx
new file mode 100644 (file)
index 0000000..f87a905
--- /dev/null
@@ -0,0 +1,117 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * Job.cxx : 
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date   : Septembre 2003
+ * Projet : SALOME 2
+ *
+ */
+
+#include "Job.hxx"
+#include "Parametre.hxx"
+#include <sstream>
+//#include "MEDMEM_STRING.hxx"
+using namespace std;
+
+namespace Batch {
+
+  // Constructeur
+  Job::Job() : _param(), _env()
+  {
+    // Nothing to do
+  }
+
+
+  // Constructeur
+  Job::Job(Parametre param) : _param(param), _env()
+  {
+    // Nothing to do
+  }
+
+
+  // Constructeur
+  Job::Job(Environnement env) : _param(), _env(env)
+  {
+    // Nothing to do
+  }
+
+
+  // Constructeur
+  Job::Job(Parametre param, Environnement env) : _param(param), _env(env)
+  {
+    // Nothing to do
+  }
+
+  // Operateur pour l'affichage sur un stream
+  ostream & operator <<(ostream & os, const Job & job)
+  {
+    return os << job.__str__();
+  }
+
+  // Accesseur
+  Batch::Parametre Job::getParametre() const
+  {
+    return _param;
+  }
+
+  // Accesseur
+  void Job::setParametre(const Batch::Parametre & param)
+  {
+    _param = param;
+  }
+
+  // Accesseur
+  Environnement Job::getEnvironnement() const
+  {
+    return _env;
+  }
+
+  // Accesseur
+  void Job::setEnvironnement(const Environnement & env)
+  {
+    _env = env;
+  }
+
+
+  // Methode pour l'interfacage avec Python (SWIG) : affichage en Python
+  string Job::__str__() const {
+    //MEDMEM::STRING str;
+    ostringstream str;
+    str << "<Job (" << this << ") :" << endl;
+    str << "  Parametre :" << endl;
+    Parametre::const_iterator itp;
+    for(itp=_param.begin(); itp!=_param.end(); itp++) {
+      str << "   * " << (*itp).first << " : " << (*itp).second << endl;
+    }
+    str << "  Environnement :" << endl;
+    Environnement::const_iterator ite;
+    for(ite=_env.begin(); ite!=_env.end(); ite++) {
+      str << "   * " << (*ite).first << " : " << (*ite).second << endl;
+    }
+    str << " >";
+    return str.str();
+  }
+
+
+}
diff --git a/src/Core/Job.hxx b/src/Core/Job.hxx
new file mode 100644 (file)
index 0000000..5433fdd
--- /dev/null
@@ -0,0 +1,78 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * Job.hxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date   : Septembre 2003
+ * Projet : SALOME 2
+ *
+ */
+
+#ifndef _JOB_H_
+#define _JOB_H_
+
+#include "Defines.hxx"
+
+
+#include "Parametre.hxx"
+#include "Environnement.hxx"
+
+namespace Batch {
+
+  class BATCH_EXPORT Job
+  {
+  public:
+    // Constructeurs et destructeur
+    Job();
+    Job(Batch::Parametre param);
+    Job(Batch::Environnement env);
+    Job(Batch::Parametre param, Batch::Environnement env);
+    virtual ~Job() {}
+
+    // Operateur pour l'affichage sur un stream
+    BATCH_EXPORT friend std::ostream & operator <<(std::ostream & os, const Job & job);
+
+    // Accesseurs
+    Batch::Parametre getParametre() const;
+    void setParametre(const Batch::Parametre &);
+
+    // Accesseurs
+    Batch::Environnement getEnvironnement() const;
+    void setEnvironnement(const Batch::Environnement &);
+
+    // Methodes pour l'interfacage avec Python (SWIG)
+    // TODO : supprimer ces methodes et transferer leur definitions dans SWIG
+    std::string  __str__() const; // SWIG : affichage en Python
+    std::string  __repr__() const { return __str__(); }; // SWIG : affichage en Python
+
+  protected:
+    Batch::Parametre _param; // table des parametres batch du job
+    Batch::Environnement _env; // table des variables d'environnement
+
+  private:
+
+  };
+
+}
+
+#endif
diff --git a/src/Core/JobId.cxx b/src/Core/JobId.cxx
new file mode 100644 (file)
index 0000000..c7a740c
--- /dev/null
@@ -0,0 +1,143 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * JobId.cxx : 
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date   : Septembre 2003
+ * Projet : SALOME 2
+ *
+ */
+
+#include "JobId.hxx"
+#include "BatchManager.hxx"
+#include <sstream>
+#include <assert.h>
+//#include "MEDMEM_STRING.hxx"
+using namespace std;
+
+namespace Batch {
+
+  // Constructeur standard
+  JobId::JobId() : _p_batchmanager(), _reference("undefined")
+  {
+    // Nothing to do
+  }
+
+  // Constructeur avec le pointeur sur le BatchManager associe et avec une reference
+  JobId::JobId(BatchManager * _p_bm, string ref) : _p_batchmanager(_p_bm), _reference(ref)
+  {
+    // Nothing to do
+  }
+
+  // Destructeur
+  JobId::~JobId()
+  {
+    // Nothing to do
+  }
+
+  // Operateur d'affectation entre objets
+  JobId & JobId::operator =(const JobId & jobid)
+  {
+    _p_batchmanager = jobid._p_batchmanager;
+    _reference      = jobid._reference;
+
+    return *this;
+  }
+
+  // Constructeur par recopie
+  JobId::JobId(const JobId & jobid) : _p_batchmanager(jobid._p_batchmanager), _reference(jobid._reference)
+  {
+    // Nothing to do
+  }
+
+  // Accesseur pour la reference interne
+  string JobId::getReference() const
+  {
+    return _reference;
+  }
+
+  // Permet de recharger un job depuis un fichier
+  void JobId::setReference(const std::string & new_reference)
+  {
+    _reference = new_reference;
+  }
+
+  // Methode pour le controle du job : retire le job du gestionnaire
+  void JobId::deleteJob() const
+  {
+    assert(_p_batchmanager != 0);
+    _p_batchmanager->deleteJob(*this);
+  }
+   
+  // Methode pour le controle du job : suspend le job en file d'attente
+  void JobId::holdJob() const
+  {
+    assert(_p_batchmanager != 0);
+    _p_batchmanager->holdJob(*this);
+  }
+
+  // Methode pour le controle du job : relache le job suspendu
+  void JobId::releaseJob() const
+  {
+    assert(_p_batchmanager != 0);
+    _p_batchmanager->releaseJob(*this);
+  }
+
+  // Methode pour le controle du job : modifie le job en file d'attente
+  void JobId::alterJob(const Parametre & param, const Environnement & env) const
+  {
+    assert(_p_batchmanager != 0);
+    _p_batchmanager->alterJob(*this, param, env);
+  }
+
+  // Methode pour le controle du job : modifie le job en file d'attente
+  void JobId::alterJob(const Parametre & param) const
+  {
+    assert(_p_batchmanager != 0);
+    _p_batchmanager->alterJob(*this, param);
+  }
+
+  // Methode pour le controle du job : modifie le job en file d'attente
+  void JobId::alterJob(const Environnement & env) const
+  {
+    assert(_p_batchmanager != 0);
+    _p_batchmanager->alterJob(*this, env);
+  }
+
+  // Methode pour le controle du job : renvoie l'etat du job
+  JobInfo JobId::queryJob() const
+  {
+    assert(_p_batchmanager != 0);
+    return _p_batchmanager->queryJob(*this);
+  }
+
+
+  // Methode pour l'interfacage avec Python (SWIG) : affichage en Python
+  string JobId::__str__() const {
+    //MEDMEM::STRING str;
+    ostringstream str;
+    str << "<JobId (" << this << ") : referenced '" << _reference << "'>";
+    return str.str();
+  }
+
+}
diff --git a/src/Core/JobId.hxx b/src/Core/JobId.hxx
new file mode 100644 (file)
index 0000000..ebbcc75
--- /dev/null
@@ -0,0 +1,94 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * JobId.hxx : 
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date   : Septembre 2003
+ * Projet : SALOME 2
+ *
+ */
+
+#ifndef _JOBID_H_
+#define _JOBID_H_
+
+
+#include "Defines.hxx"
+
+#include "JobInfo.hxx"
+#include "BatchManager.hxx"
+
+namespace Batch {
+
+  class BatchManager;
+
+  class BATCH_EXPORT JobId
+  {
+    friend class BatchManager;
+
+  public:
+    // Constructeur standard et destructeur
+    JobId();
+    virtual ~JobId();
+
+    // Constructeur avec le pointeur sur le BatchManager associe et avec une reference
+    JobId(Batch::BatchManager *, std::string ref);
+
+    // Operateur d'affectation entre objets
+    virtual JobId & operator =(const Batch::JobId &);
+
+    // Constructeur par recopie
+    JobId(const Batch::JobId &);
+
+    // Accesseur pour la reference interne
+    virtual std::string getReference() const;
+
+    // Permet de recharger un job depuis un fichier
+    virtual void setReference(const std::string & new_reference);
+
+    // Methodes pour le controle du job
+    virtual void deleteJob() const; // retire un job du gestionnaire
+    virtual void holdJob() const; // suspend un job en file d'attente
+    virtual void releaseJob() const; // relache un job suspendu
+    virtual void alterJob(const Batch::Parametre & param, const Batch::Environnement & env) const; // modifie un job en file d'attente
+    virtual void alterJob(const Batch::Parametre & param) const; // modifie un job en file d'attente
+    virtual void alterJob(const Batch::Environnement & env) const; // modifie un job en file d'attente
+    virtual void setParametre(const Batch::Parametre & param) { return alterJob(param); } // modifie un job en file d'attente
+    virtual void setEnvironnement(const Batch::Environnement & env) { return alterJob(env); } // modifie un job en file d'attente
+    virtual Batch::JobInfo queryJob() const; // renvoie l'etat du job
+
+    // Methodes pour l'interfacage avec Python (SWIG)
+    // TODO : supprimer ces methodes et transferer leur definitions dans SWIG
+    std::string  __str__() const; // SWIG : affichage en Python
+    std::string  __repr__() const { return __str__(); }; // SWIG : affichage en Python
+
+  protected:
+    Batch::BatchManager * _p_batchmanager; // pointeur sur le BatchManager qui controle le job
+    std::string _reference; // reference du job au sein du BatchManager
+
+  private:
+
+  };
+
+}
+
+#endif
diff --git a/src/Core/JobInfo.cxx b/src/Core/JobInfo.cxx
new file mode 100644 (file)
index 0000000..8353ecd
--- /dev/null
@@ -0,0 +1,97 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * JobInfo.cxx : 
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail   : mailto:ivan.dutka-malen@der.edf.fr
+ * Date   : Thu Nov  6 10:05:30 2003
+ * Projet : Salome 2
+ *
+ */
+
+#include <iostream>
+#include <string>
+#include <sstream>
+
+#include "Constants.hxx"
+#include "JobInfo.hxx"
+
+using namespace std;
+
+namespace Batch {
+
+  // Destructeur
+  JobInfo::~JobInfo()
+  {
+    // Nothing to do
+  }
+  
+
+  // Operateur pour l'affichage sur un stream
+  ostream & operator <<(ostream & os, const JobInfo & ji)
+  {
+    return os << ji.__str__();
+  }
+
+
+  // Methodes pour l'interfacage avec Python (SWIG) : affichage en Python
+  string JobInfo::__str__() const
+  {
+    //MEDMEM::STRING sst; 
+    ostringstream sst;
+    sst << "<JobInfo (" << this << ") :" << endl;
+    sst << " ID = " <<_param[ID] << endl;
+
+    sst << "  + Parametre :" << endl;
+    Parametre::const_iterator itp;
+    for(itp=_param.begin(); itp!=_param.end(); itp++) {
+      if ( (*itp).first != ID ) {
+       sst << "    * " << (*itp).first << " = " << (*itp).second << endl;
+      }
+    }
+
+    sst << "  + Environnement :" << endl;
+    Environnement::const_iterator ite;
+    for(ite=_env.begin(); ite!=_env.end(); ite++) {
+      sst << "    * " << (*ite).first << " = " << (*ite).second << endl;
+    }
+
+    sst << " >";
+
+    return sst.str();
+  }
+
+  // Accesseur
+  Parametre JobInfo::getParametre() const
+  {
+    return _param;
+  }
+
+  // Accesseur
+  Environnement JobInfo::getEnvironnement() const
+  {
+    return _env;
+  }
+
+
+}
diff --git a/src/Core/JobInfo.hxx b/src/Core/JobInfo.hxx
new file mode 100644 (file)
index 0000000..817c60e
--- /dev/null
@@ -0,0 +1,79 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * JobInfo.hxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail   : mailto:ivan.dutka-malen@der.edf.fr
+ * Date   : Thu Nov  6 10:05:30 2003
+ * Projet : Salome 2
+ *
+ */
+
+#ifndef _JOBINFO_H_
+#define _JOBINFO_H_
+
+#include "Defines.hxx"
+
+#include <iostream>
+#include <string>
+#include "Parametre.hxx"
+#include "Environnement.hxx"
+
+namespace Batch {
+
+  class BATCH_EXPORT JobInfo
+  {
+  public:
+    // Constructeur standard et destructeur
+    JobInfo() : _param(), _env() {};
+    virtual ~JobInfo();
+
+    // Constructeur par recopie
+    JobInfo(const JobInfo & jinfo) : _param(jinfo._param), _env(jinfo._env) {};
+
+    // Operateur pour l'affichage sur un stream
+    BATCH_EXPORT friend std::ostream & operator <<(std::ostream & os, const JobInfo & ji);
+
+    // Accesseurs
+    // _CS_gbo Ajout explicite du namespace pour les besoins de swig (mauvaise gestion
+    // des namespace par swig.
+    virtual Batch::Parametre getParametre() const;
+    virtual Batch::Environnement getEnvironnement() const;
+
+    // Methodes pour l'interfacage avec Python (SWIG)
+    // TODO : supprimer ces methodes et transferer leur definitions dans SWIG
+    std::string  __str__() const; // SWIG : affichage en Python
+    std::string  __repr__() const { return __str__(); }; // SWIG : affichage en Python
+
+  protected:
+    Parametre _param; // parametres du job
+    Environnement _env; // variables d'environnement du job
+    JobInfo(const Parametre & param, const Environnement & env) : _param(param), _env(env) {};
+
+  private:
+
+  };
+
+}
+
+#endif
diff --git a/src/Core/ListIsFullException.cxx b/src/Core/ListIsFullException.cxx
new file mode 100644 (file)
index 0000000..2b0cd56
--- /dev/null
@@ -0,0 +1,37 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * ListIsFullException.cxx : 
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date   : Septembre 2003
+ * Projet : SALOME 2
+ *
+ */
+
+#include "ListIsFullException.hxx"
+using namespace std;
+
+
+namespace Batch {
+
+}
diff --git a/src/Core/ListIsFullException.hxx b/src/Core/ListIsFullException.hxx
new file mode 100644 (file)
index 0000000..e1df097
--- /dev/null
@@ -0,0 +1,50 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * ListIsFullException.hxx : 
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date   : Septembre 2003
+ * Projet : SALOME 2
+ *
+ */
+
+#ifndef _LISTISFULLEXCEPTION_H_
+#define _LISTISFULLEXCEPTION_H_
+
+#include "Defines.hxx"
+
+#include "GenericException.hxx"
+
+namespace Batch {
+
+  class BATCH_EXPORT ListIsFullException : public GenericException
+  {
+  public:
+               // Constructeur
+    ListIsFullException(std::string ch = "undefined") : GenericException("ListIsFullException", ch) {}
+  };
+
+}
+
+#endif
+
diff --git a/src/Core/LongType.cxx b/src/Core/LongType.cxx
new file mode 100644 (file)
index 0000000..f600081
--- /dev/null
@@ -0,0 +1,71 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * LongType.cxx : 
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date   : Septembre 2003
+ * Projet : SALOME 2
+ *
+ */
+
+#include <string>
+#include <sstream>
+#include <assert.h>
+//#include "MEDMEM_STRING.hxx"
+#include "LongType.hxx"
+using namespace std;
+
+namespace Batch {
+
+       // Conversion en chaine
+  string LongType::affiche() const
+  {
+    //MEDMEM::STRING sst;
+    ostringstream sst;
+    sst << _data;
+    return sst.str();
+  }
+
+       // Operateur d'affectation
+  LongType & LongType::operator =(long l)
+  {
+    _data = l;
+    return *this;
+  }
+
+       // Conversion en long
+  LongType::operator long() const
+  {
+    return this->_data;
+  }
+
+       // Clone duplique l'objet et en fabrique un nouveau a l'aide de new
+       // qu'il faudra detruire ensuite manuellement
+  GenericType * LongType::clone() const
+  {
+    LongType * pL = new LongType(this->_data);
+    assert(pL != 0);
+    return pL;
+  }
+
+}
diff --git a/src/Core/LongType.hxx b/src/Core/LongType.hxx
new file mode 100644 (file)
index 0000000..dfdeccb
--- /dev/null
@@ -0,0 +1,69 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * LongType.hxx : 
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date   : Septembre 2003
+ * Projet : SALOME 2
+ *
+ */
+
+#ifndef _LONGTYPE_H_
+#define _LONGTYPE_H_
+
+#include "Defines.hxx"
+
+#include <string>
+#include "GenericType.hxx"
+
+namespace Batch {
+
+  class BATCH_EXPORT LongType : public GenericType
+  {
+  public:
+               // Constructeur
+    LongType(const long l=0L) : _data(l) {}
+
+               // Conversion en chaine
+    virtual std::string affiche() const;
+
+               // Operateur d'affectation
+    virtual LongType & operator =(long);
+
+               // Conversion en long
+    virtual operator long() const;
+
+               // Clone duplique l'objet et en fabrique un nouveau a l'aide de new
+               // qu'il faudra detruire ensuite manuellement
+    virtual GenericType * clone() const;
+
+  protected:
+    long _data;
+
+  private:
+
+  };
+
+}
+
+#endif
diff --git a/src/Core/MpiImpl.cxx b/src/Core/MpiImpl.cxx
new file mode 100644 (file)
index 0000000..a319861
--- /dev/null
@@ -0,0 +1,350 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include <iostream>
+#include <sstream>
+#include <string>
+#include "MpiImpl.hxx"
+
+using namespace std;
+
+// Constructor
+MpiImpl::MpiImpl()
+{
+}
+
+// Destructor
+MpiImpl::~MpiImpl()
+{
+}
+
+// lam implementation
+// Constructor
+MpiImpl_LAM::MpiImpl_LAM() : MpiImpl()
+{
+}
+
+// Destructor
+MpiImpl_LAM::~MpiImpl_LAM()
+{
+}
+
+string MpiImpl_LAM::size()
+{
+  return "${LAMWORLD}";
+}
+
+string MpiImpl_LAM::rank()
+{
+  return "${LAMRANK}";
+}
+
+string MpiImpl_LAM::boot(const string machinefile, const unsigned int nbnodes)
+{
+  ostringstream oss;
+  oss << "lamboot " << machinefile << endl;
+  return oss.str();
+}
+
+string MpiImpl_LAM::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute)
+{
+  ostringstream oss;
+  oss << "mpirun -np " << nbproc << " " << fileNameToExecute << endl;
+  return oss.str();
+}
+
+string MpiImpl_LAM::halt()
+{
+  ostringstream oss;
+  oss << "lamhalt" << endl;
+  return oss.str();
+}
+
+string MpiImpl_LAM::name()
+{
+  return "lam";
+}
+
+// mpich1 implementation
+// Constructor
+MpiImpl_MPICH1::MpiImpl_MPICH1() : MpiImpl()
+{
+}
+
+// Destructor
+MpiImpl_MPICH1::~MpiImpl_MPICH1()
+{
+}
+
+string MpiImpl_MPICH1::size()
+{
+  return "${MPIRUN_NPROCS}";
+}
+
+string MpiImpl_MPICH1::rank()
+{
+  return "${MPIRUN_RANK}";
+}
+
+string MpiImpl_MPICH1::boot(const string machinefile, const unsigned int nbnodes)
+{
+  return "";
+}
+
+string MpiImpl_MPICH1::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute)
+{
+  ostringstream oss;
+  oss << "mpirun -machinefile " << machinefile << " -np " << nbproc << " " << fileNameToExecute << endl;
+  return oss.str();
+}
+
+string MpiImpl_MPICH1::halt()
+{
+  return "";
+}
+
+string MpiImpl_MPICH1::name()
+{
+  return "mpich";
+}
+
+// mpich2 implementation
+// Constructor
+MpiImpl_MPICH2::MpiImpl_MPICH2() : MpiImpl()
+{
+}
+
+// Destructor
+MpiImpl_MPICH2::~MpiImpl_MPICH2()
+{
+}
+
+string MpiImpl_MPICH2::size()
+{
+  return "${PMI_SIZE}";
+}
+
+string MpiImpl_MPICH2::rank()
+{
+  return "${PMI_RANK}";
+}
+
+string MpiImpl_MPICH2::boot(const string machinefile, const unsigned int nbnodes)
+{
+  ostringstream oss;
+  oss << "mpdboot" << " -n " << nbnodes;
+  if (machinefile!="")
+    oss  << " -f " << machinefile;
+  oss << endl;
+  return oss.str();
+}
+
+string MpiImpl_MPICH2::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute)
+{
+  ostringstream oss;
+  oss << "mpirun -np " << nbproc << " " << fileNameToExecute << endl;
+  return oss.str();
+}
+
+string MpiImpl_MPICH2::halt()
+{
+  ostringstream oss;
+  oss << "mpdallexit" << endl;
+  return oss.str();
+}
+
+string MpiImpl_MPICH2::name()
+{
+  return "mpich";
+}
+
+// openmpi implementation
+// Constructor
+MpiImpl_OPENMPI::MpiImpl_OPENMPI() : MpiImpl()
+{
+}
+
+// Destructor
+MpiImpl_OPENMPI::~MpiImpl_OPENMPI()
+{
+}
+
+string MpiImpl_OPENMPI::size()
+{
+  return "${OMPI_MCA_ns_nds_num_procs}";
+}
+
+string MpiImpl_OPENMPI::rank()
+{
+  return "${OMPI_MCA_ns_nds_vpid}";
+}
+
+string MpiImpl_OPENMPI::boot(const string machinefile, const unsigned int nbnodes)
+{
+  return "";
+}
+
+string MpiImpl_OPENMPI::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute)
+{
+  ostringstream oss;
+  oss << "mpirun -hostfile " << machinefile << " -np " << nbproc << " " << fileNameToExecute << endl;
+  return oss.str();
+}
+
+string MpiImpl_OPENMPI::halt()
+{
+  return "";
+}
+
+string MpiImpl_OPENMPI::name()
+{
+  return "openmpi";
+}
+
+// ompi implementation
+// Constructor
+MpiImpl_OMPI::MpiImpl_OMPI() : MpiImpl()
+{
+}
+
+// Destructor
+MpiImpl_OMPI::~MpiImpl_OMPI()
+{
+}
+
+string MpiImpl_OMPI::size()
+{
+  return "${OMPI_MCA_ns_nds_num_procs}";
+}
+
+string MpiImpl_OMPI::rank()
+{
+  return "${OMPI_MCA_ns_nds_vpid}";
+}
+
+string MpiImpl_OMPI::boot(const string machinefile, const unsigned int nbnodes)
+{
+  return "";
+}
+
+string MpiImpl_OMPI::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute)
+{
+  ostringstream oss;
+  oss << "mpirun -hostfile " << machinefile << " -np " << nbproc << " " << fileNameToExecute << endl;
+  return oss.str();
+}
+
+string MpiImpl_OMPI::halt()
+{
+  return "";
+}
+
+string MpiImpl_OMPI::name()
+{
+  return "ompi";
+}
+
+// slurm implementation
+// Constructor
+MpiImpl_SLURM::MpiImpl_SLURM() : MpiImpl()
+{
+}
+
+// Destructor
+MpiImpl_SLURM::~MpiImpl_SLURM()
+{
+}
+
+string MpiImpl_SLURM::size()
+{
+  return "${SLURM_NPROCS}";
+}
+
+string MpiImpl_SLURM::rank()
+{
+  return "${SLURM_PROCID}";
+}
+
+string MpiImpl_SLURM::boot(const string machinefile, const unsigned int nbnodes)
+{
+  return "";
+}
+
+string MpiImpl_SLURM::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute)
+{
+  ostringstream oss;
+  oss << "srun " << fileNameToExecute << endl;
+  return oss.str();
+}
+
+string MpiImpl_SLURM::halt()
+{
+  return "";
+}
+
+string MpiImpl_SLURM::name()
+{
+  return "slurm";
+}
+
+// prun implementation
+// Constructor
+MpiImpl_PRUN::MpiImpl_PRUN() : MpiImpl()
+{
+}
+
+// Destructor
+MpiImpl_PRUN::~MpiImpl_PRUN()
+{
+}
+
+string MpiImpl_PRUN::size()
+{
+  return "${RMS_NPROCS}";
+}
+
+string MpiImpl_PRUN::rank()
+{
+  return "${RMS_RANK}";
+}
+
+string MpiImpl_PRUN::boot(const string machinefile, const unsigned int nbnodes)
+{
+  return "";
+}
+
+string MpiImpl_PRUN::run(const string machinefile, const unsigned int nbproc, const string fileNameToExecute)
+{
+  ostringstream oss;
+  oss << "prun -n " << nbproc << " " << "-p mpi " << fileNameToExecute << endl;
+  return oss.str();
+}
+
+string MpiImpl_PRUN::halt()
+{
+  return "";
+}
+
+string MpiImpl_PRUN::name()
+{
+  return "prun";
+}
diff --git a/src/Core/MpiImpl.hxx b/src/Core/MpiImpl.hxx
new file mode 100644 (file)
index 0000000..a1345d8
--- /dev/null
@@ -0,0 +1,197 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef _BL_MPIIMPL_H_
+#define _BL_MPIIMPL_H_
+
+#include "Defines.hxx"
+#include <string>
+
+class BATCH_EXPORT MpiImplException
+{
+public:
+  const std::string msg;
+  
+  MpiImplException(const std::string m) : msg(m) {}
+};
+
+class BATCH_EXPORT MpiImpl
+{
+public:
+  // Constructeur et destructeur
+  MpiImpl(); // constrcuctor
+  virtual ~MpiImpl(); //Destructor
+  
+  virtual std::string size() = 0; // get number of process of current job
+  virtual std::string rank() = 0; // get process number of current job
+  virtual std::string boot(const std::string machinefile, const unsigned int nbnodes) = 0; // get boot command
+  virtual std::string run(const std::string machinefile, const unsigned int nbproc, const std::string fileNameToExecute) = 0; // get run command
+  virtual std::string halt() = 0; // get stop command
+  virtual std::string name() = 0; // name of mpi implementation
+
+protected:
+
+private:
+
+};
+
+class BATCH_EXPORT MpiImpl_LAM : public MpiImpl
+{
+public:
+  // Constructeur et destructeur
+  MpiImpl_LAM(); // constructor
+  virtual ~MpiImpl_LAM(); //Destructor
+
+  std::string size(); // get number of process of current job
+  std::string rank(); // get process number of current job
+  std::string boot( const std::string machinefile, const unsigned int nbnodes); // get boot command
+  std::string run( const std::string machinefile, const unsigned int nbproc, const std::string fileNameToExecute); // get run command
+  std::string halt(); // get stop command
+  std::string name(); // name of mpi implementation
+
+protected:
+  
+private:
+
+};
+
+class BATCH_EXPORT MpiImpl_MPICH1 : public MpiImpl
+{
+public:
+  // Constructeur et destructeur
+  MpiImpl_MPICH1(); // constructor
+  virtual ~MpiImpl_MPICH1(); //Destructor
+  
+  std::string size(); // get number of process of current job
+  std::string rank(); // get process number of current job
+  std::string boot( const std::string machinefile, const unsigned int nbnodes); // get boot command
+  std::string run( const std::string machinefile, const unsigned int nbproc, const std::string fileNameToExecute); // get run command
+  std::string halt(); // get stop command
+  std::string name(); // name of mpi implementation
+
+protected:
+  
+private:
+
+};
+
+class BATCH_EXPORT MpiImpl_MPICH2 : public MpiImpl
+{
+public:
+  // Constructeur et destructeur
+  MpiImpl_MPICH2(); // constructor
+  virtual ~MpiImpl_MPICH2(); //Destructor
+
+  std::string size(); // get number of process of current job
+  std::string rank(); // get process number of current job
+  std::string boot( const std::string machinefile, const unsigned int nbnodes); // get boot command
+  std::string run( const std::string machinefile, const unsigned int nbproc, const std::string fileNameToExecute); // get run command
+  std::string halt(); // get stop command
+  std::string name(); // name of mpi implementation
+
+protected:
+
+private:
+
+};
+
+class BATCH_EXPORT MpiImpl_OPENMPI : public MpiImpl
+{
+public:
+  // Constructeur et destructeur
+  MpiImpl_OPENMPI(); // constructor
+  virtual ~MpiImpl_OPENMPI(); //Destructor
+
+  std::string size(); // get number of process of current job
+  std::string rank(); // get process number of current job
+  std::string boot( const std::string machinefile, const unsigned int nbnodes); // get boot command
+  std::string run( const std::string machinefile, const unsigned int nbproc, const std::string fileNameToExecute); // get run command
+  std::string halt(); // get stop command
+  std::string name(); // name of mpi implementation
+
+protected:
+
+private:
+
+};
+
+class BATCH_EXPORT MpiImpl_OMPI : public MpiImpl
+{
+public:
+  // Constructeur et destructeur
+  MpiImpl_OMPI(); // constructor
+  virtual ~MpiImpl_OMPI(); //Destructor
+
+  std::string size(); // get number of process of current job
+  std::string rank(); // get process number of current job
+  std::string boot( const std::string machinefile, const unsigned int nbnodes); // get boot command
+  std::string run( const std::string machinefile, const unsigned int nbproc, const std::string fileNameToExecute); // get run command
+  std::string halt(); // get stop command
+  std::string name(); // name of mpi implementation
+
+protected:
+
+private:
+
+};
+
+class BATCH_EXPORT MpiImpl_SLURM : public MpiImpl
+{
+public:
+  // Constructeur et destructeur
+  MpiImpl_SLURM(); // constructor
+  virtual ~MpiImpl_SLURM(); //Destructor
+
+  std::string size(); // get number of process of current job
+  std::string rank(); // get process number of current job
+  std::string boot( const std::string machinefile, const unsigned int nbnodes); // get boot command
+  std::string run( const std::string machinefile, const unsigned int nbproc, const std::string fileNameToExecute); // get run command
+  std::string halt(); // get stop command
+  std::string name(); // name of mpi implementation
+
+protected:
+
+private:
+
+};
+
+class BATCH_EXPORT MpiImpl_PRUN : public MpiImpl
+{
+public:
+  // Constructeur et destructeur
+  MpiImpl_PRUN(); // constructor
+  virtual ~MpiImpl_PRUN(); //Destructor
+
+  std::string size(); // get number of process of current job
+  std::string rank(); // get process number of current job
+  std::string boot( const std::string machinefile, const unsigned int nbnodes); // get boot command
+  std::string run( const std::string machinefile, const unsigned int nbproc, const std::string fileNameToExecute); // get run command
+  std::string halt(); // get stop command
+  std::string name(); // name of mpi implementation
+
+protected:
+
+private:
+
+};
+
+#endif
diff --git a/src/Core/NotYetImplementedException.cxx b/src/Core/NotYetImplementedException.cxx
new file mode 100644 (file)
index 0000000..a4e38c9
--- /dev/null
@@ -0,0 +1,37 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * NotYetImplementedException.cxx : 
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail   : mailto:ivan.dutka-malen@der.edf.fr
+ * Date   : Tue Nov 25 11:35:07 2003
+ * Projet : Salome 2
+ *
+ */
+
+#include "NotYetImplementedException.hxx"
+
+namespace Batch {
+
+}
+
diff --git a/src/Core/NotYetImplementedException.hxx b/src/Core/NotYetImplementedException.hxx
new file mode 100644 (file)
index 0000000..42001da
--- /dev/null
@@ -0,0 +1,52 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * NotYetImplementedException.hxx : 
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail   : mailto:ivan.dutka-malen@der.edf.fr
+ * Date   : Tue Nov 25 11:35:07 2003
+ * Projet : Salome 2
+ *
+ */
+
+#ifndef _NOTYETIMPLEMENTEDEXCEPTION_H_
+#define _NOTYETIMPLEMENTEDEXCEPTION_H_
+
+#include "Defines.hxx"
+#include "GenericException.hxx"
+
+#include <string>
+
+namespace Batch {
+
+  class BATCH_EXPORT NotYetImplementedException : public GenericException
+  {
+  public:
+               // Constructeur
+    NotYetImplementedException(std::string ch = "undefined") : GenericException("NotYetImplementedException", ch) {}
+  };
+
+}
+
+#endif
+
diff --git a/src/Core/ParameterTypeMap.cxx b/src/Core/ParameterTypeMap.cxx
new file mode 100644 (file)
index 0000000..60080da
--- /dev/null
@@ -0,0 +1,103 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * ParameterTypeMap.cxx :
+ *
+ * Auteur : Renaud Barate - EDF R&D
+ * Date   : Mars 2011
+ *
+ */
+
+#include <string>
+#include <map>
+
+#include "Constants.hxx"
+#include "InvalidKeyException.hxx"
+#include "ParameterTypeMap.hxx"
+
+using namespace std;
+
+namespace Batch {
+
+  /*!
+   * The values of this type map contain the type of the parameters and the maximum
+   * number of items in the corresponding Versatile object (0 means any number).
+   */
+  ParameterTypeMap::ParameterTypeMap()
+  {
+    // Don't use the string constants in this constructor because they might be uninitialized
+    addParameter("ARGUMENTS", STRING, 0);
+    addParameter("EXECUTABLE", STRING, 1);
+    addParameter("ID", STRING, 1);
+    addParameter("INFILE", COUPLE, 0);
+    addParameter("MAXCPUTIME", LONG, 1);
+    addParameter("MAXDISKSIZE", LONG, 1);
+    addParameter("MAXRAMSIZE", LONG, 1);
+    addParameter("MAXWALLTIME", LONG, 1);
+    addParameter("NAME", STRING, 1);
+    addParameter("NBPROC", LONG, 1);
+    addParameter("NBPROCPERNODE", LONG, 1);
+    addParameter("OUTFILE", COUPLE, 0);
+    addParameter("PID", LONG, 1);
+    addParameter("QUEUE", STRING, 1);
+    addParameter("STATE", STRING, 1);
+    addParameter("USER", STRING, 1);
+    addParameter("WORKDIR", STRING, 1);
+    addParameter("HOMEDIR", STRING, 1);
+    addParameter("EXCLUSIVE", BOOL, 1);
+  }
+
+  ParameterTypeMap::~ParameterTypeMap()
+  {
+  }
+
+  /*!
+   * Returns the ParameterTypeMap singleton.
+   * We use the construct-on-first-use idiom here because otherwise there could be a problem with
+   * the initialization order between the factory singletons and this type map. Note that since the
+   * destructors do not depend on the other objects, the order is not important for destruction.
+   */
+  ParameterTypeMap& ParameterTypeMap::getInstance () {
+    static ParameterTypeMap instance;
+    return instance;
+  }
+
+  bool ParameterTypeMap::hasKey(const string & key) const
+  {
+    return (_map.find(key) != _map.end());
+  }
+
+  void ParameterTypeMap::addParameter(const std::string & key, DiscriminatorType type, int maxelem)
+  {
+    if (hasKey(key)) throw InvalidKeyException(key + " is already present in type map");
+    _map[key].type = type;
+    _map[key].maxelem = maxelem;
+  }
+
+  Versatile ParameterTypeMap::createVersatile(const std::string & parameterName)
+  {
+    map<string, ParameterType>::const_iterator it = _map.find(parameterName);
+    if (it == _map.end()) throw InvalidKeyException(parameterName);
+    return Versatile(it->second.type, it->second.maxelem, parameterName);
+  }
+
+}
diff --git a/src/Core/ParameterTypeMap.hxx b/src/Core/ParameterTypeMap.hxx
new file mode 100644 (file)
index 0000000..5854741
--- /dev/null
@@ -0,0 +1,77 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * ParameterTypeMap.hxx :
+ *
+ * Auteur : Renaud Barate - EDF R&D
+ * Date   : Mars 2011
+ *
+ */
+
+#ifndef _PARAMETERTYPEMAP_H_
+#define _PARAMETERTYPEMAP_H_
+
+#include "Defines.hxx"
+#include "Versatile.hxx"
+
+#include <string>
+#include <map>
+
+namespace Batch {
+
+  typedef struct {
+    DiscriminatorType type;
+    int maxelem;
+  } ParameterType;
+
+
+  /*!
+   * This class is used to control the type of the values associated with a parameter.
+   * It's a singleton that can be get only through the static method getInstance().
+   */
+  class BATCH_EXPORT ParameterTypeMap
+  {
+  public:
+    static ParameterTypeMap& getInstance();
+
+    bool hasKey(const std::string & key) const;
+    void addParameter(const std::string & key, DiscriminatorType type, int maxelem);
+    Versatile createVersatile(const std::string & parameterName);
+
+  protected:
+
+    ParameterTypeMap();
+    virtual ~ParameterTypeMap();
+
+    std::map<std::string, ParameterType> _map;
+
+  private:
+
+    // Forbid the use of copy constructor and assignment operator
+    ParameterTypeMap(const ParameterTypeMap & orig) {}
+    void operator=(const ParameterTypeMap & orig) {}
+
+  };
+
+}
+
+#endif
diff --git a/src/Core/Parametre.cxx b/src/Core/Parametre.cxx
new file mode 100644 (file)
index 0000000..5336981
--- /dev/null
@@ -0,0 +1,104 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * Parametre.cxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date   : Septembre 2003
+ * Projet : SALOME 2
+ *
+ */
+
+#include "Versatile.hxx"
+#include "InvalidKeyException.hxx"
+#include "ParameterTypeMap.hxx"
+#include "Parametre.hxx"
+
+using namespace std;
+
+namespace Batch {
+
+  // Constructeur standard
+  Parametre::Parametre() : map< string, Versatile >()
+  {
+  }
+
+  // Operateur de recherche dans la map
+  // Cet operateur agit sur les objets NON CONSTANTS, il autorise la modification de
+  // la valeur associée Ã  la clef car il retourne une reference non constante
+  Versatile & Parametre::operator [] (const string & mk)
+  {
+    // On controle que la clef est valide
+    if (!ParameterTypeMap::getInstance().hasKey(mk)) throw InvalidKeyException(mk);
+
+    Parametre::iterator it = find(mk);
+    if (it != end()) {
+      return it->second;
+    } else {
+      Versatile V = ParameterTypeMap::getInstance().createVersatile(mk);
+      pair<iterator, bool> result = insert(make_pair(mk, V));
+      return result.first->second;
+    }
+  }
+
+  // Operateur de recherche dans la map
+  // Cet operateur agit sur les objets CONSTANTS
+  const Versatile & Parametre::operator [] (const string & mk) const
+  {
+    // On controle que la clef est valide
+    if (!ParameterTypeMap::getInstance().hasKey(mk)) throw InvalidKeyException(mk);
+
+    // On recherche la valeur associee
+    Parametre::const_iterator it = find(mk);
+    if (it == end()) throw InvalidKeyException(mk);
+    const Versatile & V = (*it).second;
+
+    return V;
+  }
+
+  // Operateur d'affectation
+  Parametre & Parametre::operator =(const Parametre & PM)
+  {
+    // On ne reaffecte pas l'objet a lui-meme, sinon aie, aie, aie
+    if (this == &PM) return *this;
+
+    // On efface toute la map
+    erase(begin(), end());
+
+    // On recree la structure interne de la map avec les valeurs de celle passee en argument
+    Parametre::const_iterator it;
+    for(it=PM.begin(); it!=PM.end(); it++)
+      insert(make_pair((*it).first, Versatile((*it).second)));
+
+    return *this;
+  }
+
+  // Constructeur par recopie
+  Parametre::Parametre(const Parametre & PM) : map< string, Versatile >()
+  {
+    // On cree la structure interne de la map avec les valeurs de celle passee en argument
+    Parametre::const_iterator it;
+    for(it=PM.begin(); it!=PM.end(); it++)
+      insert(make_pair((*it).first, Versatile((*it).second)));
+  }
+
+}
diff --git a/src/Core/Parametre.hxx b/src/Core/Parametre.hxx
new file mode 100644 (file)
index 0000000..574d366
--- /dev/null
@@ -0,0 +1,62 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * Parametre.hxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date   : Septembre 2003
+ * Projet : SALOME 2
+ *
+ */
+
+#ifndef _PARAMETRE_H_
+#define _PARAMETRE_H_
+
+#include <map>
+#include <string>
+
+#include "Defines.hxx"
+#include "Versatile.hxx"
+
+namespace Batch {
+
+  class BATCH_EXPORT Parametre : public std::map< std::string, Versatile >
+  {
+  public:
+    // Constructeur standard
+    Parametre();
+
+    // Constructeur par recopie
+    Parametre(const Parametre & PM);
+
+    // Operateur de recherche dans la map
+    Versatile & operator [] (const std::string &);
+    const Versatile & operator [] (const std::string &) const;
+
+    // Operateur d'affectation
+    Parametre & operator =(const Parametre & PM);
+
+  };
+
+}
+
+#endif
diff --git a/src/Core/RunTimeException.cxx b/src/Core/RunTimeException.cxx
new file mode 100644 (file)
index 0000000..22100e4
--- /dev/null
@@ -0,0 +1,37 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * RunTimeException.cxx : 
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail   : mailto:ivan.dutka-malen@der.edf.fr
+ * Date   : Tue Nov 25 14:04:13 2003
+ * Projet : Salome 2
+ *
+ */
+
+#include "RunTimeException.hxx"
+using namespace std;
+
+namespace Batch {
+
+}
diff --git a/src/Core/RunTimeException.hxx b/src/Core/RunTimeException.hxx
new file mode 100644 (file)
index 0000000..c792517
--- /dev/null
@@ -0,0 +1,51 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * RunTimeException.hxx : 
+ *
+ * Auteur : %author% - EDF R&D
+ * Mail   : mailto:ivan.dutka-malen@der.edf.fr
+ * Date   : Tue Nov 25 14:04:13 2003
+ * Projet : Salome 2
+ *
+ */
+
+#ifndef _RUNTIMEEXCEPTION_H_
+#define _RUNTIMEEXCEPTION_H_
+
+#include "Defines.hxx"
+
+
+#include "GenericException.hxx"
+
+namespace Batch {
+
+  class BATCH_EXPORT RunTimeException : public GenericException
+  {
+  public:
+               // Constructeur
+    RunTimeException(std::string ch = "undefined") : GenericException("RunTimeException", ch) {}
+  };
+
+}
+
+#endif
diff --git a/src/Core/StringType.cxx b/src/Core/StringType.cxx
new file mode 100644 (file)
index 0000000..e762037
--- /dev/null
@@ -0,0 +1,66 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * StringType.cxx : 
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date   : Septembre 2003
+ * Projet : SALOME 2
+ *
+ */
+
+#include <string>
+#include <assert.h>
+#include "StringType.hxx"
+using namespace std;
+
+namespace Batch {
+
+       // Conversion en chaine
+  string StringType::affiche() const
+  {
+    return _data;
+  }
+
+       // Operateur d'affectation
+       StringType & StringType::operator =(string s)
+  {
+    _data = s;
+    return *this;
+  }
+
+       // Conversion en chaine
+  StringType::operator string() const
+  {
+    return this->_data;
+  }
+
+       // Clone duplique l'objet et en fabrique un nouveau a l'aide de new
+       // qu'il faudra detruire ensuite manuellement
+  GenericType * StringType::clone() const
+  {
+    StringType * pS = new StringType(this->_data);
+    assert(pS != 0);
+    return pS;
+  }
+
+}
diff --git a/src/Core/StringType.hxx b/src/Core/StringType.hxx
new file mode 100644 (file)
index 0000000..4e75778
--- /dev/null
@@ -0,0 +1,67 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * StringType.hxx : 
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date   : Septembre 2003
+ * Projet : SALOME 2
+ *
+ */
+
+#ifndef _STRINGTYPE_H_
+#define _STRINGTYPE_H_
+
+#include "Defines.hxx"
+
+#include <string>
+#include "GenericType.hxx"
+
+namespace Batch {
+
+  class BATCH_EXPORT StringType : public GenericType
+  {
+  public:
+               // Constructeur
+    StringType(const std::string & s="")  : _data(s) {}
+
+               // Conversion en chaine
+    virtual std::string affiche() const;
+    virtual operator std::string() const;
+
+               // Operateur d'affectation
+    virtual StringType & operator =(std::string);
+
+               // Clone duplique l'objet et en fabrique un nouveau a l'aide de new
+               // qu'il faudra detruire ensuite manuellement
+    virtual GenericType * clone() const;
+
+  protected:
+    std::string _data;
+
+  private:
+
+  };
+
+}
+
+#endif
index 2bac0b3d36cc0915b0177c38abacaff390531eee..feb093373f31408a94521c578ed0c16337d55b66 100644 (file)
 #include <fstream>
 #include <cstring>
 
-#include <Batch_Constants.hxx>
-#include <Batch_Job.hxx>
-#include <Batch_BatchManagerCatalog.hxx>
-#include <Batch_FactBatchManager.hxx>
-#include <Batch_BatchManager.hxx>
+#include <Constants.hxx>
+#include <Job.hxx>
+#include <BatchManagerCatalog.hxx>
+#include <FactBatchManager.hxx>
+#include <BatchManager.hxx>
 
 #include "SimpleParser.hxx"
 
diff --git a/src/Core/TypeMismatchException.cxx b/src/Core/TypeMismatchException.cxx
new file mode 100644 (file)
index 0000000..904fbc5
--- /dev/null
@@ -0,0 +1,36 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * TypeMismatchException.cxx : 
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date   : Septembre 2003
+ * Projet : SALOME 2
+ *
+ */
+
+#include "TypeMismatchException.hxx"
+using namespace std;
+
+namespace Batch {
+
+}
diff --git a/src/Core/TypeMismatchException.hxx b/src/Core/TypeMismatchException.hxx
new file mode 100644 (file)
index 0000000..de84fdb
--- /dev/null
@@ -0,0 +1,51 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * TypeMismatchException.hxx : 
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date   : Septembre 2003
+ * Projet : SALOME 2
+ *
+ */
+
+#ifndef _TYPEMISMATCHEXCEPTION_H_
+#define _TYPEMISMATCHEXCEPTION_H_
+
+#include "Defines.hxx"
+
+
+#include "GenericException.hxx"
+
+namespace Batch {
+
+  class BATCH_EXPORT TypeMismatchException : public GenericException
+  {
+  public:
+               // Constructeur
+    TypeMismatchException(std::string ch = "undefined") : GenericException("TypeMismatchException", ch) {}
+  };
+
+}
+
+#endif
+
diff --git a/src/Core/Utils.cxx b/src/Core/Utils.cxx
new file mode 100644 (file)
index 0000000..a75a90e
--- /dev/null
@@ -0,0 +1,128 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * Utils.cxx
+ *
+ *  Created on: 30 jan. 2012
+ *  Author : Renaud BARATE - EDF R&D
+ */
+
+#include <cstdlib>
+#include <cstdio>
+#include <unistd.h>
+#include <iostream>
+#include <fstream>
+
+#include <config.h>
+#include "Utils.hxx"
+#include "RunTimeException.hxx"
+
+#ifdef MSVC
+#define popen _popen
+#define pclose _pclose
+#endif
+
+using namespace std;
+namespace Batch {
+
+int Utils::getCommandOutput(const string & command, string & output)
+{
+  // Reinitialize output
+  output = "";
+
+  // Call command
+  FILE * fp = popen(command.c_str(), "r");
+  if (fp == NULL) {
+    return -1;
+  }
+
+  // Read the output and store it
+  char buf[1024];
+  while (fgets(buf, sizeof(buf), fp) != NULL) {
+    output += buf;
+  }
+
+  // close and get status
+  int status = pclose(fp);
+  return status;
+}
+
+bool Utils::isAbsolutePath(const string & path)
+{
+  if (path.size() == 0)
+    return false;
+  return path[0] == '/';
+}
+
+string Utils::createAndOpenTemporaryFile(const string & prefix, ofstream & outputStream)
+{
+  if (outputStream.is_open())
+    outputStream.close();
+
+  // Find directory for temporary files
+  const char * tmpDirName = getenv("TEMP");
+  if (tmpDirName == NULL) tmpDirName = getenv("TMP");
+  if (tmpDirName == NULL) tmpDirName = getenv("TEMPDIR");
+  if (tmpDirName == NULL) tmpDirName = getenv("TMPDIR");
+  if (tmpDirName == NULL) tmpDirName = "/tmp";
+
+  string fileName = (string)tmpDirName + "/libbatch-" + prefix + "-XXXXXX";
+
+#ifdef WIN32
+
+  char randstr[7];
+  srand(time(NULL));
+
+  do {
+    sprintf(randstr, "%06d", rand() % 1000000);
+    fileName.replace(fileName.size()-6, 6, randstr);
+  } while (EXISTS(fileName.c_str()));
+
+  // Open the file as binary to avoid problems with Windows newlines
+  outputStream.open(fileName.c_str(), ios_base::binary | ios_base::out);
+
+#else
+
+  char * buf = new char[fileName.size()+1];
+  fileName.copy(buf, fileName.size());
+  buf[fileName.size()] = '\0';
+
+  int fd = mkstemp(buf);
+  if (fd == -1) {
+    delete[] buf;
+    throw RunTimeException(string("Can't create temporary file ") + fileName);
+  }
+  fileName = buf;
+  delete[] buf;
+
+  outputStream.open(fileName.c_str());
+  close(fd);  // Close the file descriptor so that the file is not opened twice
+
+#endif
+
+  if (outputStream.fail())
+    throw RunTimeException(string("Can't open temporary file ") + fileName);
+
+  return fileName;
+}
+
+}
diff --git a/src/Core/Utils.hxx b/src/Core/Utils.hxx
new file mode 100644 (file)
index 0000000..0c6f515
--- /dev/null
@@ -0,0 +1,75 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * Utils.hxx
+ *
+ *  Created on: 30 jan. 2012
+ *  Author : Renaud BARATE - EDF R&D
+ */
+
+#ifndef BATCH_UTILS_HXX_
+#define BATCH_UTILS_HXX_
+
+#include <string>
+
+namespace Batch {
+
+class Utils {
+public:
+
+  /**
+   * Call a command with the system shell and stores its output in parameter "output".
+   * Returns the return code of the command.
+   */
+  static int getCommandOutput(const std::string & command, std::string & output);
+
+  /**
+   * Test if the path in parameter is an absolute path (does not test the existence of
+   * a file or directory at this path).
+   */
+  static bool isAbsolutePath(const std::string & path);
+
+  /**
+   * Create a temporary file and open an output stream to write into this file.
+   * The file is created with the pattern "<tmpdir>/libbatch-<prefix>-XXXXXX" where <tmpdir> is the
+   * directory for temporary files and the X's are replaced by random characters. The caller is
+   * responsible for closing and deleting the file when it is no more used.
+   * <tmpdir> is found by looking for environment variables TEMP, TMP, TEMPDIR, TMPDIR, and defaults
+   * to "/tmp" if none of them is defined.
+   * \param prefix the prefix to use for the temporary file.
+   * \param outputStream an output stream that will be opened for writing in the temporary file. If
+   * the stream is already open, it will be closed first.
+   * \return the name of the created file.
+   */
+  static std::string createAndOpenTemporaryFile(const std::string & prefix,
+                                                std::ofstream & outputStream);
+
+private:
+
+  // No instanciation possible as this class provides only static methods
+  Utils() { }
+
+};
+
+}
+
+#endif /* BATCH_UTILS_HXX_ */
diff --git a/src/Core/Versatile.cxx b/src/Core/Versatile.cxx
new file mode 100644 (file)
index 0000000..06bfbad
--- /dev/null
@@ -0,0 +1,271 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * Versatile.cxx : 
+ *
+ * Author : Ivan DUTKA-MALEN - EDF R&D
+ * Date   : September 2003
+ *
+ */
+
+#include <iostream>
+#include <list>
+#include <string>
+#include <sstream>
+
+#include "GenericType.hxx"
+#include "BoolType.hxx"
+#include "LongType.hxx"
+#include "StringType.hxx"
+#include "Versatile.hxx"
+#include "TypeMismatchException.hxx"
+#include "ListIsFullException.hxx"
+
+using namespace std;
+
+namespace Batch {
+
+  Versatile::Versatile(DiscriminatorType discriminator, size_type maxsize, std::string name)
+    : _discriminator(discriminator),
+      _maxsize(maxsize),
+      _name(name)
+  {
+  }
+
+  Versatile::Versatile(const Versatile & V)
+   : _discriminator(V._discriminator),
+     _maxsize(V._maxsize),
+     _name(V._name)
+  {
+    Versatile::const_iterator it;
+    for(it=V.begin(); it!=V.end(); it++)
+      push_back( (*it)->clone() );
+  }
+
+  Versatile::~Versatile()
+  {
+    eraseAll();
+  }
+
+  Versatile & Versatile::operator = (const long l) throw(TypeMismatchException)
+  {
+    checkType(LONG);
+    eraseAll();
+    push_back(new LongType(l));
+    return *this;
+  }
+
+  Versatile & Versatile::operator = (const string & ch) throw(TypeMismatchException)
+  {
+    checkType(STRING);
+    eraseAll();
+    push_back(new StringType(ch));
+    return *this;
+  }
+
+  Versatile & Versatile::operator +=(const string & ch) throw(TypeMismatchException,ListIsFullException)
+  {
+    checkType(STRING);
+
+       // If max size is reached, throw a ListIsFullException
+    if (_maxsize == 0 || size() < _maxsize)
+      push_back(new StringType(ch));
+    else {
+      ostringstream msg;
+      msg << "Maximum size for \"" << _name << "\" is reached: " << _maxsize;
+      throw(ListIsFullException(msg.str()));
+    }
+    return *this;
+  }
+
+  Versatile & Versatile::operator , (const string & ch) throw(TypeMismatchException,ListIsFullException)
+  {
+    *this += ch;
+    return *this;
+  }
+
+  Versatile & Versatile::operator = (const char * ch) throw(TypeMismatchException)
+  {
+    return operator=(string(ch));
+  }
+
+  Versatile & Versatile::operator +=(const char * ch) throw(TypeMismatchException,ListIsFullException)
+  {
+    return operator+=(string(ch));
+  }
+
+  Versatile & Versatile::operator , (const char * ch) throw(TypeMismatchException,ListIsFullException)
+  {
+    return operator,(string(ch));
+  }
+
+  Versatile & Versatile::operator = (const Couple & cp) throw(TypeMismatchException)
+  {
+    checkType(COUPLE);
+    eraseAll();
+    push_back(new CoupleType(cp));
+    return *this;
+  }
+
+  Versatile & Versatile::operator +=(const Couple & cp) throw(TypeMismatchException,ListIsFullException)
+  {
+    checkType(COUPLE);
+    // If max size is reached, throw a ListIsFullException
+    if (_maxsize == 0 || size() < _maxsize)
+      push_back(new CoupleType(cp));
+    else {
+      ostringstream msg;
+      msg << "Maximum size for \"" << _name << "\" is reached: " << _maxsize;
+      throw(ListIsFullException(msg.str()));
+    }
+    return *this;
+  }
+
+  Versatile & Versatile::operator , (const Couple & cp) throw(TypeMismatchException,ListIsFullException)
+  {
+    *this += cp;
+    return *this;
+  }
+
+  ostream & operator << (ostream & os, const Versatile & V)
+  {
+    Versatile::const_iterator it;
+    const char * sep = "";
+
+    for(it=V.begin(); it!=V.end(); it++, sep=" ") {
+      string s = (*it)->affiche();
+      os << sep << s;
+    }
+    return os;
+  }
+
+  Versatile & Versatile::operator = (const int i) throw(TypeMismatchException)
+  {
+    checkType(LONG);
+    eraseAll();
+    push_back(new LongType((long)i));
+    return *this;
+  }
+
+  Versatile & Versatile::operator = (const bool b) throw(TypeMismatchException)
+  {
+    checkType(BOOL);
+    eraseAll();
+    push_back(new BoolType(b));
+    return *this;
+  }
+
+  void Versatile::checkType(DiscriminatorType t) const throw(TypeMismatchException)
+  {
+    if (_discriminator != t)
+      throw (TypeMismatchException("Trying to change type of Versatile object \"" + _name + "\""));
+  }
+
+  Versatile::operator long() const throw(TypeMismatchException)
+  {
+    // If the type does not correspond or if the list has more than one element,
+    // throw a TypeMismatchException
+    if ( _maxsize != 1 || _discriminator != LONG || size() == 0 ) {
+      ostringstream sst;
+      sst << "Cannot cast Versatile object \"" << _name << "\" to long";
+      throw (TypeMismatchException(sst.str()));
+    }
+       return *( static_cast<LongType *>(this->front()) );
+  }
+
+  Versatile::operator bool() const throw(TypeMismatchException)
+  {
+    // If the type does not correspond or if the list has more than one element,
+    // throw a TypeMismatchException
+    if ( _maxsize != 1 || _discriminator != BOOL || size() == 0 ) {
+      ostringstream sst;
+      sst << "Cannot cast Versatile object \"" << _name << "\" to bool";
+      throw(TypeMismatchException(sst.str()));
+    }
+    return *( static_cast<BoolType *>(this->front()) );
+  }
+
+  Versatile::operator int() const throw(TypeMismatchException)
+  {
+    return operator long();
+  }
+
+  Versatile::operator Couple() const throw(TypeMismatchException)
+  {
+    // If the type does not correspond or if the list has more than one element,
+    // throw a TypeMismatchException
+    if ( _maxsize != 1 || _discriminator != COUPLE || size() == 0 ) {
+      ostringstream sst;
+      sst << "Cannot cast Versatile object \"" << _name << "\" to Couple";
+      throw(TypeMismatchException(sst.str()));
+    }
+    return *( static_cast<CoupleType *>(this->front()) );
+  }
+
+  string Versatile::str() const throw(TypeMismatchException)
+  {
+    // If the type does not correspond, throw a TypeMismatchException
+    if ( _discriminator != STRING || size() == 0 ) {
+      ostringstream sst;
+      sst << "Cannot cast Versatile object \"" << _name << "\" to string";
+      throw(TypeMismatchException(sst.str()));
+    }
+
+       // The returned string is the concatenation of internal strings
+    string s;
+    Versatile::const_iterator it;
+    const char * sep = "";
+    for(it=begin(); it!=end(); it++, s+=sep, sep=" ")
+      s += *( static_cast<StringType *>(*it));
+
+    return s;
+  }
+
+  Versatile::operator string () const throw(TypeMismatchException)
+  {
+    return str();
+  }
+
+  void Versatile::eraseAll()
+  {
+    while(!empty()) {
+      delete back();
+      pop_back();
+    }
+  }
+
+  DiscriminatorType Versatile::getType() const
+  {
+    return _discriminator;
+  }
+
+  Versatile::size_type Versatile::getMaxSize() const
+  {
+    return _maxsize;
+  }
+
+  const string & Versatile::getName() const
+  {
+    return _name;
+  }
+
+}
diff --git a/src/Core/Versatile.hxx b/src/Core/Versatile.hxx
new file mode 100644 (file)
index 0000000..b1e7462
--- /dev/null
@@ -0,0 +1,118 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * Versatile.hxx :
+ *
+ * Author : Ivan DUTKA-MALEN - EDF R&D
+ * Date   : September 2003
+ *
+ */
+
+#ifndef _VERSATILE_H_
+#define _VERSATILE_H_
+
+#include "Defines.hxx"
+
+#include <iostream>
+#include <list>
+#include <string>
+#include "GenericType.hxx"
+#include "BoolType.hxx"
+#include "LongType.hxx"
+#include "StringType.hxx"
+#include "CoupleType.hxx"
+#include "TypeMismatchException.hxx"
+#include "ListIsFullException.hxx"
+#include "RunTimeException.hxx"
+
+namespace Batch {
+
+  // Authorized types
+  enum DiscriminatorType { BOOL, LONG, STRING, COUPLE };
+
+  class BATCH_EXPORT Versatile : public std::list< GenericType * >
+  {
+  public:
+
+    // Constructors
+    Versatile(DiscriminatorType discriminator, size_type maxsize, std::string name);
+    Versatile(const Versatile & V);
+
+    // Use of default constructor is forbidden but we cannot declare it private because
+    // compilation fails with VC8 on Windows
+    Versatile() { throw RunTimeException("Forbidden constructor"); }
+
+    // Destructor
+    virtual ~Versatile();
+
+    // Affectation and concatenation operators from base types
+    Versatile & operator = (const long     l)    throw(TypeMismatchException);
+    Versatile & operator = (const std::string & ch)   throw(TypeMismatchException);
+    Versatile & operator +=(const std::string & ch)   throw(TypeMismatchException,ListIsFullException);
+    Versatile & operator , (const std::string & ch)   throw(TypeMismatchException,ListIsFullException);
+    Versatile & operator = (const char * ch)   throw(TypeMismatchException);
+    Versatile & operator +=(const char * ch)   throw(TypeMismatchException,ListIsFullException);
+    Versatile & operator , (const char * ch)   throw(TypeMismatchException,ListIsFullException);
+    Versatile & operator = (const Couple & cp)   throw(TypeMismatchException);
+    Versatile & operator +=(const Couple & cp)   throw(TypeMismatchException,ListIsFullException);
+    Versatile & operator , (const Couple & cp)   throw(TypeMismatchException,ListIsFullException);
+    Versatile & operator = (const int i) throw(TypeMismatchException);
+    Versatile & operator = (const bool b) throw(TypeMismatchException);
+
+    // Type conversion to base types
+    operator long() const throw(TypeMismatchException);
+    operator std::string() const throw(TypeMismatchException);
+    operator Couple() const throw(TypeMismatchException);
+    std::string str() const throw(TypeMismatchException);
+    operator bool() const throw(TypeMismatchException);
+    operator int() const throw(TypeMismatchException);
+
+    // Display on a stream
+    BATCH_EXPORT friend std::ostream & operator << (std::ostream & os, const Versatile & );
+
+    // Check the type
+    void checkType(DiscriminatorType t) const throw (TypeMismatchException);
+
+    // Getter methods
+    DiscriminatorType getType() const;
+    size_type getMaxSize() const;
+    const std::string & getName() const;
+
+    // Erase all internal elements
+    void eraseAll();
+
+  protected:
+
+    DiscriminatorType _discriminator; // Internal element type
+    size_type _maxsize; // Maximum number of internal elements
+    std::string _name; // Object name (used for exceptions)
+
+  private:
+
+    // Forbid the use of affectation operator
+    void operator= (const Versatile & V) {}
+
+  };
+
+}
+
+#endif
diff --git a/src/LSF/BatchManager_LSF.cxx b/src/LSF/BatchManager_LSF.cxx
new file mode 100644 (file)
index 0000000..2103ee8
--- /dev/null
@@ -0,0 +1,327 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * BatchManager_LSF.cxx : emulation of LSF client
+ *
+ * Auteur : Bernard SECHER - CEA DEN
+ * Mail   : mailto:bernard.secher@cea.fr
+ * Date   : Thu Apr 24 10:17:22 2008
+ * Projet : PAL Salome
+ *
+ */
+
+#include <cstdlib>
+#include <fstream>
+#include <sstream>
+
+#include <Constants.hxx>
+#include <Utils.hxx>
+#include <NotYetImplementedException.hxx>
+#include "BatchManager_LSF.hxx"
+#include "JobInfo_LSF.hxx"
+
+using namespace std;
+
+namespace Batch {
+
+  BatchManager_LSF::BatchManager_LSF(const FactBatchManager * parent, const char * host,
+                                       const char * username,
+                                       CommunicationProtocolType protocolType, const char * mpiImpl)
+  : BatchManager(parent, host, username, protocolType, mpiImpl)
+  {
+    // Nothing to do
+  }
+
+  // Destructeur
+  BatchManager_LSF::~BatchManager_LSF()
+  {
+    // Nothing to do
+  }
+
+  // Methode pour le controle des jobs : soumet un job au gestionnaire
+  const JobId BatchManager_LSF::submitJob(const Job & job)
+  {
+    Parametre params = job.getParametre();
+    const std::string workDir = params[WORKDIR];
+
+    // export input files on cluster
+    cerr << "Export des fichiers en entree" << endl;
+    exportInputFiles(job);
+
+    // build batch script for job
+    cerr << "Construction du script de batch" << endl;
+    string scriptFile = buildSubmissionScript(job);
+    cerr << "Script envoye" << endl;
+
+    // define command to submit batch
+    string subCommand = string("cd ") + workDir + "; bsub < " + scriptFile;
+    string command = _protocol.getExecCommand(subCommand, _hostname, _username);
+    command += " 2>&1";
+    cerr << command.c_str() << endl;
+
+    string output;
+    int status = Utils::getCommandOutput(command, output);
+    cout << output;
+    if (status != 0) throw RunTimeException("Can't submit job, error was: " + output);
+
+    // read id of submitted job in output
+    int p10 = output.find("<");
+    int p20 = output.find(">");
+    string strjob = output.substr(p10+1,p20-p10-1);
+
+    JobId id(this, strjob);
+    return id;
+  }
+
+  // Ce manager permet de faire de la reprise
+  const Batch::JobId
+  BatchManager_LSF::addJob(const Batch::Job & job, const std::string reference)
+  {
+    return JobId(this, reference);
+  }
+
+  // Methode pour le controle des jobs : retire un job du gestionnaire
+  void BatchManager_LSF::deleteJob(const JobId & jobid)
+  {
+    int status;
+    int ref;
+    istringstream iss(jobid.getReference());
+    iss >> ref;
+
+    // define command to delete batch
+    string subCommand = string("bkill ") + iss.str();
+    string command = _protocol.getExecCommand(subCommand, _hostname, _username);
+    cerr << command.c_str() << endl;
+    status = system(command.c_str());
+    if (status)
+      throw RunTimeException("Error of connection on remote host");
+
+    cerr << "jobId = " << ref << "killed" << endl;
+  }
+
+  // Methode pour le controle des jobs : suspend un job en file d'attente
+  void BatchManager_LSF::holdJob(const JobId & jobid)
+  {
+    throw NotYetImplementedException("BatchManager_LSF::holdJob");
+  }
+
+  // Methode pour le controle des jobs : relache un job suspendu
+  void BatchManager_LSF::releaseJob(const JobId & jobid)
+  {
+    throw NotYetImplementedException("BatchManager_LSF::releaseJob");
+  }
+
+
+  // Methode pour le controle des jobs : modifie un job en file d'attente
+  void BatchManager_LSF::alterJob(const JobId & jobid, const Parametre & param, const Environnement & env)
+  {
+    throw NotYetImplementedException("BatchManager_LSF::alterJob");
+  }
+
+  // Methode pour le controle des jobs : modifie un job en file d'attente
+  void BatchManager_LSF::alterJob(const JobId & jobid, const Parametre & param)
+  {
+    alterJob(jobid, param, Environnement());
+  }
+
+  // Methode pour le controle des jobs : modifie un job en file d'attente
+  void BatchManager_LSF::alterJob(const JobId & jobid, const Environnement & env)
+  {
+    alterJob(jobid, Parametre(), env);
+  }
+
+  // Methode pour le controle des jobs : renvoie l'etat du job
+  JobInfo BatchManager_LSF::queryJob(const JobId & jobid)
+  {
+    int id;
+    istringstream iss(jobid.getReference());
+    iss >> id;
+
+    // define command to query batch
+    string subCommand = string("bjobs ") + iss.str();
+    string command = _protocol.getExecCommand(subCommand, _hostname, _username);
+    cerr << command.c_str() << endl;
+
+    string output;
+    int status = Utils::getCommandOutput(command, output);
+    if (status) throw RunTimeException("Error of connection on remote host");
+
+    JobInfo_LSF ji = JobInfo_LSF(id, output);
+    return ji;
+  }
+
+
+
+  // Methode pour le controle des jobs : teste si un job est present en machine
+  bool BatchManager_LSF::isRunning(const JobId & jobid)
+  {
+    throw NotYetImplementedException("BatchManager_LSF::isRunning");
+  }
+
+  std::string BatchManager_LSF::buildSubmissionScript(const Job & job)
+  {
+    Parametre params = job.getParametre();
+
+    // Job Parameters
+    string workDir       = "";
+    string fileToExecute = "";
+    int nbproc          = 0;
+    int edt             = 0;
+    int mem              = 0;
+    string queue         = "";
+
+    // Mandatory parameters
+    if (params.find(WORKDIR) != params.end()) 
+      workDir = params[WORKDIR].str();
+    else 
+      throw RunTimeException("params[WORKDIR] is not defined ! Please defined it, cannot submit this job");
+    if (params.find(EXECUTABLE) != params.end()) 
+      fileToExecute = params[EXECUTABLE].str();
+    else 
+      throw RunTimeException("params[EXECUTABLE] is not defined ! Please defined it, cannot submit this job");
+
+    // Optional parameters
+    if (params.find(NBPROC) != params.end()) 
+      nbproc = params[NBPROC];
+    if (params.find(MAXWALLTIME) != params.end()) 
+      edt = params[MAXWALLTIME];
+    if (params.find(MAXRAMSIZE) != params.end()) 
+      mem = params[MAXRAMSIZE];
+    if (params.find(QUEUE) != params.end()) 
+      queue = params[QUEUE].str();
+
+    string::size_type p1 = fileToExecute.find_last_of("/");
+    string::size_type p2 = fileToExecute.find_last_of(".");
+    string rootNameToExecute = fileToExecute.substr(p1+1,p2-p1-1);
+    string fileNameToExecute = fileToExecute.substr(p1+1);
+    // Create batch submit file
+    ofstream tempOutputFile;
+    std::string TmpFileName = Utils::createAndOpenTemporaryFile("LSF-script", tempOutputFile);
+
+    tempOutputFile << "#! /bin/sh -f" << endl ;
+    if (params.find(NAME) != params.end())
+      tempOutputFile << "#BSUB -J " << params[NAME] << endl;
+    if (queue != "")
+      tempOutputFile << "#BSUB -q " << queue << endl;
+    if( edt > 0 )
+      tempOutputFile << "#BSUB -W " << getWallTime(edt) << endl ;
+    if( mem > 0 )
+      tempOutputFile << "#BSUB -M " << mem*1024 << endl ;
+    tempOutputFile << "#BSUB -n " << nbproc << endl ;
+
+    if (params.find(EXCLUSIVE) != params.end() && params[EXCLUSIVE]) {
+      tempOutputFile << "#BSUB -x" << endl ;
+    }
+
+    size_t pos = workDir.find("$HOME");
+    string baseDir;
+    if( pos != string::npos )
+      baseDir = getHomeDir(workDir) + workDir.substr(pos+5,workDir.length()-5);
+    else{
+      pos = workDir.find("~");
+      if( pos != string::npos )
+       baseDir = getHomeDir(workDir) + workDir.substr(pos+1,workDir.length()-1);
+      else
+       baseDir = workDir;
+    }
+    tempOutputFile << "#BSUB -o " << baseDir << "/logs/output.log." << rootNameToExecute << endl ;
+    tempOutputFile << "#BSUB -e " << baseDir << "/logs/error.log." << rootNameToExecute << endl ;
+
+    // Define environment for the job
+    Environnement env = job.getEnvironnement();
+    for (Environnement::const_iterator iter = env.begin() ; iter != env.end() ; ++iter) {
+      tempOutputFile << "export " << iter->first << "=" << iter->second << endl;
+    }
+
+    tempOutputFile << "cd " << workDir << endl ;
+
+    // generate nodes file
+    tempOutputFile << "LIBBATCH_NODEFILE=`mktemp nodefile-XXXXXXXXXX` || exit 1" << endl;
+    tempOutputFile << "bool=0" << endl;
+    tempOutputFile << "for i in $LSB_MCPU_HOSTS; do" << endl;
+    tempOutputFile << "  if test $bool = 0; then" << endl;
+    tempOutputFile << "    n=$i" << endl;
+    tempOutputFile << "    bool=1" << endl;
+    tempOutputFile << "  else" << endl;
+    tempOutputFile << "    for ((j=0;j<$i;j++)); do" << endl;
+    tempOutputFile << "      echo $n >> $LIBBATCH_NODEFILE" << endl;
+    tempOutputFile << "    done" << endl;
+    tempOutputFile << "    bool=0" << endl;
+    tempOutputFile << "  fi" << endl;
+    tempOutputFile << "done" << endl;
+    tempOutputFile << "export LIBBATCH_NODEFILE" << endl;
+
+    // Launch the executable
+    tempOutputFile << "./" + fileNameToExecute << endl;
+
+    // Remove the node file
+    tempOutputFile << "rm $LIBBATCH_NODEFILE" << endl;
+
+    tempOutputFile.flush();
+    tempOutputFile.close();
+
+    cerr << "Batch script file generated is: " << TmpFileName.c_str() << endl;
+
+    string remoteFileName = rootNameToExecute + "_Batch.sh";
+    int status = _protocol.copyFile(TmpFileName, "", "",
+                                    workDir + "/" + remoteFileName,
+                                    _hostname, _username);
+    if (status)
+      throw RunTimeException("Error of connection on remote host");
+    return remoteFileName;
+  }
+
+  std::string BatchManager_LSF::getWallTime(const long edt)
+  {
+    long h, m;
+    h = edt / 60;
+    m = edt - h*60;
+    ostringstream oss;
+    if( m >= 10 )
+      oss << h << ":" << m;
+    else
+      oss << h << ":0" << m;
+    return oss.str();
+  }
+
+  std::string BatchManager_LSF::getHomeDir(std::string tmpdir)
+  {
+    std::string home;
+    int idx = tmpdir.find("Batch/");
+    std::string filelogtemp = tmpdir.substr(idx+6, tmpdir.length());
+    filelogtemp = "/tmp/logs" + filelogtemp + "_home";
+
+    string subCommand = string("echo $HOME");
+    string command = _protocol.getExecCommand(subCommand, _hostname, _username) + " > " + filelogtemp;
+    cerr << command.c_str() << endl;
+    int status = system(command.c_str());
+    if (status)
+      throw RunTimeException("Error of launching home command on remote host");
+
+    std::ifstream file_home(filelogtemp.c_str());
+    std::getline(file_home, home);
+    file_home.close();
+    return home;
+  }
+
+}
diff --git a/src/LSF/BatchManager_LSF.hxx b/src/LSF/BatchManager_LSF.hxx
new file mode 100644 (file)
index 0000000..201e3b3
--- /dev/null
@@ -0,0 +1,90 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * BatchManager_LSF.hxx : emulation of LSF client
+ *
+ * Auteur : Bernard SECHER - CEA DEN
+ * Mail   : mailto:bernard.secher@cea.fr
+ * Date   : Thu Apr 24 10:17:22 2008
+ * Projet : PAL Salome
+ *
+ */
+
+#ifndef _BATCHMANAGER_ELSF_H_
+#define _BATCHMANAGER_ELSF_H_
+
+#include "Defines.hxx"
+#include "JobId.hxx"
+#include "JobInfo.hxx"
+#include "FactBatchManager.hxx"
+#include "BatchManager.hxx"
+
+namespace Batch {
+
+  class BATCH_EXPORT BatchManager_LSF : public BatchManager
+  {
+  public:
+    // Constructeur et destructeur
+    BatchManager_LSF(const FactBatchManager * parent, const char * host="localhost",
+                      const char * username="",
+                      CommunicationProtocolType protocolType = SSH, const char * mpiImpl="nompi"); // connexion a la machine host
+    virtual ~BatchManager_LSF();
+
+    // Recupere le nom du serveur par defaut
+    // static string BatchManager_LSF::getDefaultServer();
+
+    // Methodes pour le controle des jobs
+    virtual const JobId submitJob(const Job & job); // soumet un job au gestionnaire
+    virtual void deleteJob(const JobId & jobid); // retire un job du gestionnaire
+    virtual void holdJob(const JobId & jobid); // suspend un job en file d'attente
+    virtual void releaseJob(const JobId & jobid); // relache un job suspendu
+    virtual void alterJob(const JobId & jobid, const Parametre & param, const Environnement & env); // modifie un job en file d'attente
+    virtual void alterJob(const JobId & jobid, const Parametre & param); // modifie un job en file d'attente
+    virtual void alterJob(const JobId & jobid, const Environnement & env); // modifie un job en file d'attente
+    virtual JobInfo queryJob(const JobId & jobid); // renvoie l'etat du job
+    virtual bool isRunning(const JobId & jobid); // teste si un job est present en machine
+
+    virtual void setParametre(const JobId & jobid, const Parametre & param) { return alterJob(jobid, param); } // modifie un job en file d'attente
+    virtual void setEnvironnement(const JobId & jobid, const Environnement & env) { return alterJob(jobid, env); } // modifie un job en file d'attente
+
+    virtual const Batch::JobId addJob(const Batch::Job & job, const std::string reference); // ajoute un nouveau job sans le soumettre
+
+  protected:
+    std::string buildSubmissionScript(const Job & job);
+    std::string getWallTime(const long edt);
+
+  private:
+
+    std::string getHomeDir(std::string tmpdir);
+
+#ifdef SWIG
+  public:
+    // Recupere le l'identifiant d'un job deja soumis au BatchManager
+    //virtual const JobId getJobIdByReference(const string & ref) { return BatchManager::getJobIdByReference(ref); }
+    virtual const JobId getJobIdByReference(const char * ref) { return BatchManager::getJobIdByReference(ref); }
+#endif
+
+  };
+
+}
+
+#endif
diff --git a/src/LSF/Batch_BatchManager_eLSF.cxx b/src/LSF/Batch_BatchManager_eLSF.cxx
deleted file mode 100644 (file)
index 9650a92..0000000
+++ /dev/null
@@ -1,327 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * BatchManager_eLSF.cxx : emulation of LSF client
- *
- * Auteur : Bernard SECHER - CEA DEN
- * Mail   : mailto:bernard.secher@cea.fr
- * Date   : Thu Apr 24 10:17:22 2008
- * Projet : PAL Salome
- *
- */
-
-#include <cstdlib>
-#include <fstream>
-#include <sstream>
-
-#include <Batch_Constants.hxx>
-#include <Batch_Utils.hxx>
-#include <Batch_NotYetImplementedException.hxx>
-#include "Batch_BatchManager_eLSF.hxx"
-#include "Batch_JobInfo_eLSF.hxx"
-
-using namespace std;
-
-namespace Batch {
-
-  BatchManager_eLSF::BatchManager_eLSF(const FactBatchManager * parent, const char * host,
-                                       const char * username,
-                                       CommunicationProtocolType protocolType, const char * mpiImpl)
-  : BatchManager(parent, host, username, protocolType, mpiImpl)
-  {
-    // Nothing to do
-  }
-
-  // Destructeur
-  BatchManager_eLSF::~BatchManager_eLSF()
-  {
-    // Nothing to do
-  }
-
-  // Methode pour le controle des jobs : soumet un job au gestionnaire
-  const JobId BatchManager_eLSF::submitJob(const Job & job)
-  {
-    Parametre params = job.getParametre();
-    const std::string workDir = params[WORKDIR];
-
-    // export input files on cluster
-    cerr << "Export des fichiers en entree" << endl;
-    exportInputFiles(job);
-
-    // build batch script for job
-    cerr << "Construction du script de batch" << endl;
-    string scriptFile = buildSubmissionScript(job);
-    cerr << "Script envoye" << endl;
-
-    // define command to submit batch
-    string subCommand = string("cd ") + workDir + "; bsub < " + scriptFile;
-    string command = _protocol.getExecCommand(subCommand, _hostname, _username);
-    command += " 2>&1";
-    cerr << command.c_str() << endl;
-
-    string output;
-    int status = Utils::getCommandOutput(command, output);
-    cout << output;
-    if (status != 0) throw RunTimeException("Can't submit job, error was: " + output);
-
-    // read id of submitted job in output
-    int p10 = output.find("<");
-    int p20 = output.find(">");
-    string strjob = output.substr(p10+1,p20-p10-1);
-
-    JobId id(this, strjob);
-    return id;
-  }
-
-  // Ce manager permet de faire de la reprise
-  const Batch::JobId
-  BatchManager_eLSF::addJob(const Batch::Job & job, const std::string reference)
-  {
-    return JobId(this, reference);
-  }
-
-  // Methode pour le controle des jobs : retire un job du gestionnaire
-  void BatchManager_eLSF::deleteJob(const JobId & jobid)
-  {
-    int status;
-    int ref;
-    istringstream iss(jobid.getReference());
-    iss >> ref;
-
-    // define command to delete batch
-    string subCommand = string("bkill ") + iss.str();
-    string command = _protocol.getExecCommand(subCommand, _hostname, _username);
-    cerr << command.c_str() << endl;
-    status = system(command.c_str());
-    if (status)
-      throw RunTimeException("Error of connection on remote host");
-
-    cerr << "jobId = " << ref << "killed" << endl;
-  }
-
-  // Methode pour le controle des jobs : suspend un job en file d'attente
-  void BatchManager_eLSF::holdJob(const JobId & jobid)
-  {
-    throw NotYetImplementedException("BatchManager_eLSF::holdJob");
-  }
-
-  // Methode pour le controle des jobs : relache un job suspendu
-  void BatchManager_eLSF::releaseJob(const JobId & jobid)
-  {
-    throw NotYetImplementedException("BatchManager_eLSF::releaseJob");
-  }
-
-
-  // Methode pour le controle des jobs : modifie un job en file d'attente
-  void BatchManager_eLSF::alterJob(const JobId & jobid, const Parametre & param, const Environnement & env)
-  {
-    throw NotYetImplementedException("BatchManager_eLSF::alterJob");
-  }
-
-  // Methode pour le controle des jobs : modifie un job en file d'attente
-  void BatchManager_eLSF::alterJob(const JobId & jobid, const Parametre & param)
-  {
-    alterJob(jobid, param, Environnement());
-  }
-
-  // Methode pour le controle des jobs : modifie un job en file d'attente
-  void BatchManager_eLSF::alterJob(const JobId & jobid, const Environnement & env)
-  {
-    alterJob(jobid, Parametre(), env);
-  }
-
-  // Methode pour le controle des jobs : renvoie l'etat du job
-  JobInfo BatchManager_eLSF::queryJob(const JobId & jobid)
-  {
-    int id;
-    istringstream iss(jobid.getReference());
-    iss >> id;
-
-    // define command to query batch
-    string subCommand = string("bjobs ") + iss.str();
-    string command = _protocol.getExecCommand(subCommand, _hostname, _username);
-    cerr << command.c_str() << endl;
-
-    string output;
-    int status = Utils::getCommandOutput(command, output);
-    if (status) throw RunTimeException("Error of connection on remote host");
-
-    JobInfo_eLSF ji = JobInfo_eLSF(id, output);
-    return ji;
-  }
-
-
-
-  // Methode pour le controle des jobs : teste si un job est present en machine
-  bool BatchManager_eLSF::isRunning(const JobId & jobid)
-  {
-    throw NotYetImplementedException("BatchManager_eLSF::isRunning");
-  }
-
-  std::string BatchManager_eLSF::buildSubmissionScript(const Job & job)
-  {
-    Parametre params = job.getParametre();
-
-    // Job Parameters
-    string workDir       = "";
-    string fileToExecute = "";
-    int nbproc          = 0;
-    int edt             = 0;
-    int mem              = 0;
-    string queue         = "";
-
-    // Mandatory parameters
-    if (params.find(WORKDIR) != params.end()) 
-      workDir = params[WORKDIR].str();
-    else 
-      throw RunTimeException("params[WORKDIR] is not defined ! Please defined it, cannot submit this job");
-    if (params.find(EXECUTABLE) != params.end()) 
-      fileToExecute = params[EXECUTABLE].str();
-    else 
-      throw RunTimeException("params[EXECUTABLE] is not defined ! Please defined it, cannot submit this job");
-
-    // Optional parameters
-    if (params.find(NBPROC) != params.end()) 
-      nbproc = params[NBPROC];
-    if (params.find(MAXWALLTIME) != params.end()) 
-      edt = params[MAXWALLTIME];
-    if (params.find(MAXRAMSIZE) != params.end()) 
-      mem = params[MAXRAMSIZE];
-    if (params.find(QUEUE) != params.end()) 
-      queue = params[QUEUE].str();
-
-    string::size_type p1 = fileToExecute.find_last_of("/");
-    string::size_type p2 = fileToExecute.find_last_of(".");
-    string rootNameToExecute = fileToExecute.substr(p1+1,p2-p1-1);
-    string fileNameToExecute = fileToExecute.substr(p1+1);
-    // Create batch submit file
-    ofstream tempOutputFile;
-    std::string TmpFileName = Utils::createAndOpenTemporaryFile("LSF-script", tempOutputFile);
-
-    tempOutputFile << "#! /bin/sh -f" << endl ;
-    if (params.find(NAME) != params.end())
-      tempOutputFile << "#BSUB -J " << params[NAME] << endl;
-    if (queue != "")
-      tempOutputFile << "#BSUB -q " << queue << endl;
-    if( edt > 0 )
-      tempOutputFile << "#BSUB -W " << getWallTime(edt) << endl ;
-    if( mem > 0 )
-      tempOutputFile << "#BSUB -M " << mem*1024 << endl ;
-    tempOutputFile << "#BSUB -n " << nbproc << endl ;
-
-    if (params.find(EXCLUSIVE) != params.end() && params[EXCLUSIVE]) {
-      tempOutputFile << "#BSUB -x" << endl ;
-    }
-
-    size_t pos = workDir.find("$HOME");
-    string baseDir;
-    if( pos != string::npos )
-      baseDir = getHomeDir(workDir) + workDir.substr(pos+5,workDir.length()-5);
-    else{
-      pos = workDir.find("~");
-      if( pos != string::npos )
-       baseDir = getHomeDir(workDir) + workDir.substr(pos+1,workDir.length()-1);
-      else
-       baseDir = workDir;
-    }
-    tempOutputFile << "#BSUB -o " << baseDir << "/logs/output.log." << rootNameToExecute << endl ;
-    tempOutputFile << "#BSUB -e " << baseDir << "/logs/error.log." << rootNameToExecute << endl ;
-
-    // Define environment for the job
-    Environnement env = job.getEnvironnement();
-    for (Environnement::const_iterator iter = env.begin() ; iter != env.end() ; ++iter) {
-      tempOutputFile << "export " << iter->first << "=" << iter->second << endl;
-    }
-
-    tempOutputFile << "cd " << workDir << endl ;
-
-    // generate nodes file
-    tempOutputFile << "LIBBATCH_NODEFILE=`mktemp nodefile-XXXXXXXXXX` || exit 1" << endl;
-    tempOutputFile << "bool=0" << endl;
-    tempOutputFile << "for i in $LSB_MCPU_HOSTS; do" << endl;
-    tempOutputFile << "  if test $bool = 0; then" << endl;
-    tempOutputFile << "    n=$i" << endl;
-    tempOutputFile << "    bool=1" << endl;
-    tempOutputFile << "  else" << endl;
-    tempOutputFile << "    for ((j=0;j<$i;j++)); do" << endl;
-    tempOutputFile << "      echo $n >> $LIBBATCH_NODEFILE" << endl;
-    tempOutputFile << "    done" << endl;
-    tempOutputFile << "    bool=0" << endl;
-    tempOutputFile << "  fi" << endl;
-    tempOutputFile << "done" << endl;
-    tempOutputFile << "export LIBBATCH_NODEFILE" << endl;
-
-    // Launch the executable
-    tempOutputFile << "./" + fileNameToExecute << endl;
-
-    // Remove the node file
-    tempOutputFile << "rm $LIBBATCH_NODEFILE" << endl;
-
-    tempOutputFile.flush();
-    tempOutputFile.close();
-
-    cerr << "Batch script file generated is: " << TmpFileName.c_str() << endl;
-
-    string remoteFileName = rootNameToExecute + "_Batch.sh";
-    int status = _protocol.copyFile(TmpFileName, "", "",
-                                    workDir + "/" + remoteFileName,
-                                    _hostname, _username);
-    if (status)
-      throw RunTimeException("Error of connection on remote host");
-    return remoteFileName;
-  }
-
-  std::string BatchManager_eLSF::getWallTime(const long edt)
-  {
-    long h, m;
-    h = edt / 60;
-    m = edt - h*60;
-    ostringstream oss;
-    if( m >= 10 )
-      oss << h << ":" << m;
-    else
-      oss << h << ":0" << m;
-    return oss.str();
-  }
-
-  std::string BatchManager_eLSF::getHomeDir(std::string tmpdir)
-  {
-    std::string home;
-    int idx = tmpdir.find("Batch/");
-    std::string filelogtemp = tmpdir.substr(idx+6, tmpdir.length());
-    filelogtemp = "/tmp/logs" + filelogtemp + "_home";
-
-    string subCommand = string("echo $HOME");
-    string command = _protocol.getExecCommand(subCommand, _hostname, _username) + " > " + filelogtemp;
-    cerr << command.c_str() << endl;
-    int status = system(command.c_str());
-    if (status)
-      throw RunTimeException("Error of launching home command on remote host");
-
-    std::ifstream file_home(filelogtemp.c_str());
-    std::getline(file_home, home);
-    file_home.close();
-    return home;
-  }
-
-}
diff --git a/src/LSF/Batch_BatchManager_eLSF.hxx b/src/LSF/Batch_BatchManager_eLSF.hxx
deleted file mode 100644 (file)
index cc4d48f..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * BatchManager_eLSF.hxx : emulation of LSF client
- *
- * Auteur : Bernard SECHER - CEA DEN
- * Mail   : mailto:bernard.secher@cea.fr
- * Date   : Thu Apr 24 10:17:22 2008
- * Projet : PAL Salome
- *
- */
-
-#ifndef _BATCHMANAGER_ELSF_H_
-#define _BATCHMANAGER_ELSF_H_
-
-#include "Batch_Defines.hxx"
-#include "Batch_JobId.hxx"
-#include "Batch_JobInfo.hxx"
-#include "Batch_FactBatchManager.hxx"
-#include "Batch_BatchManager.hxx"
-
-namespace Batch {
-
-  class BATCH_EXPORT BatchManager_eLSF : public BatchManager
-  {
-  public:
-    // Constructeur et destructeur
-    BatchManager_eLSF(const FactBatchManager * parent, const char * host="localhost",
-                      const char * username="",
-                      CommunicationProtocolType protocolType = SSH, const char * mpiImpl="nompi"); // connexion a la machine host
-    virtual ~BatchManager_eLSF();
-
-    // Recupere le nom du serveur par defaut
-    // static string BatchManager_LSF::getDefaultServer();
-
-    // Methodes pour le controle des jobs
-    virtual const JobId submitJob(const Job & job); // soumet un job au gestionnaire
-    virtual void deleteJob(const JobId & jobid); // retire un job du gestionnaire
-    virtual void holdJob(const JobId & jobid); // suspend un job en file d'attente
-    virtual void releaseJob(const JobId & jobid); // relache un job suspendu
-    virtual void alterJob(const JobId & jobid, const Parametre & param, const Environnement & env); // modifie un job en file d'attente
-    virtual void alterJob(const JobId & jobid, const Parametre & param); // modifie un job en file d'attente
-    virtual void alterJob(const JobId & jobid, const Environnement & env); // modifie un job en file d'attente
-    virtual JobInfo queryJob(const JobId & jobid); // renvoie l'etat du job
-    virtual bool isRunning(const JobId & jobid); // teste si un job est present en machine
-
-    virtual void setParametre(const JobId & jobid, const Parametre & param) { return alterJob(jobid, param); } // modifie un job en file d'attente
-    virtual void setEnvironnement(const JobId & jobid, const Environnement & env) { return alterJob(jobid, env); } // modifie un job en file d'attente
-
-    virtual const Batch::JobId addJob(const Batch::Job & job, const std::string reference); // ajoute un nouveau job sans le soumettre
-
-  protected:
-    std::string buildSubmissionScript(const Job & job);
-    std::string getWallTime(const long edt);
-
-  private:
-
-    std::string getHomeDir(std::string tmpdir);
-
-#ifdef SWIG
-  public:
-    // Recupere le l'identifiant d'un job deja soumis au BatchManager
-    //virtual const JobId getJobIdByReference(const string & ref) { return BatchManager::getJobIdByReference(ref); }
-    virtual const JobId getJobIdByReference(const char * ref) { return BatchManager::getJobIdByReference(ref); }
-#endif
-
-  };
-
-}
-
-#endif
diff --git a/src/LSF/Batch_FactBatchManager_eLSF.cxx b/src/LSF/Batch_FactBatchManager_eLSF.cxx
deleted file mode 100644 (file)
index d069be8..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * FactBatchManager_eLSF.cxx : 
- *
- * Auteur : Bernard SECHER - CEA DEN
- * Date   : Avril 2008
- * Projet : PAL Salome
- *
- */
-
-#include "Batch_BatchManager_eLSF.hxx"
-#include "Batch_FactBatchManager_eLSF.hxx"
-
-namespace Batch {
-
-  static FactBatchManager_eLSF sFBM_eLSF;
-
-  // Constructeur
-  FactBatchManager_eLSF::FactBatchManager_eLSF() : FactBatchManager("LSF")
-  {
-    // Nothing to do
-  }
-
-  // Destructeur
-  FactBatchManager_eLSF::~FactBatchManager_eLSF()
-  {
-    // Nothing to do
-  }
-
-  BatchManager * FactBatchManager_eLSF::operator() (const char * hostname,
-                                                    const char * username,
-                                                    CommunicationProtocolType protocolType,
-                                                    const char * mpiImpl) const
-  {
-    // MESSAGE("Building new BatchManager_LSF on host '" << hostname << "'");
-    return new BatchManager_eLSF(this, hostname, username, protocolType, mpiImpl);
-  }
-
-}
diff --git a/src/LSF/Batch_FactBatchManager_eLSF.hxx b/src/LSF/Batch_FactBatchManager_eLSF.hxx
deleted file mode 100644 (file)
index 3068869..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * FactBatchManager_eLSF.hxx : 
- *
- * Auteur : Bernard SECHER : CEA DEN
- * Date   : Avril 2008
- * Projet : PAL Salome
- *
- */
-
-#ifndef _FACTBATCHMANAGER_eLSF_H_
-#define _FACTBATCHMANAGER_eLSF_H_
-
-#include "Batch_Defines.hxx"
-#include "Batch_BatchManager.hxx"
-#include "Batch_FactBatchManager.hxx"
-
-namespace Batch {
-  
-  class BATCH_EXPORT FactBatchManager_eLSF : public FactBatchManager
-  {
-  public:
-
-    FactBatchManager_eLSF();
-    virtual ~FactBatchManager_eLSF();
-
-    virtual BatchManager * operator() (const char * hostname,
-                                       const char * username,
-                                       CommunicationProtocolType protocolType,
-                                       const char * mpiImpl) const;
-
-  };
-
-}
-
-#endif
diff --git a/src/LSF/Batch_JobInfo_eLSF.cxx b/src/LSF/Batch_JobInfo_eLSF.cxx
deleted file mode 100644 (file)
index 3f7ddec..0000000
+++ /dev/null
@@ -1,127 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * JobInfo_eLSF.cxx :  emulation of LSF client
- *
- * Auteur : Bernard SECHER - CEA DEN
- * Mail   : mailto:bernard.secher@cea.fr
- * Date   : Thu Apr 24 10:17:22 2008
- * Projet : PAL Salome 
- *
- */
-
-#include <cstdio>
-#include <sstream>
-
-#include <Batch_Constants.hxx>
-#include "Batch_JobInfo_eLSF.hxx"
-
-using namespace std;
-
-namespace Batch {
-
-  // Constructeurs
-  JobInfo_eLSF::JobInfo_eLSF(int id, const std::string & queryOutput) : JobInfo()
-  {
-    // Fill ID parameter
-    ostringstream oss;
-    oss << id;
-    _param[ID] = oss.str();
-
-    // read query output
-    string line;
-    istringstream fp(queryOutput);
-    getline(fp, line);
-
-    // On some batch managers, the job is deleted soon after it is finished,
-    // so we have to consider that an unknown job (empty file) is a finished
-    // one, even if it is not always true.
-    if (fp.eof()) {
-      _param[STATE] = FINISHED;
-    } else {
-      string sjobid, username, status;
-      fp >> sjobid;
-      fp >> username;
-      fp >> status;
-
-      if (status == "PEND") {         // Pending
-        _param[STATE] = QUEUED;
-      } else if (status == "PSUSP") { // Suspended while pending
-        _param[STATE] = PAUSED;
-      } else if (status == "RUN") {   // Running
-        _param[STATE] = RUNNING;
-      } else if (status == "USUSP") { // Suspended while running
-        _param[STATE] = PAUSED;
-      } else if (status == "SSUSP") { // Suspended by LSF
-        _param[STATE] = PAUSED;
-      } else if (status == "DONE") {  // Finished successfully
-        _param[STATE] = FINISHED;
-      } else if (status == "EXIT") {  // Finished in error
-        _param[STATE] = FAILED;
-      } else if (status == "UNKWN") { // Lost contact
-        _param[STATE] = FAILED;
-      } else if (status == "ZOMBI") { // Zombie
-        _param[STATE] = FAILED;
-      } else {
-        cerr << "Unknown job state code: " << status << endl;
-      }
-
-      if( status.find("RUN") != string::npos)
-        _running = true;
-    }
-  }
-
-  // Teste si un job est present en machine
-  bool JobInfo_eLSF::isRunning() const
-  {
-    return _running;
-  }
-
-
-  // Destructeur
-  JobInfo_eLSF::~JobInfo_eLSF()
-  {
-    // Nothing to do
-  }
-
-  // Convertit une date HH:MM:SS en secondes
-  long JobInfo_eLSF::HMStoLong(const string & s)
-  {
-    long hour, min, sec;
-
-    sscanf( s.c_str(), "%ld:%ld:%ld", &hour, &min, &sec);
-    return ( ( ( hour * 60L ) + min ) * 60L ) + sec;
-  }
-
-  // Methode pour l'interfacage avec Python (SWIG) : affichage en Python
-  string JobInfo_eLSF::__str__() const
-  {
-    ostringstream sst;
-    sst << "<JobInfo_eLSF (" << this << ") :" << endl;
-    sst << " ID = " <<_param[ID] << endl;
-    sst << " STATE = " <<_param[STATE] << endl;
-
-    return sst.str();
-  }
-
-
-}
diff --git a/src/LSF/Batch_JobInfo_eLSF.hxx b/src/LSF/Batch_JobInfo_eLSF.hxx
deleted file mode 100644 (file)
index dd7cd46..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * JobInfo_eLSF.hxx :  emulation of LSF client
- *
- * Auteur : Bernard SECHER - CEA DEN
- * Mail   : mailto:bernard.secher@cea.fr
- * Date   : Thu Apr 24 10:17:22 2008
- * Projet : PAL Salome 
- *
- */
-
-#ifndef _JOBINFO_LSF_H_
-#define _JOBINFO_LSF_H_
-
-#include "Batch_JobInfo.hxx"
-
-#include <string>
-
-namespace Batch {
-
-  class JobInfo_eLSF : public JobInfo
-  {
-  public:
-    // Constructeurs et destructeur
-    JobInfo_eLSF() : _running(false) {};
-    JobInfo_eLSF(int id, const std::string & queryOutput);
-    virtual ~JobInfo_eLSF();
-
-    // Constructeur par recopie
-    JobInfo_eLSF(const JobInfo_eLSF & jinfo) : JobInfo(jinfo) {};
-
-    // Teste si un job est present en machine
-    virtual bool isRunning() const;
-
-    // Methodes pour l'interfacage avec Python (SWIG)
-    // TODO : supprimer ces methodes et transferer leur definitions dans SWIG
-    std::string  __str__() const; // SWIG : affichage en Python
-    std::string  __repr__() const { return __str__(); }; // SWIG : affichage en Python
-
-  protected:
-    bool _running; // etat du job en machine
-
-  private:
-    // Convertit une date HH:MM:SS en secondes
-    long HMStoLong(const std::string &);
-
-  };
-
-}
-
-#endif
index 7a1d7f5511c045d72a3e6b5ffb422e0072cc8c1f..7268633ca8931ce35c8e9b2ddc53f8a742531e3f 100644 (file)
@@ -20,9 +20,9 @@
 #  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-SET(CLASS_LIST LSF/Batch_BatchManager_eLSF
-               LSF/Batch_FactBatchManager_eLSF
-               LSF/Batch_JobInfo_eLSF
+SET(CLASS_LIST LSF/BatchManager_LSF
+               LSF/FactBatchManager_LSF
+               LSF/JobInfo_LSF
    )
 
 APPEND_CLASSES_TO_SRC_FILES(${CLASS_LIST})
diff --git a/src/LSF/FactBatchManager_LSF.cxx b/src/LSF/FactBatchManager_LSF.cxx
new file mode 100644 (file)
index 0000000..cb6990c
--- /dev/null
@@ -0,0 +1,59 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * FactBatchManager_LSF.cxx : 
+ *
+ * Auteur : Bernard SECHER - CEA DEN
+ * Date   : Avril 2008
+ * Projet : PAL Salome
+ *
+ */
+
+#include "BatchManager_LSF.hxx"
+#include "FactBatchManager_LSF.hxx"
+
+namespace Batch {
+
+  static FactBatchManager_LSF sFBM_LSF;
+
+  // Constructeur
+  FactBatchManager_LSF::FactBatchManager_LSF() : FactBatchManager("LSF")
+  {
+    // Nothing to do
+  }
+
+  // Destructeur
+  FactBatchManager_LSF::~FactBatchManager_LSF()
+  {
+    // Nothing to do
+  }
+
+  BatchManager * FactBatchManager_LSF::operator() (const char * hostname,
+                                                    const char * username,
+                                                    CommunicationProtocolType protocolType,
+                                                    const char * mpiImpl) const
+  {
+    // MESSAGE("Building new BatchManager_LSF on host '" << hostname << "'");
+    return new BatchManager_LSF(this, hostname, username, protocolType, mpiImpl);
+  }
+
+}
diff --git a/src/LSF/FactBatchManager_LSF.hxx b/src/LSF/FactBatchManager_LSF.hxx
new file mode 100644 (file)
index 0000000..fc191cb
--- /dev/null
@@ -0,0 +1,56 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * FactBatchManager_LSF.hxx : 
+ *
+ * Auteur : Bernard SECHER : CEA DEN
+ * Date   : Avril 2008
+ * Projet : PAL Salome
+ *
+ */
+
+#ifndef _FACTBATCHMANAGER_LSF_H_
+#define _FACTBATCHMANAGER_LSF_H_
+
+#include "Defines.hxx"
+#include "BatchManager.hxx"
+#include "FactBatchManager.hxx"
+
+namespace Batch {
+  
+  class BATCH_EXPORT FactBatchManager_LSF : public FactBatchManager
+  {
+  public:
+
+    FactBatchManager_LSF();
+    virtual ~FactBatchManager_LSF();
+
+    virtual BatchManager * operator() (const char * hostname,
+                                       const char * username,
+                                       CommunicationProtocolType protocolType,
+                                       const char * mpiImpl) const;
+
+  };
+
+}
+
+#endif
diff --git a/src/LSF/JobInfo_LSF.cxx b/src/LSF/JobInfo_LSF.cxx
new file mode 100644 (file)
index 0000000..c9e6bb1
--- /dev/null
@@ -0,0 +1,127 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * JobInfo_LSF.cxx :  emulation of LSF client
+ *
+ * Auteur : Bernard SECHER - CEA DEN
+ * Mail   : mailto:bernard.secher@cea.fr
+ * Date   : Thu Apr 24 10:17:22 2008
+ * Projet : PAL Salome 
+ *
+ */
+
+#include <cstdio>
+#include <sstream>
+
+#include <Constants.hxx>
+#include "JobInfo_LSF.hxx"
+
+using namespace std;
+
+namespace Batch {
+
+  // Constructeurs
+  JobInfo_LSF::JobInfo_LSF(int id, const std::string & queryOutput) : JobInfo()
+  {
+    // Fill ID parameter
+    ostringstream oss;
+    oss << id;
+    _param[ID] = oss.str();
+
+    // read query output
+    string line;
+    istringstream fp(queryOutput);
+    getline(fp, line);
+
+    // On some batch managers, the job is deleted soon after it is finished,
+    // so we have to consider that an unknown job (empty file) is a finished
+    // one, even if it is not always true.
+    if (fp.eof()) {
+      _param[STATE] = FINISHED;
+    } else {
+      string sjobid, username, status;
+      fp >> sjobid;
+      fp >> username;
+      fp >> status;
+
+      if (status == "PEND") {         // Pending
+        _param[STATE] = QUEUED;
+      } else if (status == "PSUSP") { // Suspended while pending
+        _param[STATE] = PAUSED;
+      } else if (status == "RUN") {   // Running
+        _param[STATE] = RUNNING;
+      } else if (status == "USUSP") { // Suspended while running
+        _param[STATE] = PAUSED;
+      } else if (status == "SSUSP") { // Suspended by LSF
+        _param[STATE] = PAUSED;
+      } else if (status == "DONE") {  // Finished successfully
+        _param[STATE] = FINISHED;
+      } else if (status == "EXIT") {  // Finished in error
+        _param[STATE] = FAILED;
+      } else if (status == "UNKWN") { // Lost contact
+        _param[STATE] = FAILED;
+      } else if (status == "ZOMBI") { // Zombie
+        _param[STATE] = FAILED;
+      } else {
+        cerr << "Unknown job state code: " << status << endl;
+      }
+
+      if( status.find("RUN") != string::npos)
+        _running = true;
+    }
+  }
+
+  // Teste si un job est present en machine
+  bool JobInfo_LSF::isRunning() const
+  {
+    return _running;
+  }
+
+
+  // Destructeur
+  JobInfo_LSF::~JobInfo_LSF()
+  {
+    // Nothing to do
+  }
+
+  // Convertit une date HH:MM:SS en secondes
+  long JobInfo_LSF::HMStoLong(const string & s)
+  {
+    long hour, min, sec;
+
+    sscanf( s.c_str(), "%ld:%ld:%ld", &hour, &min, &sec);
+    return ( ( ( hour * 60L ) + min ) * 60L ) + sec;
+  }
+
+  // Methode pour l'interfacage avec Python (SWIG) : affichage en Python
+  string JobInfo_LSF::__str__() const
+  {
+    ostringstream sst;
+    sst << "<JobInfo_LSF (" << this << ") :" << endl;
+    sst << " ID = " <<_param[ID] << endl;
+    sst << " STATE = " <<_param[STATE] << endl;
+
+    return sst.str();
+  }
+
+
+}
diff --git a/src/LSF/JobInfo_LSF.hxx b/src/LSF/JobInfo_LSF.hxx
new file mode 100644 (file)
index 0000000..163d5de
--- /dev/null
@@ -0,0 +1,71 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * JobInfo_LSF.hxx :  emulation of LSF client
+ *
+ * Auteur : Bernard SECHER - CEA DEN
+ * Mail   : mailto:bernard.secher@cea.fr
+ * Date   : Thu Apr 24 10:17:22 2008
+ * Projet : PAL Salome 
+ *
+ */
+
+#ifndef _JOBINFO_LSF_H_
+#define _JOBINFO_LSF_H_
+
+#include "JobInfo.hxx"
+
+#include <string>
+
+namespace Batch {
+
+  class JobInfo_LSF : public JobInfo
+  {
+  public:
+    // Constructeurs et destructeur
+    JobInfo_LSF() : _running(false) {};
+    JobInfo_LSF(int id, const std::string & queryOutput);
+    virtual ~JobInfo_LSF();
+
+    // Constructeur par recopie
+    JobInfo_LSF(const JobInfo_LSF & jinfo) : JobInfo(jinfo) {};
+
+    // Teste si un job est present en machine
+    virtual bool isRunning() const;
+
+    // Methodes pour l'interfacage avec Python (SWIG)
+    // TODO : supprimer ces methodes et transferer leur definitions dans SWIG
+    std::string  __str__() const; // SWIG : affichage en Python
+    std::string  __repr__() const { return __str__(); }; // SWIG : affichage en Python
+
+  protected:
+    bool _running; // etat du job en machine
+
+  private:
+    // Convertit une date HH:MM:SS en secondes
+    long HMStoLong(const std::string &);
+
+  };
+
+}
+
+#endif
diff --git a/src/LoadLeveler/BatchManager_LL.cxx b/src/LoadLeveler/BatchManager_LL.cxx
new file mode 100644 (file)
index 0000000..1de7738
--- /dev/null
@@ -0,0 +1,274 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ *  BatchManager_LL.cxx :
+ *
+ *  Created on: 25 nov. 2010
+ *  Author : Renaud BARATE - EDF R&D
+ */
+
+#include <cstdlib>
+#include <iostream>
+#include <fstream>
+#include <sstream>
+
+#include <NotYetImplementedException.hxx>
+#include <Constants.hxx>
+#include <Utils.hxx>
+
+#include "FactBatchManager_LL.hxx"
+#include "BatchManager_LL.hxx"
+#include "JobInfo_LL.hxx"
+
+using namespace std;
+
+namespace Batch {
+
+  BatchManager_LL::BatchManager_LL(const FactBatchManager * parent, const char * host,
+                                     const char * username,
+                                     CommunicationProtocolType protocolType, const char * mpiImpl)
+    : BatchManager(parent, host, username, protocolType, mpiImpl)
+  {
+    // Nothing to do
+  }
+
+  BatchManager_LL::~BatchManager_LL()
+  {
+    // Nothing to do
+  }
+
+  // Method to submit a job to the batch manager
+  const JobId BatchManager_LL::submitJob(const Job & job)
+  {
+    Parametre params = job.getParametre();
+    const string workDir = params[WORKDIR];
+
+    // export input files on cluster
+    exportInputFiles(job);
+
+    // build command file to submit the job and copy it on the server
+    string cmdFile = buildCommandFile(job);
+
+    // define command to submit batch
+    string subCommand = string("cd ") + workDir + "; llsubmit " + cmdFile;
+    string command = _protocol.getExecCommand(subCommand, _hostname, _username);
+    cerr << command.c_str() << endl;
+
+    // submit job
+    string output;
+    int status = Utils::getCommandOutput(command, output);
+    cout << output;
+    if (status != 0) throw RunTimeException("Can't submit job, error was: " + output);
+
+    // find id of submitted job in output
+    string jobref;
+    istringstream idfile(output);
+    string line;
+    while (idfile && line.compare(0, 9, "llsubmit:") != 0)
+      getline(idfile, line);
+    if (line.compare(0, 9, "llsubmit:") == 0)
+    {
+      string::size_type p1 = line.find_first_of("\"");
+      string::size_type p2 = line.find_last_of("\"");
+      if (p1 != p2)
+        jobref = line.substr(p1 + 1, p2 - p1 - 1);
+    }
+    if (jobref.size() == 0)
+      throw RunTimeException("Error in the submission of the job on the remote host");
+
+    JobId id(this, jobref);
+    return id;
+  }
+
+  /**
+   * Create LoadLeveler command file and copy it on the server.
+   * Return the name of the remote file.
+   */
+  string BatchManager_LL::buildCommandFile(const Job & job)
+  {
+    Parametre params = job.getParametre();
+
+    // Job Parameters
+    string workDir = "";
+    string fileToExecute = "";
+    string queue = "";
+
+    // Mandatory parameters
+    if (params.find(WORKDIR) != params.end()) 
+      workDir = params[WORKDIR].str();
+    else 
+      throw RunTimeException("params[WORKDIR] is not defined. Please define it, cannot submit this job.");
+    if (params.find(EXECUTABLE) != params.end()) 
+      fileToExecute = params[EXECUTABLE].str();
+    else 
+      throw RunTimeException("params[EXECUTABLE] is not defined. Please define it, cannot submit this job.");
+
+    string::size_type p1 = fileToExecute.find_last_of("/");
+    string::size_type p2 = fileToExecute.find_last_of(".");
+    string rootNameToExecute = fileToExecute.substr(p1+1,p2-p1-1);
+    string fileNameToExecute = fileToExecute.substr(p1+1);
+
+    // Create batch submit file
+    ofstream tempOutputFile;
+    string tmpFileName = Utils::createAndOpenTemporaryFile("LL-script", tempOutputFile);
+
+    tempOutputFile << "#!/bin/bash" << endl;
+    tempOutputFile << "# @ output = " << workDir << "/logs/output.log." << rootNameToExecute << endl;
+    tempOutputFile << "# @ error = " << workDir << "/logs/error.log." << rootNameToExecute << endl;
+
+    if (params.find(NAME) != params.end())
+      tempOutputFile << "# @ job_name = " << params[NAME] << endl;
+
+    // Optional parameters
+    int nbproc = 1;
+    if (params.find(NBPROC) != params.end())
+      nbproc = params[NBPROC];
+    int nbprocpernode = 1;
+    if (params.find(NBPROCPERNODE) != params.end())
+      nbprocpernode = params[NBPROCPERNODE];
+
+    if (params.find(EXCLUSIVE) != params.end()) {
+      if (params[EXCLUSIVE])
+        tempOutputFile << "# @ node_usage = not_shared" << endl;
+      else
+        tempOutputFile << "# @ node_usage = shared" << endl;
+    }
+
+    // If job type is not specified, try to guess it from number of procs
+    string job_type;
+    if (params.find(LL_JOBTYPE) != params.end())
+      job_type = params[LL_JOBTYPE].str();
+    else if (nbproc == 1)
+      job_type = "serial";
+    else
+      job_type = "mpich";
+
+    tempOutputFile << "# @ job_type = " << job_type << endl;
+
+    if (job_type == "mpich") {
+      int nodes_requested = (nbproc + nbprocpernode -1) / nbprocpernode;
+      tempOutputFile << "# @ node = " << nodes_requested << endl;
+      tempOutputFile << "# @ total_tasks = " << nbproc << endl;
+    }
+
+    if (params.find(MAXWALLTIME) != params.end())
+      tempOutputFile << "# @ wall_clock_limit = " << params[MAXWALLTIME] << ":00" << endl;
+    if (params.find(MAXRAMSIZE) != params.end())
+      tempOutputFile << "# @ as_limit = " << params[MAXRAMSIZE] << "mb" << endl;
+    if (params.find(QUEUE) != params.end())
+      tempOutputFile << "# @ class = " << params[QUEUE] << endl;
+
+    // Define environment for the job
+    Environnement env = job.getEnvironnement();
+    if (!env.empty()) {
+      tempOutputFile << "# @ environment = ";
+      Environnement::const_iterator iter;
+      for (iter = env.begin() ; iter != env.end() ; ++iter) {
+        tempOutputFile << iter->first << "=" << iter->second << "; ";
+      }
+      tempOutputFile << endl;
+    }
+
+    tempOutputFile << "# @ queue" << endl;
+
+    // generate nodes file
+    tempOutputFile << "export LIBBATCH_NODEFILE=$LOADL_HOSTFILE" << endl;
+
+    // Launch the executable
+    tempOutputFile << "cd " << workDir << endl;
+    tempOutputFile << "./" + fileNameToExecute << endl;
+
+    tempOutputFile.flush();
+    tempOutputFile.close();
+
+    cerr << "Batch script file generated is: " << tmpFileName << endl;
+
+    string remoteFileName = rootNameToExecute + "_LL.cmd";
+    int status = _protocol.copyFile(tmpFileName, "", "",
+                                    workDir + "/" + remoteFileName,
+                                    _hostname, _username);
+    if (status)
+      throw RunTimeException("Cannot copy command file on host " + _hostname);
+
+    return remoteFileName;
+  }
+
+  void BatchManager_LL::deleteJob(const JobId & jobid)
+  {
+    // define command to delete job
+    string subCommand = "llcancel " + jobid.getReference();
+    string command = _protocol.getExecCommand(subCommand, _hostname, _username);
+    cerr << command.c_str() << endl;
+
+    int status = system(command.c_str());
+    if (status)
+      throw RunTimeException("Can't delete job " + jobid.getReference());
+
+    cerr << "job " << jobid.getReference() << " killed" << endl;
+  }
+
+  void BatchManager_LL::holdJob(const JobId & jobid)
+  {
+    throw NotYetImplementedException("BatchManager_LL::holdJob");
+  }
+
+  void BatchManager_LL::releaseJob(const JobId & jobid)
+  {
+    throw NotYetImplementedException("BatchManager_LL::releaseJob");
+  }
+
+  void BatchManager_LL::alterJob(const JobId & jobid, const Parametre & param, const Environnement & env)
+  {
+    throw NotYetImplementedException("BatchManager_LL::alterJob");
+  }
+
+  void BatchManager_LL::alterJob(const JobId & jobid, const Parametre & param)
+  {
+    throw NotYetImplementedException("BatchManager_LL::alterJob");
+  }
+
+  void BatchManager_LL::alterJob(const JobId & jobid, const Environnement & env)
+  {
+    throw NotYetImplementedException("BatchManager_LL::alterJob");
+  }
+
+  JobInfo BatchManager_LL::queryJob(const JobId & jobid)
+  {
+    // define command to query batch
+    string subCommand = "llq -f %st " + jobid.getReference();
+    string command = _protocol.getExecCommand(subCommand, _hostname, _username);
+    cerr << command.c_str() << endl;
+    string output;
+    int status = Utils::getCommandOutput(command, output);
+    if (status != 0)
+      throw RunTimeException("Can't query job " + jobid.getReference());
+
+    JobInfo_LL jobinfo = JobInfo_LL(jobid.getReference(), output);
+    return jobinfo;
+  }
+
+  const JobId BatchManager_LL::addJob(const Job & job, const string reference)
+  {
+    return JobId(this, reference);
+  }
+
+}
diff --git a/src/LoadLeveler/BatchManager_LL.hxx b/src/LoadLeveler/BatchManager_LL.hxx
new file mode 100644 (file)
index 0000000..fe805de
--- /dev/null
@@ -0,0 +1,68 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ *  BatchManager_LL.hxx :
+ *
+ *  Created on: 25 nov. 2010
+ *  Author : Renaud BARATE - EDF R&D
+ */
+
+#ifndef _BATCHMANAGER_ELL_H_
+#define _BATCHMANAGER_ELL_H_
+
+#include <string>
+
+#include "Defines.hxx"
+#include "JobId.hxx"
+#include "JobInfo.hxx"
+#include "FactBatchManager.hxx"
+#include "BatchManager.hxx"
+
+namespace Batch {
+
+  class BATCH_EXPORT BatchManager_LL : public BatchManager
+  {
+  public:
+    BatchManager_LL(const FactBatchManager * parent, const char * host = "localhost",
+                     const char * username = "",
+                     CommunicationProtocolType protocolType = SSH, const char * mpiImpl = "nompi");
+    virtual ~BatchManager_LL();
+
+    // Methods to control jobs
+    virtual const JobId submitJob(const Job & job);
+    virtual void deleteJob(const JobId & jobid);
+    virtual void holdJob(const JobId & jobid);
+    virtual void releaseJob(const JobId & jobid);
+    virtual void alterJob(const JobId & jobid, const Parametre & param, const Environnement & env);
+    virtual void alterJob(const JobId & jobid, const Parametre & param);
+    virtual void alterJob(const JobId & jobid, const Environnement & env);
+    virtual JobInfo queryJob(const JobId & jobid);
+    virtual const JobId addJob(const Job & job, const std::string reference);
+
+  protected:
+    std::string buildCommandFile(const Job & job);
+
+  };
+
+}
+
+#endif
diff --git a/src/LoadLeveler/Batch_BatchManager_eLL.cxx b/src/LoadLeveler/Batch_BatchManager_eLL.cxx
deleted file mode 100644 (file)
index fc729bf..0000000
+++ /dev/null
@@ -1,274 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- *  Batch_BatchManager_eLL.cxx :
- *
- *  Created on: 25 nov. 2010
- *  Author : Renaud BARATE - EDF R&D
- */
-
-#include <cstdlib>
-#include <iostream>
-#include <fstream>
-#include <sstream>
-
-#include <Batch_NotYetImplementedException.hxx>
-#include <Batch_Constants.hxx>
-#include <Batch_Utils.hxx>
-
-#include "Batch_FactBatchManager_eLL.hxx"
-#include "Batch_BatchManager_eLL.hxx"
-#include "Batch_JobInfo_eLL.hxx"
-
-using namespace std;
-
-namespace Batch {
-
-  BatchManager_eLL::BatchManager_eLL(const FactBatchManager * parent, const char * host,
-                                     const char * username,
-                                     CommunicationProtocolType protocolType, const char * mpiImpl)
-    : BatchManager(parent, host, username, protocolType, mpiImpl)
-  {
-    // Nothing to do
-  }
-
-  BatchManager_eLL::~BatchManager_eLL()
-  {
-    // Nothing to do
-  }
-
-  // Method to submit a job to the batch manager
-  const JobId BatchManager_eLL::submitJob(const Job & job)
-  {
-    Parametre params = job.getParametre();
-    const string workDir = params[WORKDIR];
-
-    // export input files on cluster
-    exportInputFiles(job);
-
-    // build command file to submit the job and copy it on the server
-    string cmdFile = buildCommandFile(job);
-
-    // define command to submit batch
-    string subCommand = string("cd ") + workDir + "; llsubmit " + cmdFile;
-    string command = _protocol.getExecCommand(subCommand, _hostname, _username);
-    cerr << command.c_str() << endl;
-
-    // submit job
-    string output;
-    int status = Utils::getCommandOutput(command, output);
-    cout << output;
-    if (status != 0) throw RunTimeException("Can't submit job, error was: " + output);
-
-    // find id of submitted job in output
-    string jobref;
-    istringstream idfile(output);
-    string line;
-    while (idfile && line.compare(0, 9, "llsubmit:") != 0)
-      getline(idfile, line);
-    if (line.compare(0, 9, "llsubmit:") == 0)
-    {
-      string::size_type p1 = line.find_first_of("\"");
-      string::size_type p2 = line.find_last_of("\"");
-      if (p1 != p2)
-        jobref = line.substr(p1 + 1, p2 - p1 - 1);
-    }
-    if (jobref.size() == 0)
-      throw RunTimeException("Error in the submission of the job on the remote host");
-
-    JobId id(this, jobref);
-    return id;
-  }
-
-  /**
-   * Create LoadLeveler command file and copy it on the server.
-   * Return the name of the remote file.
-   */
-  string BatchManager_eLL::buildCommandFile(const Job & job)
-  {
-    Parametre params = job.getParametre();
-
-    // Job Parameters
-    string workDir = "";
-    string fileToExecute = "";
-    string queue = "";
-
-    // Mandatory parameters
-    if (params.find(WORKDIR) != params.end()) 
-      workDir = params[WORKDIR].str();
-    else 
-      throw RunTimeException("params[WORKDIR] is not defined. Please define it, cannot submit this job.");
-    if (params.find(EXECUTABLE) != params.end()) 
-      fileToExecute = params[EXECUTABLE].str();
-    else 
-      throw RunTimeException("params[EXECUTABLE] is not defined. Please define it, cannot submit this job.");
-
-    string::size_type p1 = fileToExecute.find_last_of("/");
-    string::size_type p2 = fileToExecute.find_last_of(".");
-    string rootNameToExecute = fileToExecute.substr(p1+1,p2-p1-1);
-    string fileNameToExecute = fileToExecute.substr(p1+1);
-
-    // Create batch submit file
-    ofstream tempOutputFile;
-    string tmpFileName = Utils::createAndOpenTemporaryFile("LL-script", tempOutputFile);
-
-    tempOutputFile << "#!/bin/bash" << endl;
-    tempOutputFile << "# @ output = " << workDir << "/logs/output.log." << rootNameToExecute << endl;
-    tempOutputFile << "# @ error = " << workDir << "/logs/error.log." << rootNameToExecute << endl;
-
-    if (params.find(NAME) != params.end())
-      tempOutputFile << "# @ job_name = " << params[NAME] << endl;
-
-    // Optional parameters
-    int nbproc = 1;
-    if (params.find(NBPROC) != params.end())
-      nbproc = params[NBPROC];
-    int nbprocpernode = 1;
-    if (params.find(NBPROCPERNODE) != params.end())
-      nbprocpernode = params[NBPROCPERNODE];
-
-    if (params.find(EXCLUSIVE) != params.end()) {
-      if (params[EXCLUSIVE])
-        tempOutputFile << "# @ node_usage = not_shared" << endl;
-      else
-        tempOutputFile << "# @ node_usage = shared" << endl;
-    }
-
-    // If job type is not specified, try to guess it from number of procs
-    string job_type;
-    if (params.find(LL_JOBTYPE) != params.end())
-      job_type = params[LL_JOBTYPE].str();
-    else if (nbproc == 1)
-      job_type = "serial";
-    else
-      job_type = "mpich";
-
-    tempOutputFile << "# @ job_type = " << job_type << endl;
-
-    if (job_type == "mpich") {
-      int nodes_requested = (nbproc + nbprocpernode -1) / nbprocpernode;
-      tempOutputFile << "# @ node = " << nodes_requested << endl;
-      tempOutputFile << "# @ total_tasks = " << nbproc << endl;
-    }
-
-    if (params.find(MAXWALLTIME) != params.end())
-      tempOutputFile << "# @ wall_clock_limit = " << params[MAXWALLTIME] << ":00" << endl;
-    if (params.find(MAXRAMSIZE) != params.end())
-      tempOutputFile << "# @ as_limit = " << params[MAXRAMSIZE] << "mb" << endl;
-    if (params.find(QUEUE) != params.end())
-      tempOutputFile << "# @ class = " << params[QUEUE] << endl;
-
-    // Define environment for the job
-    Environnement env = job.getEnvironnement();
-    if (!env.empty()) {
-      tempOutputFile << "# @ environment = ";
-      Environnement::const_iterator iter;
-      for (iter = env.begin() ; iter != env.end() ; ++iter) {
-        tempOutputFile << iter->first << "=" << iter->second << "; ";
-      }
-      tempOutputFile << endl;
-    }
-
-    tempOutputFile << "# @ queue" << endl;
-
-    // generate nodes file
-    tempOutputFile << "export LIBBATCH_NODEFILE=$LOADL_HOSTFILE" << endl;
-
-    // Launch the executable
-    tempOutputFile << "cd " << workDir << endl;
-    tempOutputFile << "./" + fileNameToExecute << endl;
-
-    tempOutputFile.flush();
-    tempOutputFile.close();
-
-    cerr << "Batch script file generated is: " << tmpFileName << endl;
-
-    string remoteFileName = rootNameToExecute + "_LL.cmd";
-    int status = _protocol.copyFile(tmpFileName, "", "",
-                                    workDir + "/" + remoteFileName,
-                                    _hostname, _username);
-    if (status)
-      throw RunTimeException("Cannot copy command file on host " + _hostname);
-
-    return remoteFileName;
-  }
-
-  void BatchManager_eLL::deleteJob(const JobId & jobid)
-  {
-    // define command to delete job
-    string subCommand = "llcancel " + jobid.getReference();
-    string command = _protocol.getExecCommand(subCommand, _hostname, _username);
-    cerr << command.c_str() << endl;
-
-    int status = system(command.c_str());
-    if (status)
-      throw RunTimeException("Can't delete job " + jobid.getReference());
-
-    cerr << "job " << jobid.getReference() << " killed" << endl;
-  }
-
-  void BatchManager_eLL::holdJob(const JobId & jobid)
-  {
-    throw NotYetImplementedException("BatchManager_eLL::holdJob");
-  }
-
-  void BatchManager_eLL::releaseJob(const JobId & jobid)
-  {
-    throw NotYetImplementedException("BatchManager_eLL::releaseJob");
-  }
-
-  void BatchManager_eLL::alterJob(const JobId & jobid, const Parametre & param, const Environnement & env)
-  {
-    throw NotYetImplementedException("BatchManager_eLL::alterJob");
-  }
-
-  void BatchManager_eLL::alterJob(const JobId & jobid, const Parametre & param)
-  {
-    throw NotYetImplementedException("BatchManager_eLL::alterJob");
-  }
-
-  void BatchManager_eLL::alterJob(const JobId & jobid, const Environnement & env)
-  {
-    throw NotYetImplementedException("BatchManager_eLL::alterJob");
-  }
-
-  JobInfo BatchManager_eLL::queryJob(const JobId & jobid)
-  {
-    // define command to query batch
-    string subCommand = "llq -f %st " + jobid.getReference();
-    string command = _protocol.getExecCommand(subCommand, _hostname, _username);
-    cerr << command.c_str() << endl;
-    string output;
-    int status = Utils::getCommandOutput(command, output);
-    if (status != 0)
-      throw RunTimeException("Can't query job " + jobid.getReference());
-
-    JobInfo_eLL jobinfo = JobInfo_eLL(jobid.getReference(), output);
-    return jobinfo;
-  }
-
-  const JobId BatchManager_eLL::addJob(const Job & job, const string reference)
-  {
-    return JobId(this, reference);
-  }
-
-}
diff --git a/src/LoadLeveler/Batch_BatchManager_eLL.hxx b/src/LoadLeveler/Batch_BatchManager_eLL.hxx
deleted file mode 100644 (file)
index 9b6ae95..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- *  Batch_BatchManager_eLL.hxx :
- *
- *  Created on: 25 nov. 2010
- *  Author : Renaud BARATE - EDF R&D
- */
-
-#ifndef _BATCHMANAGER_ELL_H_
-#define _BATCHMANAGER_ELL_H_
-
-#include <string>
-
-#include "Batch_Defines.hxx"
-#include "Batch_JobId.hxx"
-#include "Batch_JobInfo.hxx"
-#include "Batch_FactBatchManager.hxx"
-#include "Batch_BatchManager.hxx"
-
-namespace Batch {
-
-  class BATCH_EXPORT BatchManager_eLL : public BatchManager
-  {
-  public:
-    BatchManager_eLL(const FactBatchManager * parent, const char * host = "localhost",
-                     const char * username = "",
-                     CommunicationProtocolType protocolType = SSH, const char * mpiImpl = "nompi");
-    virtual ~BatchManager_eLL();
-
-    // Methods to control jobs
-    virtual const JobId submitJob(const Job & job);
-    virtual void deleteJob(const JobId & jobid);
-    virtual void holdJob(const JobId & jobid);
-    virtual void releaseJob(const JobId & jobid);
-    virtual void alterJob(const JobId & jobid, const Parametre & param, const Environnement & env);
-    virtual void alterJob(const JobId & jobid, const Parametre & param);
-    virtual void alterJob(const JobId & jobid, const Environnement & env);
-    virtual JobInfo queryJob(const JobId & jobid);
-    virtual const JobId addJob(const Job & job, const std::string reference);
-
-  protected:
-    std::string buildCommandFile(const Job & job);
-
-  };
-
-}
-
-#endif
diff --git a/src/LoadLeveler/Batch_FactBatchManager_eLL.cxx b/src/LoadLeveler/Batch_FactBatchManager_eLL.cxx
deleted file mode 100644 (file)
index 7ca8532..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- *  Batch_FactBatchManager_eLL.cxx :
- *
- *  Created on: 25 nov. 2010
- *  Author : Renaud BARATE - EDF R&D
- */
-
-#include "Batch_ParameterTypeMap.hxx"
-#include "Batch_BatchManager_eLL.hxx"
-#include "Batch_FactBatchManager_eLL.hxx"
-
-namespace Batch {
-
-  def_Constant(LL_JOBTYPE);
-
-  static FactBatchManager_eLL sFBM_eLL;
-
-  FactBatchManager_eLL::FactBatchManager_eLL() : FactBatchManager("LL")
-  {
-    // Add specific parameters
-    ParameterTypeMap::getInstance().addParameter(LL_JOBTYPE, STRING, 1);
-  }
-
-  FactBatchManager_eLL::~FactBatchManager_eLL()
-  {
-    // Nothing to do
-  }
-
-  BatchManager * FactBatchManager_eLL::operator() (const char * hostname,
-                                                   const char * username,
-                                                   CommunicationProtocolType protocolType,
-                                                   const char * mpiImpl) const
-  {
-    // MESSAGE("Building new BatchManager_eLL on host '" << hostname << "'");
-    return new BatchManager_eLL(this, hostname, username, protocolType, mpiImpl);
-  }
-
-}
diff --git a/src/LoadLeveler/Batch_FactBatchManager_eLL.hxx b/src/LoadLeveler/Batch_FactBatchManager_eLL.hxx
deleted file mode 100644 (file)
index c0448f7..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- *  Batch_FactBatchManager_eLL.hxx :
- *
- *  Created on: 25 nov. 2010
- *  Author : Renaud BARATE - EDF R&D
- */
-
-#ifndef _FACTBATCHMANAGER_ELL_H_
-#define _FACTBATCHMANAGER_ELL_H_
-
-#include <Batch_Defines.hxx>
-#include <Batch_Constants.hxx>
-
-#include "Batch_BatchManager.hxx"
-#include "Batch_FactBatchManager.hxx"
-
-namespace Batch {
-
-  decl_extern_Constant(LL_JOBTYPE);
-
-  class BatchManager_eLL;
-
-  class BATCH_EXPORT FactBatchManager_eLL : public FactBatchManager
-  {
-  public:
-    // Constructeur et destructeur
-    FactBatchManager_eLL();
-    virtual ~FactBatchManager_eLL();
-
-    virtual BatchManager * operator() (const char * hostname,
-                                       const char * username,
-                                       CommunicationProtocolType protocolType,
-                                       const char * mpiImpl) const;
-  };
-
-}
-
-#endif
diff --git a/src/LoadLeveler/Batch_JobInfo_eLL.cxx b/src/LoadLeveler/Batch_JobInfo_eLL.cxx
deleted file mode 100644 (file)
index 59ab7d2..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- *  Batch_JobInfo_eLL.cxx :
- *
- *  Created on: 30 nov. 2010
- *  Author : Renaud BARATE - EDF R&D
- */
-
-#include <iostream>
-#include <sstream>
-
-#include <Batch_RunTimeException.hxx>
-#include <Batch_Constants.hxx>
-
-#include "Batch_JobInfo_eLL.hxx"
-
-using namespace std;
-
-namespace Batch {
-
-  JobInfo_eLL::JobInfo_eLL(const std::string & id, const std::string & output)
-    : JobInfo()
-  {
-    _param[ID] = id;
-
-    // read log file
-    istringstream log(output);
-    string line;
-
-    // status should be on the third line
-    for (int i=0 ; i<3 ; i++)
-      getline(log, line);
-    string status;
-    istringstream iss(line);
-    iss >> status;
-
-    if (status.size() == 0) {
-      // On some batch managers, the job is deleted as soon as it is finished,
-      // so we have to consider that an unknown job is a finished one, even if
-      // it is not always true.
-      _param[STATE] = FINISHED;
-    } else if (status == "C") { // Completed
-      _param[STATE] = FINISHED;
-    } else if (status == "R") { // Running
-      _param[STATE] = RUNNING;
-    } else if (status == "I") { // Idle
-      _param[STATE] = QUEUED;
-    } else if (status == "CA") { // Canceled
-      _param[STATE] = FAILED;
-    } else if (status == "CK") { // Checkpointing
-      _param[STATE] = RUNNING;
-    } else if (status == "CP") { // Complete Pending
-      _param[STATE] = RUNNING;
-    } else if (status == "D") { // Deferred
-      _param[STATE] = QUEUED;
-    } else if (status == "NQ") { // Not Queued
-      _param[STATE] = QUEUED;
-    } else if (status == "NR") { // Not Run
-      _param[STATE] = FAILED;
-    } else if (status == "P") { // Pending
-      _param[STATE] = RUNNING;
-    } else if (status == "E") { // Preempted
-      _param[STATE] = RUNNING;
-    } else if (status == "EP") { // Preempt Pending
-      _param[STATE] = RUNNING;
-    } else if (status == "X") { // Rejected
-      _param[STATE] = FAILED;
-    } else if (status == "XP") { // Reject Pending
-      _param[STATE] = QUEUED;
-    } else if (status == "RM") { // Removed
-      _param[STATE] = FAILED;
-    } else if (status == "RP") { // Remove Pending
-      _param[STATE] = FAILED;
-    } else if (status == "MP") { // Resume Pending
-      _param[STATE] = RUNNING;
-    } else if (status == "ST") { // Starting
-      _param[STATE] = RUNNING;
-    } else if (status == "S") { // System Hold
-      _param[STATE] = PAUSED;
-    } else if (status == "TX") { // Terminated
-      _param[STATE] = FAILED;
-    } else if (status == "HS") { // User & System Hold
-      _param[STATE] = PAUSED;
-    } else if (status == "H") { // User Hold
-      _param[STATE] = PAUSED;
-    } else if (status == "V") { // Vacated
-      _param[STATE] = FAILED;
-    } else if (status == "VP") { // Vacate Pending
-      _param[STATE] = FAILED;
-    } else {
-      throw RunTimeException("Unknown job state code: \"" + status + "\"");
-    }
-  }
-
-  JobInfo_eLL::~JobInfo_eLL()
-  {
-    // Nothing to do
-  }
-
-}
diff --git a/src/LoadLeveler/Batch_JobInfo_eLL.hxx b/src/LoadLeveler/Batch_JobInfo_eLL.hxx
deleted file mode 100644 (file)
index ab89129..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- *  Batch_JobInfo_eLL.hxx :
- *
- *  Created on: 30 nov. 2010
- *  Author : Renaud BARATE - EDF R&D
- */
-
-#ifndef _JOBINFO_ELL_H_
-#define _JOBINFO_ELL_H_
-
-#include <string>
-
-#include <Batch_JobInfo.hxx>
-
-namespace Batch {
-
-  class JobInfo_eLL : public JobInfo
-  {
-  public:
-    JobInfo_eLL(const std::string & id, const std::string & output);
-    virtual ~JobInfo_eLL();
-
-  };
-
-}
-
-#endif
index aa8445fabcb312c0471d99ecf7f8c239912d00a9..c3e336a4df3d98afc4f580e7e7b6f7db1094b04f 100644 (file)
@@ -20,9 +20,9 @@
 #  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-SET(CLASS_LIST LoadLeveler/Batch_BatchManager_eLL
-               LoadLeveler/Batch_FactBatchManager_eLL
-               LoadLeveler/Batch_JobInfo_eLL
+SET(CLASS_LIST LoadLeveler/BatchManager_LL
+               LoadLeveler/FactBatchManager_LL
+               LoadLeveler/JobInfo_LL
    )
 
 APPEND_CLASSES_TO_SRC_FILES(${CLASS_LIST})
diff --git a/src/LoadLeveler/FactBatchManager_LL.cxx b/src/LoadLeveler/FactBatchManager_LL.cxx
new file mode 100644 (file)
index 0000000..501118d
--- /dev/null
@@ -0,0 +1,59 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ *  FactBatchManager_LL.cxx :
+ *
+ *  Created on: 25 nov. 2010
+ *  Author : Renaud BARATE - EDF R&D
+ */
+
+#include "ParameterTypeMap.hxx"
+#include "BatchManager_LL.hxx"
+#include "FactBatchManager_LL.hxx"
+
+namespace Batch {
+
+  def_Constant(LL_JOBTYPE);
+
+  static FactBatchManager_LL sFBM_LL;
+
+  FactBatchManager_LL::FactBatchManager_LL() : FactBatchManager("LL")
+  {
+    // Add specific parameters
+    ParameterTypeMap::getInstance().addParameter(LL_JOBTYPE, STRING, 1);
+  }
+
+  FactBatchManager_LL::~FactBatchManager_LL()
+  {
+    // Nothing to do
+  }
+
+  BatchManager * FactBatchManager_LL::operator() (const char * hostname,
+                                                   const char * username,
+                                                   CommunicationProtocolType protocolType,
+                                                   const char * mpiImpl) const
+  {
+    // MESSAGE("Building new BatchManager_LL on host '" << hostname << "'");
+    return new BatchManager_LL(this, hostname, username, protocolType, mpiImpl);
+  }
+
+}
diff --git a/src/LoadLeveler/FactBatchManager_LL.hxx b/src/LoadLeveler/FactBatchManager_LL.hxx
new file mode 100644 (file)
index 0000000..de5e242
--- /dev/null
@@ -0,0 +1,59 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ *  FactBatchManager_LL.hxx :
+ *
+ *  Created on: 25 nov. 2010
+ *  Author : Renaud BARATE - EDF R&D
+ */
+
+#ifndef _FACTBATCHMANAGER_ELL_H_
+#define _FACTBATCHMANAGER_ELL_H_
+
+#include <Defines.hxx>
+#include <Constants.hxx>
+
+#include "BatchManager.hxx"
+#include "FactBatchManager.hxx"
+
+namespace Batch {
+
+  decl_extern_Constant(LL_JOBTYPE);
+
+  class BatchManager_LL;
+
+  class BATCH_EXPORT FactBatchManager_LL : public FactBatchManager
+  {
+  public:
+    // Constructeur et destructeur
+    FactBatchManager_LL();
+    virtual ~FactBatchManager_LL();
+
+    virtual BatchManager * operator() (const char * hostname,
+                                       const char * username,
+                                       CommunicationProtocolType protocolType,
+                                       const char * mpiImpl) const;
+  };
+
+}
+
+#endif
diff --git a/src/LoadLeveler/JobInfo_LL.cxx b/src/LoadLeveler/JobInfo_LL.cxx
new file mode 100644 (file)
index 0000000..188f6b8
--- /dev/null
@@ -0,0 +1,120 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ *  JobInfo_LL.cxx :
+ *
+ *  Created on: 30 nov. 2010
+ *  Author : Renaud BARATE - EDF R&D
+ */
+
+#include <iostream>
+#include <sstream>
+
+#include <RunTimeException.hxx>
+#include <Constants.hxx>
+
+#include "JobInfo_LL.hxx"
+
+using namespace std;
+
+namespace Batch {
+
+  JobInfo_LL::JobInfo_LL(const std::string & id, const std::string & output)
+    : JobInfo()
+  {
+    _param[ID] = id;
+
+    // read log file
+    istringstream log(output);
+    string line;
+
+    // status should be on the third line
+    for (int i=0 ; i<3 ; i++)
+      getline(log, line);
+    string status;
+    istringstream iss(line);
+    iss >> status;
+
+    if (status.size() == 0) {
+      // On some batch managers, the job is deleted as soon as it is finished,
+      // so we have to consider that an unknown job is a finished one, even if
+      // it is not always true.
+      _param[STATE] = FINISHED;
+    } else if (status == "C") { // Completed
+      _param[STATE] = FINISHED;
+    } else if (status == "R") { // Running
+      _param[STATE] = RUNNING;
+    } else if (status == "I") { // Idle
+      _param[STATE] = QUEUED;
+    } else if (status == "CA") { // Canceled
+      _param[STATE] = FAILED;
+    } else if (status == "CK") { // Checkpointing
+      _param[STATE] = RUNNING;
+    } else if (status == "CP") { // Complete Pending
+      _param[STATE] = RUNNING;
+    } else if (status == "D") { // Deferred
+      _param[STATE] = QUEUED;
+    } else if (status == "NQ") { // Not Queued
+      _param[STATE] = QUEUED;
+    } else if (status == "NR") { // Not Run
+      _param[STATE] = FAILED;
+    } else if (status == "P") { // Pending
+      _param[STATE] = RUNNING;
+    } else if (status == "E") { // Preempted
+      _param[STATE] = RUNNING;
+    } else if (status == "EP") { // Preempt Pending
+      _param[STATE] = RUNNING;
+    } else if (status == "X") { // Rejected
+      _param[STATE] = FAILED;
+    } else if (status == "XP") { // Reject Pending
+      _param[STATE] = QUEUED;
+    } else if (status == "RM") { // Removed
+      _param[STATE] = FAILED;
+    } else if (status == "RP") { // Remove Pending
+      _param[STATE] = FAILED;
+    } else if (status == "MP") { // Resume Pending
+      _param[STATE] = RUNNING;
+    } else if (status == "ST") { // Starting
+      _param[STATE] = RUNNING;
+    } else if (status == "S") { // System Hold
+      _param[STATE] = PAUSED;
+    } else if (status == "TX") { // Terminated
+      _param[STATE] = FAILED;
+    } else if (status == "HS") { // User & System Hold
+      _param[STATE] = PAUSED;
+    } else if (status == "H") { // User Hold
+      _param[STATE] = PAUSED;
+    } else if (status == "V") { // Vacated
+      _param[STATE] = FAILED;
+    } else if (status == "VP") { // Vacate Pending
+      _param[STATE] = FAILED;
+    } else {
+      throw RunTimeException("Unknown job state code: \"" + status + "\"");
+    }
+  }
+
+  JobInfo_LL::~JobInfo_LL()
+  {
+    // Nothing to do
+  }
+
+}
diff --git a/src/LoadLeveler/JobInfo_LL.hxx b/src/LoadLeveler/JobInfo_LL.hxx
new file mode 100644 (file)
index 0000000..770bc5c
--- /dev/null
@@ -0,0 +1,48 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ *  JobInfo_LL.hxx :
+ *
+ *  Created on: 30 nov. 2010
+ *  Author : Renaud BARATE - EDF R&D
+ */
+
+#ifndef _JOBINFO_ELL_H_
+#define _JOBINFO_ELL_H_
+
+#include <string>
+
+#include <JobInfo.hxx>
+
+namespace Batch {
+
+  class JobInfo_LL : public JobInfo
+  {
+  public:
+    JobInfo_LL(const std::string & id, const std::string & output);
+    virtual ~JobInfo_LL();
+
+  };
+
+}
+
+#endif
index f3d24a3586e1c352ce21c28ddc988afc7dfe3b89..fc37b3e1471599e071a90e747b5da77b6e2e42bb 100644 (file)
@@ -32,13 +32,13 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
 include_directories(${CMAKE_CURRENT_BINARY_DIR})
 
 # Build the test programs and add the tests
-add_executable(Test_eLL Test_eLL.cxx)
-target_link_libraries(Test_eLL batch SimpleParser)
+add_executable(Test_LL Test_LL.cxx)
+target_link_libraries(Test_LL batch SimpleParser)
 
 IF (HAS_SSH)
-    ADD_TEST(eLL_SSH Test_eLL SSH)
+    ADD_TEST(LL_SSH Test_LL SSH)
 ENDIF (HAS_SSH)
 
 #IF (HAS_RSH)
-#    ADD_TEST(eLL_RSH Test_eLL RSH)
+#    ADD_TEST(LL_RSH Test_LL RSH)
 #ENDIF (HAS_RSH)
diff --git a/src/LoadLeveler/Test/Test_LL.cxx b/src/LoadLeveler/Test/Test_LL.cxx
new file mode 100644 (file)
index 0000000..2bad912
--- /dev/null
@@ -0,0 +1,165 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * Test_PBS.cxx :
+ *
+ * Author : Renaud BARATE - EDF R&D
+ * Date   : April 2009
+ *
+ */
+
+#include <iostream>
+#include <fstream>
+#include <cstring>
+
+#include <Constants.hxx>
+#include <Job.hxx>
+#include <BatchManagerCatalog.hxx>
+#include <FactBatchManager.hxx>
+#include <FactBatchManager_LL.hxx>
+#include <BatchManager.hxx>
+
+#include <SimpleParser.hxx>
+
+using namespace std;
+using namespace Batch;
+
+void print_usage()
+{
+  cout << "usage: Test_LL PROTOCOL" << endl;
+  cout << "    PROTOCOL      \"SSH\" or \"RSH\"" << endl;
+}
+
+int main(int argc, char** argv)
+{
+  // Parse argument
+  if (argc != 2) {
+    print_usage();
+    return 1;
+  }
+  CommunicationProtocolType protocol;
+  if (strcmp(argv[1], "SSH") == 0)
+    protocol = SSH;
+  else if (strcmp(argv[1], "RSH") == 0)
+    protocol = RSH;
+  else {
+    print_usage();
+    return 1;
+  }
+
+  cout << "*******************************************************************************************" << endl;
+  cout << "This program tests the batch submission based on LoadLeveler emulation. Passwordless" << endl;
+  cout << "authentication must be used for this test to pass. For SSH, this can be configured with" << endl;
+  cout << "ssh-agent for instance. For RSH, this can be configured with the .rhosts file." << endl;
+  cout << "*******************************************************************************************" << endl;
+
+  // eventually remove any previous result
+  remove("result.txt");
+
+  try {
+    // Parse the test configuration file
+    SimpleParser parser;
+    parser.parseTestConfigFile();
+    const string & homedir = parser.getValue("TEST_ELL_HOMEDIR");
+    const string & host = parser.getValue("TEST_ELL_HOST");
+    const string & user = parser.getValue("TEST_ELL_USER");
+    const string & queue = parser.getValue("TEST_ELL_QUEUE");
+    const string & jobType = parser.getValue("TEST_ELL_JOBTYPE");
+    int timeout = parser.getValueAsInt("TEST_ELL_TIMEOUT");
+
+    // Define the job...
+    Job job;
+    // ... and its parameters ...
+    Parametre p;
+    p[EXECUTABLE]    = "./test-script.sh";
+    p[NAME]          = string("Test_LL_") + argv[1];
+    p[WORKDIR]       = homedir + "/tmp/Batch";
+    p[INFILE]        = Couple("seta.sh", "tmp/Batch/seta.sh");
+    p[INFILE]       += Couple("setb.sh", "tmp/Batch/setb.sh");
+    p[OUTFILE]       = Couple("result.txt", "tmp/Batch/result.txt");
+    p[NBPROC]        = 1;
+    p[MAXWALLTIME]   = 1;
+    p[MAXRAMSIZE]    = 50;
+    p[HOMEDIR]       = homedir;
+    p[QUEUE]         = queue;
+    p[LL_JOBTYPE]    = jobType;
+    p[EXCLUSIVE]     = false;
+    job.setParametre(p);
+    // ... and its environment
+    Environnement e;
+    e["MYENVVAR"] = "MYVALUE";
+    job.setEnvironnement(e);
+    cout << job << endl;
+
+    // Get the catalog
+    BatchManagerCatalog& c = BatchManagerCatalog::getInstance();
+
+    // Create a BatchManager of type ePBS on localhost
+    FactBatchManager * fbm = c("LL");
+    BatchManager * bm = (*fbm)(host.c_str(), user.c_str(), protocol);
+
+    // Submit the job to the BatchManager
+    JobId jobid = bm->submitJob(job);
+    cout << jobid.__repr__() << endl;
+
+    // Wait for the end of the job
+    string state = bm->waitForJobEnd(jobid, timeout);
+
+    if (state == FINISHED) {
+      cout << "Job " << jobid.__repr__() << " is done" << endl;
+      bm->importOutputFiles(job, "resultdir/seconddirname");
+    } else if (state == FAILED) {
+      cerr << "Job " << jobid.__repr__() << " finished in error" << endl;
+      bm->importOutputFiles(job, "resultdir/seconddirname");
+      return 1;
+    } else {
+      cerr << "Timeout while executing job" << endl;
+      return 1;
+    }
+
+  } catch (GenericException e) {
+    cerr << "Error: " << e << endl;
+    return 1;
+  } catch (ParserException e) {
+    cerr << "Parser error: " << e.what() << endl;
+    return 1;
+  }
+
+  // test the result file
+  try {
+    SimpleParser resultParser;
+    resultParser.parse("resultdir/seconddirname/result.txt");
+    cout << "Result:" << endl << resultParser;
+    const string & envvar = resultParser.getValue("MYENVVAR");
+    int result = resultParser.getValueAsInt("c");
+    if (envvar == "MYVALUE" && result == 12) {
+      cout << "OK, Expected result found." << endl;
+      return 0;
+    } else {
+      cerr << "Error, result is not the expected one (MYENVVAR = MYVALUE, c = 12)." << endl;
+      return 1;
+    }
+  } catch (ParserException e) {
+    cerr << "Parser error on result file: " << e.what() << endl;
+    return 1;
+  }
+}
diff --git a/src/LoadLeveler/Test/Test_eLL.cxx b/src/LoadLeveler/Test/Test_eLL.cxx
deleted file mode 100644 (file)
index 8f897cc..0000000
+++ /dev/null
@@ -1,165 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * Test_ePBS.cxx :
- *
- * Author : Renaud BARATE - EDF R&D
- * Date   : April 2009
- *
- */
-
-#include <iostream>
-#include <fstream>
-#include <cstring>
-
-#include <Batch_Constants.hxx>
-#include <Batch_Job.hxx>
-#include <Batch_BatchManagerCatalog.hxx>
-#include <Batch_FactBatchManager.hxx>
-#include <Batch_FactBatchManager_eLL.hxx>
-#include <Batch_BatchManager.hxx>
-
-#include <SimpleParser.hxx>
-
-using namespace std;
-using namespace Batch;
-
-void print_usage()
-{
-  cout << "usage: Test_eLL PROTOCOL" << endl;
-  cout << "    PROTOCOL      \"SSH\" or \"RSH\"" << endl;
-}
-
-int main(int argc, char** argv)
-{
-  // Parse argument
-  if (argc != 2) {
-    print_usage();
-    return 1;
-  }
-  CommunicationProtocolType protocol;
-  if (strcmp(argv[1], "SSH") == 0)
-    protocol = SSH;
-  else if (strcmp(argv[1], "RSH") == 0)
-    protocol = RSH;
-  else {
-    print_usage();
-    return 1;
-  }
-
-  cout << "*******************************************************************************************" << endl;
-  cout << "This program tests the batch submission based on LoadLeveler emulation. Passwordless" << endl;
-  cout << "authentication must be used for this test to pass. For SSH, this can be configured with" << endl;
-  cout << "ssh-agent for instance. For RSH, this can be configured with the .rhosts file." << endl;
-  cout << "*******************************************************************************************" << endl;
-
-  // eventually remove any previous result
-  remove("result.txt");
-
-  try {
-    // Parse the test configuration file
-    SimpleParser parser;
-    parser.parseTestConfigFile();
-    const string & homedir = parser.getValue("TEST_ELL_HOMEDIR");
-    const string & host = parser.getValue("TEST_ELL_HOST");
-    const string & user = parser.getValue("TEST_ELL_USER");
-    const string & queue = parser.getValue("TEST_ELL_QUEUE");
-    const string & jobType = parser.getValue("TEST_ELL_JOBTYPE");
-    int timeout = parser.getValueAsInt("TEST_ELL_TIMEOUT");
-
-    // Define the job...
-    Job job;
-    // ... and its parameters ...
-    Parametre p;
-    p[EXECUTABLE]    = "./test-script.sh";
-    p[NAME]          = string("Test_eLL_") + argv[1];
-    p[WORKDIR]       = homedir + "/tmp/Batch";
-    p[INFILE]        = Couple("seta.sh", "tmp/Batch/seta.sh");
-    p[INFILE]       += Couple("setb.sh", "tmp/Batch/setb.sh");
-    p[OUTFILE]       = Couple("result.txt", "tmp/Batch/result.txt");
-    p[NBPROC]        = 1;
-    p[MAXWALLTIME]   = 1;
-    p[MAXRAMSIZE]    = 50;
-    p[HOMEDIR]       = homedir;
-    p[QUEUE]         = queue;
-    p[LL_JOBTYPE]    = jobType;
-    p[EXCLUSIVE]     = false;
-    job.setParametre(p);
-    // ... and its environment
-    Environnement e;
-    e["MYENVVAR"] = "MYVALUE";
-    job.setEnvironnement(e);
-    cout << job << endl;
-
-    // Get the catalog
-    BatchManagerCatalog& c = BatchManagerCatalog::getInstance();
-
-    // Create a BatchManager of type ePBS on localhost
-    FactBatchManager * fbm = c("LL");
-    BatchManager * bm = (*fbm)(host.c_str(), user.c_str(), protocol);
-
-    // Submit the job to the BatchManager
-    JobId jobid = bm->submitJob(job);
-    cout << jobid.__repr__() << endl;
-
-    // Wait for the end of the job
-    string state = bm->waitForJobEnd(jobid, timeout);
-
-    if (state == FINISHED) {
-      cout << "Job " << jobid.__repr__() << " is done" << endl;
-      bm->importOutputFiles(job, "resultdir/seconddirname");
-    } else if (state == FAILED) {
-      cerr << "Job " << jobid.__repr__() << " finished in error" << endl;
-      bm->importOutputFiles(job, "resultdir/seconddirname");
-      return 1;
-    } else {
-      cerr << "Timeout while executing job" << endl;
-      return 1;
-    }
-
-  } catch (GenericException e) {
-    cerr << "Error: " << e << endl;
-    return 1;
-  } catch (ParserException e) {
-    cerr << "Parser error: " << e.what() << endl;
-    return 1;
-  }
-
-  // test the result file
-  try {
-    SimpleParser resultParser;
-    resultParser.parse("resultdir/seconddirname/result.txt");
-    cout << "Result:" << endl << resultParser;
-    const string & envvar = resultParser.getValue("MYENVVAR");
-    int result = resultParser.getValueAsInt("c");
-    if (envvar == "MYVALUE" && result == 12) {
-      cout << "OK, Expected result found." << endl;
-      return 0;
-    } else {
-      cerr << "Error, result is not the expected one (MYENVVAR = MYVALUE, c = 12)." << endl;
-      return 1;
-    }
-  } catch (ParserException e) {
-    cerr << "Parser error on result file: " << e.what() << endl;
-    return 1;
-  }
-}
diff --git a/src/Local/BatchManager_Local.cxx b/src/Local/BatchManager_Local.cxx
new file mode 100644 (file)
index 0000000..6be23d5
--- /dev/null
@@ -0,0 +1,835 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+* BatchManager_Local.cxx :
+*
+* Auteur : Ivan DUTKA-MALEN - EDF R&D
+* Mail   : mailto:ivan.dutka-malen@der.edf.fr
+* Date   : Thu Nov  6 10:17:22 2003
+* Projet : Salome 2
+*
+* Refactored by Renaud Barate (EDF R&D) in September 2009 to use
+* CommunicationProtocol classes and merge Local_SH, Local_RSH and Local_SSH batch
+* managers.
+*/
+
+#include <iostream>
+#include <fstream>
+#include <sstream>
+#include <cstdlib>
+#include <limits.h>
+
+#include <sys/types.h>
+#ifdef WIN32
+#include <direct.h>
+#else
+#include <sys/wait.h>
+#include <unistd.h>
+#endif
+#include <ctime>
+#include <pthread.h>
+#include <signal.h>
+#include <errno.h>
+#include <string.h>
+
+#include "Constants.hxx"
+#include "IOMutex.hxx"
+#include "BatchManager_Local.hxx"
+#include "RunTimeException.hxx"
+
+using namespace std;
+
+namespace Batch {
+
+
+  // Constructeur
+  BatchManager_Local::BatchManager_Local(const Batch::FactBatchManager * parent, const char * host,
+                                         const char * username,
+                                         CommunicationProtocolType protocolType, const char * mpiImpl)
+    : BatchManager(parent, host, username, protocolType, mpiImpl), _connect(0),
+      _idCounter(0)
+  {
+    pthread_mutex_init(&_threads_mutex, NULL);
+    pthread_cond_init(&_threadSyncCondition, NULL);
+  }
+
+  // Destructeur
+  BatchManager_Local::~BatchManager_Local()
+  {
+    for (map<Id, Child>::iterator iter = _threads.begin() ; iter != _threads.end() ; iter++) {
+      pthread_mutex_lock(&_threads_mutex);
+      string state = iter->second.param[STATE];
+      if (state != FINISHED && state != FAILED) {
+        UNDER_LOCK( cout << "Warning: Job " << iter->first <<
+                            " is not finished, it will now be canceled." << endl );
+        pthread_cancel(iter->second.thread_id);
+        pthread_cond_wait(&_threadSyncCondition, &_threads_mutex);
+      }
+      pthread_mutex_unlock(&_threads_mutex);
+    }
+    pthread_mutex_destroy(&_threads_mutex);
+    pthread_cond_destroy(&_threadSyncCondition);
+  }
+
+  // Methode pour le controle des jobs : soumet un job au gestionnaire
+  const JobId BatchManager_Local::submitJob(const Job & job)
+  {
+    // export input files in the working directory of the execution host
+    exportInputFiles(job);
+
+    Job_Local jobLocal = job;
+    Id id = _idCounter++;
+    ThreadAdapter * p_ta = new ThreadAdapter(*this, job, id);
+
+    // Les attributs du thread a sa creation
+    pthread_attr_t thread_attr;
+    pthread_attr_init(&thread_attr);
+    pthread_attr_setdetachstate(&thread_attr, PTHREAD_CREATE_DETACHED);
+
+    // Creation du thread qui va executer la commande systeme qu'on lui passe
+    pthread_t thread_id;
+    pthread_mutex_lock(&_threads_mutex);
+    int rc = pthread_create(&thread_id,
+      &thread_attr,
+      &ThreadAdapter::run,
+      static_cast<void *>(p_ta));
+
+    // Liberation des zones memoire maintenant inutiles occupees par les attributs du thread
+    pthread_attr_destroy(&thread_attr);
+
+    if (rc != 0) {
+      pthread_mutex_unlock(&_threads_mutex);
+      throw RunTimeException("Can't create new thread in BatchManager_Local");
+    }
+
+    pthread_cond_wait(&_threadSyncCondition, &_threads_mutex);
+    pthread_mutex_unlock(&_threads_mutex);
+
+    ostringstream id_sst;
+    id_sst << id;
+    return JobId(this, id_sst.str());
+  }
+
+  // Methode pour le controle des jobs : retire un job du gestionnaire
+  void BatchManager_Local::deleteJob(const JobId & jobid)
+  {
+    Id id;
+
+    istringstream iss(jobid.getReference());
+    iss >> id;
+
+    // @@@ --------> SECTION CRITIQUE <-------- @@@
+    pthread_mutex_lock(&_threads_mutex);
+    bool idFound = (_threads.find(id) != _threads.end());
+    if (idFound) {
+      string state = _threads[id].param[STATE];
+      if (state != FINISHED && state != FAILED) {
+        pthread_cancel(_threads[id].thread_id);
+        pthread_cond_wait(&_threadSyncCondition, &_threads_mutex);
+      } else {
+        cout << "Cannot delete job " << jobid.getReference() <<
+                ". Job is already finished." << endl;
+      }
+    }
+    pthread_mutex_unlock(&_threads_mutex);
+    // @@@ --------> SECTION CRITIQUE <-------- @@@
+
+    if (!idFound)
+      throw RunTimeException(string("Job with id ") + jobid.getReference() + " does not exist");
+  }
+
+  // Methode pour le controle des jobs : suspend un job en file d'attente
+  void BatchManager_Local::holdJob(const JobId & jobid)
+  {
+    Id id;
+    istringstream iss(jobid.getReference());
+    iss >> id;
+
+    UNDER_LOCK( cout << "BatchManager is sending HOLD command to the thread " << id << endl );
+
+    // On introduit une commande dans la queue du thread
+    // @@@ --------> SECTION CRITIQUE <-------- @@@
+    pthread_mutex_lock(&_threads_mutex);
+    if (_threads.find(id) != _threads.end())
+      _threads[id].command_queue.push(HOLD);
+    pthread_mutex_unlock(&_threads_mutex);
+    // @@@ --------> SECTION CRITIQUE <-------- @@@
+  }
+
+  // Methode pour le controle des jobs : relache un job suspendu
+  void BatchManager_Local::releaseJob(const JobId & jobid)
+  {
+    Id id;
+    istringstream iss(jobid.getReference());
+    iss >> id;
+
+    UNDER_LOCK( cout << "BatchManager is sending RELEASE command to the thread " << id << endl );
+
+    // On introduit une commande dans la queue du thread
+    // @@@ --------> SECTION CRITIQUE <-------- @@@
+    pthread_mutex_lock(&_threads_mutex);
+    if (_threads.find(id) != _threads.end())
+      _threads[id].command_queue.push(RELEASE);
+    pthread_mutex_unlock(&_threads_mutex);
+    // @@@ --------> SECTION CRITIQUE <-------- @@@
+  }
+
+
+  // Methode pour le controle des jobs : modifie un job en file d'attente
+  void BatchManager_Local::alterJob(const JobId & jobid, const Parametre & param, const Environnement & env)
+  {
+  }
+
+  // Methode pour le controle des jobs : modifie un job en file d'attente
+  void BatchManager_Local::alterJob(const JobId & jobid, const Parametre & param)
+  {
+    alterJob(jobid, param, Environnement());
+  }
+
+  // Methode pour le controle des jobs : modifie un job en file d'attente
+  void BatchManager_Local::alterJob(const JobId & jobid, const Environnement & env)
+  {
+    alterJob(jobid, Parametre(), env);
+  }
+
+
+
+  // Methode pour le controle des jobs : renvoie l'etat du job
+  JobInfo BatchManager_Local::queryJob(const JobId & jobid)
+  {
+    Id id;
+    istringstream iss(jobid.getReference());
+    iss >> id;
+
+    Parametre param;
+    Environnement env;
+
+    //UNDER_LOCK( cout << "JobInfo BatchManager_Local::queryJob(const JobId & jobid) : AVANT section critique" << endl );
+    // @@@ --------> SECTION CRITIQUE <-------- @@@
+    pthread_mutex_lock(&_threads_mutex);
+    std::map<Id, Child >::iterator pos = _threads.find(id);
+    bool found = (pos != _threads.end());
+    if (found) {
+      param = pos->second.param;
+      env   = pos->second.env;
+    }
+    pthread_mutex_unlock(&_threads_mutex);
+    // @@@ --------> SECTION CRITIQUE <-------- @@@
+    //UNDER_LOCK( cout << "JobInfo BatchManager_Local::queryJob(const JobId & jobid) : APRES section critique" << endl );
+
+    if (!found) throw InvalidArgumentException("Invalid JobId argument for queryJob");
+
+    JobInfo_Local ji(param, env);
+    return ji;
+  }
+
+
+  // Ce manager ne peut pas reprendre un job
+  // On force donc l'état du job Ã  erreur - pour cela on ne donne pas d'Id
+  // au JobId
+  const Batch::JobId
+  BatchManager_Local::addJob(const Batch::Job & job, const std::string reference)
+  {
+    return JobId(this, "undefined");
+  }
+
+  // Methode pour le controle des jobs : teste si un job est present en machine
+  bool BatchManager_Local::isRunning(const JobId & jobid)
+  {
+    Id id;
+    istringstream iss(jobid.getReference());
+    iss >> id;
+
+    //UNDER_LOCK( cout << "JobInfo BatchManager_Local::queryJob(const JobId & jobid) : AVANT section critique" << endl );
+    // @@@ --------> SECTION CRITIQUE <-------- @@@
+    pthread_mutex_lock(&_threads_mutex);
+    bool running = (_threads[id].param[STATE].str() == RUNNING);
+    pthread_mutex_unlock(&_threads_mutex);
+    // @@@ --------> SECTION CRITIQUE <-------- @@@
+    //UNDER_LOCK( cout << "JobInfo BatchManager_Local::queryJob(const JobId & jobid) : APRES section critique" << endl );
+
+    return running;
+  }
+
+
+  vector<string> BatchManager_Local::exec_command(const Parametre & param) const
+  {
+    ostringstream exec_sub_cmd;
+
+#ifdef WIN32
+    char drive[_MAX_DRIVE];
+    _splitpath(string(param[WORKDIR]).c_str(), drive, NULL, NULL, NULL);
+    if (strlen(drive) > 0) exec_sub_cmd << drive << " && ";
+#endif
+
+    string fileToExecute = param[EXECUTABLE].str();
+    string::size_type p1 = fileToExecute.find_last_of("/");
+    string fileNameToExecute = fileToExecute.substr(p1+1);
+
+    exec_sub_cmd << "cd " << param[WORKDIR] << " && ./" << fileNameToExecute;
+
+    if (param.find(ARGUMENTS) != param.end()) {
+      Versatile V = param[ARGUMENTS];
+      for(Versatile::const_iterator it=V.begin(); it!=V.end(); it++) {
+        StringType argt = * static_cast<StringType *>(*it);
+        string     arg  = argt;
+        exec_sub_cmd << " " << arg;
+      }
+    }
+
+    if (param.find(INFILE) != param.end()) {
+      Versatile V = param[INFILE];
+      for(Versatile::const_iterator it=V.begin(); it!=V.end(); it++) {
+        Couple cpl = * static_cast<CoupleType*>(*it);
+        string remote = cpl.getRemote();
+        if (remote == "stdin")
+        exec_sub_cmd << " <stdin";
+      }
+    }
+
+    if (param.find(OUTFILE) != param.end()) {
+      Versatile V = param[OUTFILE];
+      for(Versatile::const_iterator it=V.begin(); it!=V.end(); it++) {
+        Couple cpl = * static_cast<CoupleType*>(*it);
+        string remote = cpl.getRemote();
+        if (remote == "stdout") exec_sub_cmd << " 1>stdout";
+        if (remote == "stderr") exec_sub_cmd << " 2>stderr";
+      }
+    }
+
+    string user;
+    Parametre::const_iterator it = param.find(USER);
+    if (it != param.end()) {
+      user = string(it->second);
+    }
+
+    return _protocol.getExecCommandArgs(exec_sub_cmd.str(), _hostname, user);
+  }
+
+
+
+  // Constructeur de la classe ThreadAdapter
+  BatchManager_Local::ThreadAdapter::ThreadAdapter(BatchManager_Local & bm, const Job_Local & job, Id id) :
+  _bm(bm), _job(job), _id(id)
+  {
+    // Nothing to do
+  }
+
+
+
+  // Methode d'execution du thread
+  void * BatchManager_Local::ThreadAdapter::run(void * arg)
+  {
+    ThreadAdapter * p_ta = static_cast<ThreadAdapter *>(arg);
+
+#ifndef WIN32
+    // On bloque tous les signaux pour ce thread
+    sigset_t setmask;
+    sigfillset(&setmask);
+    pthread_sigmask(SIG_BLOCK, &setmask, NULL);
+#endif
+
+    // On autorise la terminaison differee du thread
+    // (ces valeurs sont les valeurs par defaut mais on les force par precaution)
+    pthread_setcancelstate(PTHREAD_CANCEL_ENABLE,  NULL);
+    pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL);
+
+    // On enregistre la fonction de suppression du fils en cas d'arret du thread
+    // Cette fontion sera automatiquement appelee lorsqu'une demande d'annulation
+    // sera prise en compte par pthread_testcancel()
+    Process child;
+    pthread_cleanup_push(BatchManager_Local::delete_on_exit, arg);
+    pthread_cleanup_push(BatchManager_Local::setFailedOnCancel, arg);
+    pthread_cleanup_push(BatchManager_Local::kill_child_on_exit, static_cast<void *> (&child));
+
+    // On forke/exec un nouveau process pour pouvoir controler le fils
+    // (plus finement qu'avec un appel system)
+    // int rc = system(commande.c_str());
+    //char *const parmList[] = {"/usr/bin/ssh", "localhost", "-l", "aribes", "sleep 10 && echo end", NULL};
+    //execv("/usr/bin/ssh", parmList);
+#ifdef WIN32
+    child = p_ta->launchWin32ChildProcess();
+    p_ta->pere(child);
+#else
+    child = fork();
+    if (child < 0) { // erreur
+      UNDER_LOCK( cerr << "Fork impossible (rc=" << child << ")" << endl );
+
+    } else if (child > 0) { // pere
+      p_ta->pere(child);
+
+    } else { // fils
+      p_ta->fils();
+    }
+#endif
+
+    pthread_mutex_lock(&p_ta->_bm._threads_mutex);
+
+    // Set the job state to FINISHED or FAILED
+    p_ta->_bm._threads[p_ta->_id].param[STATE] = (p_ta->_bm._threads[p_ta->_id].hasFailed) ? FAILED : FINISHED;
+
+    // On retire la fonction de nettoyage de la memoire
+    pthread_cleanup_pop(0);
+
+    // On retire la fonction de suppression du fils
+    pthread_cleanup_pop(0);
+
+    // remove setFailedOnCancel function from cancel stack
+    pthread_cleanup_pop(0);
+
+    pthread_mutex_unlock(&p_ta->_bm._threads_mutex);
+
+    // On invoque la fonction de nettoyage de la memoire
+    delete_on_exit(arg);
+
+    UNDER_LOCK( cout << "Father is leaving" << endl );
+    pthread_exit(NULL);
+    return NULL;
+  }
+
+
+
+
+  void BatchManager_Local::ThreadAdapter::pere(Process child)
+  {
+    time_t child_starttime = time(NULL);
+
+    // On enregistre le fils dans la table des threads
+    pthread_t thread_id = pthread_self();
+
+    Parametre param   = _job.getParametre();
+    Environnement env = _job.getEnvironnement();
+
+    ostringstream id_sst;
+    id_sst << _id;
+    param[ID]         = id_sst.str();
+    param[STATE]      = Batch::RUNNING;
+#ifndef WIN32
+    param[PID]        = child;
+#endif
+
+    _bm._threads[_id].thread_id = thread_id;
+#ifndef WIN32
+    _bm._threads[_id].pid       = child;
+#endif
+    _bm._threads[_id].hasFailed = false;
+    _bm._threads[_id].param     = param;
+    _bm._threads[_id].env       = env;
+    _bm._threads[_id].command_queue.push(NOP);
+
+    // Unlock the master thread. From here, all shared variables must be protected
+    // from concurrent access
+    pthread_cond_signal(&_bm._threadSyncCondition);
+
+
+    // on boucle en attendant que le fils ait termine
+    while (1) {
+#ifdef WIN32
+      DWORD exitCode;
+      GetExitCodeProcess(child, &exitCode);
+      if (exitCode != STILL_ACTIVE) {
+        UNDER_LOCK( cout << "Father sees his child is DONE: exit code = " << exitCode << endl );
+        break;
+      }
+#else
+      int child_rc = 0;
+      pid_t child_wait_rc = waitpid(child, &child_rc, WNOHANG /* | WUNTRACED */);
+      if (child_wait_rc > 0) {
+        UNDER_LOCK( cout << "Status is: " << WIFEXITED( child_rc) << endl);
+        UNDER_LOCK( cout << "Status is: " << WEXITSTATUS( child_rc) << endl);
+        UNDER_LOCK( cout << "Status is: " << WIFSIGNALED( child_rc) << endl);
+        UNDER_LOCK( cout << "Status is: " << WTERMSIG( child_rc) << endl);
+        UNDER_LOCK( cout << "Status is: " << WCOREDUMP( child_rc) << endl);
+        UNDER_LOCK( cout << "Status is: " << WIFSTOPPED( child_rc) << endl);
+        UNDER_LOCK( cout << "Status is: " << WSTOPSIG( child_rc) << endl);
+#ifdef WIFCONTINUED
+        UNDER_LOCK( cout << "Status is: " << WIFCONTINUED( child_rc) << endl); // not compilable on sarge
+#endif
+        if (WIFSTOPPED(child_rc)) {
+          // NOTA : pour rentrer dans cette section, il faut que le flag WUNTRACED
+          // soit positionne dans l'appel a waitpid ci-dessus. Ce flag est couramment
+          // desactive car s'il est possible de detecter l'arret d'un process, il est
+          // plus difficile de detecter sa reprise.
+
+          // Le fils est simplement stoppe
+          // @@@ --------> SECTION CRITIQUE <-------- @@@
+          pthread_mutex_lock(&_bm._threads_mutex);
+          _bm._threads[_id].param[STATE] = Batch::PAUSED;
+          pthread_mutex_unlock(&_bm._threads_mutex);
+          // @@@ --------> SECTION CRITIQUE <-------- @@@
+          UNDER_LOCK( cout << "Father sees his child is STOPPED : " << child_wait_rc << endl );
+
+        }
+        else {
+          // Le fils est termine, on sort de la boucle et du if englobant
+          UNDER_LOCK( cout << "Father sees his child is DONE : " << child_wait_rc << " (child_rc=" << (WIFEXITED(child_rc) ? WEXITSTATUS(child_rc) : -1) << ")" << endl );
+          break;
+        }
+      }
+      else if (child_wait_rc == -1) {
+        // Le fils a disparu ...
+        // @@@ --------> SECTION CRITIQUE <-------- @@@
+        pthread_mutex_lock(&_bm._threads_mutex);
+        _bm._threads[_id].hasFailed = true;
+        pthread_mutex_unlock(&_bm._threads_mutex);
+        // @@@ --------> SECTION CRITIQUE <-------- @@@
+        UNDER_LOCK( cout << "Father sees his child is DEAD : " << child_wait_rc << " (Reason : " << strerror(errno) << ")" << endl );
+        break;
+      }
+#endif
+
+      // On teste si le thread doit etre detruit
+      pthread_testcancel();
+
+
+
+      // On regarde si le fils n'a pas depasse son temps (wallclock time)
+      time_t child_currenttime = time(NULL);
+      long child_elapsedtime_minutes = (child_currenttime - child_starttime) / 60L;
+      if (param.find(MAXWALLTIME) != param.end()) {
+        long maxwalltime = param[MAXWALLTIME];
+        //       cout << "child_starttime          = " << child_starttime        << endl
+        //            << "child_currenttime        = " << child_currenttime      << endl
+        //            << "child_elapsedtime        = " << child_elapsedtime      << endl
+        //            << "maxwalltime              = " << maxwalltime            << endl
+        //            << "int(maxwalltime * 1.1)   = " << int(maxwalltime * 1.1) << endl;
+        if (child_elapsedtime_minutes > long((float)maxwalltime * 1.1) ) { // On se donne 10% de marge avant le KILL
+          UNDER_LOCK( cout << "Father is sending KILL command to the thread " << _id << endl );
+          // On introduit une commande dans la queue du thread
+          // @@@ --------> SECTION CRITIQUE <-------- @@@
+          pthread_mutex_lock(&_bm._threads_mutex);
+          if (_bm._threads.find(_id) != _bm._threads.end())
+            _bm._threads[_id].command_queue.push(KILL);
+          pthread_mutex_unlock(&_bm._threads_mutex);
+          // @@@ --------> SECTION CRITIQUE <-------- @@@
+
+
+        } else if (child_elapsedtime_minutes > maxwalltime ) {
+          UNDER_LOCK( cout << "Father is sending TERM command to the thread " << _id << endl );
+          // On introduit une commande dans la queue du thread
+          // @@@ --------> SECTION CRITIQUE <-------- @@@
+          pthread_mutex_lock(&_bm._threads_mutex);
+          if (_bm._threads.find(_id) != _bm._threads.end())
+            _bm._threads[_id].command_queue.push(TERM);
+          pthread_mutex_unlock(&_bm._threads_mutex);
+          // @@@ --------> SECTION CRITIQUE <-------- @@@
+        }
+      }
+
+
+
+      // On regarde s'il y a quelque chose a faire dans la queue de commande
+      // @@@ --------> SECTION CRITIQUE <-------- @@@
+      pthread_mutex_lock(&_bm._threads_mutex);
+      if (_bm._threads.find(_id) != _bm._threads.end()) {
+        while (_bm._threads[_id].command_queue.size() > 0) {
+          Commande cmd = _bm._threads[_id].command_queue.front();
+          _bm._threads[_id].command_queue.pop();
+
+          switch (cmd) {
+    case NOP:
+      UNDER_LOCK( cout << "Father does nothing to his child" << endl );
+      break;
+#ifndef WIN32
+    case HOLD:
+      UNDER_LOCK( cout << "Father is sending SIGSTOP signal to his child" << endl );
+      kill(child, SIGSTOP);
+      break;
+
+    case RELEASE:
+      UNDER_LOCK( cout << "Father is sending SIGCONT signal to his child" << endl );
+      kill(child, SIGCONT);
+      break;
+
+    case TERM:
+      UNDER_LOCK( cout << "Father is sending SIGTERM signal to his child" << endl );
+      kill(child, SIGTERM);
+      break;
+
+    case KILL:
+      UNDER_LOCK( cout << "Father is sending SIGKILL signal to his child" << endl );
+      kill(child, SIGKILL);
+      break;
+#endif
+    case ALTER:
+      break;
+
+    default:
+      break;
+          }
+        }
+
+      }
+      pthread_mutex_unlock(&_bm._threads_mutex);
+      // @@@ --------> SECTION CRITIQUE <-------- @@@
+
+      // On fait une petite pause pour ne pas surcharger inutilement le processeur
+#ifdef WIN32
+      Sleep(1000);
+#else
+      sleep(1);
+#endif
+
+    }
+
+  }
+
+
+
+#ifndef WIN32
+
+  void BatchManager_Local::ThreadAdapter::fils()
+  {
+    Parametre param = _job.getParametre();
+    Parametre::iterator it;
+
+      //char *const parmList[] = {"/usr/bin/ssh", "localhost", "-l", "aribes", "sleep 1 && echo end", NULL};
+      //int result = execv("/usr/bin/ssh", parmList);
+      //UNDER_LOCK( cout << "*** debug_command = " << result << endl );
+      //UNDER_LOCK( cout << "*** debug_command = " << strerror(errno) << endl );
+    try {
+
+      // EXECUTABLE is MANDATORY, if missing, we exit with failure notification
+      vector<string> command;
+      if (param.find(EXECUTABLE) != param.end()) {
+        command = _bm.exec_command(param);
+      } else exit(1);
+
+      // Build the argument array argv from the command
+      char ** argv = new char * [command.size() + 1];
+      string comstr;
+      for (string::size_type i=0 ; i<command.size() ; i++) {
+        argv[i] = new char[command[i].size() + 1];
+        strncpy(argv[i], command[i].c_str(), command[i].size() + 1);
+        if (i>0) comstr += " # ";
+        comstr += command[i];
+      }
+
+      argv[command.size()] = NULL;
+
+      UNDER_LOCK( cout << "*** debug_command = " << comstr << endl );
+      UNDER_LOCK( cout << "*** debug_command = " << argv[0] << endl );
+
+      // Create the environment for the new process. Note (RB): Here we change the environment for
+      // the process launched in local. It would seem more logical to set the environment for the
+      // remote process.
+      Environnement env = _job.getEnvironnement();
+
+      char ** envp = NULL;
+      if(env.size() > 0) {
+        envp = new char * [env.size() + 1]; // 1 pour le NULL terminal
+        int i = 0;
+        for(Environnement::const_iterator it=env.begin(); it!=env.end(); it++, i++) {
+          const string  & key   = (*it).first;
+          const string  & value = (*it).second;
+          ostringstream oss;
+          oss << key << "=" << value;
+          envp[i]         = new char [oss.str().size() + 1];
+          strncpy(envp[i], oss.str().c_str(), oss.str().size() + 1);
+        }
+
+        // assert (i == env.size())
+        envp[i] = NULL;
+      }
+
+      //char *const parmList[] = {"/usr/bin/ssh", "localhost", "-l", "aribes", "sleep 1 && echo end", NULL};
+      //int result = execv("/usr/bin/ssh", parmList);
+      //UNDER_LOCK( cout << "*** debug_command = " << result << endl );
+      //UNDER_LOCK( cout << "*** debug_command = " << strerror(errno) << endl );
+
+
+
+      // On positionne les limites systeme imposees au fils
+      // This part is deactivated because those limits should be set on the job process, not on
+      // the ssh process. If it is done properly one day, beware of the types used (int is not enough)
+      /*
+      if (param.find(MAXCPUTIME) != param.end()) {
+        int maxcputime = param[MAXCPUTIME];
+        struct rlimit limit;
+        limit.rlim_cur = maxcputime;
+        limit.rlim_max = int(maxcputime * 1.1);
+        setrlimit(RLIMIT_CPU, &limit);
+      }
+
+      if (param.find(MAXDISKSIZE) != param.end()) {
+        int maxdisksize = param[MAXDISKSIZE];
+        struct rlimit limit;
+        limit.rlim_cur = maxdisksize * 1024;
+        limit.rlim_max = int(maxdisksize * 1.1) * 1024;
+        setrlimit(RLIMIT_FSIZE, &limit);
+      }
+
+      if (param.find(MAXRAMSIZE) != param.end()) {
+        int maxramsize = param[MAXRAMSIZE];
+        struct rlimit limit;
+        limit.rlim_cur = maxramsize * 1024 * 1024;
+        limit.rlim_max = int(maxramsize * 1.1) * 1024 * 1024;
+        setrlimit(RLIMIT_AS, &limit);
+      }
+      */
+
+
+      //char *const parmList[] = {"/usr/bin/ssh", "localhost", "-l", "aribes", "sleep 1 && echo end", NULL};
+      //int result = execv("/usr/bin/ssh", parmList);
+      //UNDER_LOCK( cout << "*** debug_command = " << result << endl );
+      //UNDER_LOCK( cout << "*** debug_command = " << strerror(errno) << endl );
+
+      // On cree une session pour le fils de facon a ce qu'il ne soit pas
+      // detruit lorsque le shell se termine (le shell ouvre une session et
+      // tue tous les process appartenant a la session en quittant)
+      setsid();
+
+
+      // On ferme les descripteurs de fichiers standards
+      //close(STDIN_FILENO);
+      //close(STDOUT_FILENO);
+      //close(STDERR_FILENO);
+
+
+      // On execute la commande du fils
+      execve(argv[0], argv, envp);
+      UNDER_LOCK( cout << "*** debug_command = " << strerror(errno) << endl );
+      // No need to deallocate since nothing happens after a successful exec
+
+      // Normalement on ne devrait jamais arriver ici
+      ofstream file_err("error.log");
+      UNDER_LOCK( file_err << "Echec de l'appel a execve" << endl );
+
+    } catch (GenericException & e) {
+
+      std::cerr << "Caught exception : " << e.type << " : " << e.message << std::endl;
+    }
+
+    exit(99);
+  }
+
+#else
+
+  BatchManager_Local::Process BatchManager_Local::ThreadAdapter::launchWin32ChildProcess()
+  {
+    Parametre param = _job.getParametre();
+    Parametre::iterator it;
+    PROCESS_INFORMATION pi;
+
+    try {
+
+      // EXECUTABLE is MANDATORY, if missing, we throw an exception
+      vector<string> exec_command;
+      if (param.find(EXECUTABLE) != param.end()) {
+        exec_command = _bm.exec_command(param);
+      } else {
+        throw RunTimeException("Parameter \"EXECUTABLE\" is mandatory for local batch submission");
+      }
+
+      // Build the command string from the command argument vector
+      string comstr;
+      for (unsigned int i=0 ; i<exec_command.size() ; i++) {
+        if (i>0) comstr += " ";
+        comstr += exec_command[i];
+      }
+
+      UNDER_LOCK( cout << "*** debug_command = " << comstr << endl );
+
+      // Create the environment for the new process. Note (RB): Here we change the environment for
+      // the process launched in local. It would seem more logical to set the environment for the
+      // remote process.
+      // Note that if no environment is specified, we reuse the current environment.
+      Environnement env = _job.getEnvironnement();
+      char * chNewEnv = NULL;
+
+      if(env.size() > 0) {
+        chNewEnv = new char[4096];
+        LPTSTR lpszCurrentVariable = chNewEnv;
+        for(Environnement::const_iterator it=env.begin() ; it!=env.end() ; it++) {
+          const string  & key   = (*it).first;
+          const string  & value = (*it).second;
+          string envvar = key + "=" + value;
+          envvar.copy(lpszCurrentVariable, envvar.size());
+          lpszCurrentVariable[envvar.size()] = '\0';
+          lpszCurrentVariable += lstrlen(lpszCurrentVariable) + 1;
+        }
+        // Terminate the block with a NULL byte.
+        *lpszCurrentVariable = '\0';
+      }
+
+
+      STARTUPINFO si;
+      ZeroMemory( &si, sizeof(si) );
+      si.cb = sizeof(si);
+      ZeroMemory( &pi, sizeof(pi) );
+
+      // Copy the command to a non-const buffer
+      char * buffer = strdup(comstr.c_str());
+
+      // launch the new process
+      bool res = CreateProcess(NULL, buffer, NULL, NULL, FALSE,
+                               CREATE_NO_WINDOW, chNewEnv, NULL, &si, &pi);
+
+      if (buffer) free(buffer);
+      if (!res) throw RunTimeException("Error while creating new process");
+
+      CloseHandle(pi.hThread);
+
+    } catch (GenericException & e) {
+
+      std::cerr << "Caught exception : " << e.type << " : " << e.message << std::endl;
+    }
+
+    return pi.hProcess;
+  }
+
+#endif
+
+
+  void BatchManager_Local::kill_child_on_exit(void * p_pid)
+  {
+#ifndef WIN32
+    //TODO: porting of following functionality
+    pid_t child = * static_cast<pid_t *>(p_pid);
+
+    // On tue le fils
+    kill(child, SIGTERM);
+
+    // Nota : on pourrait aussi faire a la suite un kill(child, SIGKILL)
+    // mais cette option n'est pas implementee pour le moment, car il est
+    // preferable de laisser le process fils se terminer normalement et seul.
+#endif
+  }
+
+  void BatchManager_Local::delete_on_exit(void * arg)
+  {
+    ThreadAdapter * p_ta = static_cast<ThreadAdapter *>(arg);
+    delete p_ta;
+  }
+
+  void BatchManager_Local::setFailedOnCancel(void * arg)
+  {
+    ThreadAdapter * p_ta = static_cast<ThreadAdapter *>(arg);
+    pthread_mutex_lock(&p_ta->getBatchManager()._threads_mutex);
+    p_ta->getBatchManager()._threads[p_ta->getId()].param[STATE] = FAILED;
+    pthread_mutex_unlock(&p_ta->getBatchManager()._threads_mutex);
+
+    // Unlock the master thread. From here, the batch manager instance should not be used.
+    pthread_cond_signal(&p_ta->getBatchManager()._threadSyncCondition);
+  }
+
+}
diff --git a/src/Local/BatchManager_Local.hxx b/src/Local/BatchManager_Local.hxx
new file mode 100644 (file)
index 0000000..fc1c3eb
--- /dev/null
@@ -0,0 +1,170 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * BatchManager_Local.hxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail   : mailto:ivan.dutka-malen@der.edf.fr
+ * Date   : Thu Nov  6 10:17:22 2003
+ * Projet : Salome 2
+ *
+ * Refactored by Renaud Barate (EDF R&D) in September 2009 to use
+ * CommunicationProtocol classes and merge Local_SH, Local_RSH and Local_SSH batch
+ * managers.
+ *
+ */
+
+#ifndef _BATCHMANAGER_LOCAL_H_
+#define _BATCHMANAGER_LOCAL_H_
+
+#include "Defines.hxx"
+#include "CommunicationProtocol.hxx"
+
+#ifdef WIN32
+#include <Windows.h>
+#endif
+
+#include <list>
+#include <map>
+#include <queue>
+#include <pthread.h>
+#include "Job.hxx"
+#include "JobId.hxx"
+#include "JobInfo.hxx"
+#include "JobInfo_Local.hxx"
+#include "Job_Local.hxx"
+#include "BatchManager.hxx"
+
+namespace Batch {
+
+  class FactBatchManager;
+
+  /*!
+   *  This class defines a local pseudo batch manager that can launch jobs locally or on a remote
+   *  machine with SSH or RSH. This class is NOT thread-safe.
+   */
+  class BATCH_EXPORT BatchManager_Local : virtual public BatchManager
+  {
+  private:
+    typedef int Id;
+#ifdef WIN32
+    typedef HANDLE Process;
+#else
+    typedef pid_t Process;
+#endif
+    friend class ThreadAdapter;
+    class ThreadAdapter{
+    public:
+      ThreadAdapter(BatchManager_Local & bm, const Job_Local & job, Id id);
+      static void * run(void * arg);
+      BatchManager_Local & getBatchManager() const { return _bm; };
+      Id getId() const { return _id; };
+
+    protected:
+      BatchManager_Local & _bm;
+      const Job_Local _job;
+      Id _id;
+
+    private:
+      void pere(Process child);
+#ifndef WIN32
+      void fils();
+#else
+      Process launchWin32ChildProcess();
+#endif
+
+    };
+
+    enum Commande {
+      NOP = 0,
+      HOLD,
+      RELEASE,
+      TERM,
+      KILL,
+      ALTER
+    };
+
+    struct Child {
+      pthread_t thread_id;
+      std::queue<Commande, std::deque<Commande> > command_queue;
+      pid_t pid;
+      int exit_code;
+      bool hasFailed;
+      Parametre param;
+      Environnement env;
+    };
+
+
+
+  public:
+
+    BatchManager_Local(const Batch::FactBatchManager * parent, const char * host = "localhost",
+                       const char * username = "",
+                       CommunicationProtocolType protocolType = SSH, const char * mpiImpl = "nompi");
+    virtual ~BatchManager_Local();
+
+    // Recupere le nom du serveur par defaut
+    // static string BatchManager_Local::getDefaultServer();
+
+    // Methodes pour le controle des jobs
+    virtual const JobId submitJob(const Job & job); // soumet un job au gestionnaire
+    virtual void deleteJob(const JobId & jobid); // retire un job du gestionnaire
+    virtual void holdJob(const JobId & jobid); // suspend un job en file d'attente
+    virtual void releaseJob(const JobId & jobid); // relache un job suspendu
+    virtual void alterJob(const JobId & jobid, const Parametre & param, const Environnement & env); // modifie un job en file d'attente
+    virtual void alterJob(const JobId & jobid, const Parametre & param); // modifie un job en file d'attente
+    virtual void alterJob(const JobId & jobid, const Environnement & env); // modifie un job en file d'attente
+    virtual JobInfo queryJob(const JobId & jobid); // renvoie l'etat du job
+    virtual bool isRunning(const JobId & jobid); // teste si un job est present en machine
+
+    virtual void setParametre(const JobId & jobid, const Parametre & param) { return alterJob(jobid, param); } // modifie un job en file d'attente
+    virtual void setEnvironnement(const JobId & jobid, const Environnement & env) { return alterJob(jobid, env); } // modifie un job en file d'attente
+
+    virtual const Batch::JobId addJob(const Batch::Job & job, const std::string reference); // ajoute un nouveau job sans le soumettre
+
+  protected:
+    int _connect; // Local connect id
+    pthread_mutex_t _threads_mutex;
+    std::map<Id, Child > _threads;
+
+    // Methode qui renvoie la commande a executer
+    std::vector<std::string> exec_command(const Parametre & param) const;
+
+  private:
+    static  void kill_child_on_exit(void * p_pid);
+    static  void delete_on_exit(void * arg);
+    static void setFailedOnCancel(void * arg);
+    pthread_cond_t _threadSyncCondition;
+    Id _idCounter;
+
+#ifdef SWIG
+  public:
+    // Recupere le l'identifiant d'un job deja soumis au BatchManager
+    //virtual const JobId getJobIdByReference(const string & ref) { return BatchManager::getJobIdByReference(ref); }
+    virtual const JobId getJobIdByReference(const char * ref) { return BatchManager::getJobIdByReference(ref); }
+#endif
+
+  };
+
+}
+
+#endif
diff --git a/src/Local/Batch_BatchManager_Local.cxx b/src/Local/Batch_BatchManager_Local.cxx
deleted file mode 100644 (file)
index 8ca72e4..0000000
+++ /dev/null
@@ -1,835 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
-* BatchManager_Local.cxx :
-*
-* Auteur : Ivan DUTKA-MALEN - EDF R&D
-* Mail   : mailto:ivan.dutka-malen@der.edf.fr
-* Date   : Thu Nov  6 10:17:22 2003
-* Projet : Salome 2
-*
-* Refactored by Renaud Barate (EDF R&D) in September 2009 to use
-* CommunicationProtocol classes and merge Local_SH, Local_RSH and Local_SSH batch
-* managers.
-*/
-
-#include <iostream>
-#include <fstream>
-#include <sstream>
-#include <cstdlib>
-#include <limits.h>
-
-#include <sys/types.h>
-#ifdef WIN32
-#include <direct.h>
-#else
-#include <sys/wait.h>
-#include <unistd.h>
-#endif
-#include <ctime>
-#include <pthread.h>
-#include <signal.h>
-#include <errno.h>
-#include <string.h>
-
-#include "Batch_Constants.hxx"
-#include "Batch_IOMutex.hxx"
-#include "Batch_BatchManager_Local.hxx"
-#include "Batch_RunTimeException.hxx"
-
-using namespace std;
-
-namespace Batch {
-
-
-  // Constructeur
-  BatchManager_Local::BatchManager_Local(const Batch::FactBatchManager * parent, const char * host,
-                                         const char * username,
-                                         CommunicationProtocolType protocolType, const char * mpiImpl)
-    : BatchManager(parent, host, username, protocolType, mpiImpl), _connect(0),
-      _idCounter(0)
-  {
-    pthread_mutex_init(&_threads_mutex, NULL);
-    pthread_cond_init(&_threadSyncCondition, NULL);
-  }
-
-  // Destructeur
-  BatchManager_Local::~BatchManager_Local()
-  {
-    for (map<Id, Child>::iterator iter = _threads.begin() ; iter != _threads.end() ; iter++) {
-      pthread_mutex_lock(&_threads_mutex);
-      string state = iter->second.param[STATE];
-      if (state != FINISHED && state != FAILED) {
-        UNDER_LOCK( cout << "Warning: Job " << iter->first <<
-                            " is not finished, it will now be canceled." << endl );
-        pthread_cancel(iter->second.thread_id);
-        pthread_cond_wait(&_threadSyncCondition, &_threads_mutex);
-      }
-      pthread_mutex_unlock(&_threads_mutex);
-    }
-    pthread_mutex_destroy(&_threads_mutex);
-    pthread_cond_destroy(&_threadSyncCondition);
-  }
-
-  // Methode pour le controle des jobs : soumet un job au gestionnaire
-  const JobId BatchManager_Local::submitJob(const Job & job)
-  {
-    // export input files in the working directory of the execution host
-    exportInputFiles(job);
-
-    Job_Local jobLocal = job;
-    Id id = _idCounter++;
-    ThreadAdapter * p_ta = new ThreadAdapter(*this, job, id);
-
-    // Les attributs du thread a sa creation
-    pthread_attr_t thread_attr;
-    pthread_attr_init(&thread_attr);
-    pthread_attr_setdetachstate(&thread_attr, PTHREAD_CREATE_DETACHED);
-
-    // Creation du thread qui va executer la commande systeme qu'on lui passe
-    pthread_t thread_id;
-    pthread_mutex_lock(&_threads_mutex);
-    int rc = pthread_create(&thread_id,
-      &thread_attr,
-      &ThreadAdapter::run,
-      static_cast<void *>(p_ta));
-
-    // Liberation des zones memoire maintenant inutiles occupees par les attributs du thread
-    pthread_attr_destroy(&thread_attr);
-
-    if (rc != 0) {
-      pthread_mutex_unlock(&_threads_mutex);
-      throw RunTimeException("Can't create new thread in BatchManager_Local");
-    }
-
-    pthread_cond_wait(&_threadSyncCondition, &_threads_mutex);
-    pthread_mutex_unlock(&_threads_mutex);
-
-    ostringstream id_sst;
-    id_sst << id;
-    return JobId(this, id_sst.str());
-  }
-
-  // Methode pour le controle des jobs : retire un job du gestionnaire
-  void BatchManager_Local::deleteJob(const JobId & jobid)
-  {
-    Id id;
-
-    istringstream iss(jobid.getReference());
-    iss >> id;
-
-    // @@@ --------> SECTION CRITIQUE <-------- @@@
-    pthread_mutex_lock(&_threads_mutex);
-    bool idFound = (_threads.find(id) != _threads.end());
-    if (idFound) {
-      string state = _threads[id].param[STATE];
-      if (state != FINISHED && state != FAILED) {
-        pthread_cancel(_threads[id].thread_id);
-        pthread_cond_wait(&_threadSyncCondition, &_threads_mutex);
-      } else {
-        cout << "Cannot delete job " << jobid.getReference() <<
-                ". Job is already finished." << endl;
-      }
-    }
-    pthread_mutex_unlock(&_threads_mutex);
-    // @@@ --------> SECTION CRITIQUE <-------- @@@
-
-    if (!idFound)
-      throw RunTimeException(string("Job with id ") + jobid.getReference() + " does not exist");
-  }
-
-  // Methode pour le controle des jobs : suspend un job en file d'attente
-  void BatchManager_Local::holdJob(const JobId & jobid)
-  {
-    Id id;
-    istringstream iss(jobid.getReference());
-    iss >> id;
-
-    UNDER_LOCK( cout << "BatchManager is sending HOLD command to the thread " << id << endl );
-
-    // On introduit une commande dans la queue du thread
-    // @@@ --------> SECTION CRITIQUE <-------- @@@
-    pthread_mutex_lock(&_threads_mutex);
-    if (_threads.find(id) != _threads.end())
-      _threads[id].command_queue.push(HOLD);
-    pthread_mutex_unlock(&_threads_mutex);
-    // @@@ --------> SECTION CRITIQUE <-------- @@@
-  }
-
-  // Methode pour le controle des jobs : relache un job suspendu
-  void BatchManager_Local::releaseJob(const JobId & jobid)
-  {
-    Id id;
-    istringstream iss(jobid.getReference());
-    iss >> id;
-
-    UNDER_LOCK( cout << "BatchManager is sending RELEASE command to the thread " << id << endl );
-
-    // On introduit une commande dans la queue du thread
-    // @@@ --------> SECTION CRITIQUE <-------- @@@
-    pthread_mutex_lock(&_threads_mutex);
-    if (_threads.find(id) != _threads.end())
-      _threads[id].command_queue.push(RELEASE);
-    pthread_mutex_unlock(&_threads_mutex);
-    // @@@ --------> SECTION CRITIQUE <-------- @@@
-  }
-
-
-  // Methode pour le controle des jobs : modifie un job en file d'attente
-  void BatchManager_Local::alterJob(const JobId & jobid, const Parametre & param, const Environnement & env)
-  {
-  }
-
-  // Methode pour le controle des jobs : modifie un job en file d'attente
-  void BatchManager_Local::alterJob(const JobId & jobid, const Parametre & param)
-  {
-    alterJob(jobid, param, Environnement());
-  }
-
-  // Methode pour le controle des jobs : modifie un job en file d'attente
-  void BatchManager_Local::alterJob(const JobId & jobid, const Environnement & env)
-  {
-    alterJob(jobid, Parametre(), env);
-  }
-
-
-
-  // Methode pour le controle des jobs : renvoie l'etat du job
-  JobInfo BatchManager_Local::queryJob(const JobId & jobid)
-  {
-    Id id;
-    istringstream iss(jobid.getReference());
-    iss >> id;
-
-    Parametre param;
-    Environnement env;
-
-    //UNDER_LOCK( cout << "JobInfo BatchManager_Local::queryJob(const JobId & jobid) : AVANT section critique" << endl );
-    // @@@ --------> SECTION CRITIQUE <-------- @@@
-    pthread_mutex_lock(&_threads_mutex);
-    std::map<Id, Child >::iterator pos = _threads.find(id);
-    bool found = (pos != _threads.end());
-    if (found) {
-      param = pos->second.param;
-      env   = pos->second.env;
-    }
-    pthread_mutex_unlock(&_threads_mutex);
-    // @@@ --------> SECTION CRITIQUE <-------- @@@
-    //UNDER_LOCK( cout << "JobInfo BatchManager_Local::queryJob(const JobId & jobid) : APRES section critique" << endl );
-
-    if (!found) throw InvalidArgumentException("Invalid JobId argument for queryJob");
-
-    JobInfo_Local ji(param, env);
-    return ji;
-  }
-
-
-  // Ce manager ne peut pas reprendre un job
-  // On force donc l'état du job Ã  erreur - pour cela on ne donne pas d'Id
-  // au JobId
-  const Batch::JobId
-  BatchManager_Local::addJob(const Batch::Job & job, const std::string reference)
-  {
-    return JobId(this, "undefined");
-  }
-
-  // Methode pour le controle des jobs : teste si un job est present en machine
-  bool BatchManager_Local::isRunning(const JobId & jobid)
-  {
-    Id id;
-    istringstream iss(jobid.getReference());
-    iss >> id;
-
-    //UNDER_LOCK( cout << "JobInfo BatchManager_Local::queryJob(const JobId & jobid) : AVANT section critique" << endl );
-    // @@@ --------> SECTION CRITIQUE <-------- @@@
-    pthread_mutex_lock(&_threads_mutex);
-    bool running = (_threads[id].param[STATE].str() == RUNNING);
-    pthread_mutex_unlock(&_threads_mutex);
-    // @@@ --------> SECTION CRITIQUE <-------- @@@
-    //UNDER_LOCK( cout << "JobInfo BatchManager_Local::queryJob(const JobId & jobid) : APRES section critique" << endl );
-
-    return running;
-  }
-
-
-  vector<string> BatchManager_Local::exec_command(const Parametre & param) const
-  {
-    ostringstream exec_sub_cmd;
-
-#ifdef WIN32
-    char drive[_MAX_DRIVE];
-    _splitpath(string(param[WORKDIR]).c_str(), drive, NULL, NULL, NULL);
-    if (strlen(drive) > 0) exec_sub_cmd << drive << " && ";
-#endif
-
-    string fileToExecute = param[EXECUTABLE].str();
-    string::size_type p1 = fileToExecute.find_last_of("/");
-    string fileNameToExecute = fileToExecute.substr(p1+1);
-
-    exec_sub_cmd << "cd " << param[WORKDIR] << " && ./" << fileNameToExecute;
-
-    if (param.find(ARGUMENTS) != param.end()) {
-      Versatile V = param[ARGUMENTS];
-      for(Versatile::const_iterator it=V.begin(); it!=V.end(); it++) {
-        StringType argt = * static_cast<StringType *>(*it);
-        string     arg  = argt;
-        exec_sub_cmd << " " << arg;
-      }
-    }
-
-    if (param.find(INFILE) != param.end()) {
-      Versatile V = param[INFILE];
-      for(Versatile::const_iterator it=V.begin(); it!=V.end(); it++) {
-        Couple cpl = * static_cast<CoupleType*>(*it);
-        string remote = cpl.getRemote();
-        if (remote == "stdin")
-        exec_sub_cmd << " <stdin";
-      }
-    }
-
-    if (param.find(OUTFILE) != param.end()) {
-      Versatile V = param[OUTFILE];
-      for(Versatile::const_iterator it=V.begin(); it!=V.end(); it++) {
-        Couple cpl = * static_cast<CoupleType*>(*it);
-        string remote = cpl.getRemote();
-        if (remote == "stdout") exec_sub_cmd << " 1>stdout";
-        if (remote == "stderr") exec_sub_cmd << " 2>stderr";
-      }
-    }
-
-    string user;
-    Parametre::const_iterator it = param.find(USER);
-    if (it != param.end()) {
-      user = string(it->second);
-    }
-
-    return _protocol.getExecCommandArgs(exec_sub_cmd.str(), _hostname, user);
-  }
-
-
-
-  // Constructeur de la classe ThreadAdapter
-  BatchManager_Local::ThreadAdapter::ThreadAdapter(BatchManager_Local & bm, const Job_Local & job, Id id) :
-  _bm(bm), _job(job), _id(id)
-  {
-    // Nothing to do
-  }
-
-
-
-  // Methode d'execution du thread
-  void * BatchManager_Local::ThreadAdapter::run(void * arg)
-  {
-    ThreadAdapter * p_ta = static_cast<ThreadAdapter *>(arg);
-
-#ifndef WIN32
-    // On bloque tous les signaux pour ce thread
-    sigset_t setmask;
-    sigfillset(&setmask);
-    pthread_sigmask(SIG_BLOCK, &setmask, NULL);
-#endif
-
-    // On autorise la terminaison differee du thread
-    // (ces valeurs sont les valeurs par defaut mais on les force par precaution)
-    pthread_setcancelstate(PTHREAD_CANCEL_ENABLE,  NULL);
-    pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL);
-
-    // On enregistre la fonction de suppression du fils en cas d'arret du thread
-    // Cette fontion sera automatiquement appelee lorsqu'une demande d'annulation
-    // sera prise en compte par pthread_testcancel()
-    Process child;
-    pthread_cleanup_push(BatchManager_Local::delete_on_exit, arg);
-    pthread_cleanup_push(BatchManager_Local::setFailedOnCancel, arg);
-    pthread_cleanup_push(BatchManager_Local::kill_child_on_exit, static_cast<void *> (&child));
-
-    // On forke/exec un nouveau process pour pouvoir controler le fils
-    // (plus finement qu'avec un appel system)
-    // int rc = system(commande.c_str());
-    //char *const parmList[] = {"/usr/bin/ssh", "localhost", "-l", "aribes", "sleep 10 && echo end", NULL};
-    //execv("/usr/bin/ssh", parmList);
-#ifdef WIN32
-    child = p_ta->launchWin32ChildProcess();
-    p_ta->pere(child);
-#else
-    child = fork();
-    if (child < 0) { // erreur
-      UNDER_LOCK( cerr << "Fork impossible (rc=" << child << ")" << endl );
-
-    } else if (child > 0) { // pere
-      p_ta->pere(child);
-
-    } else { // fils
-      p_ta->fils();
-    }
-#endif
-
-    pthread_mutex_lock(&p_ta->_bm._threads_mutex);
-
-    // Set the job state to FINISHED or FAILED
-    p_ta->_bm._threads[p_ta->_id].param[STATE] = (p_ta->_bm._threads[p_ta->_id].hasFailed) ? FAILED : FINISHED;
-
-    // On retire la fonction de nettoyage de la memoire
-    pthread_cleanup_pop(0);
-
-    // On retire la fonction de suppression du fils
-    pthread_cleanup_pop(0);
-
-    // remove setFailedOnCancel function from cancel stack
-    pthread_cleanup_pop(0);
-
-    pthread_mutex_unlock(&p_ta->_bm._threads_mutex);
-
-    // On invoque la fonction de nettoyage de la memoire
-    delete_on_exit(arg);
-
-    UNDER_LOCK( cout << "Father is leaving" << endl );
-    pthread_exit(NULL);
-    return NULL;
-  }
-
-
-
-
-  void BatchManager_Local::ThreadAdapter::pere(Process child)
-  {
-    time_t child_starttime = time(NULL);
-
-    // On enregistre le fils dans la table des threads
-    pthread_t thread_id = pthread_self();
-
-    Parametre param   = _job.getParametre();
-    Environnement env = _job.getEnvironnement();
-
-    ostringstream id_sst;
-    id_sst << _id;
-    param[ID]         = id_sst.str();
-    param[STATE]      = Batch::RUNNING;
-#ifndef WIN32
-    param[PID]        = child;
-#endif
-
-    _bm._threads[_id].thread_id = thread_id;
-#ifndef WIN32
-    _bm._threads[_id].pid       = child;
-#endif
-    _bm._threads[_id].hasFailed = false;
-    _bm._threads[_id].param     = param;
-    _bm._threads[_id].env       = env;
-    _bm._threads[_id].command_queue.push(NOP);
-
-    // Unlock the master thread. From here, all shared variables must be protected
-    // from concurrent access
-    pthread_cond_signal(&_bm._threadSyncCondition);
-
-
-    // on boucle en attendant que le fils ait termine
-    while (1) {
-#ifdef WIN32
-      DWORD exitCode;
-      GetExitCodeProcess(child, &exitCode);
-      if (exitCode != STILL_ACTIVE) {
-        UNDER_LOCK( cout << "Father sees his child is DONE: exit code = " << exitCode << endl );
-        break;
-      }
-#else
-      int child_rc = 0;
-      pid_t child_wait_rc = waitpid(child, &child_rc, WNOHANG /* | WUNTRACED */);
-      if (child_wait_rc > 0) {
-        UNDER_LOCK( cout << "Status is: " << WIFEXITED( child_rc) << endl);
-        UNDER_LOCK( cout << "Status is: " << WEXITSTATUS( child_rc) << endl);
-        UNDER_LOCK( cout << "Status is: " << WIFSIGNALED( child_rc) << endl);
-        UNDER_LOCK( cout << "Status is: " << WTERMSIG( child_rc) << endl);
-        UNDER_LOCK( cout << "Status is: " << WCOREDUMP( child_rc) << endl);
-        UNDER_LOCK( cout << "Status is: " << WIFSTOPPED( child_rc) << endl);
-        UNDER_LOCK( cout << "Status is: " << WSTOPSIG( child_rc) << endl);
-#ifdef WIFCONTINUED
-        UNDER_LOCK( cout << "Status is: " << WIFCONTINUED( child_rc) << endl); // not compilable on sarge
-#endif
-        if (WIFSTOPPED(child_rc)) {
-          // NOTA : pour rentrer dans cette section, il faut que le flag WUNTRACED
-          // soit positionne dans l'appel a waitpid ci-dessus. Ce flag est couramment
-          // desactive car s'il est possible de detecter l'arret d'un process, il est
-          // plus difficile de detecter sa reprise.
-
-          // Le fils est simplement stoppe
-          // @@@ --------> SECTION CRITIQUE <-------- @@@
-          pthread_mutex_lock(&_bm._threads_mutex);
-          _bm._threads[_id].param[STATE] = Batch::PAUSED;
-          pthread_mutex_unlock(&_bm._threads_mutex);
-          // @@@ --------> SECTION CRITIQUE <-------- @@@
-          UNDER_LOCK( cout << "Father sees his child is STOPPED : " << child_wait_rc << endl );
-
-        }
-        else {
-          // Le fils est termine, on sort de la boucle et du if englobant
-          UNDER_LOCK( cout << "Father sees his child is DONE : " << child_wait_rc << " (child_rc=" << (WIFEXITED(child_rc) ? WEXITSTATUS(child_rc) : -1) << ")" << endl );
-          break;
-        }
-      }
-      else if (child_wait_rc == -1) {
-        // Le fils a disparu ...
-        // @@@ --------> SECTION CRITIQUE <-------- @@@
-        pthread_mutex_lock(&_bm._threads_mutex);
-        _bm._threads[_id].hasFailed = true;
-        pthread_mutex_unlock(&_bm._threads_mutex);
-        // @@@ --------> SECTION CRITIQUE <-------- @@@
-        UNDER_LOCK( cout << "Father sees his child is DEAD : " << child_wait_rc << " (Reason : " << strerror(errno) << ")" << endl );
-        break;
-      }
-#endif
-
-      // On teste si le thread doit etre detruit
-      pthread_testcancel();
-
-
-
-      // On regarde si le fils n'a pas depasse son temps (wallclock time)
-      time_t child_currenttime = time(NULL);
-      long child_elapsedtime_minutes = (child_currenttime - child_starttime) / 60L;
-      if (param.find(MAXWALLTIME) != param.end()) {
-        long maxwalltime = param[MAXWALLTIME];
-        //       cout << "child_starttime          = " << child_starttime        << endl
-        //            << "child_currenttime        = " << child_currenttime      << endl
-        //            << "child_elapsedtime        = " << child_elapsedtime      << endl
-        //            << "maxwalltime              = " << maxwalltime            << endl
-        //            << "int(maxwalltime * 1.1)   = " << int(maxwalltime * 1.1) << endl;
-        if (child_elapsedtime_minutes > long((float)maxwalltime * 1.1) ) { // On se donne 10% de marge avant le KILL
-          UNDER_LOCK( cout << "Father is sending KILL command to the thread " << _id << endl );
-          // On introduit une commande dans la queue du thread
-          // @@@ --------> SECTION CRITIQUE <-------- @@@
-          pthread_mutex_lock(&_bm._threads_mutex);
-          if (_bm._threads.find(_id) != _bm._threads.end())
-            _bm._threads[_id].command_queue.push(KILL);
-          pthread_mutex_unlock(&_bm._threads_mutex);
-          // @@@ --------> SECTION CRITIQUE <-------- @@@
-
-
-        } else if (child_elapsedtime_minutes > maxwalltime ) {
-          UNDER_LOCK( cout << "Father is sending TERM command to the thread " << _id << endl );
-          // On introduit une commande dans la queue du thread
-          // @@@ --------> SECTION CRITIQUE <-------- @@@
-          pthread_mutex_lock(&_bm._threads_mutex);
-          if (_bm._threads.find(_id) != _bm._threads.end())
-            _bm._threads[_id].command_queue.push(TERM);
-          pthread_mutex_unlock(&_bm._threads_mutex);
-          // @@@ --------> SECTION CRITIQUE <-------- @@@
-        }
-      }
-
-
-
-      // On regarde s'il y a quelque chose a faire dans la queue de commande
-      // @@@ --------> SECTION CRITIQUE <-------- @@@
-      pthread_mutex_lock(&_bm._threads_mutex);
-      if (_bm._threads.find(_id) != _bm._threads.end()) {
-        while (_bm._threads[_id].command_queue.size() > 0) {
-          Commande cmd = _bm._threads[_id].command_queue.front();
-          _bm._threads[_id].command_queue.pop();
-
-          switch (cmd) {
-    case NOP:
-      UNDER_LOCK( cout << "Father does nothing to his child" << endl );
-      break;
-#ifndef WIN32
-    case HOLD:
-      UNDER_LOCK( cout << "Father is sending SIGSTOP signal to his child" << endl );
-      kill(child, SIGSTOP);
-      break;
-
-    case RELEASE:
-      UNDER_LOCK( cout << "Father is sending SIGCONT signal to his child" << endl );
-      kill(child, SIGCONT);
-      break;
-
-    case TERM:
-      UNDER_LOCK( cout << "Father is sending SIGTERM signal to his child" << endl );
-      kill(child, SIGTERM);
-      break;
-
-    case KILL:
-      UNDER_LOCK( cout << "Father is sending SIGKILL signal to his child" << endl );
-      kill(child, SIGKILL);
-      break;
-#endif
-    case ALTER:
-      break;
-
-    default:
-      break;
-          }
-        }
-
-      }
-      pthread_mutex_unlock(&_bm._threads_mutex);
-      // @@@ --------> SECTION CRITIQUE <-------- @@@
-
-      // On fait une petite pause pour ne pas surcharger inutilement le processeur
-#ifdef WIN32
-      Sleep(1000);
-#else
-      sleep(1);
-#endif
-
-    }
-
-  }
-
-
-
-#ifndef WIN32
-
-  void BatchManager_Local::ThreadAdapter::fils()
-  {
-    Parametre param = _job.getParametre();
-    Parametre::iterator it;
-
-      //char *const parmList[] = {"/usr/bin/ssh", "localhost", "-l", "aribes", "sleep 1 && echo end", NULL};
-      //int result = execv("/usr/bin/ssh", parmList);
-      //UNDER_LOCK( cout << "*** debug_command = " << result << endl );
-      //UNDER_LOCK( cout << "*** debug_command = " << strerror(errno) << endl );
-    try {
-
-      // EXECUTABLE is MANDATORY, if missing, we exit with failure notification
-      vector<string> command;
-      if (param.find(EXECUTABLE) != param.end()) {
-        command = _bm.exec_command(param);
-      } else exit(1);
-
-      // Build the argument array argv from the command
-      char ** argv = new char * [command.size() + 1];
-      string comstr;
-      for (string::size_type i=0 ; i<command.size() ; i++) {
-        argv[i] = new char[command[i].size() + 1];
-        strncpy(argv[i], command[i].c_str(), command[i].size() + 1);
-        if (i>0) comstr += " # ";
-        comstr += command[i];
-      }
-
-      argv[command.size()] = NULL;
-
-      UNDER_LOCK( cout << "*** debug_command = " << comstr << endl );
-      UNDER_LOCK( cout << "*** debug_command = " << argv[0] << endl );
-
-      // Create the environment for the new process. Note (RB): Here we change the environment for
-      // the process launched in local. It would seem more logical to set the environment for the
-      // remote process.
-      Environnement env = _job.getEnvironnement();
-
-      char ** envp = NULL;
-      if(env.size() > 0) {
-        envp = new char * [env.size() + 1]; // 1 pour le NULL terminal
-        int i = 0;
-        for(Environnement::const_iterator it=env.begin(); it!=env.end(); it++, i++) {
-          const string  & key   = (*it).first;
-          const string  & value = (*it).second;
-          ostringstream oss;
-          oss << key << "=" << value;
-          envp[i]         = new char [oss.str().size() + 1];
-          strncpy(envp[i], oss.str().c_str(), oss.str().size() + 1);
-        }
-
-        // assert (i == env.size())
-        envp[i] = NULL;
-      }
-
-      //char *const parmList[] = {"/usr/bin/ssh", "localhost", "-l", "aribes", "sleep 1 && echo end", NULL};
-      //int result = execv("/usr/bin/ssh", parmList);
-      //UNDER_LOCK( cout << "*** debug_command = " << result << endl );
-      //UNDER_LOCK( cout << "*** debug_command = " << strerror(errno) << endl );
-
-
-
-      // On positionne les limites systeme imposees au fils
-      // This part is deactivated because those limits should be set on the job process, not on
-      // the ssh process. If it is done properly one day, beware of the types used (int is not enough)
-      /*
-      if (param.find(MAXCPUTIME) != param.end()) {
-        int maxcputime = param[MAXCPUTIME];
-        struct rlimit limit;
-        limit.rlim_cur = maxcputime;
-        limit.rlim_max = int(maxcputime * 1.1);
-        setrlimit(RLIMIT_CPU, &limit);
-      }
-
-      if (param.find(MAXDISKSIZE) != param.end()) {
-        int maxdisksize = param[MAXDISKSIZE];
-        struct rlimit limit;
-        limit.rlim_cur = maxdisksize * 1024;
-        limit.rlim_max = int(maxdisksize * 1.1) * 1024;
-        setrlimit(RLIMIT_FSIZE, &limit);
-      }
-
-      if (param.find(MAXRAMSIZE) != param.end()) {
-        int maxramsize = param[MAXRAMSIZE];
-        struct rlimit limit;
-        limit.rlim_cur = maxramsize * 1024 * 1024;
-        limit.rlim_max = int(maxramsize * 1.1) * 1024 * 1024;
-        setrlimit(RLIMIT_AS, &limit);
-      }
-      */
-
-
-      //char *const parmList[] = {"/usr/bin/ssh", "localhost", "-l", "aribes", "sleep 1 && echo end", NULL};
-      //int result = execv("/usr/bin/ssh", parmList);
-      //UNDER_LOCK( cout << "*** debug_command = " << result << endl );
-      //UNDER_LOCK( cout << "*** debug_command = " << strerror(errno) << endl );
-
-      // On cree une session pour le fils de facon a ce qu'il ne soit pas
-      // detruit lorsque le shell se termine (le shell ouvre une session et
-      // tue tous les process appartenant a la session en quittant)
-      setsid();
-
-
-      // On ferme les descripteurs de fichiers standards
-      //close(STDIN_FILENO);
-      //close(STDOUT_FILENO);
-      //close(STDERR_FILENO);
-
-
-      // On execute la commande du fils
-      execve(argv[0], argv, envp);
-      UNDER_LOCK( cout << "*** debug_command = " << strerror(errno) << endl );
-      // No need to deallocate since nothing happens after a successful exec
-
-      // Normalement on ne devrait jamais arriver ici
-      ofstream file_err("error.log");
-      UNDER_LOCK( file_err << "Echec de l'appel a execve" << endl );
-
-    } catch (GenericException & e) {
-
-      std::cerr << "Caught exception : " << e.type << " : " << e.message << std::endl;
-    }
-
-    exit(99);
-  }
-
-#else
-
-  BatchManager_Local::Process BatchManager_Local::ThreadAdapter::launchWin32ChildProcess()
-  {
-    Parametre param = _job.getParametre();
-    Parametre::iterator it;
-    PROCESS_INFORMATION pi;
-
-    try {
-
-      // EXECUTABLE is MANDATORY, if missing, we throw an exception
-      vector<string> exec_command;
-      if (param.find(EXECUTABLE) != param.end()) {
-        exec_command = _bm.exec_command(param);
-      } else {
-        throw RunTimeException("Parameter \"EXECUTABLE\" is mandatory for local batch submission");
-      }
-
-      // Build the command string from the command argument vector
-      string comstr;
-      for (unsigned int i=0 ; i<exec_command.size() ; i++) {
-        if (i>0) comstr += " ";
-        comstr += exec_command[i];
-      }
-
-      UNDER_LOCK( cout << "*** debug_command = " << comstr << endl );
-
-      // Create the environment for the new process. Note (RB): Here we change the environment for
-      // the process launched in local. It would seem more logical to set the environment for the
-      // remote process.
-      // Note that if no environment is specified, we reuse the current environment.
-      Environnement env = _job.getEnvironnement();
-      char * chNewEnv = NULL;
-
-      if(env.size() > 0) {
-        chNewEnv = new char[4096];
-        LPTSTR lpszCurrentVariable = chNewEnv;
-        for(Environnement::const_iterator it=env.begin() ; it!=env.end() ; it++) {
-          const string  & key   = (*it).first;
-          const string  & value = (*it).second;
-          string envvar = key + "=" + value;
-          envvar.copy(lpszCurrentVariable, envvar.size());
-          lpszCurrentVariable[envvar.size()] = '\0';
-          lpszCurrentVariable += lstrlen(lpszCurrentVariable) + 1;
-        }
-        // Terminate the block with a NULL byte.
-        *lpszCurrentVariable = '\0';
-      }
-
-
-      STARTUPINFO si;
-      ZeroMemory( &si, sizeof(si) );
-      si.cb = sizeof(si);
-      ZeroMemory( &pi, sizeof(pi) );
-
-      // Copy the command to a non-const buffer
-      char * buffer = strdup(comstr.c_str());
-
-      // launch the new process
-      bool res = CreateProcess(NULL, buffer, NULL, NULL, FALSE,
-                               CREATE_NO_WINDOW, chNewEnv, NULL, &si, &pi);
-
-      if (buffer) free(buffer);
-      if (!res) throw RunTimeException("Error while creating new process");
-
-      CloseHandle(pi.hThread);
-
-    } catch (GenericException & e) {
-
-      std::cerr << "Caught exception : " << e.type << " : " << e.message << std::endl;
-    }
-
-    return pi.hProcess;
-  }
-
-#endif
-
-
-  void BatchManager_Local::kill_child_on_exit(void * p_pid)
-  {
-#ifndef WIN32
-    //TODO: porting of following functionality
-    pid_t child = * static_cast<pid_t *>(p_pid);
-
-    // On tue le fils
-    kill(child, SIGTERM);
-
-    // Nota : on pourrait aussi faire a la suite un kill(child, SIGKILL)
-    // mais cette option n'est pas implementee pour le moment, car il est
-    // preferable de laisser le process fils se terminer normalement et seul.
-#endif
-  }
-
-  void BatchManager_Local::delete_on_exit(void * arg)
-  {
-    ThreadAdapter * p_ta = static_cast<ThreadAdapter *>(arg);
-    delete p_ta;
-  }
-
-  void BatchManager_Local::setFailedOnCancel(void * arg)
-  {
-    ThreadAdapter * p_ta = static_cast<ThreadAdapter *>(arg);
-    pthread_mutex_lock(&p_ta->getBatchManager()._threads_mutex);
-    p_ta->getBatchManager()._threads[p_ta->getId()].param[STATE] = FAILED;
-    pthread_mutex_unlock(&p_ta->getBatchManager()._threads_mutex);
-
-    // Unlock the master thread. From here, the batch manager instance should not be used.
-    pthread_cond_signal(&p_ta->getBatchManager()._threadSyncCondition);
-  }
-
-}
diff --git a/src/Local/Batch_BatchManager_Local.hxx b/src/Local/Batch_BatchManager_Local.hxx
deleted file mode 100644 (file)
index 2fbd229..0000000
+++ /dev/null
@@ -1,170 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * BatchManager_Local.hxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail   : mailto:ivan.dutka-malen@der.edf.fr
- * Date   : Thu Nov  6 10:17:22 2003
- * Projet : Salome 2
- *
- * Refactored by Renaud Barate (EDF R&D) in September 2009 to use
- * CommunicationProtocol classes and merge Local_SH, Local_RSH and Local_SSH batch
- * managers.
- *
- */
-
-#ifndef _BATCHMANAGER_LOCAL_H_
-#define _BATCHMANAGER_LOCAL_H_
-
-#include "Batch_Defines.hxx"
-#include "Batch_CommunicationProtocol.hxx"
-
-#ifdef WIN32
-#include <Windows.h>
-#endif
-
-#include <list>
-#include <map>
-#include <queue>
-#include <pthread.h>
-#include "Batch_Job.hxx"
-#include "Batch_JobId.hxx"
-#include "Batch_JobInfo.hxx"
-#include "Batch_JobInfo_Local.hxx"
-#include "Batch_Job_Local.hxx"
-#include "Batch_BatchManager.hxx"
-
-namespace Batch {
-
-  class FactBatchManager;
-
-  /*!
-   *  This class defines a local pseudo batch manager that can launch jobs locally or on a remote
-   *  machine with SSH or RSH. This class is NOT thread-safe.
-   */
-  class BATCH_EXPORT BatchManager_Local : virtual public BatchManager
-  {
-  private:
-    typedef int Id;
-#ifdef WIN32
-    typedef HANDLE Process;
-#else
-    typedef pid_t Process;
-#endif
-    friend class ThreadAdapter;
-    class ThreadAdapter{
-    public:
-      ThreadAdapter(BatchManager_Local & bm, const Job_Local & job, Id id);
-      static void * run(void * arg);
-      BatchManager_Local & getBatchManager() const { return _bm; };
-      Id getId() const { return _id; };
-
-    protected:
-      BatchManager_Local & _bm;
-      const Job_Local _job;
-      Id _id;
-
-    private:
-      void pere(Process child);
-#ifndef WIN32
-      void fils();
-#else
-      Process launchWin32ChildProcess();
-#endif
-
-    };
-
-    enum Commande {
-      NOP = 0,
-      HOLD,
-      RELEASE,
-      TERM,
-      KILL,
-      ALTER
-    };
-
-    struct Child {
-      pthread_t thread_id;
-      std::queue<Commande, std::deque<Commande> > command_queue;
-      pid_t pid;
-      int exit_code;
-      bool hasFailed;
-      Parametre param;
-      Environnement env;
-    };
-
-
-
-  public:
-
-    BatchManager_Local(const Batch::FactBatchManager * parent, const char * host = "localhost",
-                       const char * username = "",
-                       CommunicationProtocolType protocolType = SSH, const char * mpiImpl = "nompi");
-    virtual ~BatchManager_Local();
-
-    // Recupere le nom du serveur par defaut
-    // static string BatchManager_Local::getDefaultServer();
-
-    // Methodes pour le controle des jobs
-    virtual const JobId submitJob(const Job & job); // soumet un job au gestionnaire
-    virtual void deleteJob(const JobId & jobid); // retire un job du gestionnaire
-    virtual void holdJob(const JobId & jobid); // suspend un job en file d'attente
-    virtual void releaseJob(const JobId & jobid); // relache un job suspendu
-    virtual void alterJob(const JobId & jobid, const Parametre & param, const Environnement & env); // modifie un job en file d'attente
-    virtual void alterJob(const JobId & jobid, const Parametre & param); // modifie un job en file d'attente
-    virtual void alterJob(const JobId & jobid, const Environnement & env); // modifie un job en file d'attente
-    virtual JobInfo queryJob(const JobId & jobid); // renvoie l'etat du job
-    virtual bool isRunning(const JobId & jobid); // teste si un job est present en machine
-
-    virtual void setParametre(const JobId & jobid, const Parametre & param) { return alterJob(jobid, param); } // modifie un job en file d'attente
-    virtual void setEnvironnement(const JobId & jobid, const Environnement & env) { return alterJob(jobid, env); } // modifie un job en file d'attente
-
-    virtual const Batch::JobId addJob(const Batch::Job & job, const std::string reference); // ajoute un nouveau job sans le soumettre
-
-  protected:
-    int _connect; // Local connect id
-    pthread_mutex_t _threads_mutex;
-    std::map<Id, Child > _threads;
-
-    // Methode qui renvoie la commande a executer
-    std::vector<std::string> exec_command(const Parametre & param) const;
-
-  private:
-    static  void kill_child_on_exit(void * p_pid);
-    static  void delete_on_exit(void * arg);
-    static void setFailedOnCancel(void * arg);
-    pthread_cond_t _threadSyncCondition;
-    Id _idCounter;
-
-#ifdef SWIG
-  public:
-    // Recupere le l'identifiant d'un job deja soumis au BatchManager
-    //virtual const JobId getJobIdByReference(const string & ref) { return BatchManager::getJobIdByReference(ref); }
-    virtual const JobId getJobIdByReference(const char * ref) { return BatchManager::getJobIdByReference(ref); }
-#endif
-
-  };
-
-}
-
-#endif
diff --git a/src/Local/Batch_FactBatchManager_Local.cxx b/src/Local/Batch_FactBatchManager_Local.cxx
deleted file mode 100644 (file)
index 3c89fb8..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * FactBatchManager_Local.cxx : 
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date   : Septembre 2004
- * Projet : SALOME 2
- *
- * Refactored by Renaud Barate (EDF R&D) in September 2009 to use
- * CommunicationProtocol classes and merge Local_SH, Local_RSH and Local_SSH batch
- * managers.
- *
- */
-
-#include <Batch_config.h>
-
-#include "Batch_BatchManager_Local.hxx"
-#include "Batch_FactBatchManager_Local.hxx"
-
-namespace Batch {
-
-  static FactBatchManager_Local sFBM_Local;
-
-  FactBatchManager_Local::FactBatchManager_Local()
-    : FactBatchManager("LOCAL")
-  {
-  }
-
-  FactBatchManager_Local::~FactBatchManager_Local()
-  {
-  }
-
-  BatchManager * FactBatchManager_Local::operator() (const char * hostname,
-                                                     const char * username,
-                                                     CommunicationProtocolType protocolType,
-                                                     const char * mpi) const
-  {
-    return new BatchManager_Local(this, hostname, username, protocolType, mpi);
-  }
-
-}
diff --git a/src/Local/Batch_FactBatchManager_Local.hxx b/src/Local/Batch_FactBatchManager_Local.hxx
deleted file mode 100644 (file)
index d1da8e6..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * FactBatchManager_Local.hxx : 
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Date   : Septembre 2004
- * Projet : SALOME 2
- *
- * Refactored by Renaud Barate (EDF R&D) in September 2009 to use
- * CommunicationProtocol classes and merge Local_SH, Local_RSH and Local_SSH batch
- * managers.
- *
- */
-
-#ifndef _FACTBATCHMANAGER_LOCAL_H_
-#define _FACTBATCHMANAGER_LOCAL_H_
-
-#include "Batch_FactBatchManager.hxx"
-#include "Batch_CommunicationProtocol.hxx"
-
-namespace Batch {
-  
-  class FactBatchManager_Local : public FactBatchManager
-  {
-  public:
-
-    FactBatchManager_Local();
-    virtual ~FactBatchManager_Local();
-
-    virtual BatchManager * operator() (const char * hostname,
-                                       const char * username = "",
-                                       CommunicationProtocolType protocolType = SSH,
-                                       const char * mpi = "nompi") const;
-
-  };
-
-}
-
-#endif
diff --git a/src/Local/Batch_IOMutex.cxx b/src/Local/Batch_IOMutex.cxx
deleted file mode 100644 (file)
index 37d9770..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * IOMutex.cxx : 
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail   : mailto:ivan.dutka-malen@der.edf.fr
- * Date   : Fri Nov 14 11:00:39 2003
- * Projet : Salome 2
- *
- */
-
-#include "Batch_IOMutex.hxx"
-
-namespace Batch {
-
-  pthread_mutex_t IOMutex = PTHREAD_MUTEX_INITIALIZER;
-
-}
diff --git a/src/Local/Batch_IOMutex.hxx b/src/Local/Batch_IOMutex.hxx
deleted file mode 100644 (file)
index b7e34ce..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * IOMutex.hxx : 
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail   : mailto:ivan.dutka-malen@der.edf.fr
- * Date   : Fri Nov 14 11:00:39 2003
- * Projet : Salome 2
- *
- */
-
-#ifndef _IOMUTEX_H_
-#define _IOMUTEX_H_
-
-#include <pthread.h>
-
-#define LOCK_IO               { pthread_mutex_lock(&Batch::IOMutex) ; }
-#define UNLOCK_IO             { pthread_mutex_unlock(&Batch::IOMutex) ; }
-#define UNDER_LOCK(statement) { LOCK_IO ; { statement ; } ; UNLOCK_IO ; }
-
-namespace Batch {
-
-  extern pthread_mutex_t IOMutex;
-  
-}
-
-#endif
diff --git a/src/Local/Batch_JobInfo_Local.cxx b/src/Local/Batch_JobInfo_Local.cxx
deleted file mode 100644 (file)
index 3a742bb..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * JobInfo_Local.cxx : 
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail   : mailto:ivan.dutka-malen@der.edf.fr
- * Date   : Fri Nov 21 09:42:06 2003
- * Projet : Salome 2
- *
- */
-
-#include <cstdio>
-#include "Batch_Parametre.hxx"
-#include "Batch_Environnement.hxx"
-#include "Batch_JobInfo_Local.hxx"
-
-namespace Batch {
-
-  // Constructeurs
-  JobInfo_Local::JobInfo_Local(const Parametre & param, const Environnement & env) :
-    JobInfo(param, env)
-  {
-    // Nothing to do
-  }
-
-
-  // Destructeur
-  JobInfo_Local::~JobInfo_Local()
-  {
-    // Nothing to do
-  }
-  
-
-}
diff --git a/src/Local/Batch_JobInfo_Local.hxx b/src/Local/Batch_JobInfo_Local.hxx
deleted file mode 100644 (file)
index f5f1160..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * JobInfo_Local.hxx : 
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail   : mailto:ivan.dutka-malen@der.edf.fr
- * Date   : Fri Nov 21 09:42:05 2003
- * Projet : Salome 2
- *
- */
-
-#ifndef _JOBINFO_LOCAL_H_
-#define _JOBINFO_LOCAL_H_
-
-#include <string>
-#include "Batch_JobInfo.hxx"
-
-namespace Batch {
-
-  class JobInfo_Local : public JobInfo
-  {
-  public:
-    // Constructeurs et destructeur
-    JobInfo_Local() {};
-    JobInfo_Local(const Parametre & param, const Environnement & env);
-    virtual ~JobInfo_Local();
-
-    // Constructeur par recopie
-    JobInfo_Local(const JobInfo_Local & jinfo) : JobInfo(jinfo) {};
-
-
-  protected:
-
-  private:
-
-  };
-
-}
-
-#endif
diff --git a/src/Local/Batch_Job_Local.cxx b/src/Local/Batch_Job_Local.cxx
deleted file mode 100644 (file)
index 28355bc..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * Job_Local.cxx :
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail   : mailto:ivan.dutka-malen@der.edf.fr
- * Date   : Fri Nov 14 11:00:39 2003
- * Projet : Salome 2
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#ifndef WIN32
-#include <unistd.h>
-#endif
-
-#include "Batch_Constants.hxx"
-#include "Batch_Job_Local.hxx"
-
-using namespace std;
-
-namespace Batch {
-
-  // Constructeur
-  Job_Local::Job_Local(const Job & job) :
-    _command(), _param(job.getParametre()), _env(job.getEnvironnement())
-  {
-    // On convertit les objets Parametre et Environnement en liste chainee d'attributs + operateur
-    addEnvironnement( _env   );
-    addParametre    ( _param );
-  }
-
-
-  // Destructeur
-  Job_Local::~Job_Local()
-  {
-  }
-
-
-  void Job_Local::addParametre(const Parametre & P)
-  {
-    // En dernier, on ajoute le chemin complet de la commande
-    _command += P[EXECUTABLE].str();
-  }
-
-
-  void Job_Local::addEnvironnement(const Environnement & E)
-  {
-    for(Environnement::const_iterator it=E.begin(); it != E.end(); it++) {
-      string variable = (*it).first;
-      string value    = (*it).second;
-
-      // On remplace toutes les occurences de single-quote par backslash-single-quote
-      for(size_t pos=0; pos < value.size(); pos++) {
-        pos = value.find("'", pos);
-        if ( pos > value.size() ) break;
-        value.replace(pos, 1, "\'");
-      }
-      _command += variable + "='" + value + "' ";
-    }
-  }
-
-  string Job_Local::getCommand(void) const {
-    return _command;
-  }
-
-
-  // Retourne l'objet Parametre
-  Parametre Job_Local::getParametre() const
-  {
-    return _param;
-  }
-
-  // Retourne l'objet Environnement
-  Environnement Job_Local::getEnvironnement() const
-  {
-    return _env;
-  }
-
-
-}
diff --git a/src/Local/Batch_Job_Local.hxx b/src/Local/Batch_Job_Local.hxx
deleted file mode 100644 (file)
index a07f115..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * Job_Local.hxx : 
- *
- * Auteur : Ivan DUTKA-MALEN - EDF R&D
- * Mail   : mailto:ivan.dutka-malen@der.edf.fr
- * Date   : Fri Nov 14 11:00:39 2003
- * Projet : Salome 2
- *
- */
-
-#ifndef _JOB_LOCAL_H_
-#define _JOB_LOCAL_H_
-
-#include "Batch_Parametre.hxx"
-#include "Batch_Environnement.hxx"
-#include "Batch_Job.hxx"
-
-namespace Batch {
-
-  class Job_Local
-  {
-  public:
-    // Constructeur et destructeur
-    Job_Local(const Job & job);
-    virtual ~Job_Local();
-
-    // Retourne la commande _command
-    virtual std::string getCommand(void) const;
-
-    // Retourne l'objet Parametre
-    virtual Parametre getParametre() const;
-
-    // Retourne l'objet Environnement
-    virtual Environnement getEnvironnement() const;
-
-
-  protected:
-    std::string _command;
-    Parametre _param;
-    Environnement _env;
-
-  private:
-    void addParametre(const Parametre & P);
-    void addEnvironnement(const Environnement & E);
-
-  };
-
-}
-
-#endif
index 93f746c5dc9dd6124956661aa3751fecd0457f48..c2d091a9c9978f63502efe2fb49c1941f128d5cd 100644 (file)
 #  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-SET(CLASS_LIST Local/Batch_BatchManager_Local
-               Local/Batch_FactBatchManager_Local
-               Local/Batch_IOMutex
-               Local/Batch_Job_Local
-               Local/Batch_JobInfo_Local
+SET(CLASS_LIST Local/BatchManager_Local
+               Local/FactBatchManager_Local
+               Local/IOMutex
+               Local/Job_Local
+               Local/JobInfo_Local
    )
 
 APPEND_CLASSES_TO_SRC_FILES(${CLASS_LIST})
diff --git a/src/Local/FactBatchManager_Local.cxx b/src/Local/FactBatchManager_Local.cxx
new file mode 100644 (file)
index 0000000..935c2a9
--- /dev/null
@@ -0,0 +1,61 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * FactBatchManager_Local.cxx : 
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date   : Septembre 2004
+ * Projet : SALOME 2
+ *
+ * Refactored by Renaud Barate (EDF R&D) in September 2009 to use
+ * CommunicationProtocol classes and merge Local_SH, Local_RSH and Local_SSH batch
+ * managers.
+ *
+ */
+
+#include <config.h>
+
+#include "BatchManager_Local.hxx"
+#include "FactBatchManager_Local.hxx"
+
+namespace Batch {
+
+  static FactBatchManager_Local sFBM_Local;
+
+  FactBatchManager_Local::FactBatchManager_Local()
+    : FactBatchManager("LOCAL")
+  {
+  }
+
+  FactBatchManager_Local::~FactBatchManager_Local()
+  {
+  }
+
+  BatchManager * FactBatchManager_Local::operator() (const char * hostname,
+                                                     const char * username,
+                                                     CommunicationProtocolType protocolType,
+                                                     const char * mpi) const
+  {
+    return new BatchManager_Local(this, hostname, username, protocolType, mpi);
+  }
+
+}
diff --git a/src/Local/FactBatchManager_Local.hxx b/src/Local/FactBatchManager_Local.hxx
new file mode 100644 (file)
index 0000000..09fffff
--- /dev/null
@@ -0,0 +1,59 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * FactBatchManager_Local.hxx : 
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Date   : Septembre 2004
+ * Projet : SALOME 2
+ *
+ * Refactored by Renaud Barate (EDF R&D) in September 2009 to use
+ * CommunicationProtocol classes and merge Local_SH, Local_RSH and Local_SSH batch
+ * managers.
+ *
+ */
+
+#ifndef _FACTBATCHMANAGER_LOCAL_H_
+#define _FACTBATCHMANAGER_LOCAL_H_
+
+#include "FactBatchManager.hxx"
+#include "CommunicationProtocol.hxx"
+
+namespace Batch {
+  
+  class FactBatchManager_Local : public FactBatchManager
+  {
+  public:
+
+    FactBatchManager_Local();
+    virtual ~FactBatchManager_Local();
+
+    virtual BatchManager * operator() (const char * hostname,
+                                       const char * username = "",
+                                       CommunicationProtocolType protocolType = SSH,
+                                       const char * mpi = "nompi") const;
+
+  };
+
+}
+
+#endif
diff --git a/src/Local/IOMutex.cxx b/src/Local/IOMutex.cxx
new file mode 100644 (file)
index 0000000..7991942
--- /dev/null
@@ -0,0 +1,38 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * IOMutex.cxx : 
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail   : mailto:ivan.dutka-malen@der.edf.fr
+ * Date   : Fri Nov 14 11:00:39 2003
+ * Projet : Salome 2
+ *
+ */
+
+#include "IOMutex.hxx"
+
+namespace Batch {
+
+  pthread_mutex_t IOMutex = PTHREAD_MUTEX_INITIALIZER;
+
+}
diff --git a/src/Local/IOMutex.hxx b/src/Local/IOMutex.hxx
new file mode 100644 (file)
index 0000000..b7e34ce
--- /dev/null
@@ -0,0 +1,47 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * IOMutex.hxx : 
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail   : mailto:ivan.dutka-malen@der.edf.fr
+ * Date   : Fri Nov 14 11:00:39 2003
+ * Projet : Salome 2
+ *
+ */
+
+#ifndef _IOMUTEX_H_
+#define _IOMUTEX_H_
+
+#include <pthread.h>
+
+#define LOCK_IO               { pthread_mutex_lock(&Batch::IOMutex) ; }
+#define UNLOCK_IO             { pthread_mutex_unlock(&Batch::IOMutex) ; }
+#define UNDER_LOCK(statement) { LOCK_IO ; { statement ; } ; UNLOCK_IO ; }
+
+namespace Batch {
+
+  extern pthread_mutex_t IOMutex;
+  
+}
+
+#endif
diff --git a/src/Local/JobInfo_Local.cxx b/src/Local/JobInfo_Local.cxx
new file mode 100644 (file)
index 0000000..988d6cd
--- /dev/null
@@ -0,0 +1,54 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * JobInfo_Local.cxx : 
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail   : mailto:ivan.dutka-malen@der.edf.fr
+ * Date   : Fri Nov 21 09:42:06 2003
+ * Projet : Salome 2
+ *
+ */
+
+#include <cstdio>
+#include "Parametre.hxx"
+#include "Environnement.hxx"
+#include "JobInfo_Local.hxx"
+
+namespace Batch {
+
+  // Constructeurs
+  JobInfo_Local::JobInfo_Local(const Parametre & param, const Environnement & env) :
+    JobInfo(param, env)
+  {
+    // Nothing to do
+  }
+
+
+  // Destructeur
+  JobInfo_Local::~JobInfo_Local()
+  {
+    // Nothing to do
+  }
+  
+
+}
diff --git a/src/Local/JobInfo_Local.hxx b/src/Local/JobInfo_Local.hxx
new file mode 100644 (file)
index 0000000..4534b8f
--- /dev/null
@@ -0,0 +1,60 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * JobInfo_Local.hxx : 
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail   : mailto:ivan.dutka-malen@der.edf.fr
+ * Date   : Fri Nov 21 09:42:05 2003
+ * Projet : Salome 2
+ *
+ */
+
+#ifndef _JOBINFO_LOCAL_H_
+#define _JOBINFO_LOCAL_H_
+
+#include <string>
+#include "JobInfo.hxx"
+
+namespace Batch {
+
+  class JobInfo_Local : public JobInfo
+  {
+  public:
+    // Constructeurs et destructeur
+    JobInfo_Local() {};
+    JobInfo_Local(const Parametre & param, const Environnement & env);
+    virtual ~JobInfo_Local();
+
+    // Constructeur par recopie
+    JobInfo_Local(const JobInfo_Local & jinfo) : JobInfo(jinfo) {};
+
+
+  protected:
+
+  private:
+
+  };
+
+}
+
+#endif
diff --git a/src/Local/Job_Local.cxx b/src/Local/Job_Local.cxx
new file mode 100644 (file)
index 0000000..f7109a7
--- /dev/null
@@ -0,0 +1,102 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * Job_Local.cxx :
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail   : mailto:ivan.dutka-malen@der.edf.fr
+ * Date   : Fri Nov 14 11:00:39 2003
+ * Projet : Salome 2
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#ifndef WIN32
+#include <unistd.h>
+#endif
+
+#include "Constants.hxx"
+#include "Job_Local.hxx"
+
+using namespace std;
+
+namespace Batch {
+
+  // Constructeur
+  Job_Local::Job_Local(const Job & job) :
+    _command(), _param(job.getParametre()), _env(job.getEnvironnement())
+  {
+    // On convertit les objets Parametre et Environnement en liste chainee d'attributs + operateur
+    addEnvironnement( _env   );
+    addParametre    ( _param );
+  }
+
+
+  // Destructeur
+  Job_Local::~Job_Local()
+  {
+  }
+
+
+  void Job_Local::addParametre(const Parametre & P)
+  {
+    // En dernier, on ajoute le chemin complet de la commande
+    _command += P[EXECUTABLE].str();
+  }
+
+
+  void Job_Local::addEnvironnement(const Environnement & E)
+  {
+    for(Environnement::const_iterator it=E.begin(); it != E.end(); it++) {
+      string variable = (*it).first;
+      string value    = (*it).second;
+
+      // On remplace toutes les occurences de single-quote par backslash-single-quote
+      for(size_t pos=0; pos < value.size(); pos++) {
+        pos = value.find("'", pos);
+        if ( pos > value.size() ) break;
+        value.replace(pos, 1, "\'");
+      }
+      _command += variable + "='" + value + "' ";
+    }
+  }
+
+  string Job_Local::getCommand(void) const {
+    return _command;
+  }
+
+
+  // Retourne l'objet Parametre
+  Parametre Job_Local::getParametre() const
+  {
+    return _param;
+  }
+
+  // Retourne l'objet Environnement
+  Environnement Job_Local::getEnvironnement() const
+  {
+    return _env;
+  }
+
+
+}
diff --git a/src/Local/Job_Local.hxx b/src/Local/Job_Local.hxx
new file mode 100644 (file)
index 0000000..d2c2e25
--- /dev/null
@@ -0,0 +1,71 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * Job_Local.hxx : 
+ *
+ * Auteur : Ivan DUTKA-MALEN - EDF R&D
+ * Mail   : mailto:ivan.dutka-malen@der.edf.fr
+ * Date   : Fri Nov 14 11:00:39 2003
+ * Projet : Salome 2
+ *
+ */
+
+#ifndef _JOB_LOCAL_H_
+#define _JOB_LOCAL_H_
+
+#include "Parametre.hxx"
+#include "Environnement.hxx"
+#include "Job.hxx"
+
+namespace Batch {
+
+  class Job_Local
+  {
+  public:
+    // Constructeur et destructeur
+    Job_Local(const Job & job);
+    virtual ~Job_Local();
+
+    // Retourne la commande _command
+    virtual std::string getCommand(void) const;
+
+    // Retourne l'objet Parametre
+    virtual Parametre getParametre() const;
+
+    // Retourne l'objet Environnement
+    virtual Environnement getEnvironnement() const;
+
+
+  protected:
+    std::string _command;
+    Parametre _param;
+    Environnement _env;
+
+  private:
+    void addParametre(const Parametre & P);
+    void addEnvironnement(const Environnement & E);
+
+  };
+
+}
+
+#endif
index 2bf22bd6a60220c6152e9962f73c9e369f996652..246638edb5443688c797536244f114747c177caf 100644 (file)
 #include <iostream>
 #include <fstream>
 
-#include <Batch_Constants.hxx>
-#include <Batch_Job.hxx>
-#include <Batch_BatchManagerCatalog.hxx>
-#include <Batch_FactBatchManager.hxx>
-#include <Batch_BatchManager.hxx>
+#include <Constants.hxx>
+#include <Job.hxx>
+#include <BatchManagerCatalog.hxx>
+#include <FactBatchManager.hxx>
+#include <BatchManager.hxx>
 
 #include <SimpleParser.hxx>
 
index 3734249d4a0bf0f276e8f98a9505df8889bf04ea..943b34d82a22a5ce1aa464c68b9c826c4d903cfe 100644 (file)
 #include <iostream>
 #include <fstream>
 
-#include <Batch_Constants.hxx>
-#include <Batch_Job.hxx>
-#include <Batch_BatchManagerCatalog.hxx>
-#include <Batch_FactBatchManager.hxx>
-#include <Batch_BatchManager.hxx>
+#include <Constants.hxx>
+#include <Job.hxx>
+#include <BatchManagerCatalog.hxx>
+#include <FactBatchManager.hxx>
+#include <BatchManager.hxx>
 
 #include <Test_Local_config.h>
 #include <SimpleParser.hxx>
index 673a8946f0811b85c1287ffd60513b47b37ac356..c99b3f919c5738fc67b7131ebd9fdd8488e61048 100644 (file)
 #include <fstream>
 #include <cstdlib>
 
-#include <Batch_Constants.hxx>
-#include <Batch_Job.hxx>
-#include <Batch_BatchManagerCatalog.hxx>
-#include <Batch_FactBatchManager.hxx>
-#include <Batch_BatchManager.hxx>
+#include <Constants.hxx>
+#include <Job.hxx>
+#include <BatchManagerCatalog.hxx>
+#include <FactBatchManager.hxx>
+#include <BatchManager.hxx>
 
 #include <SimpleParser.hxx>
 
diff --git a/src/PBS/BatchManager_PBS.cxx b/src/PBS/BatchManager_PBS.cxx
new file mode 100644 (file)
index 0000000..024ebc1
--- /dev/null
@@ -0,0 +1,290 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * BatchManager_PBS.cxx : emulation of PBS client
+ *
+ * Auteur : Bernard SECHER - CEA DEN, André RIBES - EDF R&D
+ * Mail   : mailto:bernard.secher@cea.fr
+ * Date   : Thu Apr 24 10:17:22 2008
+ * Projet : PAL Salome
+ *
+ */
+
+#include <cstdlib>
+#include <fstream>
+#include <sstream>
+
+#include <Constants.hxx>
+#include <Utils.hxx>
+#include <NotYetImplementedException.hxx>
+
+#include "BatchManager_PBS.hxx"
+#include "JobInfo_PBS.hxx"
+
+using namespace std;
+
+namespace Batch {
+
+  BatchManager_PBS::BatchManager_PBS(const FactBatchManager * parent, const char * host,
+                                       const char * username,
+                                       CommunicationProtocolType protocolType, const char * mpiImpl)
+    : BatchManager(parent, host, username, protocolType, mpiImpl)
+  {
+    // Nothing to do
+  }
+
+  // Destructeur
+  BatchManager_PBS::~BatchManager_PBS()
+  {
+    // Nothing to do
+  }
+
+  // Methode pour le controle des jobs : soumet un job au gestionnaire
+  const JobId BatchManager_PBS::submitJob(const Job & job)
+  {
+    Parametre params = job.getParametre();
+    const std::string workDir = params[WORKDIR];
+
+    // export input files on cluster
+    exportInputFiles(job);
+
+    // build batch script for job
+    string scriptFile = buildSubmissionScript(job);
+
+    // define command to submit batch
+    string subCommand = string("cd ") + workDir + "; qsub " + scriptFile;
+    string command = _protocol.getExecCommand(subCommand, _hostname, _username);
+    command += " 2>&1";
+    cerr << command.c_str() << endl;
+
+    // submit job
+    string output;
+    int status = Utils::getCommandOutput(command, output);
+    cout << output;
+    if (status != 0) throw RunTimeException("Can't submit job, error was: " + output);
+
+    // normally output contains only id of submitted job, we just need to remove the final \n
+    string jobref = output.substr(0, output.size() - 1);
+    JobId id(this, jobref);
+
+    return id;
+  }
+
+  // Ce manager permet de faire de la reprise
+  const Batch::JobId
+  BatchManager_PBS::addJob(const Batch::Job & job, const std::string reference)
+  {
+    return JobId(this, reference);
+  }
+
+  // Methode pour le controle des jobs : retire un job du gestionnaire
+  void BatchManager_PBS::deleteJob(const JobId & jobid)
+  {
+    int status;
+    int ref;
+    istringstream iss(jobid.getReference());
+    iss >> ref;
+
+    // define command to delete batch
+    string subCommand = string("qdel ") + iss.str();
+    string command = _protocol.getExecCommand(subCommand, _hostname, _username);
+    cerr << command.c_str() << endl;
+    status = system(command.c_str());
+    if (status)
+      throw RunTimeException("Error of connection on remote host");
+
+    cerr << "jobId = " << ref << "killed" << endl;
+  }
+
+  // Methode pour le controle des jobs : suspend un job en file d'attente
+  void BatchManager_PBS::holdJob(const JobId & jobid)
+  {
+    throw NotYetImplementedException("BatchManager_PBS::holdJob");
+  }
+
+  // Methode pour le controle des jobs : relache un job suspendu
+  void BatchManager_PBS::releaseJob(const JobId & jobid)
+  {
+    throw NotYetImplementedException("BatchManager_PBS::releaseJob");
+  }
+
+
+  // Methode pour le controle des jobs : modifie un job en file d'attente
+  void BatchManager_PBS::alterJob(const JobId & jobid, const Parametre & param, const Environnement & env)
+  {
+    throw NotYetImplementedException("BatchManager_PBS::alterJob");
+  }
+
+  // Methode pour le controle des jobs : modifie un job en file d'attente
+  void BatchManager_PBS::alterJob(const JobId & jobid, const Parametre & param)
+  {
+    alterJob(jobid, param, Environnement());
+  }
+
+  // Methode pour le controle des jobs : modifie un job en file d'attente
+  void BatchManager_PBS::alterJob(const JobId & jobid, const Environnement & env)
+  {
+    alterJob(jobid, Parametre(), env);
+  }
+
+  // Methode pour le controle des jobs : renvoie l'etat du job
+  JobInfo BatchManager_PBS::queryJob(const JobId & jobid)
+  {
+    int id;
+    istringstream iss(jobid.getReference());
+    iss >> id;
+
+    // define command to query batch
+    string subCommand = string("qstat -f ") + iss.str();
+    string command = _protocol.getExecCommand(subCommand, _hostname, _username);
+    cerr << command.c_str() << endl;
+
+    string output;
+    int status = Utils::getCommandOutput(command, output);
+    if(status && status != 153 && status != 256*153)
+      throw RunTimeException("Error of connection on remote host");
+
+    JobInfo_PBS ji = JobInfo_PBS(id, output);
+    return ji;
+  }
+
+  // Methode pour le controle des jobs : teste si un job est present en machine
+  bool BatchManager_PBS::isRunning(const JobId & jobid)
+  {
+    throw NotYetImplementedException("BatchManager_PBS::isRunning");
+  }
+
+  std::string BatchManager_PBS::buildSubmissionScript(const Job & job)
+  {
+    Parametre params = job.getParametre();
+    Environnement env = job.getEnvironnement();
+
+    // Mandatory parameters
+    string workDir;
+    if (params.find(WORKDIR) != params.end()) 
+      workDir = params[WORKDIR].str();
+    else 
+      throw RunTimeException("params[WORKDIR] is not defined ! Please defined it, cannot submit this job");
+    string fileToExecute;
+    if (params.find(EXECUTABLE) != params.end()) 
+      fileToExecute = params[EXECUTABLE].str();
+    else 
+      throw RunTimeException("params[EXECUTABLE] is not defined ! Please defined it, cannot submit this job");
+
+    // Optional parameters
+    int nbproc = 1;
+    if (params.find(NBPROC) != params.end())
+      nbproc = params[NBPROC];
+    int nbprocpernode = 1;
+    if (params.find(NBPROCPERNODE) != params.end())
+      nbprocpernode = params[NBPROCPERNODE];
+    int edt = 0;
+    if (params.find(MAXWALLTIME) != params.end()) 
+      edt = params[MAXWALLTIME];
+    int mem = 0;
+    if (params.find(MAXRAMSIZE) != params.end()) 
+      mem = params[MAXRAMSIZE];
+    string queue = "";
+    if (params.find(QUEUE) != params.end()) 
+      queue = params[QUEUE].str();
+
+    string::size_type p1 = fileToExecute.find_last_of("/");
+    string::size_type p2 = fileToExecute.find_last_of(".");
+    string rootNameToExecute = fileToExecute.substr(p1+1,p2-p1-1);
+    string fileNameToExecute = fileToExecute.substr(p1+1);
+
+    // Create batch submit file
+    ofstream tempOutputFile;
+    std::string TmpFileName = Utils::createAndOpenTemporaryFile("PBS-script", tempOutputFile);
+
+    tempOutputFile << "#! /bin/sh -f" << endl;
+    if (params.find(NAME) != params.end()) {
+      tempOutputFile << "#PBS -N " << params[NAME] << endl;
+    }
+
+    if (nbproc > 0)
+    {
+      int nb_full_nodes = nbproc / nbprocpernode;
+      int nb_proc_on_last_node = nbproc % nbprocpernode;
+
+      // In exclusive mode, we reserve all procs on the nodes
+      if (params.find(EXCLUSIVE) != params.end() && params[EXCLUSIVE] && nb_proc_on_last_node > 0) {
+        nb_full_nodes += 1;
+        nb_proc_on_last_node = 0;
+      }
+
+      tempOutputFile << "#PBS -l nodes=";
+
+      // Full nodes
+      if (nb_full_nodes > 0) {
+        tempOutputFile << nb_full_nodes << ":ppn=" << nbprocpernode;
+        if (nb_proc_on_last_node > 0) {
+          tempOutputFile << "+";
+        }
+      }
+
+      // Partly reserved node
+      if (nb_proc_on_last_node > 0) {
+        tempOutputFile << "1:ppn=" << nb_proc_on_last_node;
+      }
+
+      tempOutputFile << endl;
+    }
+    if (queue != "")
+      tempOutputFile << "#PBS -q " << queue << endl;
+    if( edt > 0 )
+      tempOutputFile << "#PBS -l walltime=" << edt*60 << endl;
+    if( mem > 0 )
+      tempOutputFile << "#PBS -l mem=" << mem << "MB" << endl;
+    tempOutputFile << "#PBS -o " << workDir << "/logs/output.log." << rootNameToExecute << endl;
+    tempOutputFile << "#PBS -e " << workDir << "/logs/error.log."  << rootNameToExecute << endl;
+
+    // Define environment for the job
+    if (!env.empty()) {
+      tempOutputFile << "#PBS -v ";
+      Environnement::const_iterator iter;
+      for (iter = env.begin() ; iter != env.end() ; ++iter) {
+        tempOutputFile << iter->first << "=" << iter->second << ",";
+      }
+      tempOutputFile << endl;
+    }
+
+    // Define NODEFILE
+    tempOutputFile << "export LIBBATCH_NODEFILE=$PBS_NODEFILE" << endl;
+
+    // Launch the executable
+    tempOutputFile << "cd " << workDir << endl;
+    tempOutputFile << "./" + fileNameToExecute << endl;
+    tempOutputFile.flush();
+    tempOutputFile.close();
+
+    cerr << "Batch script file generated is: " << TmpFileName.c_str() << endl;
+
+    string remoteFileName = rootNameToExecute + "_Batch.sh";
+    int status = _protocol.copyFile(TmpFileName, "", "",
+                                    workDir + "/" + remoteFileName,
+                                    _hostname, _username);
+    if (status)
+      throw RunTimeException("Error of connection on remote host, cannot copy batch submission file");
+    return remoteFileName;
+  }
+}
diff --git a/src/PBS/BatchManager_PBS.hxx b/src/PBS/BatchManager_PBS.hxx
new file mode 100644 (file)
index 0000000..ebd5105
--- /dev/null
@@ -0,0 +1,85 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * BatchManager_PBS.hxx : emulation of PBS client
+ *
+ * Auteur : Bernard SECHER - CEA DEN
+ * Mail   : mailto:bernard.secher@cea.fr
+ * Date   : Thu Apr 24 10:17:22 2008
+ * Projet : PAL Salome
+ *
+ */
+
+#ifndef _BATCHMANAGER_EPBS_H_
+#define _BATCHMANAGER_EPBS_H_
+
+#include "Defines.hxx"
+#include "JobId.hxx"
+#include "JobInfo.hxx"
+#include "FactBatchManager.hxx"
+#include "BatchManager.hxx"
+
+namespace Batch {
+
+  class BATCH_EXPORT BatchManager_PBS : public BatchManager
+  {
+  public:
+    // Constructeur et destructeur
+    BatchManager_PBS(const FactBatchManager * parent, const char * host="localhost",
+                      const char * username="",
+                      CommunicationProtocolType protocolType = SSH, const char * mpiImpl="nompi");
+    virtual ~BatchManager_PBS();
+
+    // Recupere le nom du serveur par defaut
+    // static string BatchManager_LSF::getDefaultServer();
+
+    // Methodes pour le controle des jobs
+    virtual const JobId submitJob(const Job & job); // soumet un job au gestionnaire
+    virtual void deleteJob(const JobId & jobid); // retire un job du gestionnaire
+    virtual void holdJob(const JobId & jobid); // suspend un job en file d'attente
+    virtual void releaseJob(const JobId & jobid); // relache un job suspendu
+    virtual void alterJob(const JobId & jobid, const Parametre & param, const Environnement & env); // modifie un job en file d'attente
+    virtual void alterJob(const JobId & jobid, const Parametre & param); // modifie un job en file d'attente
+    virtual void alterJob(const JobId & jobid, const Environnement & env); // modifie un job en file d'attente
+    virtual JobInfo queryJob(const JobId & jobid); // renvoie l'etat du job
+    virtual bool isRunning(const JobId & jobid); // teste si un job est present en machine
+
+    virtual void setParametre(const JobId & jobid, const Parametre & param) { return alterJob(jobid, param); } // modifie un job en file d'attente
+    virtual void setEnvironnement(const JobId & jobid, const Environnement & env) { return alterJob(jobid, env); } // modifie un job en file d'attente
+
+    virtual const Batch::JobId addJob(const Batch::Job & job, const std::string reference); // ajoute un nouveau job sans le soumettre
+
+  protected:
+    std::string buildSubmissionScript(const Job & job);
+
+#ifdef SWIG
+  public:
+    // Recupere le l'identifiant d'un job deja soumis au BatchManager
+    //virtual const JobId getJobIdByReference(const string & ref) { return BatchManager::getJobIdByReference(ref); }
+    virtual const JobId getJobIdByReference(const char * ref) { return BatchManager::getJobIdByReference(ref); }
+#endif
+
+  };
+
+}
+
+#endif
diff --git a/src/PBS/Batch_BatchManager_ePBS.cxx b/src/PBS/Batch_BatchManager_ePBS.cxx
deleted file mode 100644 (file)
index 1d3e063..0000000
+++ /dev/null
@@ -1,290 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * BatchManager_ePBS.cxx : emulation of PBS client
- *
- * Auteur : Bernard SECHER - CEA DEN, André RIBES - EDF R&D
- * Mail   : mailto:bernard.secher@cea.fr
- * Date   : Thu Apr 24 10:17:22 2008
- * Projet : PAL Salome
- *
- */
-
-#include <cstdlib>
-#include <fstream>
-#include <sstream>
-
-#include <Batch_Constants.hxx>
-#include <Batch_Utils.hxx>
-#include <Batch_NotYetImplementedException.hxx>
-
-#include "Batch_BatchManager_ePBS.hxx"
-#include "Batch_JobInfo_ePBS.hxx"
-
-using namespace std;
-
-namespace Batch {
-
-  BatchManager_ePBS::BatchManager_ePBS(const FactBatchManager * parent, const char * host,
-                                       const char * username,
-                                       CommunicationProtocolType protocolType, const char * mpiImpl)
-    : BatchManager(parent, host, username, protocolType, mpiImpl)
-  {
-    // Nothing to do
-  }
-
-  // Destructeur
-  BatchManager_ePBS::~BatchManager_ePBS()
-  {
-    // Nothing to do
-  }
-
-  // Methode pour le controle des jobs : soumet un job au gestionnaire
-  const JobId BatchManager_ePBS::submitJob(const Job & job)
-  {
-    Parametre params = job.getParametre();
-    const std::string workDir = params[WORKDIR];
-
-    // export input files on cluster
-    exportInputFiles(job);
-
-    // build batch script for job
-    string scriptFile = buildSubmissionScript(job);
-
-    // define command to submit batch
-    string subCommand = string("cd ") + workDir + "; qsub " + scriptFile;
-    string command = _protocol.getExecCommand(subCommand, _hostname, _username);
-    command += " 2>&1";
-    cerr << command.c_str() << endl;
-
-    // submit job
-    string output;
-    int status = Utils::getCommandOutput(command, output);
-    cout << output;
-    if (status != 0) throw RunTimeException("Can't submit job, error was: " + output);
-
-    // normally output contains only id of submitted job, we just need to remove the final \n
-    string jobref = output.substr(0, output.size() - 1);
-    JobId id(this, jobref);
-
-    return id;
-  }
-
-  // Ce manager permet de faire de la reprise
-  const Batch::JobId
-  BatchManager_ePBS::addJob(const Batch::Job & job, const std::string reference)
-  {
-    return JobId(this, reference);
-  }
-
-  // Methode pour le controle des jobs : retire un job du gestionnaire
-  void BatchManager_ePBS::deleteJob(const JobId & jobid)
-  {
-    int status;
-    int ref;
-    istringstream iss(jobid.getReference());
-    iss >> ref;
-
-    // define command to delete batch
-    string subCommand = string("qdel ") + iss.str();
-    string command = _protocol.getExecCommand(subCommand, _hostname, _username);
-    cerr << command.c_str() << endl;
-    status = system(command.c_str());
-    if (status)
-      throw RunTimeException("Error of connection on remote host");
-
-    cerr << "jobId = " << ref << "killed" << endl;
-  }
-
-  // Methode pour le controle des jobs : suspend un job en file d'attente
-  void BatchManager_ePBS::holdJob(const JobId & jobid)
-  {
-    throw NotYetImplementedException("BatchManager_ePBS::holdJob");
-  }
-
-  // Methode pour le controle des jobs : relache un job suspendu
-  void BatchManager_ePBS::releaseJob(const JobId & jobid)
-  {
-    throw NotYetImplementedException("BatchManager_ePBS::releaseJob");
-  }
-
-
-  // Methode pour le controle des jobs : modifie un job en file d'attente
-  void BatchManager_ePBS::alterJob(const JobId & jobid, const Parametre & param, const Environnement & env)
-  {
-    throw NotYetImplementedException("BatchManager_ePBS::alterJob");
-  }
-
-  // Methode pour le controle des jobs : modifie un job en file d'attente
-  void BatchManager_ePBS::alterJob(const JobId & jobid, const Parametre & param)
-  {
-    alterJob(jobid, param, Environnement());
-  }
-
-  // Methode pour le controle des jobs : modifie un job en file d'attente
-  void BatchManager_ePBS::alterJob(const JobId & jobid, const Environnement & env)
-  {
-    alterJob(jobid, Parametre(), env);
-  }
-
-  // Methode pour le controle des jobs : renvoie l'etat du job
-  JobInfo BatchManager_ePBS::queryJob(const JobId & jobid)
-  {
-    int id;
-    istringstream iss(jobid.getReference());
-    iss >> id;
-
-    // define command to query batch
-    string subCommand = string("qstat -f ") + iss.str();
-    string command = _protocol.getExecCommand(subCommand, _hostname, _username);
-    cerr << command.c_str() << endl;
-
-    string output;
-    int status = Utils::getCommandOutput(command, output);
-    if(status && status != 153 && status != 256*153)
-      throw RunTimeException("Error of connection on remote host");
-
-    JobInfo_ePBS ji = JobInfo_ePBS(id, output);
-    return ji;
-  }
-
-  // Methode pour le controle des jobs : teste si un job est present en machine
-  bool BatchManager_ePBS::isRunning(const JobId & jobid)
-  {
-    throw NotYetImplementedException("BatchManager_ePBS::isRunning");
-  }
-
-  std::string BatchManager_ePBS::buildSubmissionScript(const Job & job)
-  {
-    Parametre params = job.getParametre();
-    Environnement env = job.getEnvironnement();
-
-    // Mandatory parameters
-    string workDir;
-    if (params.find(WORKDIR) != params.end()) 
-      workDir = params[WORKDIR].str();
-    else 
-      throw RunTimeException("params[WORKDIR] is not defined ! Please defined it, cannot submit this job");
-    string fileToExecute;
-    if (params.find(EXECUTABLE) != params.end()) 
-      fileToExecute = params[EXECUTABLE].str();
-    else 
-      throw RunTimeException("params[EXECUTABLE] is not defined ! Please defined it, cannot submit this job");
-
-    // Optional parameters
-    int nbproc = 1;
-    if (params.find(NBPROC) != params.end())
-      nbproc = params[NBPROC];
-    int nbprocpernode = 1;
-    if (params.find(NBPROCPERNODE) != params.end())
-      nbprocpernode = params[NBPROCPERNODE];
-    int edt = 0;
-    if (params.find(MAXWALLTIME) != params.end()) 
-      edt = params[MAXWALLTIME];
-    int mem = 0;
-    if (params.find(MAXRAMSIZE) != params.end()) 
-      mem = params[MAXRAMSIZE];
-    string queue = "";
-    if (params.find(QUEUE) != params.end()) 
-      queue = params[QUEUE].str();
-
-    string::size_type p1 = fileToExecute.find_last_of("/");
-    string::size_type p2 = fileToExecute.find_last_of(".");
-    string rootNameToExecute = fileToExecute.substr(p1+1,p2-p1-1);
-    string fileNameToExecute = fileToExecute.substr(p1+1);
-
-    // Create batch submit file
-    ofstream tempOutputFile;
-    std::string TmpFileName = Utils::createAndOpenTemporaryFile("PBS-script", tempOutputFile);
-
-    tempOutputFile << "#! /bin/sh -f" << endl;
-    if (params.find(NAME) != params.end()) {
-      tempOutputFile << "#PBS -N " << params[NAME] << endl;
-    }
-
-    if (nbproc > 0)
-    {
-      int nb_full_nodes = nbproc / nbprocpernode;
-      int nb_proc_on_last_node = nbproc % nbprocpernode;
-
-      // In exclusive mode, we reserve all procs on the nodes
-      if (params.find(EXCLUSIVE) != params.end() && params[EXCLUSIVE] && nb_proc_on_last_node > 0) {
-        nb_full_nodes += 1;
-        nb_proc_on_last_node = 0;
-      }
-
-      tempOutputFile << "#PBS -l nodes=";
-
-      // Full nodes
-      if (nb_full_nodes > 0) {
-        tempOutputFile << nb_full_nodes << ":ppn=" << nbprocpernode;
-        if (nb_proc_on_last_node > 0) {
-          tempOutputFile << "+";
-        }
-      }
-
-      // Partly reserved node
-      if (nb_proc_on_last_node > 0) {
-        tempOutputFile << "1:ppn=" << nb_proc_on_last_node;
-      }
-
-      tempOutputFile << endl;
-    }
-    if (queue != "")
-      tempOutputFile << "#PBS -q " << queue << endl;
-    if( edt > 0 )
-      tempOutputFile << "#PBS -l walltime=" << edt*60 << endl;
-    if( mem > 0 )
-      tempOutputFile << "#PBS -l mem=" << mem << "MB" << endl;
-    tempOutputFile << "#PBS -o " << workDir << "/logs/output.log." << rootNameToExecute << endl;
-    tempOutputFile << "#PBS -e " << workDir << "/logs/error.log."  << rootNameToExecute << endl;
-
-    // Define environment for the job
-    if (!env.empty()) {
-      tempOutputFile << "#PBS -v ";
-      Environnement::const_iterator iter;
-      for (iter = env.begin() ; iter != env.end() ; ++iter) {
-        tempOutputFile << iter->first << "=" << iter->second << ",";
-      }
-      tempOutputFile << endl;
-    }
-
-    // Define NODEFILE
-    tempOutputFile << "export LIBBATCH_NODEFILE=$PBS_NODEFILE" << endl;
-
-    // Launch the executable
-    tempOutputFile << "cd " << workDir << endl;
-    tempOutputFile << "./" + fileNameToExecute << endl;
-    tempOutputFile.flush();
-    tempOutputFile.close();
-
-    cerr << "Batch script file generated is: " << TmpFileName.c_str() << endl;
-
-    string remoteFileName = rootNameToExecute + "_Batch.sh";
-    int status = _protocol.copyFile(TmpFileName, "", "",
-                                    workDir + "/" + remoteFileName,
-                                    _hostname, _username);
-    if (status)
-      throw RunTimeException("Error of connection on remote host, cannot copy batch submission file");
-    return remoteFileName;
-  }
-}
diff --git a/src/PBS/Batch_BatchManager_ePBS.hxx b/src/PBS/Batch_BatchManager_ePBS.hxx
deleted file mode 100644 (file)
index aba5df0..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * BatchManager_ePBS.hxx : emulation of PBS client
- *
- * Auteur : Bernard SECHER - CEA DEN
- * Mail   : mailto:bernard.secher@cea.fr
- * Date   : Thu Apr 24 10:17:22 2008
- * Projet : PAL Salome
- *
- */
-
-#ifndef _BATCHMANAGER_EPBS_H_
-#define _BATCHMANAGER_EPBS_H_
-
-#include "Batch_Defines.hxx"
-#include "Batch_JobId.hxx"
-#include "Batch_JobInfo.hxx"
-#include "Batch_FactBatchManager.hxx"
-#include "Batch_BatchManager.hxx"
-
-namespace Batch {
-
-  class BATCH_EXPORT BatchManager_ePBS : public BatchManager
-  {
-  public:
-    // Constructeur et destructeur
-    BatchManager_ePBS(const FactBatchManager * parent, const char * host="localhost",
-                      const char * username="",
-                      CommunicationProtocolType protocolType = SSH, const char * mpiImpl="nompi");
-    virtual ~BatchManager_ePBS();
-
-    // Recupere le nom du serveur par defaut
-    // static string BatchManager_LSF::getDefaultServer();
-
-    // Methodes pour le controle des jobs
-    virtual const JobId submitJob(const Job & job); // soumet un job au gestionnaire
-    virtual void deleteJob(const JobId & jobid); // retire un job du gestionnaire
-    virtual void holdJob(const JobId & jobid); // suspend un job en file d'attente
-    virtual void releaseJob(const JobId & jobid); // relache un job suspendu
-    virtual void alterJob(const JobId & jobid, const Parametre & param, const Environnement & env); // modifie un job en file d'attente
-    virtual void alterJob(const JobId & jobid, const Parametre & param); // modifie un job en file d'attente
-    virtual void alterJob(const JobId & jobid, const Environnement & env); // modifie un job en file d'attente
-    virtual JobInfo queryJob(const JobId & jobid); // renvoie l'etat du job
-    virtual bool isRunning(const JobId & jobid); // teste si un job est present en machine
-
-    virtual void setParametre(const JobId & jobid, const Parametre & param) { return alterJob(jobid, param); } // modifie un job en file d'attente
-    virtual void setEnvironnement(const JobId & jobid, const Environnement & env) { return alterJob(jobid, env); } // modifie un job en file d'attente
-
-    virtual const Batch::JobId addJob(const Batch::Job & job, const std::string reference); // ajoute un nouveau job sans le soumettre
-
-  protected:
-    std::string buildSubmissionScript(const Job & job);
-
-#ifdef SWIG
-  public:
-    // Recupere le l'identifiant d'un job deja soumis au BatchManager
-    //virtual const JobId getJobIdByReference(const string & ref) { return BatchManager::getJobIdByReference(ref); }
-    virtual const JobId getJobIdByReference(const char * ref) { return BatchManager::getJobIdByReference(ref); }
-#endif
-
-  };
-
-}
-
-#endif
diff --git a/src/PBS/Batch_FactBatchManager_ePBS.cxx b/src/PBS/Batch_FactBatchManager_ePBS.cxx
deleted file mode 100644 (file)
index df41a54..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * FactBatchManager_ePBS.cxx :
- *
- * Auteur : Bernard SECHER - CEA DEN
- * Date   : Avril 2008
- * Projet : PAL Salome
- *
- */
-
-#include "Batch_BatchManager_ePBS.hxx"
-#include "Batch_FactBatchManager_ePBS.hxx"
-
-namespace Batch {
-
-  static FactBatchManager_ePBS sFBM_ePBS;
-
-  // Constructeur
-  FactBatchManager_ePBS::FactBatchManager_ePBS() : FactBatchManager("PBS")
-  {
-    // Nothing to do
-  }
-
-  // Destructeur
-  FactBatchManager_ePBS::~FactBatchManager_ePBS()
-  {
-    // Nothing to do
-  }
-
-  BatchManager * FactBatchManager_ePBS::operator() (const char * hostname,
-                                                    const char * username,
-                                                    CommunicationProtocolType protocolType,
-                                                    const char * mpiImpl) const
-  {
-    return new BatchManager_ePBS(this, hostname, username, protocolType, mpiImpl);
-  }
-
-}
diff --git a/src/PBS/Batch_FactBatchManager_ePBS.hxx b/src/PBS/Batch_FactBatchManager_ePBS.hxx
deleted file mode 100644 (file)
index 410f0d9..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * FactBatchManager_ePBS.hxx : 
- *
- * Auteur : Bernard SECHER : CEA DEN
- * Date   : Avril 2008
- * Projet : PAL Salome
- *
- */
-
-#ifndef _FACTBATCHMANAGER_ePBS_H_
-#define _FACTBATCHMANAGER_ePBS_H_
-
-#include "Batch_Defines.hxx"
-
-#include "Batch_BatchManager.hxx"
-#include "Batch_FactBatchManager.hxx"
-
-namespace Batch {
-  
-  class BatchManager_ePBS;
-
-  class BATCH_EXPORT FactBatchManager_ePBS : public FactBatchManager
-  {
-  public:
-    // Constructeur et destructeur
-    FactBatchManager_ePBS();
-    virtual ~FactBatchManager_ePBS();
-
-    virtual BatchManager * operator() (const char * hostname,
-                                       const char * username,
-                                       CommunicationProtocolType protocolType,
-                                       const char * mpiImpl) const;
-
-  };
-
-}
-
-#endif
diff --git a/src/PBS/Batch_JobInfo_ePBS.cxx b/src/PBS/Batch_JobInfo_ePBS.cxx
deleted file mode 100644 (file)
index 6211073..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * JobInfo_ePBS.cxx :  emulation of PBS client
- *
- * Auteur : Bernard SECHER - CEA DEN
- * Mail   : mailto:bernard.secher@cea.fr
- * Date   : Thu Apr 24 10:17:22 2008
- * Projet : PAL Salome
- *
- */
-
-#include <cstdio>
-#include <iostream>
-#include <sstream>
-
-#include <Batch_Constants.hxx>
-#include "Batch_JobInfo_ePBS.hxx"
-
-using namespace std;
-
-namespace Batch {
-
-  // Constructeurs
-  JobInfo_ePBS::JobInfo_ePBS(int id, string queryOutput) : JobInfo()
-  {
-    // Fill ID parameter
-    ostringstream oss;
-    oss << id;
-    _param[ID] = oss.str();
-
-    // read query output
-    istringstream queryIss(queryOutput);
-    string line;
-    size_t pos = string::npos;
-    while( (pos == string::npos) && getline(queryIss, line) ) {
-      pos = line.find("job_state");
-    }
-
-    if(pos!=string::npos){
-      string status;
-      istringstream iss(line);
-      iss >> status;
-      iss >> status;
-      iss >> status;
-
-      if (status == "C") {        // Completed
-        _param[STATE] = FINISHED;
-      } else if (status == "E") { // Exiting
-        _param[STATE] = RUNNING;
-      } else if (status == "H") { // Held
-        _param[STATE] = PAUSED;
-      } else if (status == "Q") { // Queued
-        _param[STATE] = QUEUED;
-      } else if (status == "R") { // Running
-        _param[STATE] = RUNNING;
-      } else if (status == "S") { // Suspend
-        _param[STATE] = PAUSED;
-      } else if (status == "T") { // Transiting
-        _param[STATE] = IN_PROCESS;
-      } else if (status == "W") { // Waiting
-        _param[STATE] = PAUSED;
-      } else {
-        cerr << "Unknown job state code: " << status << endl;
-      }
-    } else {
-      // On some batch managers, the job is deleted as soon as it is finished,
-      // so we have to consider that an unknown job is a finished one, even if
-      // it is not always true.
-      _param[STATE] = FINISHED;
-    }
-  }
-
-  // Destructeur
-  JobInfo_ePBS::~JobInfo_ePBS()
-  {
-    // Nothing to do
-  }
-
-  // Convertit une date HH:MM:SS en secondes
-  long JobInfo_ePBS::HMStoLong(const string & s)
-  {
-    long hour, min, sec;
-
-    sscanf( s.c_str(), "%ld:%ld:%ld", &hour, &min, &sec);
-    return ( ( ( hour * 60L ) + min ) * 60L ) + sec;
-  }
-
-  // Methode pour l'interfacage avec Python (SWIG) : affichage en Python
-  string JobInfo_ePBS::__str__() const
-  {
-    ostringstream sst;
-    sst << "<JobInfo_ePBS (" << this << ") :" << endl;
-    sst << " ID = " <<_param[ID] << endl;
-    sst << " STATE = " <<_param[STATE] << endl;
-
-    return sst.str();
-  }
-
-}
diff --git a/src/PBS/Batch_JobInfo_ePBS.hxx b/src/PBS/Batch_JobInfo_ePBS.hxx
deleted file mode 100644 (file)
index d7a8436..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * JobInfo_ePBS.hxx :  emulation of PBS client
- *
- * Auteur : Bernard SECHER - CEA DEN
- * Mail   : mailto:bernard.secher@cea.fr
- * Date   : Thu Apr 24 10:17:22 2008
- * Projet : PAL Salome 
- *
- */
-
-#ifndef _JOBINFO_PBS_H_
-#define _JOBINFO_PBS_H_
-
-#include <string>
-#include "Batch_RunTimeException.hxx"
-#include "Batch_JobInfo.hxx"
-
-namespace Batch {
-
-  class JobInfo_ePBS : public JobInfo
-  {
-  public:
-    // Constructeurs et destructeur
-    JobInfo_ePBS() {};
-    JobInfo_ePBS(int id, std::string queryOutput);
-    virtual ~JobInfo_ePBS();
-
-    // Constructeur par recopie
-    JobInfo_ePBS(const JobInfo_ePBS & jinfo) : JobInfo(jinfo) {};
-
-    // Methodes pour l'interfacage avec Python (SWIG)
-    // TODO : supprimer ces methodes et transferer leur definitions dans SWIG
-    std::string  __str__() const; // SWIG : affichage en Python
-    std::string  __repr__() const { return __str__(); }; // SWIG : affichage en Python
-
-  private:
-    // Convertit une date HH:MM:SS en secondes
-    long HMStoLong(const std::string &);
-
-  };
-
-}
-
-#endif
index 745cc56399868565ccb7389d9a82a36ed704ded5..e8d991ae931fcbdef3a95207da9ec0d6f4ea52fb 100644 (file)
@@ -20,9 +20,9 @@
 #  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-SET(CLASS_LIST PBS/Batch_BatchManager_ePBS
-               PBS/Batch_FactBatchManager_ePBS
-               PBS/Batch_JobInfo_ePBS
+SET(CLASS_LIST PBS/BatchManager_PBS
+               PBS/FactBatchManager_PBS
+               PBS/JobInfo_PBS
    )
 
 APPEND_CLASSES_TO_SRC_FILES(${CLASS_LIST})
diff --git a/src/PBS/FactBatchManager_PBS.cxx b/src/PBS/FactBatchManager_PBS.cxx
new file mode 100644 (file)
index 0000000..73eb776
--- /dev/null
@@ -0,0 +1,58 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * FactBatchManager_PBS.cxx :
+ *
+ * Auteur : Bernard SECHER - CEA DEN
+ * Date   : Avril 2008
+ * Projet : PAL Salome
+ *
+ */
+
+#include "BatchManager_PBS.hxx"
+#include "FactBatchManager_PBS.hxx"
+
+namespace Batch {
+
+  static FactBatchManager_PBS sFBM_PBS;
+
+  // Constructeur
+  FactBatchManager_PBS::FactBatchManager_PBS() : FactBatchManager("PBS")
+  {
+    // Nothing to do
+  }
+
+  // Destructeur
+  FactBatchManager_PBS::~FactBatchManager_PBS()
+  {
+    // Nothing to do
+  }
+
+  BatchManager * FactBatchManager_PBS::operator() (const char * hostname,
+                                                    const char * username,
+                                                    CommunicationProtocolType protocolType,
+                                                    const char * mpiImpl) const
+  {
+    return new BatchManager_PBS(this, hostname, username, protocolType, mpiImpl);
+  }
+
+}
diff --git a/src/PBS/FactBatchManager_PBS.hxx b/src/PBS/FactBatchManager_PBS.hxx
new file mode 100644 (file)
index 0000000..c26a8ad
--- /dev/null
@@ -0,0 +1,59 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * FactBatchManager_PBS.hxx : 
+ *
+ * Auteur : Bernard SECHER : CEA DEN
+ * Date   : Avril 2008
+ * Projet : PAL Salome
+ *
+ */
+
+#ifndef _FACTBATCHMANAGER_PBS_H_
+#define _FACTBATCHMANAGER_PBS_H_
+
+#include "Defines.hxx"
+
+#include "BatchManager.hxx"
+#include "FactBatchManager.hxx"
+
+namespace Batch {
+  
+  class BatchManager_PBS;
+
+  class BATCH_EXPORT FactBatchManager_PBS : public FactBatchManager
+  {
+  public:
+    // Constructeur et destructeur
+    FactBatchManager_PBS();
+    virtual ~FactBatchManager_PBS();
+
+    virtual BatchManager * operator() (const char * hostname,
+                                       const char * username,
+                                       CommunicationProtocolType protocolType,
+                                       const char * mpiImpl) const;
+
+  };
+
+}
+
+#endif
diff --git a/src/PBS/JobInfo_PBS.cxx b/src/PBS/JobInfo_PBS.cxx
new file mode 100644 (file)
index 0000000..514e258
--- /dev/null
@@ -0,0 +1,119 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * JobInfo_PBS.cxx :  emulation of PBS client
+ *
+ * Auteur : Bernard SECHER - CEA DEN
+ * Mail   : mailto:bernard.secher@cea.fr
+ * Date   : Thu Apr 24 10:17:22 2008
+ * Projet : PAL Salome
+ *
+ */
+
+#include <cstdio>
+#include <iostream>
+#include <sstream>
+
+#include <Constants.hxx>
+#include "JobInfo_PBS.hxx"
+
+using namespace std;
+
+namespace Batch {
+
+  // Constructeurs
+  JobInfo_PBS::JobInfo_PBS(int id, string queryOutput) : JobInfo()
+  {
+    // Fill ID parameter
+    ostringstream oss;
+    oss << id;
+    _param[ID] = oss.str();
+
+    // read query output
+    istringstream queryIss(queryOutput);
+    string line;
+    size_t pos = string::npos;
+    while( (pos == string::npos) && getline(queryIss, line) ) {
+      pos = line.find("job_state");
+    }
+
+    if(pos!=string::npos){
+      string status;
+      istringstream iss(line);
+      iss >> status;
+      iss >> status;
+      iss >> status;
+
+      if (status == "C") {        // Completed
+        _param[STATE] = FINISHED;
+      } else if (status == "E") { // Exiting
+        _param[STATE] = RUNNING;
+      } else if (status == "H") { // Held
+        _param[STATE] = PAUSED;
+      } else if (status == "Q") { // Queued
+        _param[STATE] = QUEUED;
+      } else if (status == "R") { // Running
+        _param[STATE] = RUNNING;
+      } else if (status == "S") { // Suspend
+        _param[STATE] = PAUSED;
+      } else if (status == "T") { // Transiting
+        _param[STATE] = IN_PROCESS;
+      } else if (status == "W") { // Waiting
+        _param[STATE] = PAUSED;
+      } else {
+        cerr << "Unknown job state code: " << status << endl;
+      }
+    } else {
+      // On some batch managers, the job is deleted as soon as it is finished,
+      // so we have to consider that an unknown job is a finished one, even if
+      // it is not always true.
+      _param[STATE] = FINISHED;
+    }
+  }
+
+  // Destructeur
+  JobInfo_PBS::~JobInfo_PBS()
+  {
+    // Nothing to do
+  }
+
+  // Convertit une date HH:MM:SS en secondes
+  long JobInfo_PBS::HMStoLong(const string & s)
+  {
+    long hour, min, sec;
+
+    sscanf( s.c_str(), "%ld:%ld:%ld", &hour, &min, &sec);
+    return ( ( ( hour * 60L ) + min ) * 60L ) + sec;
+  }
+
+  // Methode pour l'interfacage avec Python (SWIG) : affichage en Python
+  string JobInfo_PBS::__str__() const
+  {
+    ostringstream sst;
+    sst << "<JobInfo_PBS (" << this << ") :" << endl;
+    sst << " ID = " <<_param[ID] << endl;
+    sst << " STATE = " <<_param[STATE] << endl;
+
+    return sst.str();
+  }
+
+}
diff --git a/src/PBS/JobInfo_PBS.hxx b/src/PBS/JobInfo_PBS.hxx
new file mode 100644 (file)
index 0000000..b00503f
--- /dev/null
@@ -0,0 +1,65 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * JobInfo_PBS.hxx :  emulation of PBS client
+ *
+ * Auteur : Bernard SECHER - CEA DEN
+ * Mail   : mailto:bernard.secher@cea.fr
+ * Date   : Thu Apr 24 10:17:22 2008
+ * Projet : PAL Salome 
+ *
+ */
+
+#ifndef _JOBINFO_PBS_H_
+#define _JOBINFO_PBS_H_
+
+#include <string>
+#include "RunTimeException.hxx"
+#include "JobInfo.hxx"
+
+namespace Batch {
+
+  class JobInfo_PBS : public JobInfo
+  {
+  public:
+    // Constructeurs et destructeur
+    JobInfo_PBS() {};
+    JobInfo_PBS(int id, std::string queryOutput);
+    virtual ~JobInfo_PBS();
+
+    // Constructeur par recopie
+    JobInfo_PBS(const JobInfo_PBS & jinfo) : JobInfo(jinfo) {};
+
+    // Methodes pour l'interfacage avec Python (SWIG)
+    // TODO : supprimer ces methodes et transferer leur definitions dans SWIG
+    std::string  __str__() const; // SWIG : affichage en Python
+    std::string  __repr__() const { return __str__(); }; // SWIG : affichage en Python
+
+  private:
+    // Convertit une date HH:MM:SS en secondes
+    long HMStoLong(const std::string &);
+
+  };
+
+}
+
+#endif
index bad38d157d7c159ed09a57eba67ba1b22a2c7a4b..507ceda6ffd00c5cf4f7af609c93fa035155e5fa 100644 (file)
@@ -32,13 +32,13 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
 include_directories(${CMAKE_CURRENT_BINARY_DIR})
 
 # Build the test programs and add the tests
-add_executable(Test_ePBS Test_ePBS.cxx)
-target_link_libraries(Test_ePBS batch SimpleParser)
+add_executable(Test_PBS Test_PBS.cxx)
+target_link_libraries(Test_PBS batch SimpleParser)
 
 IF (HAS_SSH)
-    ADD_TEST(ePBS_SSH Test_ePBS SSH)
+    ADD_TEST(PBS_SSH Test_PBS SSH)
 ENDIF (HAS_SSH)
 
 IF (HAS_RSH)
-    ADD_TEST(ePBS_RSH Test_ePBS RSH)
+    ADD_TEST(PBS_RSH Test_PBS RSH)
 ENDIF (HAS_RSH)
diff --git a/src/PBS/Test/Test_PBS.cxx b/src/PBS/Test/Test_PBS.cxx
new file mode 100644 (file)
index 0000000..259fff2
--- /dev/null
@@ -0,0 +1,158 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * Test_PBS.cxx :
+ *
+ * Author : Renaud BARATE - EDF R&D
+ * Date   : April 2009
+ *
+ */
+
+#include <iostream>
+#include <fstream>
+#include <cstring>
+
+#include <Constants.hxx>
+#include <Job.hxx>
+#include <BatchManagerCatalog.hxx>
+#include <FactBatchManager.hxx>
+#include <BatchManager.hxx>
+
+#include <SimpleParser.hxx>
+
+using namespace std;
+using namespace Batch;
+
+void print_usage()
+{
+  cout << "usage: Test_PBS PROTOCOL" << endl;
+  cout << "    PROTOCOL      \"SSH\" or \"RSH\"" << endl;
+}
+
+int main(int argc, char** argv)
+{
+  // Parse argument
+  if (argc != 2) {
+    print_usage();
+    return 1;
+  }
+  CommunicationProtocolType protocol;
+  if (strcmp(argv[1], "SSH") == 0)
+    protocol = SSH;
+  else if (strcmp(argv[1], "RSH") == 0)
+    protocol = RSH;
+  else {
+    print_usage();
+    return 1;
+  }
+
+  cout << "*******************************************************************************************" << endl;
+  cout << "This program tests the batch submission based on PBS emulation. Passwordless authentication" << endl;
+  cout << "must be used for this test to pass. For SSH, this can be configured with ssh-agent for" << endl;
+  cout << "instance. For RSH, this can be configured with the .rhosts file." << endl;
+  cout << "*******************************************************************************************" << endl;
+
+  // eventually remove any previous result
+  remove("result.txt");
+
+  try {
+    // Parse the test configuration file
+    SimpleParser parser;
+    parser.parseTestConfigFile();
+    const string & homedir = parser.getValue("TEST_EPBS_HOMEDIR");
+    const string & host = parser.getValue("TEST_EPBS_HOST");
+    const string & user = parser.getValue("TEST_EPBS_USER");
+    const string & queue = parser.getValue("TEST_EPBS_QUEUE");
+    int timeout = parser.getValueAsInt("TEST_EPBS_TIMEOUT");
+
+    // Define the job...
+    Job job;
+    // ... and its parameters ...
+    Parametre p;
+    p[EXECUTABLE]    = "./test-script.sh";
+    p[NAME]          = string("Test_PBS_") + argv[1];
+    p[WORKDIR]       = homedir + "/tmp/Batch";
+    p[INFILE]        = Couple("seta.sh", "tmp/Batch/seta.sh");
+    p[INFILE]       += Couple("setb.sh", "tmp/Batch/setb.sh");
+    p[OUTFILE]       = Couple("result.txt", "tmp/Batch/result.txt");
+    p[NBPROC]        = 1;
+    p[NBPROCPERNODE] = 8;
+    p[MAXWALLTIME]   = 1;
+    p[MAXRAMSIZE]    = 128;
+    p[HOMEDIR]       = homedir;
+    p[QUEUE]         = queue;
+    job.setParametre(p);
+    // ... and its environment
+    Environnement e;
+    e["MYENVVAR"] = "MYVALUE";
+    job.setEnvironnement(e);
+    cout << job << endl;
+
+    // Get the catalog
+    BatchManagerCatalog& c = BatchManagerCatalog::getInstance();
+
+    // Create a BatchManager of type ePBS on localhost
+    FactBatchManager * fbm = c("PBS");
+    BatchManager * bm = (*fbm)(host.c_str(), user.c_str(), protocol, "nompi");
+
+    // Submit the job to the BatchManager
+    JobId jobid = bm->submitJob(job);
+    cout << jobid.__repr__() << endl;
+
+    // Wait for the end of the job
+    string state = bm->waitForJobEnd(jobid, timeout);
+
+    if (state == FINISHED || state == FAILED) {
+      cout << "Job " << jobid.__repr__() << " is done" << endl;
+      bm->importOutputFiles(job, "resultdir/seconddirname");
+    } else {
+      cerr << "Timeout while executing job" << endl;
+      return 1;
+    }
+
+  } catch (GenericException e) {
+    cerr << "Error: " << e << endl;
+    return 1;
+  } catch (ParserException e) {
+    cerr << "Parser error: " << e.what() << endl;
+    return 1;
+  }
+
+  // test the result file
+  try {
+    SimpleParser resultParser;
+    resultParser.parse("resultdir/seconddirname/result.txt");
+    cout << "Result:" << endl << resultParser;
+    const string & envvar = resultParser.getValue("MYENVVAR");
+    int result = resultParser.getValueAsInt("c");
+    if (envvar == "MYVALUE" && result == 12) {
+      cout << "OK, Expected result found." << endl;
+      return 0;
+    } else {
+      cerr << "Error, result is not the expected one (MYENVVAR = MYVALUE, c = 12)." << endl;
+      return 1;
+    }
+  } catch (ParserException e) {
+    cerr << "Parser error on result file: " << e.what() << endl;
+    return 1;
+  }
+}
diff --git a/src/PBS/Test/Test_ePBS.cxx b/src/PBS/Test/Test_ePBS.cxx
deleted file mode 100644 (file)
index f707c8a..0000000
+++ /dev/null
@@ -1,158 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * Test_ePBS.cxx :
- *
- * Author : Renaud BARATE - EDF R&D
- * Date   : April 2009
- *
- */
-
-#include <iostream>
-#include <fstream>
-#include <cstring>
-
-#include <Batch_Constants.hxx>
-#include <Batch_Job.hxx>
-#include <Batch_BatchManagerCatalog.hxx>
-#include <Batch_FactBatchManager.hxx>
-#include <Batch_BatchManager.hxx>
-
-#include <SimpleParser.hxx>
-
-using namespace std;
-using namespace Batch;
-
-void print_usage()
-{
-  cout << "usage: Test_ePBS PROTOCOL" << endl;
-  cout << "    PROTOCOL      \"SSH\" or \"RSH\"" << endl;
-}
-
-int main(int argc, char** argv)
-{
-  // Parse argument
-  if (argc != 2) {
-    print_usage();
-    return 1;
-  }
-  CommunicationProtocolType protocol;
-  if (strcmp(argv[1], "SSH") == 0)
-    protocol = SSH;
-  else if (strcmp(argv[1], "RSH") == 0)
-    protocol = RSH;
-  else {
-    print_usage();
-    return 1;
-  }
-
-  cout << "*******************************************************************************************" << endl;
-  cout << "This program tests the batch submission based on PBS emulation. Passwordless authentication" << endl;
-  cout << "must be used for this test to pass. For SSH, this can be configured with ssh-agent for" << endl;
-  cout << "instance. For RSH, this can be configured with the .rhosts file." << endl;
-  cout << "*******************************************************************************************" << endl;
-
-  // eventually remove any previous result
-  remove("result.txt");
-
-  try {
-    // Parse the test configuration file
-    SimpleParser parser;
-    parser.parseTestConfigFile();
-    const string & homedir = parser.getValue("TEST_EPBS_HOMEDIR");
-    const string & host = parser.getValue("TEST_EPBS_HOST");
-    const string & user = parser.getValue("TEST_EPBS_USER");
-    const string & queue = parser.getValue("TEST_EPBS_QUEUE");
-    int timeout = parser.getValueAsInt("TEST_EPBS_TIMEOUT");
-
-    // Define the job...
-    Job job;
-    // ... and its parameters ...
-    Parametre p;
-    p[EXECUTABLE]    = "./test-script.sh";
-    p[NAME]          = string("Test_ePBS_") + argv[1];
-    p[WORKDIR]       = homedir + "/tmp/Batch";
-    p[INFILE]        = Couple("seta.sh", "tmp/Batch/seta.sh");
-    p[INFILE]       += Couple("setb.sh", "tmp/Batch/setb.sh");
-    p[OUTFILE]       = Couple("result.txt", "tmp/Batch/result.txt");
-    p[NBPROC]        = 1;
-    p[NBPROCPERNODE] = 8;
-    p[MAXWALLTIME]   = 1;
-    p[MAXRAMSIZE]    = 128;
-    p[HOMEDIR]       = homedir;
-    p[QUEUE]         = queue;
-    job.setParametre(p);
-    // ... and its environment
-    Environnement e;
-    e["MYENVVAR"] = "MYVALUE";
-    job.setEnvironnement(e);
-    cout << job << endl;
-
-    // Get the catalog
-    BatchManagerCatalog& c = BatchManagerCatalog::getInstance();
-
-    // Create a BatchManager of type ePBS on localhost
-    FactBatchManager * fbm = c("PBS");
-    BatchManager * bm = (*fbm)(host.c_str(), user.c_str(), protocol, "nompi");
-
-    // Submit the job to the BatchManager
-    JobId jobid = bm->submitJob(job);
-    cout << jobid.__repr__() << endl;
-
-    // Wait for the end of the job
-    string state = bm->waitForJobEnd(jobid, timeout);
-
-    if (state == FINISHED || state == FAILED) {
-      cout << "Job " << jobid.__repr__() << " is done" << endl;
-      bm->importOutputFiles(job, "resultdir/seconddirname");
-    } else {
-      cerr << "Timeout while executing job" << endl;
-      return 1;
-    }
-
-  } catch (GenericException e) {
-    cerr << "Error: " << e << endl;
-    return 1;
-  } catch (ParserException e) {
-    cerr << "Parser error: " << e.what() << endl;
-    return 1;
-  }
-
-  // test the result file
-  try {
-    SimpleParser resultParser;
-    resultParser.parse("resultdir/seconddirname/result.txt");
-    cout << "Result:" << endl << resultParser;
-    const string & envvar = resultParser.getValue("MYENVVAR");
-    int result = resultParser.getValueAsInt("c");
-    if (envvar == "MYVALUE" && result == 12) {
-      cout << "OK, Expected result found." << endl;
-      return 0;
-    } else {
-      cerr << "Error, result is not the expected one (MYENVVAR = MYVALUE, c = 12)." << endl;
-      return 1;
-    }
-  } catch (ParserException e) {
-    cerr << "Parser error on result file: " << e.what() << endl;
-    return 1;
-  }
-}
index dea1d94aa2d1437050b33382869ee70409651f6d..37445c18a707c878b2dfea797e80a6f1f55d699c 100644 (file)
 %include libBatch_Swig_exception.i
 
 %{
-#include "Batch_Defines.hxx"
-#include "Batch_Constants.hxx"
-#include "Batch_Job.hxx"
-#include "Batch_JobId.hxx"
-#include "Batch_JobInfo.hxx"
+#include "Defines.hxx"
+#include "Constants.hxx"
+#include "Job.hxx"
+#include "JobId.hxx"
+#include "JobInfo.hxx"
 
-#include "Batch_CommunicationProtocol.hxx"
+#include "CommunicationProtocol.hxx"
 
-#include "Batch_BatchManager.hxx"
-#include "Batch_BatchManagerCatalog.hxx"
-#include "Batch_FactBatchManager.hxx"
+#include "BatchManager.hxx"
+#include "BatchManagerCatalog.hxx"
+#include "FactBatchManager.hxx"
 %}
 
 /* Les classes exportees en Python */
 %ignore operator<<(std::ostream & os, const Job & job);
 %ignore operator<<(std::ostream & os, const JobInfo & ji);
 
-%include Batch_Defines.hxx
-%include Batch_Job.hxx
-%include Batch_JobId.hxx
-%include Batch_JobInfo.hxx
+%include Defines.hxx
+%include Job.hxx
+%include JobId.hxx
+%include JobInfo.hxx
 
-%include Batch_CommunicationProtocol.hxx
+%include CommunicationProtocol.hxx
 
-%include Batch_BatchManager.hxx
-%include Batch_BatchManagerCatalog.hxx
-%include Batch_FactBatchManager.hxx
+%include BatchManager.hxx
+%include BatchManagerCatalog.hxx
+%include FactBatchManager.hxx
 
-%include Batch_Constants.hxx
+%include Constants.hxx
 
 
 /* Les methodes alterJob (surchargees et mal gerees en Python) sont
index 355a36de135098718fcbba9a048b0a283575c2cc..5c9e513142568e2027075d15608b9910d3ed7ee1 100644 (file)
 #include <string>
 #include <list>
 #include <map>
-#include "Batch_ParameterTypeMap.hxx"
-#include "Batch_Parametre.hxx"
-#include "Batch_JobId.hxx"
-#include "Batch_FactBatchManager.hxx"
-#include "Batch_RunTimeException.hxx"
+#include "ParameterTypeMap.hxx"
+#include "Parametre.hxx"
+#include "JobId.hxx"
+#include "FactBatchManager.hxx"
+#include "RunTimeException.hxx"
 %}
 
 # // supprime toutes les definitions par defaut => sert au debug
diff --git a/src/SGE/BatchManager_SGE.cxx b/src/SGE/BatchManager_SGE.cxx
new file mode 100644 (file)
index 0000000..cb71a06
--- /dev/null
@@ -0,0 +1,286 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * BatchManager_SGE.cxx : emulation of SGE client
+ *
+ * Auteur : Bernard SECHER - CEA DEN
+ * Mail   : mailto:bernard.secher@cea.fr
+ * Date   : Thu Apr 24 10:17:22 2008
+ * Projet : PAL Salome
+ *
+ */
+
+#include <stdlib.h>
+#include <string.h>
+
+#include <iostream>
+#include <fstream>
+#include <sstream>
+#include <sys/stat.h>
+
+#include <stdlib.h>
+#include <string.h>
+
+#ifdef WIN32
+#include <io.h>
+#else
+#include <libgen.h>
+#endif
+
+#include <Constants.hxx>
+#include <Utils.hxx>
+#include <NotYetImplementedException.hxx>
+
+#include "BatchManager_SGE.hxx"
+#include "JobInfo_SGE.hxx"
+
+using namespace std;
+
+namespace Batch {
+
+  BatchManager_SGE::BatchManager_SGE(const FactBatchManager * parent, const char * host,
+                                       const char * username,
+                                       CommunicationProtocolType protocolType, const char * mpiImpl)
+  : BatchManager(parent, host, username, protocolType, mpiImpl)
+  {
+    // Nothing to do
+  }
+
+  // Destructeur
+  BatchManager_SGE::~BatchManager_SGE()
+  {
+    // Nothing to do
+  }
+
+  // Methode pour le controle des jobs : soumet un job au gestionnaire
+  const JobId BatchManager_SGE::submitJob(const Job & job)
+  {
+    Parametre params = job.getParametre();
+    const std::string workDir = params[WORKDIR];
+    const string fileToExecute = params[EXECUTABLE];
+    string::size_type p1 = fileToExecute.find_last_of("/");
+    string::size_type p2 = fileToExecute.find_last_of(".");
+    std::string fileNameToExecute = fileToExecute.substr(p1+1,p2-p1-1);
+
+    // export input files on cluster
+    exportInputFiles(job);
+
+    // build batch script for job
+    buildBatchScript(job);
+
+    // define command to submit batch
+    string subCommand = string("bash -l -c \\\"cd ") + workDir + "; qsub " + fileNameToExecute + "_Batch.sh\\\"";
+    string command = _protocol.getExecCommand(subCommand, _hostname, _username);
+    command += " 2>&1";
+    cerr << command.c_str() << endl;
+
+    // submit job
+    string output;
+    int status = Utils::getCommandOutput(command, output);
+    cout << output;
+    if (status != 0) throw RunTimeException("Can't submit job, error was: " + output);
+
+    // find id of submitted job in output
+    string strjob;
+    istringstream iss(output);
+    iss >> strjob >> strjob >> strjob;
+
+    JobId id(this, strjob);
+    return id;
+  }
+
+  // Ce manager permet de faire de la reprise
+  const Batch::JobId
+  BatchManager_SGE::addJob(const Batch::Job & job, const std::string reference)
+  {
+    return JobId(this, reference);
+  }
+
+  // Methode pour le controle des jobs : retire un job du gestionnaire
+  void BatchManager_SGE::deleteJob(const JobId & jobid)
+  {
+    int status;
+    int ref;
+    istringstream iss(jobid.getReference());
+    iss >> ref;
+
+    // define command to delete batch
+    string subCommand = string("bash -l -c \\\"qdel ") + iss.str() + string("\\\"");
+    string command = _protocol.getExecCommand(subCommand, _hostname, _username);
+    cerr << command.c_str() << endl;
+    status = system(command.c_str());
+    if(status)
+      throw RunTimeException("Error of connection on remote host");
+
+    cerr << "jobId = " << ref << "killed" << endl;
+  }
+
+  // Methode pour le controle des jobs : suspend un job en file d'attente
+  void BatchManager_SGE::holdJob(const JobId & jobid)
+  {
+    throw NotYetImplementedException("BatchManager_SGE::holdJob");
+  }
+
+  // Methode pour le controle des jobs : relache un job suspendu
+  void BatchManager_SGE::releaseJob(const JobId & jobid)
+  {
+    throw NotYetImplementedException("BatchManager_SGE::releaseJob");
+  }
+
+
+  // Methode pour le controle des jobs : modifie un job en file d'attente
+  void BatchManager_SGE::alterJob(const JobId & jobid, const Parametre & param, const Environnement & env)
+  {
+    throw NotYetImplementedException("BatchManager_SGE::alterJob");
+  }
+
+  // Methode pour le controle des jobs : modifie un job en file d'attente
+  void BatchManager_SGE::alterJob(const JobId & jobid, const Parametre & param)
+  {
+    alterJob(jobid, param, Environnement());
+  }
+
+  // Methode pour le controle des jobs : modifie un job en file d'attente
+  void BatchManager_SGE::alterJob(const JobId & jobid, const Environnement & env)
+  {
+    alterJob(jobid, Parametre(), env);
+  }
+
+  // Methode pour le controle des jobs : renvoie l'etat du job
+  JobInfo BatchManager_SGE::queryJob(const JobId & jobid)
+  {
+    int id;
+    istringstream iss(jobid.getReference());
+    iss >> id;
+
+    // define command to query batch
+    string subCommand = string("bash -l -c \\\"qstat | grep ") + iss.str() + string("\\\"");
+    string command = _protocol.getExecCommand(subCommand, _hostname, _username);
+    cerr << command.c_str() << endl;
+
+    string output;
+    int status = Utils::getCommandOutput(command, output);
+    if (status && status != 256)
+      throw RunTimeException("Error of connection on remote host");
+
+    JobInfo_SGE ji = JobInfo_SGE(id, output);
+    return ji;
+  }
+
+  // Methode pour le controle des jobs : teste si un job est present en machine
+  bool BatchManager_SGE::isRunning(const JobId & jobid)
+  {
+    throw NotYetImplementedException("BatchManager_SGE::isRunning");
+  }
+
+  void BatchManager_SGE::buildBatchScript(const Job & job)
+  {
+#ifndef WIN32
+    //TODO porting on Win32 platform
+    std::cerr << "BuildBatchScript" << std::endl;
+    Parametre params = job.getParametre();
+
+    // Job Parameters
+    string workDir       = "";
+    string fileToExecute = "";
+    int nbproc          = 0;
+    int edt             = 0;
+    int mem              = 0;
+    string queue         = "";
+
+    // Mandatory parameters
+    if (params.find(WORKDIR) != params.end()) 
+      workDir = params[WORKDIR].str();
+    else 
+      throw RunTimeException("params[WORKDIR] is not defined ! Please defined it, cannot submit this job");
+    if (params.find(EXECUTABLE) != params.end()) 
+      fileToExecute = params[EXECUTABLE].str();
+    else 
+      throw RunTimeException("params[EXECUTABLE] is not defined ! Please defined it, cannot submit this job");
+
+    // Optional parameters
+    if (params.find(NBPROC) != params.end()) 
+      nbproc = params[NBPROC];
+    if (params.find(MAXWALLTIME) != params.end()) 
+      edt = params[MAXWALLTIME];
+    if (params.find(MAXRAMSIZE) != params.end()) 
+      mem = params[MAXRAMSIZE];
+    if (params.find(QUEUE) != params.end()) 
+      queue = params[QUEUE].str();
+
+    string::size_type p1 = fileToExecute.find_last_of("/");
+    string::size_type p2 = fileToExecute.find_last_of(".");
+    string rootNameToExecute = fileToExecute.substr(p1+1,p2-p1-1);
+    string fileNameToExecute = fileToExecute.substr(p1+1);
+
+    // Create batch submit file
+    ofstream tempOutputFile;
+    std::string TmpFileName = Utils::createAndOpenTemporaryFile("SGE-script", tempOutputFile);
+
+    tempOutputFile << "#! /bin/sh -f" << endl;
+    if (queue != "")
+      tempOutputFile << "#$ -q " << queue << endl;
+    tempOutputFile << "#$ -pe " << _mpiImpl->name() << " " << nbproc << endl;
+    if( edt > 0 )
+      tempOutputFile << "#$ -l h_rt=" << getWallTime(edt) << endl ;
+    if( mem > 0 )
+      tempOutputFile << "#$ -l h_vmem=" << mem << "M" << endl ;
+    tempOutputFile << "#$ -o " << workDir << "/logs/output.log." << rootNameToExecute << endl ;
+    tempOutputFile << "#$ -e " << workDir << "/logs/error.log." << rootNameToExecute << endl ;
+
+    // Abstraction of PBS_NODEFILE - TODO
+    tempOutputFile << "export LIBBATCH_NODEFILE=$TMPDIR/machines" << endl;
+
+    // Launch the executable
+    tempOutputFile << "cd " << workDir << endl ;
+    tempOutputFile << "./" + fileNameToExecute << endl;
+    tempOutputFile.flush();
+    tempOutputFile.close();
+
+    BATCH_CHMOD(TmpFileName.c_str(), 0x1ED);
+    cerr << "Batch script file generated is: " << TmpFileName.c_str() << endl;
+
+    int status = _protocol.copyFile(TmpFileName, "", "",
+                                    workDir + "/" + rootNameToExecute + "_Batch.sh",
+                                    _hostname, _username);
+    if (status)
+      throw RunTimeException("Error of connection on remote host");
+
+#endif //WIN32
+  }
+
+  std::string BatchManager_SGE::getWallTime(const long edt)
+  {
+    long h, m;
+    h = edt / 60;
+    m = edt - h*60;
+    ostringstream oss;
+    if( m >= 10 )
+      oss << h << ":" << m;
+    else
+      oss << h << ":0" << m;
+    oss << ":00"; // the seconds
+
+    return oss.str();
+  }
+
+}
diff --git a/src/SGE/BatchManager_SGE.hxx b/src/SGE/BatchManager_SGE.hxx
new file mode 100644 (file)
index 0000000..ec12da2
--- /dev/null
@@ -0,0 +1,88 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * BatchManager_SGE.hxx : emulation of SGE client
+ *
+ * Auteur : Bernard SECHER - CEA DEN
+ * Mail   : mailto:bernard.secher@cea.fr
+ * Date   : Thu Apr 24 10:17:22 2008
+ * Projet : PAL Salome
+ *
+ */
+
+#ifndef _BATCHMANAGER_ESGE_H_
+#define _BATCHMANAGER_ESGE_H_
+
+#include "Defines.hxx"
+#include "JobId.hxx"
+#include "JobInfo.hxx"
+#include "FactBatchManager.hxx"
+#include "BatchManager.hxx"
+
+namespace Batch {
+
+  class BATCH_EXPORT BatchManager_SGE : public BatchManager
+  {
+  public:
+    // Constructeur et destructeur
+    BatchManager_SGE(const FactBatchManager * parent, const char * host="localhost",
+                      const char * username="",
+                      CommunicationProtocolType protocolType = SSH, const char * mpiImpl="nompi"); // connexion a la machine host
+    virtual ~BatchManager_SGE();
+
+    // Recupere le nom du serveur par defaut
+    // static string BatchManager_LSF::getDefaultServer();
+
+    // Methodes pour le controle des jobs
+    virtual const JobId submitJob(const Job & job); // soumet un job au gestionnaire
+    virtual void deleteJob(const JobId & jobid); // retire un job du gestionnaire
+    virtual void holdJob(const JobId & jobid); // suspend un job en file d'attente
+    virtual void releaseJob(const JobId & jobid); // relache un job suspendu
+    virtual void alterJob(const JobId & jobid, const Parametre & param, const Environnement & env); // modifie un job en file d'attente
+    virtual void alterJob(const JobId & jobid, const Parametre & param); // modifie un job en file d'attente
+    virtual void alterJob(const JobId & jobid, const Environnement & env); // modifie un job en file d'attente
+    virtual JobInfo queryJob(const JobId & jobid); // renvoie l'etat du job
+    virtual bool isRunning(const JobId & jobid); // teste si un job est present en machine
+
+    virtual void setParametre(const JobId & jobid, const Parametre & param) { return alterJob(jobid, param); } // modifie un job en file d'attente
+    virtual void setEnvironnement(const JobId & jobid, const Environnement & env) { return alterJob(jobid, env); } // modifie un job en file d'attente
+
+    virtual const Batch::JobId addJob(const Batch::Job & job, const std::string reference); // ajoute un nouveau job sans le soumettre
+
+  protected:
+    void buildBatchScript(const Job & job);
+    std::string getWallTime(const long edt);
+
+  private:
+
+#ifdef SWIG
+  public:
+    // Recupere le l'identifiant d'un job deja soumis au BatchManager
+    //virtual const JobId getJobIdByReference(const string & ref) { return BatchManager::getJobIdByReference(ref); }
+    virtual const JobId getJobIdByReference(const char * ref) { return BatchManager::getJobIdByReference(ref); }
+#endif
+
+  };
+
+}
+
+#endif
diff --git a/src/SGE/Batch_BatchManager_eSGE.cxx b/src/SGE/Batch_BatchManager_eSGE.cxx
deleted file mode 100644 (file)
index 0bb4fbb..0000000
+++ /dev/null
@@ -1,286 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * BatchManager_eSGE.cxx : emulation of SGE client
- *
- * Auteur : Bernard SECHER - CEA DEN
- * Mail   : mailto:bernard.secher@cea.fr
- * Date   : Thu Apr 24 10:17:22 2008
- * Projet : PAL Salome
- *
- */
-
-#include <stdlib.h>
-#include <string.h>
-
-#include <iostream>
-#include <fstream>
-#include <sstream>
-#include <sys/stat.h>
-
-#include <stdlib.h>
-#include <string.h>
-
-#ifdef WIN32
-#include <io.h>
-#else
-#include <libgen.h>
-#endif
-
-#include <Batch_Constants.hxx>
-#include <Batch_Utils.hxx>
-#include <Batch_NotYetImplementedException.hxx>
-
-#include "Batch_BatchManager_eSGE.hxx"
-#include "Batch_JobInfo_eSGE.hxx"
-
-using namespace std;
-
-namespace Batch {
-
-  BatchManager_eSGE::BatchManager_eSGE(const FactBatchManager * parent, const char * host,
-                                       const char * username,
-                                       CommunicationProtocolType protocolType, const char * mpiImpl)
-  : BatchManager(parent, host, username, protocolType, mpiImpl)
-  {
-    // Nothing to do
-  }
-
-  // Destructeur
-  BatchManager_eSGE::~BatchManager_eSGE()
-  {
-    // Nothing to do
-  }
-
-  // Methode pour le controle des jobs : soumet un job au gestionnaire
-  const JobId BatchManager_eSGE::submitJob(const Job & job)
-  {
-    Parametre params = job.getParametre();
-    const std::string workDir = params[WORKDIR];
-    const string fileToExecute = params[EXECUTABLE];
-    string::size_type p1 = fileToExecute.find_last_of("/");
-    string::size_type p2 = fileToExecute.find_last_of(".");
-    std::string fileNameToExecute = fileToExecute.substr(p1+1,p2-p1-1);
-
-    // export input files on cluster
-    exportInputFiles(job);
-
-    // build batch script for job
-    buildBatchScript(job);
-
-    // define command to submit batch
-    string subCommand = string("bash -l -c \\\"cd ") + workDir + "; qsub " + fileNameToExecute + "_Batch.sh\\\"";
-    string command = _protocol.getExecCommand(subCommand, _hostname, _username);
-    command += " 2>&1";
-    cerr << command.c_str() << endl;
-
-    // submit job
-    string output;
-    int status = Utils::getCommandOutput(command, output);
-    cout << output;
-    if (status != 0) throw RunTimeException("Can't submit job, error was: " + output);
-
-    // find id of submitted job in output
-    string strjob;
-    istringstream iss(output);
-    iss >> strjob >> strjob >> strjob;
-
-    JobId id(this, strjob);
-    return id;
-  }
-
-  // Ce manager permet de faire de la reprise
-  const Batch::JobId
-  BatchManager_eSGE::addJob(const Batch::Job & job, const std::string reference)
-  {
-    return JobId(this, reference);
-  }
-
-  // Methode pour le controle des jobs : retire un job du gestionnaire
-  void BatchManager_eSGE::deleteJob(const JobId & jobid)
-  {
-    int status;
-    int ref;
-    istringstream iss(jobid.getReference());
-    iss >> ref;
-
-    // define command to delete batch
-    string subCommand = string("bash -l -c \\\"qdel ") + iss.str() + string("\\\"");
-    string command = _protocol.getExecCommand(subCommand, _hostname, _username);
-    cerr << command.c_str() << endl;
-    status = system(command.c_str());
-    if(status)
-      throw RunTimeException("Error of connection on remote host");
-
-    cerr << "jobId = " << ref << "killed" << endl;
-  }
-
-  // Methode pour le controle des jobs : suspend un job en file d'attente
-  void BatchManager_eSGE::holdJob(const JobId & jobid)
-  {
-    throw NotYetImplementedException("BatchManager_eSGE::holdJob");
-  }
-
-  // Methode pour le controle des jobs : relache un job suspendu
-  void BatchManager_eSGE::releaseJob(const JobId & jobid)
-  {
-    throw NotYetImplementedException("BatchManager_eSGE::releaseJob");
-  }
-
-
-  // Methode pour le controle des jobs : modifie un job en file d'attente
-  void BatchManager_eSGE::alterJob(const JobId & jobid, const Parametre & param, const Environnement & env)
-  {
-    throw NotYetImplementedException("BatchManager_eSGE::alterJob");
-  }
-
-  // Methode pour le controle des jobs : modifie un job en file d'attente
-  void BatchManager_eSGE::alterJob(const JobId & jobid, const Parametre & param)
-  {
-    alterJob(jobid, param, Environnement());
-  }
-
-  // Methode pour le controle des jobs : modifie un job en file d'attente
-  void BatchManager_eSGE::alterJob(const JobId & jobid, const Environnement & env)
-  {
-    alterJob(jobid, Parametre(), env);
-  }
-
-  // Methode pour le controle des jobs : renvoie l'etat du job
-  JobInfo BatchManager_eSGE::queryJob(const JobId & jobid)
-  {
-    int id;
-    istringstream iss(jobid.getReference());
-    iss >> id;
-
-    // define command to query batch
-    string subCommand = string("bash -l -c \\\"qstat | grep ") + iss.str() + string("\\\"");
-    string command = _protocol.getExecCommand(subCommand, _hostname, _username);
-    cerr << command.c_str() << endl;
-
-    string output;
-    int status = Utils::getCommandOutput(command, output);
-    if (status && status != 256)
-      throw RunTimeException("Error of connection on remote host");
-
-    JobInfo_eSGE ji = JobInfo_eSGE(id, output);
-    return ji;
-  }
-
-  // Methode pour le controle des jobs : teste si un job est present en machine
-  bool BatchManager_eSGE::isRunning(const JobId & jobid)
-  {
-    throw NotYetImplementedException("BatchManager_eSGE::isRunning");
-  }
-
-  void BatchManager_eSGE::buildBatchScript(const Job & job)
-  {
-#ifndef WIN32
-    //TODO porting on Win32 platform
-    std::cerr << "BuildBatchScript" << std::endl;
-    Parametre params = job.getParametre();
-
-    // Job Parameters
-    string workDir       = "";
-    string fileToExecute = "";
-    int nbproc          = 0;
-    int edt             = 0;
-    int mem              = 0;
-    string queue         = "";
-
-    // Mandatory parameters
-    if (params.find(WORKDIR) != params.end()) 
-      workDir = params[WORKDIR].str();
-    else 
-      throw RunTimeException("params[WORKDIR] is not defined ! Please defined it, cannot submit this job");
-    if (params.find(EXECUTABLE) != params.end()) 
-      fileToExecute = params[EXECUTABLE].str();
-    else 
-      throw RunTimeException("params[EXECUTABLE] is not defined ! Please defined it, cannot submit this job");
-
-    // Optional parameters
-    if (params.find(NBPROC) != params.end()) 
-      nbproc = params[NBPROC];
-    if (params.find(MAXWALLTIME) != params.end()) 
-      edt = params[MAXWALLTIME];
-    if (params.find(MAXRAMSIZE) != params.end()) 
-      mem = params[MAXRAMSIZE];
-    if (params.find(QUEUE) != params.end()) 
-      queue = params[QUEUE].str();
-
-    string::size_type p1 = fileToExecute.find_last_of("/");
-    string::size_type p2 = fileToExecute.find_last_of(".");
-    string rootNameToExecute = fileToExecute.substr(p1+1,p2-p1-1);
-    string fileNameToExecute = fileToExecute.substr(p1+1);
-
-    // Create batch submit file
-    ofstream tempOutputFile;
-    std::string TmpFileName = Utils::createAndOpenTemporaryFile("SGE-script", tempOutputFile);
-
-    tempOutputFile << "#! /bin/sh -f" << endl;
-    if (queue != "")
-      tempOutputFile << "#$ -q " << queue << endl;
-    tempOutputFile << "#$ -pe " << _mpiImpl->name() << " " << nbproc << endl;
-    if( edt > 0 )
-      tempOutputFile << "#$ -l h_rt=" << getWallTime(edt) << endl ;
-    if( mem > 0 )
-      tempOutputFile << "#$ -l h_vmem=" << mem << "M" << endl ;
-    tempOutputFile << "#$ -o " << workDir << "/logs/output.log." << rootNameToExecute << endl ;
-    tempOutputFile << "#$ -e " << workDir << "/logs/error.log." << rootNameToExecute << endl ;
-
-    // Abstraction of PBS_NODEFILE - TODO
-    tempOutputFile << "export LIBBATCH_NODEFILE=$TMPDIR/machines" << endl;
-
-    // Launch the executable
-    tempOutputFile << "cd " << workDir << endl ;
-    tempOutputFile << "./" + fileNameToExecute << endl;
-    tempOutputFile.flush();
-    tempOutputFile.close();
-
-    BATCH_CHMOD(TmpFileName.c_str(), 0x1ED);
-    cerr << "Batch script file generated is: " << TmpFileName.c_str() << endl;
-
-    int status = _protocol.copyFile(TmpFileName, "", "",
-                                    workDir + "/" + rootNameToExecute + "_Batch.sh",
-                                    _hostname, _username);
-    if (status)
-      throw RunTimeException("Error of connection on remote host");
-
-#endif //WIN32
-  }
-
-  std::string BatchManager_eSGE::getWallTime(const long edt)
-  {
-    long h, m;
-    h = edt / 60;
-    m = edt - h*60;
-    ostringstream oss;
-    if( m >= 10 )
-      oss << h << ":" << m;
-    else
-      oss << h << ":0" << m;
-    oss << ":00"; // the seconds
-
-    return oss.str();
-  }
-
-}
diff --git a/src/SGE/Batch_BatchManager_eSGE.hxx b/src/SGE/Batch_BatchManager_eSGE.hxx
deleted file mode 100644 (file)
index d432f40..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * BatchManager_eSGE.hxx : emulation of SGE client
- *
- * Auteur : Bernard SECHER - CEA DEN
- * Mail   : mailto:bernard.secher@cea.fr
- * Date   : Thu Apr 24 10:17:22 2008
- * Projet : PAL Salome
- *
- */
-
-#ifndef _BATCHMANAGER_ESGE_H_
-#define _BATCHMANAGER_ESGE_H_
-
-#include "Batch_Defines.hxx"
-#include "Batch_JobId.hxx"
-#include "Batch_JobInfo.hxx"
-#include "Batch_FactBatchManager.hxx"
-#include "Batch_BatchManager.hxx"
-
-namespace Batch {
-
-  class BATCH_EXPORT BatchManager_eSGE : public BatchManager
-  {
-  public:
-    // Constructeur et destructeur
-    BatchManager_eSGE(const FactBatchManager * parent, const char * host="localhost",
-                      const char * username="",
-                      CommunicationProtocolType protocolType = SSH, const char * mpiImpl="nompi"); // connexion a la machine host
-    virtual ~BatchManager_eSGE();
-
-    // Recupere le nom du serveur par defaut
-    // static string BatchManager_LSF::getDefaultServer();
-
-    // Methodes pour le controle des jobs
-    virtual const JobId submitJob(const Job & job); // soumet un job au gestionnaire
-    virtual void deleteJob(const JobId & jobid); // retire un job du gestionnaire
-    virtual void holdJob(const JobId & jobid); // suspend un job en file d'attente
-    virtual void releaseJob(const JobId & jobid); // relache un job suspendu
-    virtual void alterJob(const JobId & jobid, const Parametre & param, const Environnement & env); // modifie un job en file d'attente
-    virtual void alterJob(const JobId & jobid, const Parametre & param); // modifie un job en file d'attente
-    virtual void alterJob(const JobId & jobid, const Environnement & env); // modifie un job en file d'attente
-    virtual JobInfo queryJob(const JobId & jobid); // renvoie l'etat du job
-    virtual bool isRunning(const JobId & jobid); // teste si un job est present en machine
-
-    virtual void setParametre(const JobId & jobid, const Parametre & param) { return alterJob(jobid, param); } // modifie un job en file d'attente
-    virtual void setEnvironnement(const JobId & jobid, const Environnement & env) { return alterJob(jobid, env); } // modifie un job en file d'attente
-
-    virtual const Batch::JobId addJob(const Batch::Job & job, const std::string reference); // ajoute un nouveau job sans le soumettre
-
-  protected:
-    void buildBatchScript(const Job & job);
-    std::string getWallTime(const long edt);
-
-  private:
-
-#ifdef SWIG
-  public:
-    // Recupere le l'identifiant d'un job deja soumis au BatchManager
-    //virtual const JobId getJobIdByReference(const string & ref) { return BatchManager::getJobIdByReference(ref); }
-    virtual const JobId getJobIdByReference(const char * ref) { return BatchManager::getJobIdByReference(ref); }
-#endif
-
-  };
-
-}
-
-#endif
diff --git a/src/SGE/Batch_FactBatchManager_eSGE.cxx b/src/SGE/Batch_FactBatchManager_eSGE.cxx
deleted file mode 100644 (file)
index 79cfc9d..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * FactBatchManager_eSGE.cxx : 
- *
- * Auteur : Bernard SECHER - CEA DEN
- * Date   : Avril 2008
- * Projet : PAL Salome
- *
- */
-
-#include "Batch_BatchManager_eSGE.hxx"
-#include "Batch_FactBatchManager_eSGE.hxx"
-
-namespace Batch {
-
-  static FactBatchManager_eSGE sFBM_eSGE;
-
-  // Constructeur
-  FactBatchManager_eSGE::FactBatchManager_eSGE() : FactBatchManager("SGE")
-  {
-    // Nothing to do
-  }
-
-  // Destructeur
-  FactBatchManager_eSGE::~FactBatchManager_eSGE()
-  {
-    // Nothing to do
-  }
-
-  BatchManager * FactBatchManager_eSGE::operator() (const char * hostname,
-                                                    const char * username,
-                                                    CommunicationProtocolType protocolType,
-                                                    const char * mpiImpl) const
-  {
-    // MESSAGE("Building new BatchManager_SGE on host '" << hostname << "'");
-    return new BatchManager_eSGE(this, hostname, username, protocolType, mpiImpl);
-  }
-
-}
diff --git a/src/SGE/Batch_FactBatchManager_eSGE.hxx b/src/SGE/Batch_FactBatchManager_eSGE.hxx
deleted file mode 100644 (file)
index 6eda148..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * FactBatchManager_eSGE.hxx : 
- *
- * Auteur : Bernard SECHER : CEA DEN
- * Date   : Avril 2008
- * Projet : PAL Salome
- *
- */
-
-#ifndef _FACTBATCHMANAGER_eSGE_H_
-#define _FACTBATCHMANAGER_eSGE_H_
-
-#include "Batch_Defines.hxx"
-
-#include "Batch_BatchManager.hxx"
-#include "Batch_FactBatchManager.hxx"
-
-namespace Batch {
-  
-  class BATCH_EXPORT FactBatchManager_eSGE : public FactBatchManager
-  {
-  public:
-    // Constructeur et destructeur
-    FactBatchManager_eSGE();
-    virtual ~FactBatchManager_eSGE();
-
-    virtual BatchManager * operator() (const char * hostname,
-                                       const char * username,
-                                       CommunicationProtocolType protocolType,
-                                       const char * mpiImpl) const;
-
-  };
-
-}
-
-#endif
diff --git a/src/SGE/Batch_JobInfo_eSGE.cxx b/src/SGE/Batch_JobInfo_eSGE.cxx
deleted file mode 100644 (file)
index a15475e..0000000
+++ /dev/null
@@ -1,133 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * JobInfo_eSGE.cxx :  emulation of SGE client
- *
- * Auteur : Bernard SECHER - CEA DEN
- * Mail   : mailto:bernard.secher@cea.fr
- * Date   : Thu Apr 24 10:17:22 2008
- * Projet : PAL Salome 
- *
- */
-
-#include <cstdio>
-#include <iostream>
-#include <sstream>
-
-#include "Batch_Constants.hxx"
-#include "Batch_Parametre.hxx"
-#include "Batch_Environnement.hxx"
-#include "Batch_RunTimeException.hxx"
-#include "Batch_APIInternalFailureException.hxx"
-#include "Batch_JobInfo_eSGE.hxx"
-
-using namespace std;
-
-namespace Batch {
-
-
-
-  // Constructeurs
-  JobInfo_eSGE::JobInfo_eSGE(int id, const std::string & output) : JobInfo()
-  {
-    // On remplit les membres _param et _env
-    ostringstream oss;
-    oss << id;
-    _param[ID] = oss.str();
-
-    // read of log file
-    char line[128];
-    istringstream fp(output);
-      
-    string status;
-    string sline;
-    fp.getline(line,80,'\n');
-    sline = string(line);
-
-    if( sline.length() > 0 ){
-      istringstream iss(sline);
-      iss >> status >> status >> status >> status >> status;
-
-      if (status == "d") {         // Deletion
-        _param[STATE] = FAILED;
-      } else if (status == "t") {  // Transferring
-        _param[STATE] = IN_PROCESS;
-      } else if (status == "r") {  // Running
-        _param[STATE] = RUNNING;
-        _running = true;
-      } else if (status == "R") {  // Restarted
-        _param[STATE] = RUNNING;
-        _running = true;
-      } else if (status == "s") {  // Suspended
-        _param[STATE] = PAUSED;
-      } else if (status == "S") {  // Suspended
-        _param[STATE] = PAUSED;
-      } else if (status == "T") {  // Threshold
-        _param[STATE] = PAUSED;
-      } else if (status == "qw") { // Queued and waiting
-        _param[STATE] = QUEUED;
-      } else if (status == "h") {  // Hold
-        _param[STATE] = PAUSED;
-      } else {
-        cerr << "Unknown job state code: " << status << endl;
-      }
-    } else {
-      // TODO: Check this. I suppose that unknown jobs are finished ones.
-      _param[STATE] = FINISHED;
-    }
-  }
-
-  // Teste si un job est present en machine
-  bool JobInfo_eSGE::isRunning() const
-  {
-    return _running;
-  }
-
-
-  // Destructeur
-  JobInfo_eSGE::~JobInfo_eSGE()
-  {
-    // Nothing to do
-  }
-
-  // Convertit une date HH:MM:SS en secondes
-  long JobInfo_eSGE::HMStoLong(const string & s)
-  {
-    long hour, min, sec;
-
-    sscanf( s.c_str(), "%ld:%ld:%ld", &hour, &min, &sec);
-    return ( ( ( hour * 60L ) + min ) * 60L ) + sec;
-  }
-
-  // Methode pour l'interfacage avec Python (SWIG) : affichage en Python
-  string JobInfo_eSGE::__str__() const
-  {
-    ostringstream sst;
-    sst << "<JobInfo_eSGE (" << this << ") :" << endl;
-    sst << " ID = " <<_param[ID] << endl;
-    sst << " STATE = " <<_param[STATE] << endl;
-
-    return sst.str();
-  }
-
-
-}
diff --git a/src/SGE/Batch_JobInfo_eSGE.hxx b/src/SGE/Batch_JobInfo_eSGE.hxx
deleted file mode 100644 (file)
index c6d6f40..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- * JobInfo_eSGE.hxx :  emulation of SGE client
- *
- * Auteur : Bernard SECHER - CEA DEN
- * Mail   : mailto:bernard.secher@cea.fr
- * Date   : Thu Apr 24 10:17:22 2008
- * Projet : PAL Salome 
- *
- */
-
-#ifndef _JOBINFO_SGE_H_
-#define _JOBINFO_SGE_H_
-
-#include <string>
-#include "Batch_Defines.hxx"
-#include "Batch_RunTimeException.hxx"
-#include "Batch_JobInfo.hxx"
-
-namespace Batch {
-
-  class BATCH_EXPORT JobInfo_eSGE : public JobInfo
-  {
-  public:
-    // Constructeurs et destructeur
-    JobInfo_eSGE() : _running(false) {};
-    JobInfo_eSGE(int id, const std::string & output);
-    virtual ~JobInfo_eSGE();
-
-    // Constructeur par recopie
-    JobInfo_eSGE(const JobInfo_eSGE & jinfo) : JobInfo(jinfo) {};
-
-    // Teste si un job est present en machine
-    virtual bool isRunning() const;
-
-    // Methodes pour l'interfacage avec Python (SWIG)
-    // TODO : supprimer ces methodes et transferer leur definitions dans SWIG
-    std::string  __str__() const; // SWIG : affichage en Python
-    std::string  __repr__() const { return __str__(); }; // SWIG : affichage en Python
-
-  protected:
-    bool _running; // etat du job en machine
-
-  private:
-    // Convertit une date HH:MM:SS en secondes
-    long HMStoLong(const std::string &);
-
-  };
-
-}
-
-#endif
index af32b39fd5b97dbc8085a110ba6c6f4d756db7e5..68b706cc8c7ca14608d653a94250fd61520086bd 100644 (file)
@@ -20,9 +20,9 @@
 #  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-SET(CLASS_LIST SGE/Batch_BatchManager_eSGE
-               SGE/Batch_FactBatchManager_eSGE
-               SGE/Batch_JobInfo_eSGE
+SET(CLASS_LIST SGE/BatchManager_SGE
+               SGE/FactBatchManager_SGE
+               SGE/JobInfo_SGE
    )
 
 APPEND_CLASSES_TO_SRC_FILES(${CLASS_LIST})
diff --git a/src/SGE/FactBatchManager_SGE.cxx b/src/SGE/FactBatchManager_SGE.cxx
new file mode 100644 (file)
index 0000000..00e4ea8
--- /dev/null
@@ -0,0 +1,59 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * FactBatchManager_SGE.cxx : 
+ *
+ * Auteur : Bernard SECHER - CEA DEN
+ * Date   : Avril 2008
+ * Projet : PAL Salome
+ *
+ */
+
+#include "BatchManager_SGE.hxx"
+#include "FactBatchManager_SGE.hxx"
+
+namespace Batch {
+
+  static FactBatchManager_SGE sFBM_SGE;
+
+  // Constructeur
+  FactBatchManager_SGE::FactBatchManager_SGE() : FactBatchManager("SGE")
+  {
+    // Nothing to do
+  }
+
+  // Destructeur
+  FactBatchManager_SGE::~FactBatchManager_SGE()
+  {
+    // Nothing to do
+  }
+
+  BatchManager * FactBatchManager_SGE::operator() (const char * hostname,
+                                                    const char * username,
+                                                    CommunicationProtocolType protocolType,
+                                                    const char * mpiImpl) const
+  {
+    // MESSAGE("Building new BatchManager_SGE on host '" << hostname << "'");
+    return new BatchManager_SGE(this, hostname, username, protocolType, mpiImpl);
+  }
+
+}
diff --git a/src/SGE/FactBatchManager_SGE.hxx b/src/SGE/FactBatchManager_SGE.hxx
new file mode 100644 (file)
index 0000000..1500e4f
--- /dev/null
@@ -0,0 +1,57 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * FactBatchManager_SGE.hxx : 
+ *
+ * Auteur : Bernard SECHER : CEA DEN
+ * Date   : Avril 2008
+ * Projet : PAL Salome
+ *
+ */
+
+#ifndef _FACTBATCHMANAGER_SGE_H_
+#define _FACTBATCHMANAGER_SGE_H_
+
+#include "Defines.hxx"
+
+#include "BatchManager.hxx"
+#include "FactBatchManager.hxx"
+
+namespace Batch {
+  
+  class BATCH_EXPORT FactBatchManager_SGE : public FactBatchManager
+  {
+  public:
+    // Constructeur et destructeur
+    FactBatchManager_SGE();
+    virtual ~FactBatchManager_SGE();
+
+    virtual BatchManager * operator() (const char * hostname,
+                                       const char * username,
+                                       CommunicationProtocolType protocolType,
+                                       const char * mpiImpl) const;
+
+  };
+
+}
+
+#endif
diff --git a/src/SGE/JobInfo_SGE.cxx b/src/SGE/JobInfo_SGE.cxx
new file mode 100644 (file)
index 0000000..2f14ac4
--- /dev/null
@@ -0,0 +1,133 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * JobInfo_SGE.cxx :  emulation of SGE client
+ *
+ * Auteur : Bernard SECHER - CEA DEN
+ * Mail   : mailto:bernard.secher@cea.fr
+ * Date   : Thu Apr 24 10:17:22 2008
+ * Projet : PAL Salome 
+ *
+ */
+
+#include <cstdio>
+#include <iostream>
+#include <sstream>
+
+#include "Constants.hxx"
+#include "Parametre.hxx"
+#include "Environnement.hxx"
+#include "RunTimeException.hxx"
+#include "APIInternalFailureException.hxx"
+#include "JobInfo_SGE.hxx"
+
+using namespace std;
+
+namespace Batch {
+
+
+
+  // Constructeurs
+  JobInfo_SGE::JobInfo_SGE(int id, const std::string & output) : JobInfo()
+  {
+    // On remplit les membres _param et _nv
+    ostringstream oss;
+    oss << id;
+    _param[ID] = oss.str();
+
+    // read of log file
+    char line[128];
+    istringstream fp(output);
+      
+    string status;
+    string sline;
+    fp.getline(line,80,'\n');
+    sline = string(line);
+
+    if( sline.length() > 0 ){
+      istringstream iss(sline);
+      iss >> status >> status >> status >> status >> status;
+
+      if (status == "d") {         // Deletion
+        _param[STATE] = FAILED;
+      } else if (status == "t") {  // Transferring
+        _param[STATE] = IN_PROCESS;
+      } else if (status == "r") {  // Running
+        _param[STATE] = RUNNING;
+        _running = true;
+      } else if (status == "R") {  // Restarted
+        _param[STATE] = RUNNING;
+        _running = true;
+      } else if (status == "s") {  // Suspended
+        _param[STATE] = PAUSED;
+      } else if (status == "S") {  // Suspended
+        _param[STATE] = PAUSED;
+      } else if (status == "T") {  // Threshold
+        _param[STATE] = PAUSED;
+      } else if (status == "qw") { // Queued and waiting
+        _param[STATE] = QUEUED;
+      } else if (status == "h") {  // Hold
+        _param[STATE] = PAUSED;
+      } else {
+        cerr << "Unknown job state code: " << status << endl;
+      }
+    } else {
+      // TODO: Check this. I suppose that unknown jobs are finished ones.
+      _param[STATE] = FINISHED;
+    }
+  }
+
+  // Teste si un job est present en machine
+  bool JobInfo_SGE::isRunning() const
+  {
+    return _running;
+  }
+
+
+  // Destructeur
+  JobInfo_SGE::~JobInfo_SGE()
+  {
+    // Nothing to do
+  }
+
+  // Convertit une date HH:MM:SS en secondes
+  long JobInfo_SGE::HMStoLong(const string & s)
+  {
+    long hour, min, sec;
+
+    sscanf( s.c_str(), "%ld:%ld:%ld", &hour, &min, &sec);
+    return ( ( ( hour * 60L ) + min ) * 60L ) + sec;
+  }
+
+  // Methode pour l'interfacage avec Python (SWIG) : affichage en Python
+  string JobInfo_SGE::__str__() const
+  {
+    ostringstream sst;
+    sst << "<JobInfo_SGE (" << this << ") :" << endl;
+    sst << " ID = " <<_param[ID] << endl;
+    sst << " STATE = " <<_param[STATE] << endl;
+
+    return sst.str();
+  }
+
+
+}
diff --git a/src/SGE/JobInfo_SGE.hxx b/src/SGE/JobInfo_SGE.hxx
new file mode 100644 (file)
index 0000000..570de84
--- /dev/null
@@ -0,0 +1,72 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ * JobInfo_SGE.hxx :  emulation of SGE client
+ *
+ * Auteur : Bernard SECHER - CEA DEN
+ * Mail   : mailto:bernard.secher@cea.fr
+ * Date   : Thu Apr 24 10:17:22 2008
+ * Projet : PAL Salome 
+ *
+ */
+
+#ifndef _JOBINFO_SGE_H_
+#define _JOBINFO_SGE_H_
+
+#include <string>
+#include "Defines.hxx"
+#include "RunTimeException.hxx"
+#include "JobInfo.hxx"
+
+namespace Batch {
+
+  class BATCH_EXPORT JobInfo_SGE : public JobInfo
+  {
+  public:
+    // Constructeurs et destructeur
+    JobInfo_SGE() : _running(false) {};
+    JobInfo_SGE(int id, const std::string & output);
+    virtual ~JobInfo_SGE();
+
+    // Constructeur par recopie
+    JobInfo_SGE(const JobInfo_SGE & jinfo) : JobInfo(jinfo) {};
+
+    // Teste si un job est present en machine
+    virtual bool isRunning() const;
+
+    // Methodes pour l'interfacage avec Python (SWIG)
+    // TODO : supprimer ces methodes et transferer leur definitions dans SWIG
+    std::string  __str__() const; // SWIG : affichage en Python
+    std::string  __repr__() const { return __str__(); }; // SWIG : affichage en Python
+
+  protected:
+    bool _running; // etat du job en machine
+
+  private:
+    // Convertit une date HH:MM:SS en secondes
+    long HMStoLong(const std::string &);
+
+  };
+
+}
+
+#endif
diff --git a/src/Slurm/BatchManager_Slurm.cxx b/src/Slurm/BatchManager_Slurm.cxx
new file mode 100644 (file)
index 0000000..b1953ea
--- /dev/null
@@ -0,0 +1,246 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ *  BatchManager_Slurm.cxx :
+ *
+ *  Created on: 12 may 2011
+ *  Author : Renaud BARATE - EDF R&D
+ */
+
+#include <cstdlib>
+#include <fstream>
+
+#include <NotYetImplementedException.hxx>
+#include <Constants.hxx>
+#include <Utils.hxx>
+
+#include "BatchManager_Slurm.hxx"
+#include "JobInfo_Slurm.hxx"
+
+using namespace std;
+
+namespace Batch {
+
+  BatchManager_Slurm::BatchManager_Slurm(const FactBatchManager * parent,
+                                           const char * host,
+                                           const char * username,
+                                           CommunicationProtocolType protocolType,
+                                           const char * mpiImpl)
+    : BatchManager(parent, host, username, protocolType, mpiImpl)
+  {
+  }
+
+  BatchManager_Slurm::~BatchManager_Slurm()
+  {
+  }
+
+  // Method to submit a job to the batch manager
+  const JobId BatchManager_Slurm::submitJob(const Job & job)
+  {
+    Parametre params = job.getParametre();
+    const string workDir = params[WORKDIR];
+
+    // export input files on cluster
+    exportInputFiles(job);
+
+    // build command file to submit the job and copy it on the server
+    string cmdFile = buildCommandFile(job);
+
+    // define command to submit batch
+    string subCommand = string("cd ") + workDir + "; sbatch " + cmdFile;
+    string command = _protocol.getExecCommand(subCommand, _hostname, _username);
+    command += " 2>&1";
+    cout << command.c_str() << endl;
+
+    // submit job
+    string output;
+    int status = Utils::getCommandOutput(command, output);
+    cout << output;
+    if (status != 0) throw RunTimeException("Can't submit job, error was: " + output);
+
+    // find id of submitted job in output
+    string search = "Submitted batch job ";
+    string::size_type pos = output.find(search);
+    if (pos == string::npos)
+      throw RunTimeException("Error in the submission of the job on the remote host");
+    pos += search.size();
+    string::size_type endl_pos = output.find('\n', pos);
+    string::size_type count = (endl_pos == string::npos)? string::npos : endl_pos - pos;
+    string jobref = output.substr(pos, count);
+
+    JobId id(this, jobref);
+    return id;
+  }
+
+  /**
+   * Create Slurm command file and copy it on the server.
+   * Return the name of the remote file.
+   */
+  string BatchManager_Slurm::buildCommandFile(const Job & job)
+  {
+    Parametre params = job.getParametre();
+
+    // Job Parameters
+    string workDir = "";
+    string fileToExecute = "";
+    string queue = "";
+
+    // Mandatory parameters
+    if (params.find(WORKDIR) != params.end()) 
+      workDir = params[WORKDIR].str();
+    else 
+      throw RunTimeException("params[WORKDIR] is not defined. Please define it, cannot submit this job.");
+    if (params.find(EXECUTABLE) != params.end()) 
+      fileToExecute = params[EXECUTABLE].str();
+    else 
+      throw RunTimeException("params[EXECUTABLE] is not defined. Please define it, cannot submit this job.");
+
+    string::size_type p1 = fileToExecute.find_last_of("/");
+    string::size_type p2 = fileToExecute.find_last_of(".");
+    string rootNameToExecute = fileToExecute.substr(p1+1,p2-p1-1);
+    string fileNameToExecute = fileToExecute.substr(p1+1);
+
+    // Create batch submit file
+    ofstream tempOutputFile;
+    string tmpFileName = Utils::createAndOpenTemporaryFile("slurm-script", tempOutputFile);
+
+    tempOutputFile << "#!/bin/bash" << endl;
+    tempOutputFile << "#SBATCH --output=" << workDir << "/logs/output.log." << rootNameToExecute << endl;
+    tempOutputFile << "#SBATCH --error=" << workDir << "/logs/error.log." << rootNameToExecute << endl;
+
+    if (params.find(NAME) != params.end())
+      tempOutputFile << "#SBATCH --job-name=\"" << params[NAME] << "\"" << endl;
+
+    // Optional parameters
+    int nbproc = 1;
+    if (params.find(NBPROC) != params.end())
+      nbproc = params[NBPROC];
+    tempOutputFile << "#SBATCH --ntasks=" << nbproc << endl;
+
+    if (params.find(EXCLUSIVE) != params.end()) {
+      if (params[EXCLUSIVE])
+        tempOutputFile << "#SBATCH --exclusive" << endl;
+      else
+        tempOutputFile << "#SBATCH --share" << endl;
+    }
+
+    if (params.find(MAXWALLTIME) != params.end())
+      tempOutputFile << "#SBATCH --time=" << params[MAXWALLTIME] << endl;
+    if (params.find(MAXRAMSIZE) != params.end())
+      tempOutputFile << "#SBATCH --mem=" << params[MAXRAMSIZE] << endl;
+    if (params.find(QUEUE) != params.end())
+      tempOutputFile << "#SBATCH --partition=" << params[QUEUE] << endl;
+
+    // Define environment for the job
+    Environnement env = job.getEnvironnement();
+    for (Environnement::const_iterator iter = env.begin() ; iter != env.end() ; ++iter) {
+      tempOutputFile << "export " << iter->first << "=" << iter->second << endl;
+    }
+
+    // generate nodes file
+    tempOutputFile << "LIBBATCH_NODEFILE=`mktemp nodefile-XXXXXXXXXX`" << endl;
+    tempOutputFile << "srun hostname > $LIBBATCH_NODEFILE" << endl;
+    tempOutputFile << "export LIBBATCH_NODEFILE" << endl;
+
+    // Launch the executable
+    tempOutputFile << "cd " << workDir << endl;
+    tempOutputFile << "./" + fileNameToExecute << endl;
+
+    // Remove the node file
+    tempOutputFile << "rm $LIBBATCH_NODEFILE" << endl;
+
+    tempOutputFile.flush();
+    tempOutputFile.close();
+
+    cerr << "Batch script file generated is: " << tmpFileName << endl;
+
+    string remoteFileName = rootNameToExecute + "_slurm.cmd";
+    int status = _protocol.copyFile(tmpFileName, "", "",
+                                    workDir + "/" + remoteFileName,
+                                    _hostname, _username);
+    if (status)
+      throw RunTimeException("Cannot copy command file on host " + _hostname);
+
+    return remoteFileName;
+  }
+
+  void BatchManager_Slurm::deleteJob(const JobId & jobid)
+  {
+    // define command to delete job
+    string subCommand = "scancel " + jobid.getReference();
+    string command = _protocol.getExecCommand(subCommand, _hostname, _username);
+    cerr << command.c_str() << endl;
+
+    int status = system(command.c_str());
+    if (status)
+      throw RunTimeException("Can't delete job " + jobid.getReference());
+
+    cerr << "job " << jobid.getReference() << " killed" << endl;
+  }
+
+  void BatchManager_Slurm::holdJob(const JobId & jobid)
+  {
+    throw NotYetImplementedException("BatchManager_Slurm::holdJob");
+  }
+
+  void BatchManager_Slurm::releaseJob(const JobId & jobid)
+  {
+    throw NotYetImplementedException("BatchManager_Slurm::releaseJob");
+  }
+
+  void BatchManager_Slurm::alterJob(const JobId & jobid, const Parametre & param, const Environnement & env)
+  {
+    throw NotYetImplementedException("BatchManager_Slurm::alterJob");
+  }
+
+  void BatchManager_Slurm::alterJob(const JobId & jobid, const Parametre & param)
+  {
+    throw NotYetImplementedException("BatchManager_Slurm::alterJob");
+  }
+
+  void BatchManager_Slurm::alterJob(const JobId & jobid, const Environnement & env)
+  {
+    throw NotYetImplementedException("BatchManager_Slurm::alterJob");
+  }
+
+  JobInfo BatchManager_Slurm::queryJob(const JobId & jobid)
+  {
+    // define command to query batch
+    string subCommand = "squeue -o %t -j " + jobid.getReference();
+    string command = _protocol.getExecCommand(subCommand, _hostname, _username);
+    cerr << command.c_str() << endl;
+    string output;
+    Utils::getCommandOutput(command, output);
+    // We don't test the return code here because with jobs finished since a long time Slurm
+    // returns an error and a message like "slurm_load_jobs error: Invalid job id specified".
+    // So we consider that the job is finished when we get an error.
+
+    JobInfo_Slurm jobinfo = JobInfo_Slurm(jobid.getReference(), output);
+    return jobinfo;
+  }
+
+  const JobId BatchManager_Slurm::addJob(const Job & job, const string reference)
+  {
+    return JobId(this, reference);
+  }
+
+}
diff --git a/src/Slurm/BatchManager_Slurm.hxx b/src/Slurm/BatchManager_Slurm.hxx
new file mode 100644 (file)
index 0000000..14f9dbf
--- /dev/null
@@ -0,0 +1,72 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ *  BatchManager_Slurm.hxx :
+ *
+ *  Created on: 12 may 2011
+ *  Author : Renaud BARATE - EDF R&D
+ */
+
+#ifndef _BATCHMANAGER_ESLURM_H_
+#define _BATCHMANAGER_ESLURM_H_
+
+#include <string>
+
+#include <Defines.hxx>
+#include <JobId.hxx>
+#include <JobInfo.hxx>
+#include <FactBatchManager.hxx>
+#include <BatchManager.hxx>
+
+namespace Batch {
+
+  class BATCH_EXPORT BatchManager_Slurm : public BatchManager
+  {
+  public:
+
+    BatchManager_Slurm(const FactBatchManager * parent,
+                        const char * host = "localhost",
+                        const char * username = "",
+                        CommunicationProtocolType protocolType = SSH,
+                        const char * mpiImpl = "nompi");
+    virtual ~BatchManager_Slurm();
+
+    // Methods to control jobs
+    virtual const JobId submitJob(const Job & job);
+    virtual void deleteJob(const JobId & jobid);
+    virtual void holdJob(const JobId & jobid);
+    virtual void releaseJob(const JobId & jobid);
+    virtual void alterJob(const JobId & jobid, const Parametre & param, const Environnement & env);
+    virtual void alterJob(const JobId & jobid, const Parametre & param);
+    virtual void alterJob(const JobId & jobid, const Environnement & env);
+    virtual JobInfo queryJob(const JobId & jobid);
+    virtual const JobId addJob(const Job & job, const std::string reference);
+
+  protected:
+
+    std::string buildCommandFile(const Job & job);
+
+  };
+
+}
+
+#endif
diff --git a/src/Slurm/Batch_BatchManager_eSlurm.cxx b/src/Slurm/Batch_BatchManager_eSlurm.cxx
deleted file mode 100644 (file)
index f1e999e..0000000
+++ /dev/null
@@ -1,246 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- *  Batch_BatchManager_eSlurm.cxx :
- *
- *  Created on: 12 may 2011
- *  Author : Renaud BARATE - EDF R&D
- */
-
-#include <cstdlib>
-#include <fstream>
-
-#include <Batch_NotYetImplementedException.hxx>
-#include <Batch_Constants.hxx>
-#include <Batch_Utils.hxx>
-
-#include "Batch_BatchManager_eSlurm.hxx"
-#include "Batch_JobInfo_eSlurm.hxx"
-
-using namespace std;
-
-namespace Batch {
-
-  BatchManager_eSlurm::BatchManager_eSlurm(const FactBatchManager * parent,
-                                           const char * host,
-                                           const char * username,
-                                           CommunicationProtocolType protocolType,
-                                           const char * mpiImpl)
-    : BatchManager(parent, host, username, protocolType, mpiImpl)
-  {
-  }
-
-  BatchManager_eSlurm::~BatchManager_eSlurm()
-  {
-  }
-
-  // Method to submit a job to the batch manager
-  const JobId BatchManager_eSlurm::submitJob(const Job & job)
-  {
-    Parametre params = job.getParametre();
-    const string workDir = params[WORKDIR];
-
-    // export input files on cluster
-    exportInputFiles(job);
-
-    // build command file to submit the job and copy it on the server
-    string cmdFile = buildCommandFile(job);
-
-    // define command to submit batch
-    string subCommand = string("cd ") + workDir + "; sbatch " + cmdFile;
-    string command = _protocol.getExecCommand(subCommand, _hostname, _username);
-    command += " 2>&1";
-    cout << command.c_str() << endl;
-
-    // submit job
-    string output;
-    int status = Utils::getCommandOutput(command, output);
-    cout << output;
-    if (status != 0) throw RunTimeException("Can't submit job, error was: " + output);
-
-    // find id of submitted job in output
-    string search = "Submitted batch job ";
-    string::size_type pos = output.find(search);
-    if (pos == string::npos)
-      throw RunTimeException("Error in the submission of the job on the remote host");
-    pos += search.size();
-    string::size_type endl_pos = output.find('\n', pos);
-    string::size_type count = (endl_pos == string::npos)? string::npos : endl_pos - pos;
-    string jobref = output.substr(pos, count);
-
-    JobId id(this, jobref);
-    return id;
-  }
-
-  /**
-   * Create Slurm command file and copy it on the server.
-   * Return the name of the remote file.
-   */
-  string BatchManager_eSlurm::buildCommandFile(const Job & job)
-  {
-    Parametre params = job.getParametre();
-
-    // Job Parameters
-    string workDir = "";
-    string fileToExecute = "";
-    string queue = "";
-
-    // Mandatory parameters
-    if (params.find(WORKDIR) != params.end()) 
-      workDir = params[WORKDIR].str();
-    else 
-      throw RunTimeException("params[WORKDIR] is not defined. Please define it, cannot submit this job.");
-    if (params.find(EXECUTABLE) != params.end()) 
-      fileToExecute = params[EXECUTABLE].str();
-    else 
-      throw RunTimeException("params[EXECUTABLE] is not defined. Please define it, cannot submit this job.");
-
-    string::size_type p1 = fileToExecute.find_last_of("/");
-    string::size_type p2 = fileToExecute.find_last_of(".");
-    string rootNameToExecute = fileToExecute.substr(p1+1,p2-p1-1);
-    string fileNameToExecute = fileToExecute.substr(p1+1);
-
-    // Create batch submit file
-    ofstream tempOutputFile;
-    string tmpFileName = Utils::createAndOpenTemporaryFile("slurm-script", tempOutputFile);
-
-    tempOutputFile << "#!/bin/bash" << endl;
-    tempOutputFile << "#SBATCH --output=" << workDir << "/logs/output.log." << rootNameToExecute << endl;
-    tempOutputFile << "#SBATCH --error=" << workDir << "/logs/error.log." << rootNameToExecute << endl;
-
-    if (params.find(NAME) != params.end())
-      tempOutputFile << "#SBATCH --job-name=\"" << params[NAME] << "\"" << endl;
-
-    // Optional parameters
-    int nbproc = 1;
-    if (params.find(NBPROC) != params.end())
-      nbproc = params[NBPROC];
-    tempOutputFile << "#SBATCH --ntasks=" << nbproc << endl;
-
-    if (params.find(EXCLUSIVE) != params.end()) {
-      if (params[EXCLUSIVE])
-        tempOutputFile << "#SBATCH --exclusive" << endl;
-      else
-        tempOutputFile << "#SBATCH --share" << endl;
-    }
-
-    if (params.find(MAXWALLTIME) != params.end())
-      tempOutputFile << "#SBATCH --time=" << params[MAXWALLTIME] << endl;
-    if (params.find(MAXRAMSIZE) != params.end())
-      tempOutputFile << "#SBATCH --mem=" << params[MAXRAMSIZE] << endl;
-    if (params.find(QUEUE) != params.end())
-      tempOutputFile << "#SBATCH --partition=" << params[QUEUE] << endl;
-
-    // Define environment for the job
-    Environnement env = job.getEnvironnement();
-    for (Environnement::const_iterator iter = env.begin() ; iter != env.end() ; ++iter) {
-      tempOutputFile << "export " << iter->first << "=" << iter->second << endl;
-    }
-
-    // generate nodes file
-    tempOutputFile << "LIBBATCH_NODEFILE=`mktemp nodefile-XXXXXXXXXX`" << endl;
-    tempOutputFile << "srun hostname > $LIBBATCH_NODEFILE" << endl;
-    tempOutputFile << "export LIBBATCH_NODEFILE" << endl;
-
-    // Launch the executable
-    tempOutputFile << "cd " << workDir << endl;
-    tempOutputFile << "./" + fileNameToExecute << endl;
-
-    // Remove the node file
-    tempOutputFile << "rm $LIBBATCH_NODEFILE" << endl;
-
-    tempOutputFile.flush();
-    tempOutputFile.close();
-
-    cerr << "Batch script file generated is: " << tmpFileName << endl;
-
-    string remoteFileName = rootNameToExecute + "_slurm.cmd";
-    int status = _protocol.copyFile(tmpFileName, "", "",
-                                    workDir + "/" + remoteFileName,
-                                    _hostname, _username);
-    if (status)
-      throw RunTimeException("Cannot copy command file on host " + _hostname);
-
-    return remoteFileName;
-  }
-
-  void BatchManager_eSlurm::deleteJob(const JobId & jobid)
-  {
-    // define command to delete job
-    string subCommand = "scancel " + jobid.getReference();
-    string command = _protocol.getExecCommand(subCommand, _hostname, _username);
-    cerr << command.c_str() << endl;
-
-    int status = system(command.c_str());
-    if (status)
-      throw RunTimeException("Can't delete job " + jobid.getReference());
-
-    cerr << "job " << jobid.getReference() << " killed" << endl;
-  }
-
-  void BatchManager_eSlurm::holdJob(const JobId & jobid)
-  {
-    throw NotYetImplementedException("BatchManager_eSlurm::holdJob");
-  }
-
-  void BatchManager_eSlurm::releaseJob(const JobId & jobid)
-  {
-    throw NotYetImplementedException("BatchManager_eSlurm::releaseJob");
-  }
-
-  void BatchManager_eSlurm::alterJob(const JobId & jobid, const Parametre & param, const Environnement & env)
-  {
-    throw NotYetImplementedException("BatchManager_eSlurm::alterJob");
-  }
-
-  void BatchManager_eSlurm::alterJob(const JobId & jobid, const Parametre & param)
-  {
-    throw NotYetImplementedException("BatchManager_eSlurm::alterJob");
-  }
-
-  void BatchManager_eSlurm::alterJob(const JobId & jobid, const Environnement & env)
-  {
-    throw NotYetImplementedException("BatchManager_eSlurm::alterJob");
-  }
-
-  JobInfo BatchManager_eSlurm::queryJob(const JobId & jobid)
-  {
-    // define command to query batch
-    string subCommand = "squeue -o %t -j " + jobid.getReference();
-    string command = _protocol.getExecCommand(subCommand, _hostname, _username);
-    cerr << command.c_str() << endl;
-    string output;
-    Utils::getCommandOutput(command, output);
-    // We don't test the return code here because with jobs finished since a long time Slurm
-    // returns an error and a message like "slurm_load_jobs error: Invalid job id specified".
-    // So we consider that the job is finished when we get an error.
-
-    JobInfo_eSlurm jobinfo = JobInfo_eSlurm(jobid.getReference(), output);
-    return jobinfo;
-  }
-
-  const JobId BatchManager_eSlurm::addJob(const Job & job, const string reference)
-  {
-    return JobId(this, reference);
-  }
-
-}
diff --git a/src/Slurm/Batch_BatchManager_eSlurm.hxx b/src/Slurm/Batch_BatchManager_eSlurm.hxx
deleted file mode 100644 (file)
index 83a624c..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- *  Batch_BatchManager_eSlurm.hxx :
- *
- *  Created on: 12 may 2011
- *  Author : Renaud BARATE - EDF R&D
- */
-
-#ifndef _BATCHMANAGER_ESLURM_H_
-#define _BATCHMANAGER_ESLURM_H_
-
-#include <string>
-
-#include <Batch_Defines.hxx>
-#include <Batch_JobId.hxx>
-#include <Batch_JobInfo.hxx>
-#include <Batch_FactBatchManager.hxx>
-#include <Batch_BatchManager.hxx>
-
-namespace Batch {
-
-  class BATCH_EXPORT BatchManager_eSlurm : public BatchManager
-  {
-  public:
-
-    BatchManager_eSlurm(const FactBatchManager * parent,
-                        const char * host = "localhost",
-                        const char * username = "",
-                        CommunicationProtocolType protocolType = SSH,
-                        const char * mpiImpl = "nompi");
-    virtual ~BatchManager_eSlurm();
-
-    // Methods to control jobs
-    virtual const JobId submitJob(const Job & job);
-    virtual void deleteJob(const JobId & jobid);
-    virtual void holdJob(const JobId & jobid);
-    virtual void releaseJob(const JobId & jobid);
-    virtual void alterJob(const JobId & jobid, const Parametre & param, const Environnement & env);
-    virtual void alterJob(const JobId & jobid, const Parametre & param);
-    virtual void alterJob(const JobId & jobid, const Environnement & env);
-    virtual JobInfo queryJob(const JobId & jobid);
-    virtual const JobId addJob(const Job & job, const std::string reference);
-
-  protected:
-
-    std::string buildCommandFile(const Job & job);
-
-  };
-
-}
-
-#endif
diff --git a/src/Slurm/Batch_FactBatchManager_eSlurm.cxx b/src/Slurm/Batch_FactBatchManager_eSlurm.cxx
deleted file mode 100644 (file)
index 8f524f2..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- *  Batch_FactBatchManager_eSlurm.cxx :
- *
- *  Created on: 12 may 2011
- *  Author : Renaud BARATE - EDF R&D
- */
-
-#include <Batch_ParameterTypeMap.hxx>
-
-#include "Batch_BatchManager_eSlurm.hxx"
-#include "Batch_FactBatchManager_eSlurm.hxx"
-
-namespace Batch {
-
-  static FactBatchManager_eSlurm sFBM_eSlurm;
-
-  FactBatchManager_eSlurm::FactBatchManager_eSlurm() : FactBatchManager("SLURM")
-  {
-  }
-
-  FactBatchManager_eSlurm::~FactBatchManager_eSlurm()
-  {
-  }
-
-  BatchManager * FactBatchManager_eSlurm::operator() (const char * hostname,
-                                                      const char * username,
-                                                      CommunicationProtocolType protocolType,
-                                                      const char * mpiImpl) const
-  {
-    return new BatchManager_eSlurm(this, hostname, username, protocolType, mpiImpl);
-  }
-
-}
diff --git a/src/Slurm/Batch_FactBatchManager_eSlurm.hxx b/src/Slurm/Batch_FactBatchManager_eSlurm.hxx
deleted file mode 100644 (file)
index bf7aaa2..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- *  Batch_FactBatchManager_eSlurm.hxx :
- *
- *  Created on: 12 may 2011
- *  Author : Renaud BARATE - EDF R&D
- */
-
-#ifndef _FACTBATCHMANAGER_ESLURM_H_
-#define _FACTBATCHMANAGER_ESLURM_H_
-
-#include <Batch_Defines.hxx>
-#include <Batch_BatchManager.hxx>
-#include <Batch_FactBatchManager.hxx>
-
-namespace Batch {
-
-  class BATCH_EXPORT FactBatchManager_eSlurm : public FactBatchManager
-  {
-  public:
-
-    FactBatchManager_eSlurm();
-    virtual ~FactBatchManager_eSlurm();
-
-    virtual BatchManager * operator() (const char * hostname,
-                                       const char * username,
-                                       CommunicationProtocolType protocolType,
-                                       const char * mpiImpl) const;
-
-  };
-
-}
-
-#endif
diff --git a/src/Slurm/Batch_JobInfo_eSlurm.cxx b/src/Slurm/Batch_JobInfo_eSlurm.cxx
deleted file mode 100644 (file)
index 3b2d711..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- *  Batch_JobInfo_eSlurm.cxx :
- *
- *  Created on: 12 may 2011
- *  Author : Renaud BARATE - EDF R&D
- */
-
-#include <sstream>
-
-#include <Batch_RunTimeException.hxx>
-#include <Batch_Constants.hxx>
-
-#include "Batch_JobInfo_eSlurm.hxx"
-
-using namespace std;
-
-namespace Batch {
-
-  JobInfo_eSlurm::JobInfo_eSlurm(const std::string & id, const std::string & queryOutput)
-    : JobInfo()
-  {
-    _param[ID] = id;
-
-    // read query output, status should be on the second line
-    istringstream iss(queryOutput);
-    string status;
-    for (int i=0 ; i<2 ; i++)
-      getline(iss, status);
-
-    if (status.size() == 0) {
-      // On some batch managers, the job is deleted as soon as it is finished,
-      // so we have to consider that an unknown job is a finished one, even if
-      // it is not always true.
-      _param[STATE] = FINISHED;
-    } else if (status == "CA") { // Canceled
-      _param[STATE] = FAILED;
-    } else if (status == "CD") { // Completed
-      _param[STATE] = FINISHED;
-    } else if (status == "CF") { // Configuring
-      _param[STATE] = QUEUED;
-    } else if (status == "CG") { // Completing
-      _param[STATE] = RUNNING;
-    } else if (status == "F") {  // Failed
-      _param[STATE] = FAILED;
-    } else if (status == "NF") { // Node Fail
-      _param[STATE] = FAILED;
-    } else if (status == "PD") { // Pending
-      _param[STATE] = QUEUED;
-    } else if (status == "R") {  // Running
-      _param[STATE] = RUNNING;
-    } else if (status == "S") {  // Suspended
-      _param[STATE] = PAUSED;
-    } else if (status == "TO") { // Timeout
-      _param[STATE] = FAILED;
-    } else {
-      throw RunTimeException("Unknown job state code: \"" + status + "\"");
-    }
-  }
-
-  JobInfo_eSlurm::~JobInfo_eSlurm()
-  {
-  }
-
-}
diff --git a/src/Slurm/Batch_JobInfo_eSlurm.hxx b/src/Slurm/Batch_JobInfo_eSlurm.hxx
deleted file mode 100644 (file)
index d9c4cc8..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- *  Batch_JobInfo_eSlurm.hxx :
- *
- *  Created on: 12 may 2011
- *  Author : Renaud BARATE - EDF R&D
- */
-
-#ifndef _JOBINFO_ESLURM_H_
-#define _JOBINFO_ESLURM_H_
-
-#include <string>
-
-#include <Batch_JobInfo.hxx>
-
-namespace Batch {
-
-  class JobInfo_eSlurm : public JobInfo
-  {
-  public:
-
-    JobInfo_eSlurm(const std::string & id, const std::string & queryOutput);
-    virtual ~JobInfo_eSlurm();
-
-  };
-
-}
-
-#endif
index 175559a9183ddaeb80dd78b69114d0558c08d5ee..e08f31de61464a497ab941add7481f7ce1a20bdb 100644 (file)
@@ -20,9 +20,9 @@
 #  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-SET(CLASS_LIST Slurm/Batch_BatchManager_eSlurm
-               Slurm/Batch_FactBatchManager_eSlurm
-               Slurm/Batch_JobInfo_eSlurm
+SET(CLASS_LIST Slurm/BatchManager_Slurm
+               Slurm/FactBatchManager_Slurm
+               Slurm/JobInfo_Slurm
    )
 
 APPEND_CLASSES_TO_SRC_FILES(${CLASS_LIST})
diff --git a/src/Slurm/FactBatchManager_Slurm.cxx b/src/Slurm/FactBatchManager_Slurm.cxx
new file mode 100644 (file)
index 0000000..c4814eb
--- /dev/null
@@ -0,0 +1,54 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ *  FactBatchManager_Slurm.cxx :
+ *
+ *  Created on: 12 may 2011
+ *  Author : Renaud BARATE - EDF R&D
+ */
+
+#include <ParameterTypeMap.hxx>
+
+#include "BatchManager_Slurm.hxx"
+#include "FactBatchManager_Slurm.hxx"
+
+namespace Batch {
+
+  static FactBatchManager_Slurm sFBM_Slurm;
+
+  FactBatchManager_Slurm::FactBatchManager_Slurm() : FactBatchManager("SLURM")
+  {
+  }
+
+  FactBatchManager_Slurm::~FactBatchManager_Slurm()
+  {
+  }
+
+  BatchManager * FactBatchManager_Slurm::operator() (const char * hostname,
+                                                      const char * username,
+                                                      CommunicationProtocolType protocolType,
+                                                      const char * mpiImpl) const
+  {
+    return new BatchManager_Slurm(this, hostname, username, protocolType, mpiImpl);
+  }
+
+}
diff --git a/src/Slurm/FactBatchManager_Slurm.hxx b/src/Slurm/FactBatchManager_Slurm.hxx
new file mode 100644 (file)
index 0000000..c37838c
--- /dev/null
@@ -0,0 +1,54 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ *  FactBatchManager_Slurm.hxx :
+ *
+ *  Created on: 12 may 2011
+ *  Author : Renaud BARATE - EDF R&D
+ */
+
+#ifndef _FACTBATCHMANAGER_ESLURM_H_
+#define _FACTBATCHMANAGER_ESLURM_H_
+
+#include <Defines.hxx>
+#include <BatchManager.hxx>
+#include <FactBatchManager.hxx>
+
+namespace Batch {
+
+  class BATCH_EXPORT FactBatchManager_Slurm : public FactBatchManager
+  {
+  public:
+
+    FactBatchManager_Slurm();
+    virtual ~FactBatchManager_Slurm();
+
+    virtual BatchManager * operator() (const char * hostname,
+                                       const char * username,
+                                       CommunicationProtocolType protocolType,
+                                       const char * mpiImpl) const;
+
+  };
+
+}
+
+#endif
diff --git a/src/Slurm/JobInfo_Slurm.cxx b/src/Slurm/JobInfo_Slurm.cxx
new file mode 100644 (file)
index 0000000..6e8aac5
--- /dev/null
@@ -0,0 +1,85 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ *  JobInfo_Slurm.cxx :
+ *
+ *  Created on: 12 may 2011
+ *  Author : Renaud BARATE - EDF R&D
+ */
+
+#include <sstream>
+
+#include <RunTimeException.hxx>
+#include <Constants.hxx>
+
+#include "JobInfo_Slurm.hxx"
+
+using namespace std;
+
+namespace Batch {
+
+  JobInfo_Slurm::JobInfo_Slurm(const std::string & id, const std::string & queryOutput)
+    : JobInfo()
+  {
+    _param[ID] = id;
+
+    // read query output, status should be on the second line
+    istringstream iss(queryOutput);
+    string status;
+    for (int i=0 ; i<2 ; i++)
+      getline(iss, status);
+
+    if (status.size() == 0) {
+      // On some batch managers, the job is deleted as soon as it is finished,
+      // so we have to consider that an unknown job is a finished one, even if
+      // it is not always true.
+      _param[STATE] = FINISHED;
+    } else if (status == "CA") { // Canceled
+      _param[STATE] = FAILED;
+    } else if (status == "CD") { // Completed
+      _param[STATE] = FINISHED;
+    } else if (status == "CF") { // Configuring
+      _param[STATE] = QUEUED;
+    } else if (status == "CG") { // Completing
+      _param[STATE] = RUNNING;
+    } else if (status == "F") {  // Failed
+      _param[STATE] = FAILED;
+    } else if (status == "NF") { // Node Fail
+      _param[STATE] = FAILED;
+    } else if (status == "PD") { // Pending
+      _param[STATE] = QUEUED;
+    } else if (status == "R") {  // Running
+      _param[STATE] = RUNNING;
+    } else if (status == "S") {  // Suspended
+      _param[STATE] = PAUSED;
+    } else if (status == "TO") { // Timeout
+      _param[STATE] = FAILED;
+    } else {
+      throw RunTimeException("Unknown job state code: \"" + status + "\"");
+    }
+  }
+
+  JobInfo_Slurm::~JobInfo_Slurm()
+  {
+  }
+
+}
diff --git a/src/Slurm/JobInfo_Slurm.hxx b/src/Slurm/JobInfo_Slurm.hxx
new file mode 100644 (file)
index 0000000..cb03982
--- /dev/null
@@ -0,0 +1,49 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ *  JobInfo_Slurm.hxx :
+ *
+ *  Created on: 12 may 2011
+ *  Author : Renaud BARATE - EDF R&D
+ */
+
+#ifndef _JOBINFO_ESLURM_H_
+#define _JOBINFO_ESLURM_H_
+
+#include <string>
+
+#include <JobInfo.hxx>
+
+namespace Batch {
+
+  class JobInfo_Slurm : public JobInfo
+  {
+  public:
+
+    JobInfo_Slurm(const std::string & id, const std::string & queryOutput);
+    virtual ~JobInfo_Slurm();
+
+  };
+
+}
+
+#endif
diff --git a/src/Vishnu/BatchManager_Vishnu.cxx b/src/Vishnu/BatchManager_Vishnu.cxx
new file mode 100644 (file)
index 0000000..f9069b1
--- /dev/null
@@ -0,0 +1,350 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ *  BatchManager_Vishnu.cxx :
+ *
+ *  Created on: 24 june 2011
+ *  Author : Renaud BARATE - EDF R&D
+ */
+
+#ifndef WIN32
+#include <unistd.h>
+#endif
+
+#include <cstdlib>
+#include <iostream>
+#include <fstream>
+#include <sstream>
+
+#include <NotYetImplementedException.hxx>
+#include <Constants.hxx>
+#include <Utils.hxx>
+
+#include "BatchManager_Vishnu.hxx"
+#include "JobInfo_Vishnu.hxx"
+
+using namespace std;
+
+namespace Batch {
+
+  BatchManager_Vishnu::BatchManager_Vishnu(const FactBatchManager * parent,
+                                             const char * host,
+                                             const char * username,
+                                             CommunicationProtocolType protocolType,
+                                             const char * mpiImpl)
+    : // Force SH protocol for Vishnu
+      BatchManager(parent, host, username, SH, mpiImpl)
+  {
+  }
+
+  BatchManager_Vishnu::~BatchManager_Vishnu()
+  {
+  }
+
+  // Method to submit a job to the batch manager
+  const JobId BatchManager_Vishnu::submitJob(const Job & job)
+  {
+    // export input files on cluster
+    exportInputFiles(job);
+
+    // build command file to submit the job
+    string cmdFile = buildCommandFile(job);
+
+    // define extra parameters (that can not be defined in the command file)
+    Parametre params = job.getParametre();
+    ostringstream extraParams;
+    if (params.find(NBPROC) != params.end())
+      extraParams << "-P " << params[NBPROC] << " ";
+    if (params.find(MAXRAMSIZE) != params.end())
+      extraParams << "-m " << params[MAXRAMSIZE] << " ";
+
+    // define command to submit batch
+    string subCommand = string("export OMNIORB_CONFIG=$VISHNU_CONFIG_FILE; ");
+    subCommand += "vishnu_connect && ";
+    subCommand += "vishnu_submit_job " + extraParams.str() + _hostname + " " + cmdFile + " && ";
+    subCommand += "vishnu_close";
+    string command = _protocol.getExecCommand(subCommand, _hostname, _username);
+    command += " 2>&1";
+    cerr << command.c_str() << endl;
+
+    // submit job
+    string output;
+    int status = Utils::getCommandOutput(command, output);
+    cout << output;
+    if (status != 0) throw RunTimeException("Can't submit job, error was: " + output);
+
+    // find id of submitted job in output
+    string search = "Job Id     : ";
+    string::size_type pos = output.find(search);
+    if (pos == string::npos)
+      throw RunTimeException("Error in the submission of the job on the remote host");
+    pos += search.size();
+    string::size_type endl_pos = output.find('\n', pos);
+    string::size_type count = (endl_pos == string::npos)? string::npos : endl_pos - pos;
+    string jobref = output.substr(pos, count);
+    if (jobref.size() == 0)
+      throw RunTimeException("Error in the submission of the job on the remote host");
+
+    JobId id(this, jobref);
+    return id;
+  }
+
+
+  void BatchManager_Vishnu::exportInputFiles(const Job& job)
+  {
+    Parametre params = job.getParametre();
+    string subCommand = string("export OMNIORB_CONFIG=$VISHNU_CONFIG_FILE; ");
+    subCommand += "vishnu_connect && ";
+
+    // create remote directories
+    subCommand += "vishnu_create_dir -p " + _hostname + ":" + params[WORKDIR].str() + "/logs && ";
+
+    // copy executable
+    string executeFile = params[EXECUTABLE];
+    if (executeFile.size() != 0) {
+      subCommand += "vishnu_copy_file " + executeFile + " " +
+                    _hostname + ":" + params[WORKDIR].str() + "/ && ";
+    }
+
+    // copy filesToExportList
+    const Versatile & V = params[INFILE];
+    Versatile::const_iterator Vit;
+    for (Vit=V.begin(); Vit!=V.end(); Vit++) {
+      CoupleType cpt  = *static_cast< CoupleType * >(*Vit);
+      Couple inputFile = cpt;
+
+      // Get absolute paths
+      char * buf = getcwd(NULL, 0);
+      string cwd = buf;
+      free(buf);
+
+      string absremote = (Utils::isAbsolutePath(inputFile.getRemote()))?
+                         inputFile.getRemote() :
+                         params[WORKDIR].str() + "/" + inputFile.getRemote();
+      string abslocal = (Utils::isAbsolutePath(inputFile.getLocal()))?
+                        inputFile.getLocal() :
+                        cwd + "/" + inputFile.getLocal();
+
+      if (Vit != V.begin())
+        subCommand += " && ";
+      subCommand += "vishnu_copy_file " + abslocal + " " + _hostname + ":" + absremote;
+    }
+    subCommand += " && vishnu_close";
+
+    // Execute command
+    string command = _protocol.getExecCommand(subCommand, _hostname, _username);
+    command += " 2>&1";
+    cerr << command.c_str() << endl;
+    string output;
+    int status = Utils::getCommandOutput(command, output);
+    cout << output;
+    if (status != 0)
+      throw RunTimeException("Can't copy input files, error was: " + output);
+  }
+
+  /**
+   * Create Vishnu command file and copy it on the server.
+   * Return the name of the remote file.
+   */
+  string BatchManager_Vishnu::buildCommandFile(const Job & job)
+  {
+    Parametre params = job.getParametre();
+
+    // Job Parameters
+    string workDir = "";
+    string fileToExecute = "";
+    string queue = "";
+
+    // Mandatory parameters
+    if (params.find(WORKDIR) != params.end()) 
+      workDir = params[WORKDIR].str();
+    else 
+      throw RunTimeException("params[WORKDIR] is not defined. Please define it, cannot submit this job.");
+    if (params.find(EXECUTABLE) != params.end()) 
+      fileToExecute = params[EXECUTABLE].str();
+    else 
+      throw RunTimeException("params[EXECUTABLE] is not defined. Please define it, cannot submit this job.");
+
+    string::size_type p1 = fileToExecute.find_last_of("/");
+    string::size_type p2 = fileToExecute.find_last_of(".");
+    string rootNameToExecute = fileToExecute.substr(p1+1,p2-p1-1);
+    string fileNameToExecute = fileToExecute.substr(p1+1);
+
+    // Create batch submit file
+    ofstream tempOutputFile;
+    string tmpFileName = Utils::createAndOpenTemporaryFile("vishnu-script", tempOutputFile);
+
+    tempOutputFile << "#!/bin/sh" << endl;
+    tempOutputFile << "#% vishnu_output=" << workDir << "/logs/output.log." << rootNameToExecute << endl;
+    tempOutputFile << "#% vishnu_rror=" << workDir << "/logs/error.log." << rootNameToExecute << endl;
+
+    if (params.find(NAME) != params.end())
+      tempOutputFile << "#% vishnu_job_name=\"" << params[NAME] << "\"" << endl;
+
+    // Optional parameters
+    if (params.find(MAXWALLTIME) != params.end()) {
+      long totalMinutes = params[MAXWALLTIME];
+      long h = totalMinutes / 60;
+      long m = totalMinutes - h * 60;
+      tempOutputFile << "#% vishnu_wallclocklimit=" << h << ":";
+      if (m < 10)
+        tempOutputFile << "0";
+      tempOutputFile << m << ":00" << endl;
+    }
+    if (params.find(QUEUE) != params.end())
+      tempOutputFile << "#% vishnu_queue=" << params[QUEUE] << endl;
+
+    // Define environment for the job
+    Environnement env = job.getEnvironnement();
+    for (Environnement::const_iterator iter = env.begin() ; iter != env.end() ; ++iter) {
+      tempOutputFile << "export " << iter->first << "=" << iter->second << endl;
+    }
+
+    // Node file
+    tempOutputFile << "export LIBBATCH_NODEFILE=$VISHNU_BATCHJOB_NODEFILE" << endl;
+
+    // Launch the executable
+    tempOutputFile << "cd " << workDir << endl;
+    tempOutputFile << "./" + fileNameToExecute << endl;
+
+    tempOutputFile.flush();
+    tempOutputFile.close();
+
+    cerr << "Batch script file generated is: " << tmpFileName << endl;
+    return tmpFileName;
+  }
+
+  void BatchManager_Vishnu::deleteJob(const JobId & jobid)
+  {
+    // define command to delete job
+    string subCommand = string("export OMNIORB_CONFIG=$VISHNU_CONFIG_FILE; ");
+    subCommand += "vishnu_connect && ";
+    subCommand += "vishnu_cancel_job " + _hostname + " " + jobid.getReference() + " && ";
+    subCommand += "vishnu_close";
+    string command = _protocol.getExecCommand(subCommand, _hostname, _username);
+    cerr << command.c_str() << endl;
+
+    int status = system(command.c_str());
+    if (status)
+      throw RunTimeException("Can't delete job " + jobid.getReference());
+
+    cerr << "job " << jobid.getReference() << " killed" << endl;
+  }
+
+  void BatchManager_Vishnu::holdJob(const JobId & jobid)
+  {
+    throw NotYetImplementedException("BatchManager_Vishnu::holdJob");
+  }
+
+  void BatchManager_Vishnu::releaseJob(const JobId & jobid)
+  {
+    throw NotYetImplementedException("BatchManager_Vishnu::releaseJob");
+  }
+
+  void BatchManager_Vishnu::alterJob(const JobId & jobid, const Parametre & param, const Environnement & env)
+  {
+    throw NotYetImplementedException("BatchManager_Vishnu::alterJob");
+  }
+
+  void BatchManager_Vishnu::alterJob(const JobId & jobid, const Parametre & param)
+  {
+    throw NotYetImplementedException("BatchManager_Vishnu::alterJob");
+  }
+
+  void BatchManager_Vishnu::alterJob(const JobId & jobid, const Environnement & env)
+  {
+    throw NotYetImplementedException("BatchManager_Vishnu::alterJob");
+  }
+
+  JobInfo BatchManager_Vishnu::queryJob(const JobId & jobid)
+  {
+    // define command to query batch
+    string subCommand = string("export OMNIORB_CONFIG=$VISHNU_CONFIG_FILE; ");
+    subCommand += "vishnu_connect && ";
+    subCommand += "vishnu_get_job_info " + _hostname + " " + jobid.getReference() + " && ";
+    subCommand += "vishnu_close";
+    string command = _protocol.getExecCommand(subCommand, _hostname, _username);
+    cerr << command.c_str() << endl;
+
+    string output;
+    int status = Utils::getCommandOutput(command, output);
+    if (status != 0)
+      throw RunTimeException("Can't query job " + jobid.getReference());
+    JobInfo_Vishnu jobinfo = JobInfo_Vishnu(jobid.getReference(), output);
+    return jobinfo;
+  }
+
+  const JobId BatchManager_Vishnu::addJob(const Job & job, const string reference)
+  {
+    return JobId(this, reference);
+  }
+
+  void BatchManager_Vishnu::importOutputFiles(const Job & job, const std::string directory)
+  {
+    // Create local result directory
+    char * buf = getcwd(NULL, 0);
+    string cwd = buf;
+    free(buf);
+    string absdir = (Utils::isAbsolutePath(directory))? directory : cwd + "/" + directory;
+    int status = CommunicationProtocol::getInstance(SH).makeDirectory(absdir, "", "");
+    if (status != 0) {
+      throw RunTimeException("Can't create result directory");
+    }
+
+    string subCommand = string("export OMNIORB_CONFIG=$VISHNU_CONFIG_FILE; ");
+    subCommand += "vishnu_connect && ";
+
+    // Copy output files
+    Parametre params = job.getParametre();
+    const Versatile & V = params[OUTFILE];
+    Versatile::const_iterator Vit;
+    for (Vit=V.begin(); Vit!=V.end(); Vit++) {
+      CoupleType cpt  = *static_cast< CoupleType * >(*Vit);
+      Couple outputFile = cpt;
+
+      // Get absolute paths
+      string absremote = (Utils::isAbsolutePath(outputFile.getRemote()))?
+                         outputFile.getRemote() :
+                         params[WORKDIR].str() + "/" + outputFile.getRemote();
+      string abslocal = (Utils::isAbsolutePath(outputFile.getLocal()))?
+                        outputFile.getLocal() :
+                        absdir + "/" + outputFile.getLocal();
+
+      subCommand += "vishnu_copy_file " + _hostname + ":" + absremote + " " + abslocal + " && ";
+    }
+
+    // Copy logs
+    subCommand += "vishnu_copy_file -r " +_hostname + ":" + params[WORKDIR].str() + "/logs" + " " + absdir + " && ";
+    subCommand += "vishnu_close";
+
+    // Execute command
+    string command = _protocol.getExecCommand(subCommand, _hostname, _username);
+    command += " 2>&1";
+    cerr << command.c_str() << endl;
+    string output;
+    status = Utils::getCommandOutput(command, output);
+    cout << output;
+    if (status != 0)
+      throw RunTimeException("Can't import output files, error was: " + output);
+  }
+
+}
diff --git a/src/Vishnu/BatchManager_Vishnu.hxx b/src/Vishnu/BatchManager_Vishnu.hxx
new file mode 100644 (file)
index 0000000..d43eaaa
--- /dev/null
@@ -0,0 +1,74 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ *  BatchManager_Vishnu.hxx :
+ *
+ *  Created on: 24 june 2011
+ *  Author : Renaud BARATE - EDF R&D
+ */
+
+#ifndef _BATCHMANAGER_EVISHNU_H_
+#define _BATCHMANAGER_EVISHNU_H_
+
+#include <string>
+
+#include <Defines.hxx>
+#include <JobId.hxx>
+#include <JobInfo.hxx>
+#include <FactBatchManager.hxx>
+#include <BatchManager.hxx>
+
+namespace Batch {
+
+  class BATCH_EXPORT BatchManager_Vishnu : public BatchManager
+  {
+  public:
+
+    BatchManager_Vishnu(const FactBatchManager * parent,
+                         const char * host = "localhost",
+                         const char * username = "",
+                         CommunicationProtocolType protocolType = SSH,
+                         const char * mpiImpl = "nompi");
+    virtual ~BatchManager_Vishnu();
+
+    // Methods to control jobs
+    virtual const JobId submitJob(const Job & job);
+    virtual void deleteJob(const JobId & jobid);
+    virtual void holdJob(const JobId & jobid);
+    virtual void releaseJob(const JobId & jobid);
+    virtual void alterJob(const JobId & jobid, const Parametre & param, const Environnement & env);
+    virtual void alterJob(const JobId & jobid, const Parametre & param);
+    virtual void alterJob(const JobId & jobid, const Environnement & env);
+    virtual JobInfo queryJob(const JobId & jobid);
+    virtual const JobId addJob(const Job & job, const std::string reference);
+    virtual void importOutputFiles(const Job & job, const std::string directory);
+
+  protected:
+
+    std::string buildCommandFile(const Job & job);
+    void exportInputFiles(const Job & job);
+
+  };
+
+}
+
+#endif
diff --git a/src/Vishnu/Batch_BatchManager_eVishnu.cxx b/src/Vishnu/Batch_BatchManager_eVishnu.cxx
deleted file mode 100644 (file)
index 927f3ce..0000000
+++ /dev/null
@@ -1,350 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- *  Batch_BatchManager_eVishnu.cxx :
- *
- *  Created on: 24 june 2011
- *  Author : Renaud BARATE - EDF R&D
- */
-
-#ifndef WIN32
-#include <unistd.h>
-#endif
-
-#include <cstdlib>
-#include <iostream>
-#include <fstream>
-#include <sstream>
-
-#include <Batch_NotYetImplementedException.hxx>
-#include <Batch_Constants.hxx>
-#include <Batch_Utils.hxx>
-
-#include "Batch_BatchManager_eVishnu.hxx"
-#include "Batch_JobInfo_eVishnu.hxx"
-
-using namespace std;
-
-namespace Batch {
-
-  BatchManager_eVishnu::BatchManager_eVishnu(const FactBatchManager * parent,
-                                             const char * host,
-                                             const char * username,
-                                             CommunicationProtocolType protocolType,
-                                             const char * mpiImpl)
-    : // Force SH protocol for Vishnu
-      BatchManager(parent, host, username, SH, mpiImpl)
-  {
-  }
-
-  BatchManager_eVishnu::~BatchManager_eVishnu()
-  {
-  }
-
-  // Method to submit a job to the batch manager
-  const JobId BatchManager_eVishnu::submitJob(const Job & job)
-  {
-    // export input files on cluster
-    exportInputFiles(job);
-
-    // build command file to submit the job
-    string cmdFile = buildCommandFile(job);
-
-    // define extra parameters (that can not be defined in the command file)
-    Parametre params = job.getParametre();
-    ostringstream extraParams;
-    if (params.find(NBPROC) != params.end())
-      extraParams << "-P " << params[NBPROC] << " ";
-    if (params.find(MAXRAMSIZE) != params.end())
-      extraParams << "-m " << params[MAXRAMSIZE] << " ";
-
-    // define command to submit batch
-    string subCommand = string("export OMNIORB_CONFIG=$VISHNU_CONFIG_FILE; ");
-    subCommand += "vishnu_connect && ";
-    subCommand += "vishnu_submit_job " + extraParams.str() + _hostname + " " + cmdFile + " && ";
-    subCommand += "vishnu_close";
-    string command = _protocol.getExecCommand(subCommand, _hostname, _username);
-    command += " 2>&1";
-    cerr << command.c_str() << endl;
-
-    // submit job
-    string output;
-    int status = Utils::getCommandOutput(command, output);
-    cout << output;
-    if (status != 0) throw RunTimeException("Can't submit job, error was: " + output);
-
-    // find id of submitted job in output
-    string search = "Job Id     : ";
-    string::size_type pos = output.find(search);
-    if (pos == string::npos)
-      throw RunTimeException("Error in the submission of the job on the remote host");
-    pos += search.size();
-    string::size_type endl_pos = output.find('\n', pos);
-    string::size_type count = (endl_pos == string::npos)? string::npos : endl_pos - pos;
-    string jobref = output.substr(pos, count);
-    if (jobref.size() == 0)
-      throw RunTimeException("Error in the submission of the job on the remote host");
-
-    JobId id(this, jobref);
-    return id;
-  }
-
-
-  void BatchManager_eVishnu::exportInputFiles(const Job& job)
-  {
-    Parametre params = job.getParametre();
-    string subCommand = string("export OMNIORB_CONFIG=$VISHNU_CONFIG_FILE; ");
-    subCommand += "vishnu_connect && ";
-
-    // create remote directories
-    subCommand += "vishnu_create_dir -p " + _hostname + ":" + params[WORKDIR].str() + "/logs && ";
-
-    // copy executable
-    string executeFile = params[EXECUTABLE];
-    if (executeFile.size() != 0) {
-      subCommand += "vishnu_copy_file " + executeFile + " " +
-                    _hostname + ":" + params[WORKDIR].str() + "/ && ";
-    }
-
-    // copy filesToExportList
-    const Versatile & V = params[INFILE];
-    Versatile::const_iterator Vit;
-    for (Vit=V.begin(); Vit!=V.end(); Vit++) {
-      CoupleType cpt  = *static_cast< CoupleType * >(*Vit);
-      Couple inputFile = cpt;
-
-      // Get absolute paths
-      char * buf = getcwd(NULL, 0);
-      string cwd = buf;
-      free(buf);
-
-      string absremote = (Utils::isAbsolutePath(inputFile.getRemote()))?
-                         inputFile.getRemote() :
-                         params[WORKDIR].str() + "/" + inputFile.getRemote();
-      string abslocal = (Utils::isAbsolutePath(inputFile.getLocal()))?
-                        inputFile.getLocal() :
-                        cwd + "/" + inputFile.getLocal();
-
-      if (Vit != V.begin())
-        subCommand += " && ";
-      subCommand += "vishnu_copy_file " + abslocal + " " + _hostname + ":" + absremote;
-    }
-    subCommand += " && vishnu_close";
-
-    // Execute command
-    string command = _protocol.getExecCommand(subCommand, _hostname, _username);
-    command += " 2>&1";
-    cerr << command.c_str() << endl;
-    string output;
-    int status = Utils::getCommandOutput(command, output);
-    cout << output;
-    if (status != 0)
-      throw RunTimeException("Can't copy input files, error was: " + output);
-  }
-
-  /**
-   * Create Vishnu command file and copy it on the server.
-   * Return the name of the remote file.
-   */
-  string BatchManager_eVishnu::buildCommandFile(const Job & job)
-  {
-    Parametre params = job.getParametre();
-
-    // Job Parameters
-    string workDir = "";
-    string fileToExecute = "";
-    string queue = "";
-
-    // Mandatory parameters
-    if (params.find(WORKDIR) != params.end()) 
-      workDir = params[WORKDIR].str();
-    else 
-      throw RunTimeException("params[WORKDIR] is not defined. Please define it, cannot submit this job.");
-    if (params.find(EXECUTABLE) != params.end()) 
-      fileToExecute = params[EXECUTABLE].str();
-    else 
-      throw RunTimeException("params[EXECUTABLE] is not defined. Please define it, cannot submit this job.");
-
-    string::size_type p1 = fileToExecute.find_last_of("/");
-    string::size_type p2 = fileToExecute.find_last_of(".");
-    string rootNameToExecute = fileToExecute.substr(p1+1,p2-p1-1);
-    string fileNameToExecute = fileToExecute.substr(p1+1);
-
-    // Create batch submit file
-    ofstream tempOutputFile;
-    string tmpFileName = Utils::createAndOpenTemporaryFile("vishnu-script", tempOutputFile);
-
-    tempOutputFile << "#!/bin/sh" << endl;
-    tempOutputFile << "#% vishnu_output=" << workDir << "/logs/output.log." << rootNameToExecute << endl;
-    tempOutputFile << "#% vishnu_error=" << workDir << "/logs/error.log." << rootNameToExecute << endl;
-
-    if (params.find(NAME) != params.end())
-      tempOutputFile << "#% vishnu_job_name=\"" << params[NAME] << "\"" << endl;
-
-    // Optional parameters
-    if (params.find(MAXWALLTIME) != params.end()) {
-      long totalMinutes = params[MAXWALLTIME];
-      long h = totalMinutes / 60;
-      long m = totalMinutes - h * 60;
-      tempOutputFile << "#% vishnu_wallclocklimit=" << h << ":";
-      if (m < 10)
-        tempOutputFile << "0";
-      tempOutputFile << m << ":00" << endl;
-    }
-    if (params.find(QUEUE) != params.end())
-      tempOutputFile << "#% vishnu_queue=" << params[QUEUE] << endl;
-
-    // Define environment for the job
-    Environnement env = job.getEnvironnement();
-    for (Environnement::const_iterator iter = env.begin() ; iter != env.end() ; ++iter) {
-      tempOutputFile << "export " << iter->first << "=" << iter->second << endl;
-    }
-
-    // Node file
-    tempOutputFile << "export LIBBATCH_NODEFILE=$VISHNU_BATCHJOB_NODEFILE" << endl;
-
-    // Launch the executable
-    tempOutputFile << "cd " << workDir << endl;
-    tempOutputFile << "./" + fileNameToExecute << endl;
-
-    tempOutputFile.flush();
-    tempOutputFile.close();
-
-    cerr << "Batch script file generated is: " << tmpFileName << endl;
-    return tmpFileName;
-  }
-
-  void BatchManager_eVishnu::deleteJob(const JobId & jobid)
-  {
-    // define command to delete job
-    string subCommand = string("export OMNIORB_CONFIG=$VISHNU_CONFIG_FILE; ");
-    subCommand += "vishnu_connect && ";
-    subCommand += "vishnu_cancel_job " + _hostname + " " + jobid.getReference() + " && ";
-    subCommand += "vishnu_close";
-    string command = _protocol.getExecCommand(subCommand, _hostname, _username);
-    cerr << command.c_str() << endl;
-
-    int status = system(command.c_str());
-    if (status)
-      throw RunTimeException("Can't delete job " + jobid.getReference());
-
-    cerr << "job " << jobid.getReference() << " killed" << endl;
-  }
-
-  void BatchManager_eVishnu::holdJob(const JobId & jobid)
-  {
-    throw NotYetImplementedException("BatchManager_eVishnu::holdJob");
-  }
-
-  void BatchManager_eVishnu::releaseJob(const JobId & jobid)
-  {
-    throw NotYetImplementedException("BatchManager_eVishnu::releaseJob");
-  }
-
-  void BatchManager_eVishnu::alterJob(const JobId & jobid, const Parametre & param, const Environnement & env)
-  {
-    throw NotYetImplementedException("BatchManager_eVishnu::alterJob");
-  }
-
-  void BatchManager_eVishnu::alterJob(const JobId & jobid, const Parametre & param)
-  {
-    throw NotYetImplementedException("BatchManager_eVishnu::alterJob");
-  }
-
-  void BatchManager_eVishnu::alterJob(const JobId & jobid, const Environnement & env)
-  {
-    throw NotYetImplementedException("BatchManager_eVishnu::alterJob");
-  }
-
-  JobInfo BatchManager_eVishnu::queryJob(const JobId & jobid)
-  {
-    // define command to query batch
-    string subCommand = string("export OMNIORB_CONFIG=$VISHNU_CONFIG_FILE; ");
-    subCommand += "vishnu_connect && ";
-    subCommand += "vishnu_get_job_info " + _hostname + " " + jobid.getReference() + " && ";
-    subCommand += "vishnu_close";
-    string command = _protocol.getExecCommand(subCommand, _hostname, _username);
-    cerr << command.c_str() << endl;
-
-    string output;
-    int status = Utils::getCommandOutput(command, output);
-    if (status != 0)
-      throw RunTimeException("Can't query job " + jobid.getReference());
-    JobInfo_eVishnu jobinfo = JobInfo_eVishnu(jobid.getReference(), output);
-    return jobinfo;
-  }
-
-  const JobId BatchManager_eVishnu::addJob(const Job & job, const string reference)
-  {
-    return JobId(this, reference);
-  }
-
-  void BatchManager_eVishnu::importOutputFiles(const Job & job, const std::string directory)
-  {
-    // Create local result directory
-    char * buf = getcwd(NULL, 0);
-    string cwd = buf;
-    free(buf);
-    string absdir = (Utils::isAbsolutePath(directory))? directory : cwd + "/" + directory;
-    int status = CommunicationProtocol::getInstance(SH).makeDirectory(absdir, "", "");
-    if (status != 0) {
-      throw RunTimeException("Can't create result directory");
-    }
-
-    string subCommand = string("export OMNIORB_CONFIG=$VISHNU_CONFIG_FILE; ");
-    subCommand += "vishnu_connect && ";
-
-    // Copy output files
-    Parametre params = job.getParametre();
-    const Versatile & V = params[OUTFILE];
-    Versatile::const_iterator Vit;
-    for (Vit=V.begin(); Vit!=V.end(); Vit++) {
-      CoupleType cpt  = *static_cast< CoupleType * >(*Vit);
-      Couple outputFile = cpt;
-
-      // Get absolute paths
-      string absremote = (Utils::isAbsolutePath(outputFile.getRemote()))?
-                         outputFile.getRemote() :
-                         params[WORKDIR].str() + "/" + outputFile.getRemote();
-      string abslocal = (Utils::isAbsolutePath(outputFile.getLocal()))?
-                        outputFile.getLocal() :
-                        absdir + "/" + outputFile.getLocal();
-
-      subCommand += "vishnu_copy_file " + _hostname + ":" + absremote + " " + abslocal + " && ";
-    }
-
-    // Copy logs
-    subCommand += "vishnu_copy_file -r " +_hostname + ":" + params[WORKDIR].str() + "/logs" + " " + absdir + " && ";
-    subCommand += "vishnu_close";
-
-    // Execute command
-    string command = _protocol.getExecCommand(subCommand, _hostname, _username);
-    command += " 2>&1";
-    cerr << command.c_str() << endl;
-    string output;
-    status = Utils::getCommandOutput(command, output);
-    cout << output;
-    if (status != 0)
-      throw RunTimeException("Can't import output files, error was: " + output);
-  }
-
-}
diff --git a/src/Vishnu/Batch_BatchManager_eVishnu.hxx b/src/Vishnu/Batch_BatchManager_eVishnu.hxx
deleted file mode 100644 (file)
index 5674e5b..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- *  Batch_BatchManager_eVishnu.hxx :
- *
- *  Created on: 24 june 2011
- *  Author : Renaud BARATE - EDF R&D
- */
-
-#ifndef _BATCHMANAGER_EVISHNU_H_
-#define _BATCHMANAGER_EVISHNU_H_
-
-#include <string>
-
-#include <Batch_Defines.hxx>
-#include <Batch_JobId.hxx>
-#include <Batch_JobInfo.hxx>
-#include <Batch_FactBatchManager.hxx>
-#include <Batch_BatchManager.hxx>
-
-namespace Batch {
-
-  class BATCH_EXPORT BatchManager_eVishnu : public BatchManager
-  {
-  public:
-
-    BatchManager_eVishnu(const FactBatchManager * parent,
-                         const char * host = "localhost",
-                         const char * username = "",
-                         CommunicationProtocolType protocolType = SSH,
-                         const char * mpiImpl = "nompi");
-    virtual ~BatchManager_eVishnu();
-
-    // Methods to control jobs
-    virtual const JobId submitJob(const Job & job);
-    virtual void deleteJob(const JobId & jobid);
-    virtual void holdJob(const JobId & jobid);
-    virtual void releaseJob(const JobId & jobid);
-    virtual void alterJob(const JobId & jobid, const Parametre & param, const Environnement & env);
-    virtual void alterJob(const JobId & jobid, const Parametre & param);
-    virtual void alterJob(const JobId & jobid, const Environnement & env);
-    virtual JobInfo queryJob(const JobId & jobid);
-    virtual const JobId addJob(const Job & job, const std::string reference);
-    virtual void importOutputFiles(const Job & job, const std::string directory);
-
-  protected:
-
-    std::string buildCommandFile(const Job & job);
-    void exportInputFiles(const Job & job);
-
-  };
-
-}
-
-#endif
diff --git a/src/Vishnu/Batch_FactBatchManager_eVishnu.cxx b/src/Vishnu/Batch_FactBatchManager_eVishnu.cxx
deleted file mode 100644 (file)
index 932e383..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- *  Batch_FactBatchManager_eVishnu.cxx :
- *
- *  Created on: 24 june 2011
- *  Author : Renaud BARATE - EDF R&D
- */
-
-#include <Batch_ParameterTypeMap.hxx>
-
-#include "Batch_BatchManager_eVishnu.hxx"
-#include "Batch_FactBatchManager_eVishnu.hxx"
-
-namespace Batch {
-
-  static FactBatchManager_eVishnu sFBM_eVishnu;
-
-  FactBatchManager_eVishnu::FactBatchManager_eVishnu() : FactBatchManager("VISHNU")
-  {
-  }
-
-  FactBatchManager_eVishnu::~FactBatchManager_eVishnu()
-  {
-  }
-
-  BatchManager * FactBatchManager_eVishnu::operator() (const char * hostname,
-                                                       const char * username,
-                                                       CommunicationProtocolType protocolType,
-                                                       const char * mpiImpl) const
-  {
-    // MESSAGE("Building new BatchManager_eVishnu on host '" << hostname << "'");
-    return new BatchManager_eVishnu(this, hostname, username, protocolType, mpiImpl);
-  }
-
-}
diff --git a/src/Vishnu/Batch_FactBatchManager_eVishnu.hxx b/src/Vishnu/Batch_FactBatchManager_eVishnu.hxx
deleted file mode 100644 (file)
index 20b9bfe..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- *  Batch_FactBatchManager_eVishnu.hxx :
- *
- *  Created on: 24 june 2011
- *  Author : Renaud BARATE - EDF R&D
- */
-
-#ifndef _FACTBATCHMANAGER_EVISHNU_H_
-#define _FACTBATCHMANAGER_EVISHNU_H_
-
-#include <Batch_Defines.hxx>
-#include <Batch_Constants.hxx>
-#include <Batch_BatchManager.hxx>
-#include <Batch_FactBatchManager.hxx>
-
-namespace Batch {
-
-  class BATCH_EXPORT FactBatchManager_eVishnu : public FactBatchManager
-  {
-  public:
-
-    FactBatchManager_eVishnu();
-    virtual ~FactBatchManager_eVishnu();
-
-    virtual BatchManager * operator() (const char * hostname,
-                                       const char * username,
-                                       CommunicationProtocolType protocolType,
-                                       const char * mpiImpl) const;
-
-  };
-
-}
-
-#endif
diff --git a/src/Vishnu/Batch_JobInfo_eVishnu.cxx b/src/Vishnu/Batch_JobInfo_eVishnu.cxx
deleted file mode 100644 (file)
index d4b89d4..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- *  Batch_JobInfo_eVishnu.cxx :
- *
- *  Created on: 24 june 2011
- *  Author : Renaud BARATE - EDF R&D
- */
-
-#include <iostream>
-#include <sstream>
-
-#include <Batch_RunTimeException.hxx>
-#include <Batch_Constants.hxx>
-
-#include "Batch_JobInfo_eVishnu.hxx"
-
-using namespace std;
-
-namespace Batch {
-
-  JobInfo_eVishnu::JobInfo_eVishnu(const string & id, const string & queryOutput)
-    : JobInfo()
-  {
-    _param[ID] = id;
-
-    // find the status in the query output
-    istringstream iss(queryOutput);
-    string status;
-    bool statusFound = false;
-    while (!statusFound && !iss.eof()) {
-      string line;
-      getline(iss, line);
-      size_t pos = line.find(':');
-      if (pos != string::npos) {
-        string begline = line.substr(0, pos);
-        string keyword;
-        // Trim leading and trailing spaces of the string before ':'
-        size_t startpos = begline.find_first_not_of(" \t");
-        size_t endpos = begline.find_last_not_of(" \t");
-        if (startpos != string::npos && endpos != string::npos)
-          keyword = begline.substr(startpos, endpos-startpos+1);
-
-        if (keyword == "Status") {
-          statusFound = true;
-          string endline = line.substr(pos + 1);
-          startpos = endline.find_first_not_of(" \t");
-          endpos = endline.find_last_not_of(" \t");
-          if (startpos != string::npos && endpos != string::npos)
-            status = endline.substr(startpos, endpos-startpos+1);
-        }
-      }
-    }
-
-    if (status.size() == 0) {
-      // On some batch managers, the job is deleted as soon as it is finished,
-      // so we have to consider that an unknown job is a finished one, even if
-      // it is not always true.
-      _param[STATE] = FINISHED;
-    } else if (status == "QUEUED") {
-      _param[STATE] = QUEUED;
-    } else if (status == "WAITING") {
-      _param[STATE] = QUEUED;
-    } else if (status == "RUNNING") {
-      _param[STATE] = RUNNING;
-    } else if (status == "TERMINATED") {
-      _param[STATE] = FINISHED;
-    } else if (status == "CANCELLED") {
-      _param[STATE] = FAILED;
-    } else {
-      throw RunTimeException("Unknown job state code: \"" + status + "\"");
-    }
-  }
-
-  JobInfo_eVishnu::~JobInfo_eVishnu()
-  {
-  }
-
-}
diff --git a/src/Vishnu/Batch_JobInfo_eVishnu.hxx b/src/Vishnu/Batch_JobInfo_eVishnu.hxx
deleted file mode 100644 (file)
index 5341495..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
-//
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-/*
- *  Batch_JobInfo_eVishnu.hxx :
- *
- *  Created on: 24 june 2011
- *  Author : Renaud BARATE - EDF R&D
- */
-
-#ifndef _JOBINFO_EVISHNU_H_
-#define _JOBINFO_EVISHNU_H_
-
-#include <string>
-
-#include <Batch_JobInfo.hxx>
-
-namespace Batch {
-
-  class JobInfo_eVishnu : public JobInfo
-  {
-  public:
-
-    JobInfo_eVishnu(const std::string & id, const std::string & queryOutput);
-    virtual ~JobInfo_eVishnu();
-
-  };
-
-}
-
-#endif
index 1a0d084b84bec9dff5065ae73e241b64919f8cd3..a1fec35b21dfa6acfb86023139dd1daac1981615 100644 (file)
@@ -20,9 +20,9 @@
 #  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-SET(CLASS_LIST Vishnu/Batch_BatchManager_eVishnu
-               Vishnu/Batch_FactBatchManager_eVishnu
-               Vishnu/Batch_JobInfo_eVishnu
+SET(CLASS_LIST Vishnu/BatchManager_Vishnu
+               Vishnu/FactBatchManager_Vishnu
+               Vishnu/JobInfo_Vishnu
    )
 
 APPEND_CLASSES_TO_SRC_FILES(${CLASS_LIST})
diff --git a/src/Vishnu/FactBatchManager_Vishnu.cxx b/src/Vishnu/FactBatchManager_Vishnu.cxx
new file mode 100644 (file)
index 0000000..53361b3
--- /dev/null
@@ -0,0 +1,55 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ *  FactBatchManager_Vishnu.cxx :
+ *
+ *  Created on: 24 june 2011
+ *  Author : Renaud BARATE - EDF R&D
+ */
+
+#include <ParameterTypeMap.hxx>
+
+#include "BatchManager_Vishnu.hxx"
+#include "FactBatchManager_Vishnu.hxx"
+
+namespace Batch {
+
+  static FactBatchManager_Vishnu sFBM_Vishnu;
+
+  FactBatchManager_Vishnu::FactBatchManager_Vishnu() : FactBatchManager("VISHNU")
+  {
+  }
+
+  FactBatchManager_Vishnu::~FactBatchManager_Vishnu()
+  {
+  }
+
+  BatchManager * FactBatchManager_Vishnu::operator() (const char * hostname,
+                                                       const char * username,
+                                                       CommunicationProtocolType protocolType,
+                                                       const char * mpiImpl) const
+  {
+    // MESSAGE("Building new BatchManager_Vishnu on host '" << hostname << "'");
+    return new BatchManager_Vishnu(this, hostname, username, protocolType, mpiImpl);
+  }
+
+}
diff --git a/src/Vishnu/FactBatchManager_Vishnu.hxx b/src/Vishnu/FactBatchManager_Vishnu.hxx
new file mode 100644 (file)
index 0000000..bc04ec2
--- /dev/null
@@ -0,0 +1,55 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ *  FactBatchManager_Vishnu.hxx :
+ *
+ *  Created on: 24 june 2011
+ *  Author : Renaud BARATE - EDF R&D
+ */
+
+#ifndef _FACTBATCHMANAGER_EVISHNU_H_
+#define _FACTBATCHMANAGER_EVISHNU_H_
+
+#include <Defines.hxx>
+#include <Constants.hxx>
+#include <BatchManager.hxx>
+#include <FactBatchManager.hxx>
+
+namespace Batch {
+
+  class BATCH_EXPORT FactBatchManager_Vishnu : public FactBatchManager
+  {
+  public:
+
+    FactBatchManager_Vishnu();
+    virtual ~FactBatchManager_Vishnu();
+
+    virtual BatchManager * operator() (const char * hostname,
+                                       const char * username,
+                                       CommunicationProtocolType protocolType,
+                                       const char * mpiImpl) const;
+
+  };
+
+}
+
+#endif
diff --git a/src/Vishnu/JobInfo_Vishnu.cxx b/src/Vishnu/JobInfo_Vishnu.cxx
new file mode 100644 (file)
index 0000000..68a32b6
--- /dev/null
@@ -0,0 +1,98 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ *  JobInfo_Vishnu.cxx :
+ *
+ *  Created on: 24 june 2011
+ *  Author : Renaud BARATE - EDF R&D
+ */
+
+#include <iostream>
+#include <sstream>
+
+#include <RunTimeException.hxx>
+#include <Constants.hxx>
+
+#include "JobInfo_Vishnu.hxx"
+
+using namespace std;
+
+namespace Batch {
+
+  JobInfo_Vishnu::JobInfo_Vishnu(const string & id, const string & queryOutput)
+    : JobInfo()
+  {
+    _param[ID] = id;
+
+    // find the status in the query output
+    istringstream iss(queryOutput);
+    string status;
+    bool statusFound = false;
+    while (!statusFound && !iss.eof()) {
+      string line;
+      getline(iss, line);
+      size_t pos = line.find(':');
+      if (pos != string::npos) {
+        string begline = line.substr(0, pos);
+        string keyword;
+        // Trim leading and trailing spaces of the string before ':'
+        size_t startpos = begline.find_first_not_of(" \t");
+        size_t endpos = begline.find_last_not_of(" \t");
+        if (startpos != string::npos && endpos != string::npos)
+          keyword = begline.substr(startpos, endpos-startpos+1);
+
+        if (keyword == "Status") {
+          statusFound = true;
+          string endline = line.substr(pos + 1);
+          startpos = endline.find_first_not_of(" \t");
+          endpos = endline.find_last_not_of(" \t");
+          if (startpos != string::npos && endpos != string::npos)
+            status = endline.substr(startpos, endpos-startpos+1);
+        }
+      }
+    }
+
+    if (status.size() == 0) {
+      // On some batch managers, the job is deleted as soon as it is finished,
+      // so we have to consider that an unknown job is a finished one, even if
+      // it is not always true.
+      _param[STATE] = FINISHED;
+    } else if (status == "QUEUED") {
+      _param[STATE] = QUEUED;
+    } else if (status == "WAITING") {
+      _param[STATE] = QUEUED;
+    } else if (status == "RUNNING") {
+      _param[STATE] = RUNNING;
+    } else if (status == "TERMINATED") {
+      _param[STATE] = FINISHED;
+    } else if (status == "CANCELLED") {
+      _param[STATE] = FAILED;
+    } else {
+      throw RunTimeException("Unknown job state code: \"" + status + "\"");
+    }
+  }
+
+  JobInfo_Vishnu::~JobInfo_Vishnu()
+  {
+  }
+
+}
diff --git a/src/Vishnu/JobInfo_Vishnu.hxx b/src/Vishnu/JobInfo_Vishnu.hxx
new file mode 100644 (file)
index 0000000..db124e3
--- /dev/null
@@ -0,0 +1,49 @@
+//  Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of the GNU Lesser General Public
+//  License as published by the Free Software Foundation; either
+//  version 2.1 of the License.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+/*
+ *  JobInfo_Vishnu.hxx :
+ *
+ *  Created on: 24 june 2011
+ *  Author : Renaud BARATE - EDF R&D
+ */
+
+#ifndef _JOBINFO_EVISHNU_H_
+#define _JOBINFO_EVISHNU_H_
+
+#include <string>
+
+#include <JobInfo.hxx>
+
+namespace Batch {
+
+  class JobInfo_Vishnu : public JobInfo
+  {
+  public:
+
+    JobInfo_Vishnu(const std::string & id, const std::string & queryOutput);
+    virtual ~JobInfo_Vishnu();
+
+  };
+
+}
+
+#endif