39 using std::stringstream ;
85 string key =
"BES.Container.Persistence.File." + n ;
90 string s = key +
" not defined in BES configuration file" ;
94 ifstream persistence_file( _file.c_str() ) ;
96 if( !persistence_file )
98 char *err = strerror( myerrno ) ;
99 string s =
"Unable to open persistence file " + _file +
": " ;
103 s +=
"Unknown error" ;
110 while( !persistence_file.eof() )
113 persistence_file.getline( cline, 80 ) ;
114 if( !persistence_file.eof() )
117 BESContainerStorageFile::container *c =
118 new BESContainerStorageFile::container ;
119 strm >> c->_symbolic_name ;
120 strm >> c->_real_name ;
121 strm >> c->_container_type ;
124 if( c->_symbolic_name ==
"" ||
125 c->_real_name ==
"" ||
126 c->_container_type ==
"" )
129 persistence_file.close() ;
130 string s =
"Incomplete container persistence line in file " 136 persistence_file.close() ;
138 string s =
"Too many fields in persistence file " 142 _container_list[c->_symbolic_name] = c ;
145 persistence_file.close() ;
150 BESContainerStorageFile::Container_citer i = _container_list.begin() ;
151 BESContainerStorageFile::Container_citer ie = _container_list.end() ;
152 for( ; i != ie; i++ )
154 BESContainerStorageFile::container *c = (*i).second ;
174 BESContainerStorageFile::Container_citer i ;
175 i = _container_list.find( sym_name ) ;
176 if( i != _container_list.end() )
178 BESContainerStorageFile::container *c = (*i).second;
181 c->_container_type ) ;
184 return ret_container ;
199 const string &real_name,
202 string err =
"Unable to add a container to a file, not yet implemented" ;
219 BESContainerStorageFile::Container_iter i ;
220 i = _container_list.find( s_name ) ;
221 if( i != _container_list.end() )
223 BESContainerStorageFile::container *c = (*i).second;
224 _container_list.erase( i ) ;
244 while( _container_list.size() != 0 )
246 Container_iter ci = _container_list.begin() ;
247 BESContainerStorageFile::container *c = (*ci).second;
248 _container_list.erase( ci ) ;
276 BESContainerStorageFile::Container_citer i ;
277 i = _container_list.begin() ;
278 for( i = _container_list.begin(); i != _container_list.end(); i++ )
280 BESContainerStorageFile::container *c = (*i).second;
281 string sym = c->_symbolic_name ;
282 string real = c->_real_name ;
283 string type = c->_container_type ;
299 << (
void *)
this <<
")" << endl ;
303 if( _container_list.size() )
307 BESContainerStorageFile::Container_citer i = _container_list.begin() ;
308 BESContainerStorageFile::Container_citer ie = _container_list.end() ;
309 for( i = _container_list.begin(); i != ie; i++ )
311 BESContainerStorageFile::container *c = (*i).second;
313 strm <<
", " << c->_real_name ;
314 strm <<
", " << c->_container_type ;
virtual ~BESContainerStorageFile()
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
exception thrown if inernal error encountered
virtual bool del_container(const string &s_name)
removes a container with the given symbolic name
virtual void show_containers(BESInfo &info)
show information for each container in this persistent store
Holds real data, container type and constraint for symbolic name read from persistence.
virtual void dump(ostream &strm) const
dumps information about this object
error thrown if there is a user syntax error in the request or any other user error ...
informational response object
virtual void add_container(const string &sym_name, const string &real_name, const string &type)
adds a container with the provided information
static ostream & LMarg(ostream &strm)
virtual BESContainer * look_for(const string &sym_name)
looks for the specified container in the list of containers loaded from the file. ...
void get_value(const string &s, string &val, bool &found)
Retrieve the value of a given key, if set.
virtual bool del_containers()
removes all containers
A container is something that holds data.
BESContainerStorageFile(const string &n)
pull container information from the specified file
static BESKeys * TheKeys()
virtual const string & get_name() const
retrieve the name of this persistent store