From: caremoli Date: Tue, 16 Mar 2010 17:15:30 +0000 (+0000) Subject: CCAR: add a method to Container idl (create_component_instance_env) to be able X-Git-Tag: V5_1_4a1~25 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=14d0564de2d1c5d47a61c57bd8abf8aa367899b2;p=modules%2Fkernel.git CCAR: add a method to Container idl (create_component_instance_env) to be able to create a standalone component (executable) with predefined environment variables. It's mainly the same method as create_component_instance with a third argument that is a dict(string,Any) to pass in the environment variables. create_component_instance has been reimplemented by calling create_component_instance_env with an empty dict (for compatibility with 5.1.3) MPIContainer and ParallelContainer have been updated --- diff --git a/idl/Makefile.am b/idl/Makefile.am index 57e246b7f..18c741859 100644 --- a/idl/Makefile.am +++ b/idl/Makefile.am @@ -126,6 +126,10 @@ if MPI_IS_OK STATIDL_SOURCES += $(MPIIDL_SOURCES) endif +if MPI_IS_OK + DYNIDL_SRCS += SALOME_MPIObjectDynSK.cc SALOME_MPIContainerDynSK.cc SALOME_TestMPIComponentDynSK.cc +endif + $(DYNIDL_SRCS) : $(IDL_SOURCES) # also install all generated headers to use result library from another modules diff --git a/idl/SALOME_Component.idl b/idl/SALOME_Component.idl index fc555dc34..6253ecb8f 100644 --- a/idl/SALOME_Component.idl +++ b/idl/SALOME_Component.idl @@ -96,6 +96,19 @@ module Engines Engines::Component create_component_instance(in string componentName, in long studyId); + //! Create a new servant instance of a component with environment variables specified. + /*! + Component library must be loaded. + \param componentName Name of the component which will be registered + in Registry and Name Service, + (instance number suffix added to the registered name) + \param studyId 0 if instance is not associated to a study, + >0 otherwise (== study id) + \param env a dict of env variables + \return a loaded component + */ + Engines::Component create_component_instance_env(in string componentName, + in long studyId, in FieldsDict env); //! Find a servant instance of a component /*! \param registeredName Name of the component in Registry or Name Service, diff --git a/src/Container/Component_i.cxx b/src/Container/Component_i.cxx index 5601df1ce..ce9d79cd9 100644 --- a/src/Container/Component_i.cxx +++ b/src/Container/Component_i.cxx @@ -123,7 +123,8 @@ Engines_Component_i::Engines_Component_i(CORBA::ORB_ptr orb, _instanceName.c_str()); } - _notifSupplier = new NOTIFICATION_Supplier(instanceName, notif); + if(notif) + _notifSupplier = new NOTIFICATION_Supplier(instanceName, notif); } //============================================================================= @@ -169,7 +170,9 @@ Engines_Component_i::Engines_Component_i(CORBA::ORB_ptr orb, const CORBA::String_var ior = _orb->object_to_string(_container); if(regist) _myConnexionToRegistry = new RegistryConnexion(0, 0, ior,"theSession", _instanceName.c_str()); - _notifSupplier = new NOTIFICATION_Supplier(instanceName, notif); + if(notif) + _notifSupplier = new NOTIFICATION_Supplier(instanceName, notif); + } diff --git a/src/Container/Container_i.cxx b/src/Container/Container_i.cxx index f7124ac82..1a838c60f 100644 --- a/src/Container/Container_i.cxx +++ b/src/Container/Container_i.cxx @@ -29,10 +29,12 @@ #include #include #include +#include #ifndef WIN32 #include #include #include +#include #else #include #include @@ -603,6 +605,28 @@ Engines_Container_i::load_component_Library(const char* componentName) Engines::Component_ptr Engines_Container_i::create_component_instance(const char*genericRegisterName, CORBA::Long studyId) +{ + Engines::FieldsDict_var env = new Engines::FieldsDict; + return create_component_instance_env(genericRegisterName,studyId,env); +} + +//============================================================================= +//! Create a new component instance with environment variables specified +/*! +* CORBA method: Creates a new servant instance of a component. +* The servant registers itself to naming service and Registry. +* \param genericRegisterName Name of the component instance to register +* in Registry & Name Service (without _inst_n suffix) +* \param studyId 0 for multiStudy instance, +* study Id (>0) otherwise +* \param env dict of env variables +* \return a loaded component +*/ +//============================================================================= + +Engines::Component_ptr +Engines_Container_i::create_component_instance_env(const char*genericRegisterName, + CORBA::Long studyId,const Engines::FieldsDict& env) { if (studyId < 0) { @@ -716,8 +740,45 @@ Engines_Container_i::create_component_instance(const char*genericRegisterName, command+=instanceName; //instance name command+=" &"; MESSAGE("SALOME_Container::create_component_instance command=" << command); + +#ifndef WIN32 + // use fork/execl instead of system to get finer control on env variables + int status; + pid_t pid = fork(); + if(pid == 0) // child + { + for (CORBA::ULong i=0; i < env.length(); i++) + { + if (env[i].value.type()->kind() == CORBA::tk_string) + { + const char* value; + env[i].value >>= value; + std::string s(env[i].key); + s+='='; + s+=value; + putenv((char *)s.c_str()); + } + } + + execl("/bin/sh", "sh", "-c", command.c_str() , (char *)0); + status=-1; + } + else if(pid < 0) // failed to fork + { + status=-1; + } + else //parent + { + pid_t tpid; + do + { + tpid = wait(&status); + } while (tpid != pid); + } +#else // launch component with a system call int status=system(command.c_str()); +#endif if (status == -1) { diff --git a/src/Container/SALOME_ContainerManager.cxx b/src/Container/SALOME_ContainerManager.cxx index 1b17f0dd6..03d906381 100644 --- a/src/Container/SALOME_ContainerManager.cxx +++ b/src/Container/SALOME_ContainerManager.cxx @@ -223,12 +223,12 @@ SALOME_ContainerManager::GiveContainer(const Engines::ContainerParameters& param { if (mode == "find") { - MESSAGE("[GiveContainer] no container found"); - return ret; + MESSAGE("[GiveContainer] no container found"); + return ret; } else { - mode = "start"; + mode = "start"; } } } @@ -246,8 +246,8 @@ SALOME_ContainerManager::GiveContainer(const Engines::ContainerParameters& param Engines::Container_ptr cont = FindContainer(params, possibleResources[i].in()); try { - if(!cont->_non_existent()) - local_resources.push_back(string(possibleResources[i])); + if(!cont->_non_existent()) + local_resources.push_back(string(possibleResources[i])); } catch(CORBA::Exception&) {} } @@ -310,14 +310,14 @@ SALOME_ContainerManager::GiveContainer(const Engines::ContainerParameters& param Engines::Container_var cont=Engines::Container::_narrow(obj); if(!cont->_non_existent()) { - if(std::string(params.mode.in())=="getorstart" || std::string(params.mode.in())=="get"){ - return cont._retn(); /* the container exists and params.mode is getorstart or get use it*/ - } - else - { - INFOS("[GiveContainer] A container is already registered with the name: " << containerNameInNS << ", shutdown the existing container"); - cont->Shutdown(); // shutdown the registered container if it exists - } + if(std::string(params.mode.in())=="getorstart" || std::string(params.mode.in())=="get"){ + return cont._retn(); /* the container exists and params.mode is getorstart or get use it*/ + } + else + { + INFOS("[GiveContainer] A container is already registered with the name: " << containerNameInNS << ", shutdown the existing container"); + cont->Shutdown(); // shutdown the registered container if it exists + } } } catch(CORBA::Exception&) @@ -349,20 +349,20 @@ SALOME_ContainerManager::GiveContainer(const Engines::ContainerParameters& param SALOME_ModuleCatalog::Acomponent_var compoInfo = Catalog->GetComponent(compoi); if (CORBA::is_nil (compoInfo)) { - continue; + continue; } SALOME_ModuleCatalog::ImplType impl=compoInfo->implementation_type(); container_exe_tmp=compoInfo->implementation_name(); if(impl==SALOME_ModuleCatalog::CEXE) { - if(found) - { - INFOS("ContainerManager Error: you can't have 2 CEXE component in the same container" ); - return Engines::Container::_nil(); - } - MESSAGE("[GiveContainer] Exe container found !: " << container_exe_tmp); - container_exe = container_exe_tmp.in(); - found=1; + if(found) + { + INFOS("ContainerManager Error: you can't have 2 CEXE component in the same container" ); + return Engines::Container::_nil(); + } + MESSAGE("[GiveContainer] Exe container found !: " << container_exe_tmp); + container_exe = container_exe_tmp.in(); + found=1; } } } @@ -520,6 +520,9 @@ SALOME_ContainerManager::FindContainer(const Engines::ContainerParameters& param } } + +bool isPythonContainer(const char* ContainerName); + //============================================================================= /*! * This is no longer valid (C++ container are also python containers) @@ -579,13 +582,13 @@ SALOME_ContainerManager::BuildCommandToLaunchRemoteContainer if (params.isMPI) { if ((params.resource_params.nb_node <= 0) && (params.resource_params.nb_proc_per_node <= 0)) - nbproc = 1; + nbproc = 1; else if (params.resource_params.nb_node == 0) - nbproc = params.resource_params.nb_proc_per_node; + nbproc = params.resource_params.nb_proc_per_node; else if (params.resource_params.nb_proc_per_node == 0) - nbproc = params.resource_params.nb_node; + nbproc = params.resource_params.nb_node; else - nbproc = params.resource_params.nb_node * params.resource_params.nb_proc_per_node; + nbproc = params.resource_params.nb_node * params.resource_params.nb_proc_per_node; } // "ssh -l user machine distantPath/runRemote.sh hostNS portNS WORKINGDIR workingdir \ @@ -630,7 +633,7 @@ SALOME_ContainerManager::BuildCommandToLaunchRemoteContainer command += " WORKINGDIR "; command += " '"; if(wdir == "$TEMPDIR") - wdir="\\$TEMPDIR"; + wdir="\\$TEMPDIR"; command += wdir; // requested working directory command += "'"; } @@ -645,10 +648,10 @@ SALOME_ContainerManager::BuildCommandToLaunchRemoteContainer command += "-x PATH,LD_LIBRARY_PATH,OMNIORB_CONFIG,SALOME_trace "; #elif defined(WITHOPENMPI) if( getenv("OMPI_URI_FILE") == NULL ) - command += "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace"; + command += "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace"; else{ - command += "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace -ompi-server file:"; - command += getenv("OMPI_URI_FILE"); + command += "-x PATH -x LD_LIBRARY_PATH -x OMNIORB_CONFIG -x SALOME_trace -ompi-server file:"; + command += getenv("OMPI_URI_FILE"); } #endif command += " SALOME_MPIContainer "; @@ -697,7 +700,7 @@ SALOME_ContainerManager::BuildCommandToLaunchLocalContainer o << nbproc << " "; if( getenv("LIBBATCH_NODEFILE") != NULL ) - o << "-machinefile " << machinesFile << " "; + o << "-machinefile " << machinesFile << " "; #ifdef WITHLAM o << "-x PATH,LD_LIBRARY_PATH,OMNIORB_CONFIG,SALOME_trace "; @@ -1147,7 +1150,7 @@ SALOME_ContainerManager::checkPaCOParameters(Engines::ContainerParameters & para //============================================================================= Engines::Container_ptr SALOME_ContainerManager::StartPaCOPPContainer(const Engines::ContainerParameters& params_const, - std::string resource_selected) + std::string resource_selected) { CORBA::Object_var obj; PaCO::InterfaceManager_var container_proxy; @@ -1168,8 +1171,8 @@ SALOME_ContainerManager::StartPaCOPPContainer(const Engines::ContainerParameters // Step 2 : Get a MachineFile for the parallel container std::string machine_file_name = _ResManager->getMachineFile(resource_selected, - params.nb_proc, - params.parallelLib.in()); + params.nb_proc, + params.parallelLib.in()); if (machine_file_name == "") { @@ -1308,8 +1311,8 @@ SALOME_ContainerManager::StartPaCOPPContainer(const Engines::ContainerParameters std::string SALOME_ContainerManager::BuildCommandToLaunchPaCOProxyContainer(const Engines::ContainerParameters& params, - std::string machine_file_name, - std::string & proxy_hostname) + std::string machine_file_name, + std::string & proxy_hostname) { // In the proxy case, we always launch a Dummy Proxy std::string exe_name = "SALOME_ParallelContainerProxyDummy"; @@ -1391,9 +1394,9 @@ SALOME_ContainerManager::BuildCommandToLaunchPaCOProxyContainer(const Engines::C std::string SALOME_ContainerManager::BuildCommandToLaunchPaCONodeContainer(const Engines::ContainerParameters& params, - const std::string & machine_file_name, - SALOME_ContainerManager::actual_launch_machine_t & vect_machine, - const std::string & proxy_hostname) + const std::string & machine_file_name, + SALOME_ContainerManager::actual_launch_machine_t & vect_machine, + const std::string & proxy_hostname) { // Name of exe std::string exe_name = "SALOME_ParallelContainerNode"; @@ -1430,8 +1433,8 @@ SALOME_ContainerManager::BuildCommandToLaunchPaCONodeContainer(const Engines::Co bool remote_execution = false; if (hostname != std::string(Kernel_Utils::GetHostname())) { - MESSAGE("[BuildCommandToLaunchPaCONodeContainer] remote machine case detected !"); - remote_execution = true; + MESSAGE("[BuildCommandToLaunchPaCONodeContainer] remote machine case detected !"); + remote_execution = true; } // For each node we have a new command @@ -1449,17 +1452,17 @@ SALOME_ContainerManager::BuildCommandToLaunchPaCONodeContainer(const Engines::Co // a SALOME application if (remote_execution) { - ASSERT(getenv("NSHOST")); - ASSERT(getenv("NSPORT")); - - command_node_stream << resource_definition->protocol.in(); - command_node_stream << " -l "; - command_node_stream << resource_definition->username.in(); - command_node_stream << " " << hostname; - command_node_stream << " " << resource_definition->applipath.in(); - command_node_stream << "/runRemote.sh "; - command_node_stream << getenv("NSHOST") << " "; // hostname of CORBA name server - command_node_stream << getenv("NSPORT") << " "; // port of CORBA name server + ASSERT(getenv("NSHOST")); + ASSERT(getenv("NSPORT")); + + command_node_stream << resource_definition->protocol.in(); + command_node_stream << " -l "; + command_node_stream << resource_definition->username.in(); + command_node_stream << " " << hostname; + command_node_stream << " " << resource_definition->applipath.in(); + command_node_stream << "/runRemote.sh "; + command_node_stream << getenv("NSHOST") << " "; // hostname of CORBA name server + command_node_stream << getenv("NSPORT") << " "; // port of CORBA name server } command_node_stream << exe_name; @@ -1567,11 +1570,11 @@ SALOME_ContainerManager::BuildCommandToLaunchPaCONodeContainer(const Engines::Co void SALOME_ContainerManager::LogConfiguration(const std::string & log_type, - const std::string & exe_type, - const std::string & container_name, - const std::string & hostname, - std::string & begin, - std::string & end) + const std::string & exe_type, + const std::string & container_name, + const std::string & hostname, + std::string & begin, + std::string & end) { if(log_type == "xterm") { @@ -1594,8 +1597,8 @@ SALOME_ContainerManager::LogConfiguration(const std::string & log_type, CORBA::Object_ptr SALOME_ContainerManager::LaunchPaCOProxyContainer(const std::string& command, - const Engines::ContainerParameters& params, - const std::string & hostname) + const Engines::ContainerParameters& params, + const std::string & hostname) { PaCO::InterfaceManager_ptr container_proxy = PaCO::InterfaceManager::_nil(); @@ -1613,7 +1616,7 @@ SALOME_ContainerManager::LaunchPaCOProxyContainer(const std::string& command, int count = TIME_OUT_TO_LAUNCH_CONT; CORBA::Object_var obj = CORBA::Object::_nil(); std::string containerNameInNS = _NS->BuildContainerNameForNS(params.container_name.in(), - hostname.c_str()); + hostname.c_str()); MESSAGE("[LaunchParallelContainer] Waiting for Parallel Container proxy : " << containerNameInNS); while (CORBA::is_nil(obj) && count) @@ -1713,7 +1716,7 @@ SALOME_ContainerManager::LaunchPaCONodeContainer(const std::string& command, Engines::Container_ptr SALOME_ContainerManager::StartPaCOPPContainer(const Engines::ContainerParameters& params, - std::string resource_selected) + std::string resource_selected) { Engines::Container_ptr ret = Engines::Container::_nil(); INFOS("[StarPaCOPPContainer] is disabled !"); @@ -1723,34 +1726,34 @@ SALOME_ContainerManager::StartPaCOPPContainer(const Engines::ContainerParameters std::string SALOME_ContainerManager::BuildCommandToLaunchPaCOProxyContainer(const Engines::ContainerParameters& params, - std::string machine_file_name, - std::string & proxy_hostname) + std::string machine_file_name, + std::string & proxy_hostname) { return ""; } std::string SALOME_ContainerManager::BuildCommandToLaunchPaCONodeContainer(const Engines::ContainerParameters& params, - const std::string & machine_file_name, - SALOME_ContainerManager::actual_launch_machine_t & vect_machine, - const std::string & proxy_hostname) + const std::string & machine_file_name, + SALOME_ContainerManager::actual_launch_machine_t & vect_machine, + const std::string & proxy_hostname) { return ""; } void SALOME_ContainerManager::LogConfiguration(const std::string & log_type, - const std::string & exe_type, - const std::string & container_name, - const std::string & hostname, - std::string & begin, - std::string & end) + const std::string & exe_type, + const std::string & container_name, + const std::string & hostname, + std::string & begin, + std::string & end) { } CORBA::Object_ptr SALOME_ContainerManager::LaunchPaCOProxyContainer(const std::string& command, - const Engines::ContainerParameters& params, - const std::string& hostname) + const Engines::ContainerParameters& params, + const std::string& hostname) { CORBA::Object_ptr ret = CORBA::Object::_nil(); return ret; @@ -1758,9 +1761,9 @@ SALOME_ContainerManager::LaunchPaCOProxyContainer(const std::string& command, bool SALOME_ContainerManager::LaunchPaCONodeContainer(const std::string& command, - const Engines::ContainerParameters& params, - const std::string& name, - SALOME_ContainerManager::actual_launch_machine_t & vect_machine) + const Engines::ContainerParameters& params, + const std::string& name, + SALOME_ContainerManager::actual_launch_machine_t & vect_machine) { return false; } diff --git a/src/Container/SALOME_ContainerManager.hxx b/src/Container/SALOME_ContainerManager.hxx index 262b019b3..3633cffbb 100644 --- a/src/Container/SALOME_ContainerManager.hxx +++ b/src/Container/SALOME_ContainerManager.hxx @@ -68,7 +68,7 @@ protected: const std::string& container_exe="SALOME_Container"); std::string BuildCommandToLaunchLocalContainer(const Engines::ContainerParameters& params, - const std::string& machinesFile, + const std::string& machinesFile, const std::string& container_exe="SALOME_Container"); std::string BuildTempFileToLaunchRemoteContainer(const std::string& resource_name, @@ -120,31 +120,31 @@ protected: std::string BuildCommandToLaunchPaCOProxyContainer(const Engines::ContainerParameters& params, - std::string machine_file_name, - std::string & proxy_hostname); + std::string machine_file_name, + std::string & proxy_hostname); std::string BuildCommandToLaunchPaCONodeContainer(const Engines::ContainerParameters& params, - const std::string & machine_file_name, - SALOME_ContainerManager::actual_launch_machine_t & vect_machine, - const std::string & proxy_hostname); + const std::string & machine_file_name, + SALOME_ContainerManager::actual_launch_machine_t & vect_machine, + const std::string & proxy_hostname); void LogConfiguration(const std::string & log_type, - const std::string & exe_type, - const std::string & container_name, - const std::string & hostname, - std::string & begin, - std::string & end); + const std::string & exe_type, + const std::string & container_name, + const std::string & hostname, + std::string & begin, + std::string & end); CORBA::Object_ptr LaunchPaCOProxyContainer(const std::string& command, - const Engines::ContainerParameters& params, - const std::string& hostname); + const Engines::ContainerParameters& params, + const std::string& hostname); bool LaunchPaCONodeContainer(const std::string& command, - const Engines::ContainerParameters& params, - const std::string& name, - SALOME_ContainerManager::actual_launch_machine_t & vect_machine); + const Engines::ContainerParameters& params, + const std::string& name, + SALOME_ContainerManager::actual_launch_machine_t & vect_machine); // End of PaCO++ Parallel extension }; #endif diff --git a/src/Container/SALOME_Container_i.hxx b/src/Container/SALOME_Container_i.hxx index 91d40f96f..c0a189193 100644 --- a/src/Container/SALOME_Container_i.hxx +++ b/src/Container/SALOME_Container_i.hxx @@ -69,6 +69,10 @@ public: create_component_instance( const char* componentName, CORBA::Long studyId); // 0 for multiStudy + virtual Engines::Component_ptr + create_component_instance_env( const char* componentName, + CORBA::Long studyId, // 0 for multiStudy + const Engines::FieldsDict& env); Engines::Component_ptr find_component_instance( const char* registeredName, CORBA::Long studyId); // 0 for multiStudy diff --git a/src/MPIContainer/MPIContainer_i.cxx b/src/MPIContainer/MPIContainer_i.cxx index 2886759c5..b03da70ed 100644 --- a/src/MPIContainer/MPIContainer_i.cxx +++ b/src/MPIContainer/MPIContainer_i.cxx @@ -209,8 +209,9 @@ bool Engines_MPIContainer_i::Lload_component_Library(const char* componentName) // Create an instance of component Engines::Component_ptr -Engines_MPIContainer_i::create_component_instance( const char* componentName, - CORBA::Long studyId) +Engines_MPIContainer_i::create_component_instance_env( const char* componentName, + CORBA::Long studyId, + const Engines::FieldsDict& env) { pthread_t *th; if(_numproc == 0){ diff --git a/src/MPIContainer/MPIContainer_i.hxx b/src/MPIContainer/MPIContainer_i.hxx index 054f679a8..899c068cc 100644 --- a/src/MPIContainer/MPIContainer_i.hxx +++ b/src/MPIContainer/MPIContainer_i.hxx @@ -71,9 +71,10 @@ class Engines_MPIContainer_i : public POA_Engines::MPIContainer, // Create an instance of component // synchronous version for process 0 - Engines::Component_ptr - create_component_instance( const char* componentName, - CORBA::Long studyId); // 0 for multiStudy + virtual Engines::Component_ptr + create_component_instance_env( const char* componentName, + CORBA::Long studyId, // 0 for multiStudy + const Engines::FieldsDict& env); // Load a component in current MPI container // synchronous version for process 0 diff --git a/src/ParallelContainer/SALOME_ParallelContainerProxy_i.cxx b/src/ParallelContainer/SALOME_ParallelContainerProxy_i.cxx index 4f191ed5f..a37c15edc 100644 --- a/src/ParallelContainer/SALOME_ParallelContainerProxy_i.cxx +++ b/src/ParallelContainer/SALOME_ParallelContainerProxy_i.cxx @@ -264,12 +264,19 @@ Container_proxy_impl_final::load_component_Library(const char* componentName) return ret; } +Engines::Component_ptr +Container_proxy_impl_final::create_component_instance(const char* componentName, ::CORBA::Long studyId) +{ + Engines::FieldsDict_var env = new Engines::FieldsDict; + return create_component_instance_env(componentName, studyId, env); +} + // Il y a deux cas : // Composant sequentiel -> on le créer sur le noeud 0 (on pourrait faire une répartition de charge) // Composant parallèle -> création du proxy ici puis appel de la création de chaque objet participant // au composant parallèle Engines::Component_ptr -Container_proxy_impl_final::create_component_instance(const char* componentName, ::CORBA::Long studyId) +Container_proxy_impl_final::create_component_instance_env(const char* componentName, ::CORBA::Long studyId, const Engines::FieldsDict& env) { std::string aCompName = componentName; if (_libtype_map.count(aCompName) == 0) diff --git a/src/ParallelContainer/SALOME_ParallelContainerProxy_i.hxx b/src/ParallelContainer/SALOME_ParallelContainerProxy_i.hxx index 5750cde7e..900712494 100644 --- a/src/ParallelContainer/SALOME_ParallelContainerProxy_i.hxx +++ b/src/ParallelContainer/SALOME_ParallelContainerProxy_i.hxx @@ -56,6 +56,9 @@ class Container_proxy_impl_final : virtual ::CORBA::Boolean load_component_Library(const char* componentName); virtual Engines::Component_ptr create_component_instance(const char* componentName, ::CORBA::Long studyId); + virtual Engines::Component_ptr create_component_instance_env( const char* componentName, + CORBA::Long studyId, // 0 for multiStudy + const Engines::FieldsDict& env); private: std::map _libtype_map; // libname -> libtype (seq ou par) diff --git a/src/ParallelContainer/SALOME_ParallelContainer_i.cxx b/src/ParallelContainer/SALOME_ParallelContainer_i.cxx index 1d53af563..33d9be7b3 100644 --- a/src/ParallelContainer/SALOME_ParallelContainer_i.cxx +++ b/src/ParallelContainer/SALOME_ParallelContainer_i.cxx @@ -381,10 +381,32 @@ Engines_Parallel_Container_i::load_component_Library(const char* componentName) * \return a loaded component */ //============================================================================= - Engines::Component_ptr Engines_Parallel_Container_i::create_component_instance(const char*genericRegisterName, CORBA::Long studyId) +{ + Engines::FieldsDict_var env = new Engines::FieldsDict; + return create_component_instance_env(genericRegisterName,studyId,env); +} + +//============================================================================= +//! Create a new component instance +/*! + * CORBA method: Creates a new servant instance of a component. + * The servant registers itself to naming service and Registry. + * \param genericRegisterName Name of the component instance to register + * in Registry & Name Service (without _inst_n suffix) + * \param studyId 0 for multiStudy instance, + * study Id (>0) otherwise + * \param env dict of environment variables + * \return a loaded component + */ +//============================================================================= + +Engines::Component_ptr +Engines_Parallel_Container_i::create_component_instance_env(const char*genericRegisterName, + CORBA::Long studyId, + const Engines::FieldsDict& env) { MESSAGE("Begin of create_component_instance in node : " << getMyRank()); diff --git a/src/ParallelContainer/SALOME_ParallelContainer_i.hxx b/src/ParallelContainer/SALOME_ParallelContainer_i.hxx index 3c5298c8d..55bbf8802 100644 --- a/src/ParallelContainer/SALOME_ParallelContainer_i.hxx +++ b/src/ParallelContainer/SALOME_ParallelContainer_i.hxx @@ -77,6 +77,11 @@ public: create_component_instance( const char* componentName, CORBA::Long studyId); // 0 for multiStudy + virtual Engines::Component_ptr + create_component_instance_env( const char* componentName, + CORBA::Long studyId, // 0 for multiStudy + const Engines::FieldsDict& env); + Engines::Component_ptr find_component_instance( const char* registeredName, CORBA::Long studyId); // 0 for multiStudy