Salome HOME
[tuleap26946] : SSL - Fix inconsistency between C++ and Python components
authorAnthony Geay <anthony.geay@edf.fr>
Mon, 17 Jan 2022 09:20:38 +0000 (10:20 +0100)
committerAnthony Geay <anthony.geay@edf.fr>
Mon, 17 Jan 2022 09:20:38 +0000 (10:20 +0100)
idl/SALOME_Component.idl
src/Container/Container_i.cxx
src/Container/SALOME_ComponentPy.py
src/Container/SALOME_Container_i.hxx
src/NamingService/SALOME_Fake_NamingService.cxx

index d58943ad2f00653845451c8e523dcf4ad30b3a34..1481c75b818b271a076341620d9248cc68c4044d 100644 (file)
@@ -152,6 +152,8 @@ module Engines
     
     //! In case of SSL mode Returns entry to Embedded NS
     EmbeddedNamingService get_embedded_NS_if_ssl();
+    
+    boolean is_SSL_mode();
 
     //!  Unload component libraries from the container.
     void finalize_removal() ;
index 85c65cedd4cd2bbf3fc3be1f517a3467a14ff06c..ec3a469118f26643415d3250fcd6ad5e572d42d0 100644 (file)
@@ -57,6 +57,7 @@ int SIGUSR1 = 1000;
 #include "SALOME_NamingService.hxx"
 #include "SALOME_Fake_NamingService.hxx"
 #include "SALOME_Embedded_NamingService_Client.hxx"
+#include "SALOME_Embedded_NamingService.hxx"
 #include "Basics_Utils.hxx"
 
 #ifdef _XOPEN_SOURCE
@@ -1562,7 +1563,14 @@ Engines::EmbeddedNamingService_ptr Abstract_Engines_Container_i::get_embedded_NS
   }
   else
   {
-    return Engines::EmbeddedNamingService::_nil();
+    SALOME_Fake_NamingService *fns(dynamic_cast<SALOME_Fake_NamingService *>(this->_NS));
+    if(fns)
+    {
+      Engines::EmbeddedNamingService_var ret = GetEmbeddedNamingService();
+      return ret._retn();
+    }
+    else
+      return Engines::EmbeddedNamingService::_nil();
   } 
 }
 
index 635f7e87e4d9e671133ff416404dcebaa2d51097..c350df9cc36566865daa5b1f5b06972add67e6bd 100644 (file)
@@ -302,7 +302,7 @@ class SALOME_ComponentPy_i(SALOME_ComponentPy_Gen_i):
             self._naming_service = SALOME_NamingServicePy_i(self._orb)
         else:
             self._naming_service = SALOME_Embedded_NamingService_ClientPy(emb_ns)
-        Component_path = self._containerName + "/" + self._instanceName
+        Component_path = contID.name + "/" + self._instanceName#self._containerName
         MESSAGE(  'SALOME_ComponentPy_i Register' + str( Component_path ) )
         self._naming_service.Register(self._compo_o, Component_path)
         # Add componentinstance to registry
index ee2c5db54b051e5aa05ad12b5cbd2688e17bfaee..d4d940d51d35cdbabc15d7aca46e9e7d94461c37 100644 (file)
@@ -88,6 +88,8 @@ public:
   load_impl(const char *nameToRegister,
             const char *componentName);
 
+  bool is_SSL_mode() override { return this->isSSLMode(); }
+
   Engines::EmbeddedNamingService_ptr get_embedded_NS_if_ssl() override;
 
   SALOME_NamingService_Container_Abstract *getNS() const { return _NS; }
index 2952fef9eb929aff17bf86d7b736cdc835b673a9..8796f1fcad75f7e99611acadac22bf6af4869835 100644 (file)
@@ -160,9 +160,27 @@ SALOME_NamingService_Abstract *SALOME_Fake_NamingService::clone()
 CORBA::Object_ptr SALOME_Fake_NamingService::ResolveComponent(const char* hostname, const char* containerName, const char* componentName, const int nbproc)
 {
   std::ostringstream oss;
-  oss << SEP << "Containers" << SEP << hostname << SEP << containerName << SEP << componentName;
+  oss << SEP << "Containers" << SEP << hostname << SEP << containerName << SEP << componentName << "_inst_";
   std::string entryToFind(oss.str());
-  return Resolve(entryToFind.c_str());
+  {
+    std::lock_guard<std::mutex> g(_mutex);
+    std::vector<std::string> candidates;
+    for(auto it : _map)
+    {
+      if(it.first.find(entryToFind) == 0)
+        candidates.push_back(it.first);
+    }
+    if(candidates.size() == 1)
+    {
+      auto it = _map.find(candidates[0]);
+      return CORBA::Object::_duplicate((*it).second);
+    }
+    else
+    {
+      return CORBA::Object::_nil();
+    }
+    
+  }
 }
 
 std::vector< std::pair< std::string, Engines::Container_var> > SALOME_Fake_NamingService::ListOfContainersInNS_NoThreadSafe()