27 #include "../../common/Globals.h"
28 #include "../../common/STLUtils.h"
29 #include "../../common/StringUtils.h"
30 #include "../../common/Translator.h"
31 #include "../Exception.h"
43 throw Exception(
TE_TR(
"There is already a catalog for the data source given!"));
47 catalog->setDataSource(ds.get());
53 std::vector<std::string> datasetNames = ds->getDataSetNames();
55 for(std::size_t i = 0; i < datasetNames.size(); ++i)
57 std::auto_ptr<te::da::DataSetType> dt = ds->getDataSetType(datasetNames[i]);
62 std::vector<std::string> seqNames = ds->getSequenceNames();
64 for(std::size_t i = 0; i < seqNames.size(); ++i)
66 std::auto_ptr<te::da::Sequence> seq = ds->getSequence(seqNames[i]);
67 catalog->add(seq.release());
83 if(it != m_catalogs.end())
95 if(it != m_catalogs.end())
103 if(catalog.get() == 0)
104 throw Exception(
TE_TR(
"Please, specifify a non-null data source to be managed!"));
111 throw Exception(
TE_TR(
"There is already a catalog for the data source of the given catalog!"));
113 m_catalogs[ds] = catalog;
131 throw Exception(
TE_TR(
"This catalog is not valid to be detached from the manager!"));
135 m_catalogs.erase(it->first);
145 for(it = m_catalogs.begin(); it != m_catalogs.end(); ++it)
147 if(it->first->getType() == dsType)
148 m_catalogs.erase(it++);
boost::shared_ptr< DataSetType > DataSetTypePtr
std::map< DataSourcePtr, DataSourceCatalogPtr >::iterator iterator
boost::shared_ptr< DataSource > DataSourcePtr
An abstract class for data providers like a DBMS, Web Services or a regular file. ...
It represents the system catalog of a DataSource.
void detach(DataSourceCatalogPtr catalog)
It changes the ownership of the data source catalog to the caller.
#define TE_TR(message)
It marks a string in order to get translated.
bool find(const DataSourcePtr &ds) const
It tries to find the catalog associated to the given data source.
void insert(const DataSourceCatalogPtr &catalog)
It inserts the data source catalog into the manager. The catalog must have a data source in order to ...
boost::shared_ptr< DataSourceCatalog > DataSourceCatalogPtr
std::map< DataSourcePtr, DataSourceCatalogPtr >::const_iterator const_iterator
This is a singleton for managing all the data source catalog instances available in the system...
~DataSourceCatalogManager()
Singleton destructor.
void detachAll()
All the catalogs are detached from the manager.
ObjectLevelLockingPolicy< ::boost::lock_guard< ::boost::recursive_mutex > > LockWrite
DataSourceCatalogPtr get(DataSourcePtr ds)
It gets the catalog associated to the given data source. If there is no catalog registered in the man...
DataSourceCatalogManager()
It initializes the singleton instance of the data source catalog manager.
DataSourceCatalogPtr create(DataSourcePtr ds)
It creates a catalog for the given data source, loads their sequences and the information about the s...
ObjectLevelLockingPolicy< ::boost::lock_guard< ::boost::recursive_mutex > > LockRead