Salome HOME
[EDF29852] : Mecanism of fault tolerant in SALOME_Container to resist against emitted...
[modules/kernel.git] / idl / SALOME_Component.idl
index d7461809447b2d153506addd366f4bfd1718b9dc..f3143884467cb95447eedd64fbbbd75c4f5f2723 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2024  CEA, EDF, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -6,7 +6,7 @@
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -19,6 +19,7 @@
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+
 //  File   : SALOME_Component.idl
 //  Author : Paul RASCLE, EDF
 
 #include "SALOMEDS.idl"
 #include "SALOME_Exception.idl"
 #include "SALOME_PyNode.idl"
+#include "SALOME_Embedded_NamingService.idl"
+#include "SALOME_Comm.idl"
 
 /*! \file SALOME_Component.idl \brief interfaces for EngineComponent and Container
 */
 
 /*! \brief
 This is a package of interfaces used for connecting new components to %SALOME
-application. It also contains a set of interfaces used for management of %MED
+application. It also contains a set of interfaces used for management of %FIELDS
 component in %SALOME application.
 */
 module Engines
 {
-  /*! 
+  /*!
     A byte stream which is used for binary data transfer between different
     components
   */
-  typedef sequence<octet> TMPFile;  
-  
+  typedef sequence<octet> TMPFile;
+
   //!  General Key Value Structure to set or get properties, for component
   struct KeyValuePair
   {
@@ -53,24 +56,22 @@ module Engines
     any value;
   };
 
-  //!  Structure data type to hold reference on data 
+  //!  Structure data type to hold reference on data
   struct dataref
   {
     string ref;
   };
 
   typedef sequence<KeyValuePair> FieldsDict;
-  typedef sequence<string> ListOfOptions;
-  typedef sequence<string> ListOfIdentifiers;
+  typedef sequence<double> vectorOfDouble;
+  typedef sequence<string> vectorOfString;
+  typedef sequence<vectorOfString> vectorOfVectorOfString;
 
   interface EngineComponent ;
   interface fileRef ;
   interface fileTransfer ;
   interface Salome_file;
-  interface DataContainer;
 
-  typedef sequence<DataContainer> ListOfData;
-  
   /*! \brief Interface of the %Container.
   This interface defines the process of loading and registration
   of new components in %SALOME application
@@ -79,13 +80,25 @@ module Engines
   interface Container
   {
 
+    void override_environment( in FieldsDict env );
+
+    void override_environment_python( in FieldsDict env );
+
+    FieldsDict get_os_environment();
+
+    void addLogFileNameGroup(in vectorOfString groupOfLogFileNames);
+    
+    vectorOfVectorOfString getAllLogFileNameGroups();
+
+    void execute_python_code( in string code ) raises(SALOME::SALOME_Exception);
+
     /*! \brief Loads a new component class (dynamic library).
 
       \param componentName like COMPONENT, (Python or C++ implementation)
                            try to make a Python import of COMPONENT,
                            then a lib open of libCOMPONENTEngine.so
       \param reason      in case of error (return false) a string explaining the error
-      \return true if load successfull or already done, false otherwise
+      \return true if load successful or already done, false otherwise
     */
     boolean load_component_Library(in string componentName, out string reason);
 
@@ -95,12 +108,22 @@ module Engines
       \param componentName Name of the component which will be registered
                            in Registry and Name Service,
                          (instance number suffix added to the registered name)
-      \param studyId        0 if instance is not associated to a study, 
-                            >0 otherwise (== study id)
       \return a loaded component
     */
-    Engines::EngineComponent create_component_instance(in string componentName,
-                                                       in long studyId);
+    Engines::EngineComponent create_component_instance(in string componentName);
+
+    //! Create a new Python servant instance of a generic service.
+        /*!
+          This simply loads the service in the current container by importing the
+          corresponding Python module.
+          Warning: no internal registration is done, so it is up to the caller to
+          manage the various instantiation.
+          \param serviceName Name of the service
+          \param reason  in case of error (return void string) a string explaining the error
+          \return the IOR of the loaded service.
+        */
+    string create_python_service_instance(in string serviceName,
+                                          out string reason);
 
     //! Create a new servant instance of a component with environment variables specified.
     /*!
@@ -108,25 +131,20 @@ module Engines
       \param componentName Name of the component which will be registered
                            in Registry and Name Service,
                          (instance number suffix added to the registered name)
-      \param studyId        0 if instance is not associated to a study, 
-                            >0 otherwise (== study id)
       \param env         a dict of env variables
       \param reason      in case of error (return nil) a string explaining the error
       \return a loaded component
     */
     Engines::EngineComponent create_component_instance_env(in string componentName,
-                                                           in long studyId, in FieldsDict env,
+                                                           in FieldsDict env,
                                                            out string reason);
     //! Find a servant instance of a component
     /*!
       \param registeredName  Name of the component in Registry or Name Service,
                              without instance suffix number
-      \param studyId        0 if instance is not associated to a study, 
-                            >0 otherwise (== study id)
-      \return the first instance found with same studyId
+      \return the first instance found
     */
-    EngineComponent find_component_instance(in string registeredName,
-                                            in long studyId);
+    EngineComponent find_component_instance(in string registeredName);
 
     //! Find a servant instance of a component, or create a new one.
     /*!
@@ -146,8 +164,13 @@ module Engines
       \param component_i     Component to be removed
     */
     void remove_impl(in EngineComponent component_i);
+    
+    //! In case of SSL mode Returns entry to Embedded NS
+    EmbeddedNamingService get_embedded_NS_if_ssl();
+    
+    boolean is_SSL_mode();
 
-    //!  Unload component libraries from the container. 
+    //!  Unload component libraries from the container.
     void finalize_removal() ;
 
     //!  Determines whether the server has been loaded or not.
@@ -161,17 +184,30 @@ module Engines
 
     //!  name of the %container log file (this has been set by the launcher)
     attribute string logfilename ;
+    
+    //!  name of the %container log file
+    attribute string locallogfilename ;
+
+    //! interval of time between two measures of CPU/time process container
+    attribute long monitoringtimeresms;
+    
+    void verbosity(out boolean activated, out string level);
 
-    //!  Shutdown the Container process.
+    void setVerbosity(in boolean activated, in string level);
+
+    //!  Shutdown the Container process. Shutdown is not immediate. It waits for all remaining invokation completion.
     void Shutdown();
 
+    //!  Shutdown the Container process. Shutdown is immediate for this method.
+    void ShutdownNow();
+
     //!  Returns the hostname of the container
     string getHostName();
 
     //!  Returns the PID of the container
     long getPID();
 
-    //! Kill the container 
+    //! Kill the container
     /*!
       Returns True if the %container has been killed.
       Kept for Superv compilation but can't work, unless oneway...
@@ -183,7 +219,7 @@ module Engines
     /*!
       returns a fileRef object if origFileName exists and is readable
       else returns null object. Only one fileRef is created for a given
-      file name, so, several calls with the same file name returns the 
+      file name, so, several calls with the same file name returns the
       same object.
     */
     fileRef createFileRef(in string origFileName);
@@ -191,7 +227,7 @@ module Engines
     //! Create a Salome_file
     /*!
       returns a Salome_file object if origFileName exists and is readable
-      else returns null object. 
+      else returns null object.
 
       \param origFileName name of the file to be managed (can contain the path).
 
@@ -222,39 +258,51 @@ module Engines
      */
     PyNode createPyNode(in string nodeName, in string code)  raises(SALOME::SALOME_Exception);
 
+    //! Retrieves the last created PyNode instance with createPyNode.
+    PyNode getDefaultPyNode(in string nodeName);
+
     //! Create a PyScriptNode in the container
     /*!
       \param nodeName the name of the PyScriptNode
       \param code python code as text to load in the node
      */
     PyScriptNode createPyScriptNode(in string nodeName, in string code)  raises(SALOME::SALOME_Exception);
-  };
 
-  /*! \brief Interface to pass data files from the client side to the SALOME Container.
-    Passes data from client side to the SALOME container (where component engine is running)
-    size via the CORBA bus as a stream of bytes.
-  */
+    void removePyScriptNode(in string nodeName) raises(SALOME::SALOME_Exception);
 
-  interface DataContainer
-  {
-    //! This operation returns the stream with the data file content.
-    TMPFile get();
-    
-    //! Returns the name of the document corresponding to this data container.                                                                                  
-    string name();
-    
-    //! Returns the identifier of the document corresponding to this data container.
-    string identifier();
+    //! Retrieves the last created PyScriptNode instance with createPyScriptNode.
+    PyScriptNode getDefaultPyScriptNode(in string nodeName);
+
+    //! This method remove all refs of PyScriptNode servant objects stored in server.
+    /*!
+     * Previous scripts created on container may have been stored in a map. This method removes them. It then clean all the contexts dict attached to them.
+     */
+    void cleanAllPyScripts();
+
+    //! Return number of CPU cores in the calculation node.
+    long getNumberOfCPUCores();
+
+    //! Return a load of each CPU core.
+    vectorOfDouble loadOfCPUCores() raises(SALOME::SALOME_Exception);
 
-    //! Returns the extension (type) of the document corresponding to this data container.
-    //! It is taked from the SIMAN URL.
-    string extension();
+    //! Set custom script to calculate a load of each CPU core.
+    /*!
+      \param script Python script to execute
+     */
+    void setPyScriptForCPULoad(in string script);
+
+    //! Nullify custom script to calculate each CPU core's load.
+    void resetScriptForCPULoad();
+
+    //! Get total physical memory of calculation node, in megabytes.
+    long getTotalPhysicalMemory();
 
-    //! Defines the extension. It is required is extension of the file is not
-    //! matched with a read extension: archived file, for example.
-    void setExtension(in string extension);
+    //! Get used physical memory of calculation node, in megabytes.
+    long getTotalPhysicalMemoryInUse();
+
+    //! Obtain physical memory, used by the current process, in megabytes.
+    long getTotalPhysicalMemoryInUseByMe();
   };
-                                      
 
   /*! \brief Interface of the %component.
   This interface is used for interaction between the %container and the
@@ -271,15 +319,7 @@ module Engines
     //!  Determines whether the server has already been loaded or not.
     void ping();
 
-    //!  Get study associated to component instance
-    /*!
-      get study associated to component instance
-      \return -1: not initialised (Internal Error)
-               0: multistudy component instance
-              >0: study id associated to this instance
-    */
-    long getStudyId();
-
+    boolean isSSLMode() raises(SALOME::SALOME_Exception);
     //! Remove component instance from container
     /*!
       Deactivates the %Component.
@@ -293,10 +333,10 @@ module Engines
 
     //! Set component instance properties
     /*!
-      Gives a sequence of (key=string,value=any) to the component. 
+      Gives a sequence of (key=string,value=any) to the component.
       Base class component stores the sequence in a map.
       The map is cleared before.
-      This map is for use by derived classes. 
+      This map is for use by derived classes.
     */
     void setProperties(in FieldsDict dico);
 
@@ -356,21 +396,20 @@ module Engines
 
     //! Get the cpu used
     /*!
-      Returns the Cpu used 
+      Returns the Cpu used
     */
     long CpuUsed_impl() ;
-    
+
     //! Get a python dump
     /*!
       Returns a python script, which is being played back reproduces
       the data model of component
-    */    
-    TMPFile DumpPython(in Object theStudy,
-                       in boolean isPublished,
+    */
+    TMPFile DumpPython(in boolean isPublished,
                        in boolean isMultiFile,
                        out boolean isValidScript);
 
-    
+
     //! Returns a CORBA Ref of a input Salome_file managed by a service.
     /*!
 
@@ -379,27 +418,27 @@ module Engines
 
       \return CORBA Ref of the requested file.
 
-      \exception contains informations of what if the component cannot 
+      \exception contains information of what if the component cannot
       sends the file's reference.
     */
-    Engines::Salome_file getInputFileToService(in string service_name, 
+    Engines::Salome_file getInputFileToService(in string service_name,
                                                in string Salome_file_name) raises(SALOME::SALOME_Exception);
 
-    //! Check service input files (transfer them if needed) 
+    //! Check service input files (transfer them if needed)
     /*!
       This method is used before the activation of the service. It calls
-      recvFiles() on all the input Salome_file files of the service. 
-      
+      recvFiles() on all the input Salome_file files of the service.
+
       Before each recvFiles(), it uses the callback method named configureSalome_file.
       This method allows the user to configure the files managed by the Salome_file.
 
-      By default, there is no files managed when a Salome_file is created, 
+      By default, there is no files managed when a Salome_file is created,
       but the supervisor set some files managed by the Salome_file from the information contained
       into the schema file.
 
       \param service_name service's name.
 
-      \exception contains informations about files that are not in a good state.
+      \exception contains information about files that are not in a good state.
     */
     void checkInputFilesToService(in string service_name)           raises(SALOME::SALOME_Exception);
 
@@ -425,27 +464,27 @@ module Engines
 
       \return CORBA Ref of the requested file.
 
-      \exception contains informations of what if the component cannot 
+      \exception contains information of what if the component cannot
       sends the file's reference.
     */
-    Engines::Salome_file getOutputFileToService(in string service_name, 
+    Engines::Salome_file getOutputFileToService(in string service_name,
                                                 in string Salome_file_name) raises(SALOME::SALOME_Exception);
 
-    //! Check service output files (transfer them if needed) 
+    //! Check service output files (transfer them if needed)
     /*!
       This method is used at the end of the service. It calls
-      recvFiles() on all the output Salome_file files of the service. 
-      
+      recvFiles() on all the output Salome_file files of the service.
+
       Before each recvFiles(), it uses the callback method named configureSalome_file.
       This method allows the user to configure the files managed by the Salome_file.
 
-      By default, there is no files managed when a Salome_file is created, 
+      By default, there is no files managed when a Salome_file is created,
       but the supervisor set some files managed by the Salome_file from the information contained
       into the schema file.
 
       \param service_name service's name.
 
-      \exception contains informations about files that are not in a good state.
+      \exception contains information about files that are not in a good state.
     */
     void checkOutputFilesToService(in string service_name)        raises(SALOME::SALOME_Exception);
 
@@ -470,20 +509,19 @@ module Engines
       component provides such information.
     */
     boolean hasObjectInfo();
-    
+
     //! Get custom information about the given object.
     /*!
       This method is used to get the custom information about the given object.
       Should be redefined in the certain component in case of this
       component provides such information.
       It is worth using this method only if hasObjectInfo() method returns true.
-      
+
       \param entry object's entry.
-      \param studyId study id
 
       \return an information about the given object.
     */
-    string getObjectInfo(in long studyId, in string entry);
+    string getObjectInfo(in string entry);
 
     //! Get version of the component
     /*!
@@ -495,21 +533,6 @@ module Engines
       \return string containing component's version, e.g. "1.0"
     */
     string getVersion();
-
-    //! Generic Import operation to let the component to import data, corresponding to it.
-    /*!
-      \param studyId indentifier of the study where the data must be placed
-      \param data data for import: usually this is just imported file content
-      \param options additional options for Importat operation
-      \return the sequence of identifiers of the importedData in the component (to use later in the export function)
-    */
-    ListOfIdentifiers importData(in long studyId, in DataContainer data, in ListOfOptions options);
-    
-    //! Generic Export operation to ket the component export all modified data corresponding to it.
-    /*!
-      \param studyId identifier of the study that contains the exported data
-     */
-    ListOfData getModifiedData(in long studyId);
   };
 
   /*!
@@ -550,7 +573,7 @@ module Engines
 
     //! Close the file transfer
     /*!
-    when the file transfer is finished, close method releases structures 
+    when the file transfer is finished, close method releases structures
     created by open method, identified by fileId.
     */
     void close(in long fileId);
@@ -571,16 +594,16 @@ module Engines
 
   };
 
-  //!  A file managed by a Salome_file. 
+  //!  A file managed by a Salome_file.
   struct file {
     //! file name
     string file_name;
     //! path name
-    string path; 
+    string path;
     string type;
     string source_file_name;
     //! status ("present" or "notpresent")
-    string status; 
+    string status;
     long   node;
     Engines::Container container;
   };
@@ -589,16 +612,16 @@ module Engines
   typedef sequence<Engines::file> files;
 
 
-  //!  The state of a Salome_file. 
+  //!  The state of a Salome_file.
   struct SfState {
     //! file name
-    string  name; 
+    string  name;
     //! hdf5 file where the file can be saved
-    string  hdf5_file_name; 
+    string  hdf5_file_name;
     //! number of files managed
-    long    number_of_files; 
+    long    number_of_files;
     //! information if all the files are received
-    boolean files_ok; 
+    boolean files_ok;
 
   };
 
@@ -614,7 +637,7 @@ module Engines
 
       \param hdf5_file name (with path) of the hdf5_file.
 
-      \exception contains informations of errors if the loading doesn't succeed.
+      \exception contains information of errors if the loading doesn't succeed.
      */
     void load(in string hdf5_file)                            raises (SALOME::SALOME_Exception);
 
@@ -623,18 +646,18 @@ module Engines
 
       \param  hdf5_file name (with path) of the hdf5_file.
 
-      \exception contains informations of errors if the save doesn't succeed.
+      \exception contains information of errors if the save doesn't succeed.
 
     */
     void save(in string hdf5_file)                            raises (SALOME::SALOME_Exception);
 
-    //!  Save a Salome_file into a hdf5_file. 
+    //!  Save a Salome_file into a hdf5_file.
     /*!
       All files that are managed are saved into the hdf5_file
 
       \param  hdf5_file name (with path) of the hdf5_file.
 
-      \exception contains informations of errors if the save doesn't succeed.
+      \exception contains information of errors if the save doesn't succeed.
 
     */
     void save_all(in string hdf5_file)                            raises (SALOME::SALOME_Exception);
@@ -679,7 +702,7 @@ module Engines
     */
     void connectDistributedFile(in string file_name,
                                 in Engines::Salome_file source_Salome_file) raises (SALOME::SALOME_Exception);
-    
+
     //!  Connect the file_name with a Distributed file_name.
     /*!
 
@@ -753,9 +776,9 @@ module Engines
      machine (refMachine).
      It is created by a container (factoryServer) on refMachine,
      with createFileRef(in string origFileName) method.
-     The fileRef object maintains a list of (machine,filename) for copies. 
+     The fileRef object maintains a list of (machine,filename) for copies.
      If a copy exists on myMachine, getRef(myMachine) returns the file name
-     of the copy on myMachine, else returns empy string.
+     of the copy on myMachine, else returns empty string.
      If there is no copy on myMachine, method getFileTransfer() from container
      factoryServer on refMachine provides a fileTransfer object dedicated to
      CORBA file copy.