OPeNDAP Hyrax Back End Server (BES)  Updated for version 3.8.3
BESCatalogUtils.h
Go to the documentation of this file.
1 // BESCatalogUtils.h
2 
3 // This file is part of bes, A C++ back-end server implementation framework
4 // for the OPeNDAP Data Access Protocol.
5 
6 // Copyright (c) 2004-2009 University Corporation for Atmospheric Research
7 // Author: Patrick West <pwest@ucar.edu> and Jose Garcia <jgarcia@ucar.edu>
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 University Corporation for Atmospheric Research at
24 // 3080 Center Green Drive, Boulder, CO 80301
25 
26 // (c) COPYRIGHT University Corporation for Atmospheric Research 2004-2005
27 // Please read the full copyright statement in the file COPYRIGHT_UCAR.
28 //
29 // Authors:
30 // pwest Patrick West <pwest@ucar.edu>
31 // jgarcia Jose Garcia <jgarcia@ucar.edu>
32 
33 #ifndef S_BESCatalogUtils_h
34 #define S_BESCatalogUtils_h 1
35 
36 #include <sys/types.h>
37 #include <sys/stat.h>
38 #include <dirent.h>
39 
40 #include <map>
41 #include <vector>
42 #include <list>
43 #include <string>
44 
45 using std::map;
46 using std::vector;
47 using std::list;
48 using std::string;
49 
50 #include "BESObj.h"
51 #include "BESUtil.h"
52 
53 class BESInfo;
54 class BESCatalogEntry;
55 
56 class BESCatalogUtils: public BESObj {
57 private:
58  static map<string, BESCatalogUtils *> _instances;
59 
60  string _name;
61  string _root_dir;
62  list<string> _exclude;
63  list<string> _include;
64  bool _follow_syms;
65 
66 public:
67  struct type_reg {
68  string type;
69  string reg;
70  };
71 private:
72  vector<type_reg> _match_list;
73 
74  BESCatalogUtils() {
75  }
76 
77  static void bes_get_stat_info(BESCatalogEntry *entry, struct stat &buf);
78 public:
79  BESCatalogUtils(const string &name);
80  virtual ~BESCatalogUtils() {}
81 
82  const string & get_root_dir() const {
83  return _root_dir;
84  }
85  bool follow_sym_links() const {
86  return _follow_syms;
87  }
88  virtual bool include(const string &inQuestion) const ;
89  virtual bool exclude(const string &inQuestion) const ;
90 
91  typedef vector<type_reg>::const_iterator match_citer;
94 
95  virtual unsigned int get_entries(DIR *dip, const string &fullnode,
96  const string &use_node, const string &coi, BESCatalogEntry *entry,
97  bool dirs_only);
98 
99  static void display_entry(BESCatalogEntry *entry, BESInfo *info);
100 
101  static void bes_add_stat_info(BESCatalogEntry *entry,
102  const string &fullnode);
103 
104  static bool isData(const string &inQuestion, const string &catalog,
105  list<string> &services);
106 
107  virtual void dump(ostream &strm) const ;
108 
109  static BESCatalogUtils * Utils(const string &name);
110 
111  // Added because of reported memory leaks. jhrg 12/24/12
112  static void delete_all_catalogs();
113 
114 
115 };
116 
117 #endif // S_BESCatalogUtils_h
BESCatalogUtils::match_citer match_list_begin() const
virtual ~BESCatalogUtils()
BESCatalogUtils::match_citer match_list_end() const
vector< type_reg >::const_iterator match_citer
Base object for bes objects.
Definition: BESObj.h:52
informational response object
Definition: BESInfo.h:68
static void bes_add_stat_info(BESCatalogEntry *entry, const string &fullnode)
bool follow_sym_links() const
virtual void dump(ostream &strm) const
dump the contents of this object to the specified ostream
static bool isData(const string &inQuestion, const string &catalog, list< string > &services)
static void display_entry(BESCatalogEntry *entry, BESInfo *info)
static void delete_all_catalogs()
virtual bool include(const string &inQuestion) const
virtual bool exclude(const string &inQuestion) const
static BESCatalogUtils * Utils(const string &name)
virtual unsigned int get_entries(DIR *dip, const string &fullnode, const string &use_node, const string &coi, BESCatalogEntry *entry, bool dirs_only)
const string & get_root_dir() const