Salome HOME
[windows] Increase the time salome try to find the objects in naming service. It...
[modules/kernel.git] / doc / KERNEL_Services.txt
1 =================================================================
2 KERNEL Services for end user (Python interface)
3 =================================================================
4
5 *html version of this document is produced with docutils*::
6
7   rst2html < doc.txt > doc.html
8
9 This document corresponds to SALOME2 3.2.0
10
11 .. contents::
12 .. sectnum::
13
14 +-------------------------------------------+
15 | **WORK in PROGRESS, INCOMPLETE DOCUMENT** |
16 +-------------------------------------------+
17
18 -------------------------------------------------------------------------------
19
20 In a SALOME application, distributed components, servers and clients use
21 the CORBA middleware for comunication. CORBA interfaces are defined via idl
22 files. All the different CORBA interfaces are available for users in Python,
23 see CORBA interfaces below.
24
25 For some general purpose services, CORBA interfaces have been encapsulated
26 in order to provide a simple interface (encapsulation is generally done in
27 C++ classes, and a Python SWIG interface is also generated from C++, to 
28 ensure a consistent behavior between C++ modules and Python modules or user
29 script).
30
31 General purpose services
32 ========================
33
34 SALOME services access from a Python shell
35 ------------------------------------------
36 See SALOME_Application_ for detailed instructions to launch a Python
37 interpreter with full acces to the SALOME environment and services.
38
39 .. _SALOME_Application: ./SALOME_Application.txt
40
41 You can use the embedded Python interpreter in Grahic User Interface, or an
42 external interpreter, with::
43
44    ./runSession
45    python
46
47 In either cases, SALOME services access is done with::
48
49    import salome
50    salome.salome_init()
51
52 In the embedded interpreter, it is already done, but there is no problem to
53 do it several times, so it is preferable to add these instructions
54 systematically in your scripts, to allow them to work in all configurations.
55
56 Container and component instanciation
57 -------------------------------------
58
59 See LifeCycleCORBA_ for the C++ interface (Python interface obtained with SWIG
60 is very similar).
61
62 .. _LifeCycleCORBA: ./tui/KERNEL/classSALOME__LifeCycleCORBA.html
63
64
65 In the following example, a test component provided in KERNEL is launched
66 in the local container, "FactoryServer", created when SALOME starts::
67
68    import salome
69    salome.salome_init()
70    
71    import LifeCycleCORBA
72    lcc = LifeCycleCORBA.LifeCycleCORBA()
73    obj=lcc.FindOrLoad_Component("FactoryServer","SalomeTestComponent")
74    
75    import Engines
76    comp=obj._narrow(Engines.TestComponent)
77    
78    comp.Coucou(1)
79
80 The answer is something like::
81
82    'TestComponent_i : L = 1'
83  
84 The _narrow() instruction is not always mandatory in Python, but sometimes 
85 useful to be sure you have got the right type of object. Here, Testcomponent_
86 interface is defined in CORBA module Engines. With this example, it works also
87 without the _narrow() instruction::
88
89    obj.Coucou(1)
90
91 .. _Testcomponent: ./tui/KERNEL/interfaceEngines_1_1TestComponent.html
92
93
94 In the next example, a component instance is created in a specific Container
95 defined by it's computer hostname and it's name. Here we use the local
96 computer. Note that in Utils_Identity_, getShortHostName() gives the short
97 hostname of the computer, without domain suffixes, which is used in SALOME.
98 The container process is created here if it does not exists, and a new
99 component instance is created::
100
101    import salome
102    salome.salome_init()
103    import LifeCycleCORBA
104    lcc = LifeCycleCORBA.LifeCycleCORBA()
105
106    import Utils_Identity
107    host  = Utils_Identity.getShortHostName()
108
109    import Engines
110    params={}
111    params['hostname']=host
112    params['container_name']='myContainer'
113    comp=lcc.LoadComponent(params,'SalomeTestComponent')
114    comp.Coucou(1)
115
116 .. _Utils_Identity: ./tui/KERNEL/namespaceUtils__Identity.html
117
118 If you want to get a list of containers and component instances, client object
119 from orbmodule_ provides a list::
120
121    import orbmodule
122    clt=orbmodule.client()
123    clt.showNS()
124
125 .. _orbmodule: ./tui/KERNEL/classorbmodule_1_1client.html
126
127 The list looks like::
128
129    Logger.
130    ContainerManager.object
131    Containers.dir
132      cli70ac.dir
133        FactoryServerPy.object
134        SuperVisionContainer.object
135        FactoryServer.object
136        FactoryServer.dir
137          SalomeTestComponent_inst_1.object
138        myContainer.object
139        myContainer.dir
140          SalomeTestComponent_inst_1.object
141          SalomeTestComponent_inst_2.object
142    Registry.object
143    Kernel.dir
144      ModulCatalog.object
145      Session.object
146    Study.dir
147      Study2.object
148      extStudy_1.object
149      extStudy_2.object
150      extStudy_3.object
151    myStudyManager.object
152    SalomeAppEngine.object
153
154
155 File transfer service
156 ---------------------
157
158 See FileTransferCORBA_ for the C++ interface (Python interface obtained with
159 SWIG is very similar).
160
161 .. _FileTransferCORBA: ./tui/KERNEL/classSALOME__FileTransferCORBA.html
162
163 The following example shows how to tranfer a file from a remote host to the
164 client computer. Remote hostname is 'cli76cc', we would like to copy
165 'tkcvs_8_0_3.tar.gz' from remote to local computer. A full pathname is
166 required. A container is created on remote computer if it does not exist,
167 to handle the file transfer::
168
169    import salome
170    salome.salome_init()
171
172    import LifeCycleCORBA
173    remotefile="/home/prascle/tkcvs_8_0_3.tar.gz"
174    aFileTransfer=LifeCycleCORBA.SALOME_FileTransferCORBA('cli76cc',remotefile)
175    localFile=aFileTransfer.getLocalFile()
176
177
178 CORBA Naming service access
179 ---------------------------
180
181 See SALOME_NamingService_ for the C++ interface. The Python interface
182 SALOME_NamingServicePy_ is not yet derived from the C++ interface and offers
183 only the most useful functions.
184
185 .. _SALOME_NamingService: ./tui/KERNEL/classSALOME__NamingService.html
186 .. _SALOME_NamingServicePy: ./tui/KERNEL/classSALOME__NamingServicePy_1_1SALOME__NamingServicePy__i.html
187
188 Batch services
189 --------------
190
191 See Batch_ documentation (in french only).
192
193 .. _Batch: ./Batch.html/index.html
194
195 All IDL Interfaces
196 ==================
197
198 Containers and component life cycle, File transfer service
199 ----------------------------------------------------------
200
201 +-----------------------------+-----------------------------------------------+
202 | Engines_                    | Engines CORBA module.                         |
203 +=============================+===============================================+
204 | Component_                  | Generic component interface.                  |
205 |                             | All SALOME components inherit this interface  |
206 +-----------------------------+-----------------------------------------------+
207 | Container_                  | Container: host for C++ and Python components |
208 |                             | components instances                          |
209 +-----------------------------+-----------------------------------------------+
210 | FileTransfer_               | Agent for file transfer created by a container|
211 |                             | copy a local file to a distent client         |
212 +-----------------------------+-----------------------------------------------+
213 | FileRef_                    | Reference to a file, used by a container for  |
214 |                             | file transfers                                |
215 +-----------------------------+-----------------------------------------------+
216 | ContainerManager_           | Unique instance, in charge of container       |
217 |                             | creation on remote computers                  |
218 +-----------------------------+-----------------------------------------------+
219 | MPIContainer_               | An exemple of parallel implementation for     |
220 |                             | containers and components                     |
221 +-----------------------------+-----------------------------------------------+
222 | MPIObject_                  |                                               |
223 +-----------------------------+-----------------------------------------------+
224
225 Study management
226 ----------------
227
228 +-----------------------------+-----------------------------------------------+
229 | SALOMEDS_                   | SALOMEDS CORBA module                         |
230 +=============================+===============================================+
231 | SALOMEDSidl_                |                                               |
232 +-----------------------------+-----------------------------------------------+
233 | SALOMEDS_Attributes_        |                                               |
234 +-----------------------------+-----------------------------------------------+
235
236 High speed transfer, object life cycle, exceptions, GUI interface...
237 --------------------------------------------------------------------
238
239 +-----------------------------+-----------------------------------------------+
240 | SALOME_                     | SALOME CORBA module                           |
241 +=============================+===============================================+
242 | SALOME_Comm_                |                                               |
243 +-----------------------------+-----------------------------------------------+
244 | SALOME_GenericObj_          |                                               |
245 +-----------------------------+-----------------------------------------------+
246 | SALOME_Exception_           |                                               |
247 +-----------------------------+-----------------------------------------------+
248 | SALOME_Session_             |                                               |
249 +-----------------------------+-----------------------------------------------+
250
251 Miscelleanous
252 -------------
253 +-----------------------------+-----------------------------------------------+
254 |                             | other CORBA modules                           |
255 +=============================+===============================================+
256 | SALOME_ModuleCatalog_       |                                               |
257 +-----------------------------+-----------------------------------------------+
258 | SALOME_RessourcesCatalog_   |                                               |
259 +-----------------------------+-----------------------------------------------+
260 | SALOME_Registry_            |                                               |
261 +-----------------------------+-----------------------------------------------+
262 | Logger_                     |                                               |
263 +-----------------------------+-----------------------------------------------+
264
265 **Other idl for test purposes**
266 nstest.idl
267 SALOME_TestComponent.idl
268 SALOME_TestModuleCatalog.idl
269 SALOME_TestMPIComponent.idl
270 TestNotif.idl
271
272 .. _Engines:           ./tui/KERNEL/namespaceEngines.html
273 .. _Component:         ./tui/KERNEL/interfaceEngines_1_1Component.html
274 .. _Container:         ./tui/KERNEL/interfaceEngines_1_1Container.html
275 .. _fileTransfer:      ./tui/KERNEL/interfaceEngines_1_1fileTransfer.html
276 .. _fileRef:           ./tui/KERNEL/interfaceEngines_1_1fileRef.html
277 .. _ContainerManager:  ./tui/KERNEL/interfaceEngines_1_1ContainerManager.html
278 .. _MPIContainer:      ./tui/KERNEL/interfaceEngines_1_1MPIContainer.html
279 .. _MPIObject:         ./tui/KERNEL/interfaceEngines_1_1MPIObject.html
280 .. _SALOME:                   ./tui/KERNEL/namespaceSALOME.html
281 .. _SALOMEDS:                 ./tui/KERNEL/namespaceSALOMEDS.html
282 .. _SALOME_Component:         ./tui/KERNEL/SALOME__Component_8idl.html
283 .. _SALOME_ContainerManager:  ./tui/KERNEL/SALOME__ContainerManager_8idl.html
284 .. _SALOMEDSidl:              ./tui/KERNEL/SALOMEDS_8idl.html
285 .. _SALOMEDS_Attributes:      ./tui/KERNEL/SALOMEDS__Attributes_8idl.html
286 .. _SALOME_ModuleCatalog:     ./tui/KERNEL/SALOME__ModuleCatalog_8idl.html
287 .. _SALOME_RessourcesCatalog: ./tui/KERNEL/SALOME__RessourcesCatalog_8idl.html
288 .. _SALOME_Registry:          ./tui/KERNEL/SALOME__Registry_8idl.html
289 .. _Logger:                   ./tui/KERNEL/Logger_8idl.html
290 .. _SALOME_Comm:              ./tui/KERNEL/SALOME__Comm_8idl.html
291 .. _SALOME_GenericObj:        ./tui/KERNEL/SALOME__GenericObj_8idl.html
292 .. _SALOME_Exception:         ./tui/KERNEL/SALOME__Exception_8idl.html
293 .. _SALOME_Session:           ./tui/KERNEL/SALOME__Session_8idl.html
294 .. _SALOME_MPIContainer:      ./tui/KERNEL/SALOME__MPIContainer_8idl.html
295 .. _SALOME_MPIObject:         ./tui/KERNEL/SALOME__MPIObject_8idl.html
296
297
298 -------------------------------------------------------------------------------
299
300 +----------------------------------+------------------------------------------+
301 | `General KERNEL documentation`_  | `End User KERNEL Doxygen documentation`_ |
302 +----------------------------------+------------------------------------------+
303
304 .. _`General KERNEL documentation`:           ./index.html
305 .. _`End User KERNEL Doxygen documentation`:  ./tui/KERNEL/index.html