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/terralib4/DataSource.h
22 
23  \brief Implements the DataSource class for the TerraLib 4.x Data Access Driver.
24 */
25 
26 #ifndef __TERRALIB_TERRALIB4_INTERNAL_DATASOURCE_H
27 #define __TERRALIB_TERRALIB4_INTERNAL_DATASOURCE_H
28 
29 // TerraLib
30 #include "../dataaccess/datasource/DataSource.h"
31 #include "../dataaccess/datasource/DataSourceCapabilities.h"
32 #include "Config.h"
33 
34 class TeDatabase;
35 class TeTheme;
36 
37 namespace terralib4
38 {
39  struct ThemeInfo;
40 
42  {
43  public:
44 
45  DataSource(const std::string& connInfo);
46 
48 
50 
51  std::string getType() const;
52 
53  std::unique_ptr<te::da::DataSourceTransactor> getTransactor();
54 
55  void open();
56 
57  void close();
58 
59  bool isOpened() const;
60 
61  bool isValid() const;
62 
64 
66 
67  TeDatabase* getTerralib4Db();
68 
69  std::vector<std::string> getTL4Layers();
70 
71  std::vector<std::string> getTL4Tables();
72 
73  std::vector<std::string> getTL4Rasters();
74 
75  std::vector<std::pair<std::string, std::string> > getTL4RasterFiles();
76 
77  std::vector<::terralib4::ThemeInfo> getTL4Themes();
78 
79  TeTheme* getTL4Theme(const ::terralib4::ThemeInfo& theme);
80 
81  int getLayerSRID(const std::string & layerName);
82 
83  protected:
84 
85  void create(const std::string& dsInfo);
86 
87  void drop(const std::string& dsInfo);
88 
89  bool exists(const std::string& dsInfo);
90 
91  std::vector<std::string> getDataSourceNames(const std::string& dsInfo);
92 
93  private:
94 
95  TeDatabase* m_db;
96 
99  };
100 
101 }
102 
103 #endif // __TERRALIB_TERRALIB4_INTERNAL_DATASOURCE_H
terralib4::DataSource
Definition: DataSource.h:42
te::da::SQLDialect
It represents the SQL query dialect accepted by a given data source.
Definition: SQLDialect.h:56
terralib4::DataSource::open
void open()
It opens the data source and makes it ready for using.
terralib4::DataSource::getTL4Themes
std::vector<::terralib4::ThemeInfo > getTL4Themes()
terralib4::DataSource::getTL4Tables
std::vector< std::string > getTL4Tables()
terralib4::DataSource::sm_dialect
static te::da::SQLDialect * sm_dialect
Definition: DataSource.h:98
terralib4::DataSource::getDataSourceNames
std::vector< std::string > getDataSourceNames(const std::string &dsInfo)
It gets the data source names available in a driver.
terralib4::DataSource::getCapabilities
const te::da::DataSourceCapabilities & getCapabilities() const
It returns the known capabilities of the data source.
terralib4::DataSource::sm_capabilities
static te::da::DataSourceCapabilities sm_capabilities
Definition: DataSource.h:97
terralib4::DataSource::getTL4Theme
TeTheme * getTL4Theme(const ::terralib4::ThemeInfo &theme)
terralib4::DataSource::getTransactor
std::unique_ptr< te::da::DataSourceTransactor > getTransactor()
It returns the set of parameters used to set up the access channel to the underlying repository.
terralib4::DataSource::isOpened
bool isOpened() const
It returns true if the data source is opened, otherwise it returns false.
terralib4::DataSource::isValid
bool isValid() const
It checks if the data source is valid (available for using).
terralib4::DataSource::m_db
TeDatabase * m_db
Definition: DataSource.h:95
terralib4::DataSource::getTL4Layers
std::vector< std::string > getTL4Layers()
terralib4::DataSource::getType
std::string getType() const
It returns the data source type name (in UPPER CASE). Ex: POSTGIS, SQLITE, WFS, WMS,...
te::core::URI
A class to store the proxy information that must be used to access data located in URIs.
Definition: URI.h:50
terralib4::DataSource::DataSource
DataSource(const std::string &connInfo)
terralib4::DataSource::drop
void drop(const std::string &dsInfo)
It removes the data source with the connection information from a driver.
terralib4::DataSource::exists
bool exists(const std::string &dsInfo)
Check the existence of a data source in a driver.
terralib4::DataSource::getTL4Rasters
std::vector< std::string > getTL4Rasters()
terralib4
Definition: Band.h:35
te::da::DataSourceCapabilities
A class that represents the known capabilities of a specific data source, i.e. this class informs all...
Definition: DataSourceCapabilities.h:56
TETERRALIB4EXPORT
#define TETERRALIB4EXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:123
te::da::DataSource
An abstract class for data providers like a DBMS, Web Services or a regular file.
Definition: DataSource.h:120
terralib4::DataSource::getLayerSRID
int getLayerSRID(const std::string &layerName)
terralib4::DataSource::getTL4RasterFiles
std::vector< std::pair< std::string, std::string > > getTL4RasterFiles()
terralib4::DataSource::close
void close()
It closes the data source and clears all the resources used by its internal communication channel.
Config.h
Proxy configuration file for TerraView (see terraview_config.h).
terralib4::DataSource::getTerralib4Db
TeDatabase * getTerralib4Db()
terralib4::DataSource::getDialect
const te::da::SQLDialect * getDialect() const
It returns the data source SQL dialect, if there is one.
terralib4::DataSource::~DataSource
~DataSource()
Virtual destructor.
terralib4::DataSource::DataSource
DataSource(const te::core::URI &uri)
terralib4::DataSource::create
void create(const std::string &dsInfo)
It creates a new data source.