37 #include "BESContainerStorageList.h"
38 #include "BESContainerStorage.h"
39 #include "BESSyntaxUserError.h"
40 #include "BESContainer.h"
41 #include "TheBESKeys.h"
54 BESContainerStorageList::BESContainerStorageList() :
59 BESContainerStorageList::~BESContainerStorageList()
61 BESContainerStorageList::persistence_list *pl = _first;
63 if (pl->_persistence_obj) {
64 delete pl->_persistence_obj;
66 BESContainerStorageList::persistence_list *next = pl->_next;
88 _first =
new BESContainerStorageList::persistence_list;
89 _first->_persistence_obj = cp;
90 _first->_reference = 1;
95 BESContainerStorageList::persistence_list *pl = _first;
97 while (done ==
false) {
98 if (pl->_persistence_obj->get_name() != cp->
get_name()) {
103 pl->_next =
new BESContainerStorageList::persistence_list;
104 pl->_next->_reference = 1;
105 pl->_next->_persistence_obj = cp;
106 pl->_next->_next = 0;
133 BESContainerStorageList::persistence_list *pl = _first;
136 while (done ==
false) {
138 if (pl->_persistence_obj && pl->_persistence_obj->get_name() == persist_name) {
169 BESContainerStorageList::persistence_list *pl = _first;
170 BESContainerStorageList::persistence_list *last = 0;
173 while (done ==
false) {
175 if (pl->_persistence_obj && pl->_persistence_obj->get_name() == persist_name) {
179 if (!pl->_reference) {
181 _first = _first->_next;
185 throw BESInternalError(
"ContainerStorageList last is null", __FILE__, __LINE__);
186 last->_next = pl->_next;
188 delete pl->_persistence_obj;
218 BESContainerStorageList::persistence_list *pl = _first;
220 while (done ==
false) {
222 if (persist_name == pl->_persistence_obj->get_name()) {
223 ret = pl->_persistence_obj;
237 bool BESContainerStorageList::isnice()
240 string key =
"BES.Container.Persistence";
244 if (isnice ==
"Nice" || isnice ==
"nice" || isnice ==
"NICE")
278 BESContainerStorageList::persistence_list *pl = _first;
280 while (done ==
false) {
282 ret_container = pl->_persistence_obj->look_for(sym_name);
294 if (!ret_container) {
295 string msg = (string)
"Could not find the symbolic name " + sym_name;
296 ERROR_LOG(msg << endl);
302 return ret_container;
322 BESContainerStorageList::persistence_list *pl = _first;
324 (void) pl->_persistence_obj->del_container(sym_name);
344 BESContainerStorageList::persistence_list *pl = _first;
346 std::map<string, string> props;
347 props[
"name"] = pl->_persistence_obj->get_name();
348 info.begin_tag(
"store", &props);
349 pl->_persistence_obj->show_containers(info);
350 info.end_tag(
"store");
364 strm << BESIndent::LMarg <<
"BESContainerStorageList::dump - (" << (
void *)
this <<
")" << endl;
366 BESContainerStorageList::persistence_list *pl = _first;
368 strm << BESIndent::LMarg <<
"container storage:" << endl;
371 pl->_persistence_obj->dump(strm);
374 BESIndent::UnIndent();
377 strm << BESIndent::LMarg <<
"container storage: empty" << endl;
379 BESIndent::UnIndent();
383 BESContainerStorageList::TheList()
385 if (_instance == 0) {
Provides a mechanism for accessing container information from different container stores registered w...
virtual bool ref_persistence(const std::string &persist_name)
refence the specified persistent store if in the list
virtual void show_containers(BESInfo &info)
show information for each container in each persistence store
virtual void dump(std::ostream &strm) const
dumps information about this object
virtual bool add_persistence(BESContainerStorage *p)
Add a persistent store to the list.
virtual BESContainer * look_for(const std::string &sym_name)
look for the specified container information in the list of persistent stores.
virtual void delete_container(const std::string &sym_name)
scan all of the container stores and remove any containers called
virtual bool deref_persistence(const std::string &persist_name)
dereference a persistent store in the list.
virtual BESContainerStorage * find_persistence(const std::string &persist_name)
find the persistence store with the given name
provides persistent storage for data storage information represented by a container.
virtual const std::string & get_name() const
retrieve the name of this persistent store
A container is something that holds data. E.G., a netcdf file or a database entry.
informational response object
exception thrown if internal error encountered
error thrown if there is a user syntax error in the request or any other user error
void get_value(const std::string &s, std::string &val, bool &found)
Retrieve the value of a given key, if set.
static TheBESKeys * TheKeys()