BatchExecutor.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/dataaccess/datasource/BatchExecutor.h
22 
23  \brief A class that models an object that submits commands in batch to the data source.
24 */
25 
26 #ifndef __TERRALIB_DATAACCESS_INTERNAL_BATCHEXECUTOR_H
27 #define __TERRALIB_DATAACCESS_INTERNAL_BATCHEXECUTOR_H
28 
29 // TerraLib
30 #include "../Config.h"
31 
32 // STL
33 #include <iosfwd>
34 #include <map>
35 #include <string>
36 
37 // Boost
38 #include <boost/noncopyable.hpp>
39 
40 namespace te
41 {
42  namespace da
43  {
44 // Forward declarations
45  class DataSourceTransactor;
46  class Query;
47 
48  /*!
49  \class BatchExecutor
50 
51  \brief A class that models an object that submits commands in batch to the data source.
52 
53  \sa DataSourceTransactor, Query
54  */
55  class TEDATAACCESSEXPORT BatchExecutor : public boost::noncopyable
56  {
57  public:
58 
59  /*! \brief Constructor. */
61 
62  /*! \brief Virtual destructor. */
63  virtual ~BatchExecutor() {}
64 
65  /*!
66  \brief It adds the given statement to the list of commands to be executed.
67 
68  \param query The query command to be added to the list of commands to be executed.
69 
70  \note The batch executor will take the query ownership.
71  */
72  virtual void add(Query* q) = 0;
73 
74  /*
75  \brief It executes a batch of previously loaded statements.
76 
77  \exception Excpetion It throws na exception if something goes wrong.
78 
79  \pos The internal buffer of statements are dropped.
80  */
81  virtual void execute() = 0;
82 
83  /*!
84  \brief It executes a series of statements in the respource identified by the URI.
85 
86  \param uri An URI with a resource with query statements.
87  \param options Optional parameters that can be used to refine the execution.
88 
89  \exception Excpetion It throws na exception if something goes wrong.
90  */
91  virtual void execute(const std::string& uri, const std::map<std::string, std::string>& options) = 0;
92 
93  /*!
94  \brief It executes a series of statements from the input stream.
95 
96  \param istr An input stream with query statements.
97  \param options Optional parameters that can be used to refine the execution.
98 
99  \exception Excpetion It throws na exception if something goes wrong.
100  */
101  virtual void execute(std::istream& istr, const std::map<std::string, std::string>& options) = 0;
102 
103  /*!
104  \brief It returns a pointer to the underlying data source transactor.
105 
106  \return A pointer to the underlying data source transactor.
107  */
108  virtual DataSourceTransactor* getTransactor() const = 0;
109  };
110 
111  } // end namespace da
112 } // end namespace te
113 
114 #endif // __TERRALIB_DATAACCESS_INTERNAL_BATCHEXECUTOR_H
115 
BatchExecutor()
Constructor.
Definition: BatchExecutor.h:60
URI C++ Library.
A class that models an object that submits commands in batch to the data source.
Definition: BatchExecutor.h:55
A DataSourceTransactor can be viewed as a connection to the data source for reading/writing things in...
#define TEDATAACCESSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:97
A Query is independent from the data source language/dialect.
Definition: Query.h:46
virtual ~BatchExecutor()
Virtual destructor.
Definition: BatchExecutor.h:63