bes  Updated for version 3.20.6
HttpdCatalog.h
1 // HttpCatalog.h
2 // -*- mode: c++; c-basic-offset:4 -*-
3 //
4 // This file is part of BES httpd_catalog_module
5 //
6 // Copyright (c) 2018 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 // Please read the full copyright statement in the file COPYRIGHT_URI.
25 //
26 
27 #ifndef _HttpdCatalog_h_
28 #define _HttpdCatalog_h_ 1
29 
30 #include <list>
31 #include <string>
32 #include <map>
33 
34 #include "BESCatalog.h"
35 #include "BESInternalError.h"
36 #include "HttpdCatalogNames.h"
37 
38 class BESCatalogEntry;
39 class BESCatalogUtils;
40 
41 namespace bes {
42  class CatalogNode;
43 }
44 
45 namespace httpd_catalog {
46 
50 class HttpdCatalog: public BESCatalog {
51 private:
52  std::map<std::string,std::string> d_httpd_catalogs;
53 
54 public:
55  HttpdCatalog(const std::string &catalog_name = HTTPD_CATALOG_NAME);
56 
57  virtual ~HttpdCatalog() { }
58 
62  virtual BESCatalogEntry * show_catalog(const std::string &container, BESCatalogEntry */*entry*/){
63  throw BESInternalError("The HttpdCatalog::show_catalog() method is not supported. (container: '" + container + "')",__FILE__,__LINE__);
64  }
65 
69  virtual std::string get_root() const { return ""; }
70 
74  virtual void get_site_map(
75  const std::string &/*prefix*/,
76  const std::string &/*node_suffix*/,
77  const std::string &/*leaf_suffix*/,
78  std::ostream &/*out*/,
79  const std::string &/*path = "/"*/) const {
80  BESDEBUG(MODULE, "The HttpdCatalog::get_site_map() method is not currently supported. SKIPPING. file: " << __FILE__ << " line: " << __LINE__ << std::endl);
81  }
82 
83  virtual bes::CatalogNode *get_node(const std::string &path) const;
84 
85  virtual std::string path_to_access_url(const std::string &path) const;
86 
87  virtual void dump(std::ostream &strm) const;
88 };
89 
90 } // namespace httpd_catalog
91 
92 #endif // _HttpdCatalog_h_
93 
BESCatalogUtils
Definition: BESCatalogUtils.h:61
httpd_catalog::HttpdCatalog::get_site_map
virtual void get_site_map(const std::string &, const std::string &, const std::string &, std::ostream &, const std::string &) const
Definition: HttpdCatalog.h:74
httpd_catalog::HttpdCatalog::path_to_access_url
virtual std::string path_to_access_url(const std::string &path) const
Takes a path which begins with the name of an HttpdCatalog collection and returns the associated acce...
Definition: HttpdCatalog.cc:201
httpd_catalog::HttpdCatalog::get_root
virtual std::string get_root() const
Definition: HttpdCatalog.h:69
httpd_catalog::HttpdCatalog::get_node
virtual bes::CatalogNode * get_node(const std::string &path) const
Produces the bes::CatalogNode for the string ppath.
Definition: HttpdCatalog.cc:157
httpd_catalog::HttpdCatalog
builds catalogs from a directory structure exposed by Apache httpd
Definition: HttpdCatalog.h:50
httpd_catalog::HttpdCatalog::show_catalog
virtual BESCatalogEntry * show_catalog(const std::string &container, BESCatalogEntry *)
Definition: HttpdCatalog.h:62
bes::CatalogNode
Definition: CatalogNode.h:45
BESInternalError
exception thrown if internal error encountered
Definition: BESInternalError.h:43
BESCatalogEntry
Definition: BESCatalogEntry.h:46
httpd_catalog::HttpdCatalog::dump
virtual void dump(std::ostream &strm) const
dumps information about this object
Definition: HttpdCatalog.cc:259
BESCatalog
Catalogs provide a hierarchical organization for data.
Definition: BESCatalog.h:51
httpd_catalog::HttpdCatalog::HttpdCatalog
HttpdCatalog(const std::string &catalog_name=HTTPD_CATALOG_NAME)
A catalog based on scraping the directory pages produced by httpd .
Definition: HttpdCatalog.cc:84