#include <BESContainerStorageCatalog.h>
Public Types | |
typedef map< string, BESContainer * > ::const_iterator | Container_citer |
typedef map< string, BESContainer * >::iterator | Container_iter |
Public Member Functions | |
BESContainerStorageCatalog (const string &n) | |
create an instance of this persistent store with the given name. | |
virtual | ~BESContainerStorageCatalog () |
virtual void | add_container (const string &sym_name, const string &real_name, const string &type) |
adds a container with the provided information | |
bool | isData (const string &inQuestion, list< string > &provides) |
is the specified node in question served by a request handler | |
virtual void | dump (ostream &strm) const |
dumps information about this object | |
virtual BESContainer * | look_for (const string &sym_name) |
looks for the specified container using the symbolic name passed | |
virtual bool | del_container (const 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 | show_containers (BESInfo &info) |
show information for each container in this persistent store | |
virtual const string & | get_name () const |
retrieve the name of this persistent store | |
Protected Member Functions | |
virtual void | add_container (BESContainer *c) |
add the passed container to the list of containers in volatile storage | |
Protected Attributes | |
string | _root_dir |
bool | _follow_sym_links |
string | _my_name |
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 configuraiton file using TheBESKeys. It also gets the catalogs 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.
typedef map< string, BESContainer * >::const_iterator BESContainerStorageVolatile::Container_citer [inherited] |
typedef map< string, BESContainer * >::iterator BESContainerStorageVolatile::Container_iter [inherited] |
BESContainerStorageCatalog::BESContainerStorageCatalog | ( | const string & | n | ) |
create an instance of this persistent store with the given name.
Creates an instances of BESContainerStorageCatalog 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.
n | name of this persistent store |
BESForbiddenError | if the resources requested is not accessible | |
BESNotFoundError | if the resources requested is not found | |
BESInternalError | if there is a problem determining the resource |
References BESContainerStorageVolatile::_follow_sym_links, BESContainerStorageVolatile::_root_dir, BESCatalogUtils::follow_sym_links(), BESCatalogUtils::get_root_dir(), and BESCatalogUtils::Utils().
BESContainerStorageCatalog::~BESContainerStorageCatalog | ( | ) | [virtual] |
void BESContainerStorageVolatile::add_container | ( | BESContainer * | c | ) | [protected, virtual, inherited] |
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.
c | container to add to the list |
BESContainerStorageExcpetion | if the passed container is null | |
BESContainerStorageExcpetion | if no type is specified in the passed container | |
BESContainerStorageExcpetion | if a container with the passed symbolic name already exists. |
References BESContainer::get_container_type(), and BESContainer::get_symbolic_name().
void BESContainerStorageCatalog::add_container | ( | const string & | sym_name, | |
const string & | real_name, | |||
const 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.
sym_name | symbolic name of the container | |
real_name | real name (path to the file relative to the root catalog's root directory) | |
type | type of data represented by this container |
BESForbiddenError | if the resources requested is not accessible | |
BESNotFoundError | if the resources requested is not found | |
BESInternalError | if there is a problem determining the resource determined using the regular expression extensions. |
Reimplemented from BESContainerStorageVolatile.
References BESCatalogUtils::exclude(), BESCatalogUtils::include(), BESCatalogUtils::match_list_begin(), BESCatalogUtils::match_list_end(), BESCatalogUtils::BESCatalogUtils::type_reg::reg, and BESCatalogUtils::BESCatalogUtils::type_reg::type.
bool BESContainerStorageVolatile::del_container | ( | const string & | s_name | ) | [virtual, inherited] |
removes a container with the given symbolic name from the list and deletes it.
s_name | symbolic name for the container |
Implements BESContainerStorage.
bool BESContainerStorageVolatile::del_containers | ( | ) | [virtual, inherited] |
removes all container
This method removes all containers from the persistent store. It does not delete the real data behind the container.
Implements BESContainerStorage.
Referenced by BESContainerStorageVolatile::~BESContainerStorageVolatile().
void BESContainerStorageCatalog::dump | ( | 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.
strm | C++ i/o stream to dump the information to |
Reimplemented from BESContainerStorageVolatile.
References BESCatalogUtils::dump(), BESContainerStorage::get_name(), BESIndent::Indent(), BESIndent::LMarg(), and BESIndent::UnIndent().
virtual const string& BESContainerStorage::get_name | ( | ) | const [inline, virtual, inherited] |
retrieve the name of this persistent store
References BESContainerStorage::_my_name.
Referenced by BESContainerStorageList::add_persistence(), BESContainerStorageVolatile::dump(), BESContainerStorageFile::dump(), dump(), BESContainerStorageVolatile::show_containers(), and BESContainerStorageFile::show_containers().
bool BESContainerStorageCatalog::isData | ( | const string & | inQuestion, | |
list< string > & | provides | |||
) |
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
inQuestion | node to look up | |
provides | what is provided for the node by the node types request handler return true if a request hanlder serves the specified node, false otherwise |
References BESCatalogUtils::match_list_begin(), BESCatalogUtils::match_list_end(), BESCatalogUtils::BESCatalogUtils::type_reg::reg, and BESCatalogUtils::BESCatalogUtils::type_reg::type.
BESContainer * BESContainerStorageVolatile::look_for | ( | const string & | sym_name | ) | [virtual, inherited] |
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.
sym_name | symbolic name of the container to look for |
Implements BESContainerStorage.
References BESContainer::ptr_duplicate().
void BESContainerStorageVolatile::show_containers | ( | BESInfo & | info | ) | [virtual, inherited] |
show information for each container in this persistent store
For each container in this persistent store, add infomation 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.
info | object to store the container and persistent store information |
Implements BESContainerStorage.
References BESInfo::add_tag(), BESInfo::begin_tag(), BESInfo::end_tag(), BESContainer::get_container_type(), BESContainerStorage::get_name(), BESContainer::get_real_name(), and BESContainer::get_symbolic_name().
bool BESContainerStorageVolatile::_follow_sym_links [protected, inherited] |
string BESContainerStorage::_my_name [protected, inherited] |
Referenced by BESContainerStorage::get_name().
string BESContainerStorageVolatile::_root_dir [protected, inherited] |