]> SALOME platform Git repositories - samples/genericsolver.git/commitdiff
Salome HOME
bos #26460 Add SSL mode
authorViktor UZLOV <vuzlov@centos7-01.nnov.opencascade.com>
Tue, 9 Nov 2021 16:43:00 +0000 (19:43 +0300)
committervsr <vsr@opencascade.com>
Mon, 17 Jan 2022 11:32:20 +0000 (14:32 +0300)
resources/CMakeLists.txt
src/GENERICSOLVER/CMakeLists.txt
src/GENERICSOLVER/DEVIATION.py
src/GENERICSOLVER/DEVIATION_SalomeSessionless.py [new file with mode: 0644]

index d59de301644f8a4fed409fed32f97bd915302f34..5e45480eab27cdc3d8ecdfa89ee324b7a507178a 100644 (file)
@@ -32,3 +32,4 @@ INSTALL(FILES ${GENERICSOLVER_RESOURCES_FILES} DESTINATION ${SALOME_GENERICSOLVE
 MESSAGE(STATUS "Creation of ${CMAKE_CURRENT_BINARY_DIR}/SalomeApp.xml")
 CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/SalomeApp.xml.in ${CMAKE_CURRENT_BINARY_DIR}/SalomeApp.xml @ONLY)
 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/SalomeApp.xml DESTINATION ${SALOME_GENERICSOLVER_INSTALL_RES_DATA})
+SALOME_CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/SalomeApp.xml.in ${CMAKE_CURRENT_BINARY_DIR}/SalomeAppSL.xml INSTALL ${SALOME_GENERICSOLVER_INSTALL_RES_DATA})
\ No newline at end of file
index 7e763500f57aa7fe19b80fe79fb432dddd7787ef..9dd4c18e518f3e77cae04992bdd7948ca685fbc2 100644 (file)
@@ -22,6 +22,7 @@
 # scripts / static
 SET(_bin_SCRIPTS
   DEVIATION.py
+  DEVIATION_SalomeSessionless.py
   GENERICSOLVER.py
 )
 
index 5e1109eb894c5a827d723234bdf2b8f4c28387bb..3b0babdf3e7bcea376d177b4f35e59314f4f3346 100644 (file)
@@ -33,6 +33,7 @@ import GENERICSOLVER_ORB__POA
 import SALOME
 import SALOME_ComponentPy
 import SALOME_DriverPy
+import SALOME_Embedded_NamingService_ClientPy
 import _thread
 import salome
 
@@ -113,7 +114,15 @@ class DEVIATION(GENERICSOLVER_ORB__POA.DEVIATION_Gen,
         SALOME_DriverPy.SALOME_DriverPy_i.__init__(self, interfaceName)
         # On stocke dans l'attribut _naming_service, une reference sur
         # le Naming Service CORBA
-        self._naming_service = SALOME_ComponentPy.SALOME_NamingServicePy_i( self._orb )
+        #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)
+        #
         self.deterministicValues = {}
 
 ######################################################################
diff --git a/src/GENERICSOLVER/DEVIATION_SalomeSessionless.py b/src/GENERICSOLVER/DEVIATION_SalomeSessionless.py
new file mode 100644 (file)
index 0000000..7862298
--- /dev/null
@@ -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 DEVIATION import DEVIATION
+
+    # set SSL mode, if not done yes
+    import KernelBasis
+    KernelBasis.setSSLMode(True)
+
+    # check if DEVIATION is already registered
+    import KernelServices
+    try:
+        return KernelServices.RetrieveCompo("DEVIATION"), orb
+    except Exception:
+        pass
+
+    # initialize and register DEVIATION 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 = DEVIATION(orb, poa, conObj, "FactoryServer", "DEVIATION_inst_1", "DEVIATION")
+    ret = servant.getCorbaRef()
+    KernelServices.RegisterCompo("DEVIATION", ret)
+    return ret, orb