27 #include "../dataaccess/datasource/DataSourceTransactor.h"
28 #include "../common/StringUtils.h"
29 #include "../common/Translator.h"
36 #include <gdal_priv.h>
55 return m_connectionInfo;
60 m_connectionInfo = connInfo;
66 throw Exception(
TE_TR(
"The data source is not opened!"));
68 return std::auto_ptr<te::da::DataSourceTransactor>(
new Transactor(m_connectionInfo.find(
"URI")->second, m_layersInfo));
76 verifyConnectionInfo();
78 GDALDataset* gds =
static_cast<GDALDataset*
>(GDALOpen(m_connectionInfo.find(
"URI")->second.c_str(), GA_ReadOnly));
80 throw Exception(
TE_TR(
"Error establishing connection with the informed server!"));
83 char** subdatasets = gds->GetMetadata(
"SUBDATASETS");
106 if(m_connectionInfo.empty())
109 std::map<std::string, std::string>::const_iterator it = m_connectionInfo.find(
"URI");
110 if(it == m_connectionInfo.end())
113 GDALDataset* gds =
static_cast<GDALDataset*
>(GDALOpen(it->second.c_str(), GA_ReadOnly));
124 return sm_capabilities;
144 throw Exception(
TE_TR(
"The create() method is not supported by the WMS driver!"));
149 throw Exception(
TE_TR(
"The drop() method is not supported by the WMS driver!"));
157 std::map<std::string, std::string>::const_iterator it = dsInfo.find(
"URI");
158 if(it == dsInfo.end())
161 GDALDataset* gds =
static_cast<GDALDataset*
>(GDALOpen(it->second.c_str(), GA_ReadOnly));
172 return std::vector<std::string>();
177 return std::vector<te::common::CharEncoding>();
182 if(m_connectionInfo.empty())
183 throw Exception(
TE_TR(
"The connection information is empty!"));
185 std::map<std::string, std::string>::const_iterator it = m_connectionInfo.find(
"URI");
186 if(it == m_connectionInfo.end())
187 throw Exception(
TE_TR(
"The connection information is invalid. Missing URI parameter!"));
Implementation of the transactor for the WMS driver.
const te::da::DataSourceCapabilities & getCapabilities() const
It returns the known capabilities of the data source.
std::auto_ptr< te::da::DataSourceTransactor > getTransactor()
It returns an object that can execute transactions in the context of a data source.
const std::map< std::string, WMSLayerInfo > & getLayersInfo() const
It represents the SQL query dialect accepted by a given data source.
#define TE_WMS_DRIVER_IDENTIFIER
bool isOpened() const
It returns true if the data source is opened, otherwise it returns false.
std::vector< te::common::CharEncoding > getEncodings(const std::map< std::string, std::string > &dsInfo)
It gets the encodings for the data source.
std::vector< std::string > getDataSourceNames(const std::map< std::string, std::string > &dsInfo)
It gets the data source names available in a driver.
A class that represents the known capabilities of a specific data source, i.e. this class informs all...
void close()
It closes the data source and clears all the resources used by its internal communication channel...
#define TE_TR(message)
It marks a string in order to get translated.
bool exists(const std::map< std::string, std::string > &dsInfo)
Check the existence of a data source in a driver.
void setConnectionInfo(const std::map< std::string, std::string > &connInfo)
It sets the connection information to be used when connecting to the data source. ...
const te::da::SQLDialect * getDialect() const
It returns the data source SQL dialect, if there is one.
An exception class for the TerraLib WMS module.
void BuildLayersInfo(char **subdatasets, std::map< std::string, WMSLayerInfo > &info)
te::da::DataSourceCapabilities capabilities
static void setCapabilities(const te::da::DataSourceCapabilities &capabilities)
void drop(const std::map< std::string, std::string > &dsInfo)
It removes the data source with the connection information from a driver.
Implementation of the data source for the WMS driver.
const std::map< std::string, std::string > & getConnectionInfo() const
It returns the set of parameters used to set up the access channel to the underlying repository...
std::string getType() const
It returns the data source type name (in UPPER CASE). Ex: POSTGIS, SQLITE, WFS, WMS, or MYSQL.
Utility functions for WMS driver.
void create(const std::map< std::string, std::string > &dsInfo)
It creates a new data source.
static te::da::DataSourceCapabilities sm_capabilities
bool isValid() const
It checks if the data source is valid (available for using).
void open()
It opens the data source and makes it ready for using.
void verifyConnectionInfo() const
~DataSource()
Virtual destructor.
Implementation of the transactor for the WMS driver.