Version: 9.16.0
SALOME_ExternalServerLauncher.hxx
Go to the documentation of this file.
1// Copyright (C) 2019-2026 CEA, EDF, OPEN CASCADE
2//
3// This library is free software; you can redistribute it and/or
4// modify it under the terms of the GNU Lesser General Public
5// License as published by the Free Software Foundation; either
6// version 2.1 of the License, or (at your option) any later version.
7//
8// This library is distributed in the hope that it will be useful,
9// but WITHOUT ANY WARRANTY; without even the implied warranty of
10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11// Lesser General Public License for more details.
12//
13// You should have received a copy of the GNU Lesser General Public
14// License along with this library; if not, write to the Free Software
15// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16//
17// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18//
19// Author : Anthony GEAY (EDF R&D)
20
21#pragma once
22
24
25#include <SALOMEconfig.h>
26
27#include CORBA_SERVER_HEADER(SALOME_ExternalServerLauncher)
28
29#include <vector>
30#include <string>
31
34
35class SALOMELAUNCHER_EXPORT SALOME_ExternalServerLauncher : public POA_SALOME::ExternalServerLauncher
36{
37 public:
38 SALOME_ExternalServerLauncher(const SALOME_CPythonHelper *pyHelper, CORBA::ORB_ptr orb, PortableServer::POA_var poa, SALOME_NamingService_Abstract *ns = nullptr);
40 public:
41 SALOME::ExternalServerHandler_ptr launchServer(const char *server_name, const char *working_dir, const SALOME::CmdList& command_list ) override;
42 void registerToKill(const char *server_name, CORBA::Long PID) override;
43 void cleanServersInNS() override;
44 void shutdownServers() override;
45 SALOME::StringVec *listServersInNS() override;
46 SALOME::ExternalServerHandler_ptr retrieveServerRefGivenNSEntry( const char *ns_entry ) override;
47 char *gethostname() override;
48 SALOME::ByteVec *fetchContentOfFileAndRm(const char *file_name) override;
49 const SALOME_CPythonHelper *getPyHelper() const { return _pyHelper; }
50 private:
51 static std::string CreateAbsNameInNSFromServerName(const std::string& scopeName);
52 static std::vector<std::string> ListOfExternalServersCpp(SALOME_NamingService_Abstract *ns);
53 static bool IsAliveAndKicking(SALOME::ExternalServerHandler_ptr server);
54 static bool IsAliveAndKicking(SALOME_NamingService_Abstract *ns, const std::string& serverName);
55 static SALOME::ExternalServerHandler_var GetServerHandlerGivenName(SALOME_NamingService_Abstract *ns, const std::string& serverName);
56 private:
57 const SALOME_CPythonHelper *_pyHelper = nullptr;
59 PortableServer::POA_var _poa;
60 static unsigned CNT;
61 std::vector<long> _list_of_pids_to_kill;
62 public:
63 static const char NAME_IN_NS[];
64};
#define SALOMELAUNCHER_EXPORT
Definition: SALOME_Launcher_defs.hxx:30
Definition: SALOME_CPythonHelper.hxx:31
Definition: SALOME_ExternalServerLauncher.hxx:36
static unsigned CNT
Definition: SALOME_ExternalServerLauncher.hxx:60
std::vector< long > _list_of_pids_to_kill
Definition: SALOME_ExternalServerLauncher.hxx:61
PortableServer::POA_var _poa
Definition: SALOME_ExternalServerLauncher.hxx:59
const SALOME_CPythonHelper * getPyHelper() const
Definition: SALOME_ExternalServerLauncher.hxx:49
Definition: SALOME_NamingService_Abstract.hxx:46
poa
Definition: SALOME_ContainerPy.py:377
sequence< string > StringVec
Definition: SALOME_CommonTypes.idl:26
sequence< string > CmdList
Definition: SALOME_ExternalServerLauncher.idl:29
sequence< octet > ByteVec
Definition: SALOME_CommonTypes.idl:28
string scopeName
Definition: TestSalomeSDSHelper0.py:24
orb
Definition: salome.py:122
Definition: server.py:1