27 #include "../../common/Globals.h" 28 #include "../../common/STLUtils.h" 29 #include "../../common/StringUtils.h" 30 #include "../../core/translator/Translator.h" 31 #include "../Exception.h" 41 #include <boost/move/move.hpp> 46 throw Exception(
TE_TR(
"There is already a catalog for the data source given!"));
50 catalog->setDataSource(ds.get());
56 std::vector<std::string> datasetNames = ds->getDataSetNames();
58 for(std::size_t i = 0; i < datasetNames.size(); ++i)
62 std::vector<std::string> seqNames = ds->getSequenceNames();
64 for(std::size_t i = 0; i < seqNames.size(); ++i)
66 std::unique_ptr<te::da::Sequence> seq = ds->getSequence(seqNames[i]);
67 catalog->add(seq.release());
103 if(catalog.get() ==
nullptr)
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!"));
120 if(
ds.get() ==
nullptr)
131 throw Exception(
TE_TR(
"This catalog is not valid to be detached from the manager!"));
147 if(it->first->getType() == dsType)
boost::shared_ptr< DataSetType > DataSetTypePtr
std::map< DataSourcePtr, DataSourceCatalogPtr >::iterator iterator
boost::shared_ptr< DataSource > DataSourcePtr
It represents the system catalog of a DataSource.
An abstract class for data providers like a DBMS, Web Services or a regular file. ...
Base exception class for plugin module.
void detach(DataSourceCatalogPtr catalog)
It changes the ownership of the data source catalog to the caller.
static te::dt::Date ds(2010, 01, 01)
#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
std::map< DataSourcePtr, DataSourceCatalogPtr > m_catalogs
The catalogs registered in the manager.