From: rnv Date: Thu, 14 Apr 2022 15:54:36 +0000 (+0300) Subject: #29456 [EDF] (2022-T1) Finalization of SSL implementation X-Git-Tag: V9_9_0b1^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Frnv%2F29456;p=samples%2Fhello.git #29456 [EDF] (2022-T1) Finalization of SSL implementation --- diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6c0235e..a99818b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -21,7 +21,7 @@ # Common packages ## SET(SUBDIRS_COMMON - HELLO HELLOGUI HELLO_SWIG + HELLO HELLOGUI ) SET(SUBDIRS diff --git a/src/HELLO/CMakeLists.txt b/src/HELLO/CMakeLists.txt index f8a6863..e265b08 100644 --- a/src/HELLO/CMakeLists.txt +++ b/src/HELLO/CMakeLists.txt @@ -47,7 +47,6 @@ SET(_link_LIBRARIES # header files / no moc processing SET(HELLO_HEADERS HELLO.hxx - HELLO_Component_Generator.hxx ) # --- sources --- @@ -55,7 +54,6 @@ SET(HELLO_HEADERS # sources / static SET(HELLO_SOURCES HELLO.cxx - HELLO_Component_Generator.cxx ) # --- rules --- diff --git a/src/HELLO/HELLO.cxx b/src/HELLO/HELLO.cxx index 5c7e2c6..e16ae67 100644 --- a/src/HELLO/HELLO.cxx +++ b/src/HELLO/HELLO.cxx @@ -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(); + } + } } diff --git a/src/HELLO/HELLO_Component_Generator.cxx b/src/HELLO/HELLO_Component_Generator.cxx deleted file mode 100644 index 3ab5256..0000000 --- a/src/HELLO/HELLO_Component_Generator.cxx +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (C) 2021 CEA/DEN, EDF R&D, OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// - -#include "HELLO_Component_Generator.hxx" - -#include "HELLO.hxx" -#include "SALOME_Container_i.hxx" -#include "SALOME_KernelServices.hxx" - -#include - -static Engines::EngineComponent_var _unique_compo; - -Engines::EngineComponent_var RetrieveHELLOInstance() -{ - constexpr char COMPO_NAME[]="HELLO"; - if (CORBA::is_nil(_unique_compo)) - { - 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); - auto *cont(KERNEL::getContainerSA()); - PortableServer::ObjectId *conId(cont->getCORBAId()); - // - pman->activate(); - // - HELLO_No_Session *servant = new HELLO_No_Session(orb, poa, conId, "HELLO_inst_2", COMPO_NAME); - PortableServer::ObjectId *zeId = servant->getId(); - CORBA::Object_var zeRef = poa->id_to_reference(*zeId); - KERNEL::RegisterCompo(COMPO_NAME,zeRef); - _unique_compo = Engines::EngineComponent::_narrow(zeRef); - } - return _unique_compo; -} diff --git a/src/HELLO/HELLO_Component_Generator.hxx b/src/HELLO/HELLO_Component_Generator.hxx deleted file mode 100644 index 3c6145f..0000000 --- a/src/HELLO/HELLO_Component_Generator.hxx +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (C) 2021 CEA/DEN, EDF R&D, OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// - -#pragma once - -#include "HELLO.hxx" - -#include "SALOMEconfig.h" - -#include CORBA_SERVER_HEADER(HELLO_Gen) - -HELLOENGINE_EXPORT Engines::EngineComponent_var RetrieveHELLOInstance(); diff --git a/src/HELLOGUI/HELLOGUI.cxx b/src/HELLOGUI/HELLOGUI.cxx index d9c8dc4..f4b4d30 100644 --- a/src/HELLOGUI/HELLOGUI.cxx +++ b/src/HELLOGUI/HELLOGUI.cxx @@ -22,7 +22,6 @@ #include "HELLOGUI.h" #include "HELLO_version.h" -#include "HELLO_Component_Generator.hxx" #include #include @@ -887,17 +886,7 @@ void HELLOGUI::init() if ( CORBA::is_nil( myEngine ) ) { SALOME_NamingService_Abstract *ns = SalomeApp_Application::namingService(); - Engines::EngineComponent_var comp; - if(ns->IsTrueNS()) - { - comp = SalomeApp_Application::lcc()->FindOrLoad_Component( "FactoryServer", "HELLO" ); - } - else - { - comp = RetrieveHELLOInstance(); - CORBA::Object_var comp2 = CORBA::Object::_narrow(comp); - KERNEL::RegisterCompo("HELLO",comp2); - } + Engines::EngineComponent_var comp = SalomeApp_Application::lcc()->FindOrLoad_Component("FactoryServer", "HELLO"); myEngine = HELLO_ORB::HELLO_Gen::_narrow( comp ); } } diff --git a/src/HELLO_SWIG/CMakeLists.txt b/src/HELLO_SWIG/CMakeLists.txt deleted file mode 100644 index bfab586..0000000 --- a/src/HELLO_SWIG/CMakeLists.txt +++ /dev/null @@ -1,55 +0,0 @@ -# Copyright (C) 2012-2021 CEA/DEN, EDF R&D, OPEN CASCADE -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# - -INCLUDE(${SWIG_USE_FILE}) - -INCLUDE_DIRECTORIES( - ${KERNEL_INCLUDE_DIRS} - ${PROJECT_BINARY_DIR}/idl - ${PROJECT_SOURCE_DIR}/src/HELLO -) - -SET(_bin_SCRIPTS - HELLO_SalomeSessionless.py -) - -# additional preprocessor / compiler flags -ADD_DEFINITIONS(${OMNIORB_DEFINITIONS} ) - -# SWIG wrapping -SET(HelloHelper_HEADERS HelloHelper.h HelloHelper.i) -SET(HelloHelper_SOURCES HelloHelper.cxx ${HelloHelper_HEADERS}) -SET_SOURCE_FILES_PROPERTIES(HelloHelper.i PROPERTIES CPLUSPLUS ON) -SET_SOURCE_FILES_PROPERTIES(HelloHelper.i PROPERTIES SWIG_FLAGS "-py3") -SET_SOURCE_FILES_PROPERTIES(HelloHelper_wrap.cpp PROPERTIES COMPILE_FLAGS "-DHAVE_CONFIG_H") -SET(_swig_SCRIPTS ${CMAKE_CURRENT_BINARY_DIR}/HelloHelper.py ) -IF(${CMAKE_VERSION} VERSION_LESS "3.8.0") - SWIG_ADD_MODULE(HelloHelper python ${HelloHelper_SOURCES}) -ELSE() - SWIG_ADD_LIBRARY(HelloHelper LANGUAGE python SOURCES ${HelloHelper_SOURCES}) -ENDIF() -SWIG_LINK_LIBRARIES(HelloHelper ${PYTHON_LIBRARIES} ${PLATFORM_LIBS} HELLOEngine ${KERNEL_SalomeKernelHelpers} ${KERNEL_SalomeDS} ) -SWIG_CHECK_GENERATION(HelloHelper) -IF(WIN32) - SET_TARGET_PROPERTIES(_HelloHelper PROPERTIES DEBUG_OUTPUT_NAME _HelloHelper_d) -ENDIF(WIN32) -INSTALL(TARGETS _HelloHelper DESTINATION ${SALOME_INSTALL_LIBS}) -INSTALL(FILES ${HelloHelper_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS}) -SALOME_INSTALL_SCRIPTS("${_swig_SCRIPTS}" ${SALOME_INSTALL_BINS} EXTRA_DPYS "${SWIG_MODULE_HelloHelper_REAL_NAME}") -SALOME_INSTALL_SCRIPTS("${_bin_SCRIPTS}" ${SALOME_INSTALL_PYTHON} DEF_PERMS) diff --git a/src/HELLO_SWIG/HELLO_SalomeSessionless.py b/src/HELLO_SWIG/HELLO_SalomeSessionless.py deleted file mode 100644 index 0d36984..0000000 --- a/src/HELLO_SWIG/HELLO_SalomeSessionless.py +++ /dev/null @@ -1,28 +0,0 @@ -# -*- coding: iso-8859-1 -*- -# Copyright (C) 2021 CEA/DEN, EDF R&D, OPEN CASCADE -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# - -def buildInstance(orb): - import HelloHelper - hello_ior = HelloHelper.BuildHELLOInstance() - import HELLO_ORB - import CORBA - orb=CORBA.ORB_init(['']) - hello = orb.string_to_object(hello_ior) - return hello, orb diff --git a/src/HELLO_SWIG/HelloHelper.cxx b/src/HELLO_SWIG/HelloHelper.cxx deleted file mode 100644 index dcf031e..0000000 --- a/src/HELLO_SWIG/HelloHelper.cxx +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (C) 2021 CEA/DEN, EDF R&D, OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// - -#include "HelloHelper.h" - -#include "SALOME_KernelServices.hxx" - -#include "HELLO_Component_Generator.hxx" - -std::string BuildHELLOInstance() -{ - Engines::EngineComponent_var zeRef = RetrieveHELLOInstance(); - CORBA::String_var ior = KERNEL::getORB()->object_to_string(zeRef); - return std::string(ior.in()); -} diff --git a/src/HELLO_SWIG/HelloHelper.h b/src/HELLO_SWIG/HelloHelper.h deleted file mode 100644 index 5e2c9f4..0000000 --- a/src/HELLO_SWIG/HelloHelper.h +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (C) 2021 CEA/DEN, EDF R&D, OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// - -#include - -std::string BuildHELLOInstance(); diff --git a/src/HELLO_SWIG/HelloHelper.i b/src/HELLO_SWIG/HelloHelper.i deleted file mode 100644 index a6d8bf2..0000000 --- a/src/HELLO_SWIG/HelloHelper.i +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (C) 2021 CEA/DEN, EDF R&D, OPEN CASCADE -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// - -%module HelloHelper - -%include "std_string.i" - -%inline -{ - std::string BuildHELLOInstance(); -}