33 #include "BESContainerStorageVolatile.h" 34 #include "BESFileContainer.h" 35 #include "BESInternalError.h" 36 #include "BESSyntaxUserError.h" 38 #include "TheBESKeys.h" 40 #include "BESServiceRegistry.h" 53 string key =
"BES.Data.RootDirectory";
56 if (_root_dir ==
"") {
57 string s = key +
" not defined in BES configuration file";
62 key = (string)
"BES.FollowSymLinks";
66 if (found && (s_str ==
"yes" || s_str ==
"on" || s_str ==
"true")) {
67 _follow_sym_links =
true;
71 BESContainerStorageVolatile::~BESContainerStorageVolatile()
90 BESContainerStorageVolatile::Container_citer i;
91 i = _container_list.find(sym_name);
92 if (i != _container_list.end()) {
117 BESDEBUG(
"bes",
"BESContainerStorageVolatile::add_container() - " 118 <<
"Adding container with name \"" << sym_name
119 <<
"\", real name \"" << real_name
120 <<
"\", type \"" << type <<
"\"" << endl );
125 string s =
"Unable to add container, type of data must be specified";
130 BESContainerStorageVolatile::Container_citer i;
131 i = _container_list.find(sym_name);
132 if (i != _container_list.end()) {
133 string s = (string)
"A container with the name " + sym_name +
" already exists";
148 BESDEBUG(
"container",
"BESContainerStorageVolatile::add_container() - " 149 <<
" _root_dir: " << _root_dir
150 <<
" real_name: " << real_name
151 <<
" new_r_name: " << new_r_name
158 _container_list[sym_name] = c;
181 string s =
"Unable to add container, container passed is null";
185 string s =
"Unable to add container, type of data must be specified";
189 BESContainerStorageVolatile::Container_citer i;
190 i = _container_list.find(sym_name);
191 if (i != _container_list.end()) {
192 string s = (string)
"A container with the name " + sym_name +
" already exists";
195 _container_list[sym_name] = c;
207 BESContainerStorageVolatile::Container_iter i;
208 i = _container_list.find(s_name);
209 if (i != _container_list.end()) {
211 _container_list.erase(i);
229 while (_container_list.size() != 0) {
230 Container_iter ci = _container_list.begin();
232 _container_list.erase(ci);
276 string::size_type root_len = _root_dir.length();
277 BESContainerStorageVolatile::Container_iter i = _container_list.begin();
278 BESContainerStorageVolatile::Container_iter e = _container_list.end();
279 for (; i != e; i++) {
283 if (real.length() > root_len) {
284 if (real.compare(0, root_len, _root_dir) == 0) {
285 real = real.substr(root_len, real.length() - root_len);
302 strm << BESIndent::LMarg <<
"BESContainerStorageVolatile::dump - (" << (
void *)
this <<
")" << endl;
304 strm << BESIndent::LMarg <<
"name: " <<
get_name() << endl;
305 if (_container_list.size()) {
306 strm << BESIndent::LMarg <<
"containers:" << endl;
308 BESContainerStorageVolatile::Container_citer i = _container_list.begin();
309 BESContainerStorageVolatile::Container_citer ie = _container_list.end();
310 for (; i != ie; i++) {
314 BESIndent::UnIndent();
317 strm << BESIndent::LMarg <<
"containers: none" << endl;
319 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.
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
virtual bool del_container(const string &s_name)
removes a container with the given symbolic name from the list and deletes it.
void get_value(const string &s, string &val, bool &found)
Retrieve the value of a given key, if set.
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)
static BESKeys * TheKeys()
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