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(
TR_DATAACCESS(
"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(
TR_DATAACCESS(
"Please, specifify a non-null data source to be managed!"));
111 throw Exception(
TR_DATAACCESS(
"There is already a catalog for the data source of the given catalog!"));
113 m_catalogs[ds] = catalog;
131 throw Exception(
TR_DATAACCESS(
"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++);
DataSourceCatalogPtr get(DataSourcePtr ds)
It gets the catalog associated to the given data source. If there is no catalog registered in the man...
It represents the system catalog of a DataSource.
boost::shared_ptr< DataSourceCatalog > DataSourceCatalogPtr
void insert(const DataSourceCatalogPtr &catalog)
It inserts the data source catalog into the manager. The catalog must have a data source in order to ...
An abstract class for data providers like a DBMS, Web Services or a regular file. ...
This is a singleton for managing all the data source catalog instances available in the system...
void detachAll()
All the catalogs are detached from the manager.
ObjectLevelLockingPolicy< ::boost::lock_guard< ::boost::recursive_mutex > > LockWrite
boost::shared_ptr< DataSource > DataSourcePtr
std::map< DataSourcePtr, DataSourceCatalogPtr >::iterator iterator
#define TR_DATAACCESS(message)
It marks a string in order to get translated. This is a special mark used in the DataAccess module of...
bool find(const DataSourcePtr &ds) const
It tries to find the catalog associated to the given data source.
std::map< DataSourcePtr, DataSourceCatalogPtr >::const_iterator const_iterator
boost::shared_ptr< DataSetType > DataSetTypePtr
~DataSourceCatalogManager()
Singleton destructor.
ObjectLevelLockingPolicy< ::boost::lock_guard< ::boost::recursive_mutex > > LockRead
void detach(DataSourceCatalogPtr catalog)
It changes the ownership of the data source catalog to the caller.
DataSourceCatalogPtr create(DataSourcePtr ds)
It creates a catalog for the given data source, loads their sequences and the information about the s...
DataSourceCatalogManager()
It initializes the singleton instance of the data source catalog manager.