@@ -1,6 +1,7 | |||
|
1 | 1 | #include "AmdaProvider.h" |
|
2 | 2 | #include "AmdaDefs.h" |
|
3 | 3 | #include "AmdaResultParser.h" |
|
4 | #include "AmdaServer.h" | |
|
4 | 5 | |
|
5 | 6 | #include <Common/DateUtils.h> |
|
6 | 7 | #include <Data/DataProviderParameters.h> |
@@ -17,12 +18,6 Q_LOGGING_CATEGORY(LOG_AmdaProvider, "AmdaProvider") | |||
|
17 | 18 | |
|
18 | 19 | namespace { |
|
19 | 20 | |
|
20 | /// URL of the default AMDA server | |
|
21 | const auto AMDA_SERVER_URL = QStringLiteral("amda.irap.omp.eu"); | |
|
22 | ||
|
23 | /// URL of the AMDA test server | |
|
24 | const auto AMDA_TEST_SERVER_URL = QStringLiteral("amdatest.irap.omp.eu"); | |
|
25 | ||
|
26 | 21 | /// URL format for a request on AMDA server. The parameters are as follows: |
|
27 | 22 | /// - %1: server URL |
|
28 | 23 | /// - %2: start date |
@@ -44,18 +39,6 QString dateFormat(double sqpRange) noexcept | |||
|
44 | 39 | return dateTime.toString(AMDA_TIME_FORMAT); |
|
45 | 40 | } |
|
46 | 41 | |
|
47 | /// Returns the URL of the AMDA server queried for requests, depending on the type of server passed | |
|
48 | /// as a parameter | |
|
49 | QString serverURL(const QString &server) | |
|
50 | { | |
|
51 | if (server == QString{"amdatest"}) { | |
|
52 | return AMDA_TEST_SERVER_URL; | |
|
53 | } | |
|
54 | else { | |
|
55 | return AMDA_SERVER_URL; | |
|
56 | } | |
|
57 | } | |
|
58 | ||
|
59 | 42 | AmdaResultParser::ValueType valueType(const QString &valueType) |
|
60 | 43 | { |
|
61 | 44 | if (valueType == QStringLiteral("scalar")) { |
@@ -190,9 +173,6 void AmdaProvider::retrieveData(QUuid token, const SqpRange &dateTime, const QVa | |||
|
190 | 173 | // scalar, vector... |
|
191 | 174 | auto productValueType = valueType(data.value(AMDA_DATA_TYPE_KEY).toString()); |
|
192 | 175 | |
|
193 | // Gets the server being queried to retrieve the product. It's then used to set the server URL | |
|
194 | auto productServer = data.value(AMDA_SERVER_KEY).toString(); | |
|
195 | ||
|
196 | 176 | // /////////// // |
|
197 | 177 | // Creates URL // |
|
198 | 178 | // /////////// // |
@@ -201,7 +181,7 void AmdaProvider::retrieveData(QUuid token, const SqpRange &dateTime, const QVa | |||
|
201 | 181 | auto endDate = dateFormat(dateTime.m_TEnd); |
|
202 | 182 | |
|
203 | 183 | auto url = QUrl{ |
|
204 |
QString{AMDA_URL_FORMAT}.arg( |
|
|
184 | QString{AMDA_URL_FORMAT}.arg(AmdaServer::instance().url(), startDate, endDate, productId)}; | |
|
205 | 185 | qCInfo(LOG_AmdaProvider()) << tr("TORM AmdaProvider::retrieveData url:") << url; |
|
206 | 186 | auto tempFile = std::make_shared<QTemporaryFile>(); |
|
207 | 187 |
General Comments 0
You need to be logged in to leave comments.
Login now