]> SALOME platform Git repositories - modules/jobmanager.git/commitdiff
Salome HOME
Merge from V6_main_20120808 08Aug12
authorvsr <vsr@opencascade.com>
Thu, 9 Aug 2012 12:49:01 +0000 (12:49 +0000)
committervsr <vsr@opencascade.com>
Thu, 9 Aug 2012 12:49:01 +0000 (12:49 +0000)
99 files changed:
Makefile.am
build_cmake [new file with mode: 0755]
build_cmake.bat [new file with mode: 0644]
build_configure
clean_configure [new file with mode: 0755]
configure.ac
doc/Makefile.am [new file with mode: 0644]
doc/_static/basic.css [new file with mode: 0644]
doc/_static/default.css [new file with mode: 0644]
doc/advanced.rst [new file with mode: 0644]
doc/conf.py.in [new file with mode: 0644]
doc/images/jobmanager_job_focus.png [new file with mode: 0644]
doc/images/jobmanager_job_workflow_1.png [new file with mode: 0644]
doc/images/jobmanager_job_workflow_2.png [new file with mode: 0644]
doc/images/jobmanager_job_workflow_3.png [new file with mode: 0644]
doc/images/jobmanager_job_workflow_4.png [new file with mode: 0644]
doc/images/jobmanager_job_workflow_5.png [new file with mode: 0644]
doc/images/jobmanager_job_workflow_6.png [new file with mode: 0644]
doc/images/jobmanager_load_save_buttons.png [new file with mode: 0644]
doc/images/jobmanager_main_buttons.png [new file with mode: 0644]
doc/images/jobmanager_overview.png [new file with mode: 0644]
doc/images/jobmanager_overview_part.png [new file with mode: 0644]
doc/images/jobmanager_resource_1.png [new file with mode: 0644]
doc/images/jobmanager_resource_2.png [new file with mode: 0644]
doc/index.rst [new file with mode: 0644]
doc/intro.rst [new file with mode: 0644]
doc/job.rst [new file with mode: 0644]
doc/jobmanager_gui.rst [new file with mode: 0644]
doc/resource.rst [new file with mode: 0644]
idl/JOBMANAGER_IDL.idl [new file with mode: 0644]
idl/Makefile.am [new file with mode: 0644]
m4/ac_cxx_option.m4
m4/ac_linker_options.m4
m4/acx_pthread.m4 [new file with mode: 0644]
m4/check_boost.m4 [new file with mode: 0644]
m4/check_omniorb.m4
m4/check_salome.m4
m4/check_sphinx.m4
m4/enable_pthreads.m4 [new file with mode: 0644]
m4/i2_check_qt4.m4
m4/production.m4
src/Makefile.am
src/bases/BL_Exception.cxx
src/bases/BL_Exception.hxx
src/bases/BL_Traces.hxx
src/bases/Makefile.am
src/bases/make_begin.am
src/engine/BL_Engine.hxx [new file with mode: 0755]
src/engine/BL_Job.cxx
src/engine/BL_Job.hxx
src/engine/BL_JobsManager.cxx
src/engine/BL_JobsManager.hxx
src/engine/BL_Observer.hxx [new file with mode: 0644]
src/engine/BL_SALOMEServices.cxx
src/engine/BL_SALOMEServices.hxx
src/engine/Makefile.am [new file with mode: 0644]
src/genericgui/BL_Buttons.cxx
src/genericgui/BL_Buttons.hxx
src/genericgui/BL_CreateJobWizard.cxx
src/genericgui/BL_CreateJobWizard.hxx
src/genericgui/BL_GenericGui.cxx
src/genericgui/BL_GenericGui.hxx
src/genericgui/BL_GenericGuiDefines.hxx [new file with mode: 0755]
src/genericgui/BL_JobTab.cxx
src/genericgui/BL_JobTab.hxx
src/genericgui/BL_JobsManager_QT.cxx
src/genericgui/BL_JobsManager_QT.hxx
src/genericgui/BL_JobsTable.cxx
src/genericgui/BL_JobsTable.hxx
src/genericgui/BL_MachineCatalog.cxx [deleted file]
src/genericgui/BL_MachineCatalog.hxx [deleted file]
src/genericgui/BL_MainButtons.cxx [deleted file]
src/genericgui/BL_MainButtons.hxx [deleted file]
src/genericgui/BL_QModelManager.cxx
src/genericgui/BL_QModelManager.hxx
src/genericgui/BL_Summary.cxx
src/genericgui/BL_Summary.hxx
src/genericgui/JM_EditSalomeResource.cxx [new file with mode: 0644]
src/genericgui/JM_EditSalomeResource.hxx [new file with mode: 0644]
src/genericgui/JM_ResourceCatalog.cxx [new file with mode: 0644]
src/genericgui/JM_ResourceCatalog.hxx [new file with mode: 0644]
src/genericgui/JM_SalomeResource.cxx [new file with mode: 0644]
src/genericgui/JM_SalomeResource.hxx [new file with mode: 0644]
src/genericgui/Makefile.am
src/salomegui/BL_SalomeGui.cxx
src/salomegui/BL_SalomeGui.hxx
src/salomegui/JOBMANAGER_version.h.in [new file with mode: 0644]
src/salomegui/Makefile.am
src/salomegui/resources/SalomeApp.xml [deleted file]
src/salomegui/resources/SalomeApp.xml.in [new file with mode: 0644]
src/standalone/Makefile.am
src/standalone/main.cxx
src/standalone/start_jobmanager.sh.in
src/wrappers/BL_MainWindows_Qt.cxx
src/wrappers/BL_MainWindows_Qt.hxx
src/wrappers/BL_MainWindows_SALOME.cxx
src/wrappers/BL_MainWindows_SALOME.hxx
src/wrappers/BL_MainWindows_Wrap.hxx
src/wrappers/Makefile.am

index f8238b2370ae0a82a37bb0d8fc82e579bd9f2811..77eedc3ee4bc4872ff9c7be9aeecd09ba04ce55b 100644 (file)
@@ -1,3 +1,24 @@
+# Copyright (C) 2009-2012  CEA/DEN, EDF R&D
+#
+# 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
+#
+
 ACLOCAL_AMFLAGS = -I m4
 
-SUBDIRS = src
+SUBDIRS = idl src doc
+
+EXTRA_DIST = build_configure clean_configure
diff --git a/build_cmake b/build_cmake
new file mode 100755 (executable)
index 0000000..a81bdd4
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/sh
+# Copyright (C) 2009-2012  CEA/DEN, EDF R&D
+#
+# 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
+#
+
+CURRENT_DIR=`pwd`
+CONF_DIR=`echo $0 | sed -e "s,[^/]*$,,;s,/$,,;s,^$,.,"`
+cd ${CONF_DIR}
+python $KERNEL_ROOT_DIR/salome_adm/cmake_files/am2cmake.py --jobmanager
+status=$?
+cd ${CURRENT_DIR}
+exit $status
diff --git a/build_cmake.bat b/build_cmake.bat
new file mode 100644 (file)
index 0000000..b669ddb
--- /dev/null
@@ -0,0 +1,20 @@
+@REM Copyright (C) 2009-2012  CEA/DEN, EDF R&D
+@REM
+@REM This library is free software; you can redistribute it and/or
+@REM modify it under the terms of the GNU Lesser General Public
+@REM License as published by the Free Software Foundation; either
+@REM version 2.1 of the License.
+@REM
+@REM This library is distributed in the hope that it will be useful,
+@REM but WITHOUT ANY WARRANTY; without even the implied warranty of
+@REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+@REM Lesser General Public License for more details.
+@REM
+@REM You should have received a copy of the GNU Lesser General Public
+@REM License along with this library; if not, write to the Free Software
+@REM Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+@REM
+@REM See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+@REM
+
+%PYTHONBIN% %KERNEL_ROOT_DIR%\salome_adm\cmake_files\am2cmake.py --jobmanager\r
index e3987c4c5355c9d35128c41599985d1841c307bf..0f0908e50957e15a905f07aca81f80e25e7742e6 100755 (executable)
@@ -1,21 +1,21 @@
 #! /bin/sh
-#  Copyright (C) 2009 CEA/DEN, EDF R&D
+# Copyright (C) 2009-2012  CEA/DEN, EDF R&D
 #
-#  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 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.
+# 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
+# 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
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
 ORIG_DIR=`pwd`
diff --git a/clean_configure b/clean_configure
new file mode 100755 (executable)
index 0000000..02e09a0
--- /dev/null
@@ -0,0 +1,33 @@
+#! /bin/sh
+# Copyright (C) 2009-2012  CEA/DEN, EDF R&D
+#
+# 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   : clean_configure
+# Author : Vadim SANDLER, Open CASCADE S.A.S (vadim.sandler@opencascade.com)
+# ---
+#
+rm -rf autom4te.cache aclocal.m4 configure config.guess config.sub build_configure.log install-sh ltmain.sh missing depcomp
+rm -rf jobmanager_config.h.in INSTALL
+find . -name "*~" -print -exec rm {} \;
+find . -name "*.pyc" -print -exec rm {} \;
+
+# ... 
+
+find . -name Makefile.in | xargs rm -f
index da467736bdf5d46208d98f1c44cf8b75f1d49d9a..c3640f91b36433650a4aa165684a34435ffec994 100644 (file)
@@ -1,27 +1,28 @@
-#  Copyright (C) 2009  CEA/DEN, EDF R&D
+# Copyright (C) 2009-2012  CEA/DEN, EDF R&D
 #
-#  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 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.
+# 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
+# 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
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
+
 # --
 # Author : André RIBES (EDF)
 # --
 # -----------------------------------------------------------------------------
 #
-AC_INIT([JOBMANAGER project], [0.1], [andre.ribes@edf.fr], [JobManager-Module])
+AC_INIT([JOBMANAGER project], [6.5.0], [andre.ribes@edf.fr], [JobManager-Module])
 AM_INIT_AUTOMAKE([tar-pax])
 AC_CONFIG_HEADER(jobmanager_config.h)
 
@@ -29,7 +30,9 @@ AC_CONFIG_HEADER(jobmanager_config.h)
 MODULE_NAME=jobmanager
 AC_SUBST(MODULE_NAME)
 
-XVERSION=0x001
+SHORT_VERSION=`echo $VERSION | awk -F. '{printf("%d.%d",$1,$2)}'`
+AC_SUBST(SHORT_VERSION)
+XVERSION=`echo $VERSION | awk -F. '{printf("0x%02x%02x%02x",$1,$2,$3)}'`
 AC_SUBST(XVERSION)
 
 RELEASE=$VERSION
@@ -76,6 +79,7 @@ AM_PROG_LIBTOOL
 AC_CHECK_LIB(dl,dlopen)
 I2_CHECK_QT4
 AC_CHECK_OMNIORB
+CHECK_BOOST
 
 # Optional products
 CHECK_SPHINX
@@ -98,6 +102,7 @@ echo
 echo "Mandatory products:"
 echo "  Qt4 (graphic interface)  : $qt_ok"
 echo "  OmniOrb (CORBA) ........ : $omniORB_ok"
+echo "  Boost           ........ : $boost_ok"
 echo "  SALOME KERNEL .......... : $Kernel_ok"
 echo "  SALOME GUI ............. : $SalomeGUI_ok"
 echo
@@ -122,6 +127,7 @@ fi
 
 AC_OUTPUT([ \
   Makefile \
+  idl/Makefile \
   src/Makefile \
   src/bases/Makefile \
   src/engine/Makefile \
@@ -130,4 +136,8 @@ AC_OUTPUT([ \
   src/standalone/Makefile \
   src/standalone/start_jobmanager.sh \
   src/salomegui/Makefile \
+  src/salomegui/JOBMANAGER_version.h \
+  src/salomegui/resources/SalomeApp.xml \
+  doc/Makefile \
+  doc/conf.py \
 ])
diff --git a/doc/Makefile.am b/doc/Makefile.am
new file mode 100644 (file)
index 0000000..ab44650
--- /dev/null
@@ -0,0 +1,85 @@
+# Copyright (C) 2009-2012  CEA/DEN, EDF R&D
+#
+# 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 $(top_srcdir)/src/bases/make_begin.am
+
+.PHONY : latex
+
+if SPHINX_IS_OK
+
+jobmanagerdoc_DATA=html/index.html
+html/index.html:$(RSTFILES)
+       make htm
+endif
+
+#EXTRA_DIST= html htmldev _static
+EXTRA_DIST= html html/index.html _static images
+
+jobmanagerdocdir=$(docdir)/gui/JOBMANAGER
+
+SPHINXOPTS      =
+SOURCEDIR       = $(srcdir)
+SPHINXBUILD     = sphinx-build
+PAPEROPT_a4     = -D latex_paper_size=a4
+ALLSPHINXOPTS   = -d doctrees $(PAPEROPT_a4) $(SPHINXOPTS) $(SOURCEDIR)
+
+htm:
+       mkdir -p html doctrees
+       $(SPHINXBUILD) -c $(top_builddir)/doc -b html $(ALLSPHINXOPTS) html
+       @echo
+       @echo "Build finished. The HTML pages are in html."
+
+latex:
+       mkdir -p latex doctrees
+       $(SPHINXBUILD) -c $(top_builddir)/doc -b latex $(ALLSPHINXOPTS) latex
+       @echo
+       @echo "Build finished; the LaTeX files are in latex."
+       @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
+             "run these through (pdf)latex."
+
+html:
+                mkdir -p $@
+
+#htmldev:
+#               mkdir -p $@
+
+RSTFILES=          \
+index.rst          \
+intro.rst          \
+resource.rst       \
+job.rst            \
+jobmanager_gui.rst \
+advanced.rst
+
+
+EXTRA_DIST+= $(RSTFILES)
+
+install-data-local:
+       $(INSTALL) -d $(DESTDIR)$(jobmanagerdocdir)
+       if test -d "html"; then b=; else b="$(srcdir)/"; fi; \
+       cp -rf $$b"html"/* $(DESTDIR)$(jobmanagerdocdir) ; \
+       if test -f $$b"latex"/jobmanager.pdf; then cp -f $$b"latex"/jobmanager.pdf $(DESTDIR)$(jobmanagerdocdir) ; fi;
+
+uninstall-local:
+       chmod -R +w $(DESTDIR)$(jobmanagerdocdir)
+       rm -rf $(DESTDIR)$(jobmanagerdocdir)/*
+
+clean-local:
+       -rm -rf html latex doctrees
+       if test -d "html"; then rm -rf html ; fi
diff --git a/doc/_static/basic.css b/doc/_static/basic.css
new file mode 100644 (file)
index 0000000..aeb1381
--- /dev/null
@@ -0,0 +1,433 @@
+/**
+ * Sphinx stylesheet -- basic theme
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ */
+
+/* -- main layout ----------------------------------------------------------- */
+
+div.clearer {
+    clear: both;
+}
+
+/* -- relbar ---------------------------------------------------------------- */
+
+div.related {
+    width: 100%;
+    font-size: 90%;
+}
+
+div.related h3 {
+    display: none;
+}
+
+div.related ul {
+    margin: 0;
+    padding: 0 0 0 10px;
+    list-style: none;
+}
+
+div.related li {
+    display: inline;
+}
+
+div.related li.right {
+    float: right;
+    margin-right: 5px;
+}
+
+/* -- sidebar --------------------------------------------------------------- */
+
+div.sphinxsidebarwrapper {
+    padding: 10px 5px 0 10px;
+}
+
+div.sphinxsidebar {
+    float: left;
+    width: 230px;
+    margin-left: -100%;
+    font-size: 90%;
+}
+
+div.sphinxsidebar ul {
+    list-style: none;
+}
+
+div.sphinxsidebar ul ul,
+div.sphinxsidebar ul.want-points {
+    margin-left: 20px;
+    list-style: square;
+}
+
+div.sphinxsidebar ul ul {
+    margin-top: 0;
+    margin-bottom: 0;
+}
+
+div.sphinxsidebar form {
+    margin-top: 10px;
+}
+
+div.sphinxsidebar input {
+    border: 1px solid #98dbcc;
+    font-family: sans-serif;
+    font-size: 1em;
+}
+
+img {
+    border: 0;
+}
+
+/* -- search page ----------------------------------------------------------- */
+
+ul.search {
+    margin: 10px 0 0 20px;
+    padding: 0;
+}
+
+ul.search li {
+    padding: 5px 0 5px 20px;
+    background-image: url(file.png);
+    background-repeat: no-repeat;
+    background-position: 0 7px;
+}
+
+ul.search li a {
+    font-weight: bold;
+}
+
+ul.search li div.context {
+    color: #888;
+    margin: 2px 0 0 30px;
+    text-align: left;
+}
+
+ul.keywordmatches li.goodmatch a {
+    font-weight: bold;
+}
+
+/* -- index page ------------------------------------------------------------ */
+
+table.contentstable {
+    width: 90%;
+}
+
+table.contentstable p.biglink {
+    line-height: 150%;
+}
+
+a.biglink {
+    font-size: 1.3em;
+}
+
+span.linkdescr {
+    font-style: italic;
+    padding-top: 5px;
+    font-size: 90%;
+}
+
+/* -- general index --------------------------------------------------------- */
+
+table.indextable td {
+    text-align: left;
+    vertical-align: top;
+}
+
+table.indextable dl, table.indextable dd {
+    margin-top: 0;
+    margin-bottom: 0;
+}
+
+table.indextable tr.pcap {
+    height: 10px;
+}
+
+table.indextable tr.cap {
+    margin-top: 10px;
+    background-color: #f2f2f2;
+}
+
+img.toggler {
+    margin-right: 3px;
+    margin-top: 3px;
+    cursor: pointer;
+}
+
+/* -- general body styles --------------------------------------------------- */
+
+a.headerlink {
+    visibility: hidden;
+}
+
+h1:hover > a.headerlink,
+h2:hover > a.headerlink,
+h3:hover > a.headerlink,
+h4:hover > a.headerlink,
+h5:hover > a.headerlink,
+h6:hover > a.headerlink,
+dt:hover > a.headerlink {
+    visibility: visible;
+}
+
+div.body p.caption {
+    text-align: inherit;
+}
+
+div.body td {
+    text-align: left;
+}
+
+.field-list ul {
+    padding-left: 1em;
+}
+
+.first {
+    margin-top: 0 !important;
+}
+
+p.rubric {
+    margin-top: 30px;
+    font-weight: bold;
+}
+
+/* -- sidebars -------------------------------------------------------------- */
+
+div.sidebar {
+    margin: 0 0 0.5em 1em;
+    border: 1px solid #ddb;
+    padding: 7px 7px 0 7px;
+    background-color: #ffe;
+    width: 40%;
+    float: right;
+}
+
+p.sidebar-title {
+    font-weight: bold;
+}
+
+/* -- topics ---------------------------------------------------------------- */
+
+div.topic {
+    border: 1px solid #ccc;
+    padding: 7px 7px 0 7px;
+    margin: 10px 0 10px 0;
+}
+
+p.topic-title {
+    font-size: 1.1em;
+    font-weight: bold;
+    margin-top: 10px;
+}
+
+/* -- admonitions ----------------------------------------------------------- */
+
+div.admonition {
+    margin-top: 10px;
+    margin-bottom: 10px;
+    padding: 7px;
+}
+
+div.admonition dt {
+    font-weight: bold;
+}
+
+div.admonition dl {
+    margin-bottom: 0;
+}
+
+p.admonition-title {
+    margin: 0px 10px 5px 0px;
+    font-weight: bold;
+}
+
+div.body p.centered {
+    text-align: center;
+    margin-top: 25px;
+}
+
+/* -- tables ---------------------------------------------------------------- */
+
+table.docutils {
+    border: 0 solid #dce;
+    border-collapse: collapse;
+}
+
+table.docutils td, table.docutils th {
+    padding: 2px 5px 2px 5px;
+    border-left: 0;    
+    background-color: #eef;    
+}
+
+table.field-list td, table.field-list th {
+    border: 0 !important;
+}
+
+table.footnote td, table.footnote th {
+    border: 0 !important;
+}
+
+table.docutils th {
+    border-top: 1px solid #cac;    
+    background-color: #ede;
+}
+
+th {
+    text-align: left;
+    padding-right: 5px;
+}
+
+th.head {
+    text-align: center;    
+}
+
+/* -- other body styles ----------------------------------------------------- */
+
+dl {
+    margin-bottom: 15px;
+}
+
+dd p {
+    margin-top: 0px;
+}
+
+dd ul, dd table {
+    margin-bottom: 10px;
+}
+
+dd {
+    margin-top: 3px;
+    margin-bottom: 10px;
+    margin-left: 30px;
+}
+
+dt:target, .highlight {
+    background-color: #fbe54e;
+}
+
+dl.glossary dt {
+    font-weight: bold;
+    font-size: 1.1em;
+}
+
+.field-list ul {
+    margin: 0;
+    padding-left: 1em;
+}
+
+.field-list p {
+    margin: 0;
+}
+
+.refcount {
+    color: #060;
+}
+
+.optional {
+    font-size: 1.3em;
+}
+
+.versionmodified {
+    font-style: italic;
+}
+
+p.deprecated {
+    background-color: #ffe4e4;
+    border: 1px solid #f66;
+    padding: 7px
+}
+
+.system-message {
+    background-color: #fda;
+    padding: 5px;
+    border: 3px solid red;
+}
+
+.footnote:target  {
+    background-color: #ffa
+}
+
+.impl-detail {
+    margin-top: 10px;
+    margin-bottom: 10px;
+    padding: 7px;
+    border: 1px solid #ccc;
+}
+
+.impl-detail .compound-first {
+    margin-top: 0;
+}
+
+.impl-detail .compound-last {
+    margin-bottom: 0;
+}
+
+/* -- code displays --------------------------------------------------------- */
+
+pre {
+    overflow: auto;
+}
+
+td.linenos pre {
+    padding: 5px 0px;
+    border: 0;
+    background-color: transparent;
+    color: #aaa;
+}
+
+table.highlighttable {
+    margin-left: 0.5em;
+}
+
+table.highlighttable td {
+    padding: 0 0.5em 0 0.5em;
+}
+
+tt.descname {
+    background-color: transparent;
+    font-weight: bold;
+    font-size: 1.2em;
+}
+
+tt.descclassname {
+    background-color: transparent;
+}
+
+tt.xref, a tt {
+    background-color: transparent;
+    font-weight: bold;
+}
+
+h1 tt, h2 tt, h3 tt, h4 tt, h5 tt, h6 tt {
+    background-color: transparent;
+}
+
+/* -- math display ---------------------------------------------------------- */
+
+img.math {
+    vertical-align: middle;
+}
+
+div.body div.math p {
+    text-align: center;
+}
+
+span.eqno {
+    float: right;
+}
+
+/* -- printout stylesheet --------------------------------------------------- */
+
+@media print {
+    div.document,
+    div.documentwrapper,
+    div.bodywrapper {
+        margin: 0 !important;
+        width: 100%;
+    }
+
+    div.sphinxsidebar,
+    div.related,
+    div.footer,
+    #top-link {
+        display: none;
+    }
+}
diff --git a/doc/_static/default.css b/doc/_static/default.css
new file mode 100644 (file)
index 0000000..c999f67
--- /dev/null
@@ -0,0 +1,210 @@
+/**
+ * Sphinx stylesheet -- default theme
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ */
+
+@import url("basic.css");
+
+/* -- page layout ----------------------------------------------------------- */
+
+body {
+    font-family: sans-serif;
+    font-size: 100%;
+    background-color: #11303d;
+    color: #000;
+    margin: 0;
+    padding: 0;
+}
+
+div.document {
+    background-color: #1c4e63;
+}
+
+div.documentwrapper {
+    float: left;
+    width: 100%;
+}
+
+div.bodywrapper {
+    margin: 0 0 0 230px;
+}
+
+div.body {
+    background-color: #ffffff;
+    color: #000000;
+    padding: 0 20px 30px 20px;
+}
+
+div.footer {
+    color: #ffffff;
+    width: 100%;
+    padding: 9px 0 9px 0;
+    text-align: center;
+    font-size: 75%;
+}
+
+div.footer a {
+    color: #ffffff;
+    text-decoration: underline;
+}
+
+div.related {
+    background-color: #133f52;
+    line-height: 30px;
+    color: #ffffff;
+}
+
+div.related a {
+    color: #ffffff;
+}
+
+div.sphinxsidebar {
+}
+
+div.sphinxsidebar h3 {
+    font-family: 'Trebuchet MS', sans-serif;
+    color: #ffffff;
+    font-size: 1.4em;
+    font-weight: normal;
+    margin: 0;
+    padding: 0;
+}
+
+div.sphinxsidebar h3 a {
+    color: #ffffff;
+}
+
+div.sphinxsidebar h4 {
+    font-family: 'Trebuchet MS', sans-serif;
+    color: #ffffff;
+    font-size: 1.3em;
+    font-weight: normal;
+    margin: 5px 0 0 0;
+    padding: 0;
+}
+
+div.sphinxsidebar p {
+    color: #ffffff;
+}
+
+div.sphinxsidebar p.topless {
+    margin: 5px 10px 10px 10px;
+}
+
+div.sphinxsidebar ul {
+    margin: 10px;
+    padding: 0;
+    color: #ffffff;
+}
+
+div.sphinxsidebar a {
+    color: #98dbcc;
+}
+
+div.sphinxsidebar input {
+    border: 1px solid #98dbcc;
+    font-family: sans-serif;
+    font-size: 1em;
+}
+
+/* -- body styles ----------------------------------------------------------- */
+
+a {
+    color: #355f7c;
+    text-decoration: none;
+}
+
+a:hover {
+    text-decoration: underline;
+}
+
+div.body p, div.body dd, div.body li {
+    text-align: justify;
+    line-height: 130%;
+}
+
+div.body h1,
+div.body h2,
+div.body h3,
+div.body h4,
+div.body h5,
+div.body h6 {
+    font-family: 'Trebuchet MS', sans-serif;
+    background-color: #f2f2f2;
+    font-weight: normal;
+    color: #20435c;
+    border-bottom: 1px solid #ccc;
+    margin: 20px -20px 10px -20px;
+    padding: 3px 0 3px 10px;
+}
+
+div.body h1 { margin-top: 0; font-size: 200%; }
+div.body h2 { font-size: 160%; }
+div.body h3 { font-size: 140%; }
+div.body h4 { font-size: 120%; }
+div.body h5 { font-size: 110%; }
+div.body h6 { font-size: 100%; }
+
+a.headerlink {
+    color: #c60f0f;
+    font-size: 0.8em;
+    padding: 0 4px 0 4px;
+    text-decoration: none;
+}
+
+a.headerlink:hover {
+    background-color: #c60f0f;
+    color: white;
+}
+
+div.body p, div.body dd, div.body li {
+    text-align: justify;
+    line-height: 130%;
+}
+
+div.admonition p.admonition-title + p {
+    display: inline;
+}
+
+div.note {
+    background-color: #eee;
+    border: 1px solid #ccc;
+}
+
+div.seealso {
+    background-color: #ffc;
+    border: 1px solid #ff6;
+}
+
+div.topic {
+    background-color: #eee;
+}
+
+div.warning {
+    background-color: #ffe4e4;
+    border: 1px solid #f66;
+}
+
+p.admonition-title {
+    display: inline;
+}
+
+p.admonition-title:after {
+    content: ":";
+}
+
+pre {
+    padding: 5px;
+    background-color: #eeffcc;
+    color: #333333;
+    line-height: 120%;
+    border: 1px solid #ac9;
+    border-left: none;
+    border-right: none;
+}
+
+tt {
+    background-color: #ecf0f3;
+    padding: 0 1px 0 1px;
+    font-size: 0.95em;
+}
\ No newline at end of file
diff --git a/doc/advanced.rst b/doc/advanced.rst
new file mode 100644 (file)
index 0000000..6f87c16
--- /dev/null
@@ -0,0 +1,52 @@
+Advanced part
+=============
+
+This chapter is a melting pot of information about what the JOBMANAGER do.
+
+Logs files
+++++++++++
+
+Whatever the type of job, the JOBMANAGER provides many files for logging
+what happens during the job. These files are located in the work directory
+of the job in a directory named **logs**.
+
+For **command** type of job, one log file is created. This file contains the normal
+and error output of the job. The file name contains the type of job and the date, e.g. 
+**command_Thu_Sep_30_15_04_51_2010.log**.
+
+For **SALOME** type of job, two log files are created. The common file contains the 
+normal and error output of the SALOME services. The file name is like this:
+**salome_Wed_Feb_10_13_54_00_2010.log**. The other file depends of the type of SALOME jobs:
+
+- For **Python** type of job, the file contains all the output of the scripts. The file name is
+  like this: **python_Wed_Feb_10_13_54_00_2010.log**.
+- For **YACS** type of job, the file contains all the output of the schema. The file name is
+  like this: **yacs_Wed_Feb_10_13_54_00_2010.log**.
+
+For jobs that are launched in a batch resource like PBS or LSF, two more files are provided
+that contains the normal and error output messages of the PBS or LSF job. These files are like this:
+**error.log.runCommand_test_command_Wed_Sep__8_17_02_44_2010** and
+**output.log.runCommand_test_command_Wed_Sep__8_17_02_44_2010**
+
+How the JOBMANAGER launch the job
++++++++++++++++++++++++++++++++++
+
+For each type of job, the JOBMANAGER creates a shell that permits to launch in the resource
+the job file. It's in this file that the environment file is used. For a command job,
+the file name is like this: **runCommand_test_command_Wed_Sep__8_16_59_08_2010.sh**.
+
+If a job has to be launched in a resource with a batch manager like PBS or LSF an another
+file is created that contains batch directives. For a command job, the file name is like
+this: **runCommand_test_command_Wed_Sep__8_16_59_08_2010_Batch.sh**.
+
+
+Current limitations
++++++++++++++++++++
+
+Currently, for SALOME type of jobs, the scope of the environment file is
+restricted to the main SALOME session. Distributed containers launched in remote
+computers are not in the scope of the environment file. If you want to give an environment file to all
+your containers, use a SALOME application and copy this environment file into the **env.d**
+directory. 
+
+Currently, logs files do not contain remote containers outputs.
diff --git a/doc/conf.py.in b/doc/conf.py.in
new file mode 100644 (file)
index 0000000..053e397
--- /dev/null
@@ -0,0 +1,185 @@
+# -*- coding: utf-8 -*-
+#
+# jobmanager documentation build configuration file, created by
+# sphinx-quickstart on Fri Aug 29 09:57:25 2008.
+#
+# This file is execfile()d with the current directory set to its containing dir.
+#
+# The contents of this file are pickled, so don't put values in the namespace
+# that aren't pickleable (module imports are okay, they're removed automatically).
+#
+# All configuration values have a default; values that are commented out
+# serve to show the default.
+
+import sys, os
+
+# If your extensions are in another directory, add it here. If the directory
+# is relative to the documentation root, use os.path.abspath to make it
+# absolute, like shown here.
+#sys.path.append(os.path.abspath('.'))
+
+# General configuration
+# ---------------------
+
+# Add any Sphinx extension module names here, as strings. They can be extensions
+# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
+extensions = []
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ['_templates']
+
+# The suffix of source filenames.
+source_suffix = '.rst'
+
+# The encoding of source files.
+#source_encoding = 'utf-8'
+
+# The master toctree document.
+master_doc = 'index'
+
+# General information about the project.
+project = 'jobmanager'
+copyright = '2010-2011 CEA/DEN, EDF R&D, A. Ribes'
+
+# The version info for the project you're documenting, acts as replacement for
+# |version| and |release|, also used in various other places throughout the
+# built documents.
+#
+# The short X.Y version.
+version = '@SHORT_VERSION@'
+# The full version, including alpha/beta/rc tags.
+release = '@VERSION@'
+
+# The language for content autogenerated by Sphinx. Refer to documentation
+# for a list of supported languages.
+#language = None
+
+# There are two options for replacing |today|: either, you set today to some
+# non-false value, then it is used:
+#today = ''
+# Else, today_fmt is used as the format for a strftime call.
+#today_fmt = '%B %d, %Y'
+
+# List of documents that shouldn't be included in the build.
+#unused_docs = []
+
+# List of directories, relative to source directory, that shouldn't be searched
+# for source files.
+exclude_trees = ['.build','ref','images','CVS']
+
+# The reST default role (used for this markup: `text`) to use for all documents.
+#default_role = None
+
+# If true, '()' will be appended to :func: etc. cross-reference text.
+#add_function_parentheses = True
+
+# If true, the current module name will be prepended to all description
+# unit titles (such as .. function::).
+#add_module_names = True
+
+# If true, sectionauthor and moduleauthor directives will be shown in the
+# output. They are ignored by default.
+#show_authors = False
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = 'sphinx'
+
+
+# Options for HTML output
+# -----------------------
+
+# The theme to use for HTML and HTML Help pages.  Major themes that come with
+# Sphinx are currently 'default' and 'sphinxdoc'.
+html_theme = 'default'
+
+# The name for this set of Sphinx documents.  If None, it defaults to
+# "<project> v<release> documentation".
+#html_title = None
+
+# A shorter title for the navigation bar.  Default is the same as html_title.
+#html_short_title = None
+
+# The name of an image file (relative to this directory) to place at the top
+# of the sidebar.
+#html_logo = None
+
+# The name of an image file (within the static path) to use as favicon of the
+# docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
+# pixels large.
+#html_favicon = None
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+html_static_path = ['_static']
+
+# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
+# using the given strftime format.
+#html_last_updated_fmt = '%b %d, %Y'
+
+# If true, SmartyPants will be used to convert quotes and dashes to
+# typographically correct entities.
+#html_use_smartypants = True
+
+# Custom sidebar templates, maps document names to template names.
+#html_sidebars = {}
+
+# Additional templates that should be rendered to pages, maps page names to
+# template names.
+#html_additional_pages = {}
+
+# If false, no module index is generated.
+html_use_modindex = False
+
+# If false, no index is generated.
+#html_use_index = True
+
+# If true, the index is split into individual pages for each letter.
+#html_split_index = False
+
+# If true, the reST sources are included in the HTML build as _sources/<name>.
+#html_copy_source = True
+
+# If true, an OpenSearch description file will be output, and all pages will
+# contain a <link> tag referring to it.  The value of this option must be the
+# base URL from which the finished HTML is served.
+#html_use_opensearch = ''
+
+# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
+#html_file_suffix = ''
+
+# Output file base name for HTML help builder.
+htmlhelp_basename = 'jobmanagerdoc'
+
+
+# Options for LaTeX output
+# ------------------------
+
+# The paper size ('letter' or 'a4').
+latex_paper_size = 'a4'
+
+# The font size ('10pt', '11pt' or '12pt').
+latex_font_size = '10pt'
+
+# Grouping the document tree into LaTeX files. List of tuples
+# (source start file, target name, title, author, document class [howto/manual]).
+latex_documents = [
+  ('index', 'jobmanager.tex', 'Jobmanager User Documentation', 'A. Ribes', 'manual')
+]
+
+# The name of an image file (relative to this directory) to place at the top of
+# the title page.
+#latex_logo = None
+
+# For "manual" documents, if this is true, then toplevel headings are parts,
+# not chapters.
+#latex_use_parts = False
+
+# Additional stuff for the LaTeX preamble.
+#latex_preamble = ''
+
+# Documents to append as an appendix to all manuals.
+#latex_appendices = []
+
+# If false, no module index is generated.
+latex_use_modindex = False
diff --git a/doc/images/jobmanager_job_focus.png b/doc/images/jobmanager_job_focus.png
new file mode 100644 (file)
index 0000000..5d583d5
Binary files /dev/null and b/doc/images/jobmanager_job_focus.png differ
diff --git a/doc/images/jobmanager_job_workflow_1.png b/doc/images/jobmanager_job_workflow_1.png
new file mode 100644 (file)
index 0000000..b33e03c
Binary files /dev/null and b/doc/images/jobmanager_job_workflow_1.png differ
diff --git a/doc/images/jobmanager_job_workflow_2.png b/doc/images/jobmanager_job_workflow_2.png
new file mode 100644 (file)
index 0000000..529c2fa
Binary files /dev/null and b/doc/images/jobmanager_job_workflow_2.png differ
diff --git a/doc/images/jobmanager_job_workflow_3.png b/doc/images/jobmanager_job_workflow_3.png
new file mode 100644 (file)
index 0000000..7b25398
Binary files /dev/null and b/doc/images/jobmanager_job_workflow_3.png differ
diff --git a/doc/images/jobmanager_job_workflow_4.png b/doc/images/jobmanager_job_workflow_4.png
new file mode 100644 (file)
index 0000000..6e2e147
Binary files /dev/null and b/doc/images/jobmanager_job_workflow_4.png differ
diff --git a/doc/images/jobmanager_job_workflow_5.png b/doc/images/jobmanager_job_workflow_5.png
new file mode 100644 (file)
index 0000000..bac2e87
Binary files /dev/null and b/doc/images/jobmanager_job_workflow_5.png differ
diff --git a/doc/images/jobmanager_job_workflow_6.png b/doc/images/jobmanager_job_workflow_6.png
new file mode 100644 (file)
index 0000000..b013fe7
Binary files /dev/null and b/doc/images/jobmanager_job_workflow_6.png differ
diff --git a/doc/images/jobmanager_load_save_buttons.png b/doc/images/jobmanager_load_save_buttons.png
new file mode 100644 (file)
index 0000000..a08924f
Binary files /dev/null and b/doc/images/jobmanager_load_save_buttons.png differ
diff --git a/doc/images/jobmanager_main_buttons.png b/doc/images/jobmanager_main_buttons.png
new file mode 100644 (file)
index 0000000..e283d9d
Binary files /dev/null and b/doc/images/jobmanager_main_buttons.png differ
diff --git a/doc/images/jobmanager_overview.png b/doc/images/jobmanager_overview.png
new file mode 100644 (file)
index 0000000..24526bb
Binary files /dev/null and b/doc/images/jobmanager_overview.png differ
diff --git a/doc/images/jobmanager_overview_part.png b/doc/images/jobmanager_overview_part.png
new file mode 100644 (file)
index 0000000..b7c5930
Binary files /dev/null and b/doc/images/jobmanager_overview_part.png differ
diff --git a/doc/images/jobmanager_resource_1.png b/doc/images/jobmanager_resource_1.png
new file mode 100644 (file)
index 0000000..f60b1f7
Binary files /dev/null and b/doc/images/jobmanager_resource_1.png differ
diff --git a/doc/images/jobmanager_resource_2.png b/doc/images/jobmanager_resource_2.png
new file mode 100644 (file)
index 0000000..93de34a
Binary files /dev/null and b/doc/images/jobmanager_resource_2.png differ
diff --git a/doc/index.rst b/doc/index.rst
new file mode 100644 (file)
index 0000000..1cf7c46
--- /dev/null
@@ -0,0 +1,21 @@
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+JOBMANAGER documentation 
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+Welcome to JOBMANAGER's module documentation!
+=============================================
+
+**Contents:**
+
+.. toctree::
+   :maxdepth: 2
+
+   intro
+   job
+   jobmanager_gui
+   resource
+   advanced
+
+* :ref:`search`
+
diff --git a/doc/intro.rst b/doc/intro.rst
new file mode 100644 (file)
index 0000000..4b42133
--- /dev/null
@@ -0,0 +1,50 @@
+Introduction: What is the JOBMANAGER ?
+======================================
+
+The JOBMANAGER module allows creating, launching and following 
+calculation jobs on different types of computers. 
+
+.. figure:: images/jobmanager_overview.png
+  :scale: 75 %
+  :align: center
+
+  **Overview of the JOBMANAGER module**
+
+
+Main functionalities
+++++++++++++++++++++
+
+The JOBMANAGER module permits to define three types of jobs:
+
+- User scripts.
+- Python scripts launched in a SALOME session.
+- YACS schemas.
+
+The module handles different types of computational resources:
+
+- Interactive computers (rsh, ssh).
+- Clusters managed by batch systems like PBS, LSF or SGE.
+
+User's job list could be saved and loaded. Finally, the module provides
+an editor for managing user's SALOME resources.
+
+General description of the GUI
+++++++++++++++++++++++++++++++
+
+JOBMANAGER's GUI is divided in four parts:
+
+- Part 1 shows the user job list. It also provides many buttons
+  to manage a job (create, delete, start, ...).
+- Part 2 shows the parameters of the job selected in the list of part 1.
+  It's divided in two tabs. The first is for the general information, the second
+  is dedicated to the files.
+- Part 3 provides a text widget dedicated of SALOME messages. It provides 
+  the buttons for loading or saving the job list. It also provides an auto refresh button.
+- Part 4 is divided in two tabs. The first tab provides a summary of user's jobs status.
+  The second tab provides the SALOME resource editor.
+
+.. figure:: images/jobmanager_overview_part.png
+  :scale: 75 %
+  :align: center
+
+  **The JOBMANAGER GUI is divided in four parts**
diff --git a/doc/job.rst b/doc/job.rst
new file mode 100644 (file)
index 0000000..ecb98a8
--- /dev/null
@@ -0,0 +1,99 @@
+Main JOBMANAGER concept: Job
+============================
+
+This chapter explains the main JOBMANAGER concept: a job. 
+
+What is a job?
+++++++++++++++
+
+A job is a work that a user wants to perform on a computation resource (single computer or a cluster).
+The JOBMANAGER provides different types of job depending of what a user wants to do.
+
+There are three types of described in the table below.
+
+======================== ==============================================================================
+**Type of job**          **Description**
+======================== ==============================================================================
+**Command script**       It's a shell script containing the user's commands. This kind of job is not 
+                         related to SALOME. It could be used to launch any codes.
+**SALOME Python script** It's a Python script that will be launched into a SALOME session dedicated to 
+                         this script.
+**YACS schema**          It's a YACS schema that will be launched into a SALOME session dedicated to this
+                         schema.
+======================== ==============================================================================
+
+Job content description
++++++++++++++++++++++++
+
+All types of job share some attributes. There could be specific attributes for some types of jobs. These exceptions
+will be indicated in the future in this documentation. A job has two kinds of attributes:
+attributes that describes the job himself, and attributes that describes the computation requirements.
+
+The first table below describes the attributes of a job.
+
+======================== ================ ==============================================================================
+**Attribute**            **Mandatory**    **Description**
+======================== ================ ==============================================================================
+**Name**                 Yes              This is the name of the job. It's unique into a SALOME session.
+**Type**                 Yes              This is the type of the job. Currently, there are three types: *command*,
+                                          *python_salome* and *yacs_file*.
+**Job file**             Yes              This is the name, with the location, of the file containing the job's data.
+                                          Depending of the type it could a *shell* script, a *Python script* or
+                                          a *YACS schema*, e.g. **/home/user/work.sh**.
+**Env file**             No               An environment file could be attached to the job. It will be executed before
+                                          the job.
+**Input files**          No               A list of files or directories in the user computer that have to copied into 
+                                          the job's *work directory*.
+**Output files**         No               A list of files or directories that have to be copied from the job's resource
+                                          to the user computer into the *result directory*.
+**Work directory**       Yes              It's the directory on the job's resource where the job will be executed.
+**Result directory**     Yes              It's the directory in the user computer where the job's results have to be 
+                                          copied at the end of the job.
+======================== ================ ==============================================================================
+
+The second table below describes the attributes of computation requirements.
+
+======================== ==============================================================================
+**Attribute**            **Description**
+======================== ==============================================================================
+**Maximum duration**     It's the maximum expected duration of the job. When a batch manager is used, this
+                         time is interpreted as a **walltime** and not as a **cputime**. If maximum
+                         duration is set to 0, the time will be set to the default value of the
+                         batch queue selected.
+**Number of cpu**        It's the number of cpus/cores requested.
+**Memory**               It's the amount of memory per node expected.
+**Queue**                It's optional. It permits to choose a specific batch queue on the targeted cluster.
+                         If it is not defined, most of the batch systems will affect your job to the queue
+                         that fits with the other attributes requirements.
+======================== ==============================================================================
+
+Job's states
+++++++++++++
+
+A job could have many states in the JOBMANAGER. The table below describes the normal states.
+
+======================== ==============================================================================
+**State**                **Description**
+======================== ==============================================================================
+**Created**              The job is correctly created and could be launched.
+**In_Process**           It's a transient state between *Created* and *Queued*.
+**Queued**               The job is queued into the resource's batch manager.
+**Paused**               The job is paused. Currently the JOBMANAGER GUI does not allow to paused a 
+                         job.
+**Running**              The job is running on the resource.
+**Finished**             The job has run and it's finished.
+======================== ==============================================================================
+
+The table below describes the error states.
+
+======================== ==============================================================================
+**State**                **Description**
+======================== ==============================================================================
+**Not Created**          This state means that the job cannot be created with it's current description.
+                         It's often a problem with the selected resource.
+**Failed**               This state means that the execution of the job in the resource failed.
+**Error**                This state is used when a job is loaded and that it cannot be followed. It
+                         mainly happens when a job was launched into a *ssh* resource. If the list is
+                         saved, an error will happen when the list is loaded (*ssh* resource cannot
+                         be followed).
+======================== ==============================================================================
diff --git a/doc/jobmanager_gui.rst b/doc/jobmanager_gui.rst
new file mode 100644 (file)
index 0000000..986207e
--- /dev/null
@@ -0,0 +1,146 @@
+Using the JOBMANAGER GUI
+========================
+
+Job management with the GUI
+---------------------------
+
+This section describes the parts 1 and 2 (described in the introduction section) of the JOBMANAGER GUI 
+dedicated to the management of jobs.
+
+JOBMANAGER provides some buttons to manage the user job list (see figure :ref:`figure_jobmanager_main_buttons`).
+
+.. _figure_jobmanager_main_buttons:
+
+.. figure:: images/jobmanager_main_buttons.png
+  :align: center
+
+  **Main buttons for job management and job list**
+
+The description of each button (framed in blue in the figure) is given in the table below. 
+
+======================== ============================ ================================================================ ===================
+**Button**               **Condition of activation**  **Description**                                                  **Multi Selection**
+======================== ============================ ================================================================ ===================
+**Create**               Always activated             Launch the job wizard to create a job.                           Not matter
+**Start**                Job selected and job state   Start a job.                                                     No
+                         equals to *Created*
+**Get Results**          Job selected and job state   Get job results in the result directory.                         Yes
+                         equals to *Finish* or 
+                         *Failed*
+**Stop**                 Job selected and job state   Stop the job. If the job is registered into a remote batch       Yes
+                         equals to *Queued* or        manager, it is removed from it.
+                         *Running* or *Paused*
+**Delete**               Job selected                 Delete a job. If the job is registered into a remote batch       Yes
+                                                      manager, it is removed from it.
+**Restart**              Job selected and job state   Restart a job.                                                   No
+                         equals to *Finish* or 
+                         *Failed*
+**Edit/Clone**           Job selected                 Edit a job in *created* or *Error* or *Failed* or *Not Created*  No
+                                                      state. Clone a job in other state.
+**Refresh jobs**         Always activated             Update jobs states.                                              Not matter
+======================== ============================ ================================================================ ===================
+
+**Tip:** You could use the **Auto Refresh** button in GUI part 3 to enable an automatic refresh.
+
+When a job is selected, the part 2 is filled with all the information that the JOBMANAGER has on the job. The figure
+:ref:`figure_jobmanager_job_focus` shows this part of the GUI. It contains two tabs. The first tab provides the main 
+information and the run information. The second tab shows the input and output file list of the job.
+
+.. _figure_jobmanager_job_focus:
+
+.. figure:: images/jobmanager_job_focus.png
+  :align: center
+
+  **Job widget information**
+
+Job creation workflow
+---------------------
+
+This section describes the workflow when a job is created. The jobmanager uses a wizard to create a job.
+
+The first page (see :ref:`figure_jobmanager_job_workflow_1`) of the wizard permits to define the **job name** 
+and the **job type**. For each job type, the page provides an explanation of what job type refers.
+
+.. _figure_jobmanager_job_workflow_1:
+
+.. figure:: images/jobmanager_job_workflow_1.png
+  :align: center
+
+  **Create wizard page 1**
+
+The second page (see :ref:`figure_jobmanager_job_workflow_2`) permits to add two files, the main job file 
+(in this example a command file). You could also add an environment file that is not mandatory.
+
+.. _figure_jobmanager_job_workflow_2:
+
+.. figure:: images/jobmanager_job_workflow_2.png
+  :align: center
+
+  **Create wizard page 2**
+
+The third page (see :ref:`figure_jobmanager_job_workflow_3`) permits to define the batch parameters related
+to the job. It's mandatory to define the *Remote work directory* that is the directory where the job will be executed.
+Input files defined in page 4 will be copied in this directory. You also have to define the maximum duration,
+the amount of memory needed and the number of processors/cores of the job.
+
+.. _figure_jobmanager_job_workflow_3:
+
+.. figure:: images/jobmanager_job_workflow_3.png
+  :align: center
+
+  **Create wizard page 3**
+
+The fourth page (see :ref:`figure_jobmanager_job_workflow_4`) permits to add the input and output files. 
+Input files are files located into the user
+computer that have to be transferred into the execution resource. In this page, you could also define the result 
+directory where job's results and logs will be copied.
+
+.. _figure_jobmanager_job_workflow_4:
+
+.. figure:: images/jobmanager_job_workflow_4.png
+  :align: center
+
+  **Create wizard page 4**
+
+The fifth page (see :ref:`figure_jobmanager_job_workflow_5`) permits to choose the resource where the job 
+will be executed. You can also define the batch queue that you want to use.
+
+.. _figure_jobmanager_job_workflow_5:
+
+.. figure:: images/jobmanager_job_workflow_5.png
+  :align: center
+
+  **Create wizard page 5**
+
+The last page (see :ref:`figure_jobmanager_job_workflow_6`) finalizes the job creation. You could choose 
+if you want or not start the job at the end of the wizard.
+
+.. _figure_jobmanager_job_workflow_6:
+
+.. figure:: images/jobmanager_job_workflow_6.png
+  :align: center
+
+  **Create wizard page 6**
+
+Loading and saving job list
+---------------------------
+
+The JOBMANAGER permits to save and load the job list.
+For some jobs, this feature permits to follow the execution of a job
+into a different SALOME session by loading the list.
+
+The figure :ref:`figure_jobmanager_load_save_buttons` shows where are located 
+the load and save buttons in the JOBMANAGER GUI.
+
+.. _figure_jobmanager_load_save_buttons:
+
+.. figure:: images/jobmanager_load_save_buttons.png
+  :align: center
+
+  **Location of load and save job list buttons**
+
+All jobs cannot be followed between two SALOME sessions. Indeed, It's the *batch* type
+of the resource that allows to know if you can or not follow a job. Currently, resources
+that use **ssh** for batch configuration cannot be followed. In this case, when the JOBMANAGER
+load the job, it will set this kind of job in the **Error** state.
+
diff --git a/doc/resource.rst b/doc/resource.rst
new file mode 100644 (file)
index 0000000..d38f0b7
--- /dev/null
@@ -0,0 +1,167 @@
+Managing SALOME resources with the JOBMANAGER
+=============================================
+
+The JOBMANAGER provides a GUI to manage SALOME resources.
+Later in the chapter, we use resource for SALOME resource.
+
+Definition of a SALOME resource
++++++++++++++++++++++++++++++++
+
+A resource is the SALOME abstraction for computer.
+A resource contains three different kinds of information:
+
+- A name.
+- A physical description of the computer.
+- A description of a SALOME installation in the computer.
+
+A resource's name could be different from the computer name since 
+different SALOME installation could coexist in the computer.
+
+Physical description of the computer
+------------------------------------
+
+A resource contains a physical description of the computer.
+These informations are used by the resource manager (service provided
+by the KERNEL) to choose and use a resource when a container (in YACS)
+or a job (in JOBMANAGER) has to be launched.
+
+The description of each attribute is given in the table below. 
+
+**Warning:** The *mandatory* part is for using the resource with the JOBMANAGER.
+
+========================== ================ =============================================================
+**Attribute**              **Mandatory**    **Description**
+========================== ================ =============================================================
+**hostname**               Yes              It's the network name of the computer. If the computer is a 
+                                            cluster, you have to give the frontal node name.
+**protocol**               Yes              Network protocol to use for creating connections 
+                                            (ssh or rsh).
+**username**               Yes              User name to use for creating connections.
+**batch**                  Yes              Type of batch system installed in the resource. Use *ssh* if
+                                            the resource is a single computer.
+**iprotocol**              Yes              Internal protocol to use on a cluster (ssh, rsh or srun).
+**mpiImpl**                No               MPI implementation to use.
+
+**OS**                     No               It's the operating system name, e.g.: Linux, Windows.
+**nb_node**                No               It's the amount of node of the computer.
+**nb_proc_per_node**       No               It's the amount or processor or core in each node.
+**mem_mb**                 No               It's the amount of memory in megabytes per node.
+**cpu_clock**              No               It's the frequency in gigahertz of the computer's processors.
+========================== ================ =============================================================
+
+SALOME installation description
+-------------------------------
+
+A resource could contain a SALOME installation description.
+The description of each attribute is given in the table below.
+
+**Warning:** Attribute **applipath** is *mandatory* with JOBMANAGER SALOME related type of job.
+
+========================== =============================================================
+**Attribute**              **Description**
+========================== =============================================================
+**applipath**              It's the directory of the SALOME application to use into the 
+                           resource.
+**componentList**          It's the SALOME component list available in the SALOME 
+                           application.
+========================== =============================================================
+
+Where is the resource file?
+---------------------------
+
+Resources are located into a XML resource file. SALOME tries to find this file
+in three different locations:
+
+1. If **USER_CATALOG_RESOURCES_FILE** env file is defined, SALOME uses this file.
+2. If not, in the SALOME application directory: $APPLIPATH/CatalogResources.xml.
+3. If not, in the directory of the installation of SALOME KERNEL: 
+   $KERNEL_ROOT_DIR/share/salome/resources/kernel/CatalogResources.xml.
+
+By default, the resource manager creates a resource with the name and the hostname of the user computer.
+
+JOBMANAGER resource management GUI
+++++++++++++++++++++++++++++++++++
+
+The JOBMANAGER provides a panel to manage user's resources. This panel is shown in the 
+figure :ref:`figure_jobmanager_resource_1`. The panel provides some buttons and a list
+that shows the available resources. You have to select one resource to enable some buttons.
+
+.. _figure_jobmanager_resource_1:
+
+.. figure:: images/jobmanager_resource_1.png
+  :align: center
+
+  **JOBMANAGER resource management panel**
+
+The description of each button is given in the table below.
+
+========================== =============================================================
+**Button**                  **Description**
+========================== =============================================================
+**Refresh Resource List**  Resource file is read to refresh the list.
+**Show**                   Show the selected resource.
+**Edit**                   Edit the selected resource. The resource is saved is **Ok** 
+                           is clicked. If the resource name is changed, a new resource
+                           is added.
+**Add**                    Add a new resource.
+**Remove**                 Remove the selected resource.
+========================== =============================================================
+
+The figure :ref:`figure_jobmanager_resource_2` shows the panel of a resource. This panel
+shows all the information of a resource.
+
+.. _figure_jobmanager_resource_2:
+
+.. figure:: images/jobmanager_resource_2.png
+  :align: center
+
+  **JOBMANAGER resource panel**
+
+Two usage scenarios of SALOME's resource with the JOBMANAGER
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+This section describes to common scenarios for understanding how to describe
+a resource for the JOBMANAGER.
+
+Using an interactive resource
+-----------------------------
+
+In this scenario, you need to launch a job into your computer or an interactive computer
+available in your network.
+
+To launch a **command** job you need to fill the following attributes:
+
+- **hostname**
+- **protocol** = *ssh*
+- **username**
+- **batch** = *ssh*
+
+**Warning:** You have to configure ssh for allowing ssh commands without asking 
+interactive password (RSA or DSA keys).
+
+To launch a **SALOME** type of job, you also need to fill the following attributes:
+
+- **applipath**
+
+Using a cluster managed by a batch system
+-----------------------------------------
+
+In this scenario, you need to launch a job into a cluster managed by a batch system.
+
+To launch a **command** job you need to fill the following attributes:
+
+- **hostname**
+- **protocol**
+- **username**
+- **batch**
+- **iprotocol**
+- **nb_proc_per_node**
+
+**Warning:** You have to configure ssh for allowing ssh commands without asking 
+interactive password (RSA or DSA keys) between your computer and the cluster and between
+the cluster's nodes.
+
+To launch a **SALOME** command job you also need to fill the following attributes:
+
+- **applipath**
+
diff --git a/idl/JOBMANAGER_IDL.idl b/idl/JOBMANAGER_IDL.idl
new file mode 100644 (file)
index 0000000..2b72d61
--- /dev/null
@@ -0,0 +1,30 @@
+// Copyright (C) 2009-2012  CEA/DEN, EDF R&D
+//
+// 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 _JOBMANAGER_IDL_
+#define _JOBMANAGER_IDL_
+
+#include "SALOME_ContainerManager.idl"
+
+module JOBMANAGER
+{
+  interface LauncherObserver : Engines::SalomeLauncherObserver {};
+};
+
+#endif
diff --git a/idl/Makefile.am b/idl/Makefile.am
new file mode 100644 (file)
index 0000000..321a10e
--- /dev/null
@@ -0,0 +1,47 @@
+# Copyright (C) 2009-2012  CEA/DEN, EDF R&D
+#
+# 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
+#
+
+salomeidldir       = $(prefix)/idl
+salomeincludedir   = $(includedir)/salome
+libdir             = $(prefix)/lib/salome
+
+BUILT_SOURCES = JOBMANAGER_IDLSK.cc
+IDL_FILES     = JOBMANAGER_IDL.idl
+
+lib_LTLIBRARIES = libJOBMANAGER_IDL.la
+salomeidl_DATA = $(IDL_FILES)
+
+nodist_libJOBMANAGER_IDL_la_SOURCES = JOBMANAGER_IDLSK.cc
+nodist_salomeinclude_HEADERS    = JOBMANAGER_IDL.hh
+
+libJOBMANAGER_IDL_la_CXXFLAGS     = -I. @KERNEL_CXXFLAGS@ @OMNIORB_CXXFLAGS@ @OMNIORB_INCLUDES@
+libJOBMANAGER_IDL_la_LIBADD       = $(KERNEL_LIBS)
+
+OMNIORB_IDLCXXFLAGS = @OMNIORB_IDLCXXFLAGS@ -I$(KERNEL_ROOT_DIR)/idl/salome
+
+%SK.cc %.hh : %.idl
+       $(OMNIORB_IDL) -bcxx $(OMNIORB_IDLCXXFLAGS) $<
+
+# E.A. : IDLPYFLAGS is just to compile with cmake (parsed in am2cmake).
+
+IDLPYFLAGS = @IDLPYFLAGS@ -I$(KERNEL_ROOT_DIR)/idl/salome
+
+CLEANFILES = *.hh *SK.cc *.py *.hxx *.cxx
+
+EXTRA_DIST = $(IDL_FILES)
index 6f315136fe74cbbfcc8585a2790c8f3964a19b5c..bfd9b36026f918683e8b0ec9726b2889d5c06ce8 100644 (file)
@@ -1,21 +1,22 @@
-dnl  Copyright (C) 2006-2008  CEA/DEN, EDF R&D
+dnl Copyright (C) 2009-2012  CEA/DEN, EDF R&D
 dnl
-dnl  This library is free software; you can redistribute it and/or
-dnl  modify it under the terms of the GNU Lesser General Public
-dnl  License as published by the Free Software Foundation; either
-dnl  version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
 dnl
-dnl  This library is distributed in the hope that it will be useful,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+dnl Lesser General Public License for more details.
 dnl
-dnl  You should have received a copy of the GNU Lesser General Public
-dnl  License along with this library; if not, write to the Free Software
-dnl  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 dnl
-dnl  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 dnl
+
 dnl @synopsis AC_CXX_OPTION(-option,variable where we add option if ok,action if ok; action if not ok)
 dnl Check options for C++ compiler
 dnl @author Bernard Secher - 15/01/2004
index cec98c40dd3e78e10a6b18af976390bb85432e96..8da3462db2a40cb10191cdbd37bce3f068aad95e 100644 (file)
@@ -1,21 +1,22 @@
-dnl  Copyright (C) 2006-2008  CEA/DEN, EDF R&D
+dnl Copyright (C) 2009-2012  CEA/DEN, EDF R&D
 dnl
-dnl  This library is free software; you can redistribute it and/or
-dnl  modify it under the terms of the GNU Lesser General Public
-dnl  License as published by the Free Software Foundation; either
-dnl  version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
 dnl
-dnl  This library is distributed in the hope that it will be useful,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+dnl Lesser General Public License for more details.
 dnl
-dnl  You should have received a copy of the GNU Lesser General Public
-dnl  License along with this library; if not, write to the Free Software
-dnl  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 dnl
-dnl  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 dnl
+
 dnl @synopsis AC_LINKER_OPTIONS
 dnl Check warning flags for C++ compiler to control warning messages
 dnl
diff --git a/m4/acx_pthread.m4 b/m4/acx_pthread.m4
new file mode 100644 (file)
index 0000000..11bc253
--- /dev/null
@@ -0,0 +1,224 @@
+dnl Copyright (C) 2009-2012  CEA/DEN, EDF R&D
+dnl
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
+dnl
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+dnl Lesser General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+dnl
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl
+
+dnl Paul RASCLE: modification for Linux: -pthread required by boost...
+dnl Available from the GNU Autoconf Macro Archive at:
+dnl
+AC_DEFUN([ACX_PTHREAD], [
+AC_REQUIRE([AC_CANONICAL_HOST])
+AC_LANG_SAVE
+AC_LANG_C
+acx_pthread_ok=no
+
+# We used to check for pthread.h first, but this fails if pthread.h
+# requires special compiler flags (e.g. on True64 or Sequent).
+# It gets checked for in the link test anyway.
+
+# First of all, check if the user has set any of the PTHREAD_LIBS,
+# etcetera environment variables, and if threads linking works using
+# them:
+if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
+        save_CFLAGS="$CFLAGS"
+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+        save_LIBS="$LIBS"
+        LIBS="$PTHREAD_LIBS $LIBS"
+        AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
+        AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes)
+        AC_MSG_RESULT($acx_pthread_ok)
+        if test x"$acx_pthread_ok" = xno; then
+                PTHREAD_LIBS=""
+                PTHREAD_CFLAGS=""
+        fi
+        LIBS="$save_LIBS"
+        CFLAGS="$save_CFLAGS"
+fi
+
+# We must check for the threads library under a number of different
+# names; the ordering is very important because some systems
+# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
+# libraries is broken (non-POSIX).
+
+# Create a list of thread flags to try.  Items starting with a "-" are
+# C compiler flags, and other items are library names, except for "none"
+# which indicates that we try without any flags at all, and "pthread-config"
+# which is a program returning the flags for the Pth emulation library.
+
+acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
+
+# The ordering *is* (sometimes) important.  Some notes on the
+# individual items follow:
+
+# pthreads: AIX (must check this before -lpthread)
+# none: in case threads are in libc; should be tried before -Kthread and
+#       other compiler flags to prevent continual compiler warnings
+# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
+# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
+# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
+# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
+# -pthreads: Solaris/gcc
+# -mthreads: Mingw32/gcc, Lynx/gcc
+# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
+#      doesn't hurt to check since this sometimes defines pthreads too;
+#      also defines -D_REENTRANT)
+# pthread: Linux, etcetera
+# --thread-safe: KAI C++
+# pthread-config: use pthread-config program (for GNU Pth library)
+
+case "${host_cpu}-${host_os}" in
+        *linux*)
+
+        # On linux "none" works, but boost requires -pthread, so, try first "-pthread"
+acx_pthread_flags="-pthread pthreads none -Kthread -kthread lthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
+        ;;
+
+        *solaris*)
+
+        # On Solaris (at least, for some versions), libc contains stubbed
+        # (non-functional) versions of the pthreads routines, so link-based
+        # tests will erroneously succeed.  (We need to link with -pthread or
+        # -lpthread.)  (The stubs are missing pthread_cleanup_push, or rather
+        # a function called by this macro, so we could check for that, but
+        # who knows whether they'll stub that too in a future libc.)  So,
+        # we'll just look for -pthreads and -lpthread first:
+
+        acx_pthread_flags="-pthread -pthreads pthread -mt $acx_pthread_flags"
+        ;;
+esac
+
+if test x"$acx_pthread_ok" = xno; then
+for flag in $acx_pthread_flags; do
+
+        case $flag in
+                none)
+                AC_MSG_CHECKING([whether pthreads work without any flags])
+                ;;
+
+                -*)
+                AC_MSG_CHECKING([whether pthreads work with $flag])
+                PTHREAD_CFLAGS="$flag"
+                ;;
+
+               pthread-config)
+               AC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no)
+               if test x"$acx_pthread_config" = xno; then continue; fi
+               PTHREAD_CFLAGS="`pthread-config --cflags`"
+               PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
+               ;;
+
+                *)
+                AC_MSG_CHECKING([for the pthreads library -l$flag])
+                PTHREAD_LIBS="-l$flag"
+                ;;
+        esac
+
+        save_LIBS="$LIBS"
+        save_CFLAGS="$CFLAGS"
+        LIBS="$PTHREAD_LIBS $LIBS"
+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+
+        # Check for various functions.  We must include pthread.h,
+        # since some functions may be macros.  (On the Sequent, we
+        # need a special flag -Kthread to make this header compile.)
+        # We check for pthread_join because it is in -lpthread on IRIX
+        # while pthread_create is in libc.  We check for pthread_attr_init
+        # due to DEC craziness with -lpthreads.  We check for
+        # pthread_cleanup_push because it is one of the few pthread
+        # functions on Solaris that doesn't have a non-functional libc stub.
+        # We try pthread_create on general principles.
+        AC_TRY_LINK([#include <pthread.h>],
+                    [pthread_t th; pthread_join(th, 0);
+                     pthread_attr_init(0); pthread_cleanup_push(0, 0);
+                     pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
+                    [acx_pthread_ok=yes])
+
+        LIBS="$save_LIBS"
+        CFLAGS="$save_CFLAGS"
+
+        AC_MSG_RESULT($acx_pthread_ok)
+        if test "x$acx_pthread_ok" = xyes; then
+                break;
+        fi
+
+        PTHREAD_LIBS=""
+        PTHREAD_CFLAGS=""
+done
+fi
+
+# Various other checks:
+if test "x$acx_pthread_ok" = xyes; then
+        save_LIBS="$LIBS"
+        LIBS="$PTHREAD_LIBS $LIBS"
+        save_CFLAGS="$CFLAGS"
+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+
+        # Detect AIX lossage: threads are created detached by default
+        # and the JOINABLE attribute has a nonstandard name (UNDETACHED).
+        AC_MSG_CHECKING([for joinable pthread attribute])
+        AC_TRY_LINK([#include <pthread.h>],
+                    [int attr=PTHREAD_CREATE_JOINABLE;],
+                    ok=PTHREAD_CREATE_JOINABLE, ok=unknown)
+        if test x"$ok" = xunknown; then
+                AC_TRY_LINK([#include <pthread.h>],
+                            [int attr=PTHREAD_CREATE_UNDETACHED;],
+                            ok=PTHREAD_CREATE_UNDETACHED, ok=unknown)
+        fi
+        if test x"$ok" != xPTHREAD_CREATE_JOINABLE; then
+                AC_DEFINE(PTHREAD_CREATE_JOINABLE, $ok,
+                          [Define to the necessary symbol if this constant
+                           uses a non-standard name on your system.])
+        fi
+        AC_MSG_RESULT(${ok})
+        if test x"$ok" = xunknown; then
+                AC_MSG_WARN([we do not know how to create joinable pthreads])
+        fi
+
+        AC_MSG_CHECKING([if more special flags are required for pthreads])
+        flag=no
+        case "${host_cpu}-${host_os}" in
+                *-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";;
+                *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
+        esac
+        AC_MSG_RESULT(${flag})
+        if test "x$flag" != xno; then
+                PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
+        fi
+
+        LIBS="$save_LIBS"
+        CFLAGS="$save_CFLAGS"
+
+        # More AIX lossage: must compile with cc_r
+        AC_CHECK_PROG(PTHREAD_CC, cc_r, cc_r, ${CC})
+else
+        PTHREAD_CC="$CC"
+fi
+
+AC_SUBST(PTHREAD_LIBS)
+AC_SUBST(PTHREAD_CFLAGS)
+AC_SUBST(PTHREAD_CC)
+
+# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
+if test x"$acx_pthread_ok" = xyes; then
+        ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
+        :
+else
+        acx_pthread_ok=no
+        $2
+fi
+AC_LANG_RESTORE
+])dnl ACX_PTHREAD
diff --git a/m4/check_boost.m4 b/m4/check_boost.m4
new file mode 100644 (file)
index 0000000..97112c4
--- /dev/null
@@ -0,0 +1,176 @@
+dnl Copyright (C) 2009-2012  CEA/DEN, EDF R&D
+dnl
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
+dnl
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+dnl Lesser General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+dnl
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl
+
+AC_DEFUN([CHECK_BOOST],[
+
+AC_CHECKING(for BOOST Library)
+
+AC_REQUIRE([ENABLE_PTHREADS])dnl
+
+AC_LANG_SAVE
+AC_LANG_CPLUSPLUS
+
+gccver=`$CC -dumpversion | sed 's/^\([[0-9]]\+\)\.\([[0-9]]\+\).*/\1\2/g'`
+SUFFIXES="empty -mt -gcc -gcc-mt -gcc${gccver} -gcc${gccver}-mt"
+
+BOOST_CPPFLAGS=""
+BOOST_LIBSUFFIX=""
+BOOST_LIBS=""
+
+AC_CHECKING(for BOOST location)
+AC_ARG_WITH(boost,
+   [AC_HELP_STRING([--with-boost=DIR],[root directory path to BOOST library installation])],
+   [BOOSTDIR="$withval"
+    AC_MSG_RESULT("select $withval as path to BOOST library")
+   ])
+   
+if test "x${BOOSTDIR}" = "x" ; then
+  BOOSTDIR="/usr"
+fi
+
+AC_MSG_RESULT(\$BOOSTDIR = ${BOOSTDIR})
+
+CPPFLAGS_old="${CPPFLAGS}"
+LIBS_old=$LIBS
+
+LIB_SUFFIX="${LIB_LOCATION_SUFFIX}"
+
+if test "x${BOOSTDIR}" != "x" ; then
+  BOOST_CPPFLAGS="-I${BOOSTDIR}/include"
+  BOOST_LIBS="-L${BOOSTDIR}/lib${LIB_SUFFIX}"
+fi
+
+if test "x${BOOSTDIR}" = "x/usr" ; then
+  BOOST_CPPFLAGS=""
+  BOOST_LIBS=""
+fi
+
+boost_ok=no
+boost_headers_ok=no
+boost_binaries_ok=no
+
+dnl BOOST headers
+AC_CHECKING(for BOOST headers)
+CPPFLAGS="${CPPFLAGS_old} ${BOOST_CPPFLAGS}"
+
+boost_include_dir_ok=yes
+if test "x${BOOSTDIR}" != "x" ; then
+  AC_CHECK_FILE(${BOOSTDIR}/include/boost/shared_ptr.hpp,
+                boost_include_dir_ok=yes,
+                boost_include_dir_ok=no)
+fi
+
+BOOST_PROGRAM_OPTIONS_LIB=no
+if test "x${boost_include_dir_ok}" = "xyes" ; then
+  AC_CHECK_FILE(${BOOSTDIR}/include/boost/program_options.hpp,
+                BOOST_PROGRAM_OPTIONS_LIB=yes,
+                BOOST_PROGRAM_OPTIONS_LIB=no)
+fi
+AC_MSG_RESULT(for boost program_options tool: $BOOST_PROGRAM_OPTIONS_LIB)
+
+if test "x${boost_include_dir_ok}" = "xyes" ; then
+  AC_TRY_COMPILE([#include <boost/shared_ptr.hpp>],
+                 [boost::shared_ptr<int>(new int)],
+                 boost_headers_ok=yes,
+                 boost_headers_ok=no)
+fi
+
+if test "x${boost_headers_ok}" = "xno" ; then
+  BOOST_CPPFLAGS="BOOST_CPPFLAGS_NOT_DEFINED"
+else
+  AC_MSG_RESULT(\$BOOST_CPPFLAGS = ${BOOST_CPPFLAGS})
+fi
+AC_MSG_RESULT(for boost headers: $boost_headers_ok)
+
+if test "x${boost_headers_ok}" = "xyes" ; then
+  dnl BOOST binaries
+  AC_CHECKING(for BOOST binaries)
+  boost_lib_dir_ok=yes
+  if test "x${BOOSTDIR}" != "x" ; then
+    for BOOST_LIBSUFFIX in ${SUFFIXES} ; do
+      test "${BOOST_LIBSUFFIX}" == "empty" && BOOST_LIBSUFFIX=""
+      AC_CHECK_FILE([${BOOSTDIR}/lib${LIB_SUFFIX}/libboost_thread${BOOST_LIBSUFFIX}.so],
+                    [boost_lib_dir_ok=yes],
+                    [AC_CHECK_FILE([${BOOSTDIR}/lib64/libboost_thread${BOOST_LIBSUFFIX}.so],
+                                  [boost_lib_dir_ok=yes; LIB_SUFFIX=64],
+                                  [boost_lib_dir_ok=no])
+                    ])
+      if test "x${boost_lib_dir_ok}" = "xyes" ; then
+        break
+      fi
+    done
+  fi
+  if test "x${boost_lib_dir_ok}" = "xyes" ; then
+    LIBS="${LIBS_old} ${BOOST_LIBS} -lboost_thread${BOOST_LIBSUFFIX}"
+    AC_TRY_LINK([#include <boost/thread/thread.hpp>],
+                [struct TBody{ void operator()(){} }; boost::thread(TBody())],
+                boost_binaries_ok=yes,
+                boost_binaries_ok=no)
+    if test "x${boost_binaries_ok}" = "xyes" ; then
+      break
+    fi
+  fi
+fi
+
+if test "x${boost_binaries_ok}" = "xno" ; then
+  BOOST_LIBS="BOOST_LIBS_NOT_FOUND"
+  BOOST_LIBSUFFIX="-not-defined"
+else
+  AC_MSG_RESULT(\$BOOST_LIBSUFFIX = ${BOOST_LIBSUFFIX})
+  AC_MSG_RESULT(\$BOOST_LIBS = ${BOOST_LIBS})
+  AC_CHECK_FILE(${BOOSTDIR}/lib${LIB_SUFFIX}/libboost_thread${BOOST_LIBSUFFIX}.so,
+                BOOST_LIB_THREAD="${BOOST_LIBS} -lboost_thread${BOOST_LIBSUFFIX}",
+                BOOST_LIB_THREAD="")
+  AC_CHECK_FILE(${BOOSTDIR}/lib${LIB_SUFFIX}/libboost_signals${BOOST_LIBSUFFIX}.so,
+                BOOST_LIB_SIGNALS="${BOOST_LIBS} -lboost_signals${BOOST_LIBSUFFIX}",
+                BOOST_LIB_SIGNALS="")
+  AC_CHECK_FILE(${BOOSTDIR}/lib${LIB_SUFFIX}/libboost_system${BOOST_LIBSUFFIX}.so,
+                BOOST_LIB_SYSTEM="${BOOST_LIBS} -lboost_system${BOOST_LIBSUFFIX}",
+                BOOST_LIB_SYSTEM="")
+  AC_CHECK_FILE(${BOOSTDIR}/lib${LIB_SUFFIX}/libboost_regex${BOOST_LIBSUFFIX}.so,
+                BOOST_LIB_REGEX="${BOOST_LIBS} -lboost_regex${BOOST_LIBSUFFIX}",
+                BOOST_LIB_REGEX="")
+fi
+AC_MSG_RESULT(for boost binaries: $boost_binaries_ok)
+
+CPPFLAGS="${CPPFLAGS_old}"
+LIBS="${LIBS_old}"
+
+if test "x${boost_headers_ok}" = "xyes" ; then
+  if test "x${boost_binaries_ok}" = "xyes" ; then
+    boost_ok=yes
+  fi
+fi
+
+AC_MSG_RESULT(for boost: $boost_ok)
+
+AC_SUBST(BOOST_CPPFLAGS)
+AC_SUBST(BOOST_LIBSUFFIX)
+AC_SUBST(BOOST_LIBS)
+AC_SUBST(BOOST_LIB_THREAD)
+AC_SUBST(BOOST_LIB_SIGNALS)
+AC_SUBST(BOOST_LIB_SYSTEM)
+AC_SUBST(BOOST_LIB_REGEX)
+AC_SUBST(BOOST_PROGRAM_OPTIONS_LIB)
+
+AC_LANG_RESTORE
+
+])dnl
+
+
index f2be9a7e507823213104f119e92cf58cdd3fc3ee..eaf23982e673b50886d76a22d750f324fc6a30c2 100644 (file)
@@ -1,20 +1,20 @@
-dnl  Copyright (C) 2006-2008  CEA/DEN, EDF R&D
+dnl Copyright (C) 2009-2012  CEA/DEN, EDF R&D
 dnl
-dnl  This library is free software; you can redistribute it and/or
-dnl  modify it under the terms of the GNU Lesser General Public
-dnl  License as published by the Free Software Foundation; either
-dnl  version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
 dnl
-dnl  This library is distributed in the hope that it will be useful,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+dnl Lesser General Public License for more details.
 dnl
-dnl  You should have received a copy of the GNU Lesser General Public
-dnl  License along with this library; if not, write to the Free Software
-dnl  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 dnl
-dnl  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 dnl
 AC_DEFUN([AC_CHECK_OMNIORB],[
 AC_REQUIRE([AC_PROG_CC])dnl
@@ -25,10 +25,12 @@ AC_REQUIRE([AC_PROG_CXXCPP])dnl
 AC_CHECKING(for omniORB)
 omniORB_ok=yes
 
-if test "x$PYTHON" = "x" 
-then
-  CHECK_PYTHON
-fi
+#VSR: Python is not currently required.
+#Commented to avoid warning message on configure.
+#if test "x$PYTHON" = "x" 
+#then
+#  CHECK_PYTHON
+#fi
 
 AC_LANG_SAVE
 AC_LANG_CPLUSPLUS
index f6bdfa7d9bdf73f55a6d5565d7a3234296e2dbb2..e3848cf7cd96fac416bd5ba210202213344cd4b2 100644 (file)
@@ -1,20 +1,20 @@
-dnl  Copyright (C) 2006-2008  CEA/DEN, EDF R&D
+dnl Copyright (C) 2009-2012  CEA/DEN, EDF R&D
 dnl
-dnl  This library is free software; you can redistribute it and/or
-dnl  modify it under the terms of the GNU Lesser General Public
-dnl  License as published by the Free Software Foundation; either
-dnl  version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
 dnl
-dnl  This library is distributed in the hope that it will be useful,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+dnl Lesser General Public License for more details.
 dnl
-dnl  You should have received a copy of the GNU Lesser General Public
-dnl  License along with this library; if not, write to the Free Software
-dnl  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 dnl
-dnl  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 dnl
 # Check availability of Salome's KERNEL binary distribution
 #
index eec149530e86e7ec9cbee4ea172d2c4b88080f58..de4082c7dc440932c146d749baff20b08d6f47e9 100644 (file)
@@ -1,20 +1,20 @@
-dnl  Copyright (C) 2006-2008  CEA/DEN, EDF R&D
+dnl Copyright (C) 2009-2012  CEA/DEN, EDF R&D
 dnl
-dnl  This library is free software; you can redistribute it and/or
-dnl  modify it under the terms of the GNU Lesser General Public
-dnl  License as published by the Free Software Foundation; either
-dnl  version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
 dnl
-dnl  This library is distributed in the hope that it will be useful,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+dnl Lesser General Public License for more details.
 dnl
-dnl  You should have received a copy of the GNU Lesser General Public
-dnl  License along with this library; if not, write to the Free Software
-dnl  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 dnl
-dnl  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 dnl
 AC_DEFUN([CHECK_SPHINX],[
 
diff --git a/m4/enable_pthreads.m4 b/m4/enable_pthreads.m4
new file mode 100644 (file)
index 0000000..c7325cc
--- /dev/null
@@ -0,0 +1,21 @@
+dnl modify CFLAGS, CXXFLAGS and LIBS for compiling pthread-based programs.
+dnl@author  (C) Ruslan Shevchenko <Ruslan@Shevchenko.Kiev.UA>, 1998, 2000
+dnl@id  $Id$
+dnl Modified to use acx_pthread.m4 from GNU Autoconf Macro Archive
+dnl
+AC_DEFUN([ENABLE_PTHREADS],[
+AC_REQUIRE([ACX_PTHREAD])
+
+if test x"$enable_pthreads_done" != xyes; then
+  if test x"$acx_pthread_ok" = xyes; then
+    CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+    CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS"
+    LIBS="$LIBS $PTHREAD_LIBS"
+    threads_ok=yes
+  else
+    threads_ok=no
+  fi
+  enable_pthreads_done=yes
+fi
+])dnl
+dnl
index 355c3898a7958e2a059f5f59672120b5a638af1f..81bcc06d495ac5350d6db481e1860b4af9aac2df 100644 (file)
@@ -1,21 +1,22 @@
-dnl  Copyright (C) 2006-2008  CEA/DEN, EDF R&D
+dnl Copyright (C) 2009-2012  CEA/DEN, EDF R&D
 dnl
-dnl  This library is free software; you can redistribute it and/or
-dnl  modify it under the terms of the GNU Lesser General Public
-dnl  License as published by the Free Software Foundation; either
-dnl  version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
 dnl
-dnl  This library is distributed in the hope that it will be useful,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+dnl Lesser General Public License for more details.
 dnl
-dnl  You should have received a copy of the GNU Lesser General Public
-dnl  License along with this library; if not, write to the Free Software
-dnl  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 dnl
-dnl  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 dnl
+
 dnl the following variables are exported:
 dnl  QT_MOC
 dnl  QT_UIC
@@ -28,6 +29,7 @@ dnl qt4 is searched in the following order
 dnl   path given with --with-qt4 options
 dnl   presence of QTDIR variable
 dnl   /usr
+dnl when HAS_GUI is false (no salome gui) and nothing is said for qt4, qt4 is not checked
 dnl usages
 dnl ./configure --prefix=/home/prascle/partage/maquettes/install 
 dnl ./configure --prefix=/home/prascle/partage/maquettes/install --with-qt4
@@ -42,6 +44,8 @@ AC_DEFUN([I2_CHECK_QT4],
   AC_REQUIRE([AC_PROG_CPP])
 
   qt_ok=no
+  qt4_wanted=yes
+  WITH_QT4=0
 
   # --- check if qt4 standard install directory is defined (with subdirectories bin lib include)
   qt4_install_path=""
@@ -60,34 +64,49 @@ AC_DEFUN([I2_CHECK_QT4],
     fi
   fi
 
-  # --- if qt4 standard install directory is not defined: QTDIR value if defined, or /usr
+  # --- if qt4 standard install directory is not defined
+  #       if HAS_GUI= 0: Qt4 not wanted
+  #       else: QTDIR value if defined, or /usr
   if test x${withval} = xnotset
   then
-    if test -z $QTDIR
+    if test x${HAS_GUI} = x0
     then
-      qt4_install_path="/usr"
+      qt4_wanted=no
+      AC_MSG_NOTICE([SALOME GUI not present, Qt4 not specified, skip detection])
     else
-      if test $QTDIR = /usr/lib/qt3 ; then
-        if test -d /usr/lib/qt4 ; then
-          AC_MSG_RESULT(it is strange for a qt4 installation !)
-          AC_MSG_RESULT(/usr/lib/qt4 is present)
-          AC_MSG_RESULT(replacing QTDIR by /usr/lib/qt4)
-          QTDIR=/usr/lib/qt4
+      if test -z $QTDIR
+      then
+        qt4_install_path="/usr"
+      else
+        if test $QTDIR = /usr/lib/qt3 ; then
+          if test -d /usr/lib/qt4 ; then
+            AC_MSG_RESULT(it is strange for a qt4 installation !)
+            AC_MSG_RESULT(/usr/lib/qt4 is present)
+            AC_MSG_RESULT(replacing QTDIR by /usr/lib/qt4)
+            QTDIR=/usr/lib/qt4
+          fi
         fi
+        qt4_install_path=$QTDIR
       fi
-      qt4_install_path=$QTDIR
     fi
   fi
   
   # --- if qt4 standard install directory is not wanted: --without-qt4 or --with-qt4=no
   if test x${withval} = xno
   then
-    qt4_install_path=""
+    qt4_wanted=no
+    AC_MSG_NOTICE([Qt4 is not wanted, skip detection])
   fi
 
   QT_DIR=${qt4_install_path}
   AC_SUBST(QT_DIR)
 
+  # ----------------------------------------------------------------------
+  # --- only when qt4 wanted (no explicit --without-qt4 nor --with-qt4=no)
+
+  if test x${qt4_wanted} = xyes
+  then
+
   # --- check if qt4 includes directory is defined
   qt4_include_path=""
   AC_ARG_WITH([qt4-includes],
@@ -146,11 +165,6 @@ AC_DEFUN([I2_CHECK_QT4],
     fi
   fi
 
-  WITH_QT4=0
-
-  AC_MSG_NOTICE(${qt4_include_path})
-  AC_MSG_NOTICE(${qt4_library_path})
-  AC_MSG_NOTICE(${qt4_tools_path})
 
   # test if qt4 is completely defined
   qt4_defined=yes
@@ -158,16 +172,22 @@ AC_DEFUN([I2_CHECK_QT4],
   then
     qt4_defined=no
     AC_MSG_NOTICE([No Qt4 include path defined])
+  else
+    AC_MSG_NOTICE([Qt4 include path is ${qt4_include_path}])
   fi
   if test x${qt4_library_path} = x
   then
     qt4_defined=no
     AC_MSG_NOTICE([No Qt4 library path defined])
+  else
+    AC_MSG_NOTICE([Qt4 library path is ${qt4_library_path}])
   fi
   if test x${qt4_tools_path} = x
   then
     qt4_defined=no
     AC_MSG_NOTICE([No Qt4 tools path defined])
+  else
+    AC_MSG_NOTICE([Qt4 tools   path is ${qt4_tools_path}])
   fi
 
   # saving values for compilation variables
@@ -218,7 +238,7 @@ AC_DEFUN([I2_CHECK_QT4],
     AC_SUBST(qt4_cppflags)
 
     # --- we test the library file presence and usability
-    if test x${qt4_library_path} = /usr/lib
+    if test x${qt4_library_path} = x/usr/lib
     then
       qt4_ldflags=""
     else
@@ -226,8 +246,7 @@ AC_DEFUN([I2_CHECK_QT4],
     fi
 
     AC_MSG_NOTICE([checking whether link with qt4 is working])
-    qt4_lib_name=QtGui
-    qt4_libs="-l$qt4_lib_name"
+    qt4_libs="-lQtCore -lQtGui"
     LDFLAGS="${LDFLAGS} ${qt4_ldflags}"
     LIBS="${LIBS} ${qt4_libs}"
     AC_LANG_PUSH(C++)
@@ -257,6 +276,15 @@ AC_DEFUN([I2_CHECK_QT4],
     AC_MSG_NOTICE([No Qt4 support])
   fi
 
+  # restoring saved values
+  CPPFLAGS=$saved_CPPFLAGS
+  LDFLAGS=$saved_LDFLAGS
+  LIBS=$saved_LIBS
+
+  fi
+  # --- end: only when qt4 wanted (no explicit --without-qt4 nor --with-qt4=no)
+  # ----------------------------------------------------------------------
+
   # Propagate test into atlocal
   AC_SUBST(WITH_QT4)
 
@@ -266,21 +294,21 @@ AC_DEFUN([I2_CHECK_QT4],
   # ... and into source files
   AC_DEFINE_UNQUOTED(HAS_QT4, $WITH_QT4, [Qt4 library])
 
-  # restoring saved values
-  CPPFLAGS=$saved_CPPFLAGS
-  LDFLAGS=$saved_LDFLAGS
-  LIBS=$saved_LIBS
-
 ])
 
 
 AC_DEFUN([I2_CHECK_QSCINTILLA],
 [
   AC_REQUIRE([I2_CHECK_QT4])
-
   qscintilla_ok=no
   WITH_QSCI4=0
 
+  # ----------------------------------------------------------------------
+  # --- check qscintilla only when qt4 OK
+
+  if test x${WITH_QT4} = x1
+  then
+
   # --- check if qsci4 includes directory is defined
   qsci4_include_path=""
   qsci4_cppflags=""
@@ -389,23 +417,30 @@ AC_DEFUN([I2_CHECK_QSCINTILLA],
       AC_SUBST(qsci4_libs)
       WITH_QSCI4=1
       qscintilla_ok=yes
-      # Propagate test into atlocal
-      AC_SUBST(WITH_QSCI4)
     fi
 
   else
     AC_MSG_NOTICE([no support for qscintilla for qt4])
   fi
 
+  # restoring saved values
+  CPPFLAGS=$saved_CPPFLAGS
+  LDFLAGS=$saved_LDFLAGS
+  LIBS=$saved_LIBS
+
+  else
+  # --- end: check qscintilla only when qt4 OK
+  # ----------------------------------------------------------------------
+    AC_MSG_NOTICE([qscintilla for qt4 not checked because Qt4 not wanted or not detected])
+  fi
+
+  # Propagate test into atlocal
+  AC_SUBST(WITH_QSCI4)
+  
   # Propagate test into Makefiles...
   AM_CONDITIONAL(WITH_QSCI4, test $WITH_QSCI4 = 1)
 
   # ... and into source files
   AC_DEFINE_UNQUOTED(HAS_QSCI4, $WITH_QSCI4, [QsciScintilla library])
 
-  # restoring saved values
-  CPPFLAGS=$saved_CPPFLAGS
-  LDFLAGS=$saved_LDFLAGS
-  LIBS=$saved_LIBS
-
 ])
index 802d37e8aa4da2a5abff09eb942e1947ce7653f9..d69e5bcb80b2fb1770da566825bf4721ac55b60f 100644 (file)
@@ -1,21 +1,22 @@
-dnl  Copyright (C) 2006-2008  CEA/DEN, EDF R&D
+dnl Copyright (C) 2009-2012  CEA/DEN, EDF R&D
 dnl
-dnl  This library is free software; you can redistribute it and/or
-dnl  modify it under the terms of the GNU Lesser General Public
-dnl  License as published by the Free Software Foundation; either
-dnl  version 2.1 of the License.
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License.
 dnl
-dnl  This library is distributed in the hope that it will be useful,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+dnl Lesser General Public License for more details.
 dnl
-dnl  You should have received a copy of the GNU Lesser General Public
-dnl  License along with this library; if not, write to the Free Software
-dnl  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 dnl
-dnl  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 dnl
+
 dnl define macros :
 dnl AC_ENABLE_PRODUCTION AC_DISABLE_PRODUCTION
 dnl AC_ENABLE_DEBUG AC_DISABLE_DEBUG
index 0897ae96524ef80cd454ffa805c9a992e846d4e4..8ae3eb626b7cb80c88d167978679db4038e49035 100644 (file)
@@ -1,20 +1,20 @@
-#  Copyright (C) 2009 CEA/DEN, EDF R&D
+# Copyright (C) 2009-2012  CEA/DEN, EDF R&D
 #
-#  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 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.
+# 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
+# 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
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
 SUBDIRS = bases engine genericgui wrappers standalone salomegui
index 087eeb736310995811fd6269802552182cac50e9..d925307ef5a6efa27d5d068a5edf50f32c535c5b 100644 (file)
@@ -1,20 +1,20 @@
-//  Copyright (C) 2009 CEA/DEN, EDF R&D
+// Copyright (C) 2009-2012  CEA/DEN, EDF R&D
 //
-//  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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #include "BL_Exception.hxx"
index a03a836df6fba2864c9f1dcb4ca8d93daffffca6..4d789250d04d3241aef834ef1e8b6ff22abb27f0 100644 (file)
@@ -1,30 +1,40 @@
-//  Copyright (C) 2009 CEA/DEN, EDF R&D
+// Copyright (C) 2009-2012  CEA/DEN, EDF R&D
 //
-//  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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 #ifndef __BL_EXCEPTION_HXX__
 #define __BL_EXCEPTION_HXX__
 
+#ifdef WNT
+#  if defined BL_Bases_EXPORTS
+#    define BL_Bases_EXPORT __declspec( dllexport )
+#  else
+#    define BL_Bases_EXPORT __declspec( dllimport )
+#  endif
+#else
+#  define BL_Bases_EXPORT
+#endif
+
 #include <string>
 #include <exception>
 
 namespace BL
 {
-  class Exception : public std::exception
+  class BL_Bases_EXPORT Exception : public std::exception
   {
   protected:
     std::string _what;
index 74ea63672eb64339018b84a3724e46d031ef0e36..1e30b071bcb8118faddca2a5ffc9af977792d80a 100644 (file)
@@ -1,20 +1,20 @@
-//  Copyright (C) 2009 CEA/DEN, EDF R&D
+// Copyright (C) 2009-2012  CEA/DEN, EDF R&D
 //
-//  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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #ifndef __BL_TRACES_HXX__
index 24299723a43edebf048443aa395f9f55c858abd5..0bb9bcade94f90946a3ad8eb411134421ee63045 100644 (file)
@@ -1,20 +1,20 @@
-#  Copyright (C) 2009 CEA/DEN, EDF R&D
+# Copyright (C) 2009-2012  CEA/DEN, EDF R&D
 #
-#  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 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.
+# 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
+# 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
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
 include $(top_srcdir)/src/bases/make_begin.am
index 0e885b979f4eacca1fc9b05d13d2f9e3f22b3861..c9741e1b35eb0a2e972b076bf2f65413b9b3aecb 100644 (file)
@@ -1,21 +1,22 @@
-#  Copyright (C) 2009 CEA/DEN, EDF R&D
+# Copyright (C) 2009-2012  CEA/DEN, EDF R&D
 #
-#  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 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.
+# 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
+# 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
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
+
 ##
 # Here any commonly used variables can be defined
 ##
diff --git a/src/engine/BL_Engine.hxx b/src/engine/BL_Engine.hxx
new file mode 100755 (executable)
index 0000000..6551201
--- /dev/null
@@ -0,0 +1,32 @@
+// Copyright (C) 2009-2012  CEA/DEN, EDF R&D
+//
+// 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_ENGINE_HXX__
+#define __BL_ENGINE_HXX__
+
+#ifdef WNT
+#  if defined BL_Engine_EXPORTS
+#    define BL_Engine_EXPORT __declspec( dllexport )
+#  else
+#    define BL_Engine_EXPORT __declspec( dllimport )
+#  endif
+#else
+#  define BL_Engine_EXPORT
+#endif
+
+#endif
index 85bbb659b8dfa1fc1caf07dfac8151bc57545114..46939abd06c6e948e271453c919038c65cb7ad9d 100644 (file)
@@ -1,20 +1,20 @@
-//  Copyright (C) 2009 CEA/DEN, EDF R&D
+// Copyright (C) 2009-2012  CEA/DEN, EDF R&D
 //
-//  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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #include "BL_Job.hxx"
@@ -23,34 +23,40 @@ BL::Job::Job()
 {
   DEBTRACE("Creating BL::Job");
   _name = "";
-  _yacs_file = "";
-  _command = "";
+  _job_file = "";
+  _env_file = "";
   _batch_params.batch_directory = "";
-  _batch_params.expected_during_time = "";
+  _batch_params.maximum_duration = "";
   _batch_params.expected_memory = "";
   _batch_params.nb_proc = 0;
   _files_params.result_directory = "";
-  _machine_choosed = "";
+  _resource_choosed = "";
+  _batch_queue = "";
   _state = BL::Job::CREATED;
   _thread_state = BL::Job::NOTHING;
   _salome_launcher_id = -1;
+  _dump_yacs_state = 0;
+  _ll_jobtype = "";
 }
 
 BL::Job::Job(const std::string & name)
 {
   DEBTRACE("Creating BL::Job with name : " << name);
   _name = name;
-  _yacs_file = "";
-  _command = "";
+  _job_file = "";
+  _env_file = "";
   _batch_params.batch_directory = "";
-  _batch_params.expected_during_time = "";
+  _batch_params.maximum_duration = "";
   _batch_params.expected_memory = "";
   _batch_params.nb_proc = 0;
   _files_params.result_directory = "";
-  _machine_choosed = "";
+  _resource_choosed = "";
+  _batch_queue = "";
   _state = BL::Job::CREATED;
   _thread_state = BL::Job::NOTHING;
   _salome_launcher_id = -1;
+  _dump_yacs_state = 0;
+  _ll_jobtype = "";
 }
 
 BL::Job::~Job()
@@ -68,47 +74,76 @@ BL::Job::getName()
   return _name;
 }
 
-void 
+void
 BL::Job::setType(BL::Job::JobType type)
 {
   _type = type;
 }
 
+void
+BL::Job::setType(const std::string & type)
+{
+  if (type == "command")
+  {
+    setType(BL::Job::COMMAND);
+  }
+  else if (type == "yacs_file")
+  {
+    setType(BL::Job::YACS_SCHEMA);
+  }
+  else if (type == "python_salome")
+  {
+    setType(BL::Job::PYTHON_SALOME);
+  }
+}
+
 BL::Job::JobType
 BL::Job::getType()
 {
   return _type;
 }
 
+void
+BL::Job::setDumpYACSState(const int & dump_yacs_state)
+{
+  _dump_yacs_state = dump_yacs_state;
+}
+
+int
+BL::Job::getDumpYACSState()
+{
+  return _dump_yacs_state;
+}
+
 void 
-BL::Job::setYACSFile(std::string & yacs_file)
+BL::Job::setJobFile(const std::string & job_file)
 {
-  _yacs_file = yacs_file;
+  _job_file = job_file;
 }
 
 std::string & 
-BL::Job::getYACSFile()
+BL::Job::getJobFile()
 {
-  return _yacs_file;
+  return _job_file;
 }
 
 void 
-BL::Job::setCommand(std::string & command)
+BL::Job::setEnvFile(const std::string & env_file)
 {
-  _command = command;
+  _env_file = env_file;
 }
 
 std::string & 
-BL::Job::getCommand()
+BL::Job::getEnvFile()
 {
-  return _command;
+  return _env_file;
 }
 
 void 
 BL::Job::setBatchParameters(BL::Job::BatchParam & param)
 {
   _batch_params.batch_directory = param.batch_directory;
-  _batch_params.expected_during_time = param.expected_during_time;
+  _batch_params.maximum_duration = param.maximum_duration;
   _batch_params.expected_memory = param.expected_memory;
   _batch_params.nb_proc = param.nb_proc;
 }
@@ -134,15 +169,39 @@ BL::Job::getFilesParameters()
 }
 
 void
-BL::Job::setMachine(std::string & machine)
+BL::Job::setResource(const std::string & resource)
 {
-  _machine_choosed = machine;
+  _resource_choosed = resource;
 }
 
 std::string &
-BL::Job::getMachine()
+BL::Job::getResource()
 {
-  return _machine_choosed;
+  return _resource_choosed;
+}
+
+void
+BL::Job::setBatchQueue(const std::string & queue)
+{
+  _batch_queue = queue;
+}
+
+std::string &
+BL::Job::getBatchQueue()
+{
+  return _batch_queue;
+}
+
+void
+BL::Job::setLoadLevelerJobType(const std::string & jobtype)
+{
+  _ll_jobtype = jobtype;
+}
+
+std::string &
+BL::Job::getLoadLevelerJobType()
+{
+  return _ll_jobtype;
 }
 
 void 
@@ -157,6 +216,105 @@ BL::Job::getState()
   return _state;
 }
 
+std::string
+BL::Job::setStringState(const std::string & state)
+{
+  std::string result("");
+
+  // Check if state is an error
+  if (state != "CREATED"     &&
+      state != "IN_PROCESS"  &&
+      state != "QUEUED"      &&
+      state != "RUNNING"     &&
+      state != "PAUSED"      &&
+      state != "FINISHED"    &&
+      state != "FAILED"      &&
+      state != "NOT_CREATED" &&
+      state != "ERROR"
+     )
+  {
+    DEBTRACE("Error state in setStringState");
+    result = "RefreshError";
+  }
+
+  if (result == "")
+  {
+    if (state == "CREATED")
+    {
+      if (_state != BL::Job::CREATED)
+      {
+        setState(BL::Job::CREATED);
+        result = state;
+      }
+    }
+    else if (state == "NOT_CREATED")
+    {
+      if (_state != BL::Job::NOT_CREATED)
+      {
+        setState(BL::Job::NOT_CREATED);
+        result = state;
+      }
+    }
+    else if (state == "QUEUED")
+    {
+      if (_state != BL::Job::QUEUED)
+      {
+        setState(BL::Job::QUEUED);
+        result = state;
+      }
+    }
+    else if (state == "IN_PROCESS")
+    {
+      if (_state != BL::Job::IN_PROCESS)
+      {
+        setState(BL::Job::IN_PROCESS);
+        result = state;
+      }
+    }
+    else if (state == "RUNNING")
+    {
+      if (_state != BL::Job::RUNNING)
+      {
+        setState(BL::Job::RUNNING);
+        result = state;
+      }
+    }
+    else if (state == "PAUSED")
+    {
+      if (_state != BL::Job::PAUSED)
+      {
+        setState(BL::Job::PAUSED);
+        result = state;
+      }
+    }
+    else if (state == "FINISHED")
+    {
+      if (_state != BL::Job::FINISHED)
+      {
+        setState(BL::Job::FINISHED);
+        result = state;
+      }
+    }
+    else if (state == "ERROR")
+    {
+      if (_state != BL::Job::ERROR)
+      {
+        setState(BL::Job::ERROR);
+        result = state;
+      }
+    }
+    else if (state == "FAILED")
+    {
+      if (_state != BL::Job::FAILED)
+      {
+        setState(BL::Job::FAILED);
+        result = state;
+      }
+    }
+  }
+  return result;
+}
+
 void 
 BL::Job::setThreadState(BL::Job::ThreadState state)
 {
index 6a78e1ce86c318be31478d3b3e6526a0c19e9739..d4e3da0256647931177ab105fa60f0c6c64b87d6 100644 (file)
@@ -1,33 +1,38 @@
-//  Copyright (C) 2009 CEA/DEN, EDF R&D
+// Copyright (C) 2009-2012  CEA/DEN, EDF R&D
 //
-//  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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #ifndef _BL_JOB_HXX_
 #define _BL_JOB_HXX_
 
+#include "BL_Engine.hxx"
 #include "BL_Traces.hxx"
 
 #include <string>
 #include <list>
 
+#ifdef WNT
+#undef ERROR
+#endif
+
 namespace BL{
 
-  class Job
+  class BL_Engine_EXPORT Job
   {
     public:
       Job();
@@ -37,41 +42,52 @@ namespace BL{
       void setName(const std::string & name);
       std::string getName();
 
-      enum JobType {YACS_SCHEMA, COMMAND};
+      enum JobType {YACS_SCHEMA, COMMAND, PYTHON_SALOME};
       void setType(BL::Job::JobType type);
+      void setType(const std::string & type);
       BL::Job::JobType getType();
 
-      void setYACSFile(std::string & yacs_file);
-      std::string & getYACSFile();
+      void setJobFile(const std::string & job_file);
+      std::string & getJobFile();
 
-      void setCommand(std::string & command);
-      std::string & getCommand();
+      void setEnvFile(const std::string & env_file);
+      std::string & getEnvFile();
+
+      void setDumpYACSState(const int & dump_yacs_state);
+      int getDumpYACSState();
 
       struct BatchParam
       {
-       std::string batch_directory;
-       std::string expected_during_time;
-       std::string expected_memory;
-       int nb_proc;
+        std::string batch_directory;
+        std::string maximum_duration;
+        std::string expected_memory;
+        int nb_proc;
       };
       void setBatchParameters(BL::Job::BatchParam & param);
       BL::Job::BatchParam & getBatchParameters();
 
       struct FilesParam
       {
-       std::string result_directory;
-       std::list<std::string> input_files_list;
-       std::list<std::string> output_files_list;
+        std::string result_directory;
+        std::list<std::string> input_files_list;
+        std::list<std::string> output_files_list;
       };
       void setFilesParameters(BL::Job::FilesParam & param);
       BL::Job::FilesParam & getFilesParameters();
 
-      void setMachine(std::string & machine);
-      std::string & getMachine();
+      void setResource(const std::string & resource);
+      std::string & getResource();
+
+      void setBatchQueue(const std::string & queue);
+      std::string & getBatchQueue();
 
-      enum State {CREATED, IN_PROCESS, QUEUED, RUNNING, PAUSED, FINISHED, ERROR};
+      void setLoadLevelerJobType(const std::string & jobtype);
+      std::string & getLoadLevelerJobType();
+
+      enum State {CREATED, IN_PROCESS, QUEUED, RUNNING, PAUSED, FINISHED, ERROR, FAILED, NOT_CREATED};
       void setState(BL::Job::State state);
       BL::Job::State getState();
+      std::string setStringState(const std::string & state);
 
       enum ThreadState {NOTHING, STARTING}; 
       void setThreadState(BL::Job::ThreadState state);
@@ -80,20 +96,22 @@ namespace BL{
       void setSalomeLauncherId(int id);
       int getSalomeLauncherId();
 
-
     private:
       BL::Job::State _state;
       BL::Job::ThreadState _thread_state;
+      int _dump_yacs_state;
 
       std::string _name;
 
       BL::Job::JobType _type;
-      std::string _yacs_file;
-      std::string _command;
-  
+      std::string _job_file;
+      std::string _env_file;
+
       BL::Job::BatchParam _batch_params;
       BL::Job::FilesParam _files_params;
-      std::string _machine_choosed;
+      std::string _resource_choosed;
+      std::string _batch_queue;
+      std::string _ll_jobtype;
 
       int _salome_launcher_id;
   };
index 985d280a0578ebaa0f8e7dee40accb0fead77126..c7bf40e1796aacbd36ecfefc7d41f390f0a8091d 100644 (file)
@@ -1,30 +1,37 @@
-//  Copyright (C) 2009 CEA/DEN, EDF R&D
+// Copyright (C) 2009-2012  CEA/DEN, EDF R&D
 //
-//  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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #include "BL_JobsManager.hxx"
+#include <sstream>
+
+#ifdef WNT
+#undef ERROR
+#endif
 
 BL::JobsManager::JobsManager(BL::SALOMEServices * salome_services)
 {
   DEBTRACE("Creating BL::JobsManager");
   BL_ASSERT(salome_services);
   _salome_services = salome_services;
+  _salome_services->set_manager(this);
   _observer = NULL;
+  _name_counter = 0;
 }
 
 BL::JobsManager::~JobsManager()
@@ -45,12 +52,13 @@ BL::JobsManager::setObserver(BL::Observer * observer)
 }
 
 BL::Job *
-BL::JobsManager::addNewJob(const std::string & name)
+BL::JobsManager::createJob(const std::string & name)
 {
-  DEBTRACE("addNewJob BL::JobsManager");
+  DEBTRACE("createJob BL::JobsManager");
 
   BL::Job * new_job = NULL;
 
+  _thread_mutex_jobs_map.lock();
   _jobs_it = _jobs.find(name);
   if (_jobs_it == _jobs.end())
   {
@@ -60,15 +68,47 @@ BL::JobsManager::addNewJob(const std::string & name)
     _jobs[name] = new_job;
   }
   else
-    DEBTRACE("addNewJob Error !!!! Job already exist: " << name);
+    DEBTRACE("createJob Error !!!! Job already exist: " << name);
 
+  _thread_mutex_jobs_map.unlock();
   return new_job;
 }
 
+void
+BL::JobsManager::addJobToLauncher(const std::string & name)
+{
+  DEBTRACE("addJobToLauncher BL::JobsManager");
+
+  _thread_mutex_jobs_map.lock();
+  _jobs_it = _jobs.find(name);
+  if (_jobs_it == _jobs.end())
+  {
+    // TODO: SHOULD SEND an exeception...
+    DEBMSG("[addJobToLauncher] failed, job was not found");
+  }
+  std::string result = "";
+  result = _salome_services->create_job(_jobs_it->second);
+
+  // Unlock is here to be sure that
+  // method setSalomeLauncherId is called if
+  // the creation is successfull
+  _thread_mutex_jobs_map.unlock();
+
+  if (_observer)
+    if (result != "")
+    {
+      _jobs_it->second->setState(BL::Job::NOT_CREATED);
+      _observer->sendEvent("create_job", "Error", name, result);
+    }
+    else
+      _observer->sendEvent("create_job", "Ok", name, "");
+}
+
 void
 BL::JobsManager::removeJob(const std::string & name)
 {
   DEBTRACE("removeJob BL::JobsManager");
+  _thread_mutex_jobs_map.lock();
   _jobs_it = _jobs.find(name);
   if (_jobs_it != _jobs.end())
   {
@@ -81,12 +121,13 @@ BL::JobsManager::removeJob(const std::string & name)
 
     if (_observer)
       if (result != "")
-       _observer->sendEvent("delete_job", "Error", name, result);
+        _observer->sendEvent("delete_job", "Error", name, result);
       else
-       _observer->sendEvent("delete_job", "Ok", name, "");
+        _observer->sendEvent("delete_job", "Ok", name, "");
   }
   else
     DEBTRACE("removeJob Error !!!! Job does not exist: " << name);
+  _thread_mutex_jobs_map.unlock();
 }
 
 BL::Job *
@@ -105,78 +146,113 @@ BL::JobsManager::getJobs()
 bool 
 BL::JobsManager::job_already_exist(const std::string & name)
 {
-  _jobs_it = _jobs.find(name);
+  bool result = true;
 
+  _thread_mutex_jobs_map.lock();
+  _jobs_it = _jobs.find(name);
   if (_jobs_it == _jobs.end())
-    return false;
-  else
-    return true;
+    result = false;
+  _thread_mutex_jobs_map.unlock();
 
+  return result;
 }
 
 void
 BL::JobsManager::start_job(const std::string & name)
 {
   DEBTRACE("BL::JobsManager::start_job called for job: " << name);
+  // Prepare Info for thread
+  BL::JobsManager::thread_info * ti = new thread_info();
+  ti->object_ptr = this;
+  ti->job_name = name;
+  omni_thread::create(BL::JobsManager::starting_job_thread, ti);
+
+}
+
+void 
+BL::JobsManager::starting_job_thread(void * object_ptr)
+{
+  DEBTRACE("starting_job_thread BL::JobsManager called");
+  BL::JobsManager::thread_info * ti = reinterpret_cast<BL::JobsManager::thread_info*>(object_ptr);
+  BL::JobsManager * object = ti->object_ptr;
+  std::string job_name =  ti->job_name;
 
   // Check job exits
-  _jobs_it = _jobs.find(name);
-  if (_jobs_it == _jobs.end())
+  object->_thread_mutex_jobs_map.lock();
+  object->_jobs_it = object->_jobs.find(job_name);
+  if (object->_jobs_it == object->_jobs.end())
   {
-    DEBTRACE("BL::JobsManager::start_job job unknown: " << name);
-    return;
+    DEBTRACE("BL::JobsManager::start_job job unknown: " << job_name);
   }
   else
   {
-    _thread_mutex.lock();
-    BL::Job * job = _jobs_it->second; 
-    // Check Job Exec State - multithread protection
-    if (job->getThreadState() == BL::Job::NOTHING)
+    BL::Job * job = object->getJob(job_name);
+    std::string result = object->_salome_services->start_job(job);
+    if (result == "")
     {
-      // Prepare Info for thread
-      BL::JobsManager::thread_info * ti = new thread_info();
-      ti->object_ptr = this;
-      ti->job_name = name;
-      job->setState(BL::Job::IN_PROCESS);
-      job->setThreadState(BL::Job::STARTING);
-      omni_thread::create(BL::JobsManager::starting_job_thread, ti);
+      job->setState(BL::Job::QUEUED);
+      job->setThreadState(BL::Job::NOTHING);
+      if (object->_observer)
+        object->_observer->sendEvent("start_job", "Ok", job_name, "");
     }
     else
     {
-      DEBTRACE("BL::JobsManager::start_job nothin to do, job already starting, job name: " << name);
+      job->setState(BL::Job::ERROR);
+      job->setThreadState(BL::Job::NOTHING);
+      if (object->_observer)
+        object->_observer->sendEvent("start_job", "Error", job_name, result);
     }
-    _thread_mutex.unlock();
+  }
+  object->_thread_mutex_jobs_map.unlock();
+}
+
+void
+BL::JobsManager::stop_job(const std::string & name)
+{
+  DEBTRACE("stop_job BL::JobsManager called");
+
+  _thread_mutex_jobs_map.lock();
+  // Check job exits
+  _jobs_it = _jobs.find(name);
+  if (_jobs_it == _jobs.end())
+  {
+    DEBTRACE("BL::JobsManager::stop_job job unknown: " << name);
+    _thread_mutex_jobs_map.unlock();
+    return;
+  }
+  else
+  {
+    // Prepare Info for thread
+    BL::JobsManager::thread_info * ti = new thread_info();
+    ti->object_ptr = this;
+    ti->job_name = name;
+    omni_thread::create(BL::JobsManager::stop_job_thread, ti);
   }
 }
 
 void 
-BL::JobsManager::starting_job_thread(void * object_ptr)
+BL::JobsManager::stop_job_thread(void * object_ptr)
 {
-  DEBTRACE("starting_job_thread BL::JobsManager called");
+  DEBTRACE("stop_job_thread BL::JobsManager called");
   BL::JobsManager::thread_info * ti = reinterpret_cast<BL::JobsManager::thread_info*>(object_ptr);
   BL::JobsManager * object = ti->object_ptr;
   std::string job_name =  ti->job_name;
   BL::Job * job = object->getJob(job_name);
 
-  std::string result = object->_salome_services->start_job(job);
+  std::string result = object->_salome_services->stop_job(job);
 
-  object->_thread_mutex.lock();
   // End
   if (result == "")
   {
     if (object->_observer)
-      object->_observer->sendEvent("start_job", "Ok", job_name, "");
-    job->setState(BL::Job::QUEUED);
-    job->setThreadState(BL::Job::NOTHING);
+      object->_observer->sendEvent("stop_job", "Ok", job_name, "");
   }
   else
   {
     if (object->_observer)
-      object->_observer->sendEvent("start_job", "Error", job_name, result);
-    job->setState(BL::Job::ERROR);
-    job->setThreadState(BL::Job::NOTHING);
+      object->_observer->sendEvent("stop_job", "Error", job_name, result);
   }
-  object->_thread_mutex.unlock();
+  object->_thread_mutex_jobs_map.unlock();
 }
 
 void
@@ -184,16 +260,17 @@ BL::JobsManager::refresh_jobs()
 {
   DEBTRACE("refresh_jobs BL::JobsManager called");
 
-  omni_thread::create(BL::JobsManager::refresh_job, this);
+  omni_thread::create(BL::JobsManager::refresh_jobs_thread, this);
 }
 
 void
-BL::JobsManager::refresh_job(void * object_ptr)
+BL::JobsManager::refresh_jobs_thread(void * object_ptr)
 {
   DEBTRACE("refresh_job BL::JobsManager called");
   BL::JobsManager * object = reinterpret_cast<BL::JobsManager*>(object_ptr);
 
   //iterate on all jobs
+  object->_thread_mutex_jobs_map.lock();
   _jobs_map::iterator jobs_it;
   jobs_it = object->_jobs.begin();
   for(;jobs_it != object->_jobs.end();jobs_it++)
@@ -201,90 +278,55 @@ BL::JobsManager::refresh_job(void * object_ptr)
     BL::Job * job = jobs_it->second;
     if (job->getSalomeLauncherId() != -1)
     {
-      object->_thread_mutex.lock();
       if (job->getThreadState() == BL::Job::NOTHING)
       {
-       BL::Job::State job_state = job->getState();
-       if (job_state != BL::Job::FINISHED or job_state != BL::Job::ERROR)
-       {
-         std::string result = object->_salome_services->refresh_job(job);
-         if (result == "QUEUED")
-         {
-           if (job_state != BL::Job::QUEUED)
-           {
-             job->setState(BL::Job::QUEUED);
-             if (object->_observer)
-               object->_observer->sendEvent("refresh_job", "Ok", job->getName(), "new state");
-           }
-         }
-         else if (result == "IN_PROCESS")
-         {
-           if (job_state != BL::Job::IN_PROCESS)
-           {
-             job->setState(BL::Job::IN_PROCESS);
-             if (object->_observer)
-               object->_observer->sendEvent("refresh_job", "Ok", job->getName(), "new state");
-           }
-         }
-         else if (result == "RUNNING")
-         {
-           if (job_state != BL::Job::RUNNING)
-           {
-             job->setState(BL::Job::RUNNING);
-             if (object->_observer)
-               object->_observer->sendEvent("refresh_job", "Ok", job->getName(), "new state");
-           }
-         }
-         else if (result == "PAUSED")
-         {
-           if (job_state != BL::Job::PAUSED)
-           {
-             job->setState(BL::Job::PAUSED);
-             if (object->_observer)
-               object->_observer->sendEvent("refresh_job", "Ok", job->getName(), "new state");
-           }
-         }
-         else if (result == "FINISHED")
-         {
-           job->setState(BL::Job::FINISHED);
-           if (object->_observer)
-             object->_observer->sendEvent("refresh_job", "Ok", job->getName(), "new state");
-         }
-         else if (result == "ERROR")
-         {
-           job->setState(BL::Job::ERROR);
-           if (object->_observer)
-             object->_observer->sendEvent("refresh_job", "Ok", job->getName(), "new state");
-         }
-         else
-         {
-           // Error using launcher...
-           if (object->_observer)
-             object->_observer->sendEvent("refresh_job", "Error", job->getName(), result);
-         }
-       }
+        BL::Job::State job_state = job->getState();
+        if (job_state != BL::Job::FINISHED &&
+            job_state != BL::Job::ERROR    &&
+            job_state != BL::Job::FAILED   &&
+            job_state != BL::Job::NOT_CREATED)
+        {
+          std::string result_launcher = object->_salome_services->refresh_job(job);
+          std::string result_job = job->setStringState(result_launcher);
+          if (result_job == "RefreshError")
+          {
+            // Error using launcher...
+            if (object->_observer)
+              object->_observer->sendEvent("refresh_job", "Error", job->getName(), result_launcher);
+          }
+          else if (result_job != "")
+          {
+            if (object->_observer)
+              object->_observer->sendEvent("refresh_job", "Ok", job->getName(), result_job);
+          }
+        }
       }
-      object->_thread_mutex.unlock();
     }
   }
+  object->_thread_mutex_jobs_map.unlock();
 }
 
 void
 BL::JobsManager::get_results_job(const std::string & name)
 {
   DEBTRACE("get_results_job BL::JobsManager called");
-   
+
+  _thread_mutex_jobs_map.lock();
   // Check job exits
   _jobs_it = _jobs.find(name);
   if (_jobs_it == _jobs.end())
   {
     DEBTRACE("BL::JobsManager::get_results_job job unknown: " << name);
+    _thread_mutex_jobs_map.unlock();
     return;
   }
   else
   {
     BL::Job * job = _jobs_it->second; 
-    if (job->getState() == BL::Job::FINISHED)
+    if (job->getState() == BL::Job::FINISHED ||
+        job->getState() == BL::Job::ERROR    ||
+        job->getState() == BL::Job::FAILED
+        )
     {
       // Prepare Info for thread
       BL::JobsManager::thread_info * ti = new thread_info();
@@ -295,6 +337,7 @@ BL::JobsManager::get_results_job(const std::string & name)
     else
     {
       DEBTRACE("BL::JobsManager::get_results_job job bad job state !");
+      _thread_mutex_jobs_map.unlock();
       return;
     }
   }
@@ -309,7 +352,6 @@ BL::JobsManager::get_results_job_thread(void * object_ptr)
   std::string job_name =  ti->job_name;
   BL::Job * job = object->getJob(job_name);
 
-  object->_thread_mutex_results.lock();
   std::string result = object->_salome_services->get_results_job(job);
 
   // End
@@ -323,5 +365,195 @@ BL::JobsManager::get_results_job_thread(void * object_ptr)
     if (object->_observer)
       object->_observer->sendEvent("get_results_job", "Error", job_name, result);
   }
-  object->_thread_mutex_results.unlock();
+  object->_thread_mutex_jobs_map.unlock();
+}
+
+void
+BL::JobsManager::save_jobs(const std::string & xml_file)
+{
+  DEBTRACE("BL::JobsManager::save_jobs called for : " << xml_file);
+
+  // Prepare Info for thread
+  BL::JobsManager::thread_info_file * ti = new thread_info_file();
+  ti->object_ptr = this;
+  ti->file_name = xml_file;
+  omni_thread::create(BL::JobsManager::save_jobs_thread, ti);
+}
+
+void
+BL::JobsManager::load_jobs(const std::string & xml_file)
+{
+  DEBTRACE("BL::JobsManager::load_jobs called for : " << xml_file);
+
+  // Prepare Info for thread
+  BL::JobsManager::thread_info_file * ti = new thread_info_file();
+  ti->object_ptr = this;
+  ti->file_name = xml_file;
+  omni_thread::create(BL::JobsManager::load_jobs_thread, ti);
+}
+
+void
+BL::JobsManager::save_jobs_thread(void * object_ptr)
+{
+  DEBTRACE("save_jobs_thread BL::JobsManager called");
+  BL::JobsManager::thread_info_file * ti = reinterpret_cast<BL::JobsManager::thread_info_file*>(object_ptr);
+  BL::JobsManager * object = ti->object_ptr;
+  std::string file_name =  ti->file_name;
+
+  object->_thread_mutex_jobs_map.lock();
+  std::string result = object->_salome_services->save_jobs(file_name);
+  object->_thread_mutex_jobs_map.unlock();
+
+  if (result != "")
+    if (object->_observer)
+      object->_observer->sendEvent("save_jobs", "Error", "", result);
+}
+
+void
+BL::JobsManager::load_jobs_thread(void * object_ptr)
+{
+  DEBTRACE("load_jobs_thread BL::JobsManager called");
+  BL::JobsManager::thread_info_file * ti = reinterpret_cast<BL::JobsManager::thread_info_file*>(object_ptr);
+  BL::JobsManager * object = ti->object_ptr;
+  std::string file_name =  ti->file_name;
+
+  object->_thread_mutex_jobs_map.lock();
+  std::string result = object->_salome_services->load_jobs(file_name);
+  object->_thread_mutex_jobs_map.unlock();
+
+  if (result != "")
+    if (object->_observer)
+      object->_observer->sendEvent("load_jobs", "Error", "", result);
+}
+
+void
+BL::JobsManager::launcher_event_save_jobs(const std::string & data)
+{
+  if (_observer)
+    _observer->sendEvent("save_jobs", "Ok", "", data);
+}
+
+void
+BL::JobsManager::launcher_event_load_jobs(const std::string & data)
+{
+  if (_observer)
+    _observer->sendEvent("load_jobs", "Ok", "", data);
+}
+
+void
+BL::JobsManager::launcher_event_new_job(const std::string & data)
+{
+  int job_number;
+  std::istringstream job_number_stream(data);
+  if (job_number_stream >> job_number)
+  {
+       DEBTRACE("Receive NEWJOB:" << job_number);
+    BL::JobsManager::thread_info_new_job * ti = new thread_info_new_job();
+    ti->object_ptr = this;
+    ti->job_number = job_number;
+    omni_thread::create(BL::JobsManager::launcher_event_new_job_thread, ti);
+  }
+}
+
+void
+BL::JobsManager::launcher_event_update_job_state(const std::string & data)
+{
+  refresh_jobs();
+}
+
+void
+BL::JobsManager::launcher_event_new_job_thread(void * object_ptr)
+{
+  DEBTRACE("Start of BL::JobsManager::launcher_event_new_job_thread");
+  BL::JobsManager::thread_info_new_job * ti = reinterpret_cast<BL::JobsManager::thread_info_new_job*>(object_ptr);
+  BL::JobsManager * object = ti->object_ptr;
+  int job_number =  ti->job_number;
+
+  object->_thread_mutex_jobs_map.lock();
+
+  // 1: Check if job is not already on our map
+  bool job_in_map = false;
+  _jobs_map::iterator jobs_it;
+  jobs_it = object->_jobs.begin();
+  for(;jobs_it != object->_jobs.end();jobs_it++)
+  {
+    BL::Job * job = jobs_it->second;
+    if (job->getSalomeLauncherId() == job_number)
+      job_in_map = true;
+  }
+
+  if (!job_in_map)
+  {
+    // 2: We try to get job informations
+
+    BL::Job * new_job = object->_salome_services->get_new_job(job_number);
+
+    // 3: We add it
+    if (new_job)
+    {
+      // 4: Check if job has a name or if the name already exists
+      if (new_job->getName() == "")
+      {
+        std::ostringstream name_stream;
+        name_stream << "no_name_" << object->_name_counter;
+        object->_name_counter++;
+        new_job->setName(name_stream.str());
+      }
+
+      _jobs_map::iterator _jobs_it_name = object->_jobs.find(new_job->getName());
+      if (_jobs_it_name != object->_jobs.end())
+      {
+        std::ostringstream name_stream;
+        name_stream << new_job->getName() << "_" << object->_name_counter;
+        object->_name_counter++;
+        new_job->setName(name_stream.str());
+      }
+      // 5: Insert job
+      object->_jobs[new_job->getName()] = new_job;
+      if (object->_observer)
+        object->_observer->sendEvent("add_job", "Ok", new_job->getName(), "");
+    }
+  }
+
+  object->_thread_mutex_jobs_map.unlock();
+}
+
+void
+BL::JobsManager::launcher_event_remove_job(const std::string & data)
+{
+  int job_number;
+  std::istringstream job_number_stream(data);
+  if (job_number_stream >> job_number)
+  {
+    BL::JobsManager::thread_info_new_job * ti = new thread_info_new_job();
+    ti->object_ptr = this;
+    ti->job_number = job_number;
+    omni_thread::create(BL::JobsManager::launcher_event_remove_job_thread, ti);
+  }
+}
+
+void
+BL::JobsManager::launcher_event_remove_job_thread(void * object_ptr)
+{
+  DEBTRACE("Start of BL::JobsManager::launcher_event_remove_job_thread");
+  BL::JobsManager::thread_info_new_job * ti = reinterpret_cast<BL::JobsManager::thread_info_new_job*>(object_ptr);
+  BL::JobsManager * object = ti->object_ptr;
+  int job_number =  ti->job_number;
+
+  object->_thread_mutex_jobs_map.lock();
+
+  _jobs_map::iterator jobs_it;
+  jobs_it = object->_jobs.begin();
+  for(;jobs_it != object->_jobs.end();jobs_it++)
+  {
+    BL::Job * job = jobs_it->second;
+    if (job->getSalomeLauncherId() == job_number)
+    {
+      job->setSalomeLauncherId(-1);
+      if (object->_observer)
+        object->_observer->sendEvent("to_remove_job", "Ok", job->getName(), "");
+    }
+  }
+
+  object->_thread_mutex_jobs_map.unlock();
 }
index 675a5ab8547b5c47b041f0e2d814259d104825d8..180d40ff37a37fad9eee3e080fa94c4ef7da2b2a 100644 (file)
@@ -1,25 +1,26 @@
-//  Copyright (C) 2009 CEA/DEN, EDF R&D
+// Copyright (C) 2009-2012  CEA/DEN, EDF R&D
 //
-//  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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #ifndef _BL_JOBSMANAGER_HXX_
 #define _BL_JOBSMANAGER_HXX_
 
+#include "BL_Engine.hxx"
 #include "BL_Job.hxx"
 #include "BL_SALOMEServices.hxx"
 #include "BL_Traces.hxx"
 
 namespace BL{
 
-  class JobsManager
+  class SALOMEServices;
+
+  class BL_Engine_EXPORT JobsManager
   {
     public:
       JobsManager(BL::SALOMEServices * salome_services);
       virtual ~JobsManager();
 
+      // Add QT observer
       void setObserver(BL::Observer * observer);
 
-      BL::Job * addNewJob(const std::string & name);
-      void removeJob(const std::string & name);
-
+      // useful methods
+      BL::Job * createJob(const std::string & name);
       BL::Job * getJob(const std::string & name);
       std::map<std::string, BL::Job *> & getJobs();
-
       bool job_already_exist(const std::string & name);
 
-      virtual void start_job(const std::string & name);
-      virtual void refresh_jobs();
-      virtual void get_results_job(const std::string & name);
+      // remote methods
+      void addJobToLauncher(const std::string & name);
+      void removeJob(const std::string & name);
 
+      virtual void start_job(const std::string & name);
       static void starting_job_thread(void * object_ptr);
+
+      virtual void stop_job(const std::string & name);
+      static void stop_job_thread(void * object_ptr);
+
+      virtual void get_results_job(const std::string & name);
       static void get_results_job_thread(void * object_ptr);
-      static void refresh_job(void * object_ptr);
+
+      virtual void refresh_jobs();
+      static void refresh_jobs_thread(void * object_ptr);
+
+      virtual void load_jobs(const std::string & xml_file);
+      virtual void save_jobs(const std::string & xml_file);
+      static void load_jobs_thread(void * object_ptr);
+      static void save_jobs_thread(void * object_ptr);
+
+      // event from launcher
+      void launcher_event_save_jobs(const std::string & data);
+      void launcher_event_load_jobs(const std::string & data);
+      void launcher_event_new_job(const std::string & data);
+      static void launcher_event_new_job_thread(void * object_ptr);
+      void launcher_event_remove_job(const std::string & data);
+      static void launcher_event_remove_job_thread(void * object_ptr);
+      void launcher_event_update_job_state(const std::string & data);
 
       struct thread_info
       {
-       BL::JobsManager * object_ptr;
-       std::string job_name;
+        BL::JobsManager * object_ptr;
+        std::string job_name;
+      };
+
+      struct thread_info_file
+      {
+        BL::JobsManager * object_ptr;
+        std::string file_name;
+      };
+
+      struct thread_info_new_job
+      {
+        BL::JobsManager * object_ptr;
+        int job_number;
       };
 
     protected:
@@ -71,8 +107,11 @@ namespace BL{
       _jobs_map _jobs;
       _jobs_map::iterator _jobs_it;
 
-      omni_mutex _thread_mutex;
-      omni_mutex _thread_mutex_results;
+      // Mutex used for the jobs map
+      omni_mutex _thread_mutex_jobs_map;
+
+      // To avoid two jobs with the same name
+      int _name_counter;
   };
 
 }
diff --git a/src/engine/BL_Observer.hxx b/src/engine/BL_Observer.hxx
new file mode 100644 (file)
index 0000000..eb42870
--- /dev/null
@@ -0,0 +1,41 @@
+// Copyright (C) 2009-2012  CEA/DEN, EDF R&D
+//
+// 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_OBSERVER_HXX_
+#define _BL_OBSERVER_HXX_
+
+#include <string>
+
+namespace BL{
+
+  class Observer
+  {
+    public:
+      Observer() {};
+      virtual ~Observer() {};
+
+      virtual void sendEvent(const std::string & action,
+                             const std::string & event_name,
+                             const std::string & job_name,
+                             const std::string & data) = 0;
+  };
+
+}
+
+#endif
index 8f6a9d0703f251b7fa079530da78b0a3e210e65e..273c51737bc815fb8542c89ad42f14faf066ebe5 100644 (file)
@@ -1,23 +1,38 @@
-//  Copyright (C) 2009 CEA/DEN, EDF R&D
+// Copyright (C) 2009-2012  CEA/DEN, EDF R&D
 //
-//  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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #include "BL_SALOMEServices.hxx"
+#include <sstream>
+
+static std::ostream & 
+operator<<(std::ostream & os, const CORBA::Exception & e)
+{
+  CORBA::Any tmp;
+  tmp <<=e ;
+  CORBA::TypeCode_var tc = tmp.type();
+  const char * p = tc->name ();
+  if (*p != '\0')
+    os << p;
+  else
+    os << tc->id();
+  return os;
+}
 
 BL::SALOMEServices::SALOMEServices()
 {
@@ -26,10 +41,16 @@ BL::SALOMEServices::SALOMEServices()
   _salome_naming_service = NULL;
   _lcc = NULL;
   _state = false;
+  _manager = NULL;
 }
 
-BL::SALOMEServices::~SALOMEServices()
+BL::SALOMEServices::~SALOMEServices() {}
+
+void
+BL::SALOMEServices::end()
 {
+  if (!CORBA::is_nil(_salome_launcher))
+    _salome_launcher->removeObserver(_this());
   if (_salome_naming_service)
     delete _salome_naming_service;
   if (_lcc)
@@ -47,15 +68,17 @@ BL::SALOMEServices::initNS()
 
   if (CORBA::is_nil(_salome_launcher))
   {
-    DEBTRACE("SALOME Launcher is not reachable!")
+    DEBMSG("SALOME Launcher is not reachable!")
     return_value = false;
   }
+  _salome_launcher->addObserver(_this());
+  _remove_ref(); // POA will automatically destroy the object
 
   obj = _salome_naming_service->Resolve("/ResourcesManager");
   _resources_manager = Engines::ResourcesManager::_narrow(obj);
   if (CORBA::is_nil(_resources_manager))
   {
-    DEBTRACE("SALOME Resource Manager is not reachable !");
+    DEBMSG("SALOME Resource Manager is not reachable !");
     return_value = false;
   }
 
@@ -64,107 +87,306 @@ BL::SALOMEServices::initNS()
 }
 
 std::list<std::string> 
-BL::SALOMEServices::getMachineList()
+BL::SALOMEServices::getResourceList()
 {
-  std::list<std::string> machine_list;
+  std::list<std::string> resource_list;
   
   if (_state)
   {
-    Engines::MachineParameters params;
+    Engines::ResourceParameters params;
     _lcc->preSet(params);
-    Engines::MachineList * machineList = _resources_manager->GetFittingResources(params);
-    for (int i = 0; i < machineList->length(); i++)
+    Engines::ResourceList * resourceList = NULL;
+    try
+    {
+      resourceList = _resources_manager->GetFittingResources(params);
+    }
+    catch (const SALOME::SALOME_Exception & ex)
+    {
+      DEBMSG("SALOME Exception in addResource ! " << ex.details.text.in());
+    }
+    catch (const CORBA::SystemException& ex)
+    {
+      DEBMSG("Receive SALOME System Exception: " << ex);
+      DEBMSG("Check SALOME servers...");
+    }
+    if (resourceList)
+    {
+      for (int i = 0; i < resourceList->length(); i++)
+      {
+        const char* aResource = (*resourceList)[i];
+        resource_list.push_back(aResource);
+      }
+      delete resourceList;
+    }
+  }
+  return resource_list;
+}
+
+BL::ResourceDescr
+BL::SALOMEServices::getResourceDescr(const std::string& name)
+{
+  Engines::ResourceDefinition * resource_definition = NULL;
+  BL::ResourceDescr resource_descr;
+
+  try 
+  {
+    resource_definition = _resources_manager-> GetResourceDefinition(name.c_str());
+  }
+  catch (const SALOME::SALOME_Exception & ex)
+  {
+    DEBMSG("SALOME Exception in addResource ! " << ex.details.text.in());
+  }
+  catch (const CORBA::SystemException& ex)
+  {
+    DEBMSG("Receive SALOME System Exception: " << ex);
+    DEBMSG("Check SALOME servers...");
+  }
+
+  if(resource_definition)
+  {
+    resource_descr.name = resource_definition->name.in();
+    resource_descr.hostname = resource_definition->hostname.in();
+    resource_descr.protocol = resource_definition->protocol.in();
+    resource_descr.username = resource_definition->username.in();
+    resource_descr.applipath = resource_definition->applipath.in();
+    for (int i = 0; i < resource_definition->componentList.length(); i++)
     {
-      const char* aMachine = (*machineList)[i];
-      machine_list.push_back(aMachine);
+      resource_descr.componentList.push_back(resource_definition->componentList[i].in());
     }
+
+    resource_descr.OS = resource_definition->OS.in();
+    resource_descr.mem_mb = resource_definition->mem_mb;
+    resource_descr.cpu_clock = resource_definition->cpu_clock;
+    resource_descr.nb_node = resource_definition->nb_node;
+    resource_descr.nb_proc_per_node = resource_definition->nb_proc_per_node;
+    resource_descr.batch = resource_definition->batch.in();
+    resource_descr.mpiImpl = resource_definition->mpiImpl.in();
+    resource_descr.iprotocol = resource_definition->iprotocol.in();
+    resource_descr.is_cluster_head = resource_definition->is_cluster_head;
+    resource_descr.working_directory = resource_definition->working_directory.in();
+
+    delete resource_definition;
+  }
+  return resource_descr;
+}
+
+void
+BL::SALOMEServices::addResource(BL::ResourceDescr & new_resource)
+{
+  Engines::ResourceDefinition_var resource_definition = new Engines::ResourceDefinition;
+
+  resource_definition->name = CORBA::string_dup(new_resource.name.c_str());
+  resource_definition->hostname = CORBA::string_dup(new_resource.hostname.c_str());
+  resource_definition->protocol = CORBA::string_dup(new_resource.protocol.c_str());
+  resource_definition->username = CORBA::string_dup(new_resource.username.c_str());
+  resource_definition->applipath = CORBA::string_dup(new_resource.applipath.c_str());
+
+  int i = 0;
+  std::list<std::string>::iterator it = new_resource.componentList.begin();
+  resource_definition->componentList.length(new_resource.componentList.size());
+  for(; it != new_resource.componentList.end(); it++)
+  {
+    resource_definition->componentList[i] = CORBA::string_dup((*it).c_str());
+    i++;
   }
 
-  return machine_list;
+  resource_definition->OS = CORBA::string_dup(new_resource.OS.c_str());
+  resource_definition->mem_mb = new_resource.mem_mb;
+  resource_definition->cpu_clock = new_resource.cpu_clock;
+  resource_definition->nb_node = new_resource.nb_node;
+  resource_definition->nb_proc_per_node = new_resource.nb_proc_per_node;  
+  resource_definition->batch = CORBA::string_dup(new_resource.batch.c_str());
+  resource_definition->mpiImpl = CORBA::string_dup(new_resource.mpiImpl.c_str());
+  resource_definition->iprotocol = CORBA::string_dup(new_resource.iprotocol.c_str());
+  resource_definition->is_cluster_head = new_resource.is_cluster_head;
+  resource_definition->working_directory = CORBA::string_dup(new_resource.working_directory.c_str());
+
+  try
+  {
+    _resources_manager->AddResource(resource_definition, true, "");
+  }
+  catch (const SALOME::SALOME_Exception & ex)
+  {
+    DEBMSG("SALOME Exception in addResource ! " << ex.details.text.in());
+  }
+  catch (const CORBA::SystemException& ex)
+  {
+    DEBMSG("Receive SALOME System Exception: " << ex);
+    DEBMSG("Check SALOME servers...");
+  }
 }
 
-std::string
-BL::SALOMEServices::start_job(BL::Job * job)
+void 
+BL::SALOMEServices::removeResource(const std::string & name)
 {
-  return start_yacs_job(job);
+  try
+  {
+    _resources_manager->RemoveResource(name.c_str(), true, "");
+  }
+  catch (const SALOME::SALOME_Exception & ex)
+  {
+    DEBMSG("SALOME Exception in removeResource ! " << ex.details.text.in());
+  }
+  catch (const CORBA::SystemException& ex)
+  {
+    DEBMSG("Receive SALOME System Exception: " << ex);
+    DEBMSG("Check SALOME servers...");
+  }
 }
 
 std::string
-BL::SALOMEServices::start_yacs_job(BL::Job * job)
+BL::SALOMEServices::create_job(BL::Job * job)
 {
+  DEBMSG("Begin of create_job");
   std::string ret = "";
-  // Prepare Arguments
-  const char * fileToExecute = job->getYACSFile().c_str();
+  Engines::JobParameters_var job_parameters = new Engines::JobParameters;
+
+  // Job type
+  if (job->getType() == BL::Job::COMMAND)
+  {
+    job_parameters->job_type = CORBA::string_dup("command");
+  }
+  else if (job->getType() == BL::Job::YACS_SCHEMA)
+  {
+    job_parameters->job_type = CORBA::string_dup("yacs_file");
+  }
+  else if (job->getType() == BL::Job::PYTHON_SALOME)
+  {
+    job_parameters->job_type = CORBA::string_dup("python_salome");
+  }
+
+  // Specific parameters
+  if (job->getType() == BL::Job::YACS_SCHEMA)
+  {
+    if (job->getDumpYACSState() > 0)
+    {
+      job_parameters->specific_parameters.length(job_parameters->specific_parameters.length() + 1);
+      std::ostringstream oss;
+      oss << job->getDumpYACSState();
+      Engines::Parameter_var new_parameter = new Engines::Parameter;
+      new_parameter->name = CORBA::string_dup("EnableDumpYACS");
+      new_parameter->value = CORBA::string_dup(oss.str().c_str());
+      job_parameters->specific_parameters[job_parameters->specific_parameters.length() - 1] = new_parameter;
+    }
+  }
+  if (job->getLoadLevelerJobType() != "")
+  {
+    job_parameters->specific_parameters.length(job_parameters->specific_parameters.length() + 1);
+    Engines::Parameter_var new_parameter = new Engines::Parameter;
+    new_parameter->name = CORBA::string_dup("LoalLevelerJobType");
+    new_parameter->value = CORBA::string_dup(job->getLoadLevelerJobType().c_str());
+    job_parameters->specific_parameters[job_parameters->specific_parameters.length() - 1] = new_parameter;
+  }
 
+  // Files
+  job_parameters->job_name = CORBA::string_dup(job->getName().c_str());
+  job_parameters->job_file = CORBA::string_dup(job->getJobFile().c_str());
+  job_parameters->env_file = CORBA::string_dup(job->getEnvFile().c_str());
   BL::Job::FilesParam files = job->getFilesParameters();
-  Engines::FilesList_var filesToExport = new Engines::FilesList;
-  filesToExport->length(files.input_files_list.size());
   std::list<std::string>::iterator it;
   int i = 0;
-  for (it=files.input_files_list.begin() ; it != files.input_files_list.end(); it++)
+  int j = 0;
+
+  job_parameters->in_files.length(files.input_files_list.size());
+  for (it = files.input_files_list.begin() ; it != files.input_files_list.end(); it++)
   {
-    filesToExport[i] = CORBA::string_dup((*it).c_str());
+    job_parameters->in_files[i] = CORBA::string_dup((*it).c_str());
     i++;
   }
-  Engines::FilesList_var filesToImport = new Engines::FilesList;
-  filesToImport->length(files.output_files_list.size());
-  i = 0;
-  for (it=files.output_files_list.begin() ; it != files.output_files_list.end(); it++)
+
+  job_parameters->out_files.length(files.output_files_list.size());
+  for (it = files.output_files_list.begin() ; it != files.output_files_list.end(); it++)
   {
-    filesToImport[i] = CORBA::string_dup((*it).c_str());
-    i++;
+    job_parameters->out_files[j] = CORBA::string_dup((*it).c_str());
+    j++;
   }
+  job_parameters->local_directory = CORBA::string_dup("");
+  job_parameters->result_directory = CORBA::string_dup(files.result_directory.c_str());
 
   BL::Job::BatchParam cpp_batch_params =  job->getBatchParameters();
-  Engines::BatchParameters_var batch_params = new Engines::BatchParameters;
-  batch_params->batch_directory = CORBA::string_dup(cpp_batch_params.batch_directory.c_str());
-  batch_params->expected_during_time = CORBA::string_dup(cpp_batch_params.expected_during_time.c_str());
-  batch_params->mem = CORBA::string_dup(cpp_batch_params.expected_memory.c_str());
-  batch_params->nb_proc = cpp_batch_params.nb_proc;
+  job_parameters->work_directory = CORBA::string_dup(cpp_batch_params.batch_directory.c_str());
+
+  // Resource
+  job_parameters->maximum_duration = CORBA::string_dup(cpp_batch_params.maximum_duration.c_str());
+  job_parameters->resource_required.name = CORBA::string_dup(job->getResource().c_str());
+  job_parameters->resource_required.nb_proc = cpp_batch_params.nb_proc;
+  job_parameters->queue = CORBA::string_dup(job->getBatchQueue().c_str());
 
-  Engines::MachineParameters_var machine = new Engines::MachineParameters;
-  machine->hostname = CORBA::string_dup(job->getMachine().c_str());
+  // Memory
+  CORBA::Long memory;
+  std::string ram = cpp_batch_params.expected_memory.substr(0,cpp_batch_params.expected_memory.size()-2);
+  std::istringstream iss(ram);
+  iss >> memory;
+  std::string unity = cpp_batch_params.expected_memory.substr(cpp_batch_params.expected_memory.size()-2, 2);
+  if((unity.find("gb") != std::string::npos))
+    memory = memory * 1024;
+  job_parameters->resource_required.mem_mb = memory;
 
-  // Start Job !
+  // Create Job
   try
   {
-    int job_id = _salome_launcher->submitSalomeJob(fileToExecute, filesToExport,
-                                                  filesToImport, batch_params, machine);
+    int job_id = _salome_launcher->createJob(job_parameters);
     job->setSalomeLauncherId(job_id);
   }
   catch (const SALOME::SALOME_Exception & ex)
   {
-    DEBTRACE("SALOME Exception in submitSalomeJob !");
+    DEBMSG("SALOME Exception in createJob !");
     ret = ex.details.text.in();
   }
+  catch (const CORBA::SystemException& ex)
+  {
+    DEBMSG("Receive SALOME System Exception: " << ex);
+    DEBMSG("Check SALOME servers...");
+    ret = "SALOME System Exception - see logs";
+  }
   return ret;
 }
 
 std::string
-BL::SALOMEServices::refresh_job(BL::Job * job)
+BL::SALOMEServices::start_job(BL::Job * job)
 {
   std::string ret = "";
+  // Launch Job !
+  try
+  {
+    _salome_launcher->launchJob(job->getSalomeLauncherId());
+  }
+  catch (const SALOME::SALOME_Exception & ex)
+  {
+    DEBMSG("SALOME Exception in launchJob !");
+    ret = ex.details.text.in();
+  }
+  catch (const CORBA::SystemException& ex)
+  {
+    DEBMSG("Receive SALOME System Exception: " << ex);
+    DEBMSG("Check SALOME servers...");
+    ret = "SALOME System Exception - see logs";
+  }
+  return ret;
+}
 
-  Engines::MachineParameters_var machine = new Engines::MachineParameters;
-  machine->hostname = CORBA::string_dup(job->getMachine().c_str());
+std::string
+BL::SALOMEServices::refresh_job(BL::Job * job)
+{
+  std::string ret = "";
 
   // Refresh Job !
   try
   {
-    CORBA::String_var result = _salome_launcher->queryJob(job->getSalomeLauncherId(), machine);
-    std::string res = result.in();
-    if (res == "Running")
-      return "RUNNING";
-    else if (res == "Done")
-      return "FINISHED";
-    else
-      return result.in();
+    CORBA::String_var result = _salome_launcher->getJobState(job->getSalomeLauncherId());
+    ret = result.in();
   }
   catch (const SALOME::SALOME_Exception & ex)
   {
-    DEBTRACE("SALOME Exception in refresh_job !");
+    DEBMSG("SALOME Exception in getJobState !");
     ret = ex.details.text.in();
   }
+  catch (const CORBA::SystemException& ex)
+  {
+    DEBMSG("Receive SALOME System Exception: " << ex);
+    DEBMSG("Check SALOME servers...");
+    ret = "SALOME System Exception - see logs";
+  }
   return ret;
 }
 
@@ -172,30 +394,51 @@ std::string
 BL::SALOMEServices::delete_job(BL::Job * job)
 {
   std::string ret = "";
-
-  Engines::MachineParameters_var machine = new Engines::MachineParameters;
-  machine->hostname = CORBA::string_dup(job->getMachine().c_str());
-
   // Delete Job !
   try
   {
-    _salome_launcher->deleteJob(job->getSalomeLauncherId(), machine);
+    _salome_launcher->removeJob(job->getSalomeLauncherId());
   }
   catch (const SALOME::SALOME_Exception & ex)
   {
-    DEBTRACE("SALOME Exception in refresh_job !");
+    DEBMSG("SALOME Exception in removeJob !");
     ret = ex.details.text.in();
   }
+  catch (const CORBA::SystemException& ex)
+  {
+    DEBMSG("Receive SALOME System Exception: " << ex);
+    DEBMSG("Check SALOME servers...");
+    ret = "SALOME System Exception - see logs";
+  }
   return ret;
 }
 
 std::string
-BL::SALOMEServices::get_results_job(BL::Job * job)
+BL::SALOMEServices::stop_job(BL::Job * job)
 {
   std::string ret = "";
+  try
+  {
+    _salome_launcher->stopJob(job->getSalomeLauncherId());
+  }
+  catch (const SALOME::SALOME_Exception & ex)
+  {
+    DEBMSG("SALOME Exception in stopJob !");
+    ret = ex.details.text.in();
+  }
+  catch (const CORBA::SystemException& ex)
+  {
+    DEBMSG("Receive SALOME System Exception: " << ex);
+    DEBMSG("Check SALOME servers...");
+    ret = "SALOME System Exception - see logs";
+  }
+  return ret;
+}
 
-  Engines::MachineParameters_var machine = new Engines::MachineParameters;
-  machine->hostname = CORBA::string_dup(job->getMachine().c_str());
+std::string
+BL::SALOMEServices::get_results_job(BL::Job * job)
+{
+  std::string ret = "";
 
   BL::Job::FilesParam files = job->getFilesParameters();
   CORBA::String_var directory = CORBA::string_dup(files.result_directory.c_str());
@@ -203,12 +446,182 @@ BL::SALOMEServices::get_results_job(BL::Job * job)
   // get job results !
   try
   {
-    _salome_launcher->getResultsJob(directory, job->getSalomeLauncherId(), machine);
+    _salome_launcher->getJobResults(job->getSalomeLauncherId(), directory);
+  }
+  catch (const SALOME::SALOME_Exception & ex)
+  {
+    DEBMSG("SALOME Exception in refresh_job !");
+    ret = ex.details.text.in();
+  }
+  catch (const CORBA::SystemException& ex)
+  {
+    DEBMSG("Receive SALOME System Exception: " << ex);
+    DEBMSG("Check SALOME servers...");
+    ret = "SALOME System Exception - see logs";
+  }
+  return ret;
+}
+
+std::string
+BL::SALOMEServices::save_jobs(const std::string & file_name)
+{
+  CORBA::String_var file = CORBA::string_dup(file_name.c_str());
+  std::string ret = "";
+  try
+  {
+    _salome_launcher->saveJobs(file);
   }
   catch (const SALOME::SALOME_Exception & ex)
   {
-    DEBTRACE("SALOME Exception in refresh_job !");
+    DEBMSG("SALOME Exception in saveJobs !");
     ret = ex.details.text.in();
   }
+  catch (const CORBA::SystemException& ex)
+  {
+    DEBMSG("Receive CORBA System Exception: " << ex);
+    DEBMSG("Check SALOME servers...");
+    ret = "CORBA System Exception - see SALOME logs";
+  }
   return ret;
 }
+
+std::string
+BL::SALOMEServices::load_jobs(const std::string & file_name)
+{
+  CORBA::String_var file = CORBA::string_dup(file_name.c_str());
+  std::string ret = "";
+  try
+  {
+    _salome_launcher->loadJobs(file);
+  }
+  catch (const SALOME::SALOME_Exception & ex)
+  {
+    DEBMSG("SALOME Exception in loadJobs !");
+    ret = ex.details.text.in();
+  }
+  catch (const CORBA::SystemException& ex)
+  {
+    DEBMSG("Receive CORBA System Exception: " << ex);
+    DEBMSG("Check SALOME servers...");
+    ret = "CORBA System Exception - see SALOME logs";
+  }
+  return ret;
+}
+
+void
+BL::SALOMEServices::notify(const char* event_name, const char * event_data)
+{
+  DEBMSG("Launcher event received " << event_name << " " << event_data);
+
+  std::string event(event_name);
+  std::string data(event_data);
+
+  if (event == "SAVE_JOBS")
+  {
+    _manager->launcher_event_save_jobs(data);
+  }
+  else if (event == "LOAD_JOBS")
+  {
+    _manager->launcher_event_load_jobs(data);
+  }
+  else if (event == "NEW_JOB")
+  {
+    _manager->launcher_event_new_job(data);
+  }
+  else if (event == "REMOVE_JOB")
+  {
+    _manager->launcher_event_remove_job(data);
+  }
+  else if (event == "UPDATE_JOB_STATE")
+  {
+    _manager->launcher_event_update_job_state(data);
+  }
+  else
+  {
+    DEBMSG("Unkown launcher event received");
+  }
+}
+
+BL::Job * 
+BL::SALOMEServices::get_new_job(int job_number)
+{
+  DEBMSG("Start of BL::SALOMEServices::get_new_job");
+  BL::Job * job_return = NULL;
+  Engines::JobParameters * job_parameters = NULL;
+  try
+  {
+    job_parameters = _salome_launcher->getJobParameters(job_number);
+  }
+  catch (const SALOME::SALOME_Exception & ex)
+  {
+    DEBMSG("SALOME Exception in saveJobs !");
+  }
+  catch (const CORBA::SystemException& ex)
+  {
+    DEBMSG("Receive CORBA System Exception: " << ex);
+    DEBMSG("Check SALOME servers...");
+  }
+
+  if (job_parameters)
+  {
+    job_return = new BL::Job();
+    job_return->setSalomeLauncherId(job_number);
+
+    job_return->setName(job_parameters->job_name.in());
+    job_return->setType(job_parameters->job_type.in());
+    job_return->setJobFile(job_parameters->job_file.in());
+    job_return->setEnvFile(job_parameters->env_file.in());
+    job_return->setBatchQueue(job_parameters->queue.in());
+
+    BL::Job::FilesParam param;
+    param.result_directory = job_parameters->result_directory.in();
+    for (CORBA::ULong i = 0; i < job_parameters->in_files.length(); i++)
+      param.input_files_list.push_back(job_parameters->in_files[i].in());
+    for (CORBA::ULong i = 0; i < job_parameters->out_files.length(); i++)
+      param.output_files_list.push_back(job_parameters->out_files[i].in());
+    job_return->setFilesParameters(param);
+
+    BL::Job::BatchParam batch_param;
+    batch_param.batch_directory = job_parameters->work_directory.in();
+    batch_param.maximum_duration = job_parameters->maximum_duration.in();
+    batch_param.nb_proc = job_parameters->resource_required.nb_proc;
+    std::ostringstream mem_stream;
+    mem_stream << job_parameters->resource_required.mem_mb << "mb";
+    batch_param.expected_memory = mem_stream.str();
+    job_return->setBatchParameters(batch_param);
+
+    job_return->setResource(job_parameters->resource_required.name.in());
+
+    // Specific parameters
+    for (CORBA::ULong i = 0; i < job_parameters->specific_parameters.length(); i++)
+    {
+      if (std::string(job_parameters->specific_parameters[i].name.in()) == "EnableDumpYACS")
+      {
+        std::string user_value = job_parameters->specific_parameters[i].value.in();
+        std::istringstream iss(user_value);
+        int value;
+        iss >> value;
+        job_return->setDumpYACSState(value);
+      }
+      if (std::string(job_parameters->specific_parameters[i].name.in()) == "LoalLevelerJobType")
+      {
+        std::string user_value = job_parameters->specific_parameters[i].value.in();
+        job_return->setLoadLevelerJobType(user_value);
+      }
+    }
+
+    // Get current state
+    std::string result_job = job_return->setStringState(refresh_job(job_return));
+    if (result_job != "RefreshError") {}
+    else
+    {
+      // Error in getting state
+      DEBMSG("Error in getting state of the new job!");
+      delete job_return;
+      job_return = NULL;
+    }
+    delete job_parameters;
+  }
+
+  return job_return;
+}
index f5e597d673863c10783b3c552b87016d6c1c5dd2..f3500cc06e0f0854572a6046c4f3bf7c73bd424f 100644 (file)
@@ -1,55 +1,97 @@
-//  Copyright (C) 2009 CEA/DEN, EDF R&D
+// Copyright (C) 2009-2012  CEA/DEN, EDF R&D
 //
-//  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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #ifndef _BL_SALOMESERVICES_HXX_
 #define _BL_SALOMESERVICES_HXX_
 
+#include "BL_Engine.hxx"
 #include "BL_Traces.hxx"
 #include "BL_Job.hxx"
 
 #include "SALOME_NamingService.hxx"
 #include "SALOME_LifeCycleCORBA.hxx"
 #include "SALOME_ContainerManager.hh"
+#include "BL_JobsManager.hxx"
 
 #include <map>
 #include <list>
 #include <string>
 
+#include "JOBMANAGER_IDL.hh"
+
+
 namespace BL{
 
-  class SALOMEServices
+  class JobsManager;
+
+  struct BL_Engine_EXPORT ResourceDescr
+  {
+    std::string name;
+    std::string hostname;
+    std::string protocol;
+    std::string username;
+    std::string applipath;
+    std::list<std::string> componentList;
+
+    std::string OS;
+    unsigned int mem_mb;
+    unsigned int cpu_clock;
+    unsigned int nb_node;
+    unsigned int nb_proc_per_node;
+    std::string batch;
+    std::string mpiImpl;
+    std::string iprotocol;
+
+    bool is_cluster_head;
+    std::string working_directory;
+  };
+
+  class BL_Engine_EXPORT SALOMEServices :
+    public POA_JOBMANAGER::LauncherObserver
   {
     public:
       SALOMEServices();
       virtual ~SALOMEServices();
 
       bool initNS();
+      void end();
+
+      void set_manager(BL::JobsManager * manager) {_manager = manager;}
+
+      std::list<std::string> getResourceList();
+      BL::ResourceDescr getResourceDescr(const std::string& name);
+      void addResource(BL::ResourceDescr & new_resource);
+      void removeResource(const std::string & name);
 
-      std::list<std::string> getMachineList();
+      std::string save_jobs(const std::string & file_name);
+      std::string load_jobs(const std::string & file_name);
 
+      std::string create_job(BL::Job * job);
       std::string start_job(BL::Job * job);
       std::string refresh_job(BL::Job * job);
       std::string delete_job(BL::Job * job);
+      std::string stop_job(BL::Job * job);
       std::string get_results_job(BL::Job * job);
 
-    protected:
-      std::string start_yacs_job(BL::Job * job);
+      BL::Job * get_new_job(int job_number);
+
+      virtual void notify(const char* event_name, const char * event_data);
 
     private:
       CORBA::ORB_var _orb;
@@ -58,6 +100,8 @@ namespace BL{
       Engines::SalomeLauncher_var _salome_launcher;
       Engines::ResourcesManager_var _resources_manager;
 
+      BL::JobsManager * _manager;
+
       bool _state;
   };
 
diff --git a/src/engine/Makefile.am b/src/engine/Makefile.am
new file mode 100644 (file)
index 0000000..98f4e2f
--- /dev/null
@@ -0,0 +1,37 @@
+# Copyright (C) 2009-2012  CEA/DEN, EDF R&D
+#
+# 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
+#
+
+libdir = $(prefix)/lib/salome
+
+lib_LTLIBRARIES = libBL_Engine.la
+
+libBL_Engine_la_SOURCES = BL_Engine.hxx BL_JobsManager.hxx BL_JobsManager.cxx \
+                         BL_Job.hxx BL_Job.cxx \
+                         BL_SALOMEServices.hxx BL_SALOMEServices.cxx \
+                         BL_Observer.hxx
+
+libBL_Engine_la_CXXFLAGS = -I$(top_srcdir)/src/bases \
+                          $(OMNIORB_INCLUDES) $(OMNIORB_CXXFLAGS) \
+                          -I$(KERNEL_ROOT_DIR)/include/salome \
+                          -I../../idl
+
+libBL_Engine_la_LIBADD = $(top_builddir)/src/bases/libBL_Bases.la  $(top_builddir)/idl/libJOBMANAGER_IDL.la $(OMNIORB_LIBS) \
+                        $(KERNEL_LDFLAGS) -lSalomeIDLKernel -lSalomeNS -lSalomeLifeCycleCORBA \
+                         @OMNIORB_LIBS@
+
index b13f7dfaa4cd376ad0912e8753199c9073fd8512..7b2ee7a471c842a7f34db037d33f89795d594bf7 100644 (file)
@@ -1,51 +1,68 @@
-//  Copyright (C) 2009 CEA/DEN, EDF R&D
+// Copyright (C) 2009-2012  CEA/DEN, EDF R&D
 //
-//  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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #include "BL_Buttons.hxx"
 
-BL::Buttons::Buttons(QWidget * parent) : QGroupBox(parent)
+BL::Buttons::Buttons(QWidget * parent) : QWidget(parent)
 {
   DEBTRACE("Creating BL::Buttons");
 
-  setTitle("Actions");
+  _create_button      = new QPushButton("Create", this);
+  _start_button       = new QPushButton("Start", this);
+  _get_results_button = new QPushButton("Get Results", this);
 
-  _create_button = new QPushButton("Create Job", this);
-  _start_button = new QPushButton("Start Job", this);
-  _delete_button = new QPushButton("Delete Job", this);
-  _get_results_button = new QPushButton("Get Job Results", this);
-  _refresh_button = new QPushButton("Refresh Jobs", this);
 
+  _stop_button       = new QPushButton("Stop", this);
+  _delete_button     = new QPushButton("Delete", this);
+  _restart_button    = new QPushButton("Restart", this);
+  _edit_clone_button = new QPushButton("Edit/Clone", this);
+
+  _refresh_button    = new QPushButton("Refresh Jobs", this);
+
+  QGroupBox * main_buttons = new QGroupBox(this);
+  main_buttons->setTitle("Main");
   QHBoxLayout *mainLayout = new QHBoxLayout;
   mainLayout->addWidget(_create_button);
   mainLayout->addWidget(_start_button);
-  mainLayout->addWidget(_delete_button);
   mainLayout->addWidget(_get_results_button);
-  mainLayout->addWidget(_refresh_button);
-  mainLayout->setSpacing(0); // Space between buttons
-
-  setLayout(mainLayout);
-
-  //QSizePolicy poli;
-  //poli.setControlType(QSizePolicy::PushButton);
-  //poli.setVerticalPolicy(QSizePolicy::Fixed);
-  //poli.setHorizontalPolicy(QSizePolicy::Fixed);
-  //setSizePolicy(poli);
+  main_buttons->setLayout(mainLayout);
+
+  QGroupBox * manage_buttons = new QGroupBox(this);
+  manage_buttons->setTitle("Management");
+  QHBoxLayout *manageLayout = new QHBoxLayout;
+  manageLayout->addWidget(_stop_button);
+  manageLayout->addWidget(_delete_button);
+  manageLayout->addWidget(_restart_button);
+  manageLayout->addWidget(_edit_clone_button);
+  manage_buttons->setLayout(manageLayout);
+
+  QGroupBox * refresh_buttons = new QGroupBox(this);
+  refresh_buttons->setTitle("Refresh");
+  QHBoxLayout *refreshLayout = new QHBoxLayout;
+  refreshLayout->addWidget(_refresh_button);
+  refresh_buttons->setLayout(refreshLayout);
+
+  QGridLayout * gridLayout = new QGridLayout;
+  gridLayout->addWidget(main_buttons, 0 ,0);
+  gridLayout->addWidget(manage_buttons, 0 ,1);
+  gridLayout->addWidget(refresh_buttons, 0 , 2);
+  setLayout(gridLayout);
 }
 
 BL::Buttons::~Buttons()
@@ -59,12 +76,30 @@ BL::Buttons::setCreateButtonSlot(QObject * receiver, const char * name)
   connect(_create_button, SIGNAL(clicked()), receiver, name);
 }
 
+void
+BL::Buttons::setEditCloneButtonSlot(QObject * receiver, const char * name)
+{
+  connect(_edit_clone_button, SIGNAL(clicked()), receiver, name);
+}
+
 void
 BL::Buttons::setStartButtonSlot(QObject * receiver, const char * name)
 {
   connect(_start_button, SIGNAL(clicked()), receiver, name);
 }
 
+void
+BL::Buttons::setReStartButtonSlot(QObject * receiver, const char * name)
+{
+  connect(_restart_button, SIGNAL(clicked()), receiver, name);
+}
+
+void
+BL::Buttons::setStopButtonSlot(QObject * receiver, const char * name)
+{
+  connect(_stop_button, SIGNAL(clicked()), receiver, name);
+}
+
 void
 BL::Buttons::setDeleteButtonSlot(QObject * receiver, const char * name)
 {
@@ -83,6 +118,18 @@ BL::Buttons::setGetResultsButtonSlot(QObject * receiver, const char * name)
   connect(_get_results_button, SIGNAL(clicked()), receiver, name);
 }
 
+void 
+BL::Buttons::enable_edit_clone_button()
+{
+  _edit_clone_button->setEnabled(true);
+}
+
+void 
+BL::Buttons::disable_edit_clone_button()
+{
+  _edit_clone_button->setEnabled(false);
+}
+
 void 
 BL::Buttons::enable_start_button()
 {
@@ -95,6 +142,30 @@ BL::Buttons::disable_start_button()
   _start_button->setEnabled(false);
 }
 
+void 
+BL::Buttons::enable_restart_button()
+{
+  _restart_button->setEnabled(true);
+}
+
+void 
+BL::Buttons::disable_restart_button()
+{
+  _restart_button->setEnabled(false);
+}
+
+void 
+BL::Buttons::enable_stop_button()
+{
+  _stop_button->setEnabled(true);
+}
+
+void 
+BL::Buttons::disable_stop_button()
+{
+  _stop_button->setEnabled(false);
+}
+
 void 
 BL::Buttons::enable_delete_button()
 {
index 866e96d78a11ae9bd1ccb51ae9b08bbb7232f44f..27d92cfef56a4b81803b4a862d45b61140b85d74 100644 (file)
@@ -1,20 +1,20 @@
-//  Copyright (C) 2009 CEA/DEN, EDF R&D
+// Copyright (C) 2009-2012  CEA/DEN, EDF R&D
 //
-//  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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #ifndef _BL_BUTTONS_HXX_
@@ -26,7 +26,7 @@
 
 namespace BL 
 {
-  class Buttons: public QGroupBox
+  class Buttons: public QWidget
   {
     Q_OBJECT
 
@@ -35,14 +35,26 @@ namespace BL
       virtual ~Buttons();
 
       void setCreateButtonSlot(QObject * receiver, const char * name);
+      void setEditCloneButtonSlot(QObject * receiver, const char * name);
       void setStartButtonSlot(QObject * receiver, const char * name);
+      void setReStartButtonSlot(QObject * receiver, const char * name);
+      void setStopButtonSlot(QObject * receiver, const char * name);
       void setDeleteButtonSlot(QObject * receiver, const char * name);
       void setRefreshButtonSlot(QObject * receiver, const char * name);
       void setGetResultsButtonSlot(QObject * receiver, const char * name);
 
+      void enable_edit_clone_button();
+      void disable_edit_clone_button();
+
       void enable_start_button();
       void disable_start_button();
 
+      void enable_restart_button();
+      void disable_restart_button();
+
+      void enable_stop_button();
+      void disable_stop_button();
+
       void enable_delete_button();
       void disable_delete_button();
 
@@ -51,10 +63,13 @@ namespace BL
 
     protected:  
       QPushButton * _create_button;
+      QPushButton * _edit_clone_button;
       QPushButton * _start_button;
+      QPushButton * _restart_button;
       QPushButton * _delete_button;
       QPushButton * _get_results_button;
       QPushButton * _refresh_button;
+      QPushButton * _stop_button;
   };
 }
 
index 99ae4eea8c84648ed285646ef9645574639d96ff..8b24f65120b27909eae078fd9c9ab135052ed32b 100644 (file)
@@ -1,23 +1,35 @@
-//  Copyright (C) 2009 CEA/DEN, EDF R&D
+// Copyright (C) 2009-2012  CEA/DEN, EDF R&D
 //
-//  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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #include "BL_CreateJobWizard.hxx"
+#include "BL_JobsManager_QT.hxx"
+#ifndef WNT
+#include <unistd.h>
+#include <pwd.h>
+#endif
+#include <sys/types.h>
+#include <stdlib.h>
+#include <time.h>
+
+#ifdef WNT
+#undef ERROR
+#endif
 
 BL::CreateJobWizard::CreateJobWizard(BL::JobsManager_QT * jobs_manager, BL::SALOMEServices * salome_services)
 {
@@ -25,30 +37,42 @@ BL::CreateJobWizard::CreateJobWizard(BL::JobsManager_QT * jobs_manager, BL::SALO
   BL_ASSERT(jobs_manager);
   BL_ASSERT(salome_services);
   _jobs_manager = jobs_manager;
+  _salome_services = salome_services;
 
   job_name = "";
   yacs_file = "";
   command = "";
+  python_salome_file = "";
+  env_file = "";
   batch_directory = "";
-  expected_during_time = "";
+  maximum_duration = "";
   expected_memory = "";
   nb_proc = 1;
 
   result_directory = "";
 
-  machine_choosed = "";
+  resource_choosed = "";
+  batch_queue = "";
 
   start_job = false;
+  dump_yacs_state = -1;
+  ll_jobtype = "";
 
-  setOptions(QWizard::IndependentPages | QWizard::NoBackButtonOnStartPage);
+  setOptions(QWizard::NoBackButtonOnStartPage);
 
-  setPage(Page_JobName, new BL::CreateJobWizard::JobNamePage(this, _jobs_manager));
-  setPage(Page_YACSSchema, new BL::YACSSchemaPage(this));
-  setPage(Page_BatchParameters, new BL::BatchParametersPage(this));
+  // Common pages
+  _job_name_page = new BL::JobNamePage(this, _jobs_manager);
+
+  setPage(Page_JobName, _job_name_page);
+  setPage(Page_BatchParameters, new BL::BatchParametersPage(this, salome_services));
   setPage(Page_Files, new BL::FilesPage(this));
-  setPage(Page_Command_Main_Definitions, new BL::CreateJobWizard::CommandMainPage(this));
-  setPage(Page_Machine, new BL::MachinePage(this, salome_services));
-  setPage(Page_Conclusion, new BL::CreateJobWizard::ConclusionPage(this));
+  setPage(Page_Resource, new BL::ResourcePage(this, salome_services));
+  setPage(Page_Conclusion, new BL::ConclusionPage(this));
+
+  // Specific pages
+  setPage(Page_YACSSchema, new BL::YACSSchemaPage(this));
+  setPage(Page_Command_Main_Definitions, new BL::CommandMainPage(this));
+  setPage(Page_PythonSalome_Main_Definitions, new BL::PythonSalomeMainPage(this));
 
   setWindowTitle("Create Job Wizard");
   connect(this, SIGNAL(finished(int)), this, SLOT(end(int)));
@@ -59,6 +83,102 @@ BL::CreateJobWizard::~CreateJobWizard()
   DEBTRACE("Destroying BL::CreateJobWizard");
 }
 
+void
+BL::CreateJobWizard::clone(const std::string & name)
+{
+  if (_jobs_manager->job_already_exist(name) == true)
+  {
+    BL::Job * job = _jobs_manager->getJob(name);
+
+    // We can only edit a job in CREATED, ERROR, FAILED and NOT_CREATED
+    if (job->getState() == BL::Job::CREATED ||
+        job->getState() == BL::Job::ERROR   ||
+        job->getState() == BL::Job::FAILED  ||
+        job->getState() == BL::Job::NOT_CREATED)
+    { 
+      setField("job_name", QString(name.c_str()));
+      _job_name_page->_check_name = false;
+    }
+
+    if (job->getType() == BL::Job::YACS_SCHEMA)
+    {
+      setField("yacs_file", QString(job->getJobFile().c_str()));
+      _job_name_page->_yacs_schema_button->click();
+      setField("env_yacs_file", QString(job->getEnvFile().c_str()));
+      if (job->getDumpYACSState() != -1)
+      {
+        QString value;
+        value.setNum(job->getDumpYACSState());
+        setField("dump_yacs_state", value);
+      }
+    }
+    else if (job->getType() == BL::Job::COMMAND)
+    {
+      setField("command", QString(job->getJobFile().c_str()));
+      _job_name_page->_command_button->click();
+      setField("env_command_file", QString(job->getEnvFile().c_str()));
+    }
+    else if (job->getType() == BL::Job::PYTHON_SALOME)
+    {
+      setField("PythonSalome", QString(job->getJobFile().c_str()));
+      _job_name_page->_python_salome_button->click();
+      setField("env_PythonSalome_file", QString(job->getEnvFile().c_str()));
+    }
+
+    BL::Job::BatchParam batch_params = job->getBatchParameters();
+    setField("batch_directory", QString(batch_params.batch_directory.c_str()));
+    QString proc_value;
+    proc_value.setNum(batch_params.nb_proc);
+    setField("proc_value", proc_value);
+
+    if (batch_params.maximum_duration == "")
+    {
+      setField("duration_hour", 0);
+      setField("duration_min", 0);
+    }
+    else
+    {
+      std::size_t pos = batch_params.maximum_duration.find(":");
+      std::string hour_str = batch_params.maximum_duration.substr(0, pos);
+      int hour; 
+      std::istringstream iss_hour(hour_str);
+      iss_hour >> hour;
+      setField("duration_hour", hour);
+
+      std::string min_str = batch_params.maximum_duration.substr(pos + 1, batch_params.maximum_duration.npos);
+      int min; 
+      std::istringstream iss_min(min_str);
+      iss_min >> min;
+      setField("duration_min", min);
+    }
+
+    std::string mem_type = batch_params.expected_memory.substr(batch_params.expected_memory.size() - 2, 2);
+    if (mem_type == "mb")
+      setField("mem_type", 0);
+    else
+      setField("mem_type", 1);
+    std::string mem_value = batch_params.expected_memory.substr(0, batch_params.expected_memory.find(mem_type));
+    int mem_val; 
+    std::istringstream iss_mem(mem_value);
+    iss_mem >> mem_val;
+    setField("mem_value", mem_val);
+
+    BL::Job::FilesParam files_params = job->getFilesParameters();
+
+    std::list<std::string>::iterator it = files_params.input_files_list.begin();
+    for (; it != files_params.input_files_list.end(); it++)
+      _input_files_list->addItem(QString((*it).c_str()));
+    it = files_params.output_files_list.begin();
+    for (; it != files_params.output_files_list.end(); it++)
+      _output_files_list->addItem(QString((*it).c_str()));
+
+    setField("result_directory", QString(files_params.result_directory.c_str()));
+    setField("resource_choosed", QString(job->getResource().c_str()));
+    setField("batch_queue", QString(job->getBatchQueue().c_str()));
+    setField("ll_jobtype", QString(job->getLoadLevelerJobType().c_str()));
+  }
+}
+
 void
 BL::CreateJobWizard::setFilesList(QListWidget * input_files_list, QListWidget * output_files_list)
 {
@@ -79,26 +199,47 @@ BL::CreateJobWizard::end(int result)
     // YACS Schema Panel
     QString f_yacs_file = field("yacs_file").toString();
     yacs_file = f_yacs_file.toStdString();
-    
+    dump_yacs_state = field("dump_yacs_state").toInt();
+
     // Command Panel
     QString f_command = field("command").toString();
     command = f_command.toStdString();
-    
+
+    // Command Panel
+    QString f_python_salome_file = field("PythonSalome").toString();
+    python_salome_file = f_python_salome_file.toStdString();
+
+    QString f_env_file;
+    if (yacs_file != "")
+      f_env_file = field("env_yacs_file").toString();
+    else if (command != "")
+      f_env_file = field("env_command_file").toString();
+    else if (python_salome_file != "")
+      f_env_file = field("env_PythonSalome_file").toString();
+    env_file = f_env_file.toStdString();
+
     // Batch Panel
     QString f_batch_directory = field("batch_directory").toString();
     batch_directory = f_batch_directory.toStdString();
 
     QString time_hour;
     QString time_min;
-    if (field("during_time_hour").toInt() < 10)
-      time_hour = "0" + field("during_time_hour").toString();
-    else
-      time_hour = field("during_time_hour").toString();
-    if (field("during_time_min").toInt() < 10)
-      time_min = "0" + field("during_time_min").toString();
+    if(field("duration_hour").toInt() == 0 && field("duration_min").toInt() == 0)
+    {
+      maximum_duration = "";
+    }
     else
-      time_min = field("during_time_min").toString();
-    expected_during_time = time_hour.toStdString() + ":" + time_min.toStdString() + ":00";
+    {
+      if (field("duration_hour").toInt() < 10)
+        time_hour = "0" + field("duration_hour").toString();
+      else
+        time_hour = field("duration_hour").toString();
+      if (field("duration_min").toInt() < 10)
+        time_min = "0" + field("duration_min").toString();
+      else
+        time_min = field("duration_min").toString();
+      maximum_duration = time_hour.toStdString() + ":" + time_min.toStdString();
+    }
 
     QString mem = field("mem_value").toString();
     int mem_type_i = field("mem_type").toInt();
@@ -125,19 +266,37 @@ BL::CreateJobWizard::end(int result)
       output_files_list.push_back(item_text.toStdString());
     }
 
-    // Machine list
-    QString f_machine_choosed = field("machine_choosed").toString();
-    machine_choosed = f_machine_choosed.toStdString(); 
+    // Resource list
+    QString f_resource_choosed = field("resource_choosed").toString();
+    resource_choosed = f_resource_choosed.toStdString(); 
+
+    // Batch Queue
+    QString f_batch_queue = field("batch_queue").toString();
+    batch_queue = f_batch_queue.toStdString();
+
+    // LoadLeveler JobType
+    BL::ResourceDescr resource_descr = _salome_services->getResourceDescr(resource_choosed);
+    std::string batch = resource_descr.batch.c_str();
+    if (batch == "ll")
+    {
+      QString f_ll_jobtype = field("ll_jobtype").toString();
+      ll_jobtype = f_ll_jobtype.toStdString();
+    }
+    else
+    {
+      ll_jobtype = "";
+    }
 
     start_job = field("start_job").toBool();
   }
 }
 
 // Job Name Page
-BL::CreateJobWizard::JobNamePage::JobNamePage(QWidget * parent, BL::JobsManager_QT * jobs_manager)
+BL::JobNamePage::JobNamePage(QWidget * parent, BL::JobsManager_QT * jobs_manager)
 : QWizardPage(parent)
 {
   _jobs_manager = jobs_manager;
+  _check_name = true;
   setTitle("Create a new job");
 
   QLabel *label = new QLabel("Enter Job name, you cannot add two jobs with the same name");
@@ -147,16 +306,26 @@ BL::CreateJobWizard::JobNamePage::JobNamePage(QWidget * parent, BL::JobsManager_
   registerField("job_name", _nameLineEdit);
 
   QLabel * label_type = new QLabel("Choose type of batch job:");
-  QGroupBox *groupBox = new QGroupBox();
+  QGroupBox *groupBox = new QGroupBox("Type of job");
   _yacs_schema_button = new QRadioButton(tr("YACS Schema"));
   _yacs_schema_button->setChecked(true);
-  QRadioButton *radio2 = new QRadioButton(tr("Command"));
+  _command_button = new QRadioButton(tr("Command"));
+  _python_salome_button = new QRadioButton(tr("Python script in SALOME"));
   QVBoxLayout *vbox = new QVBoxLayout;
   vbox->addWidget(_yacs_schema_button);
-  vbox->addWidget(radio2);
+  vbox->addWidget(_command_button);
+  vbox->addWidget(_python_salome_button);
   vbox->addStretch(1);
   groupBox->setLayout(vbox);
 
+  QGroupBox * explanationBox = new QGroupBox("Explanation");
+  QVBoxLayout *explanationvbox = new QVBoxLayout;
+  _explanation = new QLabel();
+  _explanation->setWordWrap(true);
+  explanationvbox->addWidget(_explanation);
+  explanationvbox->addStretch(1);
+  explanationBox->setLayout(explanationvbox);
+
   // Layouts
   QVBoxLayout * main_layout = new QVBoxLayout;
   main_layout->addWidget(label);
@@ -166,16 +335,45 @@ BL::CreateJobWizard::JobNamePage::JobNamePage(QWidget * parent, BL::JobsManager_
   main_layout->insertLayout(-1, layout);
   layout->addWidget(label_type, 2, 0);
   layout->addWidget(groupBox, 3, 0, 1, -1);
+  layout->addWidget(explanationBox, 4, 0, 1, -1);
   setLayout(main_layout);
+
+  connect(_yacs_schema_button, SIGNAL(clicked(bool)), this, SLOT(yacs_schema_button(bool)));
+  connect(_command_button, SIGNAL(clicked(bool)), this, SLOT(command_button(bool)));
+  connect(_python_salome_button, SIGNAL(clicked(bool)), this, SLOT(python_salome_button(bool)));
+
+  // Default button
+  yacs_schema_button(true);
 }
 
-BL::CreateJobWizard::JobNamePage::~JobNamePage()
+BL::JobNamePage::~JobNamePage()
 {}
 
+void
+BL::JobNamePage::yacs_schema_button(bool checked)
+{
+  if (checked)
+    _explanation->setText("This job permits to launch a YACS schema into a SALOME application");
+}
+
+void
+BL::JobNamePage::command_button(bool checked)
+{
+  if (checked)
+    _explanation->setText("This job permits to launch a script into a distributed resource. This script is not launched into a SALOME application");
+}
+
+void
+BL::JobNamePage::python_salome_button(bool checked)
+{
+  if (checked)
+    _explanation->setText("This job permits to launch a python script into a SALOME application");
+}
+
 bool
-BL::CreateJobWizard::JobNamePage::validatePage()
+BL::JobNamePage::validatePage()
 {
-  DEBTRACE("Calling validatePage of BL::CreateJobWizard::JobNamePage");
+  DEBTRACE("Calling validatePage of BL::JobNamePage");
   bool return_value;
   QString job_name = field("job_name").toString();
 
@@ -188,7 +386,7 @@ BL::CreateJobWizard::JobNamePage::validatePage()
 
   // Check if job name already exists
   else {
-    if (_jobs_manager->job_already_exist(job_name.toStdString()) == false)
+    if (_jobs_manager->job_already_exist(job_name.toStdString()) == false || _check_name == false)
     {
       return_value = true;
     }
@@ -204,42 +402,68 @@ BL::CreateJobWizard::JobNamePage::validatePage()
   return return_value;
 }
 
-int 
-BL::CreateJobWizard::JobNamePage::nextId() const
+int
+BL::JobNamePage::nextId() const
 {
-  if (_yacs_schema_button->isChecked()) 
+  if (_yacs_schema_button->isChecked())
   {
     return BL::CreateJobWizard::Page_YACSSchema;
   } 
-  else 
+  else if (_command_button->isChecked())
   {
     return BL::CreateJobWizard::Page_Command_Main_Definitions;
   }
+  else
+  {
+    return BL::CreateJobWizard::Page_PythonSalome_Main_Definitions;
+  }
 }
 
 BL::YACSSchemaPage::YACSSchemaPage(QWidget * parent)
 : QWizardPage(parent)
 {
-  setTitle("Choose YACS Schema");
+  setTitle("Configure YACS Execution");
 
-  QLabel *label = new QLabel("In this step you have to choose what YACS Schema you want to execute");
+  QLabel *label = new QLabel("In this step you have to configure your YACS execution");
   label->setWordWrap(true);
 
-  _yacs_file_button = new QPushButton(tr("Choose YACS Schema file"));
-  _yacs_file_button->show();
-  connect(_yacs_file_button, SIGNAL(clicked()), this, SLOT(choose_file()));
-
+  QGroupBox * files_param_box = new QGroupBox("YACS job files");
+  QPushButton * yacs_file_button = new QPushButton(tr("Choose YACS Schema file"));
+  connect(yacs_file_button, SIGNAL(clicked()), this, SLOT(choose_file()));
   _yacs_file_text = new QLineEdit(this);
   _yacs_file_text->setText("");
   registerField("yacs_file", _yacs_file_text);
   _yacs_file_text->setReadOnly(true);
+  QPushButton * command_env_file_button = new QPushButton(tr("Choose an environnement file"));
+  connect(command_env_file_button, SIGNAL(clicked()), this, SLOT(choose_env_file()));
+  _line_env_file = new QLineEdit(this);
+  registerField("env_yacs_file", _line_env_file);
+  _line_env_file->setReadOnly(true);
+  QGridLayout * files_layout = new QGridLayout;
+  files_layout->addWidget(yacs_file_button, 0, 0);
+  files_layout->addWidget(_yacs_file_text, 0, 1);
+  files_layout->addWidget(command_env_file_button, 1, 0);
+  files_layout->addWidget(_line_env_file, 1, 1);
+  files_param_box->setLayout(files_layout);
+
+  QGroupBox * spec_param_box = new QGroupBox("YACS specific parameters");
+  QLabel * label_dump =  new QLabel("Dump YACS state each secs (0 disable this feature)");
+  QLabel * label_dump_warning = new QLabel("(WARNING: can only be used with SALOME >= 6.3.0)");
+  QSpinBox * spin_dump = new QSpinBox(this);
+  spin_dump->setMinimum(0);
+  spin_dump->setMaximum(1000000);
+  registerField("dump_yacs_state", spin_dump);
+  QGridLayout * specific_layout = new QGridLayout;
+  specific_layout->addWidget(label_dump, 0, 0);
+  specific_layout->addWidget(spin_dump, 0, 1);
+  specific_layout->addWidget(label_dump_warning, 1, 0);
+  spec_param_box->setLayout(specific_layout);
 
   QVBoxLayout * main_layout = new QVBoxLayout;
   main_layout->addWidget(label);
-  QGridLayout *layout = new QGridLayout;
-  layout->addWidget(_yacs_file_button, 0, 0);
-  layout->addWidget(_yacs_file_text, 0, 1);
-  main_layout->insertLayout(-1, layout);
+  main_layout->addWidget(files_param_box);
+  main_layout->addWidget(spec_param_box);
+
   setLayout(main_layout);
 };
 
@@ -267,20 +491,32 @@ void
 BL::YACSSchemaPage::choose_file()
 {
   QString yacs_file = QFileDialog::getOpenFileName(this,
-                                                  tr("Open YACS files"), "",
-                                                  tr("XML (*.xml);;All Files (*)"));
+                                                   tr("Open YACS files"), "",
+                                                   tr("XML (*.xml);;All Files (*)"));
   _yacs_file_text->setReadOnly(false);
   _yacs_file_text->setText(yacs_file);
   _yacs_file_text->setReadOnly(true);
 }
 
+void
+BL::YACSSchemaPage::choose_env_file()
+{
+  QString env_file = QFileDialog::getOpenFileName(this,
+                                                  tr("Open environnement file"), "",
+                                                  tr("sh (*.sh);;All Files (*)"));
+  _line_env_file->setReadOnly(false);
+  _line_env_file->setText(env_file);
+  _line_env_file->setReadOnly(true);
+}
+
+
 int 
 BL::YACSSchemaPage::nextId() const
 {
-  return BL::CreateJobWizard::Page_BatchParameters;
+  return BL::CreateJobWizard::Page_Resource;
 }
 
-BL::CreateJobWizard::CommandMainPage::CommandMainPage(QWidget * parent)
+BL::CommandMainPage::CommandMainPage(QWidget * parent)
 : QWizardPage(parent)
 {
   setTitle("Define command job");
@@ -288,13 +524,23 @@ BL::CreateJobWizard::CommandMainPage::CommandMainPage(QWidget * parent)
   label->setWordWrap(true);
 
   // command
-  QLabel * label_command = new QLabel("Command: ");
-  QLineEdit * line_command = new QLineEdit(this);
-  registerField("command", line_command);
+  QPushButton * command_file_button = new QPushButton(tr("Choose a command file"));
+  connect(command_file_button, SIGNAL(clicked()), this, SLOT(choose_command_file()));
+  _line_command = new QLineEdit(this);
+  registerField("command", _line_command);
+  _line_command->setReadOnly(true);
+
+  QPushButton * command_env_file_button = new QPushButton(tr("Choose an environnement file"));
+  connect(command_env_file_button, SIGNAL(clicked()), this, SLOT(choose_env_file()));
+  _line_env_file = new QLineEdit(this);
+  registerField("env_command_file", _line_env_file);
+  _line_env_file->setReadOnly(true);
 
   QGridLayout *layout = new QGridLayout;
-  layout->addWidget(label_command, 0, 0);
-  layout->addWidget(line_command, 0, 1);
+  layout->addWidget(command_file_button, 0, 0);
+  layout->addWidget(_line_command, 0, 1);
+  layout->addWidget(command_env_file_button, 1, 0);
+  layout->addWidget(_line_env_file, 1, 1);
 
   QVBoxLayout * main_layout = new QVBoxLayout;
   main_layout->addWidget(label);
@@ -302,11 +548,33 @@ BL::CreateJobWizard::CommandMainPage::CommandMainPage(QWidget * parent)
   setLayout(main_layout);
 };
 
-BL::CreateJobWizard::CommandMainPage::~CommandMainPage()
+BL::CommandMainPage::~CommandMainPage()
 {}
 
+void
+BL::CommandMainPage::choose_command_file()
+{
+  QString command_file = QFileDialog::getOpenFileName(this,
+                                                      tr("Open command file"), "",
+                                                      tr("sh (*.sh);;All Files (*)"));
+  _line_command->setReadOnly(false);
+  _line_command->setText(command_file);
+  _line_command->setReadOnly(true);
+}
+
+void
+BL::CommandMainPage::choose_env_file()
+{
+  QString env_file = QFileDialog::getOpenFileName(this,
+                                                  tr("Open environnement file"), "",
+                                                  tr("sh (*.sh);;All Files (*)"));
+  _line_env_file->setReadOnly(false);
+  _line_env_file->setText(env_file);
+  _line_env_file->setReadOnly(true);
+}
+
 bool
-BL::CreateJobWizard::CommandMainPage::validatePage()
+BL::CommandMainPage::validatePage()
 {
   QString command = field("command").toString();
   if (command == "")
@@ -319,15 +587,18 @@ BL::CreateJobWizard::CommandMainPage::validatePage()
 }
 
 int 
-BL::CreateJobWizard::CommandMainPage::nextId() const
+BL::CommandMainPage::nextId() const
 {
-  return BL::CreateJobWizard::Page_BatchParameters;
+  return BL::CreateJobWizard::Page_Resource;
 }
 
-BL::BatchParametersPage::BatchParametersPage(QWidget * parent)
+BL::BatchParametersPage::BatchParametersPage(QWidget * parent, BL::SALOMEServices * salome_services)
 : QWizardPage(parent)
 {
   setTitle("Enter Batch Parameters");
+  resource_choosed = "";
+
+  _salome_services = salome_services;
 
   QLabel *label = new QLabel("In this step you define the parameters of your job");
   label->setWordWrap(true);
@@ -335,22 +606,22 @@ BL::BatchParametersPage::BatchParametersPage(QWidget * parent)
   main_layout->addWidget(label);
 
   // batch_directory
-  QLabel * label_directory = new QLabel("Batch directory: ");
+  QLabel * label_directory = new QLabel("Remote work directory: ");
   QLineEdit * line_directory = new QLineEdit(this);
   registerField("batch_directory", line_directory);
 
   // exected during time
-  QLabel * label_during_time = new QLabel("Expected during time: ");
-  QSpinBox * spin_during_time_hour = new QSpinBox(this);
-  QLabel * label_during_time_hour = new QLabel("Hours");
-  spin_during_time_hour->setMinimum(0);
-  spin_during_time_hour->setMaximum(1000000);
-  registerField("during_time_hour", spin_during_time_hour);
-  QSpinBox * spin_during_time_min = new QSpinBox(this);
-  QLabel * label_during_time_min = new QLabel("Minutes");
-  spin_during_time_min->setMinimum(0);
-  spin_during_time_min->setMaximum(59);
-  registerField("during_time_min", spin_during_time_min);
+  QLabel * label_duration = new QLabel("Maximum during time: ");
+  QSpinBox * spin_duration_hour = new QSpinBox(this);
+  QLabel * label_duration_hour = new QLabel("Hours");
+  spin_duration_hour->setMinimum(0);
+  spin_duration_hour->setMaximum(1000000);
+  registerField("duration_hour", spin_duration_hour);
+  QSpinBox * spin_duration_min = new QSpinBox(this);
+  QLabel * label_duration_min = new QLabel("Minutes");
+  spin_duration_min->setMinimum(0);
+  spin_duration_min->setMaximum(59);
+  registerField("duration_min", spin_duration_min);
 
   // memory
   QLabel * label_memory = new QLabel("Memory per nodes expected: ");
@@ -374,11 +645,11 @@ BL::BatchParametersPage::BatchParametersPage(QWidget * parent)
   QGridLayout *layout = new QGridLayout;
   layout->addWidget(label_directory, 0, 0);
   layout->addWidget(line_directory, 0, 1, 1, -1);
-  layout->addWidget(label_during_time, 1, 0);
-  layout->addWidget(spin_during_time_hour, 1, 1);
-  layout->addWidget(label_during_time_hour, 1, 2);
-  layout->addWidget(spin_during_time_min, 1, 3);
-  layout->addWidget(label_during_time_min, 1, 4);
+  layout->addWidget(label_duration, 1, 0);
+  layout->addWidget(spin_duration_hour, 1, 1);
+  layout->addWidget(label_duration_hour, 1, 2);
+  layout->addWidget(spin_duration_min, 1, 3);
+  layout->addWidget(label_duration_min, 1, 4);
   layout->addWidget(label_memory, 2, 0);
   layout->addWidget(spin_memory, 2, 1);
   layout->addWidget(combo_memory, 2, 2);
@@ -393,6 +664,37 @@ BL::BatchParametersPage::BatchParametersPage(QWidget * parent)
 BL::BatchParametersPage::~BatchParametersPage()
 {}
 
+void BL::BatchParametersPage::cleanupPage() {}
+
+void
+BL::BatchParametersPage::initializePage()
+{
+  QString f_resource_choosed = field("resource_choosed").toString();
+  if (f_resource_choosed != resource_choosed)
+  {
+    resource_choosed = f_resource_choosed;
+    // If choosed resource has a working_directory set
+    // Generates a default remote working directory
+    BL::ResourceDescr resource_descr = _salome_services->getResourceDescr(resource_choosed.toStdString());
+    QString res_work_dir = resource_descr.working_directory.c_str();
+    if (res_work_dir != "")
+    {
+      time_t rawtime;
+      time(&rawtime);
+      std::string launch_date = ctime(&rawtime);
+      for (int i = 0; i < launch_date.size(); i++)
+        if (launch_date[i] == '/' ||
+            launch_date[i] == '-' ||
+            launch_date[i] == ':' ||
+            launch_date[i] == ' ')
+          launch_date[i] = '_';
+      launch_date.erase(--launch_date.end()); // Last caracter is a \n
+      QString date = launch_date.c_str();
+      setField("batch_directory", res_work_dir + "/" + date);
+    }
+  }
+}
+
 bool
 BL::BatchParametersPage::validatePage()
 {
@@ -403,14 +705,6 @@ BL::BatchParametersPage::validatePage()
     return false;
   }
 
-  int time_hour = field("during_time_hour").toInt();
-  int time_min = field("during_time_min").toInt();
-  if (time_hour == 0 and time_min == 0)
-  {
-    QMessageBox::warning(NULL, "Time Error", "Please enter an expected during time");
-    return false;
-  }
-
   int mem = field("mem_value").toInt();
   if (mem == 0)
   {
@@ -469,16 +763,32 @@ BL::FilesPage::FilesPage(BL::CreateJobWizard * parent)
   connect(_output_files_list, SIGNAL(itemSelectionChanged()), this, SLOT(output_itemSelectionChanged()));
 
   // Results Directory
-  QLabel * label_result_directory = new QLabel("Result directory: ");
-  QLineEdit * result_directory = new QLineEdit(this);
-  registerField("result_directory", result_directory);
+  QPushButton * button_result = new QPushButton("Local Result directory");
+  connect(button_result, SIGNAL(clicked()), this, SLOT(choose_local_directory()));
+  _result_directory = new QLineEdit(this);
+
+  // Default result directory is home directory (if we found it)
+  // First try -> HOME
+#ifdef WNT
+  _result_directory->setText(getenv("HOME"));
+#else
+  if (getenv("HOME"))
+    _result_directory->setText(getenv("HOME"));
+  else {
+    // Second try -> getpwuid
+    struct passwd * pass_struct = getpwuid(getuid());
+    if (pass_struct)
+      _result_directory->setText(pass_struct->pw_dir);
+  }
+#endif
+  registerField("result_directory", _result_directory);
 
   QGridLayout * output_box = new QGridLayout;
   output_box->addWidget(_output_files_button, 0, 0);
   output_box->addWidget(_remove_output_files_button, 0, 1);
   output_box->addWidget(_output_files_list, 1, 0, 1, -1);
-  output_box->addWidget(label_result_directory, 2, 0);
-  output_box->addWidget(result_directory, 2, 1, 1, -1);
+  output_box->addWidget(button_result, 2, 0);
+  output_box->addWidget(_result_directory, 2, 1, 1, -1);
   output_group_box->setLayout(output_box);
 
   QVBoxLayout * main_layout = new QVBoxLayout;
@@ -508,18 +818,12 @@ BL::FilesPage::validatePage()
     }
   }
 
-  if (result_directory == "" and _output_files_list->count() != 0)
+  if (result_directory == "" && _output_files_list->count() != 0)
   {
     QMessageBox::warning(NULL, "Result Directory Error", "Please enter a result directory or remove output files");
     return false;
   }
 
-  if (result_directory != "" and _output_files_list->count() == 0)
-  {
-    QMessageBox::warning(NULL, "Result Error", "Please add output files or erase result directory");
-    return false;
-  }
-
   return true;
 }
 
@@ -527,8 +831,8 @@ void
 BL::FilesPage::choose_input_files()
 {
   QStringList files = QFileDialog::getOpenFileNames(this,
-                                             tr("Add input files"), "",
-                                             tr("All Files (*)"));
+                                                    tr("Add input files"), "",
+                                                    tr("All Files (*)"));
   for (int i = 0; i < files.size(); ++i) 
   {
     if (_input_files_list->findItems(files.at(i), Qt::MatchFixedString).size() == 0)
@@ -536,6 +840,18 @@ BL::FilesPage::choose_input_files()
   }
 }
 
+void
+BL::FilesPage::choose_local_directory()
+{
+  QString dir = QFileDialog::getExistingDirectory(this, tr("Choose local result directory"),
+                                                 "",
+                                                 QFileDialog::ShowDirsOnly
+                                                 | QFileDialog::DontResolveSymlinks);
+
+  if (dir != "")
+    _result_directory->setText(dir);
+}
+
 void 
 BL::FilesPage::remove_input_files()
 {
@@ -587,10 +903,10 @@ BL::FilesPage::output_itemSelectionChanged()
 int 
 BL::FilesPage::nextId() const
 {
-  return BL::CreateJobWizard::Page_Machine;
+  return BL::CreateJobWizard::Page_Conclusion;
 }
 
-BL::CreateJobWizard::ConclusionPage::ConclusionPage(QWidget * parent)
+BL::ConclusionPage::ConclusionPage(QWidget * parent)
 : QWizardPage(parent)
 {
   setTitle("Job definition is finished");
@@ -601,86 +917,208 @@ BL::CreateJobWizard::ConclusionPage::ConclusionPage(QWidget * parent)
   setLayout(main_layout);
 };
 
-BL::CreateJobWizard::ConclusionPage::~ConclusionPage()
+BL::ConclusionPage::~ConclusionPage()
 {}
 
 bool
-BL::CreateJobWizard::ConclusionPage::validatePage()
+BL::ConclusionPage::validatePage()
 {
   return true;
 }
 
 int 
-BL::CreateJobWizard::ConclusionPage::nextId() const
+BL::ConclusionPage::nextId() const
 {
   return -1;
 }
 
-BL::MachinePage::MachinePage(BL::CreateJobWizard * parent, BL::SALOMEServices * salome_services)
+BL::ResourcePage::ResourcePage(BL::CreateJobWizard * parent, BL::SALOMEServices * salome_services)
 : QWizardPage(parent)
 {
   _salome_services = salome_services;
-  setTitle("Select a Machine");
+  setTitle("Select a Resource");
 
-  QLabel * main_label = new QLabel("In this step you select the machine of your job");
+  QLabel * main_label = new QLabel("In this step you select the resource of your job");
   main_label->setWordWrap(true);
 
-  // input_Machine
-  QGroupBox * machine_group_box = new QGroupBox("Machine List");
-  _machine_list = new QListWidget();
-  _machine_list->setSelectionMode(QAbstractItemView::SingleSelection);
-  std::list<std::string> machine_list = _salome_services->getMachineList();
-  std::list<std::string>::iterator it;
-  for (it = machine_list.begin(); it != machine_list.end(); it++)
-  {
-    std::string machine = *it;
-    _machine_list->addItem(QString(machine.c_str()));
-  }
-  connect(_machine_list, SIGNAL(itemSelectionChanged()), this, SLOT(machine_itemSelectionChanged()));
-  QVBoxLayout * machine_list_layout = new QVBoxLayout();
-  machine_list_layout->addWidget(_machine_list);
-  machine_group_box->setLayout(machine_list_layout);
-
-  QLabel * machine_label = new QLabel("Machine selected: ");
-  _machine_choosed = new QLineEdit();
-  _machine_choosed->setText("");
-  _machine_choosed->setReadOnly(true);
-  registerField("machine_choosed", _machine_choosed);
-
-  QGridLayout * main_layout = new QGridLayout;
-  main_layout->addWidget(machine_group_box, 0, 0, 1, -1);
-  main_layout->addWidget(machine_label, 1, 0);
-  main_layout->addWidget(_machine_choosed, 1, 1);
-  setLayout(main_layout);
+  // input_Resource
+  QGroupBox * resource_group_box = new QGroupBox("Resource List");
+  _resource_list = new JM::ResourceCatalog(this, _salome_services);
+  connect(_resource_list->getQListWidget(), SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(itemSelected(QListWidgetItem*)));
+
+  QVBoxLayout * resource_list_layout = new QVBoxLayout();
+  resource_list_layout->addWidget(_resource_list);
+  resource_group_box->setLayout(resource_list_layout);
+
+  QLabel * resource_label = new QLabel("Resource selected: ");
+  _resource_choosed = new QLineEdit();
+  _resource_choosed->setText("");
+  _resource_choosed->setReadOnly(true);
+  registerField("resource_choosed", _resource_choosed);
+
+  QLabel * bqLabel = new QLabel("Batch Queue (could be optional):");
+  QLineEdit * _bqLineEdit = new QLineEdit(this);
+  registerField("batch_queue", _bqLineEdit);
+
+  _ll_label = new QLabel("LoadLeveler JobType:", this);
+  _ll_value = new QLineEdit(this);
+  registerField("ll_jobtype", _ll_value);
+  _ll_label->hide();
+  _ll_value->hide();
+
+  _main_layout = new QGridLayout;
+  _main_layout->addWidget(resource_group_box, 0, 0, 1, -1);
+  _main_layout->addWidget(resource_label, 1, 0);
+  _main_layout->addWidget(_resource_choosed, 1, 1);
+  _main_layout->addWidget(bqLabel, 2, 0);
+  _main_layout->addWidget(_bqLineEdit, 2, 1);
+  setLayout(_main_layout);
+
 };
 
-BL::MachinePage::~MachinePage()
+BL::ResourcePage::~ResourcePage()
 {}
 
+void
+BL::ResourcePage::initializePage()
+{
+  if (field("ll_jobtype").toString() != "")
+  {
+    _main_layout->addWidget(_ll_label, 3, 0);
+    _main_layout->addWidget(_ll_value, 3, 1);
+    _ll_label->show();
+    _ll_value->show();
+  }
+}
+
 bool
-BL::MachinePage::validatePage()
+BL::ResourcePage::validatePage()
 {
-  QString machine_choosed = field("machine_choosed").toString();
-  if (machine_choosed == "")
+  QString resource_choosed = field("resource_choosed").toString();
+  if (resource_choosed == "")
   {
-    QMessageBox::warning(NULL, "Machine Error", "Please choose a machine");
+    QMessageBox::warning(NULL, "Resource Error", "Please choose a resource");
     return false;
   }
+
+  BL::ResourceDescr resource_descr = _salome_services->getResourceDescr(resource_choosed.toStdString());
+  std::string batch = resource_descr.batch.c_str();
+  if (batch == "ll")
+  {
+    QString ll_jobtype = field("ll_jobtype").toString();
+    if (ll_jobtype == "")
+    {
+      QMessageBox::warning(NULL, "LoadLeveler Error", "Please define a LoadLeveler JobType");
+      return false;
+    }
+  }
   return true;
 }
 
 void 
-BL::MachinePage::machine_itemSelectionChanged()
+BL::ResourcePage::itemSelected(QListWidgetItem * item)
+{
+  _resource_choosed->setReadOnly(false);
+  _resource_choosed->setText(item->text());
+  _resource_choosed->setReadOnly(true);
+
+  //Specific parameters for LoadLeveler
+  BL::ResourceDescr resource_descr = _salome_services->getResourceDescr(item->text().toStdString());
+  std::string batch = resource_descr.batch.c_str();
+  if (batch == "ll")
+  {
+    _main_layout->addWidget(_ll_label, 3, 0);
+    _main_layout->addWidget(_ll_value, 3, 1);
+    _ll_label->show();
+    _ll_value->show();
+  }
+  else
+  {
+    _main_layout->removeWidget(_ll_value);
+    _main_layout->removeWidget(_ll_label);
+    _ll_label->hide();
+    _ll_value->hide();
+  }
+}
+
+int 
+BL::ResourcePage::nextId() const
+{
+  return BL::CreateJobWizard::Page_BatchParameters;
+}
+
+BL::PythonSalomeMainPage::PythonSalomeMainPage(QWidget * parent)
+: QWizardPage(parent)
+{
+  setTitle("Define a Python script in SALOME job");
+  QLabel *label = new QLabel("Enter the Python script that will be executed into the resource");
+  label->setWordWrap(true);
+
+  // PythonSalome
+  QPushButton * PythonSalome_file_button = new QPushButton(tr("Choose a Python file"));
+  connect(PythonSalome_file_button, SIGNAL(clicked()), this, SLOT(choose_PythonSalome_file()));
+  _line_PythonSalome = new QLineEdit(this);
+  registerField("PythonSalome", _line_PythonSalome);
+  _line_PythonSalome->setReadOnly(true);
+
+  QPushButton * PythonSalome_env_file_button = new QPushButton(tr("Choose an environnement file"));
+  connect(PythonSalome_env_file_button, SIGNAL(clicked()), this, SLOT(choose_env_file()));
+  _line_env_file = new QLineEdit(this);
+  registerField("env_PythonSalome_file", _line_env_file);
+  _line_env_file->setReadOnly(true);
+
+  QGridLayout *layout = new QGridLayout;
+  layout->addWidget(PythonSalome_file_button, 0, 0);
+  layout->addWidget(_line_PythonSalome, 0, 1);
+  layout->addWidget(PythonSalome_env_file_button, 1, 0);
+  layout->addWidget(_line_env_file, 1, 1);
+
+  QVBoxLayout * main_layout = new QVBoxLayout;
+  main_layout->addWidget(label);
+  main_layout->insertLayout(-1, layout);
+  setLayout(main_layout);
+};
+
+BL::PythonSalomeMainPage::~PythonSalomeMainPage()
+{}
+
+void
+BL::PythonSalomeMainPage::choose_PythonSalome_file()
+{
+  QString PythonSalome_file = QFileDialog::getOpenFileName(this,
+                                                     tr("Open Python script file"), "",
+                                                     tr("py (*.py);;All Files (*)"));
+  _line_PythonSalome->setReadOnly(false);
+  _line_PythonSalome->setText(PythonSalome_file);
+  _line_PythonSalome->setReadOnly(true);
+}
+
+void
+BL::PythonSalomeMainPage::choose_env_file()
 {
-  _machine_choosed->setReadOnly(false);
-  QList<QListWidgetItem *> list = _machine_list->selectedItems();
-  QListWidgetItem * item = list.at(0);
-  _machine_choosed->setText(item->text());
-  _machine_choosed->setReadOnly(true);
+  QString env_file = QFileDialog::getOpenFileName(this,
+                                                     tr("Open environnement file"), "",
+                                                     tr("sh (*.sh);;All Files (*)"));
+  _line_env_file->setReadOnly(false);
+  _line_env_file->setText(env_file);
+  _line_env_file->setReadOnly(true);
+}
+
+bool
+BL::PythonSalomeMainPage::validatePage()
+{
+  QString PythonSalome = field("PythonSalome").toString();
+  if (PythonSalome == "")
+  {
+    QMessageBox::warning(NULL, "Python script in SALOME Error", "Please enter a Python script");
+    return false;
+  }
+
+  return true;
 }
 
 int 
-BL::MachinePage::nextId() const
+BL::PythonSalomeMainPage::nextId() const
 {
-  return BL::CreateJobWizard::Page_Conclusion;
+  return BL::CreateJobWizard::Page_Resource;
 }
index ede4b4be6b27966a027982fc8f030d2f1b6a8ebe..b66491436886177bd8418330c7b0d8eb6418ddf3 100644 (file)
@@ -1,20 +1,20 @@
-//  Copyright (C) 2009 CEA/DEN, EDF R&D
+// Copyright (C) 2009-2012  CEA/DEN, EDF R&D
 //
-//  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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #ifndef _BL_CREATEJOBWIZARD_HXX_
@@ -23,8 +23,8 @@
 #include <QtGui>
 
 #include "BL_Traces.hxx"
-#include "BL_JobsManager_QT.hxx"
 #include "BL_SALOMEServices.hxx"
+#include "JM_ResourceCatalog.hxx"
 
 #include <string>
 #include <list>
@@ -32,6 +32,7 @@
 namespace BL{
 
   class JobsManager_QT;
+  class JobNamePage;
   class CreateJobWizard: virtual public QWizard
   {
     Q_OBJECT
@@ -42,6 +43,8 @@ namespace BL{
 
       void setFilesList(QListWidget * input_files_list, QListWidget * output_files_list);
 
+      void clone(const std::string & name);
+
     public slots:
       void end(int result);
 
@@ -52,16 +55,21 @@ namespace BL{
       QListWidget * _input_files_list;
       QListWidget * _output_files_list;
 
+      BL::JobNamePage * _job_name_page;
+      BL::SALOMEServices * _salome_services;
+
     public:
       // Results
       std::string job_name;
-      
-      std::string yacs_file;
 
+      std::string yacs_file;
       std::string command;
+      std::string python_salome_file;
+
+      std::string env_file;
 
       std::string batch_directory;
-      std::string expected_during_time;
+      std::string maximum_duration;
       std::string expected_memory;
       int nb_proc;
 
@@ -69,67 +77,61 @@ namespace BL{
       std::list<std::string> input_files_list;
       std::list<std::string> output_files_list;
 
-      std::string machine_choosed;
+      std::string resource_choosed;
+      std::string batch_queue;
 
       bool start_job;
+      int dump_yacs_state;
+      std::string ll_jobtype;
 
     public:
-      enum {Page_JobName, Page_YACSSchema, Page_BatchParameters, Page_Files, 
-       Page_Command_Main_Definitions, Page_Machine, Page_Conclusion};
-
-      class JobNamePage: virtual public QWizardPage
-      {
-       public:
-         JobNamePage(QWidget * parent, BL::JobsManager_QT * jobs_manager);
-         virtual ~JobNamePage();
-
-         virtual bool validatePage();
-         virtual int nextId() const ;
-
-       private:          
-         BL::JobsManager_QT * _jobs_manager;
-         QRadioButton * _yacs_schema_button;
-      };
-
-
-      class CommandMainPage: virtual public QWizardPage
-      {
-       public:
-         CommandMainPage(QWidget * parent);
-         virtual ~CommandMainPage();
-
-         virtual bool validatePage();
-         virtual int nextId() const ;
-      };
-
-      class ConclusionPage: virtual public QWizardPage
-      {
-       public:
-         ConclusionPage(QWidget * parent);
-         virtual ~ConclusionPage();
-
-         virtual bool validatePage();
-         virtual int nextId() const ;
-      };
+      enum {Page_JobName,
+            Page_YACSSchema,
+            Page_Command_Main_Definitions,
+            Page_PythonSalome_Main_Definitions,
+            Page_BatchParameters,
+            Page_Files,
+            Page_Resource,
+            Page_Conclusion};
   };
 
-  class YACSSchemaPage: virtual public QWizardPage
+  class JobNamePage: virtual public QWizardPage
   {
     Q_OBJECT
 
     public:
-      YACSSchemaPage(QWidget * parent);
-      virtual ~YACSSchemaPage();
+      JobNamePage(QWidget * parent, BL::JobsManager_QT * jobs_manager);
+      virtual ~JobNamePage();
 
       virtual bool validatePage();
       virtual int nextId() const ;
+      virtual void cleanupPage() {}
 
     public slots:
-      void choose_file();
+      void yacs_schema_button(bool checked);
+      void command_button(bool checked);
+      void python_salome_button(bool checked);
 
     private:
-      QPushButton * _yacs_file_button;
-      QLineEdit * _yacs_file_text;
+      BL::JobsManager_QT * _jobs_manager;
+      QLabel * _explanation;
+
+    public:
+      QRadioButton * _yacs_schema_button;
+      QRadioButton * _command_button;
+      QRadioButton * _python_salome_button;
+      bool _check_name;
+  };
+
+  class ConclusionPage: virtual public QWizardPage
+  {
+    public:
+      ConclusionPage(QWidget * parent);
+      virtual ~ConclusionPage();
+
+      virtual bool validatePage();
+      virtual int nextId() const ;
+      virtual void cleanupPage() {}
   };
 
   class BatchParametersPage: virtual public QWizardPage
@@ -137,11 +139,17 @@ namespace BL{
     Q_OBJECT
 
     public:
-      BatchParametersPage(QWidget * parent);
+      BatchParametersPage(QWidget * parent, BL::SALOMEServices * salome_services);
       virtual ~BatchParametersPage();
 
       virtual bool validatePage();
       virtual int nextId() const;
+      virtual void cleanupPage();
+      virtual void initializePage();
+
+    private:
+      BL::SALOMEServices * _salome_services;
+      QString resource_choosed;
   };
 
   class FilesPage: virtual public QWizardPage
@@ -154,11 +162,13 @@ namespace BL{
 
       virtual int nextId() const;
       virtual bool validatePage();
+      virtual void cleanupPage() {}
 
     public slots:
       void choose_input_files();
       void remove_input_files();
       void input_itemSelectionChanged();
+      void choose_local_directory();
 
       void add_output_file();
       void remove_output_files();
@@ -168,30 +178,100 @@ namespace BL{
       QPushButton * _input_files_button;
       QPushButton * _remove_input_files_button;
       QListWidget * _input_files_list;
+      QLineEdit * _result_directory;
 
       QPushButton * _output_files_button;
       QPushButton * _remove_output_files_button;
       QListWidget * _output_files_list;
   };
 
-  class MachinePage: virtual public QWizardPage
+  class ResourcePage: virtual public QWizardPage
   {
     Q_OBJECT
 
     public:
-      MachinePage(BL::CreateJobWizard * parent, BL::SALOMEServices * salome_services);
-      virtual ~MachinePage();
+      ResourcePage(BL::CreateJobWizard * parent, BL::SALOMEServices * salome_services);
+      virtual ~ResourcePage();
 
       virtual int nextId() const;
       virtual bool validatePage();
+      virtual void initializePage();
+      virtual void cleanupPage() {}
 
     public slots:
-      void machine_itemSelectionChanged();
+      void itemSelected(QListWidgetItem * item);
 
     private:
-      QListWidget * _machine_list;
-      QLineEdit * _machine_choosed;
+      JM::ResourceCatalog * _resource_list;
+      QLineEdit * _resource_choosed;
       BL::SALOMEServices * _salome_services;
+
+      QLabel * _ll_label;
+      QLineEdit * _ll_value;
+      QGridLayout * _main_layout;
+  };
+
+  class YACSSchemaPage: virtual public QWizardPage
+  {
+    Q_OBJECT
+
+    public:
+      YACSSchemaPage(QWidget * parent);
+      virtual ~YACSSchemaPage();
+
+      virtual bool validatePage();
+      virtual int nextId() const ;
+      virtual void cleanupPage() {}
+
+    public slots:
+      void choose_file();
+      void choose_env_file();
+
+    private:
+      QLineEdit * _yacs_file_text;
+      QLineEdit * _line_env_file;
+  };
+
+  class CommandMainPage: virtual public QWizardPage
+  {
+    Q_OBJECT
+
+    public:
+      CommandMainPage(QWidget * parent);
+      virtual ~CommandMainPage();
+
+      virtual bool validatePage();
+      virtual int nextId() const ;
+      virtual void cleanupPage() {}
+
+    public slots:
+      void choose_command_file();
+      void choose_env_file();
+
+    private:
+      QLineEdit * _line_command;
+      QLineEdit * _line_env_file;
+  };
+
+  class PythonSalomeMainPage: virtual public QWizardPage
+  {
+    Q_OBJECT
+
+    public:
+      PythonSalomeMainPage(QWidget * parent);
+      virtual ~PythonSalomeMainPage();
+
+      virtual bool validatePage();
+      virtual int nextId() const ;
+      virtual void cleanupPage() {}
+
+    public slots:
+      void choose_PythonSalome_file();
+      void choose_env_file();
+
+    private:
+      QLineEdit * _line_PythonSalome;
+      QLineEdit * _line_env_file;
   };
 }
 
index 49d37af618b868bc474d8e414f707bec7953f387..b195661b38ffd6ef73232f0fc2e1c4503a8b3d17 100644 (file)
-//  Copyright (C) 2009 CEA/DEN, EDF R&D
+// Copyright (C) 2009-2012  CEA/DEN, EDF R&D
 //
-//  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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #include "BL_GenericGui.hxx"
 
+#ifdef WNT
+#undef ERROR
+#endif
+
 BL::GenericGui::GenericGui(BL::MainWindows_Wrap * wrapper) : QObject(wrapper->getDockParent())
 {
   DEBTRACE("Creating BL::GenericGui");
   BL_ASSERT(wrapper);
   _wrapper = wrapper;
-  _row_selected = -1;
   _job_name_selected = "";
 
   _dock_parent = _wrapper->getDockParent();
-  _tab_parent  = _wrapper->getTabParent();
 
+  // _salome_services is a servant
+  // POA wil destroy it at the end of the application
   _salome_services = new BL::SALOMEServices();
-  if (_salome_services->initNS() == false)
-    DEBMSG("WARNING !!!!! SALOME IS NOT REACHABLE !!!!");
-  _jobs_manager = new BL::JobsManager_QT(_dock_parent, _salome_services);
-  _model_manager = new BL::QModelManager(this, _jobs_manager);
+}
 
+BL::GenericGui::~GenericGui()
+{
+  DEBTRACE("Destroying BL::GenericGui");
+  _salome_services->end();
+}
+
+void 
+BL::GenericGui::createDockWidgets()
+{
+  DEBTRACE("createDockWidgets BL::GenericGui");
+  _jobs_manager = new BL::JobsManager_QT(_dock_parent, this, _salome_services);
+  _model_manager = new BL::QModelManager(this, _jobs_manager);
   _model = _model_manager->getModel();
 
-  // ---- Adding different GUI parts
+  /* Summary */
+  _dw_summary = new QDockWidget(_dock_parent);
+  _dw_summary->setWindowTitle("Summary");
+  _summary = new BL::Summary(_dw_summary, _jobs_manager);
+  _summary->setModel(_model);
+  QScrollArea * scroll_widget_summary = new QScrollArea(_dw_summary);
+  scroll_widget_summary->setWidget(_summary);
+  scroll_widget_summary->setWidgetResizable(true);
+  _dw_summary->setWidget(scroll_widget_summary);
+
+  /* ResourceCatalog */
+  _dw_resource_catalog = new QDockWidget(_dock_parent);
+  _dw_resource_catalog->setWindowTitle("Resource Catalog");
+  _resource_catalog = new JM::ResourceCatalog(_dw_resource_catalog, _salome_services);
+  QScrollArea * scroll_widget_resource = new QScrollArea(_dw_resource_catalog);
+  scroll_widget_resource->setWidget(_resource_catalog);
+  scroll_widget_resource->setWidgetResizable(true);
+  _dw_resource_catalog->setWidget(scroll_widget_resource);
+
+  /* Main Dock Window */
+  _dock_parent->addDockWidget(Qt::RightDockWidgetArea, _jobs_manager);
+  _dock_parent->addDockWidget(Qt::RightDockWidgetArea, _dw_summary);
+  _dock_parent->addDockWidget(Qt::RightDockWidgetArea, _dw_resource_catalog);
+  _dock_parent->splitDockWidget(_jobs_manager, _dw_summary, Qt::Vertical);
+  _dock_parent->tabifyDockWidget(_dw_summary, _dw_resource_catalog);
 
+  /* Signals and Slots */
+  // JobsManager -> Model
+  connect(_jobs_manager, SIGNAL(new_job_added(QString)), _model_manager, SLOT(new_job_added(QString)));
+  connect(_jobs_manager, SIGNAL(job_state_changed(QString)), _model_manager, SLOT(job_state_changed(QString)));
+  connect(_jobs_manager, SIGNAL(job_state_changed(QString)), this, SLOT(job_state_changed(QString)));
+  // Model -> summary
+  connect(_model, SIGNAL(rowsInserted(QModelIndex, int, int)), _summary, SLOT(rowsInserted(QModelIndex, int, int)));
+  connect(_model, SIGNAL(rowsRemoved(QModelIndex, int, int)), _summary, SLOT(rowsRemoved(QModelIndex, int, int)));
+  connect(_model, SIGNAL(itemChanged(QStandardItem*)), _summary, SLOT(itemChanged(QStandardItem*)));
+
+  // Init at the end to be able to get jobs already in Launcher
+  if (_salome_services->initNS() == false)
+    DEBMSG("WARNING !!!!! SALOME IS NOT REACHABLE !!!!");
+  // refresh at the beacause we need that _salome_services be
+  // initialized
+  _resource_catalog->refresh_resource_list();
+}
+
+void 
+BL::GenericGui::createCentralWidget()
+{
+  DEBTRACE("createCentralWidget BL::GenericGui");
+
+  _tab_parent  = _wrapper->getTabParent();
+  /* Tab Central Widget */
   /* Buttons */
   _buttons = new BL::Buttons(_tab_parent);
   _buttons->setCreateButtonSlot(this, SLOT(create_job()));
+  _buttons->setEditCloneButtonSlot(this, SLOT(edit_clone_job()));
   _buttons->setStartButtonSlot(this, SLOT(start_job()));
+  _buttons->setReStartButtonSlot(this, SLOT(restart_job()));
   _buttons->setDeleteButtonSlot(this, SLOT(delete_job()));
+  _buttons->setStopButtonSlot(this, SLOT(stop_job()));
   _buttons->setRefreshButtonSlot(this, SLOT(refresh_job()));
   _buttons->setGetResultsButtonSlot(this, SLOT(get_results_job()));
 
   /* Jobs Table */
   _jobs_table = new BL::JobsTable(_tab_parent);
   _jobs_table->setModel(_model);
+  _jobs_table->set_main_gui(this);
 
   /* Job Tab */
   _job_tab = new BL::JobTab(_tab_parent, _jobs_manager);
   _job_tab->setModel(_model);
 
-  /* Tab Central Widget */
+  // Central Widget
   QWidget * central_widget = new QWidget(_tab_parent);
-
-  QSplitter * tab_central_widget = new QSplitter(Qt::Vertical, central_widget);
+  QSplitter * tab_central_widget = new QSplitter(Qt::Vertical, _tab_parent);
   tab_central_widget->addWidget(_jobs_table);
   tab_central_widget->addWidget(_job_tab);
   tab_central_widget->setChildrenCollapsible(false);
-
   QVBoxLayout * central_layout = new QVBoxLayout;
   central_layout->addWidget(_buttons);
   central_layout->addWidget(tab_central_widget);
   central_widget->setLayout(central_layout);
 
-  _tab_parent->setCentralWidget(central_widget);
-  // Test tab
-  //QDockWidget * dw_main = new QDockWidget(_tab_parent);
-  //dw_main->setWidget(central_widget);
-  //_tab_parent->addDockWidget(Qt::LeftDockWidgetArea, dw_main);
-
-  /* Summary */
-  _dw_summary = new QDockWidget(_dock_parent);
-  _dw_summary->setWindowTitle("Summary");
-  _summary = new BL::Summary(_dock_parent, _jobs_manager);
-  _summary->setModel(_model);
-  _dw_summary->setWidget(_summary);
-
-  /* MachineCatalog */
-  _dw_machine_catalog = new QDockWidget(_dock_parent);
-  _dw_machine_catalog->setWindowTitle("Machine Catalog");
-  _machine_catalog = new BL::MachineCatalog(_dock_parent, _salome_services);
-  _dw_machine_catalog->setWidget(_machine_catalog);
-
-  /* Main Dock Window */
-  _dock_parent->addDockWidget(Qt::RightDockWidgetArea, _jobs_manager);
-  _dock_parent->addDockWidget(Qt::RightDockWidgetArea, _dw_summary);
-  _dock_parent->addDockWidget(Qt::RightDockWidgetArea, _dw_machine_catalog);
-  _dock_parent->splitDockWidget(_jobs_manager, _dw_summary, Qt::Vertical);
-  _dock_parent->tabifyDockWidget(_dw_summary, _dw_machine_catalog);
+  // Adding a scroll area for low resolution
+  QScrollArea * scroll_central_widget = new QScrollArea(_tab_parent);
+  scroll_central_widget->setWidget(central_widget);
+  scroll_central_widget->setWidgetResizable(true);
+  _tab_parent->setCentralWidget(scroll_central_widget);
 
   /* Signals and Slots */
-
-  // JobsManager -> Model
-  connect(_jobs_manager, SIGNAL(new_job_added(QString)), _model_manager, SLOT(new_job_added(QString)));
-  connect(_jobs_manager, SIGNAL(job_state_changed(QString)), _model_manager, SLOT(job_state_changed(QString)));
-  connect(_jobs_manager, SIGNAL(job_state_changed(QString)), this, SLOT(job_state_changed(QString)));
-
-  // Model -> X
-  connect(_model, SIGNAL(rowsInserted(QModelIndex, int, int)), _summary, SLOT(rowsInserted(QModelIndex, int, int)));
-  connect(_model, SIGNAL(rowsRemoved(QModelIndex, int, int)), _summary, SLOT(rowsRemoved(QModelIndex, int, int)));
-  connect(_model, SIGNAL(itemChanged(QStandardItem*)), _summary, SLOT(itemChanged(QStandardItem*)));
+  // Model -> JobTab
   connect(_model, SIGNAL(itemChanged(QStandardItem*)), _job_tab, SLOT(itemChanged(QStandardItem*)));
 
   // TableView -> X
-  connect(_jobs_table, SIGNAL(clicked(QModelIndex)), _job_tab, SLOT(job_selected(QModelIndex)));
   connect(_jobs_table, SIGNAL(clicked(QModelIndex)), this, SLOT(job_selected(QModelIndex)));
-  connect(_jobs_table, SIGNAL(clicked(QModelIndex)), _model_manager, SLOT(job_selected(QModelIndex)));
-
-  // Delete Job -> X
-  connect(this, SIGNAL(job_deleted(QString)), _job_tab, SLOT(reset(QString)));
+  connect(_jobs_table, SIGNAL(activated(QModelIndex)), this, SLOT(job_activated(QModelIndex)));
 }
 
-BL::GenericGui::~GenericGui()
+void
+BL::GenericGui::deleteDockWidget()
 {
-  DEBTRACE("Destroying BL::GenericGui");
-
-  delete _salome_services;
+  // Specific for SALOME...
+  _dock_parent->removeDockWidget(_dw_summary);
+  delete _dw_summary;
+  _dock_parent->removeDockWidget(_dw_resource_catalog);
+  delete _dw_resource_catalog;
+  _dock_parent->removeDockWidget(_jobs_manager);
+  delete _jobs_manager;
 }
 
 void 
 BL::GenericGui::showDockWidgets(bool isVisible)
 {
   DEBTRACE("BL::GenericGui::showDockWidgets " << isVisible);
-  if (_jobs_manager) _jobs_manager->setVisible(isVisible);
-  if (_dw_summary) _dw_summary->setVisible(isVisible);
-  if (_dw_machine_catalog) _dw_machine_catalog->setVisible(isVisible);
+  if (_jobs_manager) {
+    _jobs_manager->setVisible(isVisible);
+    _jobs_manager->toggleViewAction()->setVisible(isVisible);
+  }
+  if (_dw_summary) {
+    _dw_summary->setVisible(isVisible);
+    _dw_summary->toggleViewAction()->setVisible(isVisible);
+  }
+  if (_dw_resource_catalog) {
+    _dw_resource_catalog->setVisible(isVisible);
+    _dw_resource_catalog->toggleViewAction()->setVisible(isVisible);
+  }
 }
 
 void
 BL::GenericGui::createActions()
 {
   DEBTRACE("CreateActions BL::GenericGui");
-  _create_job_action = _wrapper->createAction("Create Job", QIcon(), "Create Job", "Create Job", 0, _dock_parent, false, this, SLOT(create_job()));
-  _start_job_action = _wrapper->createAction("Start Job", QIcon(), "Start Job", "Start Job", 0, _dock_parent, false, this, SLOT(start_job()));
-  _delete_job_action = _wrapper->createAction("Delete Job", QIcon(), "Delete Job", "Delete Job", 0, _dock_parent, false, this, SLOT(delete_job()));
-  _refresh_job_action = _wrapper->createAction("Refresh Job", QIcon(), "Refresh Job", "Refresh Job", 0, _dock_parent, false, this, SLOT(refresh_job()));
+  _create_job_action = _wrapper->createAction("Create a Job", QIcon(), "Create a Job", "Create a Job", 0, _dock_parent, false, this, SLOT(create_job()));
+  _edit_clone_job_action = _wrapper->createAction("Edit/Clone a Job", QIcon(), "Edit/Clone a Job", "Edit/Clone a Job", 0, _dock_parent, false, this, SLOT(edit_clone_job()));
+  _start_job_action = _wrapper->createAction("Start a Job", QIcon(), "Start a Job", "Start a Job", 0, _dock_parent, false, this, SLOT(start_job()));
+  _restart_job_action = _wrapper->createAction("Restart a Job", QIcon(), "Restart a Job", "Restart a Job", 0, _dock_parent, false, this, SLOT(restart_job()));
+  _delete_job_action = _wrapper->createAction("Delete a Job", QIcon(), "Delete a Job", "Delete a Job", Qt::Key_Delete, _dock_parent, false, this, SLOT(delete_job()));
+  _refresh_job_action = _wrapper->createAction("Refresh Jobs", QIcon(), "Refresh Jobs", "Refresh Jobs", 0, _dock_parent, false, this, SLOT(refresh_job()));
   _get_results_job_action = _wrapper->createAction("Get Job Results", QIcon(), "Get Job Results", "Get Job Results", 0, _dock_parent, false, this, SLOT(refresh_job()));
+  _stop_job_action = _wrapper->createAction("Stop a Job", QIcon(), "Stop a Job", "Stop a Job", 0, _dock_parent, false, this, SLOT(stop_job()));
 }
 
 void
@@ -150,7 +198,10 @@ BL::GenericGui::createMenus()
   DEBTRACE("CreateMenus BL::GenericGui");
   int menu_id = _wrapper->createTopMenu("JobManager");
   _wrapper->addActionToMenu(_create_job_action, menu_id);
+  _wrapper->addActionToMenu(_edit_clone_job_action, menu_id);
   _wrapper->addActionToMenu(_start_job_action, menu_id);
+  _wrapper->addActionToMenu(_restart_job_action, menu_id);
+  _wrapper->addActionToMenu(_stop_job_action, menu_id);
   _wrapper->addActionToMenu(_delete_job_action, menu_id);
   _wrapper->addActionToMenu(_get_results_job_action, menu_id);
   _wrapper->addActionToMenu(_refresh_job_action, menu_id);
@@ -160,7 +211,14 @@ void
 BL::GenericGui::create_job()
 {
   DEBTRACE("Create Job Slot BL::GenericGui");
-  _jobs_manager->create_job_wizard();
+  _jobs_manager->create_job();
+}
+
+void
+BL::GenericGui::edit_clone_job()
+{
+  DEBTRACE("Edit/Clone Job Slot BL::GenericGui");
+  _jobs_manager->edit_clone_job(_job_name_selected.toStdString());
 }
 
 void
@@ -171,6 +229,14 @@ BL::GenericGui::start_job()
   updateButtonsStates();
 }
 
+void
+BL::GenericGui::restart_job()
+{
+  DEBTRACE("Restart Job Slot BL::GenericGui");
+  _jobs_manager->restart_job(_job_name_selected.toStdString());
+  updateButtonsStates();
+}
+
 void
 BL::GenericGui::refresh_job()
 {
@@ -182,51 +248,226 @@ void
 BL::GenericGui::get_results_job()
 {
   DEBTRACE("Get Results Job Slot BL::GenericGui");
-  _jobs_manager->get_results_job(_job_name_selected.toStdString());
+  if (!_jobs_table->isMultipleSelected())
+  {
+    _jobs_manager->get_results_job(_job_name_selected.toStdString());
+  }
+  else
+  {
+    QModelIndexList selected_rows = _jobs_table->selectionModel()->selectedRows();
+    for (int i = 0; i < selected_rows.length(); ++i)
+    {
+      QString job_name = _model->itemFromIndex(selected_rows[i])->text();
+    _jobs_manager->get_results_job(job_name.toStdString());
+    }
+  }
 }
 
+void
+BL::GenericGui::stop_job()
+{
+  DEBTRACE("Stop Job Slot BL::GenericGui");
+  if (!_jobs_table->isMultipleSelected())
+  {
+    _jobs_manager->stop_job(_job_name_selected.toStdString());
+  }
+  else
+  {
+    QModelIndexList selected_rows = _jobs_table->selectionModel()->selectedRows();
+    for (int i = 0; i < selected_rows.length(); ++i)
+    {
+      QString job_name = _model->itemFromIndex(selected_rows[i])->text();
+      _jobs_manager->stop_job(job_name.toStdString());
+    }
+  }
+}
+
+
 void
 BL::GenericGui::delete_job()
 {
   DEBTRACE("Delete Job Slot BL::GenericGui");
-  int ret = QMessageBox::warning(NULL, "Delete a job", "Do you really want to delete this job ?",
-                                QMessageBox::Ok|QMessageBox::Cancel,
-                                QMessageBox::Ok);
+  int ret = QMessageBox::Cancel;
+
+  if (!_jobs_table->isMultipleSelected())
+  {
+    ret = QMessageBox::warning(NULL, "Delete a job", "Do you really want to delete job " + _job_name_selected + " ? ",
+                               QMessageBox::Ok|QMessageBox::Cancel,
+                               QMessageBox::Ok);
+  }
+  else
+  {
+   ret = QMessageBox::warning(NULL, "Delete jobs", "Do you really want to delete these jobs ?",
+                              QMessageBox::Ok|QMessageBox::Cancel,
+                              QMessageBox::Ok);
+  }
   if (ret == QMessageBox::Ok)
   {
-    _jobs_manager->delete_job(_job_name_selected);
-    _model_manager->deleteJob(_row_selected);
-    emit job_deleted(_job_name_selected);
-    _row_selected = -1;
+    delete_job_internal();
+  }
+}
+
+void
+BL::GenericGui::delete_job_external(const QString & name)
+{
+  DEBTRACE("Delete Job External");
+  _jobs_manager->delete_job(name);
+  if (!_jobs_table->selectCurrent())
+  {
     _job_name_selected = "";
     updateButtonsStates();
   }
 }
 
+void
+BL::GenericGui::delete_job_internal()
+{
+  if (!_jobs_table->isMultipleSelected())
+  {
+    QModelIndexList selected_list = _jobs_table->getSelectedIndexes();
+    QString job_name_to_delete    = _model->itemFromIndex(selected_list[0])->text();
+    DEBTRACE("Single Deleting job: " << job_name_to_delete.toStdString());
+    _jobs_manager->delete_job(job_name_to_delete);
+    if (!_jobs_table->selectCurrent())
+    {
+      _job_name_selected = "";
+      updateButtonsStates();
+    }
+  }
+  else
+  {
+    QModelIndexList selected_list = _jobs_table->getSelectedIndexes();
+    QString job_name = _model->itemFromIndex(selected_list[0])->text();
+    DEBTRACE("Multiple Deleting job: " << job_name.toStdString());
+    _jobs_manager->delete_job(job_name);
+    delete_job_internal(); // Recursive delete
+  }
+}
+
+void
+BL::GenericGui::reset_job_selection()
+{
+  _job_name_selected = "";
+  _job_tab->reset("");
+  updateButtonsStates();
+}
+
 void
 BL::GenericGui::job_selected(const QModelIndex & index)
 {
-  DEBTRACE("BL::GenericGui::job_selected slot");
-  QStandardItem * item = _model->itemFromIndex(index);
-  QStandardItem * item_name = _model->item(item->row());
-  _row_selected = item->row();
-  _job_name_selected = item_name->text();
+  DEBTRACE("BL::GenericGui::job_selected");
+
+  //Find if a job is selected (ignore index)
+  //If Multiple job are selected, take first job
+  QItemSelectionModel * selection_model = _jobs_table->selectionModel();
+  QModelIndexList selected_rows = selection_model->selectedRows();
+  if (selected_rows.length() >= 1)
+  {
+    QModelIndex idx = selected_rows[0];
+    QStandardItem * item = _model->itemFromIndex(idx);
+    QStandardItem * item_name = _model->item(item->row());
+    _job_name_selected = item_name->text();
+    _job_tab->job_selected(idx);
+    DEBTRACE("BL::GenericGui::job_selected name is " << _job_name_selected.toStdString());
+  }
+  else
+  {
+    _job_name_selected = "";
+    _job_tab->reset("");
+    DEBTRACE("BL::GenericGui::job_selected - no jobs are selected");
+  }
   updateButtonsStates();
 }
 
-void 
+void
+BL::GenericGui::job_activated(const QModelIndex & index)
+{
+  DEBTRACE("BL::GenericGui::job_activated slot");
+  job_selected(index);
+}
+
+void
 BL::GenericGui::job_state_changed(const QString & name)
 {
   if (name == _job_name_selected)
     updateButtonsStates();
 }
+
 void
 BL::GenericGui::updateButtonsStates()
 {
-  DEBTRACE("BL::GenericGui::updateButtonsStates slot");
+  if (!_jobs_table->isMultipleSelected())
+  {
+    updateButtonsStatesSingleSelection();
+  }
+  else
+  {
+    _start_job_action->setEnabled(false);
+    _edit_clone_job_action->setEnabled(false);
+    _restart_job_action->setEnabled(false);
+    _buttons->disable_start_button();
+    _buttons->disable_edit_clone_button();
+    _buttons->disable_restart_button();
+
+    // You can always delete jobs
+    _delete_job_action->setEnabled(true);
+    _buttons->enable_delete_button();
+
+    // Enable stop ?
+    bool enable_stop = true;
+    QModelIndexList selected_rows = _jobs_table->selectionModel()->selectedRows();
+    for (int i = 0; i < selected_rows.length(); ++i)
+    {
+      QString job_name = _model->itemFromIndex(selected_rows[i])->text();
+      BL::Job * job = _jobs_manager->getJob(job_name.toStdString());
+      BL::Job::State job_state = job->getState();
+      if (job_state != BL::Job::QUEUED  &&
+          job_state != BL::Job::RUNNING &&
+          job_state != BL::Job::PAUSED)
+        enable_stop = false;
+    }
+    if (enable_stop)
+    {
+      _stop_job_action->setEnabled(true);
+      _buttons->enable_stop_button();
+    }
+    else
+    {
+      _stop_job_action->setEnabled(false);
+      _buttons->disable_stop_button();
+    }
+
+    // Enable get_results ?
+    bool enable_results = true;
+    for (int i = 0; i < selected_rows.length(); ++i)
+    {
+      QString job_name = _model->itemFromIndex(selected_rows[i])->text();
+      BL::Job * job = _jobs_manager->getJob(job_name.toStdString());
+      BL::Job::State job_state = job->getState();
+      if (job_state != BL::Job::FINISHED &&
+          job_state != BL::Job::FAILED)
+        enable_results= false;
+    }
+    if (enable_results)
+    {
+      _get_results_job_action->setEnabled(true);
+      _buttons->enable_get_results_button();
+    }
+    else
+    {
+      _get_results_job_action->setEnabled(false);
+      _buttons->disable_get_results_button();
+    }
+  }
+}
+
+void
+BL::GenericGui::updateButtonsStatesSingleSelection()
+{
+  DEBTRACE("BL::GenericGui::updateButtonsStatesSingleSelection slot");
 
   // First case: no job selected
-  if (_job_name_selected == "" and _row_selected == -1)
+  if (_job_name_selected == "")
   {
     _start_job_action->setEnabled(false);
     _delete_job_action->setEnabled(false);
@@ -234,12 +475,20 @@ BL::GenericGui::updateButtonsStates()
     _buttons->disable_start_button();
     _buttons->disable_delete_button();
     _buttons->disable_get_results_button();
+    _edit_clone_job_action->setEnabled(false);
+    _buttons->disable_edit_clone_button();
+    _restart_job_action->setEnabled(false);
+    _buttons->disable_restart_button();
+    _stop_job_action->setEnabled(false);
+    _buttons->disable_stop_button();
   }
-  else if (_job_name_selected != "" and _row_selected != -1)
+  else if (_job_name_selected != "")
   {
     BL::Job * job = _jobs_manager->getJob(_job_name_selected.toStdString());
     BL::Job::State job_state = job->getState();
 
+    _edit_clone_job_action->setEnabled(true);
+    _buttons->enable_edit_clone_button();
     switch (job_state)
     {
       case BL::Job::CREATED:
@@ -249,6 +498,10 @@ BL::GenericGui::updateButtonsStates()
        _buttons->enable_start_button();
        _buttons->enable_delete_button();
        _buttons->disable_get_results_button();
+       _restart_job_action->setEnabled(false);
+       _buttons->disable_restart_button();
+        _stop_job_action->setEnabled(false);
+        _buttons->disable_stop_button();
        break;
 
       case BL::Job::IN_PROCESS:
@@ -258,6 +511,10 @@ BL::GenericGui::updateButtonsStates()
        _buttons->disable_delete_button();
        _get_results_job_action->setEnabled(false);
        _buttons->disable_get_results_button();
+       _restart_job_action->setEnabled(false);
+       _buttons->disable_restart_button();
+        _stop_job_action->setEnabled(false);
+        _buttons->disable_stop_button();
        break;
 
       case BL::Job::QUEUED:
@@ -267,6 +524,10 @@ BL::GenericGui::updateButtonsStates()
        _buttons->enable_delete_button();
        _get_results_job_action->setEnabled(false);
        _buttons->disable_get_results_button();
+       _restart_job_action->setEnabled(false);
+       _buttons->disable_restart_button();
+        _stop_job_action->setEnabled(true);
+        _buttons->enable_stop_button();
        break;
 
       case BL::Job::RUNNING:
@@ -276,6 +537,10 @@ BL::GenericGui::updateButtonsStates()
        _buttons->enable_delete_button();
        _get_results_job_action->setEnabled(false);
        _buttons->disable_get_results_button();
+       _restart_job_action->setEnabled(false);
+       _buttons->disable_restart_button();
+        _stop_job_action->setEnabled(true);
+        _buttons->enable_stop_button();
        break;
 
       case BL::Job::PAUSED:
@@ -285,6 +550,10 @@ BL::GenericGui::updateButtonsStates()
        _buttons->enable_delete_button();
        _get_results_job_action->setEnabled(false);
        _buttons->disable_get_results_button();
+       _restart_job_action->setEnabled(false);
+       _buttons->disable_restart_button();
+        _stop_job_action->setEnabled(true);
+        _buttons->enable_stop_button();
        break;
 
       case BL::Job::ERROR:
@@ -294,6 +563,10 @@ BL::GenericGui::updateButtonsStates()
        _buttons->enable_delete_button();
        _get_results_job_action->setEnabled(false);
        _buttons->disable_get_results_button();
+       _restart_job_action->setEnabled(true);
+       _buttons->enable_restart_button();
+        _stop_job_action->setEnabled(false);
+        _buttons->disable_stop_button();
        break;
 
       case BL::Job::FINISHED:
@@ -303,6 +576,36 @@ BL::GenericGui::updateButtonsStates()
        _buttons->enable_delete_button();
        _get_results_job_action->setEnabled(true);
        _buttons->enable_get_results_button();
+       _restart_job_action->setEnabled(true);
+       _buttons->enable_restart_button();
+        _stop_job_action->setEnabled(false);
+        _buttons->disable_stop_button();
+       break;
+
+      case BL::Job::FAILED:
+       _start_job_action->setEnabled(false);
+       _buttons->disable_start_button();
+       _delete_job_action->setEnabled(true);
+       _buttons->enable_delete_button();
+       _get_results_job_action->setEnabled(true);
+       _buttons->enable_get_results_button();
+       _restart_job_action->setEnabled(true);
+       _buttons->enable_restart_button();
+        _stop_job_action->setEnabled(false);
+        _buttons->disable_stop_button();
+       break;
+
+      case BL::Job::NOT_CREATED:
+       _start_job_action->setEnabled(false);
+       _buttons->disable_start_button();
+       _delete_job_action->setEnabled(true);
+       _buttons->enable_delete_button();
+       _get_results_job_action->setEnabled(false);
+       _buttons->disable_get_results_button();
+       _restart_job_action->setEnabled(true);
+       _buttons->enable_restart_button();
+        _stop_job_action->setEnabled(false);
+        _buttons->disable_stop_button();
        break;
     }
   }
index 161a24e41184b1a91a92889e3870fbc45eebdc85..6310175205a43f4f8aa4c93a70b1eaa32171fc99 100644 (file)
@@ -1,20 +1,20 @@
-//  Copyright (C) 2009 CEA/DEN, EDF R&D
+// Copyright (C) 2009-2012  CEA/DEN, EDF R&D
 //
-//  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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #ifndef _BL_GENERICGUI_HXX_
@@ -22,6 +22,8 @@
 
 #include <QtGui>
 
+#include "BL_GenericGuiDefines.hxx"
+
 #include "BL_Traces.hxx"
 
 #include "BL_SALOMEServices.hxx"
 #include "BL_JobTab.hxx"
 #include "BL_Buttons.hxx"
 #include "BL_Summary.hxx"
-#include "BL_MachineCatalog.hxx"
+#include "JM_ResourceCatalog.hxx"
 
 namespace BL 
 {
-  class GenericGui: public QObject
+  class BL_GenericGui_EXPORT GenericGui: public QObject
   {
     Q_OBJECT
 
@@ -46,25 +48,41 @@ namespace BL
       GenericGui(BL::MainWindows_Wrap * wrapper);
       virtual ~GenericGui();
 
+      void createDockWidgets();
+      void createCentralWidget();
+
       void showDockWidgets(bool isVisible);
       void createActions();
       void createMenus();
 
+      void delete_job_internal();
+
+      void deleteDockWidget();
+      void delete_job_external(const QString & name);
+
+      void reset_job_selection();
+
+
     public slots:
       void create_job();
+      void edit_clone_job();
       void start_job();
+      void restart_job();
       void delete_job();
       void refresh_job();
+      void stop_job();
       void get_results_job();
       void job_selected(const QModelIndex & index);
+      void job_activated(const QModelIndex & index);
       void job_state_changed(const QString & name);
       void updateButtonsStates();
+      void updateButtonsStatesSingleSelection();
 
-    signals:
-      void job_deleted(QString job_name);
+    public:
+      BL::JobTab * _job_tab;
+      BL::JobsTable * _jobs_table;
 
     protected:
-     
       BL::MainWindows_Wrap * _wrapper;
 
       BL::SALOMEServices * _salome_services;
@@ -72,25 +90,25 @@ namespace BL
       QMainWindow * _dock_parent;
       QMainWindow * _tab_parent;
       QDockWidget * _dw_summary;
-      QDockWidget * _dw_machine_catalog;
-     
+      QDockWidget * _dw_resource_catalog;
+
       BL::Buttons * _buttons;
-      BL::JobsTable * _jobs_table;  
-      BL::JobTab * _job_tab;
       BL::Summary * _summary;
 
       QAction * _create_job_action;
+      QAction * _edit_clone_job_action;
       QAction * _start_job_action;
+      QAction * _restart_job_action;
       QAction * _delete_job_action;
+      QAction * _stop_job_action;
       QAction * _get_results_job_action;
       QAction * _refresh_job_action;
 
       BL::JobsManager_QT * _jobs_manager;
       BL::QModelManager * _model_manager;
       QStandardItemModel * _model;
-      BL::MachineCatalog * _machine_catalog;
+      JM::ResourceCatalog * _resource_catalog;
 
-      int _row_selected;
       QString _job_name_selected;
   };
 }
diff --git a/src/genericgui/BL_GenericGuiDefines.hxx b/src/genericgui/BL_GenericGuiDefines.hxx
new file mode 100755 (executable)
index 0000000..186b80e
--- /dev/null
@@ -0,0 +1,32 @@
+// Copyright (C) 2009-2012  CEA/DEN, EDF R&D
+//
+// 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_GENERICGUIDEFINES_HXX__
+#define __BL_GENERICGUIDEFINES_HXX__
+
+#ifdef WNT
+#  if defined BL_GenericGui_EXPORTS
+#    define BL_GenericGui_EXPORT __declspec( dllexport )
+#  else
+#    define BL_GenericGui_EXPORT __declspec( dllimport )
+#  endif
+#else
+#  define BL_GenericGui_EXPORT
+#endif
+
+#endif
index 5f139cc7f0bf71e0cae8dc84b94dbaaed103b2bb..91fbfd66b0e8f4b35bc36de64ffaf229127b3de7 100644 (file)
@@ -1,25 +1,29 @@
-//  Copyright (C) 2009 CEA/DEN, EDF R&D
+// Copyright (C) 2009-2012  CEA/DEN, EDF R&D
 //
-//  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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #include "BL_JobTab.hxx"
 #include "BL_Traces.hxx"
 
+#ifdef WNT
+#undef ERROR
+#endif
+
 BL::JobTab::JobTab(QWidget *parent, BL::JobsManager_QT * jobs_manager) : QTabWidget(parent)
 {
   DEBTRACE("Creating BL::JobTab");
@@ -31,9 +35,6 @@ BL::JobTab::JobTab(QWidget *parent, BL::JobsManager_QT * jobs_manager) : QTabWid
 
   createJobSummaryTab();
   createJobFilesTab();
-
-  addTab(_summary_tab, "Job Summary");
-  addTab(_files_tab, "Job Files");
 }
 
 BL::JobTab::~JobTab()
@@ -61,19 +62,30 @@ BL::JobTab::createJobSummaryTab()
   _job_type_label_value = new QLabel("");
   QLabel * job_state_label = new QLabel("State:");
   _job_state_label_value = new QLabel("");
-  QLabel * job_machine_label = new QLabel("Machine:");
-  _job_machine_label_value = new QLabel("");
-  _job_command_label = new QLabel("Schema or Command:");
-  _job_command_label_value = new QLabel("");
+  QLabel * job_launcher_label = new QLabel("Launcher Id:");
+  _job_launcher_label_value = new QLabel("");
+  QLabel * job_resource_label = new QLabel("Resource:");
+  _job_resource_label_value = new QLabel("");
+  QLabel * job_jobfile_label = new QLabel("Job File:");
+  _job_jobfile_label_value = new QLabel("");
+  QLabel * job_envfile_label = new QLabel("Env File:");
+  _job_envfile_label_value = new QLabel("");
+
+
+  // Specific values
+  _yacs_dump_state_label = new QLabel("YACS dump state:");
+  _yacs_dump_state_value = new QLabel("");
 
   QGroupBox * main_values_box = new QGroupBox("Main values");
-  QFormLayout * values_form = new QFormLayout;
-  values_form->insertRow(0, job_name_label, _job_name_label_value);
-  values_form->insertRow(1, job_type_label, _job_type_label_value);
-  values_form->insertRow(2, job_state_label, _job_state_label_value);
-  values_form->insertRow(3, job_machine_label, _job_machine_label_value);
-  values_form->insertRow(4, _job_command_label, _job_command_label_value);
-  main_values_box->setLayout(values_form);
+  _main_values_form = new QFormLayout;
+  _main_values_form->insertRow(0, job_name_label, _job_name_label_value);
+  _main_values_form->insertRow(1, job_type_label, _job_type_label_value);
+  _main_values_form->insertRow(2, job_state_label, _job_state_label_value);
+  _main_values_form->insertRow(3, job_launcher_label, _job_launcher_label_value);
+  _main_values_form->insertRow(4, job_resource_label, _job_resource_label_value);
+  _main_values_form->insertRow(5, job_jobfile_label, _job_jobfile_label_value);
+  _main_values_form->insertRow(6, job_envfile_label, _job_envfile_label_value);
+  main_values_box->setLayout(_main_values_form);
 
   QLabel * job_nif_label = new QLabel("Number of Input Files:");
   _job_nif_label_value = new QLabel("");
@@ -84,39 +96,49 @@ BL::JobTab::createJobSummaryTab()
   QLabel * job_rd_label = new QLabel("Result directory:");
   _job_rd_label_value = new QLabel("");
 
-  QLabel * job_edt_label = new QLabel("Expected during time:");
-  _job_edt_label_value = new QLabel("");
+  QLabel * job_mdt_label = new QLabel("Maximum duration:");
+  _job_mdt_label_value = new QLabel("");
   QLabel * job_em_label = new QLabel("Expected memory:");
   _job_em_label_value = new QLabel("");
   QLabel * job_nop_label = new QLabel("Number of processors:");
   _job_nop_label_value = new QLabel("");
 
+  // Specific values
+  _batch_queue_label = new QLabel("Batch queue:");
+  _batch_queue_value = new QLabel("");
+  _ll_jobtype_label = new QLabel("LoadLeveler JobType:");
+  _ll_jobtype_value = new QLabel("");
+
   QGroupBox * run_values_box = new QGroupBox("Run values");
-  QFormLayout * run_values_form = new QFormLayout;
-  run_values_form->insertRow(0, job_nif_label, _job_nif_label_value);
-  run_values_form->insertRow(1, job_nof_label, _job_nof_label_value);
-  run_values_form->insertRow(2, job_bd_label, _job_bd_label_value);
-  run_values_form->insertRow(3, job_rd_label, _job_rd_label_value);
-  QFormLayout * other_run_values_form = new QFormLayout;
-  other_run_values_form->insertRow(0, job_edt_label, _job_edt_label_value);
-  other_run_values_form->insertRow(1, job_em_label, _job_em_label_value);
-  other_run_values_form->insertRow(2, job_nop_label, _job_nop_label_value);
+  _run_values_form = new QFormLayout;
+  _run_values_form->insertRow(0, job_nif_label, _job_nif_label_value);
+  _run_values_form->insertRow(1, job_nof_label, _job_nof_label_value);
+  _run_values_form->insertRow(2, job_bd_label, _job_bd_label_value);
+  _run_values_form->insertRow(3, job_rd_label, _job_rd_label_value);
+  _other_run_values_form = new QFormLayout;
+  _other_run_values_form->insertRow(0, job_mdt_label, _job_mdt_label_value);
+  _other_run_values_form->insertRow(1, job_em_label, _job_em_label_value);
+  _other_run_values_form->insertRow(2, job_nop_label, _job_nop_label_value);
   QHBoxLayout * box_layout = new QHBoxLayout();
-  box_layout->addLayout(run_values_form);
-  box_layout->addLayout(other_run_values_form);
+  box_layout->addLayout(_run_values_form);
+  box_layout->addLayout(_other_run_values_form);
   run_values_box->setLayout(box_layout);
 
   QVBoxLayout * mainLayout = new QVBoxLayout();
   mainLayout->addWidget(main_values_box);
   mainLayout->addWidget(run_values_box);
   _summary_tab->setLayout(mainLayout);
+
+  removeTab(0);
+  insertTab(0, _summary_tab, "Job Summary");
+  setCurrentIndex(0);
 }
 
 void
 BL::JobTab::createJobFilesTab()
 {
   _files_tab = new QWidget(this);
-  
+
   _input_files_list = new QListWidget(this);
   _input_files_list->setSelectionMode(QAbstractItemView::NoSelection);
   QGroupBox * input_files_box = new QGroupBox("Input Files");
@@ -135,6 +157,8 @@ BL::JobTab::createJobFilesTab()
   mainLayout->addWidget(input_files_box);
   mainLayout->addWidget(output_files_box);
   _files_tab->setLayout(mainLayout);
+
+  insertTab(1, _files_tab, "Job Files");
 }
 
 void
@@ -147,6 +171,8 @@ BL::JobTab::job_selected(const QModelIndex & index)
   {
     BL::Job * job = _jobs_manager->getJob(item_name->text().toStdString());
 
+    reset("");
+
     _job_name_label_value->setText(QString(job->getName().c_str()));
 
     if (job->getState() == BL::Job::CREATED)
@@ -161,23 +187,24 @@ BL::JobTab::job_selected(const QModelIndex & index)
       _job_state_label_value->setText("Paused");
     else if (job->getState() == BL::Job::ERROR)
       _job_state_label_value->setText("Error");
+    else if (job->getState() == BL::Job::FAILED)
+      _job_state_label_value->setText("Failed");
+    else if (job->getState() == BL::Job::NOT_CREATED)
+      _job_state_label_value->setText("Not Created");
     else 
       _job_state_label_value->setText("Finished");
 
+    _job_launcher_label_value->setText(QVariant(job->getSalomeLauncherId()).toString());
+    _job_jobfile_label_value->setText(QString(job->getJobFile().c_str()));
+    _job_envfile_label_value->setText(QString(job->getEnvFile().c_str()));
     if (job->getType() == BL::Job::YACS_SCHEMA)
-    {
-      _job_command_label->setText("Schema:");
-      _job_command_label_value->setText(QString(job->getYACSFile().c_str()));
       _job_type_label_value->setText("YACS_Schema");
-    }
-    else
-    {
-      _job_command_label->setText("Command:");
-      _job_command_label_value->setText(QString(job->getCommand().c_str()));
+    else if (job->getType() == BL::Job::COMMAND)
       _job_type_label_value->setText("Command");
-    }
+    else if (job->getType() == BL::Job::PYTHON_SALOME)
+      _job_type_label_value->setText("Python_Salome");
 
-    _job_machine_label_value->setText(QString(job->getMachine().c_str()));
+    _job_resource_label_value->setText(QString(job->getResource().c_str()));
 
     BL::Job::BatchParam batch_params = job->getBatchParameters();
 
@@ -189,10 +216,12 @@ BL::JobTab::job_selected(const QModelIndex & index)
     _job_bd_label_value->setText(QString(batch_params.batch_directory.c_str()));
     _job_rd_label_value->setText(QString(files_params.result_directory.c_str()));
 
-    _job_edt_label_value->setText(QString(batch_params.expected_during_time.c_str()));
+    _job_mdt_label_value->setText(QString(batch_params.maximum_duration.c_str()));
     _job_em_label_value->setText(QString(batch_params.expected_memory.c_str()));
     _job_nop_label_value->setText(QVariant(batch_params.nb_proc).toString());
 
+    _input_files_list->clear();
+    _output_files_list->clear();
     std::list<std::string>::iterator it;
     for (it = files_params.input_files_list.begin(); it != files_params.input_files_list.end(); it++)
     {
@@ -205,6 +234,23 @@ BL::JobTab::job_selected(const QModelIndex & index)
       _output_files_list->addItem(QString(file.c_str()));
     }
 
+    // Specific parameters management
+    if (job->getDumpYACSState() > 0)
+    {
+      // Add widget in the layout
+      _yacs_dump_state_value->setText(QVariant(job->getDumpYACSState()).toString());
+      _main_values_form->insertRow(7, _yacs_dump_state_label, _yacs_dump_state_value);
+    }
+    if (job->getBatchQueue() != "")
+    {
+      _batch_queue_value->setText(QVariant(job->getBatchQueue().c_str()).toString());
+      _other_run_values_form->insertRow(_other_run_values_form->rowCount(), _batch_queue_label, _batch_queue_value);
+    }
+    if (job->getLoadLevelerJobType() != "")
+    {
+      _ll_jobtype_value->setText(QVariant(job->getLoadLevelerJobType().c_str()).toString());
+      _other_run_values_form->insertRow(_other_run_values_form->rowCount(), _ll_jobtype_label, _ll_jobtype_value);
+    }
   }
   else
     DEBTRACE ("itemFromIndex returns 0 !");
@@ -232,6 +278,10 @@ BL::JobTab::itemChanged(QStandardItem * item)
       _job_state_label_value->setText("Paused");
     else if (job->getState() == BL::Job::ERROR)
       _job_state_label_value->setText("Error");
+    else if (job->getState() == BL::Job::FAILED)
+      _job_state_label_value->setText("Failed");
+    else if (job->getState() == BL::Job::NOT_CREATED)
+      _job_state_label_value->setText("Not Created");
     else 
       _job_state_label_value->setText("Finished");
   }
@@ -240,20 +290,28 @@ BL::JobTab::itemChanged(QStandardItem * item)
 void
 BL::JobTab::reset(QString job_name)
 {
-  _job_name_label_value->setText("");
-  _job_type_label_value->setText("");
-  _job_state_label_value->setText("");
-  _job_machine_label_value->setText("");
-  _job_nif_label_value->setText("");
-  _job_nof_label_value->setText("");
-  _job_bd_label_value->setText("");
-  _job_rd_label_value->setText("");
-  _job_edt_label_value->setText("");
-  _job_em_label_value->setText("");
-  _job_nop_label_value->setText("");
-  _job_command_label->setText("Schema or Command:");
-  _job_command_label_value->setText("");
-
-  _input_files_list->clear();
-  _output_files_list->clear();
+  if (job_name == _job_name_label_value->text() || job_name == "")
+  {
+    _job_name_label_value->setText("");
+    _job_type_label_value->setText("");
+    _job_state_label_value->setText("");
+    _job_launcher_label_value->setText("");
+    _job_resource_label_value->setText("");
+    _job_nif_label_value->setText("");
+    _job_nof_label_value->setText("");
+    _job_bd_label_value->setText("");
+    _job_rd_label_value->setText("");
+    _job_mdt_label_value->setText("");
+    _job_em_label_value->setText("");
+    _job_nop_label_value->setText("");
+    _job_jobfile_label_value->setText("");
+    _job_envfile_label_value->setText("");
+
+    _input_files_list->clear();
+    _output_files_list->clear();
+
+    _yacs_dump_state_value->setText("");
+    _batch_queue_value->setText("");
+    _ll_jobtype_value->setText("");
+  }
 }
index 2f68cc0c343d66cacea8a5f4fca7b0a2f523bb8c..44f58543f666bc1d4e1c11edf2b983f243e1bdd1 100644 (file)
@@ -1,20 +1,20 @@
-//  Copyright (C) 2009 CEA/DEN, EDF R&D
+// Copyright (C) 2009-2012  CEA/DEN, EDF R&D
 //
-//  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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #ifndef _BL_JOBTAB_HXX_
@@ -24,7 +24,7 @@
 
 #include "BL_JobsManager_QT.hxx"
 
-namespace BL 
+namespace BL
 {
   class JobTab: public QTabWidget
   {
@@ -38,9 +38,9 @@ namespace BL
 
       void createJobSummaryTab();
       void createJobFilesTab();
+      void job_selected(const QModelIndex & index);
 
     public slots:
-      void job_selected(const QModelIndex & index);
       void itemChanged(QStandardItem * item);
       void reset(QString job_name);
 
@@ -50,24 +50,36 @@ namespace BL
       BL::JobsManager_QT * _jobs_manager;
 
       QWidget * _summary_tab;
+      QWidget * _files_tab;
+
       // Main Values
+      QFormLayout * _main_values_form;
       QLabel * _job_name_label_value;
       QLabel * _job_type_label_value;
       QLabel * _job_state_label_value;
-      QLabel * _job_machine_label_value;
-      QLabel * _job_command_label;
-      QLabel * _job_command_label_value;
+      QLabel * _job_launcher_label_value;
+      QLabel * _job_resource_label_value;
+      QLabel * _job_jobfile_label_value;
+      QLabel * _job_envfile_label_value;
 
       // Run Values
+      QFormLayout * _run_values_form;
+      QFormLayout * _other_run_values_form;
       QLabel * _job_nif_label_value;
       QLabel * _job_nof_label_value;
       QLabel * _job_bd_label_value;
       QLabel * _job_rd_label_value;
-      QLabel * _job_edt_label_value;
+      QLabel * _job_mdt_label_value;
       QLabel * _job_em_label_value;
       QLabel * _job_nop_label_value;
 
-      QWidget * _files_tab;
+      // Specific Values
+      QLabel * _yacs_dump_state_label;
+      QLabel * _yacs_dump_state_value;
+      QLabel * _batch_queue_label;
+      QLabel * _batch_queue_value;
+      QLabel * _ll_jobtype_label;
+      QLabel * _ll_jobtype_value;
 
       QListWidget * _input_files_list;
       QListWidget * _output_files_list;
index 04cc1b52caed3d1c78f6e25f998ba04ec93e4e6e..5e83edd73e2a538b1363b7a66b49e9f626b67cd6 100644 (file)
@@ -1,23 +1,24 @@
-//  Copyright (C) 2009 CEA/DEN, EDF R&D
+// Copyright (C) 2009-2012  CEA/DEN, EDF R&D
 //
-//  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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #include "BL_JobsManager_QT.hxx"
+#include "BL_GenericGui.hxx"
 
 BL::JobManagerEvent::JobManagerEvent(const std::string & action_i, 
                                     const std::string & event_name_i, 
@@ -32,11 +33,13 @@ BL::JobManagerEvent::JobManagerEvent(const std::string & action_i,
 
 BL::JobManagerEvent::~JobManagerEvent() {}  
 
-BL::JobsManager_QT::JobsManager_QT(QWidget * parent, BL::SALOMEServices * salome_services) : 
+BL::JobsManager_QT::JobsManager_QT(QWidget * parent, BL::GenericGui * main_gui, BL::SALOMEServices * salome_services) : 
   QDockWidget(parent), BL::JobsManager(salome_services)
 {
   DEBTRACE("Creating BL::JobsManager_QT");
+  _main_gui = main_gui;
   setObserver(this);
+  _model_manager = NULL;
 
   // Widget Part
 
@@ -44,6 +47,9 @@ BL::JobsManager_QT::JobsManager_QT(QWidget * parent, BL::SALOMEServices * salome
 
   _load_jobs = new QPushButton("Load Jobs");
   _save_jobs = new QPushButton("Save Jobs");
+  connect(_load_jobs, SIGNAL(clicked()), this, SLOT(load_jobs_button()));
+  connect(_save_jobs, SIGNAL(clicked()), this, SLOT(save_jobs_button()));
+
   _auto_refresh_jobs = new QPushButton("Auto Refresh: no");
   _timer = new QTimer(this);
   _timer->stop();
@@ -77,7 +83,10 @@ BL::JobsManager_QT::JobsManager_QT(QWidget * parent, BL::SALOMEServices * salome
   mainLayout->addWidget(message_box);
   main_widget->setLayout(mainLayout);
 
-  setWidget(main_widget);
+  QScrollArea * scroll_widget = new QScrollArea(this);
+  scroll_widget->setWidget(main_widget);
+  scroll_widget->setWidgetResizable(true);
+  setWidget(scroll_widget);
   setWindowTitle("Job Manager");
 }
 
@@ -86,6 +95,59 @@ BL::JobsManager_QT::~JobsManager_QT()
   DEBTRACE("Destroying BL::JobsManager_QT");
 }
 
+void
+BL::JobsManager_QT::set_model_manager(BL::QModelManager * model_manager)
+{
+  _model_manager = model_manager;
+}
+
+void
+BL::JobsManager_QT::load_jobs_button()
+{
+  DEBTRACE("load_jobs");
+  QString jobs_file = QFileDialog::getOpenFileName(this,
+                                                   tr("Choose an xml jobs file"), "",
+                                                   tr("xml (*.xml);;All Files (*)"));
+  if (jobs_file == "")
+  {
+    write_normal_text("Load jobs action cancelled\n");
+  }
+  else
+    load_jobs(jobs_file.toStdString());
+}
+
+void
+BL::JobsManager_QT::save_jobs_button()
+{
+  DEBTRACE("save_jobs");
+  QFileDialog dialog(this, "Save jobs file");
+  QStringList filters;
+  filters << "XML files (*.xml)"
+          << "Any files (*)";
+  dialog.setFileMode(QFileDialog::AnyFile);
+  dialog.setFilters(filters);
+  dialog.selectFilter("(*.xml)");
+  dialog.setDefaultSuffix("xml");
+  dialog.setConfirmOverwrite(true);
+  dialog.setAcceptMode(QFileDialog::AcceptSave);
+  QString jobs_file("");
+  QStringList fileNames;
+  fileNames.clear();
+  if (bool ret = dialog.exec())
+  {
+    DEBTRACE(ret << " " << dialog.confirmOverwrite());
+    fileNames = dialog.selectedFiles();
+    if (!fileNames.isEmpty())
+      jobs_file= fileNames.first();
+  }
+  if (jobs_file == "")
+  {
+    write_normal_text("Save jobs action cancelled\n");
+  }
+  else
+    save_jobs(jobs_file.toStdString());
+}
+
 void
 BL::JobsManager_QT::RefreshJobs()
 {
@@ -147,54 +209,51 @@ BL::JobsManager_QT::one_hour_refresh()
   _timer->start(1 * 60 * 60 * 1000);
 }
 
+void 
+BL::JobsManager_QT::restart_job(const std::string & name)
+{
+  DEBTRACE("Restart job with name: " << name);
+  BL::CreateJobWizard wizard(this, _salome_services);
+  wizard.clone(name);
+  wizard.end(1);
+  wizard.job_name = name;
+  wizard.start_job = true;
+  _main_gui->delete_job_internal();
+  create_job_with_wizard(wizard);
+}
+
+void 
+BL::JobsManager_QT::edit_clone_job(const std::string & name)
+{
+  BL::CreateJobWizard wizard(this, _salome_services);
+  wizard.clone(name);
+  wizard.exec();
+
+  // Check if the job has the same name
+  if (name == wizard.job_name)
+  {
+    DEBTRACE("Job " << name << " has been edited");
+    _main_gui->delete_job_internal();
+  }
+
+  if (wizard.job_name != "")
+  {
+    create_job_with_wizard(wizard);
+  }
+  else
+  {
+    DEBTRACE("User cancel Create Job Wizard");
+  }
+}
+
 void
-BL::JobsManager_QT::create_job_wizard()
+BL::JobsManager_QT::create_job()
 {
     BL::CreateJobWizard wizard(this, _salome_services);
     wizard.exec();
-
     if (wizard.job_name != "")
     {
-      BL::Job * new_job = addNewJob(wizard.job_name);
-      if (wizard.yacs_file != "")
-      {
-       // YACS schema job
-       new_job->setType(BL::Job::YACS_SCHEMA);
-       new_job->setYACSFile(wizard.yacs_file);
-       BL::Job::BatchParam param;
-       param.batch_directory = wizard.batch_directory;
-       param.expected_during_time = wizard.expected_during_time;
-       param.expected_memory = wizard.expected_memory;
-       param.nb_proc = wizard.nb_proc;
-       new_job->setBatchParameters(param);
-       BL::Job::FilesParam files_params;
-       files_params.result_directory = wizard.result_directory;
-       files_params.input_files_list = wizard.input_files_list;
-       files_params.output_files_list = wizard.output_files_list;
-       new_job->setFilesParameters(files_params);
-       new_job->setMachine(wizard.machine_choosed);
-      }
-      else
-      {
-       // Command Job
-       new_job->setType(BL::Job::COMMAND);
-       new_job->setCommand(wizard.command);
-       BL::Job::BatchParam param;
-       param.batch_directory = wizard.batch_directory;
-       param.expected_during_time = wizard.expected_during_time;
-       param.expected_memory = wizard.expected_memory;
-       param.nb_proc = wizard.nb_proc;
-       new_job->setBatchParameters(param);
-       BL::Job::FilesParam files_params;
-       files_params.result_directory = wizard.result_directory;
-       files_params.input_files_list = wizard.input_files_list;
-       files_params.output_files_list = wizard.output_files_list;
-       new_job->setFilesParameters(files_params);
-       new_job->setMachine(wizard.machine_choosed);
-      }
-      emit new_job_added(QString::fromStdString(wizard.job_name));
-      if (wizard.start_job)
-       start_job(wizard.job_name);
+      create_job_with_wizard(wizard);
     }
     else
     {
@@ -202,10 +261,64 @@ BL::JobsManager_QT::create_job_wizard()
     }
 }
 
+void 
+BL::JobsManager_QT::create_job_with_wizard(BL::CreateJobWizard & wizard)
+{
+  BL::Job * new_job = createJob(wizard.job_name);
+  if (wizard.yacs_file != "")
+  {
+    // YACS schema job
+    new_job->setType(BL::Job::YACS_SCHEMA);
+    new_job->setJobFile(wizard.yacs_file);
+    new_job->setDumpYACSState(wizard.dump_yacs_state);
+  }
+  else if (wizard.command != "")
+  {
+    // Command Job
+    new_job->setType(BL::Job::COMMAND);
+    new_job->setJobFile(wizard.command);
+  }
+  else if (wizard.python_salome_file != "")
+  {
+    // Command Job
+    new_job->setType(BL::Job::PYTHON_SALOME);
+    new_job->setJobFile(wizard.python_salome_file);
+  }
+
+  // For all jobs
+  new_job->setEnvFile(wizard.env_file);
+  BL::Job::BatchParam param;
+  param.batch_directory = wizard.batch_directory;
+  param.maximum_duration = wizard.maximum_duration;
+  param.expected_memory = wizard.expected_memory;
+  param.nb_proc = wizard.nb_proc;
+  new_job->setBatchParameters(param);
+  BL::Job::FilesParam files_params;
+  files_params.result_directory = wizard.result_directory;
+  files_params.input_files_list = wizard.input_files_list;
+  files_params.output_files_list = wizard.output_files_list;
+  new_job->setFilesParameters(files_params);
+  new_job->setResource(wizard.resource_choosed);
+  new_job->setBatchQueue(wizard.batch_queue);
+  new_job->setLoadLevelerJobType(wizard.ll_jobtype);
+
+  // End
+  addJobToLauncher(wizard.job_name);
+  emit new_job_added(QString::fromStdString(wizard.job_name));
+  QStandardItemModel * model = _model_manager->getModel();
+  QList<QStandardItem *> item_list = model->findItems(QString::fromStdString(wizard.job_name));
+  QStandardItem * job_state_item = model->item(item_list.at(0)->row(), 2);
+  _main_gui->_jobs_table->selectRow(item_list.at(0)->row());
+  if (wizard.start_job)
+    start_job(wizard.job_name);
+}
+
 void
 BL::JobsManager_QT::delete_job(QString job_name)
 {
   BL::JobsManager::removeJob(job_name.toStdString());
+  _model_manager->delete_job(job_name);
+  _main_gui->_job_tab->reset(job_name);
 }
 
 void 
@@ -233,7 +346,24 @@ BL::JobsManager_QT::event(QEvent * e)
           << event->event_name << " "
           << event->job_name << " "
           << event->data);
-  if (event->action == "start_job")
+
+  if (event->action == "create_job")
+  {
+    if (event->event_name == "Ok")
+    {
+      QString str((event->job_name).c_str());
+      write_normal_text("Job " + str + " created\n");
+    }
+    else
+    {
+      QString str((event->job_name).c_str());
+      write_error_text("Error in creating job: " + str + "\n");
+      write_error_text("*** ");
+      write_error_text((event->data).c_str());
+      write_error_text(" ***\n");
+    }
+  }
+  else if (event->action == "start_job")
   {
     if (event->event_name == "Ok")
     {
@@ -254,8 +384,10 @@ BL::JobsManager_QT::event(QEvent * e)
   {
     if (event->event_name == "Ok")
     {
-      QString str((event->job_name).c_str());
-      write_normal_text("Job " + str + " state changed\n");
+      QString name((event->job_name).c_str());
+      QString state((event->data).c_str());
+      state = state.toLower();
+      write_normal_text("Job " + name + " new state is " + state + "\n");
       emit job_state_changed(QString((event->job_name).c_str()));
     }
     else
@@ -299,6 +431,66 @@ BL::JobsManager_QT::event(QEvent * e)
       write_error_text(" ***\n");
     }
   }
+  else if (event->action == "stop_job")
+  {
+    if (event->event_name == "Ok")
+    {
+      QString str((event->job_name).c_str());
+      write_normal_text("Job " + str + " is stopped\n");
+    }
+    else
+    {
+      QString str((event->job_name).c_str());
+      write_error_text("Error when trying to stop job: " + str + "\n");
+      write_error_text("*** ");
+      write_error_text((event->data).c_str());
+      write_error_text(" ***\n");
+    }
+  }
+  else if (event->action == "save_jobs")
+  {
+    if (event->event_name == "Error")
+    {
+      write_error_text("Error in saving jobs: \n");
+      write_error_text("*** ");
+      write_error_text((event->data).c_str());
+      write_error_text(" ***\n");
+    }
+    else
+    {
+      QString str((event->data).c_str());
+      write_normal_text("Jobs saved in file " + str + "\n");
+    }
+  }
+  else if (event->action == "load_jobs")
+  {
+    if (event->event_name == "Error")
+    {
+      write_error_text("Error in loading jobs: \n");
+      write_error_text("*** ");
+      write_error_text((event->data).c_str());
+      write_error_text(" ***\n");
+    }
+    else
+    {
+      QString str((event->data).c_str());
+      write_normal_text("Jobs loaded from file " + str + "\n");
+    }
+  }
+  else if (event->action == "add_job")
+  {
+    if (event->event_name == "Ok")
+    {
+      QString str((event->job_name).c_str());
+      write_normal_text("New job added " + str + "\n");
+      emit new_job_added(str);
+    }
+  }
+  else if (event->action == "to_remove_job")
+  {
+    if (event->event_name == "Ok")
+      _main_gui->delete_job_external((event->job_name).c_str());
+  }
   else
   {
     QString str((event->action).c_str());
@@ -322,9 +514,11 @@ BL::JobsManager_QT::write_normal_text(const QString & text)
 void 
 BL::JobsManager_QT::write_error_text(const QString & text)
 {
+  _log->setReadOnly(false);
   QTextCursor cursor = _log->textCursor();
   QTextCharFormat text_format;
   text_format.setForeground(Qt::red);
   cursor.insertText(text, text_format);
   _log->setTextCursor(cursor);
+  _log->setReadOnly(true);
 }
index b1b09802df08feb0eeeaac241e2fb6854b91481c..d26d689769856acc48f5d40d8b38b04ea61ddd5e 100644 (file)
@@ -1,20 +1,20 @@
-//  Copyright (C) 2009 CEA/DEN, EDF R&D
+// Copyright (C) 2009-2012  CEA/DEN, EDF R&D
 //
-//  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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #ifndef _BL_JOBSMANAGER_QT_HXX_
@@ -25,6 +25,8 @@
 #include "BL_Traces.hxx"
 #include "BL_JobsManager.hxx"
 #include "BL_CreateJobWizard.hxx"
+#include "BL_JobsManager.hxx"
+#include "BL_QModelManager.hxx"
 
 #include <string>
 
@@ -34,9 +36,9 @@ namespace BL{
   {
     public:
       JobManagerEvent(const std::string & action_i, 
-                     const std::string & event_name_i, 
-                     const std::string & job_name_i, 
-                     const std::string & data_i);
+                      const std::string & event_name_i, 
+                      const std::string & job_name_i, 
+                      const std::string & data_i);
       virtual ~JobManagerEvent();
 
     public:
@@ -46,28 +48,37 @@ namespace BL{
       std::string data;
   };
 
+  class GenericGui;
   class JobsManager_QT: virtual public QDockWidget,
-                       virtual public BL::JobsManager,
-                       virtual public BL::Observer
+                        virtual public BL::JobsManager,
+                        virtual public BL::Observer
   {
     Q_OBJECT
 
     public:
-      JobsManager_QT(QWidget * parent, BL::SALOMEServices * salome_services);
+      JobsManager_QT(QWidget * parent, BL::GenericGui * main_gui, BL::SALOMEServices * salome_services);
       virtual ~JobsManager_QT();
 
       void delete_job(QString job_name);
-      void create_job_wizard();
+
+      void create_job();
+      void edit_clone_job(const std::string & name);
+      void restart_job(const std::string & name);
 
       virtual void sendEvent(const std::string & action, 
-                            const std::string & event_name, 
-                            const std::string & job_name, 
-                            const std::string & data);
+                             const std::string & event_name, 
+                             const std::string & job_name, 
+                             const std::string & data);
       bool event(QEvent * e);
 
       void write_normal_text(const QString & text);
       void write_error_text(const QString & text);
 
+      void set_model_manager(BL::QModelManager * model_manager);
+
+    protected:
+      void create_job_with_wizard(BL::CreateJobWizard & wizard);
+
     public slots:
       void RefreshJobs();
       void no_auto_refresh();
@@ -77,6 +88,8 @@ namespace BL{
       void five_minutes_refresh();
       void thirty_minutes_refresh();
       void one_hour_refresh();
+      void load_jobs_button();
+      void save_jobs_button();
 
     signals:
       void new_job_added(const QString & name);
@@ -88,6 +101,8 @@ namespace BL{
       QPushButton * _auto_refresh_jobs;
       QTimer * _timer;
       QTextEdit * _log;
+      BL::GenericGui * _main_gui;
+      BL::QModelManager * _model_manager;
   };
 
 }
index 8a1f3fbd1193cf6287254cdbf3ddfe0979c27b75..fe4b8566bf9f9691eed93ad6332c78c5cdace6c3 100644 (file)
@@ -1,39 +1,43 @@
-//  Copyright (C) 2009 CEA/DEN, EDF R&D
+// Copyright (C) 2009-2012  CEA/DEN, EDF R&D
 //
-//  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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #include "BL_JobsTable.hxx"
 #include "BL_Traces.hxx"
+#include "BL_GenericGui.hxx"
 
 BL::JobsTable::JobsTable(QWidget *parent) : QTableView(parent)
 {
   DEBTRACE("Creating BL::JobsTable");
   BL_ASSERT(parent);
   _parent = parent;
+  _main_gui = NULL;
 
   // Init
   setShowGrid(false);
   setCornerButtonEnabled(false);
   setEditTriggers(QAbstractItemView::NoEditTriggers);
-  setSelectionBehavior(QAbstractItemView::SelectRows);
   setAlternatingRowColors(true);
   setSortingEnabled(true);
 
+  setSelectionBehavior(QAbstractItemView::SelectRows);
+  setSelectionMode(QAbstractItemView::ExtendedSelection);
+
   QHeaderView * header_view = verticalHeader();
   header_view->setClickable(false);
 }
@@ -42,3 +46,80 @@ BL::JobsTable::~JobsTable()
 {
   DEBTRACE("Destroying BL::JobsTable");
 }
+
+bool
+BL::JobsTable::selectCurrent()
+{
+  QModelIndex idx = currentIndex();
+  if (idx.row() > -1)
+    if (!isMultipleSelected())
+    {
+      DEBTRACE("SELECT CURRENT ACTIVATION !!!");
+      setCurrentIndex(idx);
+      activated(idx);
+      return true;
+    }
+  return false;
+}
+
+void
+BL::JobsTable::set_main_gui(BL::GenericGui * main_gui)
+{
+  _main_gui = main_gui;
+}
+
+void 
+BL::JobsTable::selectionChanged ( const QItemSelection & selected, const QItemSelection & deselected )
+{
+  QTableView::selectionChanged(selected, deselected);
+  DEBTRACE("selection changed");
+  QModelIndexList selected_rows = selectionModel()->selectedRows();
+  if (selected_rows.length() == 0)
+  {
+    _main_gui->reset_job_selection();
+  }
+  else if (selected_rows.length() == 1)
+  {
+    DEBTRACE("SELECTED CHANGED ACTIVATION !!!");
+    DEBTRACE("ROW NUMBER: " << selected_rows[0].row());
+    QModelIndex current = selected_rows[0];
+    if (!selectionModel()->isSelected(current))
+    {
+      setCurrentIndex(current);
+    }
+    activated(current);
+  }
+  DEBTRACE("Number of selected rows selection: " << selected_rows.length());
+}
+
+void
+BL::JobsTable::currentChanged(const QModelIndex & current, const QModelIndex & previous)
+{
+  QTableView::currentChanged(current, previous);
+  DEBTRACE("current changed");
+  DEBTRACE("current row: " << current.row());
+  if (current.row() > -1)
+    if (!isMultipleSelected())
+    {
+      DEBTRACE("CURRENT CHANGED ACTIVATION !!!");
+      //setCurrentIndex(current);
+      //activated(current);
+    }
+}
+
+bool
+BL::JobsTable::isMultipleSelected()
+{
+  QModelIndexList selected_rows = selectionModel()->selectedRows();
+  DEBTRACE("Number of selected rows: " << selected_rows.length());
+  if (selected_rows.length() > 1)
+    return true;
+  else
+    return false;
+}
+
+QModelIndexList
+BL::JobsTable::getSelectedIndexes()
+{
+  return selectedIndexes();
+}
index ace8b2f2fe7e1bc5c959f496e83809e20c22f9ef..2a356e3d8f20079c47d990c359565197264b126f 100644 (file)
@@ -1,20 +1,20 @@
-//  Copyright (C) 2009 CEA/DEN, EDF R&D
+// Copyright (C) 2009-2012  CEA/DEN, EDF R&D
 //
-//  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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #ifndef _BL_JOBSTABLE_HXX_
@@ -22,8 +22,9 @@
 
 #include <QtGui>
 
-namespace BL 
+namespace BL
 {
+  class GenericGui;
   class JobsTable: public QTableView
   {
     Q_OBJECT
@@ -32,9 +33,20 @@ namespace BL
       JobsTable(QWidget *parent);
       virtual ~JobsTable();
 
+      bool selectCurrent();
+      bool isMultipleSelected();
+      QModelIndexList getSelectedIndexes();
+      void set_main_gui(BL::GenericGui * main_gui);
+
     protected:
       QWidget* _parent;
 
+    protected slots:
+      void selectionChanged ( const QItemSelection & selected, const QItemSelection & deselected );
+      void currentChanged(const QModelIndex & current, const QModelIndex & previous);
+
+    private:
+      BL::GenericGui * _main_gui;
   };
 }
 
diff --git a/src/genericgui/BL_MachineCatalog.cxx b/src/genericgui/BL_MachineCatalog.cxx
deleted file mode 100644 (file)
index eae8ded..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-//  Copyright (C) 2009 CEA/DEN, EDF R&D
-//
-//  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 "BL_MachineCatalog.hxx"
-#include "BL_Traces.hxx"
-
-BL::MachineCatalog::MachineCatalog(QWidget *parent, BL::SALOMEServices * salome_services) : QWidget(parent)
-{
-  DEBTRACE("Creating BL::MachineCatalog");
-  BL_ASSERT(parent);
-  BL_ASSERT(salome_services);
-  _parent = parent;
-  _salome_services = salome_services;
-  
-  _refresh_button = new QPushButton("Refresh Machine List");
-  _refresh_button->show();
-  connect(_refresh_button, SIGNAL(clicked()), this, SLOT(refresh_machine_list()));
-  _machine_files_list = new QListWidget(this);
-  _machine_files_list->setSelectionMode(QAbstractItemView::NoSelection);
-  std::list<std::string> machine_list = _salome_services->getMachineList();
-  std::list<std::string>::iterator it;
-  for (it = machine_list.begin(); it != machine_list.end(); it++)
-  {
-    std::string machine = *it;
-    _machine_files_list->addItem(QString(machine.c_str()));
-  }
-
-  QVBoxLayout * mainLayout = new QVBoxLayout(this);
-  mainLayout->addWidget(_refresh_button);
-  mainLayout->addWidget(_machine_files_list);
-  setLayout(mainLayout);
-}
-
-BL::MachineCatalog::~MachineCatalog()
-{
-  DEBTRACE("Destroying BL::MachineCatalog");
-}
-
-void
-BL::MachineCatalog::refresh_machine_list()
-{
-  _machine_files_list->clear();
-  std::list<std::string> machine_list = _salome_services->getMachineList();
-  std::list<std::string>::iterator it;
-  for (it = machine_list.begin(); it != machine_list.end(); it++)
-  {
-    std::string machine = *it;
-    _machine_files_list->addItem(QString(machine.c_str()));
-  }
-}
diff --git a/src/genericgui/BL_MachineCatalog.hxx b/src/genericgui/BL_MachineCatalog.hxx
deleted file mode 100644 (file)
index 95355b4..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-//  Copyright (C) 2009 CEA/DEN, EDF R&D
-//
-//  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_MACHINECATALOG_HXX_
-#define _BL_MACHINECATALOG_HXX_
-
-#include <QtGui>
-
-#include "BL_SALOMEServices.hxx"
-
-#include <string>
-#include <list>
-
-namespace BL 
-{
-  class MachineCatalog: public QWidget
-  {
-    Q_OBJECT
-
-    public:
-      MachineCatalog(QWidget *parent, BL::SALOMEServices * salome_services);
-      virtual ~MachineCatalog();
-
-    public slots:
-      void refresh_machine_list();
-
-    protected:
-      QWidget* _parent;
-      BL::SALOMEServices * _salome_services;
-
-      QPushButton * _refresh_button;
-      QListWidget * _machine_files_list;
-  };
-}
-
-#endif
-
-
diff --git a/src/genericgui/BL_MainButtons.cxx b/src/genericgui/BL_MainButtons.cxx
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/src/genericgui/BL_MainButtons.hxx b/src/genericgui/BL_MainButtons.hxx
deleted file mode 100644 (file)
index e69de29..0000000
index 6412dd21d37c8fe7d9a8cc79fe669ecc8f0f0335..a8324ec32e8473f0e17d44ffe2acbf60d53954ce 100644 (file)
@@ -1,23 +1,28 @@
-//  Copyright (C) 2009 CEA/DEN, EDF R&D
+// Copyright (C) 2009-2012  CEA/DEN, EDF R&D
 //
-//  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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #include "BL_QModelManager.hxx"
+#include "BL_JobsManager_QT.hxx"
+
+#ifdef WNT
+#undef ERROR
+#endif
 
 BL::QModelManager::QModelManager(QObject * parent, BL::JobsManager_QT * jobs_manager) : QObject(parent)
 {
@@ -26,8 +31,9 @@ BL::QModelManager::QModelManager(QObject * parent, BL::JobsManager_QT * jobs_man
   _jobs_manager = jobs_manager;
 
   _model = new QStandardItemModel(this);
+  jobs_manager->set_model_manager(this);
   QStringList headers;
-  headers << "Job Name" << "Type" << "State" << "Machine";
+  headers << "Job Name" << "Type" << "State" << "Resource" << "Launcher Id";
   _model->setHorizontalHeaderLabels(headers);
 }
 
@@ -47,14 +53,17 @@ BL::QModelManager::getModel()
 void
 BL::QModelManager::new_job_added(const QString & name)
 {
+  DEBTRACE("Adding new job in the model manager");
   BL::Job * job = _jobs_manager->getJob(name.toStdString());
   QStandardItem * new_job_name = new QStandardItem(name);
   
   QStandardItem * new_job_type;
   if (job->getType() == BL::Job::YACS_SCHEMA)
     new_job_type = new QStandardItem("YACS_Schema");
-  else
+  else if (job->getType() == BL::Job::COMMAND)
     new_job_type = new QStandardItem("Command");
+  else if (job->getType() == BL::Job::PYTHON_SALOME)
+    new_job_type = new QStandardItem("Python_Salome");
 
   QStandardItem * new_job_state;
   if (job->getState() == BL::Job::CREATED)
@@ -67,16 +76,24 @@ BL::QModelManager::new_job_added(const QString & name)
     new_job_state = new QStandardItem("Paused");
   else if (job->getState() == BL::Job::ERROR)
     new_job_state = new QStandardItem("Error");
+  else if (job->getState() == BL::Job::FAILED)
+    new_job_state = new QStandardItem("Failed");
+  else if (job->getState() == BL::Job::NOT_CREATED)
+    new_job_state = new QStandardItem("Not Created");
   else 
     new_job_state = new QStandardItem("Finished");
 
-  QStandardItem * new_job_machine =  new QStandardItem(job->getMachine().c_str());
+  QStandardItem * new_job_resource =  new QStandardItem(job->getResource().c_str());
+  QString id_str;
+  id_str.setNum(job->getSalomeLauncherId());
+  QStandardItem * new_job_id =  new QStandardItem(id_str);
 
   int row = _model->rowCount();
   _model->setItem(row, 0, new_job_name);
   _model->setItem(row, 1, new_job_type);
   _model->setItem(row, 2, new_job_state);
-  _model->setItem(row, 3, new_job_machine);
+  _model->setItem(row, 3, new_job_resource);
+  _model->setItem(row, 4, new_job_id);
 }
 
 void
@@ -98,34 +115,23 @@ BL::QModelManager::job_state_changed(const QString & name)
     job_state_item->setText("Paused");
   else if (job->getState() == BL::Job::ERROR)
     job_state_item->setText("Error");
+  else if (job->getState() == BL::Job::FAILED)
+    job_state_item->setText("Failed");
+  else if (job->getState() == BL::Job::NOT_CREATED)
+    job_state_item->setText("Not Created");
   else 
     job_state_item->setText("Finished");
 }
 
 void
-BL::QModelManager::deleteJob(int row)
+BL::QModelManager::delete_job(const QString & name)
 {
-  _model->removeRow(row);
-}
-
-void
-BL::QModelManager::job_selected(const QModelIndex & index)
-{
-  DEBTRACE("BL::QModelManager::job_selected slot");
-  QStandardItem * item = _model->itemFromIndex(index);
-  int row = item->row();
-
-  // Algo un peu bourrin....
-  for (int i = 0; i < _model->rowCount(); i++)
-    for (int j = 0; j < _model->columnCount(); j++)
-    {
-      _model->item(i,j)->setBackground(QBrush(Qt::white));
-      _model->item(i,j)->setForeground(QBrush(Qt::black));
-    }
-
-  for (int j = 0; j < _model->columnCount(); j++)
+  QList<QStandardItem *> list = _model->findItems(name);
+  if (list.size() != 1)
   {
-    _model->item(row,j)->setBackground(QBrush(Qt::darkBlue));
-    _model->item(row,j)->setForeground(QBrush(Qt::white));
+    DEBMSG("LIST SIZE IS :" << list.size());
+    DEBMSG("FOR NAME :" << name.toStdString());
   }
+  if (list.size() > 0)
+    _model->removeRow(list[0]->row());
 }
index 868d93a48ca8a8115115bf2c6a99c649be17feab..d5dfee513778a1dc70327d36221db1ceaa31c699 100644 (file)
@@ -1,20 +1,20 @@
-//  Copyright (C) 2009 CEA/DEN, EDF R&D
+// Copyright (C) 2009-2012  CEA/DEN, EDF R&D
 //
-//  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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #ifndef _BL_QMODELMANAGER_HXX_
 #include <QtGui>
 
 #include "BL_Job.hxx"
-#include "BL_JobsManager_QT.hxx"
 
 namespace BL{
 
+  class JobsManager_QT;
   class QModelManager: virtual public QObject
   {
     Q_OBJECT
@@ -37,12 +37,11 @@ namespace BL{
       
       QStandardItemModel * getModel();
 
-      void deleteJob(int row);
+      void delete_job(const QString & name);
 
     public slots:
       void new_job_added(const QString & name);
       void job_state_changed(const QString & name);
-      void job_selected(const QModelIndex & index);
     
     private:
       QStandardItemModel * _model;
index 4cb67fc6b9c429cde72e5bf6b81f6e8c4f24fd8f..cd58ab89fc529aafc3506a87fb3d62f1add34e15 100644 (file)
@@ -1,20 +1,20 @@
-//  Copyright (C) 2009 CEA/DEN, EDF R&D
+// Copyright (C) 2009-2012  CEA/DEN, EDF R&D
 //
-//  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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #include "BL_Summary.hxx"
index b972388f51afeed56f77dd077dea36ebf84e1528..9cf5fcdd119c80c466b709522f8aeaab443fd4be 100644 (file)
@@ -1,20 +1,20 @@
-//  Copyright (C) 2009 CEA/DEN, EDF R&D
+// Copyright (C) 2009-2012  CEA/DEN, EDF R&D
 //
-//  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 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.
+// 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
+// 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
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #ifndef _BL_SUMMARY_HXX_
diff --git a/src/genericgui/JM_EditSalomeResource.cxx b/src/genericgui/JM_EditSalomeResource.cxx
new file mode 100644 (file)
index 0000000..9d1edf6
--- /dev/null
@@ -0,0 +1,391 @@
+// Copyright (C) 2009-2012  CEA/DEN, EDF R&D
+//
+// 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 "JM_EditSalomeResource.hxx"
+#include "BL_Traces.hxx"
+
+JM::EditSalomeResource::EditSalomeResource(QWidget *parent, BL::SALOMEServices * salome_services,
+                                           const std::string & resource_name) : QDialog(parent)
+{
+  DEBTRACE("Creating JM::EditSalomeResource");
+  BL_ASSERT(parent);
+  BL_ASSERT(salome_services);
+  _parent = parent;
+  _salome_services = salome_services;
+  _resource_name = resource_name;
+
+  //setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
+
+  // Widget code
+
+  // Part 1
+  QGroupBox * main_groupBox = new QGroupBox("Main values");
+  QLabel * name_label = new QLabel("Name:");
+  _name_line = new QLineEdit(this);
+  QLabel * hostname_label = new QLabel("Hostname:");
+  _hostname_line = new QLineEdit(this);
+  QLabel * username_label = new QLabel("Username:");
+  _username_line = new QLineEdit(this);
+  QLabel * applipath_label = new QLabel("Applipath:");
+  _applipath_line = new QLineEdit(this);
+
+  QLabel * protocol_label = new QLabel("Protocol:");
+  _protocol_line = new QComboBox(this);
+  _protocol_line->addItem("ssh");
+  _protocol_line->addItem("rsh");
+  _protocol_line->addItem("srun");
+  _protocol_line->addItem("pbsdsh");
+  _protocol_line->addItem("blaunch");
+  _protocol_line->setCurrentIndex(-1);
+
+  QLabel * componentList_label = new QLabel("Component List:");
+  _add_button = new QPushButton("Add");
+  _remove_button = new QPushButton("Remove");
+  _remove_button->setEnabled(false);
+  QWidget * component_widget = new QWidget(this);
+  _componentList = new QListWidget(this);
+  _componentList->setSelectionMode(QAbstractItemView::MultiSelection);
+  QGridLayout * input_box = new QGridLayout(this);
+  input_box->addWidget(_add_button, 0, 0);
+  input_box->addWidget(_remove_button, 0, 1);
+  input_box->addWidget(_componentList, 1, 0, 1, -1);
+  component_widget->setLayout(input_box);
+  connect(_add_button, SIGNAL(clicked()), this, SLOT(add_component()));
+  connect(_remove_button, SIGNAL(clicked()), this, SLOT(remove_components()));
+  connect(_componentList, SIGNAL(itemSelectionChanged()), this, SLOT(itemSelectionChanged()));
+
+  QLabel * working_directory_label = new QLabel("Working Directory:");
+  _working_directory = new QLineEdit(this);
+  QLabel * is_cluster_head_label = new QLabel("Is Cluster Head:");
+  _is_cluster_head = new QPushButton(this);
+  _is_cluster_head->setCheckable(true);
+  connect(_is_cluster_head, SIGNAL(toggled(bool)), this, SLOT(toggle_is_cluster_head(bool)));
+  toggle_is_cluster_head(false); // Default is false
+
+  QGridLayout * m_layout = new QGridLayout;
+  m_layout->addWidget(name_label, 0, 0);
+  m_layout->addWidget(_name_line, 0, 1);
+  m_layout->addWidget(hostname_label, 1, 0);
+  m_layout->addWidget(_hostname_line, 1, 1);
+  m_layout->addWidget(protocol_label, 2, 0);
+  m_layout->addWidget(_protocol_line, 2, 1);
+  m_layout->addWidget(username_label, 3, 0);
+  m_layout->addWidget(_username_line, 3, 1);
+  m_layout->addWidget(applipath_label, 4, 0);
+  m_layout->addWidget(_applipath_line, 4, 1);
+  m_layout->addWidget(componentList_label, 5, 0);
+  m_layout->addWidget(component_widget, 5, 1);
+  m_layout->addWidget(is_cluster_head_label, 6, 0);
+  m_layout->addWidget(_is_cluster_head, 6, 1);
+  m_layout->addWidget(working_directory_label, 7, 0);
+  m_layout->addWidget(_working_directory, 7, 1);
+  main_groupBox->setLayout(m_layout);
+
+  // Part 2
+  QGroupBox * config_groupBox = new QGroupBox("Configuration values");
+  QLabel * os_label = new QLabel("OS:");
+  _os_line = new QLineEdit(this);
+
+  QLabel * mem_mb_label = new QLabel("Memory (mb):");
+  _mem_mb_line = new QSpinBox(this);
+  _mem_mb_line->setMinimum(0);
+  _mem_mb_line->setMaximum(1000000);
+  _mem_mb_line->setValue(0);
+  QLabel * cpu_clock_label = new QLabel("CPU Clock:");
+  _cpu_clock_line = new QSpinBox(this);
+  _cpu_clock_line->setMinimum(0);
+  _cpu_clock_line->setMaximum(1000000);
+  _cpu_clock_line->setValue(0);
+  QLabel * nb_node_label = new QLabel("Nb node:");
+  _nb_node_line = new QSpinBox(this);
+  _nb_node_line->setMinimum(1);
+  _nb_node_line->setMaximum(1000000);
+  _nb_node_line->setValue(1);
+  QLabel * nb_proc_per_node_label = new QLabel("Nb proc/node:");
+  _nb_proc_per_node_line = new QSpinBox(this);
+  _nb_proc_per_node_line->setMinimum(1);
+  _nb_proc_per_node_line->setMaximum(1000000);
+  _nb_proc_per_node_line->setValue(1);
+
+  QLabel * iprotocol_label = new QLabel("Internal protocol:");
+  _iprotocol_line = new QComboBox(this);
+  _iprotocol_line->addItem("ssh");
+  _iprotocol_line->addItem("rsh");
+  _iprotocol_line->addItem("srun");
+  _iprotocol_line->addItem("pbsdsh");
+  _iprotocol_line->addItem("blaunch");
+  _iprotocol_line->setCurrentIndex(-1);
+
+  QLabel * batch_label = new QLabel("Batch:");
+  _batch_line = new QComboBox(this);
+  _batch_line->addItem("pbs");
+  _batch_line->addItem("lsf");
+  _batch_line->addItem("sge");
+  _batch_line->addItem("ssh");
+  _batch_line->addItem("ccc");
+  _batch_line->addItem("slurm");
+  _batch_line->addItem("ll");
+  _batch_line->addItem("vishnu");
+  _batch_line->setCurrentIndex(-1);
+
+  QLabel * mpiImpl_label = new QLabel("MPI impl:");
+  _mpiImpl_line = new QComboBox(this);
+  _mpiImpl_line->addItem("lam");
+  _mpiImpl_line->addItem("mpich1");
+  _mpiImpl_line->addItem("mpich2");
+  _mpiImpl_line->addItem("openmpi");
+  _mpiImpl_line->addItem("slurmmpi");
+  _mpiImpl_line->addItem("prun");
+  _mpiImpl_line->setCurrentIndex(-1);
+
+  QGridLayout * c_layout = new QGridLayout;
+  c_layout->addWidget(os_label, 0, 0);
+  c_layout->addWidget(_os_line, 0, 1);
+  c_layout->addWidget(mem_mb_label, 1, 0);
+  c_layout->addWidget(_mem_mb_line, 1, 1);
+  c_layout->addWidget(cpu_clock_label, 2, 0);
+  c_layout->addWidget(_cpu_clock_line, 2, 1);
+  c_layout->addWidget(nb_node_label, 3, 0);
+  c_layout->addWidget(_nb_node_line, 3, 1);
+  c_layout->addWidget(nb_proc_per_node_label, 4, 0);
+  c_layout->addWidget(_nb_proc_per_node_line, 4, 1);
+  c_layout->addWidget(batch_label, 5, 0);
+  c_layout->addWidget(_batch_line, 5, 1);
+  c_layout->addWidget(mpiImpl_label, 6, 0);
+  c_layout->addWidget(_mpiImpl_line, 6, 1);
+  c_layout->addWidget(iprotocol_label, 7, 0);
+  c_layout->addWidget(_iprotocol_line, 7, 1);
+  config_groupBox->setLayout(c_layout);
+
+  // Part 3
+  QDialogButtonBox * buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok
+                                                      | QDialogButtonBox::Cancel);
+
+  connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
+  connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
+
+  // Main Layout
+  QVBoxLayout * mainLayout = new QVBoxLayout(this);
+  mainLayout->addWidget(main_groupBox);
+  mainLayout->addWidget(config_groupBox);
+  mainLayout->addWidget(buttonBox);
+  setLayout(mainLayout);
+
+  setWindowTitle("Edit/Add a resource");
+  if (_resource_name != "")
+    get_infos();
+}
+
+JM::EditSalomeResource::~EditSalomeResource()
+{
+  DEBTRACE("Destroying JM::EditSalomeResource");
+}
+
+void
+JM::EditSalomeResource::get_infos()
+{
+  BL::ResourceDescr resource_descr = _salome_services->getResourceDescr(_resource_name);
+
+  _name_line->setText(QString(resource_descr.name.c_str()));
+  _hostname_line->setText(QString(resource_descr.hostname.c_str()));
+  _username_line->setText(QString(resource_descr.username.c_str()));
+  _applipath_line->setText(QString(resource_descr.applipath.c_str()));
+  _os_line->setText(QString(resource_descr.OS.c_str()));
+  _working_directory->setText(QString(resource_descr.working_directory.c_str()));
+  _is_cluster_head->setChecked(resource_descr.is_cluster_head);
+
+  std::string protocol = resource_descr.protocol.c_str();
+  if (protocol == "ssh")
+    _protocol_line->setCurrentIndex(0);
+  else if(protocol == "rsh")
+    _protocol_line->setCurrentIndex(1);
+  else if(protocol == "srun")
+    _protocol_line->setCurrentIndex(2);
+  else if(protocol == "pbsdsh")
+    _protocol_line->setCurrentIndex(3);
+  else if(protocol == "blaunch")
+    _protocol_line->setCurrentIndex(4);
+  else
+    _protocol_line->setCurrentIndex(-1);
+
+  std::string iprotocol = resource_descr.iprotocol.c_str();
+  if (iprotocol == "ssh")
+    _iprotocol_line->setCurrentIndex(0);
+  else if (iprotocol == "rsh")
+    _iprotocol_line->setCurrentIndex(1);
+  else if (iprotocol == "srun")
+    _iprotocol_line->setCurrentIndex(2);
+  else if (iprotocol == "pbsdsh")
+    _iprotocol_line->setCurrentIndex(3);
+  else if (iprotocol == "blaunch")
+    _iprotocol_line->setCurrentIndex(4);
+  else
+    _iprotocol_line->setCurrentIndex(-1);
+
+  std::string batch = resource_descr.batch.c_str();
+  if (batch == "pbs")
+    _batch_line->setCurrentIndex(0);
+  else if (batch == "lsf")  
+    _batch_line->setCurrentIndex(1);
+  else if (batch == "sge")  
+    _batch_line->setCurrentIndex(2);
+  else if (batch == "ssh")
+    _batch_line->setCurrentIndex(3);
+  else if (batch == "ccc")
+    _batch_line->setCurrentIndex(4);
+  else if (batch == "slurm")
+    _batch_line->setCurrentIndex(5);
+  else if (batch == "ll")
+    _batch_line->setCurrentIndex(6);
+  else if (batch == "vishnu")
+    _batch_line->setCurrentIndex(7);
+  else
+    _batch_line->setCurrentIndex(-1);
+
+  std::string mpiImpl = resource_descr.mpiImpl.c_str();
+  if (mpiImpl == "lam")
+    _mpiImpl_line->setCurrentIndex(0);
+  else if (mpiImpl == "mpich1")  
+    _mpiImpl_line->setCurrentIndex(1);
+  else if (mpiImpl == "mpich2")  
+    _mpiImpl_line->setCurrentIndex(2);
+  else if (mpiImpl == "openmpi")
+    _mpiImpl_line->setCurrentIndex(3);
+  else if (mpiImpl == "slurmmpi")
+    _mpiImpl_line->setCurrentIndex(4);
+  else if (mpiImpl == "prun")
+    _mpiImpl_line->setCurrentIndex(5);
+  else  
+    _mpiImpl_line->setCurrentIndex(-1);
+
+  int value = resource_descr.mem_mb;
+  if (value > 0)
+    _mem_mb_line->setValue(value);
+  value = resource_descr.cpu_clock;
+  if (value > 0)
+    _cpu_clock_line->setValue(value);
+  value = resource_descr.nb_node;
+  if (value > 1)
+    _nb_node_line->setValue(value);
+  value = resource_descr.nb_proc_per_node;
+  if (value > 1)
+    _nb_proc_per_node_line->setValue(value);
+
+   std::list<std::string>::iterator it = resource_descr.componentList.begin();
+   for(; it != resource_descr.componentList.end(); it++)
+     _componentList->addItem(QString((*it).c_str()));
+   
+  // Better if string's length is bigger than the widget
+  _name_line->setCursorPosition(0);
+  _hostname_line->setCursorPosition(0);
+  _username_line->setCursorPosition(0);
+  _applipath_line->setCursorPosition(0);
+  _os_line->setCursorPosition(0);
+  _working_directory->setCursorPosition(0);
+}
+
+
+void 
+JM::EditSalomeResource::itemSelectionChanged()
+{
+  if (_componentList->selectedItems().size() > 0)
+    _remove_button->setEnabled(true);
+  else
+    _remove_button->setEnabled(false);
+}
+
+void 
+JM::EditSalomeResource::add_component()
+{
+  bool ok;
+  QString text = QInputDialog::getText(this, "Add a component",
+                                       "Component name:", QLineEdit::Normal,
+                                       "", &ok);
+  if (ok && !text.isEmpty())
+    _componentList->addItem(text);
+}
+
+void 
+JM::EditSalomeResource::remove_components()
+{
+  QList<QListWidgetItem *> list = _componentList->selectedItems();
+  for (int i = 0; i < list.size(); ++i)
+  {
+    int row = _componentList->row( list.at(i) );
+    delete _componentList->takeItem(row);
+  }
+}
+
+void
+JM::EditSalomeResource::accept()
+{
+  BL::ResourceDescr resource;
+
+  // Text
+  resource.name = _name_line->text().toStdString();
+  resource.hostname = _hostname_line->text().toStdString();
+  resource.username = _username_line->text().toStdString();
+  resource.applipath = _applipath_line->text().toStdString();
+  resource.OS = _os_line->text().toStdString();
+  resource.working_directory = _working_directory->text().toStdString();
+  if (_is_cluster_head->isChecked())
+    resource.is_cluster_head = true;
+  else
+    resource.is_cluster_head = false;
+
+  // Components
+  int count = _componentList->count();
+  for (int i = 0; i < count; i++)
+    resource.componentList.push_back(_componentList->item(i)->text().toStdString());
+
+  // ComboBox
+  resource.protocol = _protocol_line->currentText().toStdString();
+  resource.iprotocol = _iprotocol_line->currentText().toStdString();
+  resource.batch = _batch_line->currentText().toStdString();
+  if (resource.batch == "ssh")
+    resource.batch = "ssh_batch";
+  resource.mpiImpl = _mpiImpl_line->currentText().toStdString();
+
+  // QSpinBox
+  resource.mem_mb = _mem_mb_line->value();
+  resource.cpu_clock = _cpu_clock_line->value();
+  resource.nb_node = _nb_node_line->value();
+  resource.nb_proc_per_node = _nb_proc_per_node_line->value();
+
+  if (resource.name != "" &&
+      resource.hostname != "" &&
+      resource.protocol != "")
+  {
+    _salome_services->addResource(resource);
+    QDialog::accept();
+  }
+  else
+  {
+    QMessageBox::warning(NULL, "Values missing", "name, hostname and protocol are mandatory! Cancel or add values!");
+  }
+}
+
+void
+JM::EditSalomeResource::toggle_is_cluster_head(bool checked)
+{
+  if (checked)
+    _is_cluster_head->setText("true");
+  else
+    _is_cluster_head->setText("false");
+}
diff --git a/src/genericgui/JM_EditSalomeResource.hxx b/src/genericgui/JM_EditSalomeResource.hxx
new file mode 100644 (file)
index 0000000..0938ca8
--- /dev/null
@@ -0,0 +1,80 @@
+// Copyright (C) 2009-2012  CEA/DEN, EDF R&D
+//
+// 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 _JM_EDITSALOMERESOURCE_HXX_
+#define _JM_EDITSALOMERESOURCE_HXX_
+
+#include <string>
+#include <QtGui>
+#include "BL_SALOMEServices.hxx"
+
+namespace JM 
+{
+  class EditSalomeResource: public QDialog
+  {
+    Q_OBJECT
+
+    public:
+      EditSalomeResource(QWidget *parent,
+                         BL::SALOMEServices * salome_services,
+                         const std::string & resource_name = "");
+      virtual ~EditSalomeResource();
+
+      void get_infos();
+
+    public slots:
+      virtual void accept();
+      void add_component();
+      void remove_components();
+      void itemSelectionChanged();
+      void toggle_is_cluster_head(bool checked);
+
+    protected:
+      QWidget* _parent;
+      BL::SALOMEServices * _salome_services;
+      std::string _resource_name;
+
+      // widget
+      QLineEdit * _name_line;
+      QLineEdit * _hostname_line;
+      QLineEdit * _username_line;
+      QLineEdit * _applipath_line;
+      QListWidget * _componentList;
+      QLineEdit * _os_line;
+
+      QComboBox * _protocol_line;
+      QComboBox * _iprotocol_line;
+      QComboBox * _batch_line;
+      QComboBox * _mpiImpl_line;
+
+      QSpinBox * _mem_mb_line;
+      QSpinBox * _cpu_clock_line;
+      QSpinBox * _nb_node_line;
+      QSpinBox * _nb_proc_per_node_line;
+
+      QLineEdit * _working_directory;
+      QPushButton * _is_cluster_head;
+
+      QPushButton * _add_button;
+      QPushButton * _remove_button;
+  };
+}
+
+#endif
+
diff --git a/src/genericgui/JM_ResourceCatalog.cxx b/src/genericgui/JM_ResourceCatalog.cxx
new file mode 100644 (file)
index 0000000..749f0af
--- /dev/null
@@ -0,0 +1,171 @@
+// Copyright (C) 2009-2012  CEA/DEN, EDF R&D
+//
+// 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 "JM_ResourceCatalog.hxx"
+#include "BL_Traces.hxx"
+#include "JM_SalomeResource.hxx"
+#include "JM_EditSalomeResource.hxx"
+
+JM::ResourceCatalog::ResourceCatalog(QWidget *parent, BL::SALOMEServices * salome_services) : QWidget(parent)
+{
+  DEBTRACE("Creating JM::ResourceCatalog");
+  BL_ASSERT(parent);
+  BL_ASSERT(salome_services);
+  _parent = parent;
+  _salome_services = salome_services;
+
+  _refresh_button = new QPushButton("Refresh Resource List");
+  _refresh_button->show();
+  _resource_files_list = new QListWidget(this);
+  _resource_files_list->setSelectionMode(QAbstractItemView::SingleSelection);
+  std::list<std::string> resource_list = _salome_services->getResourceList();
+  std::list<std::string>::iterator it;
+  for (it = resource_list.begin(); it != resource_list.end(); it++)
+  {
+    std::string resource = *it;
+    _resource_files_list->addItem(QString(resource.c_str()));
+  }
+
+  _show_button = new QPushButton("Show");
+  _show_button->setEnabled(false);
+  _edit_button = new QPushButton("Edit");
+  _edit_button->setEnabled(false);
+  _add_button = new QPushButton("Add");
+  _remove_button = new QPushButton("Remove");
+  _remove_button->setEnabled(false);
+
+  QHBoxLayout * button_layout = new QHBoxLayout(this);
+  button_layout->addWidget(_show_button);
+  button_layout->addWidget(_edit_button);
+  button_layout->addWidget(_add_button);
+  button_layout->addWidget(_remove_button);
+  QWidget * layout_widget = new QWidget(this);
+  layout_widget->setLayout(button_layout);
+
+  QVBoxLayout * mainLayout = new QVBoxLayout(this);
+  mainLayout->addWidget(_refresh_button);
+  mainLayout->addWidget(_resource_files_list);
+  mainLayout->addWidget(layout_widget);
+  setLayout(mainLayout);
+
+  // Buttons
+  connect(_refresh_button, SIGNAL(clicked()), this, SLOT(refresh_resource_list()));
+  connect(_show_button, SIGNAL(clicked()), this, SLOT(show_button()));
+  connect(_edit_button, SIGNAL(clicked()), this, SLOT(edit_button()));
+  connect(_add_button, SIGNAL(clicked()), this, SLOT(add_button()));
+  connect(_remove_button, SIGNAL(clicked()), this, SLOT(remove_button()));
+  // Double click on an item
+  connect(_resource_files_list, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(item_choosed(QListWidgetItem*)));
+  // Selection management
+  connect(_resource_files_list, SIGNAL(itemSelectionChanged()), this, SLOT(buttons_management()));
+}
+
+JM::ResourceCatalog::~ResourceCatalog()
+{
+  DEBTRACE("Destroying JM::ResourceCatalog");
+}
+
+QListWidget * 
+JM::ResourceCatalog::getQListWidget()
+{
+  return _resource_files_list;
+}
+
+void
+JM::ResourceCatalog::refresh_resource_list()
+{
+  _resource_files_list->clear();
+  std::list<std::string> resource_list = _salome_services->getResourceList();
+  std::list<std::string>::iterator it;
+  for (it = resource_list.begin(); it != resource_list.end(); it++)
+  {
+    std::string resource = *it;
+    _resource_files_list->addItem(QString(resource.c_str()));
+  }
+}
+
+void
+JM::ResourceCatalog::item_choosed(QListWidgetItem * item)
+{
+  DEBTRACE("JM::ResourceCatalog::item_choosed");
+  JM::SalomeResource * resource_widget = new JM::SalomeResource(this,
+                                                                _salome_services,
+                                                                item->text().toStdString());
+  resource_widget->exec();
+  delete resource_widget;
+}
+
+void
+JM::ResourceCatalog::buttons_management()
+{
+  QList<QListWidgetItem *> item_list = _resource_files_list->selectedItems();
+  
+  // Test if an item is selected
+  if (item_list.size() == 0)
+  {
+    _show_button->setEnabled(false);
+    _edit_button->setEnabled(false);
+    _remove_button->setEnabled(false);
+  }
+  else
+  {
+    _show_button->setEnabled(true);
+    _edit_button->setEnabled(true);
+    _remove_button->setEnabled(true);
+  }
+}
+
+void
+JM::ResourceCatalog::show_button()
+{
+  QList<QListWidgetItem *> item_list = _resource_files_list->selectedItems();
+  item_choosed(item_list.at(0));
+}
+
+void
+JM::ResourceCatalog::add_button()
+{
+  JM::EditSalomeResource * resource_widget = new JM::EditSalomeResource(this,
+                                                                        _salome_services);
+  resource_widget->exec();
+  delete resource_widget;
+  refresh_resource_list();
+}
+
+void
+JM::ResourceCatalog::remove_button()
+{
+  QList<QListWidgetItem *> item_list = _resource_files_list->selectedItems();
+  QString item_name = item_list.at(0)->text();
+  _salome_services->removeResource(item_name.toStdString());
+  refresh_resource_list();
+}
+
+void
+JM::ResourceCatalog::edit_button()
+{
+  QList<QListWidgetItem *> item_list = _resource_files_list->selectedItems();
+  QString item_name = item_list.at(0)->text();
+  JM::EditSalomeResource * resource_widget = new JM::EditSalomeResource(this,
+                                                                        _salome_services,
+                                                                        item_name.toStdString());
+  resource_widget->exec();
+  delete resource_widget;
+  refresh_resource_list();
+}
diff --git a/src/genericgui/JM_ResourceCatalog.hxx b/src/genericgui/JM_ResourceCatalog.hxx
new file mode 100644 (file)
index 0000000..2d1b2f5
--- /dev/null
@@ -0,0 +1,68 @@
+// Copyright (C) 2009-2012  CEA/DEN, EDF R&D
+//
+// 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 _JM_RESOURCECATALOG_HXX_
+#define _JM_RESOURCECATALOG_HXX_
+
+#include <QtGui>
+
+#include "BL_SALOMEServices.hxx"
+
+#include <string>
+#include <list>
+
+namespace JM 
+{
+  class ResourceCatalog: public QWidget
+  {
+    Q_OBJECT
+
+    public:
+      ResourceCatalog(QWidget *parent, BL::SALOMEServices * salome_services);
+      virtual ~ResourceCatalog();
+
+      void get_infos();
+
+      QListWidget * getQListWidget();
+
+    public slots:
+      void refresh_resource_list();
+      void item_choosed(QListWidgetItem * item);
+      void buttons_management();
+      void show_button();
+      void edit_button();
+      void add_button();
+      void remove_button();
+
+    protected:
+      QWidget* _parent;
+      BL::SALOMEServices * _salome_services;
+
+      QPushButton * _refresh_button;
+      QPushButton * _show_button;
+      QPushButton * _edit_button;
+      QPushButton * _add_button;
+      QPushButton * _remove_button;
+      QListWidget * _resource_files_list;
+  };
+}
+
+#endif
+
+
diff --git a/src/genericgui/JM_SalomeResource.cxx b/src/genericgui/JM_SalomeResource.cxx
new file mode 100644 (file)
index 0000000..6c2cb9c
--- /dev/null
@@ -0,0 +1,189 @@
+// Copyright (C) 2009-2012  CEA/DEN, EDF R&D
+//
+// 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 "JM_SalomeResource.hxx"
+#include "BL_Traces.hxx"
+
+JM::SalomeResource::SalomeResource(QWidget *parent, BL::SALOMEServices * salome_services, 
+                                   const std::string & resource_name) : QDialog(parent)
+{
+  DEBTRACE("Creating JM::SalomeResource");
+  BL_ASSERT(parent);
+  BL_ASSERT(salome_services);
+  _parent = parent;
+  _salome_services = salome_services;
+  _resource_name = resource_name;
+
+  // Widget code
+  QGroupBox * main_groupBox = new QGroupBox("Main values");
+  QLabel * name_label = new QLabel("Name:");
+  _name_line = new QLineEdit(this);
+  QLabel * hostname_label = new QLabel("Hostname:");
+  _hostname_line = new QLineEdit(this);
+  QLabel * protocol_label = new QLabel("Protocol:");
+  _protocol_line = new QLineEdit(this);
+  QLabel * username_label = new QLabel("Username:");
+  _username_line = new QLineEdit(this);
+  QLabel * applipath_label = new QLabel("Applipath:");
+  _applipath_line = new QLineEdit(this);
+  QLabel * componentList_label = new QLabel("Component List:");
+  _componentList = new QListWidget(this);
+  _componentList->setViewMode(QListView::ListMode);
+  QLabel * working_directory_label = new QLabel("Working Directory:");
+  _working_directory = new QLineEdit(this);
+  QLabel * is_cluster_head_label = new QLabel("Is Cluster Head:");
+  _is_cluster_head = new QPushButton(this);
+  toggle_is_cluster_head(false); // Default is false
+  QGridLayout * m_layout = new QGridLayout;
+  m_layout->addWidget(name_label, 0, 0);
+  m_layout->addWidget(_name_line, 0, 1);
+  m_layout->addWidget(hostname_label, 1, 0);
+  m_layout->addWidget(_hostname_line, 1, 1);
+  m_layout->addWidget(protocol_label, 2, 0);
+  m_layout->addWidget(_protocol_line, 2, 1);
+  m_layout->addWidget(username_label, 3, 0);
+  m_layout->addWidget(_username_line, 3, 1);
+  m_layout->addWidget(applipath_label, 4, 0);
+  m_layout->addWidget(_applipath_line, 4, 1);
+  m_layout->addWidget(componentList_label, 5, 0);
+  m_layout->addWidget(_componentList, 5, 1);
+  m_layout->addWidget(is_cluster_head_label, 6, 0);
+  m_layout->addWidget(_is_cluster_head, 6, 1);
+  m_layout->addWidget(working_directory_label, 7, 0);
+  m_layout->addWidget(_working_directory, 7, 1);
+  main_groupBox->setLayout(m_layout);
+
+  QGroupBox * config_groupBox = new QGroupBox("Configuration values");
+  QLabel * os_label = new QLabel("OS:");
+  _os_line = new QLineEdit(this);
+  QLabel * mem_mb_label = new QLabel("Memory (mb):");
+  _mem_mb_line = new QLineEdit(this);
+  QLabel * cpu_clock_label = new QLabel("CPU Clock:");
+  _cpu_clock_line = new QLineEdit(this);
+  QLabel * nb_node_label = new QLabel("Nb node:");
+  _nb_node_line = new QLineEdit(this);
+  QLabel * nb_proc_per_node_label = new QLabel("Nb proc/node:");
+  _nb_proc_per_node_line = new QLineEdit(this);
+  QLabel * batch_label = new QLabel("Batch:");
+  _batch_line = new QLineEdit(this);
+  QLabel * mpiImpl_label = new QLabel("MPI impl:");
+  _mpiImpl_line = new QLineEdit(this);
+  QLabel * iprotocol_label = new QLabel("Internal proctocol:");
+  _iprotocol_line = new QLineEdit(this);
+  QGridLayout * c_layout = new QGridLayout;
+  c_layout->addWidget(os_label, 0, 0);
+  c_layout->addWidget(_os_line, 0, 1);
+  c_layout->addWidget(mem_mb_label, 1, 0);
+  c_layout->addWidget(_mem_mb_line, 1, 1);
+  c_layout->addWidget(cpu_clock_label, 2, 0);
+  c_layout->addWidget(_cpu_clock_line, 2, 1);
+  c_layout->addWidget(nb_node_label, 3, 0);
+  c_layout->addWidget(_nb_node_line, 3, 1);
+  c_layout->addWidget(nb_proc_per_node_label, 4, 0);
+  c_layout->addWidget(_nb_proc_per_node_line, 4, 1);
+  c_layout->addWidget(batch_label, 5, 0);
+  c_layout->addWidget(_batch_line, 5, 1);
+  c_layout->addWidget(mpiImpl_label, 6, 0);
+  c_layout->addWidget(_mpiImpl_line, 6, 1);
+  c_layout->addWidget(iprotocol_label, 7, 0);
+  c_layout->addWidget(_iprotocol_line, 7, 1);
+  config_groupBox->setLayout(c_layout);
+
+  // Main Layout
+  QVBoxLayout * mainLayout = new QVBoxLayout(this);
+  mainLayout->addWidget(main_groupBox);
+  mainLayout->addWidget(config_groupBox);
+  setLayout(mainLayout);
+
+  setWindowTitle("Resource");
+  get_infos();
+
+  // Line cannot be changed
+  _name_line->setCursorPosition(0);
+  _hostname_line->setCursorPosition(0);
+  _protocol_line->setCursorPosition(0);
+  _username_line->setCursorPosition(0);
+  _applipath_line->setCursorPosition(0);
+  _os_line->setCursorPosition(0);
+  _mem_mb_line->setCursorPosition(0);
+  _cpu_clock_line->setCursorPosition(0);
+  _nb_node_line->setCursorPosition(0);
+  _nb_proc_per_node_line->setCursorPosition(0);
+  _batch_line->setCursorPosition(0);
+  _mpiImpl_line->setCursorPosition(0);
+  _iprotocol_line->setCursorPosition(0);
+  _working_directory->setCursorPosition(0);
+
+  _name_line->setReadOnly(true);
+  _hostname_line->setReadOnly(true);
+  _protocol_line->setReadOnly(true);
+  _username_line->setReadOnly(true);
+  _applipath_line->setReadOnly(true);
+  _os_line->setReadOnly(true);
+  _mem_mb_line->setReadOnly(true);
+  _cpu_clock_line->setReadOnly(true);
+  _nb_node_line->setReadOnly(true);
+  _nb_proc_per_node_line->setReadOnly(true);
+  _batch_line->setReadOnly(true);
+  _mpiImpl_line->setReadOnly(true);
+  _iprotocol_line->setReadOnly(true);
+  _working_directory->setReadOnly(true);
+}
+
+JM::SalomeResource::~SalomeResource()
+{
+  DEBTRACE("Destroying JM::SalomeResource");
+}
+
+void
+JM::SalomeResource::get_infos()
+{
+  BL::ResourceDescr resource_descr = _salome_services->getResourceDescr(_resource_name);
+
+  _name_line->setText(QString(resource_descr.name.c_str()));
+  _hostname_line->setText(QString(resource_descr.hostname.c_str()));
+  _protocol_line->setText(QString(resource_descr.protocol.c_str()));
+  _username_line->setText(QString(resource_descr.username.c_str()));
+  _applipath_line->setText(QString(resource_descr.applipath.c_str()));
+  _os_line->setText(QString(resource_descr.OS.c_str()));
+  _batch_line->setText(QString(resource_descr.batch.c_str()));
+  _mpiImpl_line->setText(QString(resource_descr.mpiImpl.c_str()));
+  _iprotocol_line->setText(QString(resource_descr.iprotocol.c_str()));
+  _working_directory->setText(QString(resource_descr.working_directory.c_str()));
+  toggle_is_cluster_head(resource_descr.is_cluster_head);
+
+  QString value;
+  _mem_mb_line->setText(value.setNum(resource_descr.mem_mb));
+  _cpu_clock_line->setText(value.setNum(resource_descr.cpu_clock));
+  _nb_node_line->setText(value.setNum(resource_descr.nb_node));
+  _nb_proc_per_node_line->setText(value.setNum(resource_descr.nb_proc_per_node));
+
+   std::list<std::string>::iterator it = resource_descr.componentList.begin();
+   for(; it != resource_descr.componentList.end(); it++)
+     _componentList->addItem(QString((*it).c_str()));
+}
+
+void
+JM::SalomeResource::toggle_is_cluster_head(bool checked)
+{
+  if (checked)
+    _is_cluster_head->setText("true");
+  else
+    _is_cluster_head->setText("false");
+}
diff --git a/src/genericgui/JM_SalomeResource.hxx b/src/genericgui/JM_SalomeResource.hxx
new file mode 100644 (file)
index 0000000..dc80b1c
--- /dev/null
@@ -0,0 +1,69 @@
+// Copyright (C) 2009-2012  CEA/DEN, EDF R&D
+//
+// 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 _JM_SALOMERESOURCE_HXX_
+#define _JM_SALOMERESOURCE_HXX_
+
+#include <QtGui>
+#include "BL_SALOMEServices.hxx"
+
+#include <string>
+
+namespace JM 
+{
+  class SalomeResource: public QDialog
+  {
+    Q_OBJECT
+
+    public:
+      SalomeResource(QWidget *parent, BL::SALOMEServices * salome_services, 
+                    const std::string & resource_name);
+      virtual ~SalomeResource();
+
+      void get_infos();
+
+      void toggle_is_cluster_head(bool checked);
+
+    protected:
+      QWidget* _parent;
+      BL::SALOMEServices * _salome_services;
+      std::string _resource_name;
+
+      // widget
+      QLineEdit * _name_line;
+      QLineEdit * _hostname_line;
+      QLineEdit * _protocol_line;
+      QLineEdit * _username_line;
+      QLineEdit * _applipath_line;
+      QListWidget * _componentList;
+      QPushButton * _is_cluster_head;
+      QLineEdit * _working_directory;
+      QLineEdit * _os_line;
+      QLineEdit * _mem_mb_line;
+      QLineEdit * _cpu_clock_line;
+      QLineEdit * _nb_node_line;
+      QLineEdit * _nb_proc_per_node_line;
+      QLineEdit * _batch_line;
+      QLineEdit * _mpiImpl_line;
+      QLineEdit * _iprotocol_line;
+  };
+}
+
+#endif
+
index c039365a977bc635c4d1af46bb018dad9ca2ea35..0e6814658ae8f9eb8a8c22cfb139ab5ed03856bc 100644 (file)
@@ -1,27 +1,28 @@
-#  Copyright (C) 2009 CEA/DEN, EDF R&D
+# Copyright (C) 2009-2012  CEA/DEN, EDF R&D
 #
-#  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 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.
+# 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
+# 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
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
 libdir = $(prefix)/lib/salome
 
 lib_LTLIBRARIES = libBL_GenericGui.la
 
-libBL_GenericGui_la_SOURCES = BL_GenericGui.hxx BL_GenericGui.cxx \
+libBL_GenericGui_la_SOURCES = BL_GenericGuiDefines.hxx \
+                             BL_GenericGui.hxx BL_GenericGui.cxx \
                              BL_JobsTable.hxx BL_JobsTable.cxx \
                              BL_JobTab.hxx BL_JobTab.cxx \
                              BL_Buttons.hxx BL_Buttons.cxx \
@@ -29,23 +30,30 @@ libBL_GenericGui_la_SOURCES = BL_GenericGui.hxx BL_GenericGui.cxx \
                              BL_QModelManager.hxx BL_QModelManager.cxx \
                              BL_CreateJobWizard.hxx BL_CreateJobWizard.cxx \
                              BL_Summary.hxx BL_Summary.cxx \
-                             BL_MachineCatalog.hxx BL_MachineCatalog.cxx
+                             JM_ResourceCatalog.hxx JM_ResourceCatalog.cxx \
+                             JM_SalomeResource.hxx JM_SalomeResource.cxx \
+                             JM_EditSalomeResource.hxx JM_EditSalomeResource.cxx
 
-nodist_libBL_GenericGui_la_SOURCES = BL_GenericGui_moc.cxx BL_JobsTable_moc.cxx \
+MOC_FILES =                          BL_GenericGui_moc.cxx BL_JobsTable_moc.cxx \
                                     BL_JobTab_moc.cxx  \
                                     BL_Buttons_moc.cxx BL_JobsManager_QT_moc.cxx \
                                     BL_QModelManager_moc.cxx BL_CreateJobWizard_moc.cxx \
-                                    BL_Summary_moc.cxx BL_MachineCatalog_moc.cxx
+                                    BL_Summary_moc.cxx JM_ResourceCatalog_moc.cxx \
+                                    JM_SalomeResource_moc.cxx JM_EditSalomeResource_moc.cxx
+
+nodist_libBL_GenericGui_la_SOURCES = $(MOC_FILES)
 
 libBL_GenericGui_la_CXXFLAGS = $(qt4_cppflags) \
                               -I$(top_srcdir)/src/bases \
                               -I$(top_srcdir)/src/engine \
                               -I$(KERNEL_ROOT_DIR)/include/salome \
+                              $(OMNIORB_INCLUDES) $(OMNIORB_CXXFLAGS) \
+                              -I../../idl \
                               -I$(top_srcdir)/src/wrappers
 
 libBL_GenericGui_la_LDFLAGS = $(qt4_ldflags) 
 
-libBL_GenericGui_la_LIBADD = -lQtGui -lQtCore -lQtWebKit \
+libBL_GenericGui_la_LIBADD = -lQtGui -lQtCore \
                             $(top_builddir)/src/bases/libBL_Bases.la \
                             $(top_builddir)/src/engine/libBL_Engine.la
 
index 5895d94a242a99e113ccd68e2e17e79d751adf26..b71fd64e220a7a570ddb5223f5e7f21daab3a3df 100644 (file)
@@ -1,22 +1,24 @@
-//  Copyright (C) 2009 CEA/DEN, EDF R&D
+// Copyright (C) 2009-2012  CEA/DEN, EDF R&D
 //
-//  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 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.
+// 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
+// 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
 //
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 
 #include "BL_SalomeGui.hxx"
+#include "JOBMANAGER_version.h"
 
 BL::SalomeGui::SalomeGui() : MainWindows_SALOME("JobManager"), 
                             SalomeApp_Module("JobManager"), 
@@ -29,6 +31,10 @@ BL::SalomeGui::SalomeGui() : MainWindows_SALOME("JobManager"),
 BL::SalomeGui::~SalomeGui()
 {
   DEBTRACE("Destroying BL::SalomeGui");
+  if (getApp())
+    disconnect(getApp(), SIGNAL(studyClosed()), this, SLOT(studyClosed()));
+  if (_gengui)
+    delete _gengui;
 }
 
 void 
@@ -36,12 +42,22 @@ BL::SalomeGui::initialize(CAM_Application* app)
 {
    DEBTRACE("Entering in initialize");
    SalomeApp_Module::initialize(app); // MANDATORY -> Otherwise SISEGV...
-   BL::MainWindows_SALOME::initialize(getApp());
+   connect( getApp(), SIGNAL(studyClosed()), this, SLOT(studyClosed()));
+   if ( app && app->desktop() )
+     connect( app->desktop(), SIGNAL( windowActivated( SUIT_ViewWindow* ) ),
+              this, SLOT(onWindowActivated( SUIT_ViewWindow* )) );
+}
 
-   _gengui = new BL::GenericGui(this);
-   _gengui->createActions();
-   _gengui->createMenus();
-   _gengui->updateButtonsStates();
+void
+BL::SalomeGui::studyClosed()
+{
+  if (_gengui)
+  {
+    _gengui->deleteDockWidget();
+    delete _gengui;
+    _gengui = NULL;
+    _viewWin = NULL;
+  }
 }
 
 bool 
@@ -49,10 +65,32 @@ BL::SalomeGui::activateModule(SUIT_Study* theStudy)
 {
   DEBTRACE("Entering in BL::SalomeGui::activateModule");
 
-  bool bOk = SalomeApp_Module::activateModule(theStudy);
-  setMenuShown(true);
+  if (!_gengui)
+  {
+   BL::MainWindows_SALOME::initialize(getApp());
+   BL::MainWindows_SALOME::createView();
+   _gengui = new BL::GenericGui(this);
 
+   _gengui->createDockWidgets();
+   _gengui->createCentralWidget();
+   _gengui->createActions();
+   _gengui->createMenus();
+   _gengui->updateButtonsStates();
+  }
+  else
+   {
+    // Test main view
+    if (!BL::MainWindows_SALOME::restoreViewFocus())
+     {
+      // We need to recreate QT objects and the view
+      BL::MainWindows_SALOME::createView();
+      _gengui->createCentralWidget();
+     }
+   }
+
+  setMenuShown(true);
   _gengui->showDockWidgets(true);
+  bool bOk = SalomeApp_Module::activateModule(theStudy);
   return bOk;
 }
 
@@ -68,18 +106,35 @@ bool
 BL::SalomeGui::deactivateModule(SUIT_Study* theStudy)
 {
   DEBTRACE("Entering in BL::SalomeGui::deactivateModule");
-
   setMenuShown(false);
-  _gengui->showDockWidgets(false);
+  if (_gengui)
+    _gengui->showDockWidgets(false);
   bool bOk = SalomeApp_Module::deactivateModule(theStudy);
   return bOk;
 }
 
+void 
+BL::SalomeGui::onWindowActivated( SUIT_ViewWindow* svw)
+{
+  DEBTRACE("BL::SalomeGui::onWindowActivated");
+  DEBTRACE("activeModule()->moduleName() " << (getApp()->activeModule() ? getApp()->activeModule()->moduleName().toStdString() : "") );
+  
+  if (_viewWin) // Be sure to have a _viewWindow
+    if (svw->getId() == _viewWin->getId()) // Same Id ?
+      if (!getApp()->activeModule() || getApp()->activeModule()->moduleName() != "JobManager") // JobManager already activated ?
+        if ( !getApp()->activateModule("JobManager") ) return;
+}
+
 // --- Export the module
 extern "C"
 {
-  CAM_Module* createModule()
+  JOBMANAGER_EXPORT CAM_Module* createModule()
   {
     return new BL::SalomeGui();
   }
+
+  char* getModuleVersion()
+  {
+      return (char*)JOBMANAGER_VERSION_STR;
+  }
 }
index c72142d9f272b550268e7d02c750fe28006a8afa..a1f24af02c791681913d1b92586db5efbf190777 100644 (file)
@@ -1,24 +1,35 @@
-//  Copyright (C) 2009 CEA/DEN, EDF R&D
+// Copyright (C) 2009-2012  CEA/DEN, EDF R&D
 //
-//  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 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.
+// 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
+// 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
 //
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 
 #ifndef _BL_SALOMEGUI_HXX_
 #define _BL_SALOMEGUI_HXX_
 
+#ifdef WNT
+#  if defined JOBMANAGER_EXPORTS
+#    define JOBMANAGER_EXPORT __declspec( dllexport )
+#  else
+#    define JOBMANAGER_EXPORT __declspec( dllimport )
+#  endif
+#else
+#  define JOBMANAGER_EXPORT
+#endif
+
 #include <SALOMEconfig.h>
 
 #include <SalomeApp_Module.h>
@@ -44,6 +55,10 @@ namespace BL
     public slots:
       bool deactivateModule( SUIT_Study* theStudy);
       bool activateModule( SUIT_Study* theStudy);
+      void studyClosed();
+
+    protected slots:
+      void onWindowActivated( SUIT_ViewWindow* svw);
 
     protected:
       BL::GenericGui * _gengui;
diff --git a/src/salomegui/JOBMANAGER_version.h.in b/src/salomegui/JOBMANAGER_version.h.in
new file mode 100644 (file)
index 0000000..5621203
--- /dev/null
@@ -0,0 +1,34 @@
+// Copyright (C) 2007-2012  CEA/DEN, EDF R&D
+//
+// 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   : JOBMANAGER_version.h
+//  Author : Vadim SANDLER
+//  Module : SALOME
+//
+#if !defined(__JOBMANAGER_VERSION_H__)
+#define __JOBMANAGER_VERSION_H__
+
+/*
+  JOBMANAGER_VERSION is (major << 16) + (minor << 8) + patch.
+*/
+
+#define JOBMANAGER_VERSION_STR "@VERSION@"
+#define JOBMANAGER_VERSION     @XVERSION@
+
+#endif // __JOBMANAGER_VERSION_H__
index c9167027c27867292405a533f2999d0bd165d7a7..8a01eab38015c56d11967549e348e644a8b75cf9 100644 (file)
@@ -1,20 +1,20 @@
-#  Copyright (C) 2009 CEA/DEN, EDF R&D
+# Copyright (C) 2009-2012  CEA/DEN, EDF R&D
 #
-#  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 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.
+# 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
+# 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
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
 include $(top_srcdir)/src/bases/make_begin.am
@@ -28,7 +28,10 @@ dist_libJOBMANAGER_la_SOURCES = BL_SalomeGui.hxx BL_SalomeGui.cxx
 nodist_libJOBMANAGER_la_SOURCES = $(MOC_FILES)
 
 libJOBMANAGER_la_CXXFLAGS = $(qt4_cppflags) \
-                               $(OMNIORB_INCLUDES) \
+                               $(BOOST_CPPFLAGS) \
+                               $(OMNIORB_INCLUDES) $(OMNIORB_CXXFLAGS) \
+                               -I$(top_builddir)/idl \
+                               -I. \
                                -I$(KERNEL_ROOT_DIR)/include/salome \
                                -I$(GUI_ROOT_DIR)/include/salome \
                                -I$(top_srcdir)/src/genericgui \
@@ -41,6 +44,8 @@ libJOBMANAGER_la_LDFLAGS  = -L$(GUI_ROOT_DIR)/lib/salome \
                                $(qt4_ldflags)
 
 libJOBMANAGER_la_LIBADD  = $(qt4_libs) \
+                          $(top_builddir)/idl/libJOBMANAGER_IDL.la \
+                          @OMNIORB_LIBS@ \
                               $(top_builddir)/src/bases/libBL_Bases.la \
                               $(top_builddir)/src/engine/libBL_Engine.la \
                               $(top_builddir)/src/genericgui/libBL_GenericGui.la \
@@ -48,11 +53,14 @@ libJOBMANAGER_la_LIBADD  = $(qt4_libs) \
                               -lSalomeApp
 
 salomeinclude_HEADERS = BL_SalomeGui.hxx
+salomeinclude_DATA = JOBMANAGER_version.h
 
 # resources files
-LIBICONS = SalomeApp.xml jobmanager.png
+ICONS = resources/jobmanager.png
+
+nodist_salomeres_SCRIPTS = resources/SalomeApp.xml
+
 dist_salomeres_DATA = ${ICONS}
-ICONS = $(LIBICONS:%=resources/%)
 
 # --------------------------------------------
 # *.h --> *_moc.cxx
diff --git a/src/salomegui/resources/SalomeApp.xml b/src/salomegui/resources/SalomeApp.xml
deleted file mode 100644 (file)
index c8e0933..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-<!--
-  Copyright (C) 2009  CEA/DEN, EDF R&D
-
-  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
-
--->
-<document>
-  <section name="JOBMANAGER">
-    <!-- Major module parameters -->
-    <parameter name="name" value="JobManager"/>
-    <parameter name="icon" value="jobmanager.png"/>
-  </section>
-  <section name="resources">
-    <!-- Module resources -->
-    <parameter name="JOBMANAGER" value="${JOBMANAGER_ROOT_DIR}/share/salome/resources/jobmanager"/>
-  </section>
-</document>
diff --git a/src/salomegui/resources/SalomeApp.xml.in b/src/salomegui/resources/SalomeApp.xml.in
new file mode 100644 (file)
index 0000000..bc8bb87
--- /dev/null
@@ -0,0 +1,37 @@
+<!--
+  Copyright (C) 2009-2012  CEA/DEN, EDF R&D
+
+  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
+
+-->
+<document>
+  <section name="JOBMANAGER">
+    <!-- Major module parameters -->
+    <parameter name="name" value="JobManager"/>
+    <parameter name="icon" value="jobmanager.png"/>
+    <parameter name="documentation" value="jobmanager_help"/>
+    <parameter name="version" value="@VERSION@"/>
+  </section>
+  <section name="resources">
+    <!-- Module resources -->
+    <parameter name="JOBMANAGER" value="%JOBMANAGER_ROOT_DIR%/share/salome/resources/jobmanager"/>
+  </section>
+  <section name="jobmanager_help">
+    <parameter name="sub_menu"     value="%1 module"/>
+    <parameter name="User's Guide" value="%JOBMANAGER_ROOT_DIR%/share/doc/salome/gui/JOBMANAGER/index.html"/>
+  </section>
+</document>
index e6c5d75a7d2ce097ae6f41de6078afe888a09ebe..a747dff1bb07ce81bc870f7bd670ab8d778ccd0e 100644 (file)
@@ -1,3 +1,22 @@
+# Copyright (C) 2009-2012  CEA/DEN, EDF R&D
+#
+# 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
+#
+
 bin_PROGRAMS = jobmanager_gui
 
 bin_SCRIPTS = start_jobmanager.sh
@@ -8,6 +27,8 @@ jobmanager_gui_CXXFLAGS = $(qt4_cppflags) \
                              -I$(top_srcdir)/src/bases \
                              -I$(top_srcdir)/src/engine \
                              -I$(KERNEL_ROOT_DIR)/include/salome \
+                               $(OMNIORB_INCLUDES) $(OMNIORB_CXXFLAGS) \
+                              -I../../idl \
                              -I$(top_srcdir)/src/wrappers \
                              -I$(top_srcdir)/src/genericgui
 
@@ -18,6 +39,7 @@ jobmanager_gui_LDADD = -lQtGui -lQtCore \
                           $(top_builddir)/src/engine/libBL_Engine.la \
                           $(top_builddir)/src/wrappers/libBL_Wrappers_Qt.la \
                           @OMNIORB_LIBS@ \
+                          $(top_builddir)/idl/libJOBMANAGER_IDL.la \
                           -L$(KERNEL_ROOT_DIR)/lib/salome -lSalomeLifeCycleCORBA -lSalomeIDLKernel -lSalomeNS
 
 EXTRA_DIST = start_jobmanager.sh.in
index baf07c6c7a75fd9607aabe5c84c20c2418f9d6d9..a33ff390a4f9c59ce9c5b4b7ed6d1e3088ba800f 100644 (file)
@@ -1,3 +1,22 @@
+// Copyright (C) 2009-2012  CEA/DEN, EDF R&D
+//
+// 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 <QtGui>
 #include "BL_GenericGui.hxx"
 #include "BL_MainWindows_Qt.hxx"
index 4b94938f14e8e3abb06ebd45271642926662cf91..ab6985007cb9b7d93d2fe558d4463009cb46c33d 100644 (file)
@@ -1,21 +1,21 @@
 #!/bin/bash
-#  Copyright (C) 2009  CEA/DEN, EDF R&D
+# Copyright (C) 2009-2012  CEA/DEN, EDF R&D
 #
-#  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 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.
+# 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
+# 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
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
 usage()
index ea7e5a2acad769748adc5cee41c5bc952cdd273e..e8b0305fea1ca6f1e213b2b53ba5cac7411e72c0 100644 (file)
@@ -1,20 +1,21 @@
-//  Copyright (C) 2009 CEA/DEN, EDF R&D
+// Copyright (C) 2009-2012  CEA/DEN, EDF R&D
 //
-//  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 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.
+// 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
+// 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
 //
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 
 #include "BL_MainWindows_Qt.hxx"
 
@@ -48,11 +49,12 @@ BL::MainWindows_Qt::createAction(const QString& toolTip,
                                 const QIcon& icon,
                                 const QString& menu,
                                 const QString& status,
-                                const int shortCut,
+                                const int accel,
                                 QObject* parent,
                                 bool checkable,
                                 QObject* receiver,
-                                const char* member)
+                                const char* member,
+                                 const QString& shortCut)
 {
   QAction * action = new QAction(icon, menu, parent);
   action->setStatusTip(status);
index 550d6c54e29d038c144e84b327a5618fc70d7724..c50e8f34925dc91df14358e983999aa65f32fb28 100644 (file)
@@ -1,31 +1,42 @@
-//  Copyright (C) 2009 CEA/DEN, EDF R&D
+// Copyright (C) 2009-2012  CEA/DEN, EDF R&D
 //
-//  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 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.
+// 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
+// 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
 //
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 
 
 #ifndef _BL_MAINWINDOWS_QT_HXX_
 #define _BL_MAINWINDOWS_QT_HXX_
 
+#ifdef WNT
+#  if defined BL_Wrappers_Qt_EXPORTS
+#    define BL_Wrappers_Qt_EXPORT __declspec( dllexport )
+#  else
+#    define BL_Wrappers_Qt_EXPORT __declspec( dllimport )
+#  endif
+#else
+#  define BL_Wrappers_Qt_EXPORT
+#endif
+
 #include "BL_MainWindows_Wrap.hxx"
 #include <map>
 
 namespace BL
 {
-  class MainWindows_Qt : public MainWindows_Wrap, public QObject
+  class BL_Wrappers_Qt_EXPORT MainWindows_Qt : public MainWindows_Wrap, public QObject
   {
     public:
       MainWindows_Qt(QMainWindow * main_window);
@@ -38,11 +49,12 @@ namespace BL
                                    const QIcon& icon,
                                    const QString& menu,
                                    const QString& status,
-                                   const int shortCut,
+                                   const int accel,
                                    QObject* parent =0,
                                    bool checkable = false,
                                    QObject* receiver =0,
-                                   const char* member =0);
+                                   const char* member =0,
+                                    const QString& shortCut=QString());
 
       virtual int createTopMenu(const QString & menu_name);
       virtual void addActionToMenu(QAction * action, int menu_id);
index 6a604b7f838919bcfcb2ed016cb4b3ee8a95922c..a3fc934326a6484025304841419845b2ee453ba0 100644 (file)
@@ -1,22 +1,24 @@
-//  Copyright (C) 2009 CEA/DEN, EDF R&D
+// Copyright (C) 2009-2012  CEA/DEN, EDF R&D
 //
-//  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 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.
+// 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
+// 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
 //
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 
 #include "BL_MainWindows_SALOME.hxx"
+#include <SalomeApp_Engine_i.hxx>
 
 BL::MainWindows_SALOME::MainWindows_SALOME(const QString & module_name) :
   SalomeApp_Module(module_name),
@@ -24,6 +26,8 @@ BL::MainWindows_SALOME::MainWindows_SALOME(const QString & module_name) :
 {
   DEBTRACE("Creating BL::MainWindows_SALOME");
   _actionId = 190;
+  _currentViewId = -1;
+  _svm = 0;
 }
 
 void 
@@ -31,28 +35,69 @@ BL::MainWindows_SALOME::initialize(SalomeApp_Application * appli)
 {
   DEBTRACE("Initialize BL::MainWindows_SALOME");
   BL_ASSERT(appli);
-
   _appli = appli;
-  _svm = new SUIT_ViewManager(_appli->activeStudy(), _appli->desktop(), new SUIT_ViewModel());
-  _appli->addViewManager(_svm);
-  _viewWin = _svm->createViewWindow();
+}
+
+
+void
+BL::MainWindows_SALOME::createView()
+{
+  DEBTRACE("BL::MainWindows_SALOME CreateView");
+  QString vmType = "JobManager View";
+
+  // Get JobManager View Manager
+  _svm = _appli->getViewManager( vmType, true );
+  if (!_svm) {
+    // view manager not found
+    QTextEdit* w = new QTextEdit;
+    _svm = _appli->createViewManager( vmType, w );
+  }
+
+  // Create a view
+  _viewWin = _svm->getActiveView();
+  _viewWin->setClosable( false );
+  _currentViewId = _viewWin->getId();
+  DEBTRACE("End of BL::MainWindows_SALOME CreateView");
+}
+
+bool
+BL::MainWindows_SALOME::restoreViewFocus()
+{
+  bool result = false;
+  SUIT_ViewWindow* resWnd = 0;
+
+  // Search window
+  QList<SUIT_ViewWindow*> wndlist = _appli->desktop()->windows();
+  SUIT_ViewWindow* wnd;
+  for (int i = 0; i < wndlist.size(); ++i) 
+   {
+    wnd = wndlist.at(i);
+    if (_currentViewId == wnd->getId()) {resWnd = wnd;}
+    if (resWnd) {break;}
+   }
 
-  if (_viewWin && _appli->desktop())
-    _viewWin->resize((int)(_appli->desktop()->width() * 0.6), (int)(_appli->desktop()->height() * 0.6 ));
+  if (resWnd)
+   {
+    wnd->setFocus();
+    result = true;
+   }
+  return result;
 }
 
 QString  
 BL::MainWindows_SALOME::engineIOR() const
 {
   DEBTRACE("Entering in BL::SalomeGui::engineIOR");
-  return _appli->defaultEngineIOR();
+  QString anEngineIOR = SalomeApp_Engine_i::EngineIORForComponent( "JOBMANAGER", true ).c_str();
+  return anEngineIOR;
 }
 
 void 
 BL::MainWindows_SALOME::viewManagers(QStringList& list) const
 {
   DEBTRACE("Entering in BL::SalomeGui::viewManagers");
-  list.append(_svm->getType());
+  if (_svm)
+    list.append(_svm->getType());
 }
 
 
@@ -78,19 +123,20 @@ BL::MainWindows_SALOME::createAction(const QString& toolTip,
                                     const QIcon& icon,
                                     const QString& menu,
                                     const QString& status,
-                                    const int shortCut,
+                                    const int accel,
                                     QObject* parent,
                                     bool checkable,
                                     QObject* receiver,
-                                    const char* member)
+                                    const char* member,
+                                     const QString & shortCut)
 {
-  return SalomeApp_Module::createAction(getActionId(), toolTip, icon, menu, status, shortCut, parent, checkable, receiver, member);
+  return SalomeApp_Module::createAction(getActionId(), toolTip, icon, menu, status, accel, parent, checkable, receiver, member, shortCut);
 }
 
 int
 BL::MainWindows_SALOME::createTopMenu(const QString & menu_name)
 {
-  return createMenu(menu_name, -1);
+  return createMenu(menu_name, -1, -1, 30 );
 }
 
 void 
index ec2ee35e0f6e61498b11addcbce91671f78d2b80..11a939c7134246a138605e2978cf7597b442d3b9 100644 (file)
@@ -1,25 +1,36 @@
-//  Copyright (C) 2009 CEA/DEN, EDF R&D
+// Copyright (C) 2009-2012  CEA/DEN, EDF R&D
 //
-//  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 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.
+// 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
+// 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
 //
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 
 
 #ifndef _BL_MAINWINDOWS_SALOME_HXX_
 #define _BL_MAINWINDOWS_SALOME_HXX_
 
+#ifdef WNT
+#  if defined BL_Wrappers_SALOME_EXPORTS
+#    define BL_Wrappers_SALOME_EXPORT __declspec( dllexport )
+#  else
+#    define BL_Wrappers_SALOME_EXPORT __declspec( dllimport )
+#  endif
+#else
+#  define BL_Wrappers_SALOME_EXPORT
+#endif
+
 #include "BL_MainWindows_Wrap.hxx"
 
 #include <SalomeApp_Application.h>
@@ -32,8 +43,8 @@
 
 namespace BL
 {
-  class MainWindows_SALOME : virtual public MainWindows_Wrap, 
-                            virtual public SalomeApp_Module
+  class BL_Wrappers_SALOME_EXPORT MainWindows_SALOME : virtual public MainWindows_Wrap, 
+                             virtual public SalomeApp_Module
   {
     public:
       MainWindows_SALOME(const QString & module_name);
@@ -50,26 +61,30 @@ namespace BL
       virtual QMainWindow * getTabParent();
 
       virtual QAction* createAction(const QString& toolTip,
-                                   const QIcon& icon,
-                                   const QString& menu,
-                                   const QString& status,
-                                   const int shortCut,
-                                   QObject* parent =0,
-                                   bool checkable = false,
-                                   QObject* receiver =0,
-                                   const char* member =0);
+                                    const QIcon& icon,
+                                    const QString& menu,
+                                    const QString& status,
+                                    const int accel,
+                                    QObject* parent =0,
+                                    bool checkable = false,
+                                    QObject* receiver =0,
+                                    const char* member =0,
+                                    const QString& shortCut=QString());
 
       virtual int createTopMenu(const QString & menu_name);
       virtual void addActionToMenu(QAction * action, int menu_id);
 
       // Usefull methods
       virtual void initialize(SalomeApp_Application * appli);
+      bool restoreViewFocus();
+      void createView();
 
     protected:
       SalomeApp_Application * _appli;
       SalomeApp_Module * _module;
       SUIT_ViewManager * _svm;
       SUIT_ViewWindow  * _viewWin;
+      int _currentViewId;
 
       int _actionId;
       int getActionId() { return _actionId++; }
index 3d16e980842b458f0b9ed39e2689ad36fbe3b12d..333b3fe7b38c8ed0c32fe1f933ecdb40d3c81092 100644 (file)
@@ -1,20 +1,21 @@
-//  Copyright (C) 2009 CEA/DEN, EDF R&D
+// Copyright (C) 2009-2012  CEA/DEN, EDF R&D
 //
-//  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 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.
+// 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
+// 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
 //
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 
 
 #ifndef _BL_MAINWINDOWS_WRAP_HXX_
@@ -39,11 +40,12 @@ namespace BL
                                    const QIcon& icon,
                                    const QString& menu,
                                    const QString& status,
-                                   const int shortCut,
+                                   const int accel,
                                    QObject* parent =0,
                                    bool checkable = false,
                                    QObject* receiver =0,
-                                   const char* member =0) = 0;
+                                   const char* member =0,
+                                    const QString& shortCut=QString()) = 0;
 
       virtual int createTopMenu(const QString & menu_name) = 0;
       virtual void addActionToMenu(QAction * action, int menu_id) = 0;
index 773d02e1c88f95fab532e21200f77393f1de8e30..a787decddbad7f2383001bfba67a3ebfd54d8478 100644 (file)
@@ -1,20 +1,20 @@
-#  Copyright (C) 2009 CEA/DEN, EDF R&D
+# Copyright (C) 2009-2012  CEA/DEN, EDF R&D
 #
-#  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 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.
+# 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
+# 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
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
 libdir = $(prefix)/lib/salome
@@ -44,11 +44,12 @@ libBL_Wrappers_SALOME_la_SOURCES = BL_MainWindows_Wrap.hxx \
 nodist_libBL_Wrappers_SALOME_la_SOURCES =
 
 libBL_Wrappers_SALOME_la_CXXFLAGS = $(qt4_cppflags) -I$(top_srcdir)/src/bases \
-                                   $(OMNIORB_INCLUDES) \
+                                   $(OMNIORB_INCLUDES) $(OMNIORB_CXXFLAGS) $(BOOST_CPPFLAGS) \
                                    -I$(KERNEL_ROOT_DIR)/include/salome \
                                    -I$(GUI_ROOT_DIR)/include/salome
 
 libBL_Wrappers_SALOME_la_LDFLAGS = $(qt4_ldflags) 
 
-libBL_Wrappers_SALOME_la_LIBADD = -lQtGui -lQtCore $(top_builddir)/src/bases/libBL_Bases.la
+libBL_Wrappers_SALOME_la_LIBADD = -lQtGui -lQtCore $(top_builddir)/src/bases/libBL_Bases.la $(OMNIORB_LIBS) \
+                                 $(KERNEL_LDFLAGS) -lSalomeIDLKernel $(GUI_LDFLAGS) -lLightApp -lSalomeApp -lSalomeSession -lCAM -lsuit