33 #include "BESContainerStorageVolatile.h" 34 #include "BESFileContainer.h" 35 #include "BESInternalError.h" 36 #include "BESSyntaxUserError.h" 38 #include "TheBESKeys.h" 40 #include "BESServiceRegistry.h" 57 string key =
"BES.Data.RootDirectory";
60 if (_root_dir ==
"") {
61 string s = key +
" not defined in BES configuration file";
66 key = (string)
"BES.FollowSymLinks";
70 if (found && (s_str ==
"yes" || s_str ==
"on" || s_str ==
"true")) {
71 _follow_sym_links =
true;
75 BESContainerStorageVolatile::~BESContainerStorageVolatile()
94 BESContainerStorageVolatile::Container_citer i;
95 i = _container_list.find(sym_name);
96 if (i != _container_list.end()) {
101 return ret_container;
121 BESDEBUG(
"bes",
"BESContainerStorageVolatile::add_container() - " 122 <<
"Adding container with name \"" << sym_name
123 <<
"\", real name \"" << real_name
124 <<
"\", type \"" << type <<
"\"" << endl );
129 string s =
"Unable to add container, type of data must be specified";
134 BESContainerStorageVolatile::Container_citer i;
135 i = _container_list.find(sym_name);
136 if (i != _container_list.end()) {
137 string s = (string)
"A container with the name " + sym_name +
" already exists";
152 BESDEBUG(
"container",
"BESContainerStorageVolatile::add_container() - " 153 <<
" _root_dir: " << _root_dir
154 <<
" real_name: " << real_name
155 <<
" new_r_name: " << new_r_name
162 _container_list[sym_name] = c;
185 string s =
"Unable to add container, container passed is null";
189 string s =
"Unable to add container, type of data must be specified";
193 BESContainerStorageVolatile::Container_citer i;
194 i = _container_list.find(sym_name);
195 if (i != _container_list.end()) {
196 string s = (string)
"A container with the name " + sym_name +
" already exists";
199 _container_list[sym_name] = c;
211 BESContainerStorageVolatile::Container_iter i;
212 i = _container_list.find(s_name);
213 if (i != _container_list.end()) {
215 _container_list.erase(i);
233 while (_container_list.size() != 0) {
234 Container_iter ci = _container_list.begin();
236 _container_list.erase(ci);
280 string::size_type root_len = _root_dir.length();
281 BESContainerStorageVolatile::Container_iter i = _container_list.begin();
282 BESContainerStorageVolatile::Container_iter e = _container_list.end();
283 for (; i != e; i++) {
287 if (real.length() > root_len) {
288 if (real.compare(0, root_len, _root_dir) == 0) {
289 real = real.substr(root_len, real.length() - root_len);
306 strm << BESIndent::LMarg <<
"BESContainerStorageVolatile::dump - (" << (
void *)
this <<
")" << endl;
308 strm << BESIndent::LMarg <<
"name: " <<
get_name() << endl;
309 if (_container_list.size()) {
310 strm << BESIndent::LMarg <<
"containers:" << endl;
312 BESContainerStorageVolatile::Container_citer i = _container_list.begin();
313 BESContainerStorageVolatile::Container_citer ie = _container_list.end();
314 for (; i != ie; i++) {
318 BESIndent::UnIndent();
321 strm << BESIndent::LMarg <<
"containers: none" << endl;
323 BESIndent::UnIndent();
provides persistent storage for data storage information represented by a container.
virtual void show_container(const string &sym_name, const string &real_name, const string &type, BESInfo &info)
add information for a container to the informational response object
virtual BESContainer * look_for(const string &sym_name)
looks for the specified container using the symbolic name passed
exception thrown if inernal error encountered
static string lowercase(const string &s)
virtual void dump(ostream &strm) const
dumps information about this object
Holds real data, container type and constraint for symbolic name read from persistence.
void get_value(const string &s, string &val, bool &found)
Retrieve the value of a given key, if set.
virtual void dump(ostream &strm) const
dumps information about this object
virtual void add_container(BESContainer *c)
add the passed container to the list of containers in volatile storage
error thrown if there is a user syntax error in the request or any other user error
static string assemblePath(const string &firstPart, const string &secondPart, bool addLeadingSlash=false)
Assemble path fragments making sure that they are separated by a single '/' character.
virtual void show_containers(BESInfo &info)
show information for each container in this persistent store
informational response object
static TheBESKeys * TheKeys()
virtual bool del_container(const string &s_name)
removes a container with the given symbolic name from the list and deletes it.
BESContainerStorageVolatile(const string &n)
create an instance of this persistent store with the given name.
string get_real_name() const
retrieve the real name for this container, such as a file name.
string get_container_type() const
retrieve the type of data this container holds, such as cedar or netcdf.
virtual bool del_containers()
removes all container
A container is something that holds data. I.E. a netcdf file or a database entry.
static void check_path(const string &path, const string &root, bool follow_sym_links)
virtual const string & get_name() const
retrieve the name of this persistent store
virtual bool isData(const string &inQuestion, list< string > &provides)
determine if the given container is data and what servies are available for it
virtual BESContainer * ptr_duplicate()=0
pure abstract method to duplicate this instances of BESContainer
virtual void services_handled(const string &handler, list< string > &services)
returns the list of servies provided by the handler in question
string get_symbolic_name() const
retrieve the symbolic name for this container