37 #include "BESContainerStorageList.h" 38 #include "BESContainerStorage.h" 39 #include "BESSyntaxUserError.h" 40 #include "BESContainer.h" 41 #include "TheBESKeys.h" 49 BESContainerStorageList::BESContainerStorageList() :
54 BESContainerStorageList::~BESContainerStorageList()
56 BESContainerStorageList::persistence_list *pl = _first;
58 if (pl->_persistence_obj) {
59 delete pl->_persistence_obj;
61 BESContainerStorageList::persistence_list *next = pl->_next;
83 _first =
new BESContainerStorageList::persistence_list;
84 _first->_persistence_obj = cp;
85 _first->_reference = 1;
90 BESContainerStorageList::persistence_list *pl = _first;
92 while (done ==
false) {
93 if (pl->_persistence_obj->get_name() != cp->
get_name()) {
98 pl->_next =
new BESContainerStorageList::persistence_list;
99 pl->_next->_reference = 1;
100 pl->_next->_persistence_obj = cp;
101 pl->_next->_next = 0;
128 BESContainerStorageList::persistence_list *pl = _first;
131 while (done ==
false) {
133 if (pl->_persistence_obj && pl->_persistence_obj->get_name() == persist_name) {
164 BESContainerStorageList::persistence_list *pl = _first;
165 BESContainerStorageList::persistence_list *last = 0;
168 while (done ==
false) {
170 if (pl->_persistence_obj && pl->_persistence_obj->get_name() == persist_name) {
174 if (!pl->_reference) {
176 _first = _first->_next;
180 throw BESInternalError(
"ContainerStorageList last is null", __FILE__, __LINE__);
181 last->_next = pl->_next;
183 delete pl->_persistence_obj;
213 BESContainerStorageList::persistence_list *pl = _first;
215 while (done ==
false) {
217 if (persist_name == pl->_persistence_obj->get_name()) {
218 ret = pl->_persistence_obj;
232 bool BESContainerStorageList::isnice()
235 string key =
"BES.Container.Persistence";
239 if (isnice ==
"Nice" || isnice ==
"nice" || isnice ==
"NICE")
273 BESContainerStorageList::persistence_list *pl = _first;
275 while (done ==
false) {
277 ret_container = pl->_persistence_obj->look_for(sym_name);
289 if (!ret_container) {
291 LOG(
"Could not find the symbolic name " << sym_name << endl);
294 string s = (string)
"Could not find the symbolic name " + sym_name;
299 return ret_container;
319 BESContainerStorageList::persistence_list *pl = _first;
321 (void) pl->_persistence_obj->del_container(sym_name);
341 BESContainerStorageList::persistence_list *pl = _first;
343 map<string, string> props;
344 props[
"name"] = pl->_persistence_obj->get_name();
345 info.begin_tag(
"store", &props);
346 pl->_persistence_obj->show_containers(info);
347 info.end_tag(
"store");
361 strm << BESIndent::LMarg <<
"BESContainerStorageList::dump - (" << (
void *)
this <<
")" << endl;
363 BESContainerStorageList::persistence_list *pl = _first;
365 strm << BESIndent::LMarg <<
"container storage:" << endl;
368 pl->_persistence_obj->dump(strm);
371 BESIndent::UnIndent();
374 strm << BESIndent::LMarg <<
"container storage: empty" << endl;
376 BESIndent::UnIndent();
380 BESContainerStorageList::TheList()
382 if (_instance == 0) {
provides persistent storage for data storage information represented by a container.
virtual BESContainer * look_for(const std::string &sym_name)
look for the specified container information in the list of persistent stores.
virtual void dump(std::ostream &strm) const
dumps information about this object
exception thrown if inernal error encountered
virtual bool deref_persistence(const std::string &persist_name)
dereference a persistent store in the list.
virtual bool add_persistence(BESContainerStorage *p)
Add a persistent store to the list.
void get_value(const std::string &s, std::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 BESContainerStorage * find_persistence(const std::string &persist_name)
find the persistence store with the given name
informational response object
static TheBESKeys * TheKeys()
Provides a mechanism for accessing container information from different container stores registered w...
virtual void delete_container(const std::string &sym_name)
scan all of the container stores and remove any containers called
A container is something that holds data. E.G., a netcdf file or a database entry.
virtual void show_containers(BESInfo &info)
show information for each container in each persistence store
virtual bool ref_persistence(const std::string &persist_name)
refence the specified persistent store if in the list
virtual const std::string & get_name() const
retrieve the name of this persistent store