This is a singleton for managing all data source instances available in the system. More...
#include <DataSourceManager.h>
Public Types | |
| typedef std::map< std::string, DataSourcePtr >::const_iterator | const_iterator |
| typedef std::map< std::string, DataSourcePtr >::iterator | iterator |
| typedef ObjectLevelLockingPolicy< ::boost::lock_guard< ::boost::recursive_mutex > > | LockRead |
| typedef ObjectLevelLockingPolicy< ::boost::lock_guard< ::boost::recursive_mutex > > | LockWrite |
| typedef volatile DataSourceManager | VolatileType |
Public Member Functions | |
| const_iterator | begin () const |
| It returns an iterator to the beginning of the conteiner. More... | |
| iterator | begin () |
| It returns an iterator to the beginning of the conteiner. More... | |
| void | detach (const DataSourcePtr &ds) |
| It changes the ownership of the data source to the caller. More... | |
| DataSourcePtr | detach (const std::string &id) |
| It changes the ownership of the data source with the given identifier to the caller. More... | |
| void | detachAll (const std::string &dsType) |
| All data sources of the specified type are detached from the manager. More... | |
| void | detachAll () |
| All data sources are detached from the manager. More... | |
| const_iterator | end () const |
| It returns an iterator to the end of the conteiner. More... | |
| iterator | end () |
| It returns an iterator to the end of the conteiner. More... | |
| DataSourcePtr | find (const std::string &id) const |
| It returns the data source identified by the given id. More... | |
| DataSourcePtr | get (const std::string &id, const std::string &dsType, const std::string &connInfo) |
| It searches for an opened data source with the given id or it opens a new one if it doesn't exists. More... | |
| DataSourcePtr | get (const std::string &id, const std::string &dsType, const te::core::URI &connInfo) |
| It searches for an opened data source with the given id or it opens a new one if it doesn't exists. More... | |
| void | insert (const DataSourcePtr &ds) |
| It stores the data source in the manager. More... | |
| DataSourcePtr | make (const std::string &id, const std::string &dsType, const std::string &connInfo) |
| It creates a new data source, stores a reference to it in the manager and then returns a pointer to it. More... | |
| DataSourcePtr | make (const std::string &id, const std::string &dsType, const te::core::URI &connInfo) |
| It creates a new data source, stores a reference to it in the manager and then returns a pointer to it. More... | |
| DataSourcePtr | open (const std::string &id, const std::string &dsType, const std::string &connInfo) |
| It opens the data source, makes it ready for use, stores a reference to it in the manager and returns a pointer to it. More... | |
| DataSourcePtr | open (const std::string &id, const std::string &dsType, const te::core::URI &connInfo) |
| It opens the data source, makes it ready for use, stores a reference to it in the manager and returns a pointer to it. More... | |
| std::size_t | size () const |
| It returns the number of data sources that the manager are keeping track of. More... | |
Static Public Member Functions | |
| static DataSourceManager & | getInstance () |
| It returns a reference to the singleton instance. More... | |
Protected Member Functions | |
| DataSourceManager () | |
| It initializes the singleton instance of the data source manager. More... | |
| ~DataSourceManager () | |
| Singleton destructor. More... | |
Private Attributes | |
| std::map< std::string, DataSourcePtr > | m_dss |
| The data sources kept in the manager. More... | |
Friends | |
| class | te::common::Singleton< DataSourceManager > |
This is a singleton for managing all data source instances available in the system.
Prefer using the methods from this singleton instead of using the data source factory because it keeps track of the data sources available in the system.
Another reason to use it in your application is that the application can choose any strategy to label data sources, for examples, using a descriptive title provided by the user or using an unique-universal-identifier (uid) generated by an algorithm.
Definition at line 62 of file DataSourceManager.h.
| typedef std::map<std::string, DataSourcePtr>::const_iterator te::da::DataSourceManager::const_iterator |
Definition at line 72 of file DataSourceManager.h.
| typedef std::map<std::string, DataSourcePtr>::iterator te::da::DataSourceManager::iterator |
Definition at line 73 of file DataSourceManager.h.
|
inherited |
Definition at line 205 of file ThreadingPolicies.h.
|
inherited |
Definition at line 206 of file ThreadingPolicies.h.
|
inherited |
Definition at line 204 of file ThreadingPolicies.h.
|
protecteddefault |
It initializes the singleton instance of the data source manager.
Referenced by detachAll().
|
protecteddefault |
Singleton destructor.
Referenced by detachAll().
|
inline |
It returns an iterator to the beginning of the conteiner.
Definition at line 291 of file DataSourceManager.h.
|
inline |
It returns an iterator to the beginning of the conteiner.
Definition at line 296 of file DataSourceManager.h.
| void te::da::DataSourceManager::detach | ( | const DataSourcePtr & | ds | ) |
It changes the ownership of the data source to the caller.
The memory used by the given data source will NOT BE released. In other words, you will take the ownership of the data source pointer.
| ds | The data source to be detached. |
Definition at line 181 of file dataaccess/datasource/DataSourceManager.cpp.
| te::da::DataSourcePtr te::da::DataSourceManager::detach | ( | const std::string & | id | ) |
It changes the ownership of the data source with the given identifier to the caller.
| id | The data source identifier. |
Definition at line 189 of file dataaccess/datasource/DataSourceManager.cpp.
| void te::da::DataSourceManager::detachAll | ( | const std::string & | dsType | ) |
All data sources of the specified type are detached from the manager.
Definition at line 205 of file dataaccess/datasource/DataSourceManager.cpp.
References m_dss.
| void te::da::DataSourceManager::detachAll | ( | ) |
All data sources are detached from the manager.
Definition at line 218 of file dataaccess/datasource/DataSourceManager.cpp.
References DataSourceManager(), m_dss, and ~DataSourceManager().
|
inline |
It returns an iterator to the end of the conteiner.
Definition at line 301 of file DataSourceManager.h.
|
inline |
It returns an iterator to the end of the conteiner.
Definition at line 306 of file DataSourceManager.h.
| te::da::DataSourcePtr te::da::DataSourceManager::find | ( | const std::string & | id | ) | const |
It returns the data source identified by the given id.
| id | The data source identification. |
Definition at line 156 of file dataaccess/datasource/DataSourceManager.cpp.
References m_dss.
Referenced by make().
| te::da::DataSourcePtr te::da::DataSourceManager::get | ( | const std::string & | id, |
| const std::string & | dsType, | ||
| const std::string & | connInfo | ||
| ) |
It searches for an opened data source with the given id or it opens a new one if it doesn't exists.
| id | The data source identification. |
| dsType | The data source type name (example: PostGIS, Oracle, WFS). |
| connInfo | The set of parameters, as a valid URI string, used to set up the underlying access channel to the repository. |
| Exception | It throws an exception if the data source can not be opened. |
Definition at line 111 of file dataaccess/datasource/DataSourceManager.cpp.
References insert(), m_dss, te::da::DataSourceFactory::make(), and TE_TR.
| te::da::DataSourcePtr te::da::DataSourceManager::get | ( | const std::string & | id, |
| const std::string & | dsType, | ||
| const te::core::URI & | connInfo | ||
| ) |
It searches for an opened data source with the given id or it opens a new one if it doesn't exists.
| id | The data source identification. |
| dsType | The data source type name (example: PostGIS, Oracle, WFS). |
| connInfo | The set of parameters used to set up the underlying access channel to the repository. |
| Exception | It throws an exception if the data source can not be opened. |
Definition at line 134 of file dataaccess/datasource/DataSourceManager.cpp.
References insert(), m_dss, te::da::DataSourceFactory::make(), and TE_TR.
|
staticinherited |
It returns a reference to the singleton instance.
Referenced by MainWindow::addDataSetLayer(), te::qt::widgets::SegmenterAdvancedOptionsWizardPage::applyVectorization(), BOOST_AUTO_TEST_CASE(), te::qt::plugins::terralib4::TL4ConverterWizard::commit(), te::qt::plugins::pgis::PostGISConnector::connect(), te::qt::plugins::pgisRaster::PostGISConnector::connect(), te::qt::plugins::wms::WMSConnector::connect(), te::qt::plugins::mysql::MySQLConnector::connect(), te::qt::plugins::ado::ADOConnector::connect(), te::qt::plugins::sqlite::SQLiteConnector::connect(), te::qt::plugins::ogr::OGRConnector::connect(), te::qt::plugins::wfs::WFSConnector::connect(), te::qt::plugins::gdal::GDALConnector::connect(), te::ws::ogc::wcs::qt::WCSConnector::connect(), te::ws::ogc::wms::qt::WMSConnector::connect(), te::qt::plugins::ado::ADOConnector::create(), te::qt::plugins::pgis::PostGISConnector::create(), CreateDataSetLayer(), CreateDataSourceAndUpdateManager(), te::sa::CreateGDALDataSource(), createLayer(), te::qt::widgets::createLayer(), te::qt::plugins::pgisRaster::CreateLayers(), CreateMaskCellSpace(), te::sa::CreateOGRDataSource(), te::vp::CreateOGRDataSource(), CreateRasterLayer(), te::qt::widgets::DataSourceItem::data(), DataSourceManager_Find(), DataSourceManager_Make(), DataSourceManager_Open(), DataSourceManager_Size(), te::qt::widgets::DataSetDisplay::draw(), te::qt::widgets::DataExchangerWizard::exchange(), te::qt::widgets::DirectExchangerDialog::exchangeToDatabase(), te::qt::widgets::VectorizationWizard::execute(), te::qt::widgets::CloudDetectionDialog::execute(), te::qt::widgets::DataSetCategoryItem::fetchMore(), te::qt::widgets::DataSetGroupItem::fetchMore(), te::st::STDataLoader::finalize(), te::qt::plugins::terralib4::TL4ConverterWizard::finish(), te::da::GetDataSet(), te::da::GetDataSetNames(), te::qt::plugins::gdal::GetDataSetsInfo(), GetDataSetsInfo(), te::da::GetDataSetType(), te::qt::widgets::DataExchangerWizard::getDataSource(), te::da::GetDataSource(), GetDataSource(), te::qt::widgets::DataSetTableHorizontalHeader::GetDataSource(), te::qt::widgets::QueryBuilderWizard::getDataSourceIds(), te::vp::GetDataStructFromLayer(), te::qt::widgets::RasterizationWizardPage::getDistinctClasses(), te::da::GetExtent(), te::qt::plugins::gdal::GetLayer(), te::qt::plugins::cellspace::CreateCellularSpaceDialog::getLayer(), GetLayer(), te::wms::WMSLayerSelector::getLayers(), te::qt::widgets::HiddenDataSetLayerSelector::getLayers(), te::qt::widgets::DataSetLayerSelector::getLayers(), te::ws::ogc::wms::qt::WMSLayerSelector::getLayers(), te::ws::ogc::wcs::qt::WCSLayerSelector::getLayers(), te::qt::widgets::QueryBuilderWizard::getProperties(), te::qt::widgets::DataExchangerWizard::getTargetDataSource(), te::qt::widgets::DataSetCategoryGroupItem::hasChildren(), te::qt::widgets::DataSetCategoryItem::hasChildren(), te::qt::widgets::DataSetGroupItem::hasChildren(), te::da::HasDataSet(), te::st::STDataLoader::initialize(), te::qt::plugins::pgisRaster::PostGISDataSetSelectorDialog::listDataSets(), te::da::LoadFull(), LoadPGISDataSource(), te::da::LoadProperties(), LoadShapeDataSource(), MapDisplay(), te::da::Module::Module(), SelectionTool::mouseReleaseEvent(), te::qt::widgets::QueryDataSourceDialog::onCreateLayerToolButtonClicked(), te::qt::widgets::QueryBuilderWizard::onDataSourceComboBoxActivated(), te::qt::widgets::DatapPropertiesWidget::onInputDataToolButtonTriggered(), te::qt::plugins::tv::TimeViewerDockWidget::onLayerCBoxSelected(), te::mnt::SmoothIsolinesDialog::onOkPushButtonClicked(), te::qt::widgets::SHP2ADODialog::onOkPushButtonClicked(), te::qt::widgets::SHP2PostGISDialog::onOkPushButtonClicked(), te::vp::PolygonToLineDialog::onOkPushButtonClicked(), te::vp::LineToPolygonDialog::onOkPushButtonClicked(), te::mnt::CreateIsolinesDialog::onOkPushButtonClicked(), te::mnt::TINGenerationDialog::onOkPushButtonClicked(), te::attributefill::VectorToRasterDialog::onOkPushButtonClicked(), te::vp::MultipartToSinglepartDialog::onOkPushButtonClicked(), te::vp::IntersectionDialog::onOkPushButtonClicked(), te::addressgeocoding::MainWindowDialog::onOkPushButtonClicked(), te::vp::GeometricOpDialog::onOkPushButtonClicked(), te::vp::MergeDialog::onOkPushButtonClicked(), te::vp::BufferDialog::onOkPushButtonClicked(), te::attributefill::RasterToVectorDialog::onOkPushButtonClicked(), te::vp::UnionDialog::onOkPushButtonClicked(), te::vp::DifferenceDialog::onOkPushButtonClicked(), te::vp::IdentityDialog::onOkPushButtonClicked(), te::attributefill::VectorToVectorDialog::onOkPushButtonClicked(), te::qt::widgets::SaveSelectedObjectsWidget::onTargetDatasourceToolButtonPressed(), te::qt::widgets::CreateLayerWidget::onTargetDatasourceToolButtonPressed(), te::qt::widgets::SaveSelectedObjectsWidget::onTargetFileToolButtonPressed(), te::qt::widgets::CreateLayerWidget::onTargetFileToolButtonPressed(), te::wms::WMS2Layer::operator()(), te::qt::widgets::DataSet2Layer::operator()(), te::ws::ogc::wms::WMS2Layer::operator()(), te::qt::widgets::DataSetOptionsWizardPage::previewData(), te::qt::widgets::DataSetSelectorWidget::previewData(), te::qt::plugins::wms::WMSConnector::remove(), te::qt::plugins::pgis::PostGISConnector::remove(), te::qt::plugins::geofile::GeoFileConnector::remove(), te::qt::plugins::pgisRaster::PostGISConnector::remove(), te::qt::plugins::ado::ADOConnector::remove(), te::qt::plugins::sqlite::SQLiteConnector::remove(), te::qt::plugins::mysql::MySQLConnector::remove(), te::qt::plugins::wfs::WFSConnector::remove(), te::qt::plugins::gdal::GDALConnector::remove(), te::qt::plugins::ogr::OGRConnector::remove(), te::ws::ogc::wcs::qt::WCSConnector::remove(), te::ws::ogc::wms::qt::WMSConnector::remove(), te::sa::KernelOperation::saveDataSet(), te::qt::widgets::DataSetOptionsWizardPage::set(), te::ws::ogc::wms::qt::WMSLayerSelectorDialog::set(), te::qt::widgets::DataSetAdapterWidget::setAdapterParameters(), te::qt::widgets::NewPropertyWidget::setDataSourceId(), te::qt::widgets::TableLinkDialog::setInputLayer(), te::sqlite::Module::shutdown(), te::qt::plugins::terramobile::Plugin::shutdown(), te::wfs::Module::shutdown(), te::wms::Module::shutdown(), te::wcs::Module::shutdown(), terralib4::Module::shutdown(), te::ado::Module::shutdown(), te::ws::ogc::wms::da::Module::shutdown(), te::ws::ogc::wcs::da::Module::shutdown(), te::st::STDataLoaderFromMemDS::STDataLoaderFromMemDS(), te::qt::plugins::wms::WMSConnector::update(), te::qt::plugins::ado::ADOConnector::update(), te::qt::plugins::pgisRaster::PostGISConnector::update(), te::qt::plugins::sqlite::SQLiteConnector::update(), te::qt::plugins::pgis::PostGISConnector::update(), te::qt::plugins::mysql::MySQLConnector::update(), te::qt::plugins::wfs::WFSConnector::update(), te::qt::plugins::gdal::GDALConnector::update(), te::qt::plugins::ogr::OGRConnector::update(), te::ws::ogc::wms::qt::WMSConnector::update(), te::ws::ogc::wcs::qt::WCSConnector::update(), te::qt::widgets::QueryLayerBuilderWizard::validateCurrentPage(), te::qt::plugins::terralib4::TL4ConverterWizard::validateCurrentPage(), te::qt::plugins::terralib4::TL4ConverterWizard::validLayerNames(), and VectorToVector().
| void te::da::DataSourceManager::insert | ( | const DataSourcePtr & | ds | ) |
It stores the data source in the manager.
The data source must have an identification in order to be inserted.
| ds | The data source to be stored in the manager. |
| Exception | It throws an exception if a data source with the same identification already exist or if the data source id is empty. |
Definition at line 168 of file dataaccess/datasource/DataSourceManager.cpp.
| te::da::DataSourcePtr te::da::DataSourceManager::make | ( | const std::string & | id, |
| const std::string & | dsType, | ||
| const std::string & | connInfo | ||
| ) |
It creates a new data source, stores a reference to it in the manager and then returns a pointer to it.
| id | The identification to be assigned to the data source. |
| dsType | The data source type name (example: PostGIS, Oracle, WFS). |
| connInfo | The URI, as a valid string, used to set up the underlying access channel to the repository. |
| Exception | It throws an exception if a data source with the same identification already exist. |
Definition at line 41 of file dataaccess/datasource/DataSourceManager.cpp.
References ds, find(), insert(), te::da::DataSourceFactory::make(), and TE_TR.
| te::da::DataSourcePtr te::da::DataSourceManager::make | ( | const std::string & | id, |
| const std::string & | dsType, | ||
| const te::core::URI & | connInfo | ||
| ) |
It creates a new data source, stores a reference to it in the manager and then returns a pointer to it.
| id | The identification to be assigned to the data source. |
| dsType | The data source type name (example: PostGIS, Oracle, WFS). |
| connInfo | The URI used to set up the underlying access channel to the repository. |
| Exception | It throws an exception if a data source with the same identification already exist. |
Definition at line 59 of file dataaccess/datasource/DataSourceManager.cpp.
References ds, find(), insert(), te::da::DataSourceFactory::make(), and TE_TR.
| te::da::DataSourcePtr te::da::DataSourceManager::open | ( | const std::string & | id, |
| const std::string & | dsType, | ||
| const std::string & | connInfo | ||
| ) |
It opens the data source, makes it ready for use, stores a reference to it in the manager and returns a pointer to it.
| id | The identification to be assigned to the data source. |
| dsType | The data source type name (example: PostGIS, Oracle, WFS). |
| connInfo | The URI, as a valid string, used to set up the underlying access channel to the repository. |
| Exception | It throws an exception if the data source can not be opened or if a data source with the same identification already exist. |
Definition at line 77 of file dataaccess/datasource/DataSourceManager.cpp.
References ds, insert(), te::da::DataSourceFactory::make(), and TE_TR.
| te::da::DataSourcePtr te::da::DataSourceManager::open | ( | const std::string & | id, |
| const std::string & | dsType, | ||
| const te::core::URI & | connInfo | ||
| ) |
It opens the data source, makes it ready for use, stores a reference to it in the manager and returns a pointer to it.
| id | The identification to be assigned to the data source. |
| dsType | The data source type name (example: PostGIS, Oracle, WFS). |
| connInfo | The URI used to set up the underlying access channel to the repository. |
| Exception | It throws an exception if the data source can not be opened or if a data source with the same identification already exist. |
Definition at line 94 of file dataaccess/datasource/DataSourceManager.cpp.
References ds, insert(), te::da::DataSourceFactory::make(), and TE_TR.
|
inline |
It returns the number of data sources that the manager are keeping track of.
Definition at line 286 of file DataSourceManager.h.
|
friend |
Definition at line 68 of file DataSourceManager.h.
|
private |
The data sources kept in the manager.
Definition at line 283 of file DataSourceManager.h.
Referenced by detach(), detachAll(), find(), get(), and insert().