1 // Copyright (C) 2007-2012 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 if (CORBA::is_nil(obj))
104 throw SALOME_Exception("Error: Cannot resolve ContainerManager in Naming Service");
105 _ContManager=Engines::ContainerManager::_narrow(obj);
107 obj = _NS->Resolve(SALOME_ResourcesManager::_ResourcesManagerNameInNS);
108 if (CORBA::is_nil(obj))
109 throw SALOME_Exception("Error: Cannot resolve ResourceManager in Naming Service");
110 _ResManager=Engines::ResourcesManager::_narrow(obj);
113 //=============================================================================
117 //=============================================================================
119 SALOME_LifeCycleCORBA::~SALOME_LifeCycleCORBA()
121 if(_NSnew)delete _NSnew;
124 //=============================================================================
125 /*! \brief Find an already existing and registered component instance.
127 * \param params machine parameters like type or name...
128 * \param componentName the name of component class
129 * \param studyId default = 0 : multistudy instance
130 * \return a CORBA reference of the component instance, or _nil if not found
132 //=============================================================================
133 Engines::EngineComponent_ptr
134 SALOME_LifeCycleCORBA::FindComponent(const Engines::MachineParameters& params,
135 const char *componentName,
138 if (! isKnownComponentClass(componentName))
139 return Engines::EngineComponent::_nil();
141 Engines::ContainerParameters new_params;
142 convert(params, new_params);
143 new_params.resource_params.componentList.length(1);
144 new_params.resource_params.componentList[0] = componentName;
145 Engines::ResourceList_var listOfResources;
148 listOfResources = _ResManager->GetFittingResources(new_params.resource_params);
150 catch( const SALOME::SALOME_Exception& ex )
152 return Engines::EngineComponent::_nil();
155 Engines::EngineComponent_var compo = _FindComponent(new_params,
160 return compo._retn();
163 //=============================================================================
164 /*! \brief Load a component instance on a container defined by machine parameters
166 * \param params machine parameters like type or name...
167 * \param componentName the name of component class
168 * \param studyId default = 0 : multistudy instance
169 * \return a CORBA reference of the component instance, or _nil if problem
171 //=============================================================================
173 Engines::EngineComponent_ptr
174 SALOME_LifeCycleCORBA::LoadComponent(const Engines::MachineParameters& params,
175 const char *componentName,
178 // --- Check if Component Name is known in ModuleCatalog
180 if (! isKnownComponentClass(componentName))
181 return Engines::EngineComponent::_nil();
183 Engines::ContainerParameters new_params;
184 convert(params, new_params);
185 new_params.resource_params.componentList.length(1);
186 new_params.resource_params.componentList[0] = componentName;
188 Engines::ResourceList_var listOfResources;
191 listOfResources = _ResManager->GetFittingResources(new_params.resource_params);
193 catch( const SALOME::SALOME_Exception& ex )
195 return Engines::EngineComponent::_nil();
197 new_params.resource_params.resList = listOfResources;
199 Engines::EngineComponent_var compo = _LoadComponent(new_params,
203 return compo._retn();
206 //=============================================================================
207 /*! \brief Find an already existing and registered component instance or load a new
208 * component instance on a container defined by machine parameters.
210 * \param params machine parameters like type or name...
211 * \param componentName the name of component class
212 * \param studyId default = 0 : multistudy instance
213 * \return a CORBA reference of the component instance, or _nil if problem
215 //=============================================================================
217 Engines::EngineComponent_ptr
218 SALOME_LifeCycleCORBA::
219 FindOrLoad_Component(const Engines::MachineParameters& params,
220 const char *componentName,
223 // --- Check if Component Name is known in ModuleCatalog
225 if (! isKnownComponentClass(componentName))
226 return Engines::EngineComponent::_nil();
228 Engines::ContainerParameters new_params;
229 convert(params, new_params);
230 new_params.resource_params.componentList.length(1);
231 new_params.resource_params.componentList[0] = componentName;
233 // For Compatibility -> if hostname == localhost put name == hostname
234 if (std::string(new_params.resource_params.hostname.in()) == "localhost")
236 new_params.resource_params.hostname = CORBA::string_dup(Kernel_Utils::GetHostname().c_str());
237 new_params.resource_params.name = CORBA::string_dup(Kernel_Utils::GetHostname().c_str());
240 Engines::ResourceList_var listOfResources;
243 listOfResources = _ResManager->GetFittingResources(new_params.resource_params);
245 catch( const SALOME::SALOME_Exception& ex )
247 return Engines::EngineComponent::_nil();
250 Engines::EngineComponent_var compo = _FindComponent(new_params,
255 if(CORBA::is_nil(compo))
257 new_params.resource_params.resList = listOfResources;
258 compo = _LoadComponent(new_params,
263 return compo._retn();
266 Engines::EngineComponent_ptr
267 SALOME_LifeCycleCORBA::
268 FindOrLoad_Component(const Engines::ContainerParameters& params,
269 const char *componentName,
272 // --- Check if Component Name is known in ModuleCatalog
274 if (! isKnownComponentClass(componentName))
275 return Engines::EngineComponent::_nil();
277 Engines::ContainerParameters new_params(params);
278 new_params.resource_params.componentList.length(1);
279 new_params.resource_params.componentList[0] = componentName;
281 Engines::ResourceList_var listOfResources;
284 listOfResources = _ResManager->GetFittingResources(new_params.resource_params);
286 catch( const SALOME::SALOME_Exception& ex )
288 return Engines::EngineComponent::_nil();
291 Engines::EngineComponent_var compo = _FindComponent(new_params,
296 if(CORBA::is_nil(compo))
298 new_params.resource_params.resList = listOfResources;
299 compo = _LoadComponent(new_params,
304 return compo._retn();
307 //=============================================================================
308 /*! \brief Find an already existing and registered component instance or load a new
309 * component instance on a container defined by name
311 * \param containerName the name of container, under one of the forms
312 * - 1 aContainer (local container)
313 * - 2 machine/aContainer (container on hostname = machine)
314 * \param componentName the name of component class
315 * \return a CORBA reference of the component instance, or _nil if problem
317 //=============================================================================
319 Engines::EngineComponent_ptr
320 SALOME_LifeCycleCORBA::FindOrLoad_Component(const char *containerName,
321 const char *componentName)
323 MESSAGE("SALOME_LifeCycleCORBA::FindOrLoad_Component INTERACTIF " << containerName << " " << componentName ) ;
325 // --- Check if Component Name is known in ModuleCatalog
326 if (! isKnownComponentClass(componentName))
327 return Engines::EngineComponent::_nil();
329 // --- Check if containerName contains machine name (if yes: rg>0)
330 char *stContainer=strdup(containerName);
331 std::string st2Container(stContainer);
332 int rg=st2Container.find("/");
334 Engines::MachineParameters_var params=new Engines::MachineParameters;
338 // containerName doesn't contain "/" => Local container
339 params->container_name=CORBA::string_dup(stContainer);
344 stContainer[rg]='\0';
345 params->container_name=CORBA::string_dup(stContainer+rg+1);
346 params->hostname=CORBA::string_dup(stContainer);
348 params->isMPI = false;
349 SCRUTE(params->container_name);
351 return FindOrLoad_Component(params, componentName);
354 //=============================================================================
355 /*! \brief Check if the component class is known in module catalog
357 * \param componentName the name of component class
358 * \return true if found, false otherwise
360 //=============================================================================
362 bool SALOME_LifeCycleCORBA::isKnownComponentClass(const char *componentName)
366 CORBA::Object_var obj = _NS->Resolve("/Kernel/ModulCatalog");
367 SALOME_ModuleCatalog::ModuleCatalog_var Catalog =
368 SALOME_ModuleCatalog::ModuleCatalog::_narrow(obj) ;
369 ASSERT(! CORBA::is_nil(Catalog));
370 SALOME_ModuleCatalog::Acomponent_var compoInfo =
371 Catalog->GetComponent(componentName);
372 if (CORBA::is_nil (compoInfo))
374 MESSAGE("Catalog Error: Component not found in the catalog " << componentName);
379 catch (ServiceUnreachable&)
381 INFOS("Caught exception: Naming Service Unreachable");
385 INFOS("Caught unknown exception.");
390 //=============================================================================
392 * Not so complex... useful ?
394 //=============================================================================
397 SALOME_LifeCycleCORBA::isMpiContainer(const Engines::ContainerParameters& params)
398 throw(IncompatibleComponent)
407 //=============================================================================
408 /*! \brief Initialisation of a given Engines::MachineParameters with default values.
410 * - container_name = "" : not relevant
411 * - hostname = "" : not relevant
412 * - OS = "" : not relevant
413 * - nb_proc = 0 : not relevant
414 * - mem_mb = 0 : not relevant
415 * - cpu_clock = 0 : not relevant
416 * - nb_proc_per_node = 0 : not relevant
417 * - nb_node = 0 : not relevant
418 * - isMPI = false : standard components
420 //=============================================================================
422 void SALOME_LifeCycleCORBA::preSet(Engines::MachineParameters& params)
424 params.container_name = "";
425 params.hostname = "";
428 params.cpu_clock = 0;
429 params.nb_proc_per_node = 0;
431 params.isMPI = false;
432 params.workingdir = "";
435 params.parallelLib = "";
436 params.nb_component_nodes = 0;
440 SALOME_LifeCycleCORBA::preSet(Engines::ResourceParameters& params)
443 params.hostname = "";
447 params.cpu_clock = 0;
449 params.nb_proc_per_node = 0;
453 void SALOME_LifeCycleCORBA::preSet( Engines::ContainerParameters& params)
455 params.container_name = "";
457 params.workingdir = "";
459 params.isMPI = false;
460 params.parallelLib = "";
461 SALOME_LifeCycleCORBA::preSet(params.resource_params);
465 SALOME_LifeCycleCORBA::convert(const Engines::MachineParameters& params_in,
466 Engines::ContainerParameters& params_out)
468 SALOME_LifeCycleCORBA::preSet(params_out);
471 params_out.container_name = params_in.container_name;
472 params_out.mode = params_in.mode;
473 params_out.workingdir = params_in.workingdir;
474 params_out.isMPI = params_in.isMPI;
475 params_out.parallelLib = params_in.parallelLib;
478 params_out.resource_params.hostname = params_in.hostname;
479 params_out.resource_params.OS = params_in.OS;
480 params_out.resource_params.mem_mb = params_in.mem_mb;
481 params_out.resource_params.cpu_clock = params_in.cpu_clock;
482 params_out.resource_params.nb_node = params_in.nb_node;
483 params_out.resource_params.nb_proc_per_node = params_in.nb_proc_per_node;
484 params_out.resource_params.policy = params_in.policy;
485 params_out.resource_params.componentList = params_in.componentList;
487 params_out.resource_params.resList.length(params_in.computerList.length());
488 for (CORBA::ULong i = 0; i < params_in.computerList.length(); i++)
489 params_out.resource_params.resList[i] = params_in.computerList[i];
492 //=============================================================================
494 * \return a number of processors not 0, only for MPI containers
496 //=============================================================================
498 int SALOME_LifeCycleCORBA::NbProc(const Engines::ContainerParameters& params)
500 if( !isMpiContainer(params) )
502 else if( params.nb_proc <= 0 )
505 return params.nb_proc;
508 //=============================================================================
509 /*! \brief Get the container manager
511 * \return the container Manager
513 //=============================================================================
515 Engines::ContainerManager_ptr SALOME_LifeCycleCORBA::getContainerManager()
517 Engines::ContainerManager_var contManager =
518 Engines::ContainerManager::_duplicate(_ContManager);
519 return contManager._retn();
522 //=============================================================================
523 /*! \brief Get the resources manager
525 * \return the container Manager
527 //=============================================================================
529 Engines::ResourcesManager_ptr SALOME_LifeCycleCORBA::getResourcesManager()
531 Engines::ResourcesManager_var resManager =
532 Engines::ResourcesManager::_duplicate(_ResManager);
533 return resManager._retn();
536 //=============================================================================
537 /*! \brief shutdown all the SALOME servers except SALOME_Session_Server, omniNames and notifd
539 //=============================================================================
541 void SALOME_LifeCycleCORBA::shutdownServers()
543 // get each Container from NamingService => shutdown it
544 // (the order is inverse to the order of servers initialization)
546 SALOME::Session_var session = SALOME::Session::_nil();
548 CORBA::Object_var objS = _NS->Resolve("/Kernel/Session");
549 if (!CORBA::is_nil(objS))
551 session = SALOME::Session::_narrow(objS);
552 if (!CORBA::is_nil(session))
554 pid = session->getPID();
559 std::string hostname = Kernel_Utils::GetHostname();
561 // 1) ConnectionManager
564 CORBA::Object_var objCnM=_NS->Resolve("/ConnectionManager");
565 Engines::ConnectionManager_var connMan=Engines::ConnectionManager::_narrow(objCnM);
566 if ( !CORBA::is_nil(connMan) && ( pid != connMan->getPID() ) )
567 connMan->ShutdownWithExit();
569 catch(const CORBA::Exception& e)
571 // ignore and continue
575 ts_req.tv_nsec=100000000;
578 //Wait some time so that ConnectionManager be completely shutdown
580 nanosleep(&ts_req,0);
586 CORBA::Object_var objSDS = _NS->Resolve("/myStudyManager");
587 SALOMEDS::StudyManager_var studyManager = SALOMEDS::StudyManager::_narrow(objSDS) ;
588 if ( !CORBA::is_nil(studyManager) && ( pid != studyManager->getPID() ) )
589 studyManager->Shutdown();
591 catch(const CORBA::Exception& e)
593 // ignore and continue
596 //Wait some time so that study be completely shutdown
598 nanosleep(&ts_req,0);
604 CORBA::Object_var objMC=_NS->Resolve("/Kernel/ModulCatalog");
605 SALOME_ModuleCatalog::ModuleCatalog_var catalog = SALOME_ModuleCatalog::ModuleCatalog::_narrow(objMC);
606 if ( !CORBA::is_nil(catalog) && ( pid != catalog->getPID() ) )
609 catch(const CORBA::Exception& e)
611 // ignore and continue
614 //Wait some time so that ModulCatalog be completely shutdown
616 nanosleep(&ts_req,0);
622 CORBA::Object_var objSL = _NS->Resolve("/SalomeLauncher");
623 Engines::SalomeLauncher_var launcher = Engines::SalomeLauncher::_narrow(objSL);
624 if (!CORBA::is_nil(launcher) && (pid != launcher->getPID()))
625 launcher->Shutdown();
627 catch(const CORBA::Exception& e)
629 // ignore and continue
632 //Wait some time so that launcher be completely shutdown
634 nanosleep(&ts_req,0);
640 CORBA::Object_var objR = _NS->Resolve("/Registry");
641 Registry::Components_var registry = Registry::Components::_narrow(objR);
642 if ( !CORBA::is_nil(registry) && ( pid != registry->getPID() ) )
643 registry->Shutdown();
645 catch(const CORBA::Exception& e)
647 // ignore and continue
652 if ( !CORBA::is_nil( session ) ) {
657 catch(const CORBA::Exception& e)
659 // ignore and continue
666 char *xargv = (char*)"";
667 char **argv = &xargv;
668 CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
670 CORBA::Object_var objLog = CORBA::Object::_nil();
671 CosNaming::NamingContext_var inc;
672 CORBA::Object_var theObj = CORBA::Object::_nil();
673 std::string stdname = "Logger";
674 CosNaming::Name name;
676 name[0].id = CORBA::string_dup(stdname.c_str());
679 if(!CORBA::is_nil(orb))
680 theObj = orb->resolve_initial_references("NameService");
681 if (!CORBA::is_nil(theObj))
682 inc = CosNaming::NamingContext::_narrow(theObj);
687 if(!CORBA::is_nil(inc))
691 objLog = inc->resolve(name);
692 SALOME_Logger::Logger_var logger = SALOME_Logger::Logger::_narrow(objLog);
693 if ( !CORBA::is_nil(logger) )
702 //=============================================================================
703 /*! \brief shutdown omniNames and notifd
705 //=============================================================================
707 void SALOME_LifeCycleCORBA::killOmniNames()
709 std::string portNumber (::getenv ("NSPORT") );
710 if ( !portNumber.empty() )
715 cmd = std::string( "ps -eo pid,command | grep -v grep | grep -E \"omniNames.*")
717 + std::string("\" | awk '{cmd=sprintf(\"kill -9 %s\",$1); system(cmd)}'" );
720 system ( cmd.c_str() );
727 // NPAL 18309 (Kill Notifd)
728 if ( !portNumber.empty() )
730 std::string cmd = ("from killSalomeWithPort import killNotifdAndClean; ");
731 cmd += std::string("killNotifdAndClean(") + portNumber + "); ";
732 cmd = std::string("python -c \"") + cmd +"\" > /dev/null 2> /dev/null";
734 system( cmd.c_str() );
738 //=============================================================================
739 /*! \brief Find an already existing and registered component instance.
741 * - build a list of machines on which an instance of the component is running,
742 * - find the best machine among the list
744 * \param params machine parameters like type or name...
745 * \param componentName the name of component class
746 * \param studyId default = 0 : multistudy instance
747 * \param listOfMachines list of machine address
748 * \return a CORBA reference of the component instance, or _nil if not found
750 //=============================================================================
752 Engines::EngineComponent_ptr
753 SALOME_LifeCycleCORBA::
754 _FindComponent(const Engines::ContainerParameters& params,
755 const char *componentName,
757 const Engines::ResourceList& listOfResources)
759 // --- build the list of machines on which the component is already running
760 const char *containerName = params.container_name;
761 int nbproc = NbProc(params);
763 Engines::ResourceList_var resourcesOK = new Engines::ResourceList;
765 unsigned int lghtOfresourcesOK = 0;
766 resourcesOK->length(listOfResources.length());
768 for(unsigned int i=0; i < listOfResources.length(); i++)
770 const char * currentResource = listOfResources[i];
771 CORBA::Object_var obj = _NS->ResolveComponent(currentResource,
775 if (!CORBA::is_nil(obj))
776 resourcesOK[lghtOfresourcesOK++] = CORBA::string_dup(currentResource);
779 // --- find the best machine among the list
780 if(lghtOfresourcesOK != 0)
782 resourcesOK->length(lghtOfresourcesOK);
783 CORBA::String_var bestResource = _ResManager->FindFirst(resourcesOK);
784 CORBA::Object_var obj = _NS->ResolveComponent(bestResource,
788 return Engines::EngineComponent::_narrow(obj);
791 return Engines::EngineComponent::_nil();
794 //=============================================================================
795 /*! \brief Load a component instance.
797 * - Finds a container in the list of machine or start one.
798 * - Try to load the component library in the container,
799 * - then create an instance of the component.
801 * \param params machine parameters like type or name...
802 * \param componentName the name of component class
803 * \param studyId default = 0 : multistudy instance
804 * \return a CORBA reference of the component instance, or _nil if problem
806 //=============================================================================
808 Engines::EngineComponent_ptr
809 SALOME_LifeCycleCORBA::
810 _LoadComponent(const Engines::ContainerParameters& params,
811 const char *componentName,
814 MESSAGE("_LoadComponent, required " << params.container_name <<
815 " " << componentName << " " << NbProc(params));
817 Engines::ContainerParameters local_params(params);
818 local_params.mode = CORBA::string_dup("findorstart");
819 Engines::Container_var cont = _ContManager->GiveContainer(local_params);
820 if (CORBA::is_nil(cont)) return Engines::EngineComponent::_nil();
823 bool isLoadable = cont->load_component_Library(componentName,reason);
826 //std::cerr << reason << std::endl;
827 CORBA::string_free(reason);
828 return Engines::EngineComponent::_nil();
830 CORBA::string_free(reason);
832 Engines::EngineComponent_var myInstance =
833 cont->create_component_instance(componentName, studyId);
834 return myInstance._retn();
837 //=============================================================================
838 /*! \brief Load a parallel component instance.
840 * \param params machine parameters like type or name...
841 * \param componentName the name of component class
842 * \param studyId default = 0 : multistudy instance
843 * \return a CORBA reference of the parallel component instance, or _nil if problem
845 //=============================================================================
846 Engines::EngineComponent_ptr
847 SALOME_LifeCycleCORBA::Load_ParallelComponent(const Engines::ContainerParameters& params,
848 const char *componentName,
851 MESSAGE("Entering LoadParallelComponent");
853 /*MESSAGE("Parameters : ");
854 MESSAGE("Container name : " << params.container_name);
855 MESSAGE("Number of component nodes : " << params.nb_component_nodes);
856 MESSAGE("Component Name : " << componentName);*/
858 Engines::ContainerParameters parms(params);
859 parms.resource_params.componentList.length(1);
860 parms.resource_params.componentList[0] = componentName;
861 parms.mode = CORBA::string_dup("findorstart");
863 MESSAGE("Starting Parallel Container");
864 Engines::Container_var cont = _ContManager->GiveContainer(parms);
865 if (CORBA::is_nil(cont)) {
866 INFOS("FindOrStartParallelContainer() returns a NULL container !");
867 return Engines::EngineComponent::_nil();
870 MESSAGE("Loading component library");
872 bool isLoadable = cont->load_component_Library(componentName,reason);
874 INFOS(componentName <<" library is not loadable !");
875 //std::cerr << reason << std::endl;
876 CORBA::string_free(reason);
877 return Engines::EngineComponent::_nil();
879 CORBA::string_free(reason);
881 MESSAGE("Creating component instance");
882 // @PARALLEL@ permits to identify that the component requested
883 // is a parallel component.
884 std::string name = std::string(componentName);
885 Engines::EngineComponent_var myInstance = cont->create_component_instance(name.c_str(), studyId);
886 if (CORBA::is_nil(myInstance))
887 INFOS("create_component_instance returns a NULL component !");
888 return myInstance._retn();
891 /*! \brief copy a file from a source host to a destination host
892 * \param hostSrc the source host
893 * \param fileSrc the file to copy from the source host to the destination host
894 * \param hostDest the destination host
895 * \param fileDest the destination file
897 void SALOME_LifeCycleCORBA::copyFile(const char* hostSrc, const char* fileSrc, const char* hostDest, const char* fileDest)
899 if(strcmp(hostDest,"localhost") == 0)
901 //if localhost use a shortcut
902 SALOME_FileTransferCORBA transfer(hostSrc,fileSrc);
903 transfer.getLocalFile(fileDest);
907 Engines::ContainerManager_var contManager = getContainerManager();
909 Engines::ContainerParameters params;
912 params.resource_params.hostname = hostDest;
913 params.mode = CORBA::string_dup("findorstart");
914 Engines::Container_var containerDest = contManager->GiveContainer(params);
916 params.resource_params.hostname = hostSrc;
917 Engines::Container_var containerSrc = contManager->GiveContainer(params);
919 containerDest->copyFile(containerSrc,fileSrc,fileDest);
922 /*! \brief get the naming service used by the life cycle
924 * \return the naming service
926 SALOME_NamingService * SALOME_LifeCycleCORBA::namingService()
931 /*! \brief get the orb used by the life cycle
935 CORBA::ORB_ptr SALOME_LifeCycleCORBA::orb()