Salome HOME
Make PYHELLO component appear into SALOME_Session_Server_No_Server application
authorAnthony Geay <anthony.geay@edf.fr>
Fri, 30 Jul 2021 13:52:31 +0000 (15:52 +0200)
committerAnthony Geay <anthony.geay@edf.fr>
Fri, 30 Jul 2021 14:10:51 +0000 (16:10 +0200)
resources/CMakeLists.txt
src/PYHELLO/PYHELLO.py
src/PYHELLO/PYHELLO_utils.py

index 24e7cb292ba664ed4c29a25e22f909d7f3346f81..01c84911817876526d75252cea89413c555163bf 100644 (file)
@@ -32,4 +32,7 @@ SET(PYHELLO_RESOURCES_FILES
 INSTALL(FILES ${PYHELLO_RESOURCES_FILES} DESTINATION ${SALOME_PYHELLO_INSTALL_RES_DATA})
 
 SALOME_CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/SalomeApp.xml.in ${CMAKE_CURRENT_BINARY_DIR}/SalomeApp.xml INSTALL ${SALOME_PYHELLO_INSTALL_RES_DATA})
+
+SALOME_CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/SalomeApp.xml.in ${CMAKE_CURRENT_BINARY_DIR}/SalomeAppSL.xml INSTALL ${SALOME_PYHELLO_INSTALL_RES_DATA})
+
 SALOME_CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/PYHELLOCatalog.xml.in ${CMAKE_CURRENT_BINARY_DIR}/PYHELLOCatalog.xml INSTALL ${SALOME_PYHELLO_INSTALL_RES_DATA})
index 5951a372737c7df6da4071cb3ddf0866b1b6fabb..77ed258a712fdf4634e9c684955b6c7806feab7b 100644 (file)
@@ -27,6 +27,7 @@
 #
 import PYHELLO_ORB__POA
 import SALOME_ComponentPy
+import SALOME_Embedded_NamingService_ClientPy
 import SALOME_DriverPy
 import SALOMEDS
 from PYHELLO_utils import findOrCreateComponent, objectID, moduleName, getStudy
@@ -47,10 +48,18 @@ class PYHELLO(PYHELLO_ORB__POA.PYHELLO_Gen,
                     contID, containerName, instanceName, interfaceName, False)
         SALOME_DriverPy.SALOME_DriverPy_i.__init__(self, interfaceName)
         #
-        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)
         #
         pass
 
+    def getNamingService(self):
+        return self._naming_service
+
     """
     Get version information.
     """
@@ -77,7 +86,7 @@ class PYHELLO(PYHELLO_ORB__POA.PYHELLO_Gen,
     Create object.
     """
     def createObject( self, name ):
-        study = getStudy()
+        study = getStudy( self._naming_service )
         builder = study.NewBuilder()
         father  = findOrCreateComponent()
         obj  = builder.NewObject( father )
index 698cc2581f09f91ba3a17b6e4fbd87499f61aa2d..6766427dea0ccebe53acf6c48e5299ae3338d4eb 100644 (file)
@@ -30,7 +30,6 @@ __all__ = [
     "modulePixmap",
     "verbose",
     "getORB",
-    "getNS",
     "getLCC",
     "getEngine",
     "getStudy",
@@ -107,17 +106,6 @@ def getORB():
         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__
-
 ##
 # Get life cycle CORBA instance
 ##
@@ -136,7 +124,7 @@ __study__ = None
 def getStudy():
     global __study__
     if __study__ is None:
-        obj = getNS().Resolve( '/Study' )
+        obj = __engine__.getNamingService().Resolve( '/Study' )
         __study__ = obj._narrow( SALOMEDS.Study )
         pass
     return __study__
@@ -148,7 +136,19 @@ __engine__ = None
 def getEngine():
     global __engine__
     if __engine__ is None:
-        __engine__ = getLCC().FindOrLoadComponent( "FactoryServerPy", moduleName() )
+        import KernelBasis
+        if KernelBasis.getSSLMode():
+            import salome
+            import PYHELLO
+            from SALOME_ContainerPy import SALOME_ContainerPy_SSL_i
+            poa = salome.orb.resolve_initial_references("RootPOA")
+            poaManager = poa._get_the_POAManager()
+            poaManager.activate()
+            cpy_i = SALOME_ContainerPy_SSL_i(salome.orb, poa, "FactoryServerPy")
+            cpy_ref = cpy_i._this()
+            __engine__ = PYHELLO.PYHELLO(salome.orb,poa,cpy_ref,"FactoryServerPy", "PYHELLO_inst_2" , moduleName())
+        else:
+            __engine__ = getLCC().FindOrLoadComponent( "FactoryServerPy", moduleName() )
         pass
     return __engine__