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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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 {
58 private:
59  static map<string, BESCatalogUtils *> _instances ;
60 
61  string _name ;
62  string _root_dir ;
63  list<string> _exclude ;
64  list<string> _include ;
65  bool _follow_syms ;
66 
67 public:
68  struct type_reg
69  {
70  string type ;
71  string reg ;
72  } ;
73 private:
74  vector< type_reg > _match_list ;
75 
76  BESCatalogUtils() {}
77 
78  static void bes_get_stat_info( BESCatalogEntry *entry,
79  struct stat &buf ) ;
80 public:
81  BESCatalogUtils( const string &name ) ;
82  virtual ~BESCatalogUtils() {}
83  const string & get_root_dir() const { return _root_dir ; }
84  bool follow_sym_links() const { return _follow_syms ; }
85  virtual bool include( const string &inQuestion ) const ;
86  virtual bool exclude( const string &inQuestion ) const ;
87 
88  typedef vector< type_reg >::const_iterator match_citer ;
91 
92  virtual unsigned int get_entries( DIR *dip, const string &fullnode,
93  const string &use_node,
94  const string &coi,
95  BESCatalogEntry *entry,
96  bool dirs_only ) ;
97 
98  static void display_entry( BESCatalogEntry *entry,
99  BESInfo *info ) ;
100 
101  static void bes_add_stat_info( BESCatalogEntry *entry,
102  const string &fullnode ) ;
103 
104  static bool isData( const string &inQuestion,
105  const string &catalog,
106  list<string> &services ) ;
107 
108  virtual void dump( ostream &strm ) const ;
109 
110  static BESCatalogUtils * Utils( const string &name ) ;
111 } ;
112 
113 #endif // S_BESCatalogUtils_h
114 
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)
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