35 using std::ostringstream ;
53 string key =
"BES.Catalog.Default" ;
62 if( !found || _default_catalog.empty() )
79 if( catalog )
delete catalog ;
99 std::pair<const std::string, BESCatalog*> p =
100 std::make_pair( name, catalog ) ;
101 result = _catalogs.insert(p).second;
125 i = _catalogs.find( catalog_name ) ;
126 if( i != _catalogs.end() )
152 i = _catalogs.find( catalog_name ) ;
153 if( i != _catalogs.end() )
158 _catalogs.erase( i ) ;
177 i = _catalogs.find( catalog_name ) ;
178 if( i != _catalogs.end() )
225 if( container.empty() )
227 if( _catalogs.size() == 1 )
230 catalog = (*i).second ;
235 map<string,string> props ;
236 props[
"name"] =
"/" ;
237 props[
"catalog"] =
"/" ;
238 ostringstream ssize ;
239 ssize << _catalogs.size() ;
240 props[
"count"] = ssize.str() ;
241 props[
"node"] =
"true" ;
257 string::size_type colon = container.find(
":" ) ;
258 if( colon == string::npos )
262 if( _catalogs.size() == 1 )
265 catalog = (*i).second ;
270 cat_name = _default_catalog ;
272 cat_node = container ;
277 cat_name = container.substr( 0, colon ) ;
278 cat_node = container.substr( colon+1, container.length() - colon ) ;
281 catalog = _catalogs[ cat_name ] ;
288 string serr =
"The catalog " + cat_name +
" does not exist." ;
317 << (
void *)
this <<
")" << endl ;
319 if( _catalogs.size() )
virtual BESCatalog * find_catalog(const string &catalog_name)
find the catalog in the list with the specified name
#define SHOW_INFO_RESPONSE
virtual bool add_catalog(BESCatalog *catalog)
adds the speciifed catalog to the list
virtual unsigned int dereference_catalog()
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 bool ref_catalog(const string &catalog_name)
reference the specified catalog
List of all registered catalogs.
Abstract exception class for the BES with basic string message.
virtual bool deref_catalog(const string &catalog_name)
de-reference the specified catalog and remove from list if no longer referenced
virtual void show_catalog(const string &container, const string &catalog_or_info, BESInfo *info)=0
virtual void begin_tag(const string &tag_name, map< string, string > *attrs=0)
static ostream & LMarg(ostream &strm)
#define BES_DEFAULT_CATALOG
virtual ~BESCatalogList()
list destructor deletes all registered catalogs
virtual void show_catalog(const string &container, const string &catalog_or_info, BESInfo *info)
show the contents of the catalog given the specified container
BESCatalogList()
construct a catalog list
abstract base class catalog object.
void get_value(const string &s, string &val, bool &found)
Retrieve the value of a given key, if set.
virtual void reference_catalog()
virtual string get_catalog_name()
static BESCatalogList * TheCatalogList()
returns the singleton BESCatalogList instance
static BESKeys * TheKeys()
map< string, BESCatalog * >::iterator catalog_iter
virtual void end_tag(const string &tag_name)
map< string, BESCatalog * >::const_iterator catalog_citer