1 // Copyright (C) 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // SALOME LifeCycleCORBA : implementation of containers and engines life cycle both in Python and C++
24 // File : SALOME_LifeCycleCORBA.cxx
25 // Author : Paul RASCLE, EDF
39 #include "Basics_Utils.hxx"
40 #include "utilities.h"
42 #include <ServiceUnreachable.hxx>
44 #include "SALOME_LifeCycleCORBA.hxx"
45 #include CORBA_CLIENT_HEADER(SALOME_ModuleCatalog)
46 #include CORBA_CLIENT_HEADER(SALOME_Session)
47 #include CORBA_CLIENT_HEADER(DSC_Engines)
48 #include CORBA_CLIENT_HEADER(SALOME_Registry)
49 #include CORBA_CLIENT_HEADER(SALOMEDS)
50 #include CORBA_CLIENT_HEADER(Logger)
52 #include "SALOME_ContainerManager.hxx"
53 #include "SALOME_Component_i.hxx"
54 #include "SALOME_NamingService.hxx"
55 #include "SALOME_FileTransferCORBA.hxx"
57 IncompatibleComponent::IncompatibleComponent( void ):
58 SALOME_Exception( "IncompatibleComponent" )
62 IncompatibleComponent::IncompatibleComponent(const IncompatibleComponent &ex):
63 SALOME_Exception( ex )
67 /*! \class SALOME_LifeCycleCORBA
68 \brief A class to manage life cycle of SALOME components.
72 //=============================================================================
76 //=============================================================================
78 SALOME_LifeCycleCORBA::SALOME_LifeCycleCORBA(SALOME_NamingService *ns)
80 // be sure to have an instance of traceCollector, when used via SWIG
83 char *xargv = (char*)"";
85 CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
86 // LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
90 _NS = new SALOME_NamingService(orb);
95 _NS->Change_Directory("/"); // mpv 250105: current directory may be not root
96 // (in SALOMEDS for an example)
97 // not enough: set a current directory in naming service is not thread safe
98 // if naming service instance is shared among several threads...
99 // ==> allways use absolute path and dot rely on current directory!
101 CORBA::Object_var obj =
102 _NS->Resolve(SALOME_ContainerManager::_ContainerManagerNameInNS);
103 ASSERT( !CORBA::is_nil(obj));
104 _ContManager=Engines::ContainerManager::_narrow(obj);
106 obj = _NS->Resolve(SALOME_ResourcesManager::_ResourcesManagerNameInNS);
107 ASSERT( !CORBA::is_nil(obj));
108 _ResManager=Engines::ResourcesManager::_narrow(obj);
111 //=============================================================================
115 //=============================================================================
117 SALOME_LifeCycleCORBA::~SALOME_LifeCycleCORBA()
119 if(_NSnew)delete _NSnew;
122 //=============================================================================
123 /*! \brief Find an already existing and registered component instance.
125 * \param params machine parameters like type or name...
126 * \param componentName the name of component class
127 * \param studyId default = 0 : multistudy instance
128 * \return a CORBA reference of the component instance, or _nil if not found
130 //=============================================================================
131 Engines::EngineComponent_ptr
132 SALOME_LifeCycleCORBA::FindComponent(const Engines::MachineParameters& params,
133 const char *componentName,
136 if (! isKnownComponentClass(componentName))
137 return Engines::EngineComponent::_nil();
139 Engines::ContainerParameters new_params;
140 convert(params, new_params);
141 new_params.resource_params.componentList.length(1);
142 new_params.resource_params.componentList[0] = componentName;
143 Engines::ResourceList_var listOfResources;
146 listOfResources = _ResManager->GetFittingResources(new_params.resource_params);
148 catch( const SALOME::SALOME_Exception& ex )
150 return Engines::EngineComponent::_nil();
153 Engines::EngineComponent_var compo = _FindComponent(new_params,
158 return compo._retn();
161 //=============================================================================
162 /*! \brief Load a component instance on a container defined by machine parameters
164 * \param params machine parameters like type or name...
165 * \param componentName the name of component class
166 * \param studyId default = 0 : multistudy instance
167 * \return a CORBA reference of the component instance, or _nil if problem
169 //=============================================================================
171 Engines::EngineComponent_ptr
172 SALOME_LifeCycleCORBA::LoadComponent(const Engines::MachineParameters& params,
173 const char *componentName,
176 // --- Check if Component Name is known in ModuleCatalog
178 if (! isKnownComponentClass(componentName))
179 return Engines::EngineComponent::_nil();
181 Engines::ContainerParameters new_params;
182 convert(params, new_params);
183 new_params.resource_params.componentList.length(1);
184 new_params.resource_params.componentList[0] = componentName;
186 Engines::ResourceList_var listOfResources;
189 listOfResources = _ResManager->GetFittingResources(new_params.resource_params);
191 catch( const SALOME::SALOME_Exception& ex )
193 return Engines::EngineComponent::_nil();
195 new_params.resource_params.resList = listOfResources;
197 Engines::EngineComponent_var compo = _LoadComponent(new_params,
201 return compo._retn();
204 //=============================================================================
205 /*! \brief Find an already existing and registered component instance or load a new
206 * component instance on a container defined by machine parameters.
208 * \param params machine parameters like type or name...
209 * \param componentName the name of component class
210 * \param studyId default = 0 : multistudy instance
211 * \return a CORBA reference of the component instance, or _nil if problem
213 //=============================================================================
215 Engines::EngineComponent_ptr
216 SALOME_LifeCycleCORBA::
217 FindOrLoad_Component(const Engines::MachineParameters& params,
218 const char *componentName,
221 // --- Check if Component Name is known in ModuleCatalog
223 if (! isKnownComponentClass(componentName))
224 return Engines::EngineComponent::_nil();
226 Engines::ContainerParameters new_params;
227 convert(params, new_params);
228 new_params.resource_params.componentList.length(1);
229 new_params.resource_params.componentList[0] = componentName;
231 // For Compatibility -> if hostname == localhost put name == hostname
232 if (std::string(new_params.resource_params.hostname.in()) == "localhost")
234 new_params.resource_params.hostname = CORBA::string_dup(Kernel_Utils::GetHostname().c_str());
235 new_params.resource_params.name = CORBA::string_dup(Kernel_Utils::GetHostname().c_str());
238 Engines::ResourceList_var listOfResources;
241 listOfResources = _ResManager->GetFittingResources(new_params.resource_params);
243 catch( const SALOME::SALOME_Exception& ex )
245 return Engines::EngineComponent::_nil();
248 Engines::EngineComponent_var compo = _FindComponent(new_params,
253 if(CORBA::is_nil(compo))
255 new_params.resource_params.resList = listOfResources;
256 compo = _LoadComponent(new_params,
261 return compo._retn();
264 Engines::EngineComponent_ptr
265 SALOME_LifeCycleCORBA::
266 FindOrLoad_Component(const Engines::ContainerParameters& params,
267 const char *componentName,
270 // --- Check if Component Name is known in ModuleCatalog
272 if (! isKnownComponentClass(componentName))
273 return Engines::EngineComponent::_nil();
275 Engines::ContainerParameters new_params(params);
276 new_params.resource_params.componentList.length(1);
277 new_params.resource_params.componentList[0] = componentName;
279 Engines::ResourceList_var listOfResources;
282 listOfResources = _ResManager->GetFittingResources(new_params.resource_params);
284 catch( const SALOME::SALOME_Exception& ex )
286 return Engines::EngineComponent::_nil();
289 Engines::EngineComponent_var compo = _FindComponent(new_params,
294 if(CORBA::is_nil(compo))
296 new_params.resource_params.resList = listOfResources;
297 compo = _LoadComponent(new_params,
302 return compo._retn();
305 //=============================================================================
306 /*! \brief Find an already existing and registered component instance or load a new
307 * component instance on a container defined by name
309 * \param containerName the name of container, under one of the forms
310 * - 1 aContainer (local container)
311 * - 2 machine/aContainer (container on hostname = machine)
312 * \param componentName the name of component class
313 * \return a CORBA reference of the component instance, or _nil if problem
315 //=============================================================================
317 Engines::EngineComponent_ptr
318 SALOME_LifeCycleCORBA::FindOrLoad_Component(const char *containerName,
319 const char *componentName)
321 MESSAGE("SALOME_LifeCycleCORBA::FindOrLoad_Component INTERACTIF " << containerName << " " << componentName ) ;
323 // --- Check if Component Name is known in ModuleCatalog
324 if (! isKnownComponentClass(componentName))
325 return Engines::EngineComponent::_nil();
327 // --- Check if containerName contains machine name (if yes: rg>0)
328 char *stContainer=strdup(containerName);
329 std::string st2Container(stContainer);
330 int rg=st2Container.find("/");
332 Engines::MachineParameters_var params=new Engines::MachineParameters;
336 // containerName doesn't contain "/" => Local container
337 params->container_name=CORBA::string_dup(stContainer);
342 stContainer[rg]='\0';
343 params->container_name=CORBA::string_dup(stContainer+rg+1);
344 params->hostname=CORBA::string_dup(stContainer);
346 params->isMPI = false;
347 SCRUTE(params->container_name);
349 return FindOrLoad_Component(params, componentName);
352 //=============================================================================
353 /*! \brief Check if the component class is known in module catalog
355 * \param componentName the name of component class
356 * \return true if found, false otherwise
358 //=============================================================================
360 bool SALOME_LifeCycleCORBA::isKnownComponentClass(const char *componentName)
364 CORBA::Object_var obj = _NS->Resolve("/Kernel/ModulCatalog");
365 SALOME_ModuleCatalog::ModuleCatalog_var Catalog =
366 SALOME_ModuleCatalog::ModuleCatalog::_narrow(obj) ;
367 ASSERT(! CORBA::is_nil(Catalog));
368 SALOME_ModuleCatalog::Acomponent_var compoInfo =
369 Catalog->GetComponent(componentName);
370 if (CORBA::is_nil (compoInfo))
372 MESSAGE("Catalog Error: Component not found in the catalog " << componentName);
377 catch (ServiceUnreachable&)
379 INFOS("Caught exception: Naming Service Unreachable");
383 INFOS("Caught unknown exception.");
388 //=============================================================================
390 * Not so complex... useful ?
392 //=============================================================================
395 SALOME_LifeCycleCORBA::isMpiContainer(const Engines::ContainerParameters& params)
396 throw(IncompatibleComponent)
405 //=============================================================================
406 /*! \brief Initialisation of a given Engines::MachineParameters with default values.
408 * - container_name = "" : not relevant
409 * - hostname = "" : not relevant
410 * - OS = "" : not relevant
411 * - nb_proc = 0 : not relevant
412 * - mem_mb = 0 : not relevant
413 * - cpu_clock = 0 : not relevant
414 * - nb_proc_per_node = 0 : not relevant
415 * - nb_node = 0 : not relevant
416 * - isMPI = false : standard components
418 //=============================================================================
420 void SALOME_LifeCycleCORBA::preSet(Engines::MachineParameters& params)
422 params.container_name = "";
423 params.hostname = "";
426 params.cpu_clock = 0;
427 params.nb_proc_per_node = 0;
429 params.isMPI = false;
430 params.workingdir = "";
433 params.parallelLib = "";
434 params.nb_component_nodes = 0;
438 SALOME_LifeCycleCORBA::preSet(Engines::ResourceParameters& params)
441 params.hostname = "";
445 params.cpu_clock = 0;
447 params.nb_proc_per_node = 0;
451 void SALOME_LifeCycleCORBA::preSet( Engines::ContainerParameters& params)
453 params.container_name = "";
455 params.workingdir = "";
457 params.isMPI = false;
458 params.parallelLib = "";
459 SALOME_LifeCycleCORBA::preSet(params.resource_params);
463 SALOME_LifeCycleCORBA::convert(const Engines::MachineParameters& params_in,
464 Engines::ContainerParameters& params_out)
466 SALOME_LifeCycleCORBA::preSet(params_out);
469 params_out.container_name = params_in.container_name;
470 params_out.mode = params_in.mode;
471 params_out.workingdir = params_in.workingdir;
472 params_out.isMPI = params_in.isMPI;
473 params_out.parallelLib = params_in.parallelLib;
476 params_out.resource_params.hostname = params_in.hostname;
477 params_out.resource_params.OS = params_in.OS;
478 params_out.resource_params.mem_mb = params_in.mem_mb;
479 params_out.resource_params.cpu_clock = params_in.cpu_clock;
480 params_out.resource_params.nb_node = params_in.nb_node;
481 params_out.resource_params.nb_proc_per_node = params_in.nb_proc_per_node;
482 params_out.resource_params.policy = params_in.policy;
483 params_out.resource_params.componentList = params_in.componentList;
485 params_out.resource_params.resList.length(params_in.computerList.length());
486 for (CORBA::ULong i = 0; i < params_in.computerList.length(); i++)
487 params_out.resource_params.resList[i] = params_in.computerList[i];
490 //=============================================================================
492 * \return a number of processors not 0, only for MPI containers
494 //=============================================================================
496 int SALOME_LifeCycleCORBA::NbProc(const Engines::ContainerParameters& params)
498 if( !isMpiContainer(params) )
500 else if( params.nb_proc <= 0 )
503 return params.nb_proc;
506 //=============================================================================
507 /*! \brief Get the container manager
509 * \return the container Manager
511 //=============================================================================
513 Engines::ContainerManager_ptr SALOME_LifeCycleCORBA::getContainerManager()
515 Engines::ContainerManager_var contManager =
516 Engines::ContainerManager::_duplicate(_ContManager);
517 return contManager._retn();
520 //=============================================================================
521 /*! \brief Get the resources manager
523 * \return the container Manager
525 //=============================================================================
527 Engines::ResourcesManager_ptr SALOME_LifeCycleCORBA::getResourcesManager()
529 Engines::ResourcesManager_var resManager =
530 Engines::ResourcesManager::_duplicate(_ResManager);
531 return resManager._retn();
534 //=============================================================================
535 /*! \brief shutdown all the SALOME servers except SALOME_Session_Server, omniNames and notifd
537 //=============================================================================
539 void SALOME_LifeCycleCORBA::shutdownServers()
541 // get each Container from NamingService => shutdown it
542 // (the order is inverse to the order of servers initialization)
544 SALOME::Session_var session = SALOME::Session::_nil();
546 CORBA::Object_var objS = _NS->Resolve("/Kernel/Session");
547 if (!CORBA::is_nil(objS))
549 session = SALOME::Session::_narrow(objS);
550 if (!CORBA::is_nil(session))
552 pid = session->getPID();
556 std::string hostname = Kernel_Utils::GetHostname();
558 // 1) ConnectionManager
561 CORBA::Object_var objCnM=_NS->Resolve("/ConnectionManager");
562 Engines::ConnectionManager_var connMan=Engines::ConnectionManager::_narrow(objCnM);
563 if ( !CORBA::is_nil(connMan) && ( pid != connMan->getPID() ) )
564 connMan->ShutdownWithExit();
566 catch(const CORBA::Exception& e)
568 // ignore and continue
572 ts_req.tv_nsec=100000000;
575 //Wait some time so that ConnectionManager be completely shutdown
577 nanosleep(&ts_req,0);
583 CORBA::Object_var objSDS = _NS->Resolve("/myStudyManager");
584 SALOMEDS::StudyManager_var studyManager = SALOMEDS::StudyManager::_narrow(objSDS) ;
585 if ( !CORBA::is_nil(studyManager) && ( pid != studyManager->getPID() ) )
586 studyManager->Shutdown();
588 catch(const CORBA::Exception& e)
590 // ignore and continue
593 //Wait some time so that study be completely shutdown
595 nanosleep(&ts_req,0);
601 CORBA::Object_var objMC=_NS->Resolve("/Kernel/ModulCatalog");
602 SALOME_ModuleCatalog::ModuleCatalog_var catalog = SALOME_ModuleCatalog::ModuleCatalog::_narrow(objMC);
603 if ( !CORBA::is_nil(catalog) && ( pid != catalog->getPID() ) )
606 catch(const CORBA::Exception& e)
608 // ignore and continue
611 //Wait some time so that ModulCatalog be completely shutdown
613 nanosleep(&ts_req,0);
619 CORBA::Object_var objSL = _NS->Resolve("/SalomeLauncher");
620 Engines::SalomeLauncher_var launcher = Engines::SalomeLauncher::_narrow(objSL);
621 if (!CORBA::is_nil(launcher) && (pid != launcher->getPID()))
622 launcher->Shutdown();
624 catch(const CORBA::Exception& e)
626 // ignore and continue
629 //Wait some time so that launcher be completely shutdown
631 nanosleep(&ts_req,0);
637 CORBA::Object_var objR = _NS->Resolve("/Registry");
638 Registry::Components_var registry = Registry::Components::_narrow(objR);
639 if ( !CORBA::is_nil(registry) && ( pid != registry->getPID() ) )
640 registry->Shutdown();
642 catch(const CORBA::Exception& e)
644 // ignore and continue
648 if ( !CORBA::is_nil( session ) ) {
653 catch(const CORBA::Exception& e)
655 // ignore and continue
661 char *xargv = (char*)"";
662 char **argv = &xargv;
663 CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
665 CORBA::Object_var objLog = CORBA::Object::_nil();
666 CosNaming::NamingContext_var inc;
667 CORBA::Object_var theObj = CORBA::Object::_nil();
668 std::string stdname = "Logger";
669 CosNaming::Name name;
671 name[0].id = CORBA::string_dup(stdname.c_str());
674 if(!CORBA::is_nil(orb))
675 theObj = orb->resolve_initial_references("NameService");
676 if (!CORBA::is_nil(theObj))
677 inc = CosNaming::NamingContext::_narrow(theObj);
682 if(!CORBA::is_nil(inc))
686 objLog = inc->resolve(name);
687 SALOME_Logger::Logger_var logger = SALOME_Logger::Logger::_narrow(objLog);
688 if ( !CORBA::is_nil(logger) )
697 //=============================================================================
698 /*! \brief shutdown omniNames and notifd
700 //=============================================================================
702 void SALOME_LifeCycleCORBA::killOmniNames()
704 std::string portNumber (::getenv ("NSPORT") );
705 if ( !portNumber.empty() )
710 cmd = std::string( "ps -eo pid,command | grep -v grep | grep -E \"omniNames.*")
712 + std::string("\" | awk '{cmd=sprintf(\"kill -9 %s\",$1); system(cmd)}'" );
715 system ( cmd.c_str() );
722 // NPAL 18309 (Kill Notifd)
723 if ( !portNumber.empty() )
725 std::string cmd = ("from killSalomeWithPort import killNotifdAndClean; ");
726 cmd += std::string("killNotifdAndClean(") + portNumber + "); ";
727 cmd = std::string("python -c \"") + cmd +"\" > /dev/null 2> /dev/null";
729 system( cmd.c_str() );
733 //=============================================================================
734 /*! \brief Find an already existing and registered component instance.
736 * - build a list of machines on which an instance of the component is running,
737 * - find the best machine among the list
739 * \param params machine parameters like type or name...
740 * \param componentName the name of component class
741 * \param studyId default = 0 : multistudy instance
742 * \param listOfMachines list of machine address
743 * \return a CORBA reference of the component instance, or _nil if not found
745 //=============================================================================
747 Engines::EngineComponent_ptr
748 SALOME_LifeCycleCORBA::
749 _FindComponent(const Engines::ContainerParameters& params,
750 const char *componentName,
752 const Engines::ResourceList& listOfResources)
754 // --- build the list of machines on which the component is already running
755 const char *containerName = params.container_name;
756 int nbproc = NbProc(params);
758 Engines::ResourceList_var resourcesOK = new Engines::ResourceList;
760 unsigned int lghtOfresourcesOK = 0;
761 resourcesOK->length(listOfResources.length());
763 for(unsigned int i=0; i < listOfResources.length(); i++)
765 const char * currentResource = listOfResources[i];
766 CORBA::Object_var obj = _NS->ResolveComponent(currentResource,
770 if (!CORBA::is_nil(obj))
771 resourcesOK[lghtOfresourcesOK++] = CORBA::string_dup(currentResource);
774 // --- find the best machine among the list
775 if(lghtOfresourcesOK != 0)
777 resourcesOK->length(lghtOfresourcesOK);
778 CORBA::String_var bestResource = _ResManager->FindFirst(resourcesOK);
779 CORBA::Object_var obj = _NS->ResolveComponent(bestResource,
783 return Engines::EngineComponent::_narrow(obj);
786 return Engines::EngineComponent::_nil();
789 //=============================================================================
790 /*! \brief Load a component instance.
792 * - Finds a container in the list of machine or start one.
793 * - Try to load the component library in the container,
794 * - then create an instance of the component.
796 * \param params machine parameters like type or name...
797 * \param componentName the name of component class
798 * \param studyId default = 0 : multistudy instance
799 * \return a CORBA reference of the component instance, or _nil if problem
801 //=============================================================================
803 Engines::EngineComponent_ptr
804 SALOME_LifeCycleCORBA::
805 _LoadComponent(const Engines::ContainerParameters& params,
806 const char *componentName,
809 MESSAGE("_LoadComponent, required " << params.container_name <<
810 " " << componentName << " " << NbProc(params));
812 Engines::ContainerParameters local_params(params);
813 local_params.mode = CORBA::string_dup("findorstart");
814 Engines::Container_var cont = _ContManager->GiveContainer(local_params);
815 if (CORBA::is_nil(cont)) return Engines::EngineComponent::_nil();
818 bool isLoadable = cont->load_component_Library(componentName,reason);
821 //std::cerr << reason << std::endl;
822 CORBA::string_free(reason);
823 return Engines::EngineComponent::_nil();
825 CORBA::string_free(reason);
827 Engines::EngineComponent_var myInstance =
828 cont->create_component_instance(componentName, studyId);
829 return myInstance._retn();
832 //=============================================================================
833 /*! \brief Load a parallel component instance.
835 * \param params machine parameters like type or name...
836 * \param componentName the name of component class
837 * \param studyId default = 0 : multistudy instance
838 * \return a CORBA reference of the parallel component instance, or _nil if problem
840 //=============================================================================
841 Engines::EngineComponent_ptr
842 SALOME_LifeCycleCORBA::Load_ParallelComponent(const Engines::ContainerParameters& params,
843 const char *componentName,
846 MESSAGE("Entering LoadParallelComponent");
848 /*MESSAGE("Parameters : ");
849 MESSAGE("Container name : " << params.container_name);
850 MESSAGE("Number of component nodes : " << params.nb_component_nodes);
851 MESSAGE("Component Name : " << componentName);*/
853 Engines::ContainerParameters parms(params);
854 parms.resource_params.componentList.length(1);
855 parms.resource_params.componentList[0] = componentName;
856 parms.mode = CORBA::string_dup("findorstart");
858 MESSAGE("Starting Parallel Container");
859 Engines::Container_var cont = _ContManager->GiveContainer(parms);
860 if (CORBA::is_nil(cont)) {
861 INFOS("FindOrStartParallelContainer() returns a NULL container !");
862 return Engines::EngineComponent::_nil();
865 MESSAGE("Loading component library");
867 bool isLoadable = cont->load_component_Library(componentName,reason);
869 INFOS(componentName <<" library is not loadable !");
870 //std::cerr << reason << std::endl;
871 CORBA::string_free(reason);
872 return Engines::EngineComponent::_nil();
874 CORBA::string_free(reason);
876 MESSAGE("Creating component instance");
877 // @PARALLEL@ permits to identify that the component requested
878 // is a parallel component.
879 std::string name = std::string(componentName);
880 Engines::EngineComponent_var myInstance = cont->create_component_instance(name.c_str(), studyId);
881 if (CORBA::is_nil(myInstance))
882 INFOS("create_component_instance returns a NULL component !");
883 return myInstance._retn();
886 /*! \brief copy a file from a source host to a destination host
887 * \param hostSrc the source host
888 * \param fileSrc the file to copy from the source host to the destination host
889 * \param hostDest the destination host
890 * \param fileDest the destination file
892 void SALOME_LifeCycleCORBA::copyFile(const char* hostSrc, const char* fileSrc, const char* hostDest, const char* fileDest)
894 if(strcmp(hostDest,"localhost") == 0)
896 //if localhost use a shortcut
897 SALOME_FileTransferCORBA transfer(hostSrc,fileSrc);
898 transfer.getLocalFile(fileDest);
902 Engines::ContainerManager_var contManager = getContainerManager();
904 Engines::ContainerParameters params;
907 params.resource_params.hostname = hostDest;
908 params.mode = CORBA::string_dup("findorstart");
909 Engines::Container_var containerDest = contManager->GiveContainer(params);
911 params.resource_params.hostname = hostSrc;
912 Engines::Container_var containerSrc = contManager->GiveContainer(params);
914 containerDest->copyFile(containerSrc,fileSrc,fileDest);
917 /*! \brief get the naming service used by the life cycle
919 * \return the naming service
921 SALOME_NamingService * SALOME_LifeCycleCORBA::namingService()
926 /*! \brief get the orb used by the life cycle
930 CORBA::ORB_ptr SALOME_LifeCycleCORBA::orb()