Salome HOME
add options-help get from launcher
[modules/kernel.git] / src / Container / SALOME_ComponentPy.py
index 2ddb033d7af515c424835b4063f3159dd9916d0b..f7e01ae9d4ed729745d9fd842c353d1edecceac4 100644 (file)
@@ -1,5 +1,5 @@
 #  -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2021  CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2024  CEA, EDF, OPEN CASCADE
 #
 # Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -41,6 +41,7 @@ import Engines, Engines__POA
 import Registry
 from Utils_Identity import *
 from SALOME_NamingServicePy import *
+from SALOME_Embedded_NamingService_ClientPy import SALOME_Embedded_NamingService_ClientPy
 from libNOTIFICATION import *
 
 from SALOME_utilities import *
@@ -254,7 +255,7 @@ class SALOME_ComponentPy_Gen_i (Engines__POA.EngineComponent):
     def CpuUsed_impl(self):
         if ( self._ThreadId | self._Executed ) :
             if self._ThreadId == get_ident() :
-                cpu = time.clock()
+                cpu = time.process_time()
                 self._ThreadCpuUsed = cpu - self._StartUsed
                 MESSAGE( "SALOME_ComponentPy_i::CpuUsed_impl " + self._serviceName + " " + str( int(cpu) ) + " - " + str( self._StartUsed ) + " = " + str( self._ThreadCpuUsed ) )
                 return self._ThreadCpuUsed
@@ -296,12 +297,16 @@ class SALOME_ComponentPy_i(SALOME_ComponentPy_Gen_i):
     """
     def __init__ (self, orb, poa, contID, containerName, instanceName, interfaceName, notif=False):
         SALOME_ComponentPy_Gen_i.__init__(self, orb, poa, contID, containerName, instanceName, interfaceName, notif)
-        naming_service = SALOME_NamingServicePy_i(self._orb)
-        Component_path = self._containerName + "/" + self._instanceName
+        emb_ns = self._contId.get_embedded_NS_if_ssl()
+        if CORBA.is_nil(emb_ns):
+            self._naming_service = SALOME_NamingServicePy_i(self._orb)
+        else:
+            self._naming_service = SALOME_Embedded_NamingService_ClientPy(emb_ns)
+        Component_path = contID.name + "/" + self._instanceName#self._containerName
         MESSAGE(  'SALOME_ComponentPy_i Register' + str( Component_path ) )
-        naming_service.Register(self._compo_o, Component_path)
+        self._naming_service.Register(self._compo_o, Component_path)
         # Add componentinstance to registry
-        obj = naming_service.Resolve('/Registry')
+        obj = self._naming_service.Resolve('/Registry')
         if obj is None:
             MESSAGE(  "Registry Reference is invalid" )
         else: