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

implementation of BESContainerStorage that represents a data within a catalog repository More...

#include <BESFileContainerStorage.h>

Inheritance diagram for BESFileContainerStorage:
Inheritance graph
Collaboration diagram for BESFileContainerStorage:
Collaboration graph

Public Types

typedef std::map< std::string, BESContainer * >::const_iterator Container_citer
 
typedef std::map< std::string, BESContainer * >::iterator Container_iter
 

Public Member Functions

virtual void add_container (const std::string &sym_name, const std::string &real_name, const std::string &type)
 adds a container with the provided information
 
 BESFileContainerStorage (const std::string &n)
 create an instance of this persistent store with the given name.
 
virtual bool del_container (const std::string &s_name)
 removes a container with the given symbolic name from the list and deletes it.
 
virtual bool del_containers ()
 removes all container
 
virtual void dump (std::ostream &strm) const
 dumps information about this object
 
virtual const std::string & get_name () const
 retrieve the name of this persistent store
 
virtual bool isData (const std::string &inQuestion, std::list< std::string > &provides)
 is the specified node in question served by a request handler
 
virtual BESContainerlook_for (const std::string &sym_name)
 looks for the specified container using the symbolic name passed
 
virtual void show_containers (BESInfo &info)
 show information for each container in this persistent store
 

Protected Member Functions

virtual void add_container (BESContainer *c)
 add the passed container to the list of containers in volatile storage
 
virtual void show_container (const std::string &sym_name, const std::string &real_name, const std::string &type, BESInfo &info)
 add information for a container to the informational response object
 

Protected Attributes

bool _follow_sym_links
 
std::string _my_name
 
std::string _root_dir
 

Detailed Description

implementation of BESContainerStorage that represents a data within a catalog repository

When a container is added to this container storage, the file extension is used to determine the type of data using a set of regular expressions. The regular expressions are retrieved from the BES configuration file using TheBESKeys. It also gets the catalog's root directory for where the files exist. This way, the user need not know the root directory or the type of data represented by the container.

Catalog._name_.RootDirectory is the key representing the base directory where the files are physically located. The real_name of the container is determined by concatenating the file name to the base directory.

Catalog._name_.TypeMatch is the key representing the regular expressions. This key is formatted as follows:

data type : reg exp ; data type : reg exp ;

For example: cedar:cedar/.*\.cbf;cdf:cdf/.*\.cdf;

The first would match anything that might look like: cedar/datfile01.cbf

name is the name of this container storage, so you could have multiple container stores using regular expressions.

The containers are stored in a volatile list.

See also
BESContainerStorage
BESContainer
BESKeys

Definition at line 77 of file BESFileContainerStorage.h.

Member Typedef Documentation

◆ Container_citer

typedef std::map<std::string,BESContainer*>::const_iterator BESContainerStorageVolatile::Container_citer
inherited

Definition at line 70 of file BESContainerStorageVolatile.h.

◆ Container_iter

typedef std::map<std::string,BESContainer*>::iterator BESContainerStorageVolatile::Container_iter
inherited

Definition at line 71 of file BESContainerStorageVolatile.h.

Constructor & Destructor Documentation

◆ BESFileContainerStorage()

BESFileContainerStorage::BESFileContainerStorage ( const std::string & n)

create an instance of this persistent store with the given name.

Creates an instances of BESFileContainerStorage with the given name. Looks up the base directory and regular expressions in the bes configuration file using TheBESKeys. Throws an exception if either of these cannot be determined or if the regular expressions are incorrectly formed.

<data type>:<reg exp>; <data type>:<reg exp>;

each type/reg expression pair is separated by a semicolon and ends with a semicolon. The data type/expression pair itself is separated by a colon.

Parameters
nThe name of the Catalog/ContainerStorage (they must be the same).
Exceptions
BESForbiddenErrorif the resources requested is not accessible
BESNotFoundErrorif the resources requested is not found
BESInternalErrorif there is a problem determining the resource
See also
BESKeys
BESContainer

Definition at line 79 of file BESFileContainerStorage.cc.

◆ ~BESFileContainerStorage()

BESFileContainerStorage::~BESFileContainerStorage ( )
virtual

Definition at line 90 of file BESFileContainerStorage.cc.

Member Function Documentation

◆ add_container() [1/2]

void BESContainerStorageVolatile::add_container ( BESContainer * c)
protectedvirtualinherited

add the passed container to the list of containers in volatile storage

This method adds the passed container to the list of volatile containers. The passed container is owned by the list if added and should not be deleted by the caller.

If a container with the symbolic name of the passed container is already in the list then an exception is thrown.

Parameters
ccontainer to add to the list
Exceptions
BESContainerStorageExcpetionif the passed container is null
BESContainerStorageExcpetionif no type is specified in the passed container
BESContainerStorageExcpetionif a container with the passed symbolic name already exists.

Implements BESContainerStorage.

Definition at line 191 of file BESContainerStorageVolatile.cc.

◆ add_container() [2/2]

void BESFileContainerStorage::add_container ( const std::string & sym_name,
const std::string & real_name,
const std::string & type )
virtual

adds a container with the provided information

If a match is made with the real name passed against the list of regular expressions representing the type of data, then the type is set.

The real name of the container (the file name) is constructed using the root directory from the initialization file with the passed real name appended to it.

Before adding the actual file name (catalog root directory + real_name passed), the file name is compared against a list of regular expressions representing files that can be included in the catalog and against a list of regular expressions representing files to exclude from the catalog. If the file name is in the include list and not in the exclude list, then it is added to the storage.

The information is then passed to the add_container method in the parent class.

Parameters
sym_namesymbolic name of the container
real_namereal name (path to the file relative to the root catalog's root directory)
typetype of data represented by this container
Exceptions
BESForbiddenErrorif the resources requested is not accessible
BESNotFoundErrorif the resources requested is not found
BESInternalErrorif there is a problem determining the resource determined using the regular expression extensions.

Reimplemented from BESContainerStorageVolatile.

Definition at line 123 of file BESFileContainerStorage.cc.

◆ del_container()

bool BESContainerStorageVolatile::del_container ( const std::string & s_name)
virtualinherited

removes a container with the given symbolic name from the list and deletes it.

Parameters
s_namesymbolic name for the container
Returns
true if successfully removed and false otherwise

Implements BESContainerStorage.

Definition at line 216 of file BESContainerStorageVolatile.cc.

◆ del_containers()

bool BESContainerStorageVolatile::del_containers ( )
virtualinherited

removes all container

This method removes all containers from the persistent store. It does not delete the real data behind the container.

Returns
true if successfully removed and false otherwise

Implements BESContainerStorage.

Definition at line 241 of file BESContainerStorageVolatile.cc.

◆ dump()

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

dumps information about this object

Displays the pointer value of this instance along with information about the "storage" of containers in a catalog.

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

Reimplemented from BESContainerStorageVolatile.

Definition at line 189 of file BESFileContainerStorage.cc.

◆ get_name()

virtual const std::string & BESContainerStorage::get_name ( ) const
inlinevirtualinherited

retrieve the name of this persistent store

Returns
name of this persistent store.

Definition at line 91 of file BESContainerStorage.h.

◆ isData()

bool BESFileContainerStorage::isData ( const std::string & inQuestion,
std::list< std::string > & provides )
virtual

is the specified node in question served by a request handler

Determine if the node in question is served by a request handler (provides data) and what the request handler serves for the node

Parameters
inQuestionnode to look up
provideswhat is provided for the node by the node type's request handler
Returns
true if a request handler serves the specified node, false otherwise

Reimplemented from BESContainerStorageVolatile.

Definition at line 173 of file BESFileContainerStorage.cc.

◆ look_for()

BESContainer * BESContainerStorageVolatile::look_for ( const std::string & sym_name)
virtualinherited

looks for the specified container using the symbolic name passed

If a match is made with the symbolic name then the stored container is duplicated and returned to the user. If not, 0 is returned.

Parameters
sym_namesymbolic name of the container to look for
Returns
a new BESContainer instance using the ptr_duplicate method on BESContainer

Implements BESContainerStorage.

Definition at line 105 of file BESContainerStorageVolatile.cc.

◆ show_container()

void BESContainerStorage::show_container ( const std::string & sym_name,
const std::string & real_name,
const std::string & type,
BESInfo & info )
protectedvirtualinherited

add information for a container to the informational response object

Parameters
sym_namesymbolic name of the container to add
real_namereal name, e.g. file name, of the container to add
typedata type of the container
infoThe BES information object to add container information to
See also
BESInfo

Definition at line 48 of file BESContainerStorage.cc.

◆ show_containers()

void BESContainerStorageVolatile::show_containers ( BESInfo & info)
virtualinherited

show information for each container in this persistent store

For each container in this persistent store, add information about each of those containers. The information added to the information object includes a line for each container within this persistent store which includes the symbolic name, the real name, and the data type, separated by commas.

In the case of this persistent store information from each container added to the volatile list is added to the information object.

Parameters
infoobject to store the container and persistent store information
See also
BESInfo

Implements BESContainerStorage.

Definition at line 290 of file BESContainerStorageVolatile.cc.

Member Data Documentation

◆ _follow_sym_links

bool BESContainerStorageVolatile::_follow_sym_links
protectedinherited

Definition at line 63 of file BESContainerStorageVolatile.h.

◆ _my_name

std::string BESContainerStorage::_my_name
protectedinherited

Definition at line 69 of file BESContainerStorage.h.

◆ _root_dir

std::string BESContainerStorageVolatile::_root_dir
protectedinherited

Definition at line 62 of file BESContainerStorageVolatile.h.


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