Salome HOME
Merge from V5_1_3_BR 07/12/2009
[modules/kernel.git] / src / LifeCycleCORBA / SALOME_LifeCycleCORBA.cxx
index dd691dd193baeba2e4ffd553079db8fdd3cbcf96..53455360982754f42b8ebcf52db9da14789e35d7 100644 (file)
@@ -85,9 +85,11 @@ SALOME_LifeCycleCORBA::SALOME_LifeCycleCORBA(SALOME_NamingService *ns)
   char **argv = &xargv;
   CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
   //  LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
+  _NSnew=0;
   if (!ns)
     {
       _NS = new SALOME_NamingService(orb);
+      _NSnew=_NS;
     }
   else _NS = ns;
   //add try catch
@@ -115,6 +117,7 @@ SALOME_LifeCycleCORBA::SALOME_LifeCycleCORBA(SALOME_NamingService *ns)
 
 SALOME_LifeCycleCORBA::~SALOME_LifeCycleCORBA()
 {
+  if(_NSnew)delete _NSnew;
 }
 
 //=============================================================================
@@ -274,7 +277,7 @@ SALOME_LifeCycleCORBA::FindOrLoad_Component(const char *containerName,
     {
       // containerName doesn't contain "/" => Local container
       params->container_name=CORBA::string_dup(stContainer);
-      params->hostname=CORBA::string_dup(Kernel_Utils::GetHostname().c_str());
+      params->hostname="";
     }
   else 
     {
@@ -534,6 +537,8 @@ void SALOME_LifeCycleCORBA::killOmniNames()
   string portNumber (::getenv ("NSPORT") );
   if ( !portNumber.empty() ) 
     {
+#ifdef WNT
+#else
       string cmd ;
       cmd = string( "ps -eo pid,command | grep -v grep | grep -E \"omniNames.*")
         + portNumber
@@ -544,6 +549,7 @@ void SALOME_LifeCycleCORBA::killOmniNames()
       }
       catch ( ... ) {
       }
+#endif
     }
   
   // NPAL 18309  (Kill Notifd)
@@ -678,7 +684,7 @@ SALOME_LifeCycleCORBA::Load_ParallelComponent(const Engines::MachineParameters&
   parms.componentList[0] = componentName;
 
   MESSAGE("Starting Parallel Container");
-  Engines::Container_var cont = _ContManager->FindOrStartParallelContainer(parms);
+  Engines::Container_var cont = _ContManager->StartParallelContainer(parms);
   if (CORBA::is_nil(cont)) {
     INFOS("FindOrStartParallelContainer() returns a NULL container !");
     return Engines::Component::_nil();
@@ -694,7 +700,7 @@ SALOME_LifeCycleCORBA::Load_ParallelComponent(const Engines::MachineParameters&
   MESSAGE("Creating component instance");
   // @PARALLEL@ permits to identify that the component requested
   // is a parallel component.
-  string name = string(componentName) + string("@PARALLEL@");
+  string name = string(componentName);
   Engines::Component_var myInstance = cont->create_component_instance(name.c_str(), studyId);
   if (CORBA::is_nil(myInstance))
     INFOS("create_component_instance returns a NULL component !");
@@ -731,3 +737,21 @@ void SALOME_LifeCycleCORBA::copyFile(const char* hostSrc, const char* fileSrc, c
   containerDest->copyFile(containerSrc,fileSrc,fileDest);
 }
 
+/*! \brief get the naming service used by the life cycle
+ *
+ *  \return the naming service
+ */
+SALOME_NamingService * SALOME_LifeCycleCORBA::namingService()
+{
+  return _NS;
+}
+
+/*! \brief get the orb used by the life cycle
+ *
+ *  \return the orb
+ */
+CORBA::ORB_ptr SALOME_LifeCycleCORBA::orb()
+{
+  return _NS->orb();
+}
+