]> SALOME platform Git repositories - modules/kernel.git/blob - doc/KERNEL_Services.txt
Salome HOME
PR: documentation modifications
[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 (beta version)
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 CORBA Naming service access
164 ---------------------------
165
166 See SALOME_NamingService_ for the C++ interface (Python interface obtained with
167 SWIG is very similar).
168
169 .. _SALOME_NamingService: ./tui/KERNEL/classSALOME__NamingService.html
170
171 Batch services
172 --------------
173
174 See Batch_ documentation (in french only).
175
176 .. _Batch: ./Batch.html/index.html
177
178 All IDL Interfaces
179 ==================
180
181 +-----------------------------+-----------------------------------------------+
182 | Engines_                    | Engines CORBA module.                         |
183 |                             | Containers and component life cycle,          |
184 |                             | File transfer service                         |
185 +=============================+===============================================+
186 | Component_                  | Generic component interface.                  |
187 |                             | All SALOME components inherit this interface  |
188 +-----------------------------+-----------------------------------------------+
189 | Container_                  | Container: host for C++ and Python components |
190 |                             | components instances                          |
191 +-----------------------------+-----------------------------------------------+
192 | FileTransfer_               | Agent for file transfer created by a container|
193 |                             | copy a local file to a distent client         |
194 +-----------------------------+-----------------------------------------------+
195 | FileRef_                    | Reference to a file, used by a container for  |
196 |                             | file transfers                                |
197 +-----------------------------+-----------------------------------------------+
198 | ContainerManager_           | Unique instance, in charge of container       |
199 |                             | creation on remote computers                  |
200 +-----------------------------+-----------------------------------------------+
201 | MPIContainer_               | An exemple of parallel implementation for     |
202 |                             | containers and components                     |
203 +-----------------------------+-----------------------------------------------+
204 | MPIObject_                  |                                               |
205 +-----------------------------+-----------------------------------------------+
206
207 +-----------------------------+-----------------------------------------------+
208 | SALOMEDS_                   | SALOMEDS CORBA module                         |
209 +=============================+===============================================+
210 | SALOMEDSidl_                |                                               |
211 +-----------------------------+-----------------------------------------------+
212 | SALOMEDS_Attributes_        |                                               |
213 +-----------------------------+-----------------------------------------------+
214
215 +-----------------------------+-----------------------------------------------+
216 | SALOME_                     | SALOME CORBA module                           |
217 +=============================+===============================================+
218 | SALOME_Comm_                |                                               |
219 +-----------------------------+-----------------------------------------------+
220 |SALOME_GenericObj_           |                                               |
221 +-----------------------------+-----------------------------------------------+
222 |SALOME_Exception_            |                                               |
223 +-----------------------------+-----------------------------------------------+
224 | SALOME_Session_             |                                               |
225 +-----------------------------+-----------------------------------------------+
226
227 +-----------------------------+-----------------------------------------------+
228 |                             | other CORBA modules                           |
229 +=============================+===============================================+
230 | SALOME_ModuleCatalog_       |                                               |
231 +-----------------------------+-----------------------------------------------+
232 | SALOME_RessourcesCatalog_   |                                               |
233 +-----------------------------+-----------------------------------------------+
234 | SALOME_Registry_            |                                               |
235 +-----------------------------+-----------------------------------------------+
236 | Logger_                     |                                               |
237 +-----------------------------+-----------------------------------------------+
238
239 **Other idl for test purposes**
240 nstest.idl
241 SALOME_TestComponent.idl
242 SALOME_TestModuleCatalog.idl
243 SALOME_TestMPIComponent.idl
244 TestNotif.idl
245
246 .. _Engines:           ./tui/KERNEL/namespaceEngines.html
247 .. _Component:         ./tui/KERNEL/interfaceEngines_1_1Component.html
248 .. _Container:         ./tui/KERNEL/interfaceEngines_1_1Container.html
249 .. _fileTransfer:      ./tui/KERNEL/interfaceEngines_1_1fileTransfer.html
250 .. _fileRef:           ./tui/KERNEL/interfaceEngines_1_1fileRef.html
251 .. _ContainerManager:  ./tui/KERNEL/interfaceEngines_1_1ContainerManager.html
252 .. _MPIContainer:      ./tui/KERNEL/interfaceEngines_1_1MPIContainer.html
253 .. _MPIObject:         ./tui/KERNEL/interfaceEngines_1_1MPIObject.html
254 .. _SALOME:                   ./tui/KERNEL/namespaceSALOME.html
255 .. _SALOMEDS:                 ./tui/KERNEL/namespaceSALOMEDS.html
256 .. _SALOME_Component:         ./tui/KERNEL/SALOME__Component_8idl.html
257 .. _SALOME_ContainerManager:  ./tui/KERNEL/SALOME__ContainerManager_8idl.html
258 .. _SALOMEDSidl:              ./tui/KERNEL/SALOMEDS_8idl.html
259 .. _SALOMEDS_Attributes:      ./tui/KERNEL/SALOMEDS__Attributes_8idl.html
260 .. _SALOME_ModuleCatalog:     ./tui/KERNEL/SALOME__ModuleCatalog_8idl.html
261 .. _SALOME_RessourcesCatalog: ./tui/KERNEL/SALOME__RessourcesCatalog_8idl.html
262 .. _SALOME_Registry:          ./tui/KERNEL/SALOME__Registry_8idl.html
263 .. _Logger:                   ./tui/KERNEL/Logger_8idl.html
264 .. _SALOME_Comm:              ./tui/KERNEL/SALOME__Comm_8idl.html
265 .. _SALOME_GenericObj:        ./tui/KERNEL/SALOME__GenericObj_8idl.html
266 .. _SALOME_Exception:         ./tui/KERNEL/SALOME__Exception_8idl.html
267 .. _SALOME_Session:           ./tui/KERNEL/SALOME__Session_8idl.html
268 .. _SALOME_MPIContainer:      ./tui/KERNEL/SALOME__MPIContainer_8idl.html
269 .. _SALOME_MPIObject:         ./tui/KERNEL/SALOME__MPIObject_8idl.html
270
271
272 -------------------------------------------------------------------------------
273
274 +----------------------------------+------------------------------------------+
275 | `General KERNEL documentation`_  | `End User KERNEL Doxygen documentation`_ |
276 +----------------------------------+------------------------------------------+
277
278 .. _`General KERNEL documentation`:           ./index.html
279 .. _`End User KERNEL Doxygen documentation`:  ./tui/KERNEL/index.html