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_connectionInfo.find(
"COVERAGE_NAME")->second));
76 verifyConnectionInfo();
78 std::string request =
BuildRequest(m_connectionInfo.find(
"URI")->second, m_connectionInfo.find(
"COVERAGE_NAME")->second);
80 GDALDataset* gds =
static_cast<GDALDataset*
>(GDALOpen(request.c_str(), GA_ReadOnly));
82 throw Exception(
TE_TR(
"Error establishing connection with the informed server!"));
101 if(m_connectionInfo.empty())
104 std::map<std::string, std::string>::const_iterator it = m_connectionInfo.find(
"URI");
105 if(it == m_connectionInfo.end())
108 GDALDataset* gds =
static_cast<GDALDataset*
>(GDALOpen(it->second.c_str(), GA_ReadOnly));
119 return sm_capabilities;
134 throw Exception(
TE_TR(
"The create() method is not supported by the WCS driver!"));
139 throw Exception(
TE_TR(
"The drop() method is not supported by the WCS driver!"));
147 std::map<std::string, std::string>::const_iterator it = dsInfo.find(
"URI");
148 if(it == dsInfo.end())
151 GDALDataset* gds =
static_cast<GDALDataset*
>(GDALOpen(it->second.c_str(), GA_ReadOnly));
162 return std::vector<std::string>();
167 return std::vector<te::common::CharEncoding>();
172 if(m_connectionInfo.empty())
173 throw Exception(
TE_TR(
"The connection information is empty!"));
175 std::map<std::string, std::string>::const_iterator it = m_connectionInfo.find(
"URI");
176 if(it == m_connectionInfo.end())
177 throw Exception(
TE_TR(
"The connection information is invalid. Missing URI parameter!"));
179 it = m_connectionInfo.find(
"COVERAGE_NAME");
180 if(it == m_connectionInfo.end())
181 throw Exception(
TE_TR(
"The connection information is invalid. Missing COVERAGE_NAME parameter!"));
void open()
It opens the data source and makes it ready for using.
const te::da::SQLDialect * getDialect() const
It returns the data source SQL dialect, if there is one.
void close()
It closes the data source and clears all the resources used by its internal communication channel...
Implementation of the data source for the WCS driver.
Implementation of the transactor for the WCS driver.
Utility functions for WCS driver.
An exception class for the TerraLib WCS module.
void setConnectionInfo(const std::map< std::string, std::string > &connInfo)
It sets the connection information to be used when connecting to the data source. ...
It represents the SQL query dialect accepted by a given data source.
A class that represents the known capabilities of a specific data source, i.e. this class informs all...
#define TE_TR(message)
It marks a string in order to get translated.
std::auto_ptr< te::da::DataSourceTransactor > getTransactor()
It returns an object that can execute transactions in the context of a data source.
std::string getType() const
It returns the data source type name (in UPPER CASE). Ex: POSTGIS, SQLITE, WFS, WMS, or MYSQL.
bool isValid() const
It checks if the data source is valid (available for using).
te::da::DataSourceCapabilities capabilities
std::vector< te::common::CharEncoding > getEncodings(const std::map< std::string, std::string > &dsInfo)
It gets the encodings for the data source.
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...
const te::da::DataSourceCapabilities & getCapabilities() const
It returns the known capabilities of the data source.
#define TE_WCS_DRIVER_IDENTIFIER
The WCS driver identifier string.
std::string BuildRequest(const std::string &serviceURL, const std::string &coverageName, const te::gm::Envelope *e=0)
static te::da::DataSourceCapabilities sm_capabilities
~DataSource()
Virtual destructor.
void create(const std::map< std::string, std::string > &dsInfo)
It creates a new 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.
Implementation of the transactor for the WCS driver.
bool isOpened() const
It returns true if the data source is opened, otherwise it returns false.
static void setCapabilities(const te::da::DataSourceCapabilities &capabilities)
void verifyConnectionInfo() const
void drop(const std::map< std::string, std::string > &dsInfo)
It removes the data source with the connection information from a driver.
bool exists(const std::map< std::string, std::string > &dsInfo)
Check the existence of a data source in a driver.