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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
22 // File : SALOME_Component.idl
23 // Author : Paul RASCLE, EDF
26 #ifndef _SALOME_COMPONENT_IDL_
27 #define _SALOME_COMPONENT_IDL_
30 This is a package of interfaces used for connecting new components to %SALOME
31 application. It also contains a set of interfaces used for management of %MED
32 component in %SALOME application.
37 A byte stream which is used for binary data transfer between different
40 typedef sequence<octet> TMPFile;
43 General Key Value Structure to set or get properties, for component
51 typedef sequence<KeyValuePair> FieldsDict;
55 interface fileTransfer ;
57 /*! \brief Interface of the %Container
58 This interface defines the process of loading and registration
59 of new components in %SALOME application
66 Loads a new component class (dynamic library).
67 \param componentName like COMPONENT, (Python or C++ implementation)
68 try to make a Python import of COMPONENT,
69 then a lib open of libCOMPONENTEngine.so
70 \return true if load successfull or already done, false otherwise
72 boolean load_component_Library(in string componentName);
75 Creates a new servant instance of a component.
76 Component library must be loaded.
77 \param componentName Name of the component which will be registered
78 in Registry and Name Service,
79 (instance number suffix added to the registered name)
80 \param studyId 0 if instance is not associated to a study,
81 >0 otherwise (== study id)
82 \return a loaded component
84 Component create_component_instance(in string componentName,
88 Finds a servant instance of a component
89 \param registeredName Name of the component in Registry or Name Service,
90 without instance suffix number
91 \param studyId 0 if instance is not associated to a study,
92 >0 otherwise (== study id)
93 \return the first instance found with same studyId
95 Component find_component_instance(in string registeredName,
99 Find a servant instance of a component, or create a new one.
100 Loads the component library if needed.
101 Only applicable to multiStudy components.
102 \param nameToRegister Name of the component which will be registered
103 in Registry (or Name Service)
104 \param componentName Name of the constructed library of the %component
105 (not used any more, give empty string)
106 \return a loaded component
108 Component load_impl(in string nameToRegister,
109 in string componentName);
112 Stops the component servant, and deletes all related objects
113 \param component_i Component to be removed
115 void remove_impl(in Component component_i);
118 Discharges all components from the container.
120 void finalize_removal() ;
123 Determines whether the server has been loaded or not.
128 Name of the %container
130 readonly attribute string name ;
133 Shutdown the Container process.
135 oneway void Shutdown();
138 Returns the hostname of the container
140 string getHostName();
143 Returns the PID of the container
148 Returns True if the %container has been killed.
149 Kept for Superv compilation but can't work, unless oneway...
152 boolean Kill_impl() ;
155 returns a fileRef object if origFileName exists and is readable
156 else returns null object. Only one fileRef is created for a given
157 file name, so, several calls with the same file name returns the
160 fileRef createFileRef(in string origFileName);
163 returns a fileTransfer object used to copy files from the container
164 machine to the clients machines. Only one fileTransfer instance is
165 created in a container.
167 fileTransfer getFileTransfer();
173 /*! \brief Interface of the %component
174 This interface is used for interaction between the %container and the
175 %component and between the components inside the container.
180 The name of the instance of the %Component
182 readonly attribute string instanceName ;
185 The name of the interface of the %Component
187 readonly attribute string interfaceName ;
190 Determines whether the server has already been loaded or not.
195 // Set study associated to component instance
197 // (=0: multistudy component instance,
198 // >0: study id associated to this instance
199 // \return false if already set with a different value (change not possible)
201 // boolean setStudyId(in long studyId);
204 get study associated to component instance
205 \return -1: not initialised (Internal Error)
206 0: multistudy component instance
207 >0: study id associated to this instance
212 Deactivates the %Component.
213 -- TO BE USED BY CONTAINER ONLY (Container housekeeping) --
214 use remove_impl from Container instead !
219 Returns the container that the %Component refers to.
221 Container GetContainerRef() ;
224 Gives a sequence of (key=string,value=any) to the component.
225 Base class component stores the sequence in a map.
226 The map is cleared before.
227 This map is for use by derived classes.
229 void setProperties(in FieldsDict dico);
232 returns a previously stored map (key=string,value=any) as a sequence.
233 See setProperties(in FieldsDict dico).
235 FieldsDict getProperties();
238 This method is used by the %SUPERVISOR component. It sets the names of
239 the graph and of the node.
240 \param aGraphName Name of graph
241 \param aNodeName Name of node
243 void Names( in string aGraphName , in string aNodeName ) ;
246 Returns True if the %Component has been killed.
248 boolean Kill_impl() ;
251 Returns True if the activity of the %Component has been stopped.
252 (It's action can't be resumed)
254 boolean Stop_impl() ;
257 Returns True if the activity of the %Component has been suspended.
258 (It's action can be resumed)
260 boolean Suspend_impl() ;
263 Returns True if the activity of the %Component has been resumed.
265 boolean Resume_impl() ;
268 Returns the Cpu used (long does not run with python !...)
270 long CpuUsed_impl() ;
273 Returns a python script, which is being played back reproduces
274 the data model of component
276 TMPFile DumpPython(in Object theStudy,
277 in boolean isPublished,
278 out boolean isValidScript);
282 typedef sequence<octet> fileBlock;
285 file transfer object. open method returns a key (fileId) that identifies
286 the structure (ex: C FILE) on the server, created for transfer.
288 interface fileTransfer
290 long open(in string fileName);
292 void close(in long fileId);
294 fileBlock getBlock(in long fileId);
298 A fileRef object is associated to an original file (origFileName) on a
299 machine (refMachine).
300 It is created by a container (factoryServer) on refMachine,
301 with createFileRef(in string origFileName) method.
302 fileRef object maintains a list of (machine,filename) for copies.
303 If a copy exists on myMachine, getRef(myMachine) returns the file name
304 of the copy on myMachine, else returns empy string.
305 If there is no copy on myMachine, method getFileTransfer() from container
306 factoryServer on refMachine provides a fileTransfer object dedicated to
308 After the copy, addRef(myMachine, localFileNameOnMyMachine) registers
309 the file name of the copy on myMachine.
313 readonly attribute string origFileName;
314 readonly attribute string refMachine;
316 Container getContainer();
318 boolean addRef(in string machine,
321 string getRef(in string machine);