From a2251f85c619fc8021bf1755467c47b52db59828 Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Fri, 19 Feb 2021 08:32:01 +0100 Subject: [PATCH] WIP --- src/Container/Container_i.cxx | 59 +++++++++++++++++++ src/Container/SALOME_Container_i.hxx | 10 ++++ .../SALOME_Fake_NamingService.cxx | 7 ++- .../SALOME_Fake_NamingService.hxx | 8 +++ 4 files changed, 83 insertions(+), 1 deletion(-) diff --git a/src/Container/Container_i.cxx b/src/Container/Container_i.cxx index ec10aaedd..582cd1d7a 100644 --- a/src/Container/Container_i.cxx +++ b/src/Container/Container_i.cxx @@ -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(&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() +{ + +} diff --git a/src/Container/SALOME_Container_i.hxx b/src/Container/SALOME_Container_i.hxx index 0aa3426b2..047d9dfb3 100644 --- a/src/Container/SALOME_Container_i.hxx +++ b/src/Container/SALOME_Container_i.hxx @@ -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 diff --git a/src/NamingService/SALOME_Fake_NamingService.cxx b/src/NamingService/SALOME_Fake_NamingService.cxx index 83ed3206c..75c7e911b 100644 --- a/src/NamingService/SALOME_Fake_NamingService.cxx +++ b/src/NamingService/SALOME_Fake_NamingService.cxx @@ -19,14 +19,19 @@ #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 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 == ) } diff --git a/src/NamingService/SALOME_Fake_NamingService.hxx b/src/NamingService/SALOME_Fake_NamingService.hxx index ea80395fa..9f7fc28bd 100644 --- a/src/NamingService/SALOME_Fake_NamingService.hxx +++ b/src/NamingService/SALOME_Fake_NamingService.hxx @@ -21,10 +21,18 @@ #include "omniORB4/CORBA.h" +#include +#include +#include + 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 _map; }; -- 2.39.2