bes  Updated for version 3.20.8
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 
43 #if 0
44 #include "Granule.h"
45 #endif
46 
47 namespace ngap {
48 
49 class NgapApi {
50 private:
51  std::string d_cmr_hostname;
52  std::string d_cmr_search_endpoint_path;
53 
54  std::string get_cmr_search_endpoint_url();
55  std::string find_get_data_url_in_granules_umm_json_v1_4(const std::string &restified_path, rapidjson::Document &cmr_granule_response);
56  std::string build_cmr_query_url(const std::string &restified_path);
57 
58  friend class NgapApiTest;
59 
60 public:
61 
62  NgapApi();
63 
65  const std::string &restified_path,
66  const std::string &uid="");
67 
68  static bool signed_url_is_expired(const http::url &signed_url) ;
69 
70 #if 0
71  void get_years(std::string collection_name, std::vector<std::string> &years_result);
72  void get_months(std::string collection_name, std::string year, std::vector<std::string> &months_result);
73  void get_days(std::string collection_name, std::string r_year, std::string r_month, std::vector<std::string> &days_result);
74  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);
75  void get_granule_ids(std::string collection_name, std::string r_year, std::string r_month, std::vector<std::string> &granules_result);
76  void get_granules(std::string collection_name, std::string r_year, std::string r_month, std::string r_day, std::vector<ngap::Granule *> &granules);
77  void get_collection_ids(std::vector<std::string> &collection_ids);
78  unsigned long granule_count(std::string collection_name,std:: string r_year, std::string r_month, std::string r_day);
79  ngap::Granule *get_granule(const std::string path);
80  ngap::Granule *get_granule(std::string collection_name, std::string r_year, std::string r_month, std::string r_day, std::string granule_id);
81 };
82 #endif
83 };
84 
85 } // namespace ngap
86 
87 #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:434
GenericDocument< UTF8<> > Document
GenericDocument with UTF8 encoding.
Definition: document.h:2585