1 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License.
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // File : SALOME_Component.idl
23 // Author : Paul RASCLE, EDF
26 #ifndef _SALOME_COMPONENT_IDL_
27 #define _SALOME_COMPONENT_IDL_
29 #include "SALOME_Exception.idl"
32 This is a package of interfaces used for connecting new components to %SALOME
33 application. It also contains a set of interfaces used for management of %MED
34 component in %SALOME application.
39 A byte stream which is used for binary data transfer between different
42 typedef sequence<octet> TMPFile;
45 General Key Value Structure to set or get properties, for component
53 typedef sequence<KeyValuePair> FieldsDict;
57 interface fileTransfer ;
58 interface Salome_file;
60 /*! \brief Interface of the %Container.
61 This interface defines the process of loading and registration
62 of new components in %SALOME application
69 Loads a new component class (dynamic library).
70 \param componentName like COMPONENT, (Python or C++ implementation)
71 try to make a Python import of COMPONENT,
72 then a lib open of libCOMPONENTEngine.so
73 \return true if load successfull or already done, false otherwise
75 boolean load_component_Library(in string componentName);
78 Creates a new servant instance of a component.
79 Component library must be loaded.
80 \param componentName Name of the component which will be registered
81 in Registry and Name Service,
82 (instance number suffix added to the registered name)
83 \param studyId 0 if instance is not associated to a study,
84 >0 otherwise (== study id)
85 \return a loaded component
87 Engines::Component create_component_instance(in string componentName,
91 Finds a servant instance of a component
92 \param registeredName Name of the component in Registry or Name Service,
93 without instance suffix number
94 \param studyId 0 if instance is not associated to a study,
95 >0 otherwise (== study id)
96 \return the first instance found with same studyId
98 Component find_component_instance(in string registeredName,
102 Find a servant instance of a component, or create a new one.
103 Loads the component library if needed.
104 Only applicable to multiStudy components.
105 \param nameToRegister Name of the component which will be registered
106 in Registry (or Name Service)
107 \param componentName Name of the constructed library of the %component
108 (not used any more, give empty string)
109 \return a loaded component
111 Component load_impl(in string nameToRegister,
112 in string componentName);
115 Stops the component servant, and deletes all related objects
116 \param component_i Component to be removed
118 void remove_impl(in Component component_i);
121 Discharges all components from the container.
123 void finalize_removal() ;
126 Determines whether the server has been loaded or not.
131 Name of the %container
133 readonly attribute string name ;
136 working directory of the %container
138 readonly attribute string workingdir ;
141 name of the %container log file (this has been set by the launcher)
143 attribute string logfilename ;
146 Shutdown the Container process.
151 Returns the hostname of the container
153 string getHostName();
156 Returns the PID of the container
161 Returns True if the %container has been killed.
162 Kept for Superv compilation but can't work, unless oneway...
165 boolean Kill_impl() ;
168 returns a fileRef object if origFileName exists and is readable
169 else returns null object. Only one fileRef is created for a given
170 file name, so, several calls with the same file name returns the
173 fileRef createFileRef(in string origFileName);
176 returns a Salome_file object if origFileName exists and is readable
177 else returns null object.
179 \param origFileName name of the file to be managed (can contain the path).
181 \return Salome_file CORBA reference.
183 Salome_file createSalome_file(in string origFileName);
186 returns a fileTransfer object used to copy files from the container
187 machine to the clients machines. Only one fileTransfer instance is
188 created in a container.
190 fileTransfer getFileTransfer();
194 /*! \brief Interface of the %component.
195 This interface is used for interaction between the %container and the
196 %component and between the components inside the container.
201 The name of the instance of the %Component
203 readonly attribute string instanceName ;
206 The name of the interface of the %Component
208 readonly attribute string interfaceName ;
211 Determines whether the server has already been loaded or not.
216 // Set study associated to component instance
218 // (=0: multistudy component instance,
219 // >0: study id associated to this instance
220 // \return false if already set with a different value (change not possible)
222 // boolean setStudyId(in long studyId);
225 get study associated to component instance
226 \return -1: not initialised (Internal Error)
227 0: multistudy component instance
228 >0: study id associated to this instance
233 Deactivates the %Component.
234 -- TO BE USED BY CONTAINER ONLY (Container housekeeping) --
235 use remove_impl from Container instead !
240 Returns the container that the %Component refers to.
242 Container GetContainerRef() ;
245 Gives a sequence of (key=string,value=any) to the component.
246 Base class component stores the sequence in a map.
247 The map is cleared before.
248 This map is for use by derived classes.
250 void setProperties(in FieldsDict dico);
253 returns a previously stored map (key=string,value=any) as a sequence.
254 See setProperties(in FieldsDict dico).
256 FieldsDict getProperties();
259 This method is used by the %SUPERVISOR component. It sets the names of
260 the graph and of the node.
261 \param aGraphName Name of graph
262 \param aNodeName Name of node
264 void Names( in string aGraphName , in string aNodeName ) ;
267 Returns True if the %Component has been killed.
269 boolean Kill_impl() ;
272 Returns True if the activity of the %Component has been stopped.
273 (It's action can't be resumed)
275 boolean Stop_impl() ;
278 Returns True if the activity of the %Component has been suspended.
279 (It's action can be resumed)
281 boolean Suspend_impl() ;
284 Returns True if the activity of the %Component has been resumed.
286 boolean Resume_impl() ;
289 Returns the Cpu used (long does not run with python !...)
291 long CpuUsed_impl() ;
294 Returns a python script, which is being played back reproduces
295 the data model of component
297 TMPFile DumpPython(in Object theStudy,
298 in boolean isPublished,
299 out boolean isValidScript);
303 Returns a CORBA Ref of a input Salome_file managed by a service.
305 \param service_name service's name.
306 \param file_name name of the requested file.
308 \return CORBA Ref of the requested file.
310 \exception contains informations of what if the component cannot
311 sends the file's reference.
313 Engines::Salome_file getInputFileToService(in string service_name,
314 in string Salome_file_name) raises(SALOME::SALOME_Exception);
317 This method is used before the activation of the service. It calls
318 recvFiles() on all the input Salome_file files of the service.
320 Before each recvFiles(), it uses the callback method named configureSalome_file.
321 This method allows the user to configure the files managed by the Salome_file.
323 By default, there is no files managed when a Salome_file is created,
324 but the supervisor set some files managed by the Salome_file from the information contained
325 into the schema file.
327 \param service_name service's name.
329 \exception contains informations about files that are not in a good state.
331 void checkInputFilesToService(in string service_name) raises(SALOME::SALOME_Exception);
334 This method adds a input Salome_file to a service of the component.
336 \param service_name service's name.
337 \param Salome_file_name name of the Salome_file
339 \return a reference of the Salome_file
341 \exception raises an exception if there is already
342 a Salome_file with this name for the service.
344 Engines::Salome_file setInputFileToService(in string service_name,
345 in string Salome_file_name) raises(SALOME::SALOME_Exception);
348 Returns a CORBA Ref of a output Salome_file managed by a service.
350 \param service_name service's name.
351 \param file_name name of the requested file.
353 \return CORBA Ref of the requested file.
355 \exception contains informations of what if the component cannot
356 sends the file's reference.
358 Engines::Salome_file getOutputFileToService(in string service_name,
359 in string Salome_file_name) raises(SALOME::SALOME_Exception);
362 This method is used at the end of the service. It calls
363 recvFiles() on all the output Salome_file files of the service.
365 Before each recvFiles(), it uses the callback method named configureSalome_file.
366 This method allows the user to configure the files managed by the Salome_file.
368 By default, there is no files managed when a Salome_file is created,
369 but the supervisor set some files managed by the Salome_file from the information contained
370 into the schema file.
372 \param service_name service's name.
374 \exception contains informations about files that are not in a good state.
376 void checkOutputFilesToService(in string service_name) raises(SALOME::SALOME_Exception);
379 This method adds an output Salome_file to a service of the component.
381 \param service_name service's name.
382 \param Salome_file_name name of the Salome_file
384 \return a reference of the Salome_file
386 \exception raises an exception if there is already
387 a Salome_file with this name for the service.
389 Engines::Salome_file setOutputFileToService(in string service_name,
390 in string Salome_file_name) raises(SALOME::SALOME_Exception);
393 interface Parallel_Component : Engines::Component {
394 void send_parallel_proxy_object(in Object proxy_ref);
398 A block of binary data used for file transfer. The maximum size of the
399 block is defined on server side.
401 typedef sequence<octet> fileBlock;
403 /*! \brief Interface of fileTransfer.
404 The fileTransfer and fileRef interfaces provide a file transfer service
405 between different computers.
407 interface fileTransfer
410 open method returns a key (fileId) that identifies the structure
411 (ex: C FILE), associated to the original file on the server.
412 The structure is created by a container for transfer of files availables
413 on the computer which runs the container.
414 Each open gives a unique fileId, to allow concurrent reads of the same
417 long open(in string fileName);
420 when the file transfer is finished, close method releases structures
421 created by open method, identified by fileId.
423 void close(in long fileId);
426 Get successive blocks of octets from the original file.
427 The last block is empty, and identifies the end of file.
429 fileBlock getBlock(in long fileId);
433 This is a file managed by a Salome_file. It contains file's name, path and status.
434 The status is : "present" or "notpresent".
440 string source_file_name;
443 Engines::Container container;
447 A sequence of Engines::file.
449 typedef sequence<Engines::file> files;
453 It is the state of a Salome_file. It contains the Salome_file's name, the name
454 of the hdf5 file where it can be saved, the number of files managed and the information
455 if all the files are received.
459 string hdf5_file_name;
460 long number_of_files;
464 /*! \brief Interface of a Salome_file managed
465 This file is independent of a Salome module. It can managed one or more
466 real files. It's useful for parallel files. Currently Salome_file cannot manage
467 two files that have the same name but not the same path.
469 interface Salome_file : Engines::fileTransfer
472 Load a Salome_file from a hdf5 file.
474 \param hdf5_file name (with path) of the hdf5_file.
476 \exception contains informations of errors if the loading doesn't succeed.
478 void load(in string hdf5_file) raises (SALOME::SALOME_Exception);
481 Save a Salome_file into a hdf5_file.
483 \param hdf5_file name (with path) of the hdf5_file.
485 \exception contains informations of errors if the save doesn't succeed.
488 void save(in string hdf5_file) raises (SALOME::SALOME_Exception);
491 Save a Salome_file into a hdf5_file. All files that are managed
492 are saved into the hdf5_file
494 \param hdf5_file name (with path) of the hdf5_file.
496 \exception contains informations of errors if the save doesn't succeed.
499 void save_all(in string hdf5_file) raises (SALOME::SALOME_Exception);
504 Add a Local file to the Salome_file.
506 \param file_name name of the file with the path.
508 \exception raised if the file is already added into the Salome_file.
510 void setLocalFile(in string comp_file_name) raises (SALOME::SALOME_Exception);
513 Add a Distributed file to the Salome_file.
515 \param comp_file_name name of the file with the path.
517 \exception raised if the file is already added into the Salome_file.
519 void setDistributedFile(in string comp_file_name) raises (SALOME::SALOME_Exception);
522 Connect a Salome_file with another Salome_file.
523 It works only if the Salome_file managed only one file
525 \param source_Salome_file Salome_file that managed the distributed version of the file.
527 \exception raised if there is more or less than one file.
529 void connect(in Engines::Salome_file source_Salome_file) raises (SALOME::SALOME_Exception);
532 Connect the managed file file_name to a Salome_file.
534 \param file_name name of the file without the path.
535 \param source_Salome_file Salome_file that managed the distributed version of the file.
537 \exception raised if the file doesn't exist.
539 void connectDistributedFile(in string file_name,
540 in Engines::Salome_file source_Salome_file) raises (SALOME::SALOME_Exception);
543 Connect the file_name with a Distributed file_name.
545 \param file_name name of the file without the path.
546 \param source_file_name It's the name of the file managed by the distributed source Salome_file.
548 \exception raised if the file doesn't exist.
550 void setDistributedSourceFile(in string file_name,
551 in string source_file_name) raises (SALOME::SALOME_Exception);
556 Get all the distributed files managed by the Salome_file and
557 check all the local files.
559 \exception raised if some of the files are not ok.
561 void recvFiles() raises (SALOME::SALOME_Exception) ;
566 Remove a file of the Salome_file.
568 \param file_name name of the file.
570 \exception raised if the file doesn't exist.
572 void removeFile(in string file_name) raises (SALOME::SALOME_Exception);
575 Remove all the files of the Salome_file.
582 Get the list of the files managed by the Salome_file.
583 The list can be empty.
585 Engines::files getFilesInfos();
588 Get a file managed by the Salome_file.
590 \param file_name the name of the file.
592 \return CORBA file reference.
594 \exception raised if the file doesn't exist.
596 Engines::file getFileInfos(in string file_name) raises (SALOME::SALOME_Exception);
599 Return the state of the Salome_file.
601 Engines::SfState getSalome_fileState();
605 Set the container where files are.
607 \param container container CORBA's reference.
609 void setContainer(in Engines::Container container);
612 /*! \brief Interface of fileRef.
613 The fileTransfer and fileRef interfaces provide a file transfer service
614 between different computers.
616 A fileRef object is associated to an original file (origFileName) on a
617 machine (refMachine).
618 It is created by a container (factoryServer) on refMachine,
619 with createFileRef(in string origFileName) method.
620 The fileRef object maintains a list of (machine,filename) for copies.
621 If a copy exists on myMachine, getRef(myMachine) returns the file name
622 of the copy on myMachine, else returns empy string.
623 If there is no copy on myMachine, method getFileTransfer() from container
624 factoryServer on refMachine provides a fileTransfer object dedicated to
626 After the copy, addRef(myMachine, localFileNameOnMyMachine) registers
627 the file name of the copy on myMachine.
631 readonly attribute string origFileName;
632 readonly attribute string refMachine;
634 Container getContainer();
636 boolean addRef(in string machine,
639 string getRef(in string machine);
642 /*! \brief Interface of a Parallel_Salome_file
643 This interface is used by parallel components and containers.
644 It adds methods to enable to choose on which node of the parallel component the file has to
647 interface Parallel_Salome_file : Engines::Salome_file {
650 Set a number of node for the file. Default is the node 0.
652 \param file_name name of the file.
653 \param node_nbr node number where the file is.
655 \exception raised if the file doesn't exist.
657 void setFileNode(in string file_name, in long node_nbr) raises (SALOME::SALOME_Exception);
660 Get the number of the node that actually managed the file.
662 \param file_name name of managed file.
664 \return node number of the file
666 \exception raised if the file doesn't exist.
668 long getFileNode(in string file_name) raises (SALOME::SALOME_Exception);
671 This method update the state of file for the Parallel_Salome_file.
673 \param new_file the new state of file.
675 Engines::Container updateFile(in Engines::file new_file);
678 This method is used by the parallel implementation of recvFiles.
680 \exception raised if the file cannot be ok.
682 void recvFiles_node() raises (SALOME::SALOME_Exception);