27 #include "../../common/STLUtils.h" 28 #include "../../core/uri/URI.h" 29 #include "../../core/translator/Translator.h" 30 #include "../Exception.h" 38 #include <boost/format.hpp> 42 std::map<std::string, DataSourceInfoPtr>::const_iterator it =
m_datasources.find(
id);
49 if (ds.get() ==
nullptr)
50 throw Exception(
TE_TR(
"Can not insert a NULL data source into the manager!"));
54 std::string conInfo = ds->getConnInfoAsString();
56 std::map<std::string, DataSourceInfoPtr>::const_iterator dsInfoIt =
m_datasources.begin();
59 std::string dsConInfo = dsInfoIt->second->getConnInfoAsString();
61 if (conInfo == dsConInfo)
63 ds->setId(dsInfoIt->second->getId());
75 std::map<std::string, DataSourceInfoPtr>::iterator it =
m_datasources.find(
id);
78 throw Exception((boost::format(
TE_TR(
"There isn't a data source with the given id (%1%) in data source manager!")) %
id).str());
85 std::map<std::string, DataSourceInfoPtr>::iterator it =
m_datasources.begin();
88 if(it->second->getType() == dsTypeName)
97 std::map<std::string, DataSourceInfoPtr>::const_iterator it =
m_datasources.begin();
98 std::map<std::string, DataSourceInfoPtr>::const_iterator itend =
m_datasources.end();
102 if(it->second->getType() == dsTypeName)
103 datasources.push_back(it->second);
111 std::map<std::string, DataSourceInfoPtr>::const_iterator dsInfoIt =
m_datasources.begin();
114 std::string dsConInfo = dsInfoIt->second->getConnInfoAsString();
116 if (connInfo == dsConInfo)
117 return dsInfoIt->second;
std::map< std::string, DataSourceInfoPtr >::iterator iterator
bool add(const DataSourceInfoPtr &ds)
Base exception class for plugin module.
std::map< std::string, DataSourceInfoPtr >::const_iterator const_iterator
static te::dt::Date ds(2010, 01, 01)
void getByType(const std::string &dsTypeName, std::vector< DataSourceInfoPtr > &datasources) const
#define TE_TR(message)
It marks a string in order to get translated.
DataSourceInfoPtr getByConnInfo(const std::string &connInfo)
DataSourceInfoPtr get(const std::string &id) const
A singleton to keep all the registered data sources.
const_iterator end() const
A conteiner class for keeping information about a data source.
void remove(const std::string &id)
void removeByType(const std::string &dsTypeName)
std::map< std::string, DataSourceInfoPtr > m_datasources
const_iterator begin() const
boost::shared_ptr< DataSourceInfo > DataSourceInfoPtr