Salome HOME
#29456 [EDF] (2022-T1) Finalization of SSL implementation
[samples/hello.git] / src / HELLO / HELLO.cxx
index 5c7e2c602ff000009b5159fa655e2b56e5fdde1a..e16ae67c96a33b16fe172365720f560139ad72c0 100644 (file)
@@ -287,13 +287,23 @@ extern "C"
     \param interfaceName SALOME component interface name
     \return CORBA object identifier of the registered servant
   */
-  PortableServer::ObjectId* HELLOEngine_factory( CORBA::ORB_ptr orb,
-                                                PortableServer::POA_ptr poa, 
-                                                PortableServer::ObjectId* contId,
-                                                const char* instanceName, 
-                                                const char* interfaceName )
-  {
-    HELLO_Session* component = new HELLO_Session( orb, poa, contId, instanceName, interfaceName );
-    return component->getId();
-  }
+       PortableServer::ObjectId* HELLOEngine_factory(CORBA::ORB_ptr orb,
+               PortableServer::POA_ptr poa,
+               PortableServer::ObjectId* contId,
+               const char* instanceName,
+               const char* interfaceName)
+       {
+               CORBA::Object_var o = poa->id_to_reference(*contId);
+               Engines::Container_var cont = Engines::Container::_narrow(o);
+               if (cont->is_SSL_mode())
+               {
+                       HELLO_No_Session* component = new HELLO_No_Session(orb, poa, contId, instanceName, interfaceName);
+                       return component->getId();
+               }
+               else
+               {
+                       HELLO_Session* component = new HELLO_Session(orb, poa, contId, instanceName, interfaceName);
+                       return component->getId();
+               }
+       }
 }