--- /dev/null
+# SALOME ResourcesManager
+#
+# 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 : Jean Rahuel
+# Module : SALOME
+# $Header:
+
+top_srcdir=@top_srcdir@
+top_builddir=../..
+srcdir=@srcdir@
+VPATH=.:@srcdir@:@top_srcdir@/idl
+
+
+@COMMENCE@
+
+# Libraries targets
+LIB = libResourcesManager.la
+LIB_SRC = ResourcesManager_Handler.cxx \
+ ResourcesComputer_Impl.cxx \
+ ResourcesManager_Impl.cxx
+
+# Executables targets
+BIN = ResourcesManager_Server
+BIN_SRC =
+BIN_SERVER_IDL = ContainersManager.idl SALOME_Component.idl ResourcesManager.idl
+
+CPPFLAGS+= $(QT_MT_INCLUDES)
+CXXFLAGS+=
+LDFLAGS+= $(QT_MT_LIBS) $(OGL_LIBS) -lSalomeNS -lOpUtil -lSALOMELocalTrace
+
+@CONCLUDE@
+
+
--- /dev/null
+// ResourcesComputer_Impl
+//
+// 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 : ResourcesComputer_Impl.cxx
+// Author : Jean Rahuel
+// Module : SALOME
+
+using namespace std;
+#include "ResourcesComputer_Impl.hxx"
+#include <fstream>
+
+Computer_Impl::Computer_Impl() {
+}
+
+Computer_Impl::Computer_Impl( CORBA::ORB_ptr orb ,
+ PortableServer::POA_ptr poa ,
+ Resources::ComputerParameters * aComputerParameters ,
+ Resources::ComputerEnvironment * aComputerEnvironment ) {
+ _Orb = CORBA::ORB::_duplicate( orb ) ;
+ _Poa = PortableServer::POA::_duplicate( poa ) ;
+ _Id = _Poa->activate_object( this ) ;
+ _ComputerParameters = new Resources::ComputerParameters() ;
+ _ComputerParameters->FullName = CORBA::string_dup( aComputerParameters->FullName ) ;
+ _ComputerParameters->Alias = CORBA::string_dup( aComputerParameters->Alias ) ;
+ _ComputerParameters->SshAccess = aComputerParameters->SshAccess ;
+ _ComputerParameters->Interactive = aComputerParameters->Interactive ;
+ _ComputerParameters->Batch = aComputerParameters->Batch ;
+ _ComputerParameters->UserName = CORBA::string_dup( aComputerParameters->UserName ) ;
+ _ComputerParameters->Os = aComputerParameters->Os ;
+ _ComputerParameters->Memory = aComputerParameters->Memory ;
+ _ComputerParameters->Swap = aComputerParameters->Swap ;
+ _ComputerParameters->CpuClock = aComputerParameters->CpuClock ;
+ _ComputerParameters->NbProc = aComputerParameters->NbProc ;
+ _ComputerParameters->NbNode = aComputerParameters->NbNode ;
+ _ComputerEnvironment = new Resources::ComputerEnvironment() ;
+ _ComputerEnvironment->Path = CORBA::string_dup( aComputerEnvironment->Path ) ;
+ _ComputerEnvironment->Ld_Library_Path = CORBA::string_dup( aComputerEnvironment->Ld_Library_Path ) ;
+ _ComputerEnvironment->PythonPath = CORBA::string_dup( aComputerEnvironment->PythonPath ) ;
+ _ComputerEnvironment->CasRoot = CORBA::string_dup( aComputerEnvironment->CasRoot ) ;
+ int size = aComputerEnvironment->Module_Root_Dir_Names.length() ;
+ _ComputerEnvironment->Module_Root_Dir_Names.length( size ) ;
+ _ComputerEnvironment->Module_Root_Dir_Values.length( size ) ;
+ int i ;
+ for ( i = 0 ; i < size ; i++ ) {
+ _ComputerEnvironment->Module_Root_Dir_Names[ i ] = CORBA::string_dup( aComputerEnvironment->Module_Root_Dir_Names[ i ] ) ;
+ _ComputerEnvironment->Module_Root_Dir_Values[ i ] = CORBA::string_dup( aComputerEnvironment->Module_Root_Dir_Values[ i ] ) ;
+ }
+ cout << "Computer_Impl::Computer_Impl FullName " << _ComputerParameters->FullName << endl ;
+ cout << "Computer_Impl::Computer_Impl Alias " << _ComputerParameters->Alias << endl ;
+ cout << "Computer_Impl::Computer_Impl SshAccess " << _ComputerParameters->SshAccess << endl ;
+ cout << "Computer_Impl::Computer_Impl Interactive " << _ComputerParameters->Interactive << endl ;
+ cout << "Computer_Impl::Computer_Impl Batch " << _ComputerParameters->Batch << endl ;
+ cout << "Computer_Impl::Computer_Impl UserName " << _ComputerParameters->UserName << endl ;
+ cout << "Computer_Impl::Computer_Impl Os " << _ComputerParameters->Os << endl ;
+ cout << "Computer_Impl::Computer_Impl Memory " << _ComputerParameters->Memory << endl ;
+ cout << "Computer_Impl::Computer_Impl Swap " << _ComputerParameters->Swap << endl ;
+ cout << "Computer_Impl::Computer_Impl CpuClock " << _ComputerParameters->CpuClock << endl ;
+ cout << "Computer_Impl::Computer_Impl NbProc " << _ComputerParameters->NbProc << endl ;
+ cout << "Computer_Impl::Computer_Impl NbNode " << _ComputerParameters->NbNode << endl ;
+ for ( i = 0 ; i < size ; i++ ) {
+ cout << "Computer_Impl::Computer_Impl Module_Root_Dir_Names[" << i << " ] " << _ComputerEnvironment->Module_Root_Dir_Names[ i ] << endl ;
+ cout << "Computer_Impl::Computer_Impl Module_Root_Dir_Values[" << i << " ] " << _ComputerEnvironment->Module_Root_Dir_Values[ i ] << endl ;
+ }
+ cout << "Computer_Impl::Computer_Impl Path " << _ComputerEnvironment->Path << endl ;
+ cout << "Computer_Impl::Computer_Impl Ld_Library_Path " << _ComputerEnvironment->Ld_Library_Path << endl ;
+ cout << "Computer_Impl::Computer_Impl PythonPath " << _ComputerEnvironment->PythonPath << endl ;
+ cout << "Computer_Impl::Computer_Impl CasRoot " << _ComputerEnvironment->CasRoot << endl ;
+}
+
+Computer_Impl::~Computer_Impl() {
+}
+
+PortableServer::ObjectId * Computer_Impl::getId() {
+ return _Id ;
+}
+
+long Computer_Impl::ping() {
+ MESSAGE("Computer_Impl::ping()") ;
+ return 1 ;
+}
+
+char * Computer_Impl::FullName() {
+ MESSAGE("Computer_Impl::FullName()") ;
+ return CORBA::string_dup( _ComputerParameters->FullName ) ;
+}
+
+char * Computer_Impl::Alias() {
+ MESSAGE("Computer_Impl::Alias()") ;
+ return CORBA::string_dup( _ComputerParameters->Alias ) ;
+}
+
+Resources::ComputerParameters * Computer_Impl::Parameters() {
+ Resources::ComputerParameters_var aComputerParameters = new Resources::ComputerParameters() ;
+ aComputerParameters->FullName = CORBA::string_dup( _ComputerParameters->FullName ) ;
+ aComputerParameters->Alias = CORBA::string_dup( _ComputerParameters->Alias ) ;
+ aComputerParameters->SshAccess = _ComputerParameters->SshAccess ;
+ aComputerParameters->Interactive = _ComputerParameters->Interactive ;
+ aComputerParameters->Batch = _ComputerParameters->Batch ;
+ aComputerParameters->UserName = CORBA::string_dup( _ComputerParameters->UserName ) ;
+ aComputerParameters->Os = _ComputerParameters->Os ;
+ aComputerParameters->Memory = _ComputerParameters->Memory ;
+ aComputerParameters->Swap = _ComputerParameters->Swap ;
+ aComputerParameters->CpuClock = _ComputerParameters->CpuClock ;
+ aComputerParameters->NbProc = _ComputerParameters->NbProc ;
+ aComputerParameters->NbNode = _ComputerParameters->NbNode ;
+ return aComputerParameters._retn() ;
+}
+
+Resources::ComputerEnvironment * Computer_Impl::Environment() {
+ Resources::ComputerEnvironment_var aComputerEnvironment = new Resources::ComputerEnvironment() ;
+ aComputerEnvironment->Path = CORBA::string_dup( _ComputerEnvironment->Path ) ;
+ aComputerEnvironment->Ld_Library_Path = CORBA::string_dup( _ComputerEnvironment->Ld_Library_Path ) ;
+ aComputerEnvironment->PythonPath = CORBA::string_dup( _ComputerEnvironment->PythonPath ) ;
+ aComputerEnvironment->CasRoot = CORBA::string_dup( _ComputerEnvironment->CasRoot ) ;
+ int size = _ComputerEnvironment->Module_Root_Dir_Names.length() ;
+ aComputerEnvironment->Module_Root_Dir_Names.length( size ) ;
+ aComputerEnvironment->Module_Root_Dir_Values.length( size ) ;
+ int i ;
+ for ( i = 0 ; i < size ; i++ ) {
+ aComputerEnvironment->Module_Root_Dir_Names[ i ] = CORBA::string_dup( _ComputerEnvironment->Module_Root_Dir_Names[ i ] ) ;
+ aComputerEnvironment->Module_Root_Dir_Values[ i ] = CORBA::string_dup( _ComputerEnvironment->Module_Root_Dir_Values[ i ] ) ;
+ }
+ return aComputerEnvironment._retn() ;
+}
+
--- /dev/null
+// SALOME ResourcesComputer_Impl
+//
+// 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 : ResourcesComputer_Impl.hxx
+// Author : Jean Rahuel
+// Module : SALOME
+// $Header:
+
+#ifndef RESOURCESCOMPUTER_IMPL_HXX
+#define RESOURCESCOMPUTER_IMPL_HXX
+
+#include "utilities.h"
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER( ResourcesManager )
+
+class Computer_Impl : public POA_Resources::Computer ,
+ public PortableServer::RefCountServantBase {
+ private:
+
+ CORBA::ORB_ptr _Orb ;
+ PortableServer::POA_ptr _Poa ;
+ PortableServer::ObjectId * _Id ;
+
+ Resources::ComputerParameters * _ComputerParameters ;
+ Resources::ComputerEnvironment * _ComputerEnvironment ;
+
+ public:
+
+ Computer_Impl() ;
+
+ Computer_Impl( CORBA::ORB_ptr orb ,
+ PortableServer::POA_ptr poa ,
+ Resources::ComputerParameters * aComputerParameters ,
+ Resources::ComputerEnvironment * aComputerEnvironment ) ;
+
+ ~Computer_Impl() ;
+
+ PortableServer::ObjectId * Computer_Impl::getId() ;
+
+ virtual long ping() ;
+
+ virtual char * FullName() ;
+
+ virtual char * Alias() ;
+
+ virtual Resources::ComputerParameters * Parameters() ;
+
+ virtual Resources::ComputerEnvironment * Environment() ;
+
+} ;
+
+#endif
--- /dev/null
+// SALOME ResourcesManager_Handler
+//
+// 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 : ResourcesManager_Handler.cxx
+// Author : Jean Rahuel
+// Module : SALOME
+//$Header:
+
+#define TRACE 1
+
+using namespace std;
+
+#include "ResourcesManager_Handler.hxx"
+
+ResourcesManager_Handler::ResourcesManager_Handler( CORBA::ORB_ptr orb ,
+ PortableServer::POA_ptr poa ) {
+ MESSAGE("ResourcesManager_Handler creation") ;
+ _Orb = CORBA::ORB::_duplicate( orb ) ;
+ _Poa = PortableServer::POA::_duplicate( poa ) ;
+ ResetParameters() ;
+}
+
+ResourcesManager_Handler::~ResourcesManager_Handler() {
+ MESSAGE("~ResourcesManager_Handler");
+}
+
+//Resources::ListOfComputers * ResourcesManager_Handler::ListOfComputers() {
+// MESSAGE("ResourcesManager_Handler::ListOfComputers() " << _ComputersList->length() << " computers" ) ;
+// return _ComputersList._retn() ;
+//}
+
+vector< Computer_Impl * > ResourcesManager_Handler::ComputersVector() {
+ MESSAGE("ResourcesManager_Handler::ComputersVector() " << _ComputersVector.size() << " computers" ) ;
+ return _ComputersVector;
+}
+
+void ResourcesManager_Handler::ResetParameters() {
+ _ComputerParameters.FullName = CORBA::string_dup( "" ) ;
+ _ComputerParameters.Alias = CORBA::string_dup( "" ) ;
+ _ComputerParameters.SshAccess = 0 ;
+ _ComputerParameters.Interactive = 0 ;
+ _ComputerParameters.Batch = 0 ;
+ _ComputerParameters.UserName = CORBA::string_dup( "" ) ;
+ _ComputerParameters.Os = Containers::Unknown ;
+ _ComputerParameters.Memory = 0 ;
+ _ComputerParameters.Swap = 0 ;
+ _ComputerParameters.CpuClock = 0 ;
+ _ComputerParameters.NbProc = 0 ;
+ _ComputerParameters.NbNode = 0 ;
+ _ComputerEnvironment.Path = CORBA::string_dup( "" ) ;
+ _ComputerEnvironment.Ld_Library_Path = CORBA::string_dup( "" ) ;
+ _ComputerEnvironment.PythonPath = CORBA::string_dup( "" ) ;
+ _ComputerEnvironment.CasRoot = CORBA::string_dup( "" ) ;
+ _ComputerEnvironment.Module_Root_Dir_Names.length( 0 ) ;
+ _ComputerEnvironment.Module_Root_Dir_Values.length( 0 ) ;
+}
+
+Containers::System ResourcesManager_Handler::OsEnumValue( const string anOsName ) {
+ if ( anOsName == "Linux" ) {
+ return Containers::Linux ;
+ }
+ return Containers::Unknown ;
+}
+
+bool ResourcesManager_Handler::startDocument() {
+ MESSAGE("Begin parse document");
+ return true;
+}
+
+bool ResourcesManager_Handler::startElement( const QString&,
+ const QString&,
+ const QString& qName,
+ const QXmlAttributes& atts) {
+ return true;
+}
+
+bool ResourcesManager_Handler::endElement( const QString& , const QString& ,
+ const QString& qName ) {
+ if ( qName.compare( QString( "fullname" ) ) == 0 ) {
+#if TRACE
+ cout << "fullname " << content.c_str() << endl ;
+#endif
+ _ComputerParameters.FullName = CORBA::string_dup( content.c_str() ) ;
+ }
+ else if ( qName.compare(QString( "alias" ) ) == 0 ) {
+#if TRACE
+ cout << "alias " << content.c_str() << endl ;
+#endif
+ _ComputerParameters.Alias = CORBA::string_dup( content.c_str() ) ;
+ }
+ else if ( qName.compare(QString( "sshaccess" ) ) == 0 ) {
+#if TRACE
+ cout << "sshaccess " << content.c_str() << endl ;
+#endif
+ _ComputerParameters.SshAccess = atol( content.c_str() ) ;
+ }
+ else if ( qName.compare(QString( "interactive" ) ) == 0 ) {
+#if TRACE
+ cout << "interactive " << content.c_str() << endl ;
+#endif
+ _ComputerParameters.Interactive = atol( content.c_str() ) ;
+ }
+ else if ( qName.compare(QString( "batch" ) ) == 0 ) {
+#if TRACE
+ cout << "batch " << content.c_str() << endl ;
+#endif
+ _ComputerParameters.Batch = atol( content.c_str() ) ;
+ }
+ else if ( qName.compare(QString( "username" ) ) == 0 ) {
+#if TRACE
+ cout << "username " << content.c_str() << " length " << content.length() << endl ;
+#endif
+ if ( content[0] != '\n' ) {
+ _ComputerParameters.UserName = CORBA::string_dup( content.c_str() ) ;
+ }
+ }
+ else if ( qName.compare(QString( "os" ) ) == 0 ) {
+#if TRACE
+ cout << "os " << content.c_str() << endl ;
+#endif
+ _ComputerParameters.Os = OsEnumValue( content ) ;
+ }
+ else if ( qName.compare(QString( "memory" ) ) == 0 ) {
+#if TRACE
+ cout << "memory " << content.c_str() << endl ;
+#endif
+ _ComputerParameters.Memory = atol( content.c_str() ) ;
+ }
+ else if ( qName.compare(QString( "swap" ) ) == 0 ) {
+#if TRACE
+ cout << "swap " << content.c_str() << endl ;
+#endif
+ _ComputerParameters.Swap = atol( content.c_str() ) ;
+ }
+ else if ( qName.compare(QString( "cpuclock" ) ) == 0 ) {
+#if TRACE
+ cout << "cpuclock " << content.c_str() << endl ;
+#endif
+ _ComputerParameters.CpuClock = atol( content.c_str() ) ;
+ }
+ else if ( qName.compare(QString( "nbproc" ) ) == 0 ) {
+#if TRACE
+ cout << "nbproc " << content.c_str() << endl ;
+#endif
+ _ComputerParameters.NbProc = atol( content.c_str() ) ;
+ }
+ else if ( qName.compare(QString( "nbnode" ) ) == 0 ) {
+#if TRACE
+ cout << "nbnode " << content.c_str() << endl ;
+#endif
+ _ComputerParameters.NbNode = atol( content.c_str() ) ;
+ }
+
+ else if ( qName.compare(QString("path") ) == 0 ) {
+#if TRACE
+ cout << "path " << content.c_str() << endl ;
+#endif
+ _ComputerEnvironment.Path = CORBA::string_dup( content.c_str() ) ;
+ }
+ else if ( qName.compare(QString("ld_library_path") ) == 0 ) {
+#if TRACE
+ cout << "ld_library_path " << content.c_str() << endl ;
+#endif
+ _ComputerEnvironment.Ld_Library_Path = CORBA::string_dup( content.c_str() ) ;
+ }
+ else if ( qName.compare(QString("pythonpath") ) == 0 ) {
+#if TRACE
+ cout << "pythonpath " << content.c_str() << endl ;
+#endif
+ _ComputerEnvironment.PythonPath = CORBA::string_dup( content.c_str() ) ;
+ }
+ else if ( qName.compare(QString("casroot") ) == 0 ) {
+#if TRACE
+ cout << "casroot " << content.c_str() << endl ;
+#endif
+ _ComputerEnvironment.CasRoot = CORBA::string_dup( content.c_str() ) ;
+ }
+ else if ( qName.compare(QString("modules_root_dir") ) == 0 ) {
+#if TRACE
+ cout << "modules_root_dir " << content.c_str() << endl ;
+#endif
+ int size = _ComputerEnvironment.Module_Root_Dir_Names.length() ;
+ _ComputerEnvironment.Module_Root_Dir_Names.length( size + 1 ) ;
+ _ComputerEnvironment.Module_Root_Dir_Names[ size ] = CORBA::string_dup( content.c_str() ) ;
+ }
+ else if ( qName.compare(QString("modules_root_path") ) == 0 ) {
+#if TRACE
+ cout << "modules_root_path " << content.c_str() << endl ;
+#endif
+ int size = _ComputerEnvironment.Module_Root_Dir_Values.length() ;
+ _ComputerEnvironment.Module_Root_Dir_Values.length( size + 1 ) ;
+ _ComputerEnvironment.Module_Root_Dir_Values[ size ] = CORBA::string_dup( content.c_str() ) ;
+ }
+
+ else if ( qName.compare(QString("computer") ) == 0 ) {
+ Computer_Impl * aComputer = new Computer_Impl( _Orb , _Poa ,
+ &_ComputerParameters , &_ComputerEnvironment ) ;
+ int size = _ComputersVector.size() ;
+ _ComputersVector.resize( size + 1 ) ;
+ _ComputersVector[ size ] = aComputer ;
+ ResetParameters() ;
+#if TRACE
+ cout << size+1 << " computers" << endl ;
+#endif
+ }
+
+ return true;
+}
+
+bool ResourcesManager_Handler::characters(const QString& chars) {
+ content = (const char *)chars ;
+ return true;
+}
+
+bool ResourcesManager_Handler::endDocument() {
+ MESSAGE("End parse document");
+ return true;
+}
+
+QString ResourcesManager_Handler::errorProtocol() {
+ return errorProt;
+}
+
+bool ResourcesManager_Handler::fatalError(const QXmlParseException& exception) {
+ errorProt += QString( "fatal parsing error: %1 in line %2, column %3\n" )
+ .arg( exception.message() )
+ .arg( exception.lineNumber() )
+ .arg( exception.columnNumber() );
+
+ return QXmlDefaultHandler::fatalError( exception );
+}
+
--- /dev/null
+// SALOME ResourcesManager_Handler
+//
+// 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 : ResourcesManager_Handler.hxx
+// Author : Jean Rahuel
+// Module : SALOME
+//$Header:
+
+#ifndef RESSOURCESMANAGER_HANDLER_HXX
+#define RESSOURCESMANAGER_HANDLER_HXX
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER( ResourcesManager )
+#include CORBA_SERVER_HEADER( ContainersManager )
+
+#include "utilities.h"
+#include "ResourcesManager_Parser.hxx"
+#include "ResourcesComputer_Impl.hxx"
+#include <qxml.h>
+#include <string>
+#include <vector>
+
+class ResourcesManager_Handler : public QXmlDefaultHandler {
+
+ private :
+
+ CORBA::ORB_ptr _Orb ;
+ PortableServer::POA_ptr _Poa ;
+
+// Resources::ListOfComputers_var _ComputersList ;
+ vector< Computer_Impl * > _ComputersVector ;
+ Resources::ComputerParameters _ComputerParameters ;
+ Resources::ComputerEnvironment _ComputerEnvironment ;
+
+ QString errorProt ;
+
+ string content ;
+
+ void ResourcesManager_Handler::ResetParameters() ;
+
+ Containers::System OsEnumValue( const string anOsName ) ;
+
+ public :
+
+ ResourcesManager_Handler( CORBA::ORB_ptr orb ,
+ PortableServer::POA_ptr poa ) ;
+
+ virtual ~ResourcesManager_Handler() ;
+
+// virtual Resources::ListOfComputers * ListOfComputers() ;
+ vector< Computer_Impl * > ComputersVector() ;
+
+ virtual bool startDocument() ;
+
+ virtual bool startElement( const QString& , const QString& ,
+ const QString& qName , const QXmlAttributes& atts ) ;
+
+ virtual bool endElement( const QString& , const QString& ,
+ const QString& qName) ;
+
+ virtual bool characters( const QString & chars) ;
+
+ virtual bool endDocument() ;
+
+ virtual QString errorProtocol() ;
+
+ virtual bool fatalError( const QXmlParseException& exception ) ;
+
+} ;
+
+#endif
--- /dev/null
+// ResourcesManager_Impl
+//
+// 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 : ResourcesManager_Impl.cxx
+// Author : Jean Rahuel
+// Module : SALOME
+
+using namespace std;
+
+#include <fstream>
+
+#include "ResourcesManager_Impl.hxx"
+
+Manager_Impl::Manager_Impl( CORBA::ORB_ptr orb ,
+ PortableServer::POA_ptr poa ,
+ SALOME_NamingService * NamingService ,
+ int argc ,
+ char ** argv ) {
+
+ _Orb = CORBA::ORB::_duplicate( orb ) ;
+ _Poa = PortableServer::POA::_duplicate( poa ) ;
+ _Id = _Poa->activate_object( this ) ;
+ _NamingService = NamingService ;
+
+ _ComputersList = new Resources::ListOfComputers() ;
+
+ if ( !ParseArguments( argc , argv , &_CatalogPath ) ) {
+ MESSAGE( "Error while argument parsing" ) ;
+ }
+ else if ( _CatalogPath == NULL ) {
+ MESSAGE( "Error the resources catalog should be indicated" ) ;
+ }
+ else {
+ MESSAGE("Parse resources catalog");
+ ParseXmlFile( _CatalogPath ) ;
+ }
+ int i ;
+ MESSAGE(_ComputersVector.size() << " computers") ;
+ int size = _ComputersVector.size() ;
+ _ComputersList->length( size ) ;
+ for ( i = 0 ; i < size ; i++ ) {
+ Computer_Impl * aComputer = _ComputersVector[ i ] ;
+ PortableServer::ObjectId * id = aComputer->getId() ;
+ CORBA::Object_var obj = _Poa->id_to_reference( *id ) ;
+ Resources::Computer_var iobject = Resources::Computer::_narrow( obj ) ;
+ _ComputersList[ i ] = Resources::Computer::_duplicate( iobject ) ;
+ Resources::ComputerParameters * aComputerParameters = aComputer->Parameters() ;
+ const char * anAlias = aComputerParameters->Alias ;
+ if ( _MapOfComputers[ anAlias ] > 0 ) {
+ MESSAGE("Duplicate computer " << aComputerParameters->FullName << " " << anAlias ) ;
+ }
+ else {
+ MESSAGE("Computer " << aComputerParameters->FullName << " " << anAlias ) ;
+ _MapOfComputers[ anAlias ] = i + 1 ;
+ }
+ }
+ MESSAGE(_ComputersList->length() << " computers") ;
+}
+
+Manager_Impl::~Manager_Impl() {
+ MESSAGE("~Manager_Impl()") ;
+}
+
+long Manager_Impl::ping() {
+ MESSAGE("Manager_Impl::ping()") ;
+ return 1 ;
+}
+
+Resources::Computer_ptr Manager_Impl::TestComputer() {
+#if 1
+ Resources::ComputerParameters * aComputerParameters = new Resources::ComputerParameters() ;
+ aComputerParameters->FullName = CORBA::string_dup( "FullName" ) ;
+ aComputerParameters->Alias = CORBA::string_dup( "Alias" ) ;
+ aComputerParameters->SshAccess = 1 ;
+ aComputerParameters->Interactive = 1 ;
+ aComputerParameters->Batch = 1 ;
+ aComputerParameters->UserName = CORBA::string_dup( "UserName" ) ;
+ aComputerParameters->Os = Containers::Linux ;
+ aComputerParameters->Memory = 100 ;
+ aComputerParameters->Swap = 200 ;
+ aComputerParameters->CpuClock = 300 ;
+ aComputerParameters->NbProc = 1 ;
+ aComputerParameters->NbNode = 1 ;
+ Resources::ComputerEnvironment * aComputerEnvironment = new Resources::ComputerEnvironment() ;
+ aComputerEnvironment->Path = CORBA::string_dup( "Path" ) ;
+ aComputerEnvironment->Ld_Library_Path = CORBA::string_dup( "Ld_Library_Path" ) ;
+ aComputerEnvironment->PythonPath = CORBA::string_dup( "PythonPath" ) ;
+ aComputerEnvironment->CasRoot = CORBA::string_dup( "CasRoot" ) ;
+ Computer_Impl * aComputer = new Computer_Impl( _Orb , _Poa ,
+ aComputerParameters , aComputerEnvironment ) ;
+ PortableServer::ObjectId * id = aComputer->getId() ;
+ CORBA::Object_var obj = _Poa->id_to_reference( *id ) ;
+ Resources::Computer_var iobject = Resources::Computer::_narrow( obj ) ;
+ return Resources::Computer::_duplicate( iobject ) ;
+#endif
+}
+
+long Manager_Impl::SshAccess( const char * aComputerName ) {
+ if ( !CORBA::is_nil( SearchComputer( aComputerName ) ) ) {
+ return SearchComputer( aComputerName )->Parameters()->SshAccess ;
+ }
+ return 0 ;
+}
+
+Resources::ListOfComputers * Manager_Impl::AllComputers() {
+ MESSAGE("Manager_Impl::AllComputers()") ;
+ Resources::ListOfComputers_var aListOfComputers = new Resources::ListOfComputers() ;
+ aListOfComputers->length( _ComputersList->length() ) ;
+ int i ;
+ for ( i = 0 ; i < _ComputersList->length() ; i++ ) {
+ Resources::Computer_var aComputer = _ComputersList[ i ] ;
+ aListOfComputers[ i ] = Resources::Computer::_duplicate( aComputer ) ;
+ }
+ return aListOfComputers._retn() ;
+}
+
+Resources::ListOfComputers * Manager_Impl::GetComputers( const Containers::MachineParameters & aMachineParameters ) {
+ MESSAGE("Manager_Impl::GetComputers()") ;
+ Resources::ListOfComputers_var aListOfComputers = new Resources::ListOfComputers() ;
+ int i ;
+ if ( strlen( (char * ) ((CORBA::String_member ) aMachineParameters.HostName) ) ) {
+ for ( i = 0 ; i < _ComputersList->length() ; i++ ) {
+ Resources::Computer_var aComputer = _ComputersList[ i ] ;
+ if ( aComputer->Parameters()->FullName == aMachineParameters.HostName ||
+ aComputer->Parameters()->Alias == aMachineParameters.HostName ) {
+ aListOfComputers->length( 1 ) ;
+ aListOfComputers[ 0 ] = Resources::Computer::_duplicate( aComputer ) ;
+ MESSAGE("Manager_Impl::GetComputers() " << aComputer->FullName() << " selected" ) ;
+ break ;
+ }
+ }
+ }
+ else {
+ for ( i = 0 ; i < _ComputersList->length() ; i++ ) {
+ Resources::Computer_var aComputer = _ComputersList[ i ] ;
+ if ( ( aMachineParameters.Os == Containers::Unknown ||
+ ( aComputer->Parameters()->Os == aMachineParameters.Os ) ) &&
+ aComputer->Parameters()->Memory >= aMachineParameters.Memory &&
+ aComputer->Parameters()->CpuClock >= aMachineParameters.CpuClock &&
+ aComputer->Parameters()->NbProc >= aMachineParameters.NbProc &&
+ aComputer->Parameters()->NbNode >= aMachineParameters.NbNode ) {
+ int size = aListOfComputers->length() ;
+ aListOfComputers->length( size + 1 ) ;
+ aListOfComputers[ size ] = Resources::Computer::_duplicate( aComputer ) ;
+ MESSAGE("Manager_Impl::GetComputers() " << aComputer->FullName() << " selected" ) ;
+ }
+ }
+ }
+ MESSAGE("Manager_Impl::GetComputers() " << aListOfComputers->length() << " found" ) ;
+ return aListOfComputers._retn() ;
+}
+
+Resources::Computer_ptr Manager_Impl::SelectComputer( const Containers::MachineParameters & aMachineParameters ) {
+ MESSAGE("Manager_Impl::SelectComputer()") ;
+ Resources::ListOfComputers_var aListOfComputers = GetComputers( aMachineParameters ) ;
+ MESSAGE("Manager_Impl::SelectComputer()") ;
+ return GetComputer( aListOfComputers ) ;
+}
+
+Resources::Computer_ptr Manager_Impl::GetComputer( const Resources::ListOfComputers & aListOfComputers ) {
+ MESSAGE("Manager_Impl::GetComputer()") ;
+ Resources::Computer_var aComputer = Resources::Computer::_nil() ;
+ if ( aListOfComputers.length() ) {
+ aComputer = aListOfComputers[ 0 ] ;
+ }
+ MESSAGE("Manager_Impl::GetComputer()") ;
+ return Resources::Computer::_duplicate( aComputer ) ;
+}
+
+Resources::Computer_ptr Manager_Impl::SearchComputer( const char * aComputerName ) {
+ MESSAGE("Manager_Impl::SearchComputer()") ;
+ Resources::Computer_var aComputer = Resources::Computer::_nil() ;
+ int i = _MapOfComputers[ aComputerName ] ;
+ if ( i ) {
+ aComputer = _ComputersList[ i - 1 ] ;
+ }
+ MESSAGE("Manager_Impl::SearchComputer()") ;
+ return Resources::Computer::_duplicate( aComputer ) ;
+}
+
+//Resources::ListOfComputers_var Manager_Impl::ParseXmlFile( const char * xmlfile ) {
+void Manager_Impl::ParseXmlFile( const char * xmlfile ) {
+ ResourcesManager_Handler * MyHandler = new ResourcesManager_Handler( _Orb , _Poa );
+ QFile xmlFile( xmlfile ) ;
+ QXmlInputSource source( xmlFile ) ;
+ QXmlSimpleReader reader ;
+ reader.setContentHandler( MyHandler ) ;
+ reader.setErrorHandler( MyHandler ) ;
+ reader.parse( source ) ;
+// Resources::ListOfComputers_var aListOfComputers = MyHandler->ListOfComputers() ;
+ _ComputersVector = MyHandler->ComputersVector() ;
+ xmlFile.close() ;
+ MESSAGE("Manager_Impl::ParseXmlFile()" << _ComputersVector.size() << " computers" ) ;
+// return aListOfComputers ;
+}
+
+bool Manager_Impl::ParseArguments( int argc , char ** argv , char ** path) {
+ bool RetVal = true;
+ *path = NULL;
+ for ( int ind = 0 ; ind < argc ; ind++ ) {
+ if ( strcmp( argv[ind] , "-help" ) == 0 ) {
+ INFOS( "Usage: " << argv[0] << " -common 'path to ressources catalog' -ORBInitRef NameService=corbaname::localhost");
+ RetVal = false ;
+ }
+ if ( strcmp( argv[ind] ,"-common" ) == 0 ) {
+ if ( ind + 1 <= argc ) {
+ *path = argv[ind + 1] ;
+ ifstream path_file(*path);
+ if ( !path_file ) {
+ MESSAGE( "Sorry the file " << *path << " can't be open" )
+ *path = NULL ;
+ RetVal = false;
+ }
+ }
+ }
+ }
+ return RetVal ;
+}
+
--- /dev/null
+// SALOME ResourcesManager_Impl
+//
+// 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 : ResourcesManager_Impl.hxx
+// Author : Jean Rahuel
+// Module : SALOME
+// $Header:
+
+#ifndef RESOURCESMANAGER_IMPL_HXX
+#define RESOURCESMANAGER_IMPL_HXX
+
+#include <vector.h>
+#include <map.h>
+
+#include <ServiceUnreachable.hxx>
+
+#include "SALOME_NamingService.hxx"
+
+#include "utilities.h"
+#include "ResourcesManager_Handler.hxx"
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER( ResourcesManager )
+#include CORBA_SERVER_HEADER( ContainersManager )
+
+class Manager_Impl : public POA_Resources::Manager ,
+ public PortableServer::RefCountServantBase {
+
+ private:
+
+ CORBA::ORB_ptr _Orb ;
+ PortableServer::POA_ptr _Poa ;
+ SALOME_NamingService * _NamingService ;
+ PortableServer::ObjectId * _Id ;
+
+ char * _CatalogPath ;
+
+ vector< Computer_Impl * > _ComputersVector ;
+ Resources::ListOfComputers_var _ComputersList ;
+ map< string , int > _MapOfComputers ;
+
+// virtual Resources::ListOfComputers_var ParseXmlFile( const char * xmlfile ) ;
+ virtual void ParseXmlFile( const char * xmlfile ) ;
+
+ virtual bool ParseArguments( int argc , char ** argv , char ** path ) ;
+
+ public:
+
+ Manager_Impl( CORBA::ORB_ptr orb ,
+ PortableServer::POA_ptr poa ,
+ SALOME_NamingService * NamingService ,
+ int argc ,
+ char** argv ) ;
+
+ virtual ~Manager_Impl();
+
+ virtual long ping() ;
+
+ virtual Resources::Computer_ptr TestComputer() ;
+
+ virtual long SshAccess( const char * aComputerName ) ;
+
+ virtual Resources::ListOfComputers * AllComputers() ;
+
+ virtual Resources::ListOfComputers * GetComputers( const Containers::MachineParameters & aMachineParameters ) ;
+
+ virtual Resources::Computer_ptr SelectComputer( const Containers::MachineParameters & aMachineParameters ) ;
+
+ virtual Resources::Computer_ptr GetComputer( const Resources::ListOfComputers & aListOfComputers ) ;
+
+ virtual Resources::Computer_ptr SearchComputer( const char * aComputerName ) ;
+
+} ;
+
+#endif
--- /dev/null
+// SALOME ResourcesManager_Parser
+//
+// 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 : ResourcesManager_Parser.hxx
+// Author : Jean Rahuel
+// Module : SALOME
+//$Header:
+
+#ifndef RESOURCESMANAGER_PARSER
+#define RESOURCESMANAGER_PARSER
+
+#include <string>
+#include <vector>
+
+struct ParserProc{
+ long Parsernumber;
+ string Parsermodel_name;
+ float Parsercpu_mhz;
+ float Parsercache_size;
+};
+
+typedef vector<ParserProc> ListOfParserProc;
+
+enum Parsercontainertype {Cpp, python, NP};
+typedef vector<Parsercontainertype> ListOfParserContainerType;
+
+struct Parserressources{
+ string Parsername;
+ string ParserOS;
+ string ParserOS_version;
+ ListOfParserProc Parserprocs;
+ ListOfParserContainerType Parsercontainertype;
+};
+
+typedef vector<Parserressources> ListOfParserressources;
+
+#ifdef WRITE_RESSOURCES_TYPE
+ListOfParserressources _ressources_list;
+#else
+extern ListOfParserressources _ressources_list;
+#endif
+
+#endif
--- /dev/null
+// SALOME ResourcesManager_Server
+//
+// 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 : ResourcesManager_Server.cxx
+// Author : Jean Rahuel
+// Module : SALOME
+// $Header:
+
+#include <iostream.h>
+#include "SALOME_NamingService.hxx"
+#include "Utils_SINGLETON.hxx"
+
+#include "ResourcesManager_Impl.hxx"
+
+using namespace std;
+
+int main(int argc,char **argv) {
+ try {
+
+// initialize the ORB
+ CORBA::ORB_ptr orb = CORBA::ORB_init ( argc , argv ) ;
+
+ long TIMESleep = 250000000 ;
+ int NumberOfTries = 40 ;
+ int a ;
+ int i ;
+ int j ;
+ 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 ;
+
+// initialize POA
+ CosNaming::NamingContext_var inc ;
+ PortableServer::POA_var poa ;
+ CORBA::Object_var theObj = CORBA::Object::_nil() ;
+ CORBA::Object_var obj = CORBA::Object::_nil() ;
+ CORBA::Object_var object = CORBA::Object::_nil() ;
+ SALOME_NamingService &naming = *SINGLETON_<SALOME_NamingService>::Instance() ;
+ int CONTAINERS_MANAGER = 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 mgr ;
+ for ( 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 ) ) {
+ poa = PortableServer::POA::_narrow( obj ) ;
+ }
+ if ( !CORBA::is_nil( poa ) ) {
+ mgr = 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::COMM_FAILURE& ) {
+ MESSAGE( "ContainersManager : CORBA::COMM_FAILURE: Unable to contact the Naming Service" ) ;
+ }
+ if ( !CORBA::is_nil( inc ) ) {
+ MESSAGE( "ContainersManager : Naming Service was found" ) ;
+ if ( EnvL == 1 ) {
+ for ( j = 1 ; j <= NumberOfTries ; j++ ) {
+ if ( j !=1 ) {
+ a=nanosleep( &ts_req , &ts_rem ) ;
+ }
+ try {
+ object = inc->resolve( name ) ;
+ }
+ catch ( CosNaming::NamingContext::NotFound ) {
+ MESSAGE( "ContainersManager : Logger Server wasn't found" ) ;
+ }
+ catch (...) {
+ MESSAGE( "ContainersManager : Unknown exception" ) ;
+ }
+ if ( !CORBA::is_nil( object ) ) {
+ MESSAGE( "ContainersManager : Loger Server was found" ) ;
+ CONTAINERS_MANAGER = 1 ;
+ break;
+ }
+ }
+ }
+ }
+ if ( ( CONTAINERS_MANAGER == 1 ) || ( (EnvL ==0 ) && ( !CORBA::is_nil( inc ) ) ) ) {
+ break;
+ }
+ }
+
+#if 0
+ // define policy objects
+ PortableServer::ImplicitActivationPolicy_var implicitActivation =
+ poa->create_implicit_activation_policy(PortableServer::NO_IMPLICIT_ACTIVATION) ;
+
+ // default = NO_IMPLICIT_ACTIVATION
+ PortableServer::ThreadPolicy_var threadPolicy =
+ poa->create_thread_policy(PortableServer::ORB_CTRL_MODEL) ;
+ // default = ORB_CTRL_MODEL, other choice SINGLE_THREAD_MODEL
+
+ // create policy list
+ CORBA::PolicyList policyList;
+ policyList.length(2);
+ policyList[0] = PortableServer::ImplicitActivationPolicy::_duplicate(implicitActivation) ;
+ policyList[1] = PortableServer::ThreadPolicy::_duplicate(threadPolicy) ;
+
+ // create the child POA
+ PortableServer::POAManager_var nil_mgr = PortableServer::POAManager::_nil() ;
+ PortableServer::POA_var factory_poa =
+ poa->create_POA("factory_poa", mgr, policyList) ;
+ //with nil_mgr instead of mgr, a new POA manager is created with the new POA
+
+ // destroy policy objects
+ implicitActivation->destroy() ;
+ threadPolicy->destroy() ;
+
+#endif
+
+// initialise Naming Service
+ SALOME_NamingService *_NS ;
+ _NS = new SALOME_NamingService( orb ) ;
+
+// Active ResourcesManager
+ Manager_Impl * MyResourcesManager = new Manager_Impl( orb , poa , _NS , argc , argv ) ;
+// Manager_Impl * MyResourcesManager = new Manager_Impl( orb , factory_poa , _NS , argc , argv ) ;
+// poa->activate_object ( MyResourcesManager ) ;
+ mgr->activate() ;
+ CORBA::Object_ptr TheResourcesManager = MyResourcesManager->_this() ;
+
+
+// register ResourcesManager in Naming Service
+ _NS->Register( TheResourcesManager , "/Kernel/ResourcesManager" ) ;
+
+ MESSAGE("Running ResourcesManager Server.") ;
+
+ orb->run();
+
+ poa->destroy( 1 , 1 ) ;
+
+ }
+ catch ( CORBA::SystemException& ) {
+ INFOS("Caught CORBA::SystemException.") ;
+ }
+ catch ( CORBA::Exception& ) {
+ INFOS("Caught CORBA::Exception.") ;
+ }
+
+ return 0 ;
+}