bes Updated for version 3.20.13
NgapApi.h
1// -*- mode: c++; c-basic-offset:4 -*-
2
3// This file is part of ngap_module, A C++ module that can be loaded in to
4// the OPeNDAP Back-End Server (BES) and is able to handle remote requests.
5
6// Copyright (c) 2020 OPeNDAP, Inc.
7// Author: Nathan Potter <ndp@opendap.org>
8//
9// This library is free software; you can redistribute it and/or
10// modify it under the terms of the GNU Lesser General Public
11// License as published by the Free Software Foundation; either
12// version 2.1 of the License, or (at your option) any later version.
13//
14// This library is distributed in the hope that it will be useful,
15// but WITHOUT ANY WARRANTY; without even the implied warranty of
16// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17// Lesser General Public License for more details.
18//
19// You should have received a copy of the GNU Lesser General Public
20// License along with this library; if not, write to the Free Software
21// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22//
23// You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
24
25
26/*
27 * NgapApi.h
28 *
29 * Created on: July, 13 2018
30 * Author: ndp
31 */
32
33#ifndef MODULES_NGAP_MODULE_NGAPAPI_H_
34#define MODULES_NGAP_MODULE_NGAPAPI_H_
35
36#include <string>
37#include <vector>
38#include <map>
39#include "rapidjson/document.h"
40#include "BESCatalogUtils.h"
41#include "url_impl.h"
42
43namespace ngap {
44
45class NgapApi {
46private:
47 std::string d_cmr_hostname;
48 std::string d_cmr_search_endpoint_path;
49
50 std::string get_cmr_search_endpoint_url();
51 std::string find_get_data_url_in_granules_umm_json_v1_4(const std::string &restified_path, rapidjson::Document &cmr_granule_response);
52 std::string build_cmr_query_url(const std::string &restified_path);
53 std::string build_cmr_query_url_old_rpath_format(const std::string &restified_path);
54
55 friend class NgapApiTest;
56
57public:
58
59 NgapApi();
60
62 const std::string &restified_path,
63 const std::string &uid="");
64
65 static bool signed_url_is_expired(const http::url &signed_url) ;
66
67#if 0
68 void get_years(std::string collection_name, std::vector<std::string> &years_result);
69 void get_months(std::string collection_name, std::string year, std::vector<std::string> &months_result);
70 void get_days(std::string collection_name, std::string r_year, std::string r_month, std::vector<std::string> &days_result);
71 void get_granule_ids(std::string collection_name, std::string r_year, std::string r_month, std::string r_day, std::vector<std::string> &granules_result);
72 void get_granule_ids(std::string collection_name, std::string r_year, std::string r_month, std::vector<std::string> &granules_result);
73 void get_granules(std::string collection_name, std::string r_year, std::string r_month, std::string r_day, std::vector<ngap::Granule *> &granules);
74 void get_collection_ids(std::vector<std::string> &collection_ids);
75 unsigned long granule_count(std::string collection_name,std:: string r_year, std::string r_month, std::string r_day);
76 ngap::Granule *get_granule(const std::string path);
77 ngap::Granule *get_granule(std::string collection_name, std::string r_year, std::string r_month, std::string r_day, std::string granule_id);
78};
79#endif
80};
81
82} // namespace ngap
83
84#endif /* MODULES_NGAP_MODULE_NGAPAPI_H_ */
std::string convert_ngap_resty_path_to_data_access_url(const std::string &restified_path, const std::string &uid="")
Converts an NGAP restified granule path into a CMR metadata query for the granule.
Definition: NgapApi.cc:425