27 #include "../dataaccess/datasource/DataSourceTransactor.h" 
   28 #include "../dataaccess/query/SQLDialect.h" 
   29 #include "../common/StringUtils.h" 
   30 #include "../common/Translator.h" 
   37 #include <ogrsf_frmts.h> 
   63   return m_connectionInfo;
 
   68   m_connectionInfo = connInfo;
 
   74     throw Exception(
TE_TR(
"The data source is not opened!"));
 
   76   return std::auto_ptr<te::da::DataSourceTransactor>(
new Transactor(
this));
 
   84   verifyConnectionInfo();
 
   86   m_ogrDS = OGRSFDriverRegistrar::Open(m_connectionInfo.find(
"URI")->second.c_str());
 
   89     throw Exception(
TE_TR(
"Could not open the WFS data source!"));
 
   97     OGRDataSource::DestroyDataSource(m_ogrDS);
 
  111   if(m_connectionInfo.empty())
 
  114   std::map<std::string, std::string>::const_iterator it = m_connectionInfo.find(
"URI");
 
  115   if(it == m_connectionInfo.end())
 
  118   OGRDataSource* ds = OGRSFDriverRegistrar::Open(it->second.c_str());
 
  122   OGRDataSource::DestroyDataSource(ds);
 
  129   return sm_capabilities;
 
  155   if(!m_layersInfo.empty())
 
  165   throw Exception(
TE_TR(
"The create() method is not supported by the WFS driver!"));
 
  170   throw Exception(
TE_TR(
"The drop() method is not supported by the WFS driver!"));
 
  178   std::map<std::string, std::string>::const_iterator it = dsInfo.find(
"URI");
 
  179   if(it == dsInfo.end())
 
  182   OGRDataSource* ds = OGRSFDriverRegistrar::Open(it->second.c_str());
 
  186   OGRDataSource::DestroyDataSource(ds);
 
  193   return std::vector<std::string>();
 
  198   return std::vector<te::common::CharEncoding>();
 
  203   if(m_connectionInfo.empty())
 
  204     throw Exception(
TE_TR(
"The connection information is empty!"));
 
  206   std::map<std::string, std::string>::const_iterator it = m_connectionInfo.find(
"URI");
 
  207   if(it == m_connectionInfo.end())
 
  208     throw Exception(
TE_TR(
"The connection information is invalid. Missing URI parameter!"));
 
  215   OGRLayer* wfsMetadata = m_ogrDS->GetLayerByName(
"WFSLayerMetadata");
 
  218     throw Exception(
TE_TR(
"Could not retrieve the metadata from WFS server!"));
 
  221   wfsMetadata->ResetReading();
 
  222   while((f = wfsMetadata->GetNextFeature()) != NULL)
 
  225     info.
m_name = f->GetFieldAsString(
"layer_name");
 
  226     info.
m_title = f->GetFieldAsString(
"title");
 
  227     info.
m_abstract = f->GetFieldAsString(
"abstract");
 
  229     m_layersInfo.push_back(info);
 
Implementation of the data source for the WFS driver. 
 
const te::da::SQLDialect * getDialect() const 
It returns the data source SQL dialect, if there is one. 
 
Implementation of the transactor for the WFS 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. ...
 
Implementation of the transactor for the WFS driver. 
 
te::da::SQLDialect * dialect
 
static te::da::DataSourceCapabilities sm_capabilities
 
#define TE_WFS_DRIVER_IDENTIFIER
The WFS driver identifier string. 
 
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...
 
void drop(const std::map< std::string, std::string > &dsInfo)
It removes the data source with the connection information from a driver. 
 
#define TE_TR(message)
It marks a string in order to get translated. 
 
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. 
 
Implementation of the data source for the WFS driver. 
 
Informations about WFS Layers. 
 
static void setCapabilities(const te::da::DataSourceCapabilities &capabilities)
 
static void setDialect(te::da::SQLDialect *dialect)
 
te::da::DataSourceCapabilities capabilities
 
void verifyConnectionInfo() const 
 
void close()
It closes the data source and clears all the resources used by its internal communication channel...
 
~DataSource()
Virtual destructor. 
 
bool isOpened() const 
It returns true if the data source is opened, otherwise it returns false. 
 
void create(const std::map< std::string, std::string > &dsInfo)
It creates a new 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::vector< WFSLayerInfo > & getLayersInfo()
 
Utility functions for WFS driver. 
 
bool isValid() const 
It checks if the data source is valid (available for using). 
 
bool exists(const std::map< std::string, std::string > &dsInfo)
Check the existence of a data source in a driver. 
 
static te::da::SQLDialect * sm_dialect
 
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...
 
void open()
It opens the data source and makes it ready for using. 
 
const te::da::DataSourceCapabilities & getCapabilities() const 
It returns the known capabilities of the data source. 
 
OGRDataSource * getOGRDataSource()
 
An exception class for the TerraLib WFS module. 
 
std::string getType() const 
It returns the data source type name (in UPPER CASE). Ex: POSTGIS, SQLITE, WFS, WMS, or MYSQL.