##// END OF EJS Templates
Adds "local server" mode...
Alexandre Leroux -
r1120:07d7d7f01c19
parent child
Show More
@@ -32,6 +32,7 IF(BUILD_PLUGINS)
32 # - "default": default AMDA server
32 # - "default": default AMDA server
33 # - "amdatest": AMDA test server
33 # - "amdatest": AMDA test server
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)
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 # Any other value will lead to the use of the default server
36 # Any other value will lead to the use of the default server
36 ADD_DEFINITIONS(-DSCIQLOP_AMDA_SERVER="hybrid")
37 ADD_DEFINITIONS(-DSCIQLOP_AMDA_SERVER="hybrid")
37
38
@@ -27,6 +27,7 endif
27 # - "default": default AMDA server
27 # - "default": default AMDA server
28 # - "amdatest": AMDA test server
28 # - "amdatest": AMDA test server
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)
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 # Any other value will lead to the use of the default server
31 # Any other value will lead to the use of the default server
31 add_project_arguments('-DSCIQLOP_AMDA_SERVER="hybrid"', language : 'cpp')
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 /// URL of the AMDA test server
12 /// URL of the AMDA test server
13 const auto AMDA_TEST_SERVER_URL = QStringLiteral("amdatest.irap.omp.eu");
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 /// Default AMDA server
22 /// Default AMDA server
16 struct AmdaDefaultServer : public AmdaServer {
23 struct AmdaDefaultServer : public AmdaServer {
17 public:
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 /// @return an AMDA server instance created from the name of the server passed in parameter. If the
69 /// @return an AMDA server instance created from the name of the server passed in parameter. If the
52 /// name does not match any known server, a default server instance is created
70 /// name does not match any known server, a default server instance is created
53 std::unique_ptr<AmdaServer> createInstance(const QString &server)
71 std::unique_ptr<AmdaServer> createInstance(const QString &server)
@@ -58,6 +76,9 std::unique_ptr<AmdaServer> createInstance(const QString &server)
58 else if (server == QString{"hybrid"}) {
76 else if (server == QString{"hybrid"}) {
59 return std::make_unique<AmdaHybridServer>();
77 return std::make_unique<AmdaHybridServer>();
60 }
78 }
79 else if (server == QString{"localhost"}) {
80 return std::make_unique<AmdaLocalServer>();
81 }
61 else {
82 else {
62 if (server != QString{"default"}) {
83 if (server != QString{"default"}) {
63 qCWarning(LOG_AmdaServer())
84 qCWarning(LOG_AmdaServer())
General Comments 0
You need to be logged in to leave comments. Login now