bes
Updated for version 3.20.6
|
33 #include "BESContainerStorageVolatile.h"
34 #include "BESFileContainer.h"
35 #include "BESInternalError.h"
36 #include "BESSyntaxUserError.h"
38 #include "TheBESKeys.h"
40 #include "BESServiceRegistry.h"
65 string key =
"BES.Data.RootDirectory";
68 if (_root_dir ==
"") {
69 string s = key +
" not defined in BES configuration file";
74 key = (string)
"BES.FollowSymLinks";
78 if (found && (s_str ==
"yes" || s_str ==
"on" || s_str ==
"true")) {
79 _follow_sym_links =
true;
83 BESContainerStorageVolatile::~BESContainerStorageVolatile()
102 BESContainerStorageVolatile::Container_citer i;
103 i = _container_list.find(sym_name);
104 if (i != _container_list.end()) {
109 return ret_container;
134 throw BESInternalError(
string(
"Unable to add container '").append(real_name).append(
"', type of data must be specified"), __FILE__, __LINE__);
137 BESContainerStorageVolatile::Container_citer i = _container_list.find(sym_name);
138 if (i != _container_list.end()) {
139 throw BESInternalError(
string(
"A container with the name '").append(sym_name).append(
"' already exists"), __FILE__, __LINE__);
150 BESDEBUG(
"container",
"BESContainerStorageVolatile::add_container() - "
151 <<
" _root_dir: " << _root_dir
152 <<
" real_name: " << real_name
153 <<
" symbolic name: " << sym_name
154 <<
" fully_qualified_real_name: " << fully_qualified_real_name
163 _container_list[sym_name] = c;
186 throw BESInternalError(
"Unable to add container, container passed is null", __FILE__, __LINE__);
189 throw BESInternalError(
"Unable to add container, type of data must be specified", __FILE__, __LINE__);
194 BESContainerStorageVolatile::Container_citer i = _container_list.find(sym_name);
195 if (i != _container_list.end()) {
196 throw BESInternalError(
string(
"A container with the name '").append(sym_name).append(
"' already exists"), __FILE__, __LINE__);
199 _container_list[sym_name] = c;
211 BESContainerStorageVolatile::Container_iter i = _container_list.find(s_name);
212 if (i != _container_list.end()) {
214 _container_list.erase(i);
232 while (_container_list.size() != 0) {
233 Container_iter ci = _container_list.begin();
235 _container_list.erase(ci);
279 string::size_type root_len = _root_dir.length();
280 BESContainerStorageVolatile::Container_iter i = _container_list.begin();
281 BESContainerStorageVolatile::Container_iter e = _container_list.end();
282 for (; i != e; i++) {
286 if (real.length() > root_len) {
287 if (real.compare(0, root_len, _root_dir) == 0) {
288 real = real.substr(root_len, real.length() - root_len);
305 strm << BESIndent::LMarg <<
"BESContainerStorageVolatile::dump - (" << (
void *)
this <<
")" << endl;
307 strm << BESIndent::LMarg <<
"name: " <<
get_name() << endl;
308 if (_container_list.size()) {
309 strm << BESIndent::LMarg <<
"containers:" << endl;
311 BESContainerStorageVolatile::Container_citer i = _container_list.begin();
312 BESContainerStorageVolatile::Container_citer ie = _container_list.end();
313 for (; i != ie; i++) {
317 BESIndent::UnIndent();
320 strm << BESIndent::LMarg <<
"containers: none" << endl;
322 BESIndent::UnIndent();
virtual void services_handled(const std::string &handler, std::list< std::string > &services)
returns the list of servies provided by the handler in question
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
provides persistent storage for data storage information represented by a container.
virtual void dump(std::ostream &strm) const
dumps information about this object
Holds real data, container type and constraint for symbolic name read from persistence.
virtual BESContainer * ptr_duplicate()=0
pure abstract method to duplicate this instances of BESContainer
virtual void add_container(BESContainer *c)
add the passed container to the list of containers in volatile storage
std::string get_container_type() const
retrieve the type of data this container holds, such as cedar or netcdf.
std::string get_symbolic_name() const
retrieve the symbolic name for this container
static void check_path(const std::string &path, const std::string &root, bool follow_sym_links)
Check if the specified path is valid.
informational response object
virtual BESContainer * look_for(const std::string &sym_name)
looks for the specified container using the symbolic name passed
virtual bool del_containers()
removes all container
static std::string assemblePath(const std::string &firstPart, const std::string &secondPart, bool leadingSlash=false, bool trailingSlash=false)
Assemble path fragments making sure that they are separated by a single '/' character.
virtual const std::string & get_name() const
retrieve the name of this persistent store
static TheBESKeys * TheKeys()
error thrown if there is a user syntax error in the request or any other user error
exception thrown if internal error encountered
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
void get_value(const std::string &s, std::string &val, bool &found)
Retrieve the value of a given key, if set.
BESContainerStorageVolatile(const std::string &n)
create an instance of this persistent store with the given name.
virtual void show_containers(BESInfo &info)
show information for each container in this persistent store
A container is something that holds data. E.G., a netcdf file or a database entry.
virtual bool del_container(const std::string &s_name)
removes a container with the given symbolic name from the list and deletes it.
std::string get_real_name() const
retrieve the real name for this container, such as a file name.
static std::string lowercase(const std::string &s)
void set_relative_name(const std::string &relative)
Set the relative name of the object in this container.
virtual void dump(std::ostream &strm) const
dumps information about this object