|
OPeNDAP Hyrax Back End Server (BES)
Updated for version 3.8.3
|
Implementation of the <scan> element used to scan directories to create the set of files for an aggregation. More...
#include <ScanElement.h>


Public Member Functions | |
| void | addPreDeleteCB (UseCountHitZeroCB *pCB) |
| Add uniquely. More... | |
| virtual ScanElement * | clone () const |
| Make and return a copy of this. More... | |
| void | getDatasetList (vector< NetcdfElement * > &datasets) const |
| Actually perform the filesystem scan based on the specified attributes (suffix, subdirs, etc). More... | |
| long | getOlderThanAsSeconds () const |
| Get the olderThan attribute in seconds. More... | |
| AggregationElement * | getParent () const |
| Get the aggregation of which I am a child. More... | |
| virtual int | getRefCount () const |
| Get the current reference count. More... | |
| virtual const string & | getTypeName () const |
| Return the type of the element, which should be: the same as ConcreteClassName::getTypeName() More... | |
| virtual void | handleBegin () |
| Handle a begin on this element. More... | |
| virtual void | handleContent (const string &content) |
| Handle the characters content for the element. More... | |
| virtual void | handleEnd () |
| Handle the closing of this element. More... | |
| int | line () const |
| Return the current parse line number. More... | |
| const string & | ncoords () const |
| virtual int | ref () const |
| Increase the reference count by one. More... | |
| virtual void | removeFromPool () const |
| If the object is in an auto-delete pool, remove it from the pool and force it to only delete when it's ref count goes to 0. More... | |
| void | removePreDeleteCB (UseCountHitZeroCB *pCB) |
| Remove it exists. More... | |
| ScanElement () | |
| ScanElement (const ScanElement &proto) | |
| virtual void | setAttributes (const XMLAttributeMap &attrs) |
| Set the attributes of this from the map. More... | |
| void | setParent (AggregationElement *pParent) |
| Set the parent of this element. More... | |
| void | setParser (NCMLParser *p) |
| bool | shouldScanSubdirs () const |
| is the subdirs attribute true? More... | |
| virtual string | toString () const |
| Return a string describing the element. More... | |
| virtual int | unref () const throw () |
| Decrease the reference count by one. More... | |
| virtual bool | validateAttributes (const XMLAttributeMap &attrs, const vector< string > &validAttrs, vector< string > *pInvalidAttrs=0, bool printInvalid=true, bool throwOnError=true) |
| Check that the given attributes are all in the valid set, otherwise fill in *pInvalidAttrs with the problematic ones if it's not null. More... | |
| virtual | ~ScanElement () |
Static Public Member Functions | |
| static bool | areAllAttributesValid (const XMLAttributeMap &attrMap, const std::vector< string > &validAttrs, std::vector< string > *pInvalidAttributes=0) |
| static bool | isValidAttribute (const std::vector< string > &validAttrs, const string &attr) |
| static std::string | printAttributeIfNotEmpty (const std::string &attrName, const std::string &attrValue) |
| Helper for subclasses implementing toString(). More... | |
Static Public Attributes | |
| static const string | _sTypeName = "scan" |
| static const vector< string > | _sValidAttrs = getValidAttributes() |
Protected Attributes | |
| NCMLParser * | _parser |
Implementation of the <scan> element used to scan directories to create the set of files for an aggregation.
Definition at line 50 of file ScanElement.h.
| ncml_module::ScanElement::ScanElement | ( | ) |
Definition at line 94 of file ScanElement.cc.
Referenced by clone().
| ncml_module::ScanElement::ScanElement | ( | const ScanElement & | proto | ) |
Definition at line 110 of file ScanElement.cc.
|
virtual |
Definition at line 130 of file ScanElement.cc.
|
inherited |
Add uniquely.
If it is added agan, the second time is ignored.
Definition at line 145 of file RCObject.cc.
References BESDEBUG.
|
staticinherited |
Definition at line 261 of file NCMLElement.cc.
References ncml_module::XMLAttributeMap::begin(), ncml_module::XMLAttributeMap::end(), and ncml_module::NCMLElement::isValidAttribute().
Referenced by ncml_module::NCMLElement::validateAttributes().

|
virtual |
Make and return a copy of this.
Used by the factory from a prototype.
Implements ncml_module::NCMLElement.
Definition at line 155 of file ScanElement.cc.
References ScanElement().
Referenced by ncml_module::AggregationElement::AggregationElement().

| void ncml_module::ScanElement::getDatasetList | ( | vector< NetcdfElement * > & | datasets | ) | const |
Actually perform the filesystem scan based on the specified attributes (suffix, subdirs, etc).
Fill in the vector with matching datasets, sorted by the filename.
NOTE: The members added to this vector will be ref()'d so the caller needs to make sure to deref them!
| datasets | The vector to add the datasets to. |
Definition at line 264 of file ScanElement.cc.
References ncml_module::NCMLElement::_parser, ncml_module::XMLAttributeMap::addAttribute(), BESDEBUG, ncml_module::XMLAttributeMap::clear(), BESNotFoundError::dump(), agg_util::RCPtr< T >::get(), agg_util::DirectoryUtil::getBESRootDir(), agg_util::DirectoryUtil::getListingForPath(), agg_util::DirectoryUtil::getListingOfRegularFilesRecursive(), getParent(), agg_util::DirectoryUtil::getRootDir(), ncml_module::NetcdfElement::isCoordValueLexicographicallyLessThan(), ncml_module::NetcdfElement::isLocationLexicographicallyLessThan(), ncml_module::NCMLElement::line(), ncml_module::NCMLElement::Factory::makeElement(), agg_util::RCPtr< T >::refAndGet(), ncml_module::AggregationElement::setAggregationVariableCoordinateAxisType(), agg_util::DirectoryUtil::setRootDir(), shouldScanSubdirs(), THROW_NCML_PARSE_ERROR, toString(), and VALID_PTR.

| long ncml_module::ScanElement::getOlderThanAsSeconds | ( | ) | const |
Get the olderThan attribute in seconds.
Returns 0 for the empty attribute and -1 if there's an error parsing the attribute.
Definition at line 241 of file ScanElement.cc.
References L, ncml_module::NCMLElement::line(), agg_util::SimpleTimeParser::parseIntoSeconds(), and THROW_NCML_PARSE_ERROR.

| AggregationElement * ncml_module::ScanElement::getParent | ( | ) | const |
Get the aggregation of which I am a child.
Definition at line 137 of file ScanElement.cc.
Referenced by getDatasetList().
|
virtualinherited |
Get the current reference count.
Implements agg_util::RCObjectInterface.
Definition at line 110 of file RCObject.cc.
|
virtual |
Return the type of the element, which should be: the same as ConcreteClassName::getTypeName()
Implements ncml_module::NCMLElement.
Definition at line 149 of file ScanElement.cc.
References _sTypeName.
|
virtual |
Handle a begin on this element.
Called after creation and it is assumed the attributes and _parser are already set.
Implements ncml_module::NCMLElement.
Definition at line 186 of file ScanElement.cc.
References ncml_module::NCMLElement::_parser, ncml_module::NCMLElement::line(), THROW_NCML_PARSE_ERROR, and toString().

|
virtual |
Handle the characters content for the element.
Default impl throws if the content is not all whitespace. Subclasses that handle non-whitespace content should override.
| content | the string of characters in the element content. |
Reimplemented from ncml_module::NCMLElement.
Definition at line 196 of file ScanElement.cc.
References ncml_module::NCMLElement::handleContent().

|
virtual |
Handle the closing of this element.
Implements ncml_module::NCMLElement.
Definition at line 202 of file ScanElement.cc.
References ncml_module::NCMLElement::_parser, ncml_module::AggregationElement::addScanElement(), ncml_module::NetcdfElement::getChildAggregation(), NCML_ASSERT_MSG, and VALID_PTR.

|
staticinherited |
Definition at line 246 of file NCMLElement.cc.
Referenced by ncml_module::NCMLElement::areAllAttributesValid().
|
inherited |
Return the current parse line number.
Shorthand
Definition at line 174 of file NCMLElement.cc.
References ncml_module::NCMLElement::_parser, and ncml_module::NCMLParser::getParseLineNumber().
Referenced by getDatasetList(), ncml_module::NetcdfElement::getNcoordsAsUnsignedInt(), getOlderThanAsSeconds(), and handleBegin().

| const string & ncml_module::ScanElement::ncoords | ( | ) | const |
Definition at line 229 of file ScanElement.cc.
|
staticinherited |
Helper for subclasses implementing toString().
Definition at line 240 of file NCMLElement.cc.
Referenced by ncml_module::VariableAggElement::toString(), toString(), ncml_module::DimensionElement::toString(), ncml_module::NetcdfElement::toString(), and ncml_module::AggregationElement::toString().
|
virtualinherited |
Increase the reference count by one.
const since we do not consider the ref count part of the semantic constness of the rep
Implements agg_util::RCObjectInterface.
Definition at line 74 of file RCObject.cc.
References BESDEBUG.
Referenced by ncml_module::AggregationElement::addChildDataset(), ncml_module::NetcdfElement::addDimension(), ncml_module::AggregationElement::addScanElement(), ncml_module::NetcdfElement::VariableValueValidator::addVariableToValidate(), and agg_util::RCPtr< ncml_module::AggregationElement >::refAndGet().
|
virtualinherited |
If the object is in an auto-delete pool, remove it from the pool and force it to only delete when it's ref count goes to 0.
Useful when we desire a particular object stay around outside of the pool's lifetime.
Implements agg_util::RCObjectInterface.
Definition at line 116 of file RCObject.cc.
References NCML_ASSERT, and agg_util::RCObjectPool::remove().

|
inherited |
Remove it exists.
If not, this unchanged.
Definition at line 164 of file RCObject.cc.
References BESDEBUG.
|
virtual |
Set the attributes of this from the map.
| attrs | the attribute map to set this class to. |
Implements ncml_module::NCMLElement.
Definition at line 161 of file ScanElement.cc.
References _sValidAttrs, ncml_module::XMLAttributeMap::getValueForLocalNameOrDefault(), and ncml_module::NCMLElement::validateAttributes().

| void ncml_module::ScanElement::setParent | ( | AggregationElement * | pParent | ) |
Set the parent of this element.
This should ONLY be called by the AggregationElement when this is added to it.
| pParent | the weak ref to the parent. |
Definition at line 143 of file ScanElement.cc.
Referenced by ncml_module::AggregationElement::addScanElement().
|
inherited |
Definition at line 166 of file NCMLElement.cc.
References ncml_module::NCMLElement::_parser, and NCML_ASSERT_MSG.
| bool ncml_module::ScanElement::shouldScanSubdirs | ( | ) | const |
is the subdirs attribute true?
Definition at line 235 of file ScanElement.cc.
Referenced by getDatasetList().
|
virtual |
Return a string describing the element.
Implements ncml_module::NCMLElement.
Definition at line 215 of file ScanElement.cc.
References _sTypeName, and ncml_module::NCMLElement::printAttributeIfNotEmpty().
Referenced by getDatasetList(), and handleBegin().

|
virtualinherited | |||||||||||||
Decrease the reference count by one.
If it goes from 1 to 0, delete this and this is no longer valid.
It is illegal to unref() an object with a count of 0. We don't throw to allow use in dtors, so the caller is assumed not to do it!
const since the reference count is not part of the semantic constness of the rep
Implements agg_util::RCObjectInterface.
Definition at line 82 of file RCObject.cc.
References BESDEBUG, agg_util::RCObjectPool::release(), and agg_util::RCObject::toString().
Referenced by ncml_module::NetcdfElement::clearDimensions(), agg_util::RCPtr< ncml_module::AggregationElement >::operator=(), ncml_module::AggregationElement::~AggregationElement(), and ncml_module::NetcdfElement::VariableValueValidator::~VariableValueValidator().

|
virtualinherited |
Check that the given attributes are all in the valid set, otherwise fill in *pInvalidAttrs with the problematic ones if it's not null.
If pInvalidAttrs && printInvalid is set, we print the problematic attributes to BESDEBUG "ncml" channel If throwOnError is set, we throw a parse error instead of returning.
Definition at line 191 of file NCMLElement.cc.
References ncml_module::NCMLElement::_parser, ncml_module::NCMLElement::areAllAttributesValid(), BESDEBUG, ncml_module::NCMLParser::getParseLineNumber(), ncml_module::NCMLElement::getTypeName(), THROW_NCML_PARSE_ERROR, and VALID_PTR.
Referenced by ncml_module::RemoveElement::setAttributes(), ncml_module::ExplicitElement::setAttributes(), ncml_module::ReadMetadataElement::setAttributes(), ncml_module::VariableAggElement::setAttributes(), ncml_module::ValuesElement::setAttributes(), ncml_module::AttributeElement::setAttributes(), setAttributes(), ncml_module::DimensionElement::setAttributes(), ncml_module::VariableElement::setAttributes(), ncml_module::NetcdfElement::setAttributes(), and ncml_module::AggregationElement::setAttributes().

|
protectedinherited |
Definition at line 193 of file NCMLElement.h.
Referenced by ncml_module::AggregationElement::addAggregationVariable(), ncml_module::NetcdfElement::createResponseObject(), ncml_module::NetcdfElement::getAggMemberDataset(), getDatasetList(), ncml_module::VariableAggElement::getParentAggregation(), ncml_module::RemoveElement::handleBegin(), ncml_module::ExplicitElement::handleBegin(), ncml_module::ReadMetadataElement::handleBegin(), ncml_module::VariableAggElement::handleBegin(), ncml_module::ValuesElement::handleBegin(), ncml_module::AttributeElement::handleBegin(), handleBegin(), ncml_module::DimensionElement::handleBegin(), ncml_module::VariableElement::handleBegin(), ncml_module::NetcdfElement::handleBegin(), ncml_module::AggregationElement::handleBegin(), ncml_module::RemoveElement::handleContent(), ncml_module::ExplicitElement::handleContent(), ncml_module::ReadMetadataElement::handleContent(), ncml_module::ValuesElement::handleContent(), ncml_module::AttributeElement::handleContent(), ncml_module::DimensionElement::handleContent(), ncml_module::VariableElement::handleContent(), ncml_module::NetcdfElement::handleContent(), ncml_module::AggregationElement::handleContent(), ncml_module::NCMLElement::handleContent(), ncml_module::ValuesElement::handleEnd(), ncml_module::AttributeElement::handleEnd(), handleEnd(), ncml_module::VariableElement::handleEnd(), ncml_module::NetcdfElement::handleEnd(), ncml_module::AggregationElement::handleEnd(), ncml_module::NetcdfElement::isValid(), ncml_module::NCMLElement::line(), ncml_module::ValuesElement::setAttributes(), ncml_module::NCMLElement::setParser(), ncml_module::NCMLElement::validateAttributes(), and ncml_module::NCMLElement::~NCMLElement().
|
static |
Definition at line 54 of file ScanElement.h.
Referenced by getTypeName(), and toString().
|
static |
Definition at line 57 of file ScanElement.h.
Referenced by setAttributes().