LIST(APPEND _bin_SCRIPTS
PVSERVER.py
PVSERVER_utils.py
+ PVSERVER_SalomeSessionless.py
)
ENDIF()
#
import PVSERVER_ORB__POA
-from SALOME_NamingServicePy import SALOME_NamingServicePy_i
+import SALOME_ComponentPy
+import SALOME_Embedded_NamingService_ClientPy
from PVSERVER_impl import PVSERVER_impl, MESSAGE
class PVSERVER(PVSERVER_ORB__POA.PVSERVER_Gen,
# self._interfaceName = interfaceName
self._containerName = containerName
# self._contId = contID
+ self._compo_o = None
+
+ emb_ns = 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._naming_service = SALOME_NamingServicePy_i(self._orb)
Component_path = self._containerName + "/" + self._instanceName
MESSAGE( 'SALOME_ComponentPy_i Register' + str( Component_path ) )
id_o = poa.activate_object(self)
- compo_o = poa.id_to_reference(id_o)
+ self._compo_o = poa.id_to_reference(id_o)
## And launch registration
##
- self._naming_service.Register(compo_o, Component_path)
+ self._naming_service.Register(self._compo_o, Component_path)
+
+ def getCorbaRef(self):
+ return self._compo_o
""" Override base class destroy to make sure we try to kill the pvserver
before leaving.
def destroy(self):
# TODO
self.StopPVServer()
+
\ No newline at end of file
--- /dev/null
+# -*- 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 PVSERVER import PVSERVER
+
+ # set SSL mode, if not done yes
+ import KernelBasis
+ KernelBasis.setSSLMode(True)
+
+ # check if PYHELLO is already registered
+ import KernelServices
+ try:
+ return KernelServices.RetrieveCompo("PVSERVER"), orb
+ except Exception:
+ pass
+
+ # initialize and register PVSERVER 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 = PVSERVER(orb, poa, conObj, "FactoryServer", "PVSERVER_inst_1", "PVSERVER")
+ ret = servant.getCorbaRef()
+ KernelServices.RegisterCompo("PVSERVER", ret)
+ return ret, orb
# Author : Adrien BRUNETON (CEA)
#
+import salome
from omniORB import CORBA
from SALOME_NamingServicePy import SALOME_NamingServicePy_i
import SALOMEDS
###
# Get verbose level
-###
+###
__verbose__ = None
def verbose():
import os
###
# 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 PVSERVER service
###
__service__ = None
__serviceLoader__ = None
-def getService():
+def getService():
global __service__, __serviceLoader__
+ import KernelBasis
containerName = "FactoryServer"
- if __serviceLoader__ is None:
- __serviceLoader__ = PVServer_ServiceLoader()
- if __service__ is None:
- import PVSERVER
- ior = __serviceLoader__.findOrLoadService(containerName)
- obj = getORB().string_to_object( ior )
- __service__ = obj._narrow(PVSERVER.PVSERVER)
- pass
+ if KernelBasis.getSSLMode():
+ if __service__ is None:
+ salome.salome_init()
+ __service__ = salome.lcc.FindOrLoadComponent(containerName, "PVSERVER")
+ else:
+ if __serviceLoader__ is None:
+ __serviceLoader__ = PVServer_ServiceLoader()
+ if __service__ is None:
+ import PVSERVER
+ ior = __serviceLoader__.findOrLoadService(containerName)
+ obj = getORB().string_to_object( ior )
+ __service__ = obj._narrow(PVSERVER.PVSERVER)
+ pass
return __service__
###