39 #include "BESContainerStorageList.h"
40 #include "BESContainerStorage.h"
41 #include "BESSyntaxUserError.h"
42 #include "BESContainer.h"
43 #include "TheBESKeys.h"
51 BESContainerStorageList::BESContainerStorageList() :
56 BESContainerStorageList::~BESContainerStorageList()
58 BESContainerStorageList::persistence_list *pl = _first;
60 if (pl->_persistence_obj) {
61 delete pl->_persistence_obj;
63 BESContainerStorageList::persistence_list *next = pl->_next;
85 _first =
new BESContainerStorageList::persistence_list;
86 _first->_persistence_obj = cp;
87 _first->_reference = 1;
92 BESContainerStorageList::persistence_list *pl = _first;
94 while (done ==
false) {
95 if (pl->_persistence_obj->get_name() != cp->
get_name()) {
100 pl->_next =
new BESContainerStorageList::persistence_list;
101 pl->_next->_reference = 1;
102 pl->_next->_persistence_obj = cp;
103 pl->_next->_next = 0;
130 BESContainerStorageList::persistence_list *pl = _first;
133 while (done ==
false) {
135 if (pl->_persistence_obj && pl->_persistence_obj->get_name() == persist_name) {
166 BESContainerStorageList::persistence_list *pl = _first;
167 BESContainerStorageList::persistence_list *last = 0;
170 while (done ==
false) {
172 if (pl->_persistence_obj && pl->_persistence_obj->get_name() == persist_name) {
176 if (!pl->_reference) {
178 _first = _first->_next;
182 throw BESInternalError(
"ContainerStorageList last is null", __FILE__, __LINE__);
183 last->_next = pl->_next;
185 delete pl->_persistence_obj;
215 BESContainerStorageList::persistence_list *pl = _first;
217 while (done ==
false) {
219 if (persist_name == pl->_persistence_obj->get_name()) {
220 ret = pl->_persistence_obj;
234 bool BESContainerStorageList::isnice()
237 string key =
"BES.Container.Persistence";
241 if (isnice ==
"Nice" || isnice ==
"nice" || isnice ==
"NICE")
275 BESContainerStorageList::persistence_list *pl = _first;
277 while (done ==
false) {
279 ret_container = pl->_persistence_obj->look_for(sym_name);
291 if (!ret_container) {
293 LOG(
"Could not find the symbolic name " << sym_name << endl);
296 string s = (string)
"Could not find the symbolic name " + sym_name;
301 return ret_container;
321 BESContainerStorageList::persistence_list *pl = _first;
323 (void) pl->_persistence_obj->del_container(sym_name);
343 BESContainerStorageList::persistence_list *pl = _first;
345 std::map<string, string> props;
346 props[
"name"] = pl->_persistence_obj->get_name();
347 info.begin_tag(
"store", &props);
348 pl->_persistence_obj->show_containers(info);
349 info.end_tag(
"store");
363 strm << BESIndent::LMarg <<
"BESContainerStorageList::dump - (" << (
void *)
this <<
")" << endl;
365 BESContainerStorageList::persistence_list *pl = _first;
367 strm << BESIndent::LMarg <<
"container storage:" << endl;
370 pl->_persistence_obj->dump(strm);
373 BESIndent::UnIndent();
376 strm << BESIndent::LMarg <<
"container storage: empty" << endl;
378 BESIndent::UnIndent();
382 BESContainerStorageList::TheList()
384 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()