1 # Copyright (C) 2015-2021 CEA/DEN, EDF R&D, OPEN CASCADE
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 # Lesser General Public License for more details.
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 # Author : Adrien BRUNETON (CEA)
22 import PVSERVER_ORB__POA
23 import SALOME_ComponentPy
24 import SALOME_Embedded_NamingService_ClientPy
25 from PVSERVER_impl import PVSERVER_impl, MESSAGE
27 class PVSERVER(PVSERVER_ORB__POA.PVSERVER_Gen,
30 Construct an instance of PVSERVER *service*.
31 The class PVSERVER implements the CORBA interface PVSERVER_Gen (see PVSERVER_Gen.idl).
32 It is NOT inherited from the classes SALOME_ComponentPy_i, as we present
33 the class as a pure CORBA service, not as a standard SALOME component.
35 def __init__ ( self, orb, poa, contID, containerName, instanceName,
39 PVSERVER_impl.__init__(self)
43 self._instanceName = instanceName
44 # self._interfaceName = interfaceName
45 self._containerName = containerName
46 # self._contId = contID
49 emb_ns = contID.get_embedded_NS_if_ssl()
51 if CORBA.is_nil(emb_ns):
52 self._naming_service = SALOME_ComponentPy.SALOME_NamingServicePy_i( self._orb )
54 self._naming_service = SALOME_Embedded_NamingService_ClientPy.SALOME_Embedded_NamingService_ClientPy(emb_ns)
56 Component_path = self._containerName + "/" + self._instanceName
57 MESSAGE( 'SALOME_ComponentPy_i Register' + str( Component_path ) )
58 id_o = poa.activate_object(self)
59 self._compo_o = poa.id_to_reference(id_o)
61 ## And launch registration
63 self._naming_service.Register(self._compo_o, Component_path)
65 def getCorbaRef(self):
68 """ Override base class destroy to make sure we try to kill the pvserver