1 =================================================================
2 KERNEL Services for end user (Python interface)
3 =================================================================
5 *html version of this document is produced with docutils*::
7 rst2html < doc.txt > doc.html
9 This document corresponds to SALOME2 3.2.0
14 +-------------------------------------------+
15 | **WORK in PROGRESS, INCOMPLETE DOCUMENT** |
16 +-------------------------------------------+
18 -------------------------------------------------------------------------------
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.
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
31 General purpose services
32 ========================
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.
39 .. _SALOME_Application: ./SALOME_Application.txt
41 You can use the embedded Python interpreter in Grahic User Interface, or an
42 external interpreter, with::
47 In either cases, SALOME services access is done with::
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.
56 Container and component instanciation
57 -------------------------------------
59 See LifeCycleCORBA_ for the C++ interface (Python interface obtained with SWIG
62 .. _LifeCycleCORBA: ./tui/KERNEL/classSALOME__LifeCycleCORBA.html
65 In the following example, a test component provided in KERNEL is launched
66 in the local container, "FactoryServer", created when SALOME starts::
72 lcc = LifeCycleCORBA.LifeCycleCORBA()
73 obj=lcc.FindOrLoad_Component("FactoryServer","SalomeTestComponent")
76 comp=obj._narrow(Engines.TestComponent)
80 The answer is something like::
82 'TestComponent_i : L = 1'
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::
91 .. _Testcomponent: ./tui/KERNEL/interfaceEngines_1_1TestComponent.html
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::
103 import LifeCycleCORBA
104 lcc = LifeCycleCORBA.LifeCycleCORBA()
106 import Utils_Identity
107 host = Utils_Identity.getShortHostName()
111 params['hostname']=host
112 params['container_name']='myContainer'
113 comp=lcc.LoadComponent(params,'SalomeTestComponent')
116 .. _Utils_Identity: ./tui/KERNEL/namespaceUtils__Identity.html
118 If you want to get a list of containers and component instances, client object
119 from orbmodule_ provides a list::
122 clt=orbmodule.client()
125 .. _orbmodule: ./tui/KERNEL/classorbmodule_1_1client.html
127 The list looks like::
130 ContainerManager.object
133 FactoryServerPy.object
134 SuperVisionContainer.object
137 SalomeTestComponent_inst_1.object
140 SalomeTestComponent_inst_1.object
141 SalomeTestComponent_inst_2.object
151 myStudyManager.object
152 SalomeAppEngine.object
155 File transfer service
156 ---------------------
158 See FileTransferCORBA_ for the C++ interface (Python interface obtained with
159 SWIG is very similar).
161 .. _FileTransferCORBA: ./tui/KERNEL/classSALOME__FileTransferCORBA.html
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::
172 import LifeCycleCORBA
173 remotefile="/home/prascle/tkcvs_8_0_3.tar.gz"
174 aFileTransfer=LifeCycleCORBA.SALOME_FileTransferCORBA('cli76cc',remotefile)
175 localFile=aFileTransfer.getLocalFile()
178 CORBA Naming service access
179 ---------------------------
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.
185 .. _SALOME_NamingService: ./tui/KERNEL/classSALOME__NamingService.html
186 .. _SALOME_NamingServicePy: ./tui/KERNEL/classSALOME__NamingServicePy_1_1SALOME__NamingServicePy__i.html
191 See Batch_ documentation (in french only).
193 .. _Batch: ./Batch.html/index.html
198 Containers and component life cycle, File transfer service
199 ----------------------------------------------------------
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 |
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 +-----------------------------+-----------------------------------------------+
223 +-----------------------------+-----------------------------------------------+
228 +-----------------------------+-----------------------------------------------+
229 | SALOMEDS_ | SALOMEDS CORBA module |
230 +=============================+===============================================+
232 +-----------------------------+-----------------------------------------------+
233 | SALOMEDS_Attributes_ | |
234 +-----------------------------+-----------------------------------------------+
236 High speed transfer, object life cycle, exceptions, GUI interface...
237 --------------------------------------------------------------------
239 +-----------------------------+-----------------------------------------------+
240 | SALOME_ | SALOME CORBA module |
241 +=============================+===============================================+
243 +-----------------------------+-----------------------------------------------+
244 | SALOME_GenericObj_ | |
245 +-----------------------------+-----------------------------------------------+
246 | SALOME_Exception_ | |
247 +-----------------------------+-----------------------------------------------+
248 | SALOME_Session_ | |
249 +-----------------------------+-----------------------------------------------+
253 +-----------------------------+-----------------------------------------------+
254 | | other CORBA modules |
255 +=============================+===============================================+
256 | SALOME_ModuleCatalog_ | |
257 +-----------------------------+-----------------------------------------------+
258 | SALOME_RessourcesCatalog_ | |
259 +-----------------------------+-----------------------------------------------+
260 | SALOME_Registry_ | |
261 +-----------------------------+-----------------------------------------------+
263 +-----------------------------+-----------------------------------------------+
265 **Other idl for test purposes**
267 SALOME_TestComponent.idl
268 SALOME_TestModuleCatalog.idl
269 SALOME_TestMPIComponent.idl
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
298 -------------------------------------------------------------------------------
300 +----------------------------------+------------------------------------------+
301 | `General KERNEL documentation`_ | `End User KERNEL Doxygen documentation`_ |
302 +----------------------------------+------------------------------------------+
304 .. _`General KERNEL documentation`: ./index.html
305 .. _`End User KERNEL Doxygen documentation`: ./tui/KERNEL/index.html