Salome HOME
[EDF30399] : Steer directory hosting replay files
[modules/kernel.git] / src / Container / Component_i.cxx
index 879329b2a2f67b555c4dfb8fa2555660027bda36..7e47c0d6195ca761bfd06f6efeef23446bfcc2a5 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2021  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2024  CEA, EDF, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 #include "SALOME_Container_i.hxx"
 #include "RegistryConnexion.hxx"
 #include "Basics_Utils.hxx"
-#include <stdio.h>
+#include "OpUtil.hxx"
+#include "Utils_SINGLETON.hxx"
+#include "SALOME_NamingService.hxx"
+#include "Utils_CorbaException.hxx"
+
+#include <cstdio>
 #ifndef WIN32
 #include <dlfcn.h>
 #endif
@@ -115,8 +120,8 @@ Engines_Component_i::Engines_Component_i(CORBA::ORB_ptr orb,
   if(regist)
     {
       const CORBA::String_var ior = _orb->object_to_string(o);
-      _myConnexionToRegistry = new RegistryConnexion(0, 0, ior,"theSession",
-                                                     _instanceName.c_str());
+      _myConnexionToRegistry = new RegistryConnexion(ior,"theSession",
+                                                     _instanceName.c_str(), getNS());
     }
 
   if(notif)
@@ -165,13 +170,35 @@ 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());
+    _myConnexionToRegistry = new RegistryConnexion(ior,"theSession", _instanceName.c_str(),getNS());
   }
   if(notif)
     _notifSupplier = new NOTIFICATION_Supplier(instanceName, notif);
 
 }
 
+CORBA::Boolean Engines_Component_i::isSSLMode()
+{
+  PortableServer::ServantBase *serv(_poa->reference_to_servant(_container));
+  if(!serv)
+    THROW_SALOME_CORBA_EXCEPTION("_container and component are not managed by the same POA ! Looks bad !", SALOME::INTERNAL_ERROR);
+  Abstract_Engines_Container_i *elt=dynamic_cast<Abstract_Engines_Container_i *>(serv);
+  if(!elt)
+    THROW_SALOME_CORBA_EXCEPTION("_container servant object if not a Abstract_Engines_Container_i ! It smells bad !", SALOME::INTERNAL_ERROR);
+  SALOME_NamingService_Container_Abstract *ns(elt->getNS());
+  if(!ns)
+    THROW_SALOME_CORBA_EXCEPTION("_container servant object points to a nullptr NS ! It smells bad !", SALOME::INTERNAL_ERROR);
+  return elt->isSSLMode() && (!dynamic_cast<SALOME_NamingService *>(ns));
+}
+
+SALOME_NamingService_Abstract *Engines_Component_i::getNS()
+{
+  CORBA::ORB_var orb = KERNEL::GetRefToORB();
+
+  SALOME_NamingService *naming = SINGLETON_<SALOME_NamingService>::Instance() ;
+  naming->init_orb( orb ) ;
+  return naming;
+}
 
 //=============================================================================
 /*!