bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
ScanElement.h
1
2// This file is part of the "NcML Module" project, a BES module designed
3// to allow NcML files to be used to be used as a wrapper to add
4// AIS to existing datasets of any format.
5//
6// Copyright (c) 2009 OPeNDAP, Inc.
7// Author: Michael Johnson <m.johnson@opendap.org>
8//
9// For more information, please also see the main website: http://opendap.org/
10//
11// This library is free software; you can redistribute it and/or
12// modify it under the terms of the GNU Lesser General Public
13// License as published by the Free Software Foundation; either
14// version 2.1 of the License, or (at your option) any later version.
15//
16// This library is distributed in the hope that it will be useful,
17// but WITHOUT ANY WARRANTY; without even the implied warranty of
18// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19// Lesser General Public License for more details.
20//
21// You should have received a copy of the GNU Lesser General Public
22// License along with this library; if not, write to the Free Software
23// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24//
25// Please see the files COPYING and COPYRIGHT for more information on the GLPL.
26//
27// You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
29#ifndef __NCML_MODULE__SCAN_ELEMENT_H__
30#define __NCML_MODULE__SCAN_ELEMENT_H__
31
32#include "NCMLElement.h"
33#include "AggMemberDataset.h"
34
35namespace agg_util {
36class DirectoryUtil;
37}
38
39namespace ncml_module {
40// FDecls
41class NetcdfElement;
43
48class ScanElement: public NCMLElement {
49public:
50 // class vars
51 // Name of the element
52 static const std::string _sTypeName;
53
54 // All possible attributes for this element.
55 static const std::vector<std::string> _sValidAttrs;
56
57private:
58 ScanElement& operator=(const ScanElement& rhs); // disallow
59
60public:
61 ScanElement();
62 ScanElement(const ScanElement& proto);
63 virtual ~ScanElement();
64
65 virtual const std::string& getTypeName() const;
66 virtual ScanElement* clone() const; // override clone with more specific subclass
67 virtual void setAttributes(const XMLAttributeMap& attrs);
68 virtual void handleBegin();
69 virtual void handleContent(const std::string& content);
70 virtual void handleEnd();
71 virtual std::string toString() const;
72
74 const std::string& ncoords() const;
75
78
87
89 bool shouldScanSubdirs() const;
90
97
110 void getDatasetList(std::vector<NetcdfElement*>& datasets) const;
111
112private:
113 // internal methods
114
116 void setupFilters(agg_util::DirectoryUtil& scanner) const;
117
122 void initSimpleDateFormats(const std::string& dateFormatMark);
123
125 void deleteDateFormats() noexcept;
126
134 std::string extractTimeFromFilename(const std::string& filename) const;
135
136 static std::vector<std::string> getValidAttributes();
137
139 void throwOnUnhandledAttributes();
140
142 static std::string getTimeAsString(time_t theTime);
143
144private:
145 // data rep
146 std::string _location;
147 std::string _suffix;
148 std::string _regExp;
149 std::string _subdirs;
150 std::string _olderThan;
151 std::string _dateFormatMark;
152 std::string _enhance; // we're not implementing this one now.
153 std::string _ncoords; // OPeNDAP EXTENSION to NcML. Inherited by all matched datasets.
154
155 // Back pointer to our parent
156 AggregationElement* _pParent;
157
158 // We use an opaque ptr (pimpl idiom) to push the
159 // decl of the ICU classes to the .cc
160 // to get config.h information as well as hide the icu headers.
161 struct DateFormatters;
162 DateFormatters* _pDateFormatters;
163};
164
165}
166
167#endif /* __NCML_MODULE__SCAN_ELEMENT_H__ */
Concrete class for NcML <netcdf> element.
void getDatasetList(std::vector< NetcdfElement * > &datasets) const
virtual ScanElement * clone() const
virtual void handleContent(const std::string &content)
virtual const std::string & getTypeName() const
bool shouldScanSubdirs() const
virtual void handleEnd()
virtual void handleBegin()
long getOlderThanAsSeconds() const
virtual void setAttributes(const XMLAttributeMap &attrs)
AggregationElement * getParent() const
virtual std::string toString() const
void setParent(AggregationElement *pParent)
STL class.
Helper class for temporarily hijacking an existing dhi to load a DDX response for one particular file...
NcML Parser for adding/modifying/removing metadata (attributes) to existing local datasets using NcML...