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/wms/DataSource.h
22 
23  \brief Implementation of the data source for the WMS driver.
24 */
25 
26 #ifndef __TERRALIB_WMS_INTERNAL_DATASOURCE_H
27 #define __TERRALIB_WMS_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 "WMSLayerInfo.h"
35 
36 // STL
37 #include <map>
38 #include <string>
39 
40 namespace te
41 {
42  namespace wms
43  {
44  /*!
45  \class DataSource
46 
47  \brief Implementation of the data source for the WMS driver.
48  */
50  {
51  public:
52 
53  DataSource();
54 
55  ~DataSource();
56 
57  std::string getType() const;
58 
59  const std::map<std::string, std::string>& getConnectionInfo() const;
60 
61  void setConnectionInfo(const std::map<std::string, std::string>& connInfo);
62 
63  std::auto_ptr<te::da::DataSourceTransactor> getTransactor();
64 
65  void open();
66 
67  void close();
68 
69  bool isOpened() const;
70 
71  bool isValid() const;
72 
73  const te::da::DataSourceCapabilities& getCapabilities() const;
74 
75  static void setCapabilities(const te::da::DataSourceCapabilities& capabilities);
76 
77  const te::da::SQLDialect* getDialect() const;
78 
79  const std::map<std::string, WMSLayerInfo>& getLayersInfo() const;
80 
81  protected:
82 
83  void create(const std::map<std::string, std::string>& dsInfo);
84 
85  void drop(const std::map<std::string, std::string>& dsInfo);
86 
87  bool exists(const std::map<std::string, std::string>& dsInfo);
88 
89  std::vector<std::string> getDataSourceNames(const std::map<std::string, std::string>& dsInfo);
90 
91  std::vector<te::common::CharEncoding> getEncodings(const std::map<std::string, std::string>& dsInfo);
92 
93  private:
94 
95  void verifyConnectionInfo() const;
96 
97  private:
98 
99  std::map<std::string, std::string> m_connectionInfo;
101  std::map<std::string, WMSLayerInfo> m_layersInfo;
103  };
104 
105  } // end namespace wms
106 } // end namespace te
107 
108 #endif // __TERRALIB_WMS_INTERNAL_DATASOURCE_H
Implementation of the data source for the WMS driver.
Definition: DataSource.h:49
#define TEWMSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:132
Informations about WMS Layers.
It represents the SQL query dialect accepted by a given data source.
Definition: SQLDialect.h:55
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
Configuration flags for the TerraLib WMS module.
std::map< std::string, WMSLayerInfo > m_layersInfo
Definition: DataSource.h:101
An exception class for the TerraLib WMS module.
te::da::DataSourceCapabilities capabilities
URI C++ Library.
std::map< std::string, std::string > m_connectionInfo
Definition: DataSource.h:99
static te::da::DataSourceCapabilities sm_capabilities
Definition: DataSource.h:102