]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
WIP
authorAnthony Geay <anthony.geay@edf.fr>
Fri, 19 Feb 2021 07:32:01 +0000 (08:32 +0100)
committerAnthony Geay <anthony.geay@edf.fr>
Fri, 19 Feb 2021 07:32:01 +0000 (08:32 +0100)
src/Container/Container_i.cxx
src/Container/SALOME_Container_i.hxx
src/NamingService/SALOME_Fake_NamingService.cxx
src/NamingService/SALOME_Fake_NamingService.hxx

index ec10aaeddc8088c1acbcc9bca3af908e51852a32..582cd1d7a3a9b666f920ca72e3ea08cf956682f0 100644 (file)
@@ -1939,3 +1939,62 @@ std::string Engines_Container_i::AnotherMethodeToReplace_PyString_AsString(PyObj
     return my_result;
 }
 */
+
+static Engines_Container_i *_container_singleton_ssl = nullptr;
+
+Engines_Container_i *KERNEL::getContainerIdSA()
+{
+
+  if(!_container_singleton_ssl)
+  {
+    int argc(0); orb = CORBA::ORB_init(argc,nullptr); }
+    CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
+    PortableServer::POA_var poa = PortableServer::POA::_narrow(obj);
+    PortableServer::POAManager_var pman = poa->the_POAManager();
+    CORBA::PolicyList policies;
+    policies.length(0);
+    PortableServer::ObjectId_var conId;
+    //
+    {
+        char *argv[4] = {"Container","FactoryServer","toto",nullptr};
+        _container_singleton_ssl = new Engines_Container_i(orb,poa,"FactoryServer",2,argv,false,false);
+        conId = poa->activate_object(_container_singleton_ssl);
+    }
+  }
+CORBA::ORB_var orb;
+    { int argc(0); orb = CORBA::ORB_init(argc,nullptr); }
+    CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
+    PortableServer::POA_var poa = PortableServer::POA::_narrow(obj);
+    PortableServer::POAManager_var pman = poa->the_POAManager();
+    CORBA::PolicyList policies;
+    policies.length(0);
+    PortableServer::ObjectId_var conId;
+    //
+    {
+        char *argv[4] = {"Container","FactoryServer","toto",nullptr};
+        Engines_Container_i *cont = new Engines_Container_i(orb,poa,"FactoryServer",2,argv,false,false);
+        conId = poa->activate_object(cont);
+    }
+    //
+    pman->activate();
+    //
+    GEOM_Gen_No_Session_i *servant = new GEOM_Gen_No_Session_i(orb,poa,const_cast<PortableServer::ObjectId*>(&conId.in()),"GEOM_inst_2","GEOM");
+    PortableServer::ObjectId *zeId = servant->getId();
+    CORBA::Object_var zeRef = poa->id_to_reference(*zeId);
+    char *interfaceName = servant->interfaceName();
+    std::string interfaceNameCpp(interfaceName);
+    CORBA::string_free(interfaceName);
+    KERNEL::RegisterCompo(interfaceNameCpp,zeRef);
+    CORBA::String_var ior = orb->object_to_string(zeRef);
+    return std::string(ior.in());
+}
+
+PortableServer::ObjectId_var KERNEL::getContainerIdSA()
+{
+
+}
+
+Engines::Container_var KERNEL::getContainerRefSA()
+{
+
+}
index 0aa3426b269014b16409296483470f586057f0f5..047d9dfb3366965251dcf1afcf500a82ab65b2ca 100644 (file)
@@ -173,4 +173,14 @@ protected:
   bool   _isServantAloneInProcess;
 };
 
+/*!
+ * Methods to be used in SSL mode to skip NS.
+ */
+namespace KERNEL
+{
+  CONTAINER_EXPORT Engines_Container_i *getContainerIdSA();
+  CONTAINER_EXPORT PortableServer::ObjectId_var getContainerIdSA();
+  CONTAINER_EXPORT Engines::Container_var getContainerRefSA();
+}
+
 #endif
index 83ed3206c7ec393b7af4375381aa7b444616c414..75c7e911bee573d3fcde6dbd1c45722f5c92d843 100644 (file)
 
 #include "SALOME_Fake_NamingService.hxx"
 
-SALOME_Fake_NamingService::SALOME_Fake_NamingService(CORBA::ORB_ptr orb)
+SALOME_Fake_NamingService::SALOME_Fake_NamingService(CORBA::ORB_ptr orb):_orb(CORBA::ORB::_duplicate(orb))
 {
 }
 
 void SALOME_Fake_NamingService::Register(CORBA::Object_ptr ObjRef, const char* Path)
 {
+  std::lock_guard<std::mutex> g(_mutex);
+  CORBA::Object_var ObjRefAuto = CORBA::Object::_duplicate(ObjRef);
+  _map[Path] = ObjRefAuto;
 }
 
 CORBA::Object_ptr SALOME_Fake_NamingService::Resolve(const char* Path)
 {
+  std::string pathCpp(Path);
+  if(pathCpp == )
 }
index ea80395fabb515b5fcd5f66a8aa1913f824a0a08..9f7fc28bd01b5cd834cf80271df757ec2a337552 100644 (file)
 
 #include "omniORB4/CORBA.h"
 
+#include <mutex>
+#include <string>
+#include <map>
+
 class SALOME_Fake_NamingService
 {
 public:
     SALOME_Fake_NamingService(CORBA::ORB_ptr orb);
     void Register(CORBA::Object_ptr ObjRef, const char* Path);
     CORBA::Object_ptr Resolve(const char* Path);
+private:    
+    CORBA::ORB_var _orb;
+    std::mutex _mutex;
+    std::map<std::string,CORBA::Object_var> _map;
 };