Salome HOME
Merge branch 'V9_2_2_BR'
[modules/gui.git] / src / PVServerService / ENGINE / PVSERVER.py
1 # Copyright (C) 2015-2019  CEA/DEN, EDF R&D, OPEN CASCADE
2 #
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.
7 #
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.
12 #
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
16 #
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 #
19 # Author : Adrien BRUNETON (CEA)
20 #
21
22 import PVSERVER_ORB__POA
23 from SALOME_NamingServicePy import SALOME_NamingServicePy_i
24 from PVSERVER_impl import PVSERVER_impl, MESSAGE 
25     
26 class PVSERVER(PVSERVER_ORB__POA.PVSERVER_Gen,
27               PVSERVER_impl):
28     """
29     Construct an instance of PVSERVER *service*.
30     The class PVSERVER implements the CORBA interface PVSERVER_Gen (see PVSERVER_Gen.idl).
31     It is NOT inherited from the classes SALOME_ComponentPy_i, as we present
32     the class as a pure CORBA service, not as a standard SALOME component.
33     """
34     def __init__ ( self, orb, poa, contID, containerName, instanceName, 
35                    interfaceName ):
36         
37         
38         PVSERVER_impl.__init__(self)
39         
40         self._orb = orb
41         self._poa = poa
42         self._instanceName = instanceName
43 #         self._interfaceName = interfaceName
44         self._containerName = containerName
45 #         self._contId = contID
46
47         self._naming_service = SALOME_NamingServicePy_i(self._orb)
48         Component_path = self._containerName + "/" + self._instanceName
49         MESSAGE(  'SALOME_ComponentPy_i Register' + str( Component_path ) )
50         id_o = poa.activate_object(self)
51         compo_o = poa.id_to_reference(id_o)
52         
53         ## And launch registration
54         ##
55         self._naming_service.Register(compo_o, Component_path)        
56
57     """ Override base class destroy to make sure we try to kill the pvserver
58         before leaving.
59     """
60     def destroy(self):
61         # TODO
62         self.StopPVServer()
63