runSalome \
runSalome.csh \
runNS.sh \
+createAppli.sh \
launchConfigureParser.py \
salome.launch \
envSalome.py \
done
# install script in $(bindir) :
+install-appliskel:
+ $(INSTALL) -d $(bindir)
+ cp -rp $(top_builddir)/bin/salome/appliskel $(bindir)
+
install-bin: $(BIN_SCRIPT)
$(INSTALL) -d $(bindir)
$(INSTALL_PROGRAM) $^ $(bindir)
# install Plugin file
install-plugin: $(top_builddir)/share/salome/resources/Plugin
($(INSTALL_DATA) $^ $(datadir)/resources/. || exit 1); \
-
+
uninstall: uninstall-idl
uninstall-idl:
resources: $(top_builddir)/share/salome/resources/Plugin
-install: install-bin install-include install-make install-plugin install-end
-
+install: install-bin install-appliskel install-include install-make install-plugin install-end
--- /dev/null
+<!DOCTYPE ResourcesCatalog>
+<resources>
+ <machine
+ protocol="ssh"
+ nbOfNodes="1"
+ mode="interactif"
+ OS="LINUX"
+ CPUFreqMHz="2800"
+ userName="prascle"
+ memInMB="1500"
+ nbOfProcPerNode="2"
+ alias="cli76cd"
+ hostname="cli76cd" >
+ </machine>
+
+ <machine
+ protocol="ssh"
+ nbOfNodes="1"
+ mode="interactif"
+ OS="LINUX"
+ CPUFreqMHz="2000"
+ userName="prascle"
+ memInMB="1000"
+ nbOfProcPerNode="1"
+ alias="cli76ce"
+ hostname="cli76ce" >
+ </machine>
+</resources>
--- /dev/null
+Set of scripts for a SALOME application
+=======================================
+
+# - A SALOME application distributed on several computers needs APPLI
+# directories on the same path ($APPLI) relative to $HOME directory
+# of the user, on each computer.
+
+user scripts:
+-------------
+
+runAppli : SALOME launch (idem runSalome but different name to avoid
+ confusion with ${KERNEL_ROOT_DIR}/bin/salome/runSalome
+
+runConsole : a python console in the current SALOME session environment
+
+runSession : a shell in SALOME environment, either interactive (without args)
+ or used to run a program (defined by given args)
+
+internal application scripts:
+-----------------------------
+
+runRemote.sh : called from remote computer, via ssh, rsh...
+ used for instance to create container
+
+envd : sets SALOME application environment
+ sourced by other scripts
+
+The following files must be adapted to your environment and SALOME Application:
+-------------------------------------------------------------------------------
+
+SalomeApp.xml - list of modules, options on server launch and resources...
+CatalogResources.xml - configuration of machines used in SALOME application
+ (no need of modules list and path here)
+
+env.d directory must contain the necessary files to source, to define
+the SALOME Application environment :
+ ( envd script source these files in alphanumeric order )
+
+For instance,
+ atFirst.sh - general presets
+ envProducts.sh - prerequisite SALOME environment
+ envSalome.sh - list of MODULE_ROOT_DIR
--- /dev/null
+<document>
+ <section name="desktop" >
+ <parameter name="state" value="max"/>
+ <parameter name="pos_x" value="100"/>
+ <parameter name="pos_y" value="050"/>
+ <parameter name="width" value="640"/>
+ <parameter name="height" value="480"/>
+ </section>
+ <section name="launch">
+ <parameter name="gui" value="yes"/>
+ <parameter name="splash" value="yes"/>
+ <parameter name="file" value="no"/>
+ <parameter name="key" value="no"/>
+ <parameter name="interp" value="no"/>
+ <parameter name="logger" value="no"/>
+ <parameter name="xterm" value="no"/>
+ <parameter name="portkill" value="no"/>
+ <parameter name="killall" value="no"/>
+ <parameter name="modules" value="GUI,GEOM,SMESH,VISU,SUPERV,MED,COMPONENT,LIGHT,PYHELLO,PYCALCULATOR"/>
+ <parameter name="pyModules" value=""/>
+ <parameter name="embedded" value="SalomeAppEngine,cppContainer,registry,moduleCatalog,study"/>
+ <parameter name="standalone" value="pyContainer"/>
+ </section>
+ <section name="language">
+ <parameter name="language" value="en"/>
+ <parameter name="translators" value="%P_msg_%L.qm|%P_icons.qm|%P_images.qm"/>
+ </section>
+ <section name="resources">
+ <parameter name="SUIT" value="${SUITRoot}/resources"/>
+ <parameter name="STD" value="${SUITRoot}/resources"/>
+ <parameter name="Plot2d" value="${SUITRoot}/resources"/>
+ <parameter name="SPlot2d" value="${SUITRoot}/resources"/>
+ <parameter name="GLViewer" value="${SUITRoot}/resources"/>
+ <parameter name="OCCViewer" value="${SUITRoot}/resources"/>
+ <parameter name="VTKViewer" value="${SUITRoot}/resources"/>
+ <parameter name="SalomeApp" value="${SUITRoot}/resources"/>
+ <parameter name="OB" value="${SUITRoot}/resources"/>
+ <parameter name="CAM" value="${SUITRoot}/resources"/>
+ <parameter name="GEOM" value="${GEOM_ROOT_DIR}/share/salome/resources"/>
+ <parameter name="SMESH" value="${SMESH_ROOT_DIR}/share/salome/resources"/>
+ <parameter name="VISU" value="${VISU_ROOT_DIR}/share/salome/resources"/>
+ <parameter name="SUPERV" value="${SUPERV_ROOT_DIR}/share/salome/resources"/>
+ <parameter name="MED" value="${MED_ROOT_DIR}/share/salome/resources"/>
+ <parameter name="StdMeshers" value="${SMESH_ROOT_DIR}/share/salome/resources"/>
+ <parameter name="NETGENPlugin" value="${NETGENPLUGIN_ROOT_DIR}/share/salome/resources"/>
+ <parameter name="GHS3DPlugin" value="${GHS3DPLUGIN_ROOT_DIR}/share/salome/resources"/>
+ <parameter name="COMPONENT" value="${COMPONENT_ROOT_DIR}/share/salome/resources"/>
+ <parameter name="PYHELLO" value="${PYHELLO_ROOT_DIR}/share/salome/resources"/>
+ <parameter name="PYCALCULATOR" value="${PYCALCULATOR_ROOT_DIR}/share/salome/resources"/>
+ <parameter name="LIGHT" value="${LIGHT_ROOT_DIR}/share/salome/resources"/>
+
+ </section>
+ <section name="GEOM">
+ <parameter name="name" value="Geometry"/>
+ <parameter name="icon" value="ModuleGeom.png"/>
+ </section>
+ <section name="SMESH">
+ <parameter name="name" value="Mesh"/>
+ <parameter name="icon" value="ModuleMesh.png"/>
+ </section>
+ <section name="VISU">
+ <parameter name="name" value="Post-Pro"/>
+ <parameter name="icon" value="ModuleVisu.png"/>
+ </section>
+ <section name="SUPERV">
+ <parameter name="name" value="Supervisor"/>
+ <parameter name="icon" value="ModuleSupervision.png"/>
+ </section>
+ <section name="MED">
+ <parameter name="name" value="Med"/>
+ <parameter name="icon" value="ModuleMed.png"/>
+ </section>
+ <section name="PYHELLO">
+ <parameter name="name" value="PyHello"/>
+ <parameter name="icon" value="PYHELLO.png"/>
+ <parameter name="library" value="libSalomePyQtGUI.so"/>
+ </section>
+ <section name="LIGHT">
+ <parameter name="name" value="Light"/>
+ <parameter name="icon" value="LIGHT.png"/>
+ </section>
+
+<!-- values below this line are just an example, they are not used -->
+ <section name="application">
+ <parameter name="QuickDirList" value=""/>
+ <!-- Here go other common user preferences -->
+ </section>
+ <section name="Geometry" >
+ <parameter value="255, 255, 0" name="shading_color" />
+ </section>
+ <section name="SMESH">
+ <parameter name="plugins" value="NETGENPlugin,GHS3DPlugin"/>
+ <!-- Here go SMESH module user preferences -->
+ </section>
+ <!-- Here go optional sections for other modules -->
+ <section name="resources">
+ <parameter name="salome" value="${KERNEL_ROOT_DIR}/share/salome/res"/>
+ <!-- Here go resource directories for other modules -->
+ </section>
+</document>
--- /dev/null
+#!/bin/sh
+
+#------------------------------------------------
+# to be sourced first, used in following scripts
+#------------------------------------------------
+
+export LD_LIBRARY_PATH="."
+export PATH="/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/prascle/bin:."
+export PYTHONPATH=""
+
+export RAC=${HOME}
+export PAKSAL=/opt
+export PUB=${RAC}/public
+export TARP=${RAC}/tarpublic
+export PYPACKAGES=${PUB}/site_packages
+
+# ------------------------------------------------
+# ---- gdb 5.3
+
+export PATH=${PAKSAL}/gdb53/bin:${PATH}
+export LD_LIBRARY_PATH=${PAKSAL}/gdb53/lib:${LD_LIBRARY_PATH}
+
+# ------------------------------------------------
+# ---- ddd 3.3.7
+
+export PATH=${PAKSAL}/ddd337/bin:${PATH}
+export LD_LIBRARY_PATH=${PAKSAL}/ddd337/lib:${LD_LIBRARY_PATH}
+
+# ------------------------------------------------
+# --- Java 1.4
+
+export JDKHOME=${PUB}/j2sdk_nb/j2sdk1.4.2
+export JAVAHOME=${PUB}/j2sdk_nb/j2sdk1.4.2
+export PATH=${JAVAHOME}/bin:${PATH}
+export LD_LIBRARY_PATH=${JAVAHOME}/lib:${LD_LIBRARY_PATH}
+export LD_LIBRARY_PATH=${JAVAHOME}/jre/lib/i386:${LD_LIBRARY_PATH}
+export LD_LIBRARY_PATH=${JAVAHOME}/jre/lib/i386/client:${LD_LIBRARY_PATH}
+
+# ------------------------------------------------
+# --- gsl -1.4
+
+export GSLHOME=${PAKSAL}/gsl-1.4
+export PATH=${GSLHOME}/bin:${PATH}
+export LD_LIBRARY_PATH=${GSLHOME}/lib:${LD_LIBRARY_PATH}
+
+# ------------------------------------------------
+# --- fltk 1.1.4
+
+export FLTKHOME=${PAKSAL}/fltk114
+export PATH=${FLTKHOME}/bin:${PATH}
+export LD_LIBRARY_PATH=${FLTKHOME}/lib:${LD_LIBRARY_PATH}
+
+# ------------------------------------------------
+# --- gmsh 1.48
+
+export GMSHHOME=${PAKSAL}/gmsh148
+export PATH=${GMSHHOME}/bin:${PATH}
+
+# ------------------------------------------------
+# ---- tkcvs, tkdiffb, cvs
+
+export PATH=${PAKSAL}/tkcvs7.2/bin:${PAKSAL}/cvs1.11.14/bin:${PATH}
--- /dev/null
+#!/bin/sh
+
+# ------------------------------------------------
+# ---- openpbs
+
+export OPENPBS=/optroot/openpbs2316
+export PATH=${OPENPBS}/bin:${PATH}
+export LD_LIBRARY_PATH=${OPENPBS}/lib:${LD_LIBRARY_PATH}
+
+#------------------------------------------------------------------------------
+
+export INSTALL_ROOT=/home/prascle/PAL_SALOME141
+#------ gcc ------
+export GCC_ROOT=/usr
+export CXX=${GCC_ROOT}/bin/g++
+export CC=${GCC_ROOT}/bin/gcc
+##
+#------ boost ------
+export BOOSTDIR=${INSTALL_ROOT}/boost-1.30.2
+##
+
+#------ tcltk ------
+export TCLHOME=/usr
+
+#------ Python ------
+export PYTHONHOME=/usr
+export PYTHONPATH=${PYPACKAGES}:${PYTHONPATH}
+##
+#------ Qt ------
+#export QTDIR=/usr/lib/qt-3.0.5
+export QTDIR=/usr/lib/qt3-gcc3.2
+export PATH=${PATH}:${QTDIR}/bin
+export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${QTDIR}/lib
+##
+#------ Sip ------
+export SIPDIR=/usr
+export PYQTDIR=/usr
+##
+#------ PyQt ------
+export PYQT_SIPS=/usr/share/sip/qt
+export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/lib/python2.2/site-packages
+##
+#------ Swig ------
+export SWIG_ROOT=${INSTALL_ROOT}/SWIG-1.3.17
+export PATH=${SWIG_ROOT}/bin:${PATH}
+export LD_LIBRARY_PATH=${SWIG_ROOT}/lib:${LD_LIBRARY_PATH}
+##
+#------ OpenCascade ------
+export CASROOT=/opt/CAS52patch
+export LD_LIBRARY_PATH=${CASROOT}/Linux/lib:${LD_LIBRARY_PATH}
+export PATH=${CASROOT}/Linux/bin:${PATH}
+# Variable for Foundation Classes :
+export CSF_UnitsLexicon=${CASROOT}/src/UnitsAPI/Lexi_Expr.dat
+export CSF_UnitsDefinition=${CASROOT}/src/UnitsAPI/Units.dat
+# Variable for DataExchange :
+export CSF_SHMessage=${CASROOT}/src/SHMessage
+export CSF_XSMessage=${CASROOT}/src/XSMessage
+# Variable for Font :
+export CSF_MDTVFontDirectory=${CASROOT}/src/FontMFT
+export CSF_MDTVTexturesDirectory=${CASROOT}/src/Textures
+##
+export CSF_LANGUAGE=us
+export MMGT_CLEAR=1
+export CSF_EXCEPTION_PROMPT=1
+export CSF_StandardDefaults=${CASROOT}/src/StdResource
+export CSF_PluginDefaults=${CASROOT}/src/StdResource
+export CSF_XCAFDefaults=${CASROOT}/src/StdResource
+export CSF_GraphicShr=${CASROOT}/Linux/lib/libTKOpenGl.so
+export CSF_IGESDefaults=${CASROOT}/src/XSTEPResource
+export CSF_STEPDefaults=${CASROOT}/src/XSTEPResource
+##
+#export TCLLIBPATH=$TCLHOME/lib
+##
+#------ Qwt ------
+export QWTHOME=${INSTALL_ROOT}/qwt-0.4.1
+export LD_LIBRARY_PATH=${QWTHOME}/lib:${LD_LIBRARY_PATH}
+##
+#------ Hdf ------
+export HDF5HOME=${INSTALL_ROOT}/hdf5-1.4.4
+export PATH=${HDF5HOME}/bin:$PATH
+export LD_LIBRARY_PATH=${HDF5HOME}/lib:${LD_LIBRARY_PATH}
+##
+#------ Med ------
+export MED2HOME=/opt/med2.2.2
+export PATH=${MED2HOME}/bin:${PATH}
+export LD_LIBRARY_PATH=${MED2HOME}/lib:${LD_LIBRARY_PATH}
+##
+#------ Vtk ------
+export VTKHOME=${INSTALL_ROOT}/VTK-4.2.2
+export PATH=${VTKHOME}/bin:${PATH}
+export LD_LIBRARY_PATH=${VTKHOME}/lib/vtk:${LD_LIBRARY_PATH}
+export PYTHONPATH=${VTKHOME}/lib/vtk:${VTKHOME}/lib/python2.2/site-packages/vtk_python:${PYTHONPATH}
+##
+#------ netgen ------
+export NETGENROOT=${INSTALL_ROOT}/netgen4.3
+export NETGEN_HOME=${INSTALL_ROOT}/netgen4.3
+##
+#------ OmniORB ------
+export OMNIORBDIR=${INSTALL_ROOT}/omniORB-3.0.5
+export OMNIORB_CONFIG=${OMNIORBDIR}/.omniORB.cfg
+export PYTHONPATH=${OMNIORBDIR}/lib/python:${OMNIORBDIR}/lib/i586_linux_2.0_glibc2.1:${PYTHONPATH}
+export PATH=$OMNIORBDIR/bin/i586_linux_2.0_glibc2.1:$PATH
+export LD_LIBRARY_PATH=$OMNIORBDIR/lib/i586_linux_2.0_glibc2.1:$LD_LIBRARY_PATH
+##
+#------ Numeric ------
+export PYTHONPATH=${INSTALL_ROOT}/Numeric-22.0/lib/python2.2/site-packages/Numeric:${PYTHONPATH}
+##
+#------ HappyDoc ------
+export PATH=${INSTALL_ROOT}/HappyDoc-r2_1/bin:${PATH}
+export PYTHONPATH=${INSTALL_ROOT}/HappyDoc-r2_1/lib/python2.2/site-packages:${PYTHONPATH}
+##
+#------ Doxygen ------
+export PATH=${INSTALL_ROOT}/doxygen-1.3-rc2/bin:${PATH}
+##
+#------ Graphviz ------
+export PATH=${INSTALL_ROOT}/graphviz-1.9/bin:${PATH}
+export LD_LIBRARY_PATH=${INSTALL_ROOT}/graphviz-1.9/lib/graphviz:${LD_LIBRARY_PATH}
+##
+
+#------------------------------------------------------------------------------
--- /dev/null
+#!/bin/sh
+
+# --- example to adapt to your own configuration ---
+#
+# --- envSalome.sh gives a set of MODULE_ROOT_DIR, to source
+# --- you must at least define and export KERNEL_ROOT_DIR
+
+REPINST=/home/prascle/SALOME2/Install
+
+export KERNEL_ROOT_DIR=${REPINST}/KERNEL_V301
+
+export GUI_ROOT_DIR=${REPINST}/GUI_V301
+#export SalomeAppConfig=${GUI_ROOT_DIR}/share/salome/resources
+export SalomeAppConfig=${HOME}/${APPLI}
+export SUITRoot=${GUI_ROOT_DIR}/share/salome
+
+export GEOM_ROOT_DIR=${REPINST}/GEOM_V301
+export MED_ROOT_DIR=${REPINST}/MED_V301
+export SMESH_ROOT_DIR=${REPINST}/SMESH_V301
+export SUPERV_ROOT_DIR=${REPINST}/SUPERV_V301
+export VISU_ROOT_DIR=${REPINST}/VISU_V301
+export NETGENPLUGIN_ROOT_DIR=${REPINST}/NETGENPLUGIN_V301
+export COMPONENT_ROOT_DIR=${REPINST}/COMPONENT_V301
+export PYCALCULATOR_ROOT_DIR=${REPINST}/PYCALCULATOR_V301
+export PYHELLO_ROOT_DIR=${REPINST}/PYHELLO_V301
+export PYTIX_ROOT_DIR=${REPINST}/PYTIX_V301
+
--- /dev/null
+#!/bin/bash
+
+for i in $1/env.d/*;do source ${i}; done
--- /dev/null
+#!/bin/bash
+
+# --- retrieve APPLI path, relative to $HOME
+# on sarge, "which" gives not allways the absolute path...
+
+comName=`which $0`
+aa=${comName:0:1}
+if test x$aa == x\/; then
+ mycom=${comName}
+elif test x$aa == x\.; then
+ mycom=${PWD}/${comName:2}
+else
+ mycom=${PWD}/${comName}
+fi
+APPLI=`echo ${HOME} \`dirname $mycom\` | awk ' { print substr($2,length($1)+2) } '`
+#echo $APPLI
+export APPLI
+
+# --- set the SALOME environment (prerequisites, MODULES_ROOT_DIR...)
+
+. ${HOME}/${APPLI}/envd ${HOME}/${APPLI}
+
+# --- define port for CORBA naming service
+
+searchFreePort() {
+ echo -n "Searching for a free port for naming service: "
+ export NSPORT=2810
+ local limit=$NSPORT
+ let limit=limit+100
+ while [ 1 ]
+ do
+ aRes=`netstat -ltn | grep -E :${NSPORT}`
+ if [ -z "$aRes" ]; then
+ echo ${NSPORT} - Ok
+ local myhost=`hostname`
+ export OMNIORB_CONFIG=${HOME}/$APPLI//.omniORB_${myhost}_${NSPORT}.cfg
+ export NSPORT
+ local initref="NameService=corbaname::"`hostname`":$NSPORT"
+ echo "ORBInitRef $initref" > $OMNIORB_CONFIG
+ break
+ fi
+ echo -n "${NSPORT} "
+ if [[ $NSPORT -eq $limit ]] ; then
+ echo
+ echo "Can't find a free port to launch omniNames"
+ echo "Try to kill the running servers and then launch SALOME again."
+ exit
+ fi
+ let NSPORT=NSPORT+1
+ done
+}
+
+# --- run SALOME
+# (default arguments defined in local salome.launch could be completed
+# by arguments to this command)
+
+searchFreePort
+
+if [ $# -ne 0 ] ; then
+ ${KERNEL_ROOT_DIR}/bin/salome/envSalome.py python -i ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py $*
+else
+ ${KERNEL_ROOT_DIR}/bin/salome/envSalome.py python ${KERNEL_ROOT_DIR}/bin/salome/runSalome.py
+fi
--- /dev/null
+#!/bin/bash
+
+# --- retrieve APPLI path, relative to $HOME
+# on sarge, "which" gives not allways the absolute path...
+
+comName=`which $0`
+aa=${comName:0:1}
+if test x$aa == x\/; then
+ mycom=${comName}
+elif test x$aa == x\.; then
+ mycom=${PWD}/${comName:2}
+else
+ mycom=${PWD}/${comName}
+fi
+APPLI=`echo ${HOME} \`dirname $mycom\` | awk ' { print substr($2,length($1)+2) } '`
+#echo $APPLI
+export APPLI
+
+# --- set the SALOME environment (prerequisites, MODULES_ROOT_DIR...)
+
+. ${HOME}/${APPLI}/envd ${HOME}/${APPLI}
+
+# --- open a Python interpreter with SALOME environment
+
+${KERNEL_ROOT_DIR}/bin/salome/envSalome.py python -i ${KERNEL_ROOT_DIR}/bin/salome/salomeConsole.py $*
--- /dev/null
+#!/bin/bash
+
+./runAppli --killall
+
+#./runSession killSalome.py
--- /dev/null
+#!/bin/bash
+#
+# --- run command in SALOME environment from remote call, ssh or rsh
+# - SALOME configuration is defined by :
+# - list of MODULE_ROOT_DIR
+# - prerequisite environment
+# - specific configuration for a particular SALOME application
+# - These elements of configuration are defined locally on each computer
+# in the directory APPLI:
+# - A SALOME application distributed on several computers needs APPLI
+# directories on the same path ($APPLI) relative to $HOME directory
+# of the user, on each computer.
+#
+# --- call example (from cli76cd to cli76ce):
+# ssh cli76ce ${APPLI}/runRemote.sh cli76cd 2810 SALOME_Container myContainerName
+#
+# --- local arguments
+# $0 : ${APPLI}/runRemote.sh: from arg name, rebuild and export $APPLI variable
+# $1 : computer name for CORBA name service (where SALOME was launched)
+# $2 : port for CORBA name service
+# $3 and following : local command to execute, with args
+#
+
+# --- retrieve APPLI path, relative to $HOME
+# on sarge, "which" gives not allways the absolute path...
+
+comName=`which $0`
+aa=${comName:0:1}
+if test x$aa == x\/; then
+ mycom=${comName}
+elif test x$aa == x\.; then
+ mycom=${PWD}/${comName:2}
+else
+ mycom=${PWD}/${comName}
+fi
+APPLI=`echo ${HOME} \`dirname $mycom\` | awk ' { print substr($2,length($1)+2) } '`
+#echo $APPLI
+export APPLI
+
+# --- set the SALOME environment (prerequisites, MODULES_ROOT_DIR...)
+
+. ${HOME}/${APPLI}/envd ${HOME}/${APPLI}
+
+# --- set the OMNIORB_CONFIG file and environment relative to this run of SALOME
+
+export OMNIORB_CONFIG=${HOME}/${APPLI}/.omniORB_$1_$2.cfg
+initref="NameService=corbaname::"$1":$2"
+echo "ORBInitRef $initref" > $OMNIORB_CONFIG
+
+# --- execute the command in the SALOME environment
+
+shift 2
+
+${KERNEL_ROOT_DIR}/bin/salome/envSalome.py /bin/bash --rcfile $HOME/$APPLI/.bashrc -c "$*"
--- /dev/null
+#!/bin/bash
+#
+# Useful shell to run executable progs or shells under Salome env
+# Use it with args to run a program : runSession python -i myprog.py
+# Use it without args to run an interactive shell under Salome env
+#
+
+# --- retrieve APPLI path, relative to $HOME
+# on sarge, "which" gives not allways the absolute path...
+
+comName=`which $0`
+aa=${comName:0:1}
+if test x$aa == x\/; then
+ mycom=${comName}
+elif test x$aa == x\.; then
+ mycom=${PWD}/${comName:2}
+else
+ mycom=${PWD}/${comName}
+fi
+APPLI=`echo ${HOME} \`dirname $mycom\` | awk ' { print substr($2,length($1)+2) } '`
+#echo $APPLI
+export APPLI
+
+# --- set the SALOME environment (prerequisites, MODULES_ROOT_DIR...)
+
+. ${HOME}/${APPLI}/envd ${HOME}/${APPLI}
+
+# --- invoque shell with or without args
+
+if [ $# -ne 0 ] ; then
+ ${KERNEL_ROOT_DIR}/bin/salome/envSalome.py /bin/bash --rcfile ${HOME}/${APPLI}/.bashrc -c "$*"
+else
+ ${KERNEL_ROOT_DIR}/bin/salome/envSalome.py /bin/bash --rcfile ${HOME}/${APPLI}/.bashrc
+fi
--- /dev/null
+#!/bin/sh
+
+comName=`which $0`
+rep=`dirname $comName`
+
+cp -r $rep/appliskel $1
+chmod +x $1/*.sh $1/run* $1/envd
local myhost=`hostname`
export OMNIORB_CONFIG=${HOME}/.omniORB_${myhost}_${NSPORT}.cfg
local initref="NameService=corbaname::"`hostname`":$NSPORT"
+ export NSPORT
if [[ `python -c "import CORBA; print CORBA.ORB_ID"` == "omniORB4" ]]; then
echo "InitRef = $initref" > $OMNIORB_CONFIG
else
self.CMD=self.SCMD1 + [string.join(cata_path,':')] + self.SCMD2
else:
self.CMD=self.SCMD1 + self.SCMD2
-
- # arguments SALOME_Session_Server pour ddd
- comm_ddd=""
- for mot in self.CMD:
- if mot == "(":
- comm_ddd+='"(" '
- elif mot == ")":
- comm_ddd+='")" '
- else:
- comm_ddd+=mot+" "
- print comm_ddd
# ---
clt.waitNS("/Containers/" + theComputer + "/SuperVisionContainer")
##----------------
- #macomm2=['ddd']
- #pid = os.spawnvp(os.P_NOWAIT, macomm2[0], macomm2)
- #
# Attente de la disponibilite du Session Server dans le Naming Service
#
echo ---------------------------------------------
echo
-dnl openpbs_ok=no
+openpbs_ok=no
CHECK_OPENPBS
dnl openpbs_ok is set to yes by CHECK_OPENPBS
echo ---------------------------------------------
echo
-dnl lsf_ok=no
+lsf_ok=no
CHECK_LSF
dnl lsf_ok is set to yes by CHECK_LSF
echo
echo Configure
-variables="cc_ok boost_ok lex_yacc_ok mpi_ok python_ok swig_ok threads_ok OpenGL_ok qt_ok vtk_ok hdf5_ok med2_ok omniORB_ok occ_ok sip_ok pyqt_ok qwt_ok doxygen_ok graphviz_ok openpbs_ok lsf_ok"
+variables="cc_ok boost_ok lex_yacc_ok mpi_ok python_ok swig_ok threads_ok OpenGL_ok qt_ok vtk_ok hdf5_ok med2_ok omniORB_ok occ_ok sip_ok pyqt_ok qwt_ok doxygen_ok graphviz_ok"
+
+for var in $variables
+do
+ eval toto=\$$var
+ if test x$toto != "x"; then
+ printf " %10s : " `echo \$var | sed -e "s,_ok,,"`
+ eval echo \$$var
+ fi
+done
+echo "---Optional:"
+variables="openpbs_ok lsf_ok"
for var in $variables
do
mkdir -p bin/salome
cd bin/salome
-for i in $ROOT_SRCDIR/bin/*
+for i in `find $ROOT_SRCDIR/bin`
do
- local_bin=`echo $i | sed -e "s,$ROOT_SRCDIR,.,"`
+ local_bin=`echo $i | sed -e "s,$ROOT_SRCDIR/bin,.,"`
case "$local_bin" in
*.in | *~) ;;
- ./bin/CVS | ./bin/salome) ;;
- *) $INSTALL $i .; echo $local_bin ;;
+ . | */CVS | */CVS/* | ./salome) ;;
+ ./appliskel |./appliskel/env.d) $INSTALL -d $local_bin ; echo $local_bin ;;
+ *) $INSTALL $i $local_bin; echo $local_bin ;;
esac
done
cd $ROOT_BUILDDIR
bool _Sleeping = false ;
-// Needed by multi-threaded Python
+// // Needed by multi-threaded Python --- Supervision
int _ArgC ;
char ** _ArgV ;
if(activAndRegist)
ActSigIntHandler() ;
- _ArgC = argc ;
- _ArgV = argv ;
-
_argc = argc ;
_argv = argv ;
- int i = strlen( _argv[ 0 ] ) - 1 ;
- while ( i >= 0 )
- {
- if ( _argv[ 0 ][ i ] == '/' )
- {
- _argv[ 0 ][ i+1 ] = '\0' ;
- break ;
- }
- i -= 1 ;
- }
+
string hostname = GetHostname();
MESSAGE(hostname << " " << getpid() << " Engines_Container_i starting argc "
<< _argc << " Thread " << pthread_self() ) ;
- i = 0 ;
+
+ int i = 0 ;
while ( _argv[ i ] )
{
MESSAGE(" argv" << i << " " << _argv[ i ]) ;
_isSupervContainer = false;
if (strcmp(argv[1],"SuperVisionContainer") == 0) _isSupervContainer = true;
+ if (_isSupervContainer)
+ {
+ _ArgC = argc ;
+ _ArgV = argv ;
+ }
+
_containerName = BuildContainerNameForNS(containerName,hostname.c_str());
_orb = CORBA::ORB::_duplicate(orb) ;
perror("SALOME_Container main ") ;
exit(0) ;
}
- INFOS(pthread_self() << "SigIntHandler activated") ;
+ //PAL9042 JR : during the execution of a Signal Handler (and of methods called through Signal Handlers)
+ // use of streams (and so on) should never be used because :
+ // streams of C++ are naturally thread-safe and use pthread_mutex_lock ===>
+ // A stream operation may be interrupted by a signal and if the Handler use stream we
+ // may have a "Dead-Lock" ===HangUp
+ //==INFOS is commented
+ // INFOS(pthread_self() << "SigIntHandler activated") ;
}
void SetCpuUsed() ;
void SigIntHandler(int what , siginfo_t * siginfo ,
- void * toto )
-{
- MESSAGE(pthread_self() << "SigIntHandler what " << what << endl
- << " si_signo " << siginfo->si_signo << endl
- << " si_code " << siginfo->si_code << endl
- << " si_pid " << siginfo->si_pid) ;
+ void * toto ) {
+ //PAL9042 JR : during the execution of a Signal Handler (and of methods called through Signal Handlers)
+ // use of streams (and so on) should never be used because :
+ // streams of C++ are naturally thread-safe and use pthread_mutex_lock ===>
+ // A stream operation may be interrupted by a signal and if the Handler use stream we
+ // may have a "Dead-Lock" ===HangUp
+ //==MESSAGE is commented
+ // MESSAGE(pthread_self() << "SigIntHandler what " << what << endl
+ // << " si_signo " << siginfo->si_signo << endl
+ // << " si_code " << siginfo->si_code << endl
+ // << " si_pid " << siginfo->si_pid) ;
if ( _Sleeping ) {
_Sleeping = false ;
- MESSAGE("SigIntHandler END sleeping.") ;
+ // MESSAGE("SigIntHandler END sleeping.") ;
return ;
}
else {
}
else {
_Sleeping = true ;
- MESSAGE("SigIntHandler BEGIN sleeping.") ;
+ // MESSAGE("SigIntHandler BEGIN sleeping.") ;
int count = 0 ;
while( _Sleeping ) {
sleep( 1 ) ;
count += 1 ;
}
- MESSAGE("SigIntHandler LEAVE sleeping after " << count << " s.") ;
+ // MESSAGE("SigIntHandler LEAVE sleeping after " << count << " s.") ;
}
return ;
}
#include <string>
#include <stdio.h>
-//#include "Utils_ORB_INIT.hxx"
-//#include "Utils_SINGLETON.hxx"
#include <unistd.h>
-#include "SALOME_NamingService.hxx"
#include "SALOME_Container_i.hxx"
#include "utilities.h"
#include "SALOMETraceCollector.hxx"
#ifdef HAVE_MPI2
MPI_Init(&argc,&argv);
#endif
+
// Initialise the ORB.
CORBA::ORB_var orb = CORBA::ORB_init( argc , argv ) ;
SALOMETraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
Py_Initialize() ;
PySys_SetArgv( argc , argv ) ;
}
-
- try{
- // Obtain a reference to the root POA.
- // obtain the root poa manager
- //
- long TIMESleep = 500000000;
- int NumberOfTries = 40;
- int a;
- timespec ts_req;
- ts_req.tv_nsec=TIMESleep;
- ts_req.tv_sec=0;
- timespec ts_rem;
- ts_rem.tv_nsec=0;
- ts_rem.tv_sec=0;
- CosNaming::NamingContext_var inc;
- PortableServer::POA_var root_poa;
- CORBA::Object_var theObj;
- CORBA::Object_var obj;
- CORBA::Object_var object;
- //SALOME_NamingService &naming = *SINGLETON_<SALOME_NamingService>::Instance() ;
- int CONTAINER=0;
- const char * Env = getenv("USE_LOGGER");
- int EnvL =0;
- if(Env != NULL && strlen(Env))
- EnvL=1;
-
- CosNaming::Name name;
- name.length(1);
- name[0].id=CORBA::string_dup("Logger");
- PortableServer::POAManager_var pman;
- for(int i = 1; i <= NumberOfTries; i++){
- if(i != 1)
- a=nanosleep(&ts_req,&ts_rem);
- try{
- obj = orb->resolve_initial_references("RootPOA");
- if(!CORBA::is_nil(obj))
- root_poa = PortableServer::POA::_narrow(obj);
- if(!CORBA::is_nil(root_poa))
- pman = root_poa->the_POAManager();
- if(!CORBA::is_nil(orb))
- theObj = orb->resolve_initial_references("NameService");
- if (!CORBA::is_nil(theObj))
- inc = CosNaming::NamingContext::_narrow(theObj);
- }catch(CORBA::SystemException&){
- MESSAGE( "Container: CORBA::SystemException: Unable to contact the Naming Service" );
- }
- if(!CORBA::is_nil(inc)){
- MESSAGE( "Container: Naming Service was found" );
- if(EnvL == 1){
- for(int j = 1; j <= NumberOfTries; j++){
- if(j != 1)
- a=nanosleep(&ts_req, &ts_rem);
- try{
- object = inc->resolve(name);
- }catch(CosNaming::NamingContext::NotFound){
- MESSAGE( "Container: Logger Server wasn't found" );
- }catch(...){
- MESSAGE( "Container: Unknown exception" );
- }
- if(!CORBA::is_nil(object)){
- MESSAGE( "Container: Logger Server was found" );
- CONTAINER = 1;
- break;
- }
- }
- }
- }
- if(CONTAINER == 1 || (EnvL == 0 && !CORBA::is_nil(inc)))
- break;
- }
- char *containerName = "";
- if(argc > 1){
+ char *containerName = "";
+ if(argc > 1)
+ {
containerName = argv[1] ;
}
- // add new container to the kill list
- char aCommand[40];
- sprintf(aCommand, "addToKillList.py %d SALOME_Container", getpid());
- system(aCommand);
-
- Engines_Container_i * myContainer
- = new Engines_Container_i(orb, root_poa, containerName , argc , argv );
+ try
+ {
+ CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
+ ASSERT(!CORBA::is_nil(obj));
+ PortableServer::POA_var root_poa = PortableServer::POA::_narrow(obj);
- pman->activate();
-
+ PortableServer::POAManager_var pman = root_poa->the_POAManager();
+
+ // add new container to the kill list
+ char aCommand[40];
+ sprintf(aCommand, "addToKillList.py %d SALOME_Container", getpid());
+ system(aCommand);
+
+ Engines_Container_i * myContainer
+ = new Engines_Container_i(orb, root_poa, containerName , argc , argv );
+
+ pman->activate();
+
#ifdef CHECKTIME
- Utils_Timer timer;
- timer.Start();
- timer.Stop();
- MESSAGE("SALOME_Registry_Server.cxx - orb->run()");
- timer.ShowAbsolute();
+ Utils_Timer timer;
+ timer.Start();
+ timer.Stop();
+ MESSAGE("SALOME_Registry_Server.cxx - orb->run()");
+ timer.ShowAbsolute();
#endif
-
- HandleServerSideSignals(orb);
- }catch(CORBA::SystemException&){
- INFOS("Caught CORBA::SystemException.");
- }catch(PortableServer::POA::WrongPolicy&){
- INFOS("Caught CORBA::WrongPolicyException.");
- }catch(PortableServer::POA::ServantAlreadyActive&){
- INFOS("Caught CORBA::ServantAlreadyActiveException");
- }catch(CORBA::Exception&){
- INFOS("Caught CORBA::Exception.");
- }catch(std::exception& exc){
- INFOS("Caught std::exception - "<<exc.what());
- }catch(...){
- INFOS("Caught unknown exception.");
- }
+
+ HandleServerSideSignals(orb);
+
+ }
+ catch(CORBA::SystemException&)
+ {
+ INFOS("Caught CORBA::SystemException.");
+ }
+ catch(PortableServer::POA::ServantAlreadyActive&)
+ {
+ INFOS("Caught CORBA::ServantAlreadyActiveException");
+ }
+ catch(CORBA::Exception&)
+ {
+ INFOS("Caught CORBA::Exception.");
+ }
+ catch(std::exception& exc)
+ {
+ INFOS("Caught std::exception - "<<exc.what());
+ }
+ catch(...)
+ {
+ INFOS("Caught unknown exception.");
+ }
+
#ifdef HAVE_MPI2
MPI_Finalize();
#endif
+
END_OF(argv[0]);
delete myThreadTrace;
return 0 ;
SALOME_ContainerManager::SALOME_ContainerManager(CORBA::ORB_ptr orb)
{
+ MESSAGE("constructor");
_NS=new SALOME_NamingService(orb);
PortableServer::POA_var root_poa=PortableServer::POA::_the_root_poa();
PortableServer::POAManager_var pman = root_poa->the_POAManager();
CORBA::Object_var obj=my_poa->id_to_reference(id);
Engines::ContainerManager_var refContMan = Engines::ContainerManager::_narrow(obj);
_NS->Register(refContMan,_ContainerManagerNameInNS);
+ MESSAGE("constructor end");
}
SALOME_ContainerManager::~SALOME_ContainerManager()
{
+ MESSAGE("destructor");
delete _NS;
}
void SALOME_ContainerManager::Shutdown()
{
+ MESSAGE("Shutdown");
ShutdownContainers();
PortableServer::ObjectId_var oid = _default_POA()->servant_to_id(this);
_default_POA()->deactivate_object(oid);
void SALOME_ContainerManager::ShutdownContainers()
{
+ MESSAGE("ShutdownContainers");
_NS->Change_Directory("/Containers");
vector<string> vec=_NS->list_directory_recurs();
for(vector<string>::iterator iter=vec.begin();iter!=vec.end();iter++)
Engines::Container_ptr SALOME_ContainerManager::FindOrStartContainer(const char *containerName, const Engines::MachineList& possibleComputers)
{
+ MESSAGE("FindOrStartContainer "<<containerName);
Engines::Container_ptr ret=FindContainer(containerName,possibleComputers);
if(!CORBA::is_nil(ret))
return ret;
- // Container doesn't exist try to launch it ...
+ MESSAGE("Container doesn't exist try to launch it ...");
vector<string> vector;
string theMachine=_LoadManager.FindBest(possibleComputers);
+ SCRUTE(theMachine);
string command;
if(theMachine==GetHostname())
command=_ResManager.BuildCommandToLaunchLocalContainer(containerName);
else
command=_ResManager.BuildTempFileToLaunchRemoteContainer(theMachine,containerName);
- _ResManager.RmTmpFile();
+ //_ResManager.RmTmpFile();
int status=system(command.c_str());
if (status == -1) {
MESSAGE("SALOME_LifeCycleCORBA::StartOrFindContainer rsh failed (system command status -1)");
Engines::MachineList *SALOME_ContainerManager::GetFittingResources(const Engines::MachineParameters& params, const char *componentName)
{
+ MESSAGE("GetFittingResources");
vector<string> vec=_ResManager.GetFittingResources(params,componentName);
Engines::MachineList *ret=new Engines::MachineList;
+ MESSAGE("Machine list length "<<vec.size());
ret->length(vec.size());
for(unsigned int i=0;i<vec.size();i++)
{
char* SALOME_ContainerManager::FindBest(const Engines::MachineList& possibleComputers)
{
+ MESSAGE("FindBest");
string theMachine=_LoadManager.FindBest(possibleComputers);
return CORBA::string_dup(theMachine.c_str());
}
Engines::Container_ptr SALOME_ContainerManager::FindContainer(const char *containerName,const char *theMachine)
{
+ MESSAGE("FindContainer "<<theMachine);
string containerNameInNS(BuildContainerNameInNS(containerName,theMachine));
SCRUTE(containerNameInNS);
CORBA::Object_var obj = _NS->Resolve(containerNameInNS.c_str());
Engines::Container_ptr SALOME_ContainerManager::FindContainer(const char *containerName,const Engines::MachineList& possibleComputers)
{
+ MESSAGE("FindContainer "<<possibleComputers.length());
for(unsigned int i=0;i<possibleComputers.length();i++)
{
+ SCRUTE(possibleComputers[i]);
Engines::Container_ptr cont=FindContainer(containerName,possibleComputers[i]);
if( !CORBA::is_nil(cont) )
return cont;
string SALOME_ContainerManager::BuildContainerNameInNS(const char *containerName,const char *machineName)
{
+ MESSAGE("BuildContainerNameInNS");
string containerNameInNS("/Containers/");
containerNameInNS+=machineName;
containerNameInNS+="/";
#include "SALOME_ContainerManager.hxx"
+#include "SALOMETraceCollector.hxx"
#include "utilities.h"
int main(int argc, char* argv[])
CORBA::Object_var obj;
CORBA::ORB_var orb = CORBA::ORB_init( argc , argv ) ;
+ SALOMETraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
+ INFOS_COMPILATION;
+ BEGIN_OF(argv[0]);
try{
obj = orb->resolve_initial_references("RootPOA");
if(!CORBA::is_nil(obj))
}catch(...){
MESSAGE("Caught unknown exception.");
}
+ END_OF(argv[0]);
+ delete myThreadTrace;
}
EXPORT_HEADERS = SALOME_LifeCycleCORBA.hxx
-EXPORT_PYSCRIPTS = LifeCycleCORBA.py Launchers.py
+EXPORT_PYSCRIPTS = Launchers.py
# Libraries targets
SALOME_LifeCycleCORBA::SALOME_LifeCycleCORBA(SALOME_NamingService *ns)
{
- _NS = ns;
+ if (!ns)
+ {
+ int argc = 0;
+ char *xargv = "";
+ char **argv = &xargv;
+ CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
+ _NS = new SALOME_NamingService(orb);
+ }
+ else _NS = ns;
//add try catch
_NS->Change_Directory("/"); // mpv 250105: current directory may be not root
// (in SALOMEDS for an example)
{ // Compatibility ...
string theComputer ;
string theContainer ;
- cont = ContainerName( containerName , &theComputer , &theContainer ) ;
+ cont = _ContainerName( containerName , &theComputer , &theContainer ) ;
}
else
{
int studyId,
const char *instanceName)
{
- ASSERT(0);
+ if (! isKnownComponentClass(componentName))
+ return Engines::Component::_nil();
+ Engines::MachineList_var listOfMachine =
+ _ContManager->GetFittingResources(params,componentName);
+ Engines::Component_var compo =
+ _FindComponent(params.container_name,componentName,listOfMachine);
+ return compo._retn();
}
//=============================================================================
const char *componentName,
int studyId)
{
- ASSERT(0);
+ if (! isKnownComponentClass(componentName))
+ return Engines::Component::_nil();
+
+ Engines::MachineList_var listOfMachine =
+ _ContManager->GetFittingResources(params,componentName);
+
+ Engines::Container_var cont =
+ _ContManager->FindOrStartContainer(params.container_name,
+ listOfMachine);
+ if (CORBA::is_nil(cont)) return Engines::Component::_nil();
+
+ bool isLoadable = cont->load_component_Library(componentName);
+ if (!isLoadable) return Engines::Component::_nil();
+
+ Engines::Component_var myInstance =
+ cont->create_component_instance(componentName, 0);
+ return myInstance._retn();
}
//=============================================================================
/*! Public -
* Find and aready existing and registered component instance or load a new
- * component instance on a container defined by machine parameters
+ * component instance on a container defined by machine parameters.
* \param params machine parameters like type or name...
* \param componentName the name of component class
* \param studyId default = 0 : multistudy instance
Engines::MachineList_var listOfMachine =
_ContManager->GetFittingResources(params,componentName);
- Engines::Component_ptr ret=
- FindComponent(params.container_name,componentName,listOfMachine);
- if(CORBA::is_nil(ret))
- return LoadComponent(params.container_name,componentName,listOfMachine);
+ Engines::Component_var compo=
+ _FindComponent(params.container_name,componentName,listOfMachine);
+ if(CORBA::is_nil(compo))
+ return _LoadComponent(params.container_name,componentName,listOfMachine);
else
- return ret;
+ return compo._retn();
}
//=============================================================================
* - 1 localhost/aContainer
* - 2 aContainer
* - 3 /machine/aContainer
- * (not the same rules as FindContainer() method base on protected method
+ * (not the same rules as FindContainer() method based on protected method
* ContainerName() -- MUST BE CORRECTED --)
* \param componentName the name of component class
* \return a CORBA reference of the component instance, or _nil if problem
stContainer[rg]='\0';
if(strcmp(stContainer,"localhost")==0)
{
- Engines::Component_ptr ret=FindOrLoad_Component(stContainer+rg+1,
- componentName);
+ Engines::Component_var compo = FindOrLoad_Component(stContainer+rg+1,
+ componentName);
free(stContainer);
- return ret;
+ return compo._retn();
}
else ASSERT(0); // no return in that case...
}
Engines::MachineList_var listOfMachine=new Engines::MachineList;
listOfMachine->length(1);
listOfMachine[0]=CORBA::string_dup(GetHostname().c_str());
- Engines::Component_ptr ret = FindComponent(containerName,
- componentName,
- listOfMachine.in());
- if(CORBA::is_nil(ret))
- return LoadComponent(containerName,componentName,listOfMachine);
+ Engines::Component_var compo = _FindComponent(containerName,
+ componentName,
+ listOfMachine.in());
+ if(CORBA::is_nil(compo))
+ return _LoadComponent(containerName,componentName,listOfMachine);
else
- return ret;
+ return compo._retn();
}
else
{
//=============================================================================
/*! Protected -
- *
+ * Find and aready existing and registered component instance.
+ * \param containerName the name of container, or empty string
+ * (now, default Container Name used = FactoryServer)
+ * \param componentName the name of component class
+ * \param listOfMachines list of machine address
+ * \return a CORBA reference of the component instance, or _nil if not found
+ * - if containerName given, creates a sublist of the machine list, where
+ * machine/ContainerName/ComponentName exists. then chooses the best machine.
+ * - if no containerName given, choose first the best machine, then tries
+ * machine/ContainerName/ComponentName, where ContainerName = FactoryServer
*/
//=============================================================================
Engines::Component_ptr
-SALOME_LifeCycleCORBA::FindComponent(const char *containerName,
- const char *componentName,
- const Engines::MachineList& listOfMachines)
+SALOME_LifeCycleCORBA::_FindComponent(const char *containerName,
+ const char *componentName,
+ const Engines::MachineList& listOfMachines)
{
- if (! isKnownComponentClass(componentName)) return Engines::Component::_nil();
+ if (!isKnownComponentClass(componentName)) return Engines::Component::_nil();
if(containerName[0]!='\0')
{
Engines::MachineList_var machinesOK=new Engines::MachineList;
//=============================================================================
/*! Protected -
- *
+ * Load a component instance.
+ * \param containerName the name of container (no default name)
+ * \param componentName the name of component class
+ * \param listOfMachines list of machine address
+ * \return a CORBA reference of the component instance, or _nil if problem
+ * - uses the first container (of given name) found in the machines list.
+ * - if no container found, tries to launch one one the best machine of the
+ * list.
+ * Then, find or loads a component instance on the choosen container.
*/
//=============================================================================
Engines::Component_ptr
-SALOME_LifeCycleCORBA::LoadComponent(const char *containerName,
- const char *componentName,
- const Engines::MachineList& listOfMachines)
+SALOME_LifeCycleCORBA::_LoadComponent(const char *containerName,
+ const char *componentName,
+ const Engines::MachineList& listOfMachines)
{
- Engines::Container_var cont=_ContManager->FindOrStartContainer(containerName,
- listOfMachines);
- //string implementation=Engines_Component_i::GetDynLibraryName(componentName);
- //return cont->load_impl(componentName, implementation.c_str());
- return cont->load_impl(componentName,"");
+ Engines::Container_var cont =
+ _ContManager->FindOrStartContainer(containerName,
+ listOfMachines);
+ if (!CORBA::is_nil(cont)) return cont->load_impl(componentName,"");
+ else return Engines::Component::_nil();
}
//=============================================================================
/*! Protected -
- *
+ * Alternate Container Launcher, without container manager...
*/
//=============================================================================
Engines::Container_ptr
-SALOME_LifeCycleCORBA::FindOrStartContainer(const string aComputerContainer ,
- const string theComputer ,
- const string theContainer )
+SALOME_LifeCycleCORBA::_FindOrStartContainer(const string aComputerContainer ,
+ const string theComputer ,
+ const string theContainer )
{
SCRUTE( aComputerContainer ) ;
SCRUTE( theComputer ) ;
SCRUTE( theContainer ) ;
- Engines::Container_var aContainer = FindContainer(aComputerContainer.c_str());
+ Engines::Container_var aContainer =
+ FindContainer(aComputerContainer.c_str());
if ( !CORBA::is_nil( aContainer ) )
{
* \param aComputerContainer container name under one of the forms:
* - 1 aContainer
* - 2 machine/aContainer
- * \param theComputer return computer name:
+ * \param theComputer return computer name (machine):
* - 1 machine = GetHostname()
- * - 2 machine (localhost replaced by GetHostName())
+ * - 2 machine = as given (localhost replaced by GetHostName())
* \param theContainer return container name:
* - 1 aContainer
* - 2 aContainer
*/
//=============================================================================
-string SALOME_LifeCycleCORBA::ContainerName(const char *aComputerContainer ,
- string * theComputer ,
- string * theContainer )
+string SALOME_LifeCycleCORBA::_ContainerName(const char *aComputerContainer ,
+ string * theComputer ,
+ string * theContainer )
{
char * ContainerName = new char [ strlen( aComputerContainer ) + 1 ] ;
strcpy( ContainerName , aComputerContainer ) ;
*/
//=============================================================================
-string SALOME_LifeCycleCORBA::ComputerPath(const char * theComputer )
+string SALOME_LifeCycleCORBA::_ComputerPath(const char * theComputer )
{
CORBA::String_var path;
CORBA::Object_var obj = _NS->Resolve("/Kernel/ModulCatalog");
class SALOME_LifeCycleCORBA
{
public:
- SALOME_LifeCycleCORBA(SALOME_NamingService *ns);
+ SALOME_LifeCycleCORBA(SALOME_NamingService *ns = 0);
virtual ~SALOME_LifeCycleCORBA();
Engines::Container_ptr
Engines::Component_ptr
FindOrLoad_Component(const Engines::MachineParameters& params,
const char *componentName,
- int studyId=0);
+ int studyId =0);
Engines::Component_ptr
FindOrLoad_Component(const char *containerName,
* This method uses Naming Service to find the component.
*/
Engines::Component_ptr
- FindComponent(const char *containerName,
- const char *componentName,
- const Engines::MachineList& listOfMachines);
+ _FindComponent(const char *containerName,
+ const char *componentName,
+ const Engines::MachineList& listOfMachines);
Engines::Component_ptr
- LoadComponent(const char *containerName,
- const char *componentName,
- const Engines::MachineList& listOfMachines);
+ _LoadComponent(const char *containerName,
+ const char *componentName,
+ const Engines::MachineList& listOfMachines);
SALOME_NamingService *_NS;
Engines::ContainerManager_var _ContManager;
//private:
- std::string ContainerName( const char * aComputerContainer ,
- std::string * theComputer ,
- std::string * theContainer ) ;
- std::string ComputerPath( const char * theComputer ) ;
+ std::string _ContainerName( const char * aComputerContainer ,
+ std::string * theComputer ,
+ std::string * theContainer ) ;
+ std::string _ComputerPath( const char * theComputer ) ;
Engines::Container_ptr
- FindOrStartContainer(const std::string aComputerContainer ,
- const std::string theComputer ,
- const std::string theContainer ) ;
+ _FindOrStartContainer(const std::string aComputerContainer ,
+ const std::string theComputer ,
+ const std::string theContainer ) ;
} ;
#endif
--- /dev/null
+# SALOME LifeCycleCORBA : implementation of containers and engines life cycle both in Python and C++
+#
+# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+#
+#
+#
+# File : LifeCycleCORBA.py
+# Author : Paul RASCLE, EDF
+# Module : SALOME
+# $Header$
+
+
+import Engines
+from libSALOME_LifeCycleCORBA import *
+
+class LifeCycleCORBA (SALOME_LifeCycleCORBA):
+
+ def __init__(self, orb = None):
+ SALOME_LifeCycleCORBA.__init__(self)
+
+ def FindOrLoadComponent(self, containerName, componentName):
+ return SALOME_LifeCycleCORBA.FindOrLoad_Component(self,
+ containerName,
+ componentName)
--- /dev/null
+# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+#
+#
+#
+# File : Makefile.in
+# Author : Paul RASCLE, EDF
+# Module : SALOME
+# $Header$
+
+top_srcdir=@top_srcdir@
+top_builddir=../..
+srcdir=@srcdir@
+VPATH=.:@srcdir@:@top_srcdir@/idl
+
+
+@COMMENCE@
+
+# Libraries targets
+
+LIB = libSALOME_LifeCycleCORBAcmodule.la
+LIB_SRC =
+
+LIB_CLIENT_IDL = SALOME_Component.idl SALOME_ContainerManager.idl
+
+SWIG_DEF = libSALOME_LifeCycleCORBA.i
+
+EXPORT_PYSCRIPTS = libSALOME_LifeCycleCORBA.py LifeCycleCORBA.py TestLifeCycleCORBA.py
+
+CPPFLAGS+= $(PYTHON_INCLUDES)
+
+LIBS+= $(PYTHON_LIBS) -lSalomeLifeCycleCORBA
+
+LDFLAGS+= -lSalomeLifeCycleCORBA
+
+@CONCLUDE@
--- /dev/null
+
+import Engines
+import LifeCycleCORBA
+
+lcc = LifeCycleCORBA.LifeCycleCORBA()
+
+#obj=lcc.FindOrLoad_Component("FactoryServer","SalomeTestComponent")
+#comp=obj._narrow(Engines.TestComponent)
+#comp.Coucou(1)
+
+param={}
+param['hostname']='cli76ce'
+param['container_name']='myContainer'
+smesh=lcc.FindOrLoad_Component(param,'SMESH')
+
+container=lcc.FindContainer('myContainer')
+engine=lcc.FindComponent(param,'SMESH')
+geom=lcc.LoadComponent(param,'GEOM')
--- /dev/null
+
+
+%module libSALOME_LifeCycleCORBA
+
+%{
+#include "utilities.h"
+#include "SALOME_LifeCycleCORBA.hxx"
+
+ using namespace std;
+%}
+
+%typemap(python,out) Engines::Container_ptr, Engines::Component_ptr
+{
+ MESSAGE("typemap out on CORBA object ptr");
+ SCRUTE($1);
+
+ // --- Get the Python orb
+
+ PyObject* pdict = PyDict_New();
+ PyDict_SetItemString(pdict, "__builtins__", PyEval_GetBuiltins());
+ PyRun_String("import CORBA", Py_single_input, pdict, pdict);
+ PyRun_String("o = CORBA.ORB_init([''], CORBA.ORB_ID);", Py_single_input,
+ pdict, pdict);
+ PyObject* orb = PyDict_GetItemString(pdict, "o");
+
+ // --- Get the C++ orb
+
+ int argc = 0;
+ char *xargv = "";
+ char **argv = &xargv;
+ CORBA::ORB_var ORB = CORBA::ORB_init(argc, argv);
+ string s = ORB->object_to_string($1);
+ SCRUTE(s);
+ PyObject * tmp = PyString_FromString(s.c_str());
+ SCRUTE(tmp);
+ $result = PyObject_CallMethod(orb, "string_to_object", "O", tmp);
+ SCRUTE($result);
+}
+
+
+%typemap(typecheck) const Engines::MachineParameters &
+{
+ $1 = ($input != 0);
+}
+
+%typemap(python,in) const Engines::MachineParameters &
+{
+ printf("typemap in on Engines::MachineParameters\n");
+ //MESSAGE("typemap in on Engines::MachineParameters");
+ //ASSERT (PyDict_Check($input))
+ if (PyDict_Check($input) == 1)
+ {
+ Engines::MachineParameters *param = new Engines::MachineParameters ;
+ PyObject *key, *value;
+ int pos = 0;
+ while (PyDict_Next($input, &pos, &key, &value))
+ {
+ char* keystr = PyString_AsString(key);
+ printf("key: %s\n", keystr);
+ if (strcmp(keystr,"container_name")==0)
+ {
+ param->container_name = CORBA::string_dup(PyString_AsString(value));
+ }
+ else if (strcmp(keystr,"hostname")==0)
+ {
+ param->hostname = CORBA::string_dup(PyString_AsString(value));
+ }
+ else if (strcmp(keystr,"OS")==0)
+ {
+ param->OS = CORBA::string_dup(PyString_AsString(value));
+ }
+ else if (strcmp(keystr,"mem_mb")==0)
+ {
+ param->mem_mb = PyLong_AsLong(value);
+ }
+ else if (strcmp(keystr,"cpu_clock")==0)
+ {
+ param->cpu_clock = PyLong_AsLong(value);
+ }
+ else if (strcmp(keystr,"nb_proc_per_node")==0)
+ {
+ param->nb_proc_per_node = PyLong_AsLong(value);
+ }
+ else if (strcmp(keystr,"nb_node")==0)
+ {
+ param->nb_node = PyLong_AsLong(value);
+ }
+ }
+ $1 = param;
+ }
+ else
+ {
+ printf("pas un dico\n");
+ return NULL;
+ }
+}
+
+%typemap(python,freearg) const Engines::MachineParameters &
+{
+ MESSAGE("delete $1");
+ delete $1;
+}
+
+%include "SALOME_LifeCycleCORBA.hxx"
CASCatch GenericObj MEDWrapper NamingService Registry \
ModuleCatalog DataTypeCatalog RessourcesCatalog \
ResourcesManager Notification NOTIFICATION_SWIG \
- Container TestContainer LifeCycleCORBA HDFPersist \
+ Container TestContainer LifeCycleCORBA LifeCycleCORBA_SWIG HDFPersist \
SALOMEDSClient TOOLSDS SALOMEDSImpl SALOMEDS KERNEL_PY \
ModuleGenerator Communication
SALOME_NamingService::~SALOME_NamingService()
{
- MESSAGE("SALOME_NamingService destruction");
+ // Problem MESSAGE with singleton: late destruction, after trace system destruction ?
+ //MESSAGE("SALOME_NamingService destruction");
}
//----------------------------------------------------------------------