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

implementation of BESContainerStorage that represents a way to read container information from a file. More...

#include <BESContainerStorageFile.h>

Inheritance diagram for BESContainerStorageFile:
Inheritance graph
Collaboration diagram for BESContainerStorageFile:
Collaboration graph

Public Member Functions

virtual void add_container (BESContainer *c)
 Add a container to the store.
 
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
 
 BESContainerStorageFile (const std::string &n)
 pull container information from the specified file
 
virtual bool del_container (const std::string &s_name)
 removes a container with the given symbolic name
 
virtual bool del_containers ()
 removes all containers
 
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)
 determine if the given container is data and what servies are available for it
 
virtual BESContainerlook_for (const std::string &sym_name)
 looks for the specified container in the list of containers loaded from the file.
 
virtual void show_containers (BESInfo &info)
 show information for each container in this persistent store
 

Protected Member Functions

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

std::string _my_name
 

Detailed Description

implementation of BESContainerStorage that represents a way to read container information from a file.

This implementation of BESContainerStorage loads container information from a file. The name of the file is determined from the bes configuration file. The key is:

BES.Container.Persistence.File.<name>

where <name> is the name of this persistent store.

The format of the file is:

<symbolic_name> <real_name> <data type>

where the <symbolic_name> is the symbolic name of the container, the <real_name> represents the physical location of the data, such as a file, and the <data type> is the type of data being represented, such as netcdf, cedar, etc...

One container per line, cannot span multiple lines

See also
BESContainerStorage
BESFileContainer
BESKeys

Definition at line 68 of file BESContainerStorageFile.h.

Constructor & Destructor Documentation

◆ BESContainerStorageFile()

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

pull container information from the specified file

Constructs a BESContainerStorageFile from a file specified by a key in the bes configuration file. The key is constructed using the name of this persistent store.

BES.Container.Persistence.File.<name>

where <name> is the name of this persistent store.

The containers are then read into memory. The format of the file is as follows.

<symbolic_name> <real_name> <data type>

where the symbolic name is the symbolic name of the container, the <real_name> represents the physical location of the data, such as a file, and the <data type> is the type of data being represented, such as netcdf, cedar, etc...

One container per line, cannot span multiple lines

Parameters
nname of this persistent store
Exceptions
BESInternalErrorif the file cannot be opened or if there is an error in reading in the container information.
See also
BESContainerStorage
BESFileContainer
BESInternalError

Definition at line 84 of file BESContainerStorageFile.cc.

◆ ~BESContainerStorageFile()

BESContainerStorageFile::~BESContainerStorageFile ( )
virtual

Definition at line 149 of file BESContainerStorageFile.cc.

Member Function Documentation

◆ add_container() [1/2]

void BESContainerStorageFile::add_container ( BESContainer * c)
virtual

Add a container to the store.

Parameters
c

Implements BESContainerStorage.

Definition at line 200 of file BESContainerStorageFile.cc.

◆ add_container() [2/2]

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

adds a container with the provided information

This method adds a container to the persistence store with the specified information. This functionality is not currently supported for file persistence.

Parameters
sym_namesymbolic name for the container
real_namereal name for the container
typetype of data represented by this container

Implements BESContainerStorage.

Definition at line 194 of file BESContainerStorageFile.cc.

◆ del_container()

bool BESContainerStorageFile::del_container ( const std::string & s_name)
virtual

removes a container with the given symbolic name

This method removes a container to the persistence store with the given symbolic name. It deletes the container. The container is NOT removed from the file from which it was loaded, however.

Parameters
s_namesymbolic name for the container
Returns
true if successfully removes container, false otherwise

Implements BESContainerStorage.

Definition at line 215 of file BESContainerStorageFile.cc.

◆ del_containers()

bool BESContainerStorageFile::del_containers ( )
virtual

removes all containers

This method removes all containers from the persistent store. The container is NOT removed from the file from which it was loaded, however.

Returns
true if successfully removes all containers, false otherwise

Implements BESContainerStorage.

Definition at line 238 of file BESContainerStorageFile.cc.

◆ dump()

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

dumps information about this object

Displays the pointer value of this instance along with information about the containers in this storage

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

Implements BESContainerStorage.

Definition at line 308 of file BESContainerStorageFile.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 BESContainerStorageFile::isData ( const std::string & inQuestion,
std::list< std::string > & provides )
virtual

determine if the given container is data and what servies are available for it

Parameters
inQuestionthe container in question
providesan output parameter for storing the list of services provided for this container

Implements BESContainerStorage.

Definition at line 258 of file BESContainerStorageFile.cc.

◆ look_for()

BESContainer * BESContainerStorageFile::look_for ( const std::string & sym_name)
virtual

looks for the specified container in the list of containers loaded from the file.

If a match is made with the specified symbolic name then a BESFileContainer instance is created using the the information found (real name and container type). If not found then NULL is returned.

Parameters
sym_namename of the container to look for
Returns
a new BESFileContainer if the sym_name is found in the file, else 0
See also
BESFileContainer

Implements BESContainerStorage.

Definition at line 171 of file BESContainerStorageFile.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 BESContainerStorageFile::show_containers ( BESInfo & info)
virtual

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 all of the containers loaded from the file specified by the key BES.Container.Persistence.File.<store_name> is added to the information object.

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

Implements BESContainerStorage.

Definition at line 288 of file BESContainerStorageFile.cc.

Member Data Documentation

◆ _my_name

std::string BESContainerStorage::_my_name
protectedinherited

Definition at line 69 of file BESContainerStorage.h.


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