1 #ifndef __SALOME_RESOURCESMANAGER_HXX__
2 #define __SALOME_RESOURCESMANAGER_HXX__
4 #include "Utils_SALOME_Exception.hxx"
6 #include <SALOMEconfig.h>
7 #include "SALOME_ResourcesCatalog_Handler.hxx"
8 #include "SALOME_LoadRateManager.hxx"
9 #include "SALOME_NamingService.hxx"
10 #include CORBA_CLIENT_HEADER(SALOME_ContainerManager)
17 #if defined RESOURCESMANAGER_EXPORTS
19 #define RESOURCESMANAGER_EXPORT __declspec( dllexport )
21 #define RESOURCESMANAGER_EXPORT
25 #define RESOURCESMANAGER_EXPORT __declspec( dllimport )
27 #define RESOURCESMANAGER_EXPORT
32 // The call of BuildTempFileToLaunchRemoteContainer and RmTmpFile must be done
33 // in a critical section to be sure to be clean.
34 // Only one thread should use the SALOME_ResourcesManager class in a SALOME
37 class RESOURCESMANAGER_EXPORT SALOME_ResourcesManager
42 SALOME_ResourcesManager(CORBA::ORB_ptr orb, const char *xmlFilePath);
43 SALOME_ResourcesManager(CORBA::ORB_ptr orb);
45 ~SALOME_ResourcesManager();
47 std::vector<std::string>
48 GetFittingResources(const Engines::MachineParameters& params,
49 const char *moduleName)
50 throw(SALOME_Exception);
52 std::string FindBest(const Engines::MachineList& listOfMachines);
54 std::string BuildCommandToLaunchRemoteContainer
55 (const std::string& machine,
56 const Engines::MachineParameters& params);
58 std::string BuildCommandToLaunchLocalContainer
59 (const Engines::MachineParameters& params);
63 std::string BuildCommand(const std::string& machine,
64 const char *containerName);
66 int AddResourceInCatalog
67 (const Engines::MachineParameters& paramsOfNewResources,
68 const std::map<std::string, std::string>& modulesOnNewResources,
69 const char *environPathOfPrerequired,
73 AccessProtocolType prot)
74 throw(SALOME_Exception);
76 void DeleteResourceInCatalog(const char *hostname);
78 void WriteInXmlFile();
80 const MapOfParserResourcesType& ParseXmlFile();
82 const MapOfParserResourcesType& GetList() const;
85 SALOME_NamingService *_NS;
87 std::string BuildTempFileToLaunchRemoteContainer
88 (const std::string& machine,
89 const Engines::MachineParameters& params);
91 void SelectOnlyResourcesWithOS(std::vector<std::string>& hosts,
93 throw(SALOME_Exception);
95 void KeepOnlyResourcesWithModule(std::vector<std::string>& hosts,
96 const char *moduleName) const
97 throw(SALOME_Exception);
99 void AddOmninamesParams(std::string& command) const;
101 void AddOmninamesParams(std::ofstream& fileStream) const;
103 std::string BuildTemporaryFileName() const;
106 //! will contain the path to the ressources catalog
107 QString _path_resources;
109 //! attribute that contains current tmp files generated
110 std::string _TmpFileName;
112 //! contains the rsh or ssh command to access directly to machine.
113 // Only used by this->RmTmpFile in case of a remote launch.
114 std::string _CommandForRemAccess;
116 //! will contain the informations on the data type catalog(after parsing)
117 MapOfParserResourcesType _resourcesList;
119 SALOME_LoadRateManager _dynamicResourcesSelecter;
121 //! different behaviour if $APPLI exists (SALOME Application)
122 bool _isAppliSalomeDefined;
125 #endif // RESSOURCESCATALOG_IMPL_H