bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
BESCatalogDirectory Class Reference

Catalogs from a directory structure. More...

#include <BESCatalogDirectory.h>

Inheritance diagram for BESCatalogDirectory:
Inheritance graph
Collaboration diagram for BESCatalogDirectory:
Collaboration graph

Public Member Functions

 BESCatalogDirectory (const std::string &name)
 A catalog for POSIX file systems.
 
virtual unsigned int dereference_catalog ()
 Decrement the count of clients that reference this catalog.
 
virtual void dump (std::ostream &strm) const
 dumps information about this object
 
virtual std::string get_catalog_name () const
 Get the name for this catalog.
 
virtual BESCatalogUtilsget_catalog_utils () const
 Get a pointer to the utilities, customized for this catalog.
 
virtual bes::CatalogNodeget_node (const std::string &path) const
 Get a CatalogNode for the given path in the current catalog.
 
virtual std::string get_root () const
 Get the root directory for the catalog.
 
virtual void get_site_map (const std::string &prefix, const std::string &node_suffix, const std::string &leaf_suffix, std::ostream &out, const std::string &path="/") const
 Write the site map for this catalog to the stream.
 
virtual void reference_catalog ()
 Increase the count of clients that reference this catalog.
 
virtual BESCatalogEntryshow_catalog (const std::string &container, BESCatalogEntry *entry)
 Get the CatalogEntry for the given node.
 

Detailed Description

Catalogs from a directory structure.

Definition at line 52 of file BESCatalogDirectory.h.

Constructor & Destructor Documentation

◆ BESCatalogDirectory()

BESCatalogDirectory::BESCatalogDirectory ( const std::string & name)

A catalog for POSIX file systems.

BESCatalgDirectory is BESCatalog specialized for POSIX file systems. The default catalog is an instance of this class.

Note
Access to the host's file system is made using BESCatalogUtils, which is initialized using the catalog name.
Parameters
nameThe name of the catalog.
See also
BESCatalogUtils

Definition at line 85 of file BESCatalogDirectory.cc.

◆ ~BESCatalogDirectory()

BESCatalogDirectory::~BESCatalogDirectory ( )
virtual

Definition at line 93 of file BESCatalogDirectory.cc.

Member Function Documentation

◆ dereference_catalog()

virtual unsigned int BESCatalog::dereference_catalog ( )
inlinevirtualinherited

Decrement the count of clients that reference this catalog.

Returns
The number of clients that reference this BESCatalog instance
See also
reference_catalog()

Definition at line 91 of file BESCatalog.h.

◆ dump()

void BESCatalogDirectory::dump ( std::ostream & strm) const
virtual

dumps information about this object

Displays the pointer value of this instance along with information about this catalog directory.

Parameters
strmC++ i/o stream to dump the information to

Implements BESCatalog.

Definition at line 671 of file BESCatalogDirectory.cc.

◆ get_catalog_name()

virtual std::string BESCatalog::get_catalog_name ( ) const
inlinevirtualinherited

Get the name for this catalog.

Returns
The catalog.

Definition at line 102 of file BESCatalog.h.

◆ get_catalog_utils()

virtual BESCatalogUtils * BESCatalog::get_catalog_utils ( ) const
inlinevirtualinherited

Get a pointer to the utilities, customized for this catalog.

Returns
A BESCatalogUtils pointer.

Definition at line 112 of file BESCatalog.h.

◆ get_node()

CatalogNode * BESCatalogDirectory::get_node ( const std::string & path) const
virtual

Get a CatalogNode for the given path in the current catalog.

This is similar to show_catalog() but returns a simpler response. The

  • path must start with a slash and is used as a suffix to the Catalog's root directory. Thus, the
  • path argument is relative to the catalog's root directory (even though the string starts with a slash).
Note
The
  • path can be either a directory name or a file name. In the first case, this will return a CatalogNode that holds a set of CatalogItem instances. The parent CatalogNode is itself a node. In the second case, the CatalogNode returned is a leaf. See the CatalogNode class and note that it has dual nature - it can be a node in a hierarchy or it can be a leaf.
Parameters
pathThe pathname for the node; must start with a slash (/)
Returns
A CatalogNode instance or null if there is no such path in the current catalog.
Exceptions
BESInternalErrorIf the
  • path is not a directory
BESForbiddenErrorIf the
  • path is explicitly excluded by the bes.conf file

Implements BESCatalog.

Definition at line 395 of file BESCatalogDirectory.cc.

◆ get_root()

string BESCatalogDirectory::get_root ( ) const
virtual

Get the root directory for the catalog.

Returns
The root directory for the catalog

Implements BESCatalog.

Definition at line 262 of file BESCatalogDirectory.cc.

◆ get_site_map()

void BESCatalogDirectory::get_site_map ( const std::string & prefix,
const std::string & node_suffix,
const std::string & leaf_suffix,
std::ostream & out,
const std::string & path = "/" ) const
virtual

Write the site map for this catalog to the stream.

  • out

For any node in the catalog, write the URL for all of the data items (which must be leaves in the node named by

  • path) and write the URLs for all the leaves contained in that nodes children. This method performs a depth-first traversal of the Catalog, visiting nodes at any level in the order that BESCatalog::get_node() returns them.
Parameters
prefixPrefix for each item found. It's likely the start of a URL (https://_machine_/_service_). It should not end in a slash (/).
node_suffixAppended to each node item found if not empty. If this is the empty string, do not print information about nodes. This parameter's value should not include a leading slash (e.g., 'contents.html').
leaf_suffixAppended to each leaf item found. Likely '.html', but if the empty string do not print information about leaves.
outWrite the site map to this stream
pathWrite the data for this node in the catalog. Starts with a slash.

Implements BESCatalog.

Definition at line 631 of file BESCatalogDirectory.cc.

◆ reference_catalog()

virtual void BESCatalog::reference_catalog ( )
inlinevirtualinherited

Increase the count of clients that reference this catalog.

This class maintains a count of the clients that reference the catalog. When count of clients drops to zero, the instance can be deleted.

Todo
Revisit the reference counting behavior - maybe there's a better way to manage these catalogs?

Definition at line 80 of file BESCatalog.h.

◆ show_catalog()

BESCatalogEntry * BESCatalogDirectory::show_catalog ( const std::string & container,
BESCatalogEntry * entry )
virtual

Get the CatalogEntry for the given node.

Deprecated
Switch to get_node(); drop use of CatalogEntry objects
Parameters
nodeThe node within the Catalog
entryIf not null, link the newly built CatalogEntry object to
  • entry as a child node.
Returns
The CatalogEntry for this node.

Implements BESCatalog.

Definition at line 108 of file BESCatalogDirectory.cc.


The documentation for this class was generated from the following files: