From: Viktor UZLOV Date: Tue, 9 Nov 2021 16:18:15 +0000 (+0300) Subject: bos 26460 Complete SSL mode X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Focc%2Fssl;p=modules%2Fadao.git bos 26460 Complete SSL mode --- diff --git a/resources/CMakeLists.txt b/resources/CMakeLists.txt index 150d33f..2362c9f 100644 --- a/resources/CMakeLists.txt +++ b/resources/CMakeLists.txt @@ -20,7 +20,9 @@ if(ADAO_SALOME_MODULE) - install(FILES SalomeApp.xml ADAOCatalog.xml DESTINATION ${ADAO_RES_SALOME}) + install(FILES ADAOCatalog.xml DESTINATION ${ADAO_RES_SALOME}) + SALOME_CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/SalomeApp.xml.in ${CMAKE_CURRENT_BINARY_DIR}/SalomeApp.xml INSTALL ${ADAO_RES_SALOME}) + SALOME_CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/SalomeApp.xml.in ${CMAKE_CURRENT_BINARY_DIR}/SalomeAppSL.xml INSTALL ${ADAO_RES_SALOME}) else(ADAO_SALOME_MODULE) diff --git a/resources/SalomeApp.xml b/resources/SalomeApp.xml deleted file mode 100644 index c4813c1..0000000 --- a/resources/SalomeApp.xml +++ /dev/null @@ -1,43 +0,0 @@ - - -
- - - - - - - - -
-
- - -
-
- - -
-
diff --git a/resources/SalomeApp.xml.in b/resources/SalomeApp.xml.in new file mode 100644 index 0000000..c4813c1 --- /dev/null +++ b/resources/SalomeApp.xml.in @@ -0,0 +1,43 @@ + + +
+ + + + + + + + +
+
+ + +
+
+ + +
+
diff --git a/src/daSalome/daGUI/ADAO.py b/src/daSalome/daGUI/ADAO.py index efd4aef..ecbe8e8 100644 --- a/src/daSalome/daGUI/ADAO.py +++ b/src/daSalome/daGUI/ADAO.py @@ -25,6 +25,7 @@ import ADAO_COMPONENT__POA import SALOME_ComponentPy import SALOME_DriverPy +import SALOME_Embedded_NamingService_ClientPy from daUtils.adaoLogger import * @@ -46,7 +47,14 @@ class ADAO(ADAO_COMPONENT__POA.ADAO_ENGINE, SALOME_DriverPy.SALOME_DriverPy_i.__init__(self, interfaceName) # On stocke dans l'attribut _naming_service, une ref sur le Naming Service - self._naming_service = SALOME_ComponentPy.SALOME_NamingServicePy_i( self._orb ) + # + emb_ns = self._contId.get_embedded_NS_if_ssl() + import CORBA + if CORBA.is_nil(emb_ns): + self._naming_service = SALOME_ComponentPy.SALOME_NamingServicePy_i( self._orb ) + else: + self._naming_service = SALOME_Embedded_NamingService_ClientPy.SALOME_Embedded_NamingService_ClientPy(emb_ns) + # def print_ping(): info("ADAO ENGINE Ping", "ENGINE") diff --git a/src/daSalome/daGUI/ADAO_SalomeSessionless.py b/src/daSalome/daGUI/ADAO_SalomeSessionless.py new file mode 100644 index 0000000..0cb504b --- /dev/null +++ b/src/daSalome/daGUI/ADAO_SalomeSessionless.py @@ -0,0 +1,49 @@ +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2021 CEA/DEN, EDF R&D +# +# 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): + from ADAO import ADAO + + # set SSL mode, if not done yes + import KernelBasis + KernelBasis.setSSLMode(True) + + # check if ADAO is already registered + import KernelServices + try: + return KernelServices.RetrieveCompo("ADAO"), orb + except Exception: + pass + + # initialize and register ADAO engine + import PortableServer + obj = orb.resolve_initial_references("RootPOA") + poa = obj._narrow(PortableServer.POA) + pman = poa._get_the_POAManager() + pman.activate() + # + from SALOME_ContainerPy import SALOME_ContainerPy_SSL_i + cont = SALOME_ContainerPy_SSL_i(orb, poa, "FactoryServer") + conObj = poa.id_to_reference(poa.activate_object(cont)) + # + servant = ADAO(orb, poa, conObj, "FactoryServer", "ADAO_inst_1", "ADAO") + ret = servant.getCorbaRef() + KernelServices.RegisterCompo("ADAO", ret) + return ret, orb diff --git a/src/daSalome/daGUI/CMakeLists.txt b/src/daSalome/daGUI/CMakeLists.txt index f4e0798..310cdf6 100644 --- a/src/daSalome/daGUI/CMakeLists.txt +++ b/src/daSalome/daGUI/CMakeLists.txt @@ -20,7 +20,7 @@ if(ADAO_SALOME_MODULE) - install(FILES ADAOGUI.py ADAO.py DESTINATION ${ADAO_SCRIPT_PYTHON_SALOME}) + install(FILES ADAOGUI.py ADAO.py ADAO_SalomeSessionless.py DESTINATION ${ADAO_SCRIPT_PYTHON_SALOME}) else(ADAO_SALOME_MODULE) diff --git a/src/daSalome/daGUI/daGuiImpl/adaoModuleHelper.py b/src/daSalome/daGUI/daGuiImpl/adaoModuleHelper.py index feb76d7..cf651e5 100644 --- a/src/daSalome/daGUI/daGuiImpl/adaoModuleHelper.py +++ b/src/daSalome/daGUI/daGuiImpl/adaoModuleHelper.py @@ -29,7 +29,6 @@ __all__ = [ "modulePixmap", "verbose", "getORB", - "getNS", "getLCC", "getStudyManager", "getEngine", @@ -41,6 +40,7 @@ __all__ = [ from omniORB import CORBA from SALOME_NamingServicePy import SALOME_NamingServicePy_i from LifeCycleCORBA import LifeCycleCORBA +import salome import SALOMEDS import SALOMEDS_Attributes_idl from salome.kernel.studyedit import getStudyEditor @@ -119,47 +119,23 @@ def verbose(): ### # Get ORB reference ### -__orb__ = None def getORB(): - global __orb__ - if __orb__ is None: - __orb__ = CORBA.ORB_init( [''], CORBA.ORB_ID ) - pass - return __orb__ - -### -# Get naming service instance -### -__naming_service__ = None -def getNS(): - global __naming_service__ - if __naming_service__ is None: - __naming_service__ = SALOME_NamingServicePy_i( getORB() ) - pass - return __naming_service__ + salome.salome_init() + return salome.orb ## # Get life cycle CORBA instance ## -__lcc__ = None def getLCC(): - global __lcc__ - if __lcc__ is None: - __lcc__ = LifeCycleCORBA( getORB() ) - pass - return __lcc__ + salome.salome_init() + return salome.lcc ## # Get study manager ### -__study_manager__ = None def getStudyManager(): - global __study_manager__ - if __study_manager__ is None: - obj = getNS().Resolve( '/myStudyManager' ) - __study_manager__ = obj._narrow( SALOMEDS.StudyManager ) - pass - return __study_manager__ + salome.salome_init() + return salome.myStudy ### # Get OMA engine