##// END OF EJS Templates
Adds "local server" mode...
Alexandre Leroux -
r1153:07d7d7f01c19
parent child
Show More
@@ -32,6 +32,7 IF(BUILD_PLUGINS)
32 32 # - "default": default AMDA server
33 33 # - "amdatest": AMDA test server
34 34 # - "hybrid": use both the default server and the test server (the server used is relative to each product, according to its "server" property in the JSON file)
35 # - "localhost": use local AMDA server
35 36 # Any other value will lead to the use of the default server
36 37 ADD_DEFINITIONS(-DSCIQLOP_AMDA_SERVER="hybrid")
37 38
@@ -27,6 +27,7 endif
27 27 # - "default": default AMDA server
28 28 # - "amdatest": AMDA test server
29 29 # - "hybrid": use both the default server and the test server (the server used is relative to each product, according to its "server" property in the JSON file)
30 # - "localhost": use local AMDA server
30 31 # Any other value will lead to the use of the default server
31 32 add_project_arguments('-DSCIQLOP_AMDA_SERVER="hybrid"', language : 'cpp')
32 33
@@ -12,6 +12,13 const auto AMDA_DEFAULT_SERVER_URL = QStringLiteral("amda.irap.omp.eu");
12 12 /// URL of the AMDA test server
13 13 const auto AMDA_TEST_SERVER_URL = QStringLiteral("amdatest.irap.omp.eu");
14 14
15 /// Port used for local server
16 const auto AMDA_LOCAL_SERVER_PORT = 6543;
17
18 /// URL of the local server
19 const auto AMDA_LOCAL_SERVER_URL
20 = QString{"localhost:%1"}.arg(QString::number(AMDA_LOCAL_SERVER_PORT));
21
15 22 /// Default AMDA server
16 23 struct AmdaDefaultServer : public AmdaServer {
17 24 public:
@@ -48,6 +55,17 public:
48 55 }
49 56 };
50 57
58 /// Local AMDA server: use local python server to simulate AMDA requests
59 struct AmdaLocalServer : public AmdaServer {
60 public:
61 QString name() const override { return AMDA_LOCAL_SERVER_URL; }
62 QString url(const QVariantHash &properties) const override
63 {
64 Q_UNUSED(properties);
65 return AMDA_LOCAL_SERVER_URL;
66 }
67 };
68
51 69 /// @return an AMDA server instance created from the name of the server passed in parameter. If the
52 70 /// name does not match any known server, a default server instance is created
53 71 std::unique_ptr<AmdaServer> createInstance(const QString &server)
@@ -58,6 +76,9 std::unique_ptr<AmdaServer> createInstance(const QString &server)
58 76 else if (server == QString{"hybrid"}) {
59 77 return std::make_unique<AmdaHybridServer>();
60 78 }
79 else if (server == QString{"localhost"}) {
80 return std::make_unique<AmdaLocalServer>();
81 }
61 82 else {
62 83 if (server != QString{"default"}) {
63 84 qCWarning(LOG_AmdaServer())
General Comments 0
You need to be logged in to leave comments. Login now