37 #include "BESContainerStorageList.h" 38 #include "BESContainerStorage.h" 39 #include "BESSyntaxUserError.h" 40 #include "BESContainer.h" 41 #include "TheBESKeys.h" 47 BESContainerStorageList::BESContainerStorageList() :
52 BESContainerStorageList::~BESContainerStorageList()
54 BESContainerStorageList::persistence_list *pl = _first;
56 if (pl->_persistence_obj) {
57 delete pl->_persistence_obj;
59 BESContainerStorageList::persistence_list *next = pl->_next;
81 _first =
new BESContainerStorageList::persistence_list;
82 _first->_persistence_obj = cp;
83 _first->_reference = 1;
88 BESContainerStorageList::persistence_list *pl = _first;
90 while (done ==
false) {
91 if (pl->_persistence_obj->get_name() != cp->
get_name()) {
96 pl->_next =
new BESContainerStorageList::persistence_list;
97 pl->_next->_reference = 1;
98 pl->_next->_persistence_obj = cp;
126 BESContainerStorageList::persistence_list *pl = _first;
129 while (done ==
false) {
131 if (pl->_persistence_obj && pl->_persistence_obj->get_name() == persist_name) {
162 BESContainerStorageList::persistence_list *pl = _first;
163 BESContainerStorageList::persistence_list *last = 0;
166 while (done ==
false) {
168 if (pl->_persistence_obj && pl->_persistence_obj->get_name() == persist_name) {
172 if (!pl->_reference) {
174 _first = _first->_next;
178 throw BESInternalError(
"ContainerStorageList last is null", __FILE__, __LINE__);
179 last->_next = pl->_next;
181 delete pl->_persistence_obj;
211 BESContainerStorageList::persistence_list *pl = _first;
213 while (done ==
false) {
215 if (persist_name == pl->_persistence_obj->get_name()) {
216 ret = pl->_persistence_obj;
230 bool BESContainerStorageList::isnice()
233 string key =
"BES.Container.Persistence";
237 if (isnice ==
"Nice" || isnice ==
"nice" || isnice ==
"NICE")
271 BESContainerStorageList::persistence_list *pl = _first;
273 while (done ==
false) {
275 ret_container = pl->_persistence_obj->look_for(sym_name);
287 if (!ret_container) {
289 LOG(
"Could not find the symbolic name " << sym_name << endl);
292 string s = (string)
"Could not find the symbolic name " + sym_name;
297 return ret_container;
314 BESContainerStorageList::persistence_list *pl = _first;
316 map<string, string> props;
317 props[
"name"] = pl->_persistence_obj->get_name();
318 info.begin_tag(
"store", &props);
319 pl->_persistence_obj->show_containers(info);
320 info.end_tag(
"store");
334 strm << BESIndent::LMarg <<
"BESContainerStorageList::dump - (" << (
void *)
this <<
")" << endl;
336 BESContainerStorageList::persistence_list *pl = _first;
338 strm << BESIndent::LMarg <<
"container storage:" << endl;
341 pl->_persistence_obj->dump(strm);
344 BESIndent::UnIndent();
347 strm << BESIndent::LMarg <<
"container storage: empty" << endl;
349 BESIndent::UnIndent();
353 BESContainerStorageList::TheList()
355 if (_instance == 0) {
provides persistent storage for data storage information represented by a container.
exception thrown if inernal error encountered
virtual BESContainerStorage * find_persistence(const string &persist_name)
find the persistence store with the given name
virtual bool add_persistence(BESContainerStorage *p)
Add a persistent store to the list.
void get_value(const string &s, string &val, bool &found)
Retrieve the value of a given key, if set.
error thrown if there is a user syntax error in the request or any other user error
virtual bool ref_persistence(const string &persist_name)
refence the specified persistent store if in the list
informational response object
static TheBESKeys * TheKeys()
Provides a mechanism for accessing container information from different container stores registered w...
virtual bool deref_persistence(const string &persist_name)
dereference a persistent store in the list.
virtual void dump(ostream &strm) const
dumps information about this object
virtual BESContainer * look_for(const string &sym_name)
look for the specified container information in the list of persistent stores.
A container is something that holds data. I.E. a netcdf file or a database entry.
virtual void show_containers(BESInfo &info)
show information for each container in each persistence store
virtual const string & get_name() const
retrieve the name of this persistent store