bes  Updated for version 3.20.6
HttpdDirScraper.h
1 
2 // -*- mode: c++; c-basic-offset:4 -*-
3 //
4 // This file is part of httpd_catalog_module, A C++ module that can be loaded in to
5 // the OPeNDAP Back-End Server (BES) and is able to handle remote requests.
6 //
7 // Copyright (c) 2018 OPeNDAP, Inc.
8 // Author: Nathan Potter <ndp@opendap.org>
9 //
10 // This library is free software; you can redistribute it and/or
11 // modify it under the terms of the GNU Lesser General Public
12 // License as published by the Free Software Foundation; either
13 // version 2.1 of the License, or (at your option) any later version.
14 //
15 // This library is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 // Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public
21 // License along with this library; if not, write to the Free Software
22 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 //
24 // You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
25 
26 #ifndef MODULES_CMR_MODULE_HTTPDDIRSCRAPER_H_
27 #define MODULES_CMR_MODULE_HTTPDDIRSCRAPER_H_
28 
29 #include <set>
30 #include <string>
31 
32 #include <CatalogNode.h>
33 #include "HttpdCatalog.h"
34 
35 namespace httpd_catalog {
36 
44 private:
45  std::map<std::string,int> d_months;
46 
47  int getNextElementText(const std::string &page_str, std::string element_name, int startIndex, std::string &resultText, bool trim=true) const;
48  void createHttpdDirectoryPageMap(std::string url, std::map<std::string, bes::CatalogItem *> &items) const;
49  long get_size_val(const std::string size_str) const;
50  std::string httpd_time_to_iso_8601(const std::string httpd_time) const;
51  std::string httpd_time_to_iso_8601_new(const std::string httpd_time) const;
52  time_t parse_time_format_A(const std::vector<std::string> tokens) const;
53  time_t parse_time_format_B(const std::vector<std::string> tokens) const;
54 
55 public:
57  ~HttpdDirScraper() { }
58  virtual bes::CatalogNode *get_node(const std::string &url, const std::string &path) const;
59 };
60 } // namespace httpd_catalog
61 
62 #endif /* MODULES_CMR_MODULE_HTTPDDIRSCRAPER_H_ */
httpd_catalog::HttpdDirScraper
This class builds a BES CatalogNode response from an httpd-generated directory page.
Definition: HttpdDirScraper.h:43
bes::CatalogNode
Definition: CatalogNode.h:45