DataSource.h
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file terralib/wfs/DataSource.h
22 
23  \brief Implementation of the data source for the WFS driver.
24 */
25 
26 #ifndef __TERRALIB_WFS_INTERNAL_DATASOURCE_H
27 #define __TERRALIB_WFS_INTERNAL_DATASOURCE_H
28 
29 // TerraLib
30 #include "../dataaccess/datasource/DataSource.h"
31 #include "../dataaccess/datasource/DataSourceCapabilities.h"
32 #include "Config.h"
33 #include "Exception.h"
34 #include "WFSLayerInfo.h"
35 
36 // STL
37 #include <string>
38 #include <vector>
39 
40 // Forward declarations
41 //class OGRDataSource;
42 class GDALDataset;
43 
44 namespace te
45 {
46  namespace wfs
47  {
48  /*!
49  \class DataSource
50 
51  \brief Implementation of the data source for the WFS driver.
52  */
54  {
55  public:
56 
57  DataSource();
58 
59  ~DataSource();
60 
61  std::string getType() const;
62 
63  const std::map<std::string, std::string>& getConnectionInfo() const;
64 
65  void setConnectionInfo(const std::map<std::string, std::string>& connInfo);
66 
67  std::auto_ptr<te::da::DataSourceTransactor> getTransactor();
68 
69  void open();
70 
71  void close();
72 
73  bool isOpened() const;
74 
75  bool isValid() const;
76 
77  const te::da::DataSourceCapabilities& getCapabilities() const;
78 
79  static void setCapabilities(const te::da::DataSourceCapabilities& capabilities);
80 
81  const te::da::SQLDialect* getDialect() const;
82 
83  static void setDialect(te::da::SQLDialect* dialect);
84 
85  //OGRDataSource* getOGRDataSource();
86  GDALDataset* getOGRDataSource();
87 
88  const std::vector<WFSLayerInfo>& getLayersInfo();
89 
90  protected:
91 
92  void create(const std::map<std::string, std::string>& dsInfo);
93 
94  void drop(const std::map<std::string, std::string>& dsInfo);
95 
96  bool exists(const std::map<std::string, std::string>& dsInfo);
97 
98  std::vector<std::string> getDataSourceNames(const std::map<std::string, std::string>& dsInfo);
99 
100  std::vector<te::common::CharEncoding> getEncodings(const std::map<std::string, std::string>& dsInfo);
101 
102  private:
103 
104  void verifyConnectionInfo() const;
105 
106  void buildLayersInfo();
107 
108  private:
109 
110  std::map<std::string, std::string> m_connectionInfo;
111  //OGRDataSource* m_ogrDS;
112  GDALDataset* m_ogrDS;
114  std::vector<WFSLayerInfo> m_layersInfo;
117  };
118 
119  } // end namespace wfs
120 } // end namespace te
121 
122 #endif // __TERRALIB_WFS_INTERNAL_DATASOURCE_H
te::da::SQLDialect * dialect
Definition: WFSDialect.h:1
static te::da::DataSourceCapabilities sm_capabilities
Definition: DataSource.h:115
It represents the SQL query dialect accepted by a given data source.
Definition: SQLDialect.h:55
Informations about WFS Layers.
A class that represents the known capabilities of a specific data source, i.e. this class informs all...
An abstract class for data providers like a DBMS, Web Services or a regular file. ...
Definition: DataSource.h:118
#define TEWFSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:104
Implementation of the data source for the WFS driver.
Definition: DataSource.h:53
GDALDataset * m_ogrDS
Definition: DataSource.h:112
std::vector< WFSLayerInfo > m_layersInfo
Definition: DataSource.h:114
te::da::DataSourceCapabilities capabilities
URI C++ Library.
Configuration flags for the TerraLib WFS module.
static te::da::SQLDialect * sm_dialect
Definition: DataSource.h:116
An exception class for the TerraLib WFS module.
std::map< std::string, std::string > m_connectionInfo
Definition: DataSource.h:110