Salome HOME
merge from V3_2_0_maintenance 17mar08
[modules/eficas.git] / src / EFICAS / EFICAS.py
1 # -*- coding: utf-8 -*-
2
3 import EFICAS_ORB__POA
4
5 import SALOMEDS__POA
6
7 import SALOME_ComponentPy
8
9
10
11
12
13 class SALOME_DriverPy_i(SALOMEDS__POA.Driver):
14     """
15     Python implementation of generic SALOMEDS driver.
16     Should be inherited by any Python module's engine
17     to provide persistence mechanism.
18     """
19     def __init__ (self, componentDataType):
20         print "SALOME_DriverPy.__init__: ",componentDataType
21         self._ComponentDataType = componentDataType
22
23     def IORToLocalPersistentID(self, theSObject, IORString, isMultiFile, isASCII):
24         return theSObject.GetID()
25
26     def LocalPersistentIDToIOR(self, theSObject, PersistentID, isMultiFile, isASCII):
27         return ""
28
29     def ComponentDataType(self):
30         return self._ComponentDataType
31
32     def Save(self, theComponent, theURL, isMultiFile):
33         return 'Rien'
34
35     def SaveASCII(self, theComponent, theURL, isMultiFile):
36         return self.Save(theComponent, theURL, isMultiFile)
37
38     def Load(self, theComponent, theStream, theURL, isMultiFile):
39         return 1
40
41     def LoadASCII(self, theComponent, theStream, theURL, isMultiFile):
42         return self.Load(theComponent, theStream, theURL, isMultiFile)
43
44     def Close(self, theComponent):
45         pass
46
47     def CanPublishInStudy(self, theIOR):
48         return 0
49
50     def PublishInStudy(self, theStudy, theSObject, theObject, theName):
51         return None
52
53     def CanCopy(self, theObject):
54         return 0
55
56
57
58 class EFICAS(EFICAS_ORB__POA.EFICAS_Gen,
59               SALOME_ComponentPy.SALOME_ComponentPy_i,
60               SALOME_DriverPy_i ):
61     """
62         Pour etre un composant SALOME cette classe Python
63         doit avoir le nom du composant et heriter de la
64         classe EFICAS_Gen issue de la compilation de l'idl
65         par omniidl et de la classe SALOME_ComponentPy_i
66         qui porte les services generaux d'un composant SALOME
67     """
68     def __init__ (self, orb, poa, contID, containerName, instanceName, 
69                   interfaceName):
70         print "EFICAS.__init__: ",containerName,' ',instanceName
71         SALOME_ComponentPy.SALOME_ComponentPy_i.__init__(self, orb, poa,
72                     contID, containerName,instanceName, interfaceName, 0 )
73         SALOME_DriverPy_i.__init__( self, 'OTHER' )                    
74         # On stocke dans l'attribut _naming_service, une reference sur
75         # le Naming Service CORBA
76         self._naming_service=SALOME_ComponentPy.SALOME_NamingServicePy_i(self._orb)
77
78
79