All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Transactor.cpp
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/wcs/Transactor.cpp
22 
23  \brief Implementation of the transactor for the WCS driver.
24 */
25 
26 // TerraLib
27 #include "../common/Translator.h"
28 #include "../gdal/DataSet.h"
29 #include "../gdal/Utils.h"
30 #include "../geometry/Envelope.h"
31 #include "../raster/Grid.h"
32 #include "Exception.h"
33 #include "Transactor.h"
34 #include "Utils.h"
35 
36 // GDAL
37 #include <gdal_priv.h>
38 
39 // STL
40 #include <vector>
41 
42 te::wcs::Transactor::Transactor(const std::string& serviceURL, const std::string& coverageName)
43  : m_serviceURL(serviceURL),
44  m_coverageName(coverageName)
45 {
46 }
47 
49 {
50 }
51 
53 {
54  return 0;
55 }
56 
57 std::auto_ptr<te::da::DataSet> te::wcs::Transactor::getDataSet(const std::string& name,
58  te::common::TraverseType /*travType*/,
59  bool /*connected*/,
60  const te::common::AccessPolicy /*accessPolicy*/)
61 {
62  if(name != m_coverageName)
63  throw Exception(TE_TR("The informed data set could not be found in the data source!!"));
64 
65  // Retrieves the data set type
66  std::auto_ptr<te::da::DataSetType> type = getDataSetType(name);
67 
68  // Build the GDAL WCS request
69  std::string request = BuildRequest(m_serviceURL, m_coverageName);
70 
71  return std::auto_ptr<te::da::DataSet>(new te::gdal::DataSet(type, te::common::RAccess, request));
72 }
73 
74 std::auto_ptr<te::da::DataSet> te::wcs::Transactor::getDataSet(const std::string& name,
75  const std::string& /*propertyName*/,
76  const te::gm::Envelope* e,
78  te::common::TraverseType /*travType*/,
79  bool /*connected*/,
80  const te::common::AccessPolicy /*accessPolicy*/)
81 {
82  if(name != m_coverageName)
83  throw Exception(TE_TR("The informed data set could not be found in the data source!"));
84 
85  // Retrieves the data set type
86  std::auto_ptr<te::da::DataSetType> type = getDataSetType(name);
87 
88  // Build the GDAL WCS request with extent restriction
89  std::string request = BuildRequest(m_serviceURL, m_coverageName, e);
90 
91  return std::auto_ptr<te::da::DataSet>(new te::gdal::DataSet(type, te::common::RAccess, request));
92 }
93 
94 std::auto_ptr<te::da::DataSet> te::wcs::Transactor::getDataSet(const std::string& name,
95  const std::string& propertyName,
96  const te::gm::Geometry* g,
98  te::common::TraverseType travType,
99  bool connected,
100  const te::common::AccessPolicy accessPolicy)
101 {
102  return getDataSet(name, propertyName, g->getMBR(), r, travType, connected, accessPolicy);
103 }
104 
105 std::auto_ptr<te::da::DataSet> te::wcs::Transactor::getDataSet(const std::string& name,
106  const te::da::ObjectIdSet* oids,
107  te::common::TraverseType travType,
108  bool connected,
109  const te::common::AccessPolicy accessPolicy)
110 {
111  throw Exception(TE_TR("The ObjectIdSet concept is not supported by the WCS driver!"));
112 }
113 
114 std::auto_ptr<te::da::DataSet> te::wcs::Transactor::query(const te::da::Select& q,
115  te::common::TraverseType travType,
116  bool connected,
117  const te::common::AccessPolicy accessPolicy)
118 {
119  throw Exception(TE_TR("Query operations is not supported by the WCS driver!"));
120 }
121 
122 std::auto_ptr<te::da::DataSet> te::wcs::Transactor::query(const std::string& query,
123  te::common::TraverseType travType,
124  bool connected,
125  const te::common::AccessPolicy accessPolicy)
126 {
127  throw Exception(TE_TR("Query operations is not supported by the WCS driver!"));
128 }
129 
130 std::vector<std::string> te::wcs::Transactor::getDataSetNames()
131 {
132  std::vector<std::string> names;
133  names.push_back(m_coverageName);
134 
135  return names;
136 }
137 
139 {
140  return 1;
141 }
142 
143 std::auto_ptr<te::da::DataSetType> te::wcs::Transactor::getDataSetType(const std::string& name)
144 {
145  if(name != m_coverageName)
146  throw Exception(TE_TR("The informed data set could not be found in the data source."));
147 
148  // Build the GDAL WCS request
149  std::string request = BuildRequest(m_serviceURL, m_coverageName);
150 
151  GDALDataset* gds = static_cast<GDALDataset*>(GDALOpen(request.c_str(), GA_ReadOnly));
152  if(gds == 0)
153  throw Exception(TE_TR("The data set type could not be retrieved from data source."));
154 
155  te::da::DataSetType* type = new te::da::DataSetType(m_coverageName, 0);
156  type->setTitle(m_coverageName);
157 
158  te::rst::Grid* grid = te::gdal::GetGrid(gds);
159 
160  std::vector<te::rst::BandProperty*> bandProperties;
161  te::gdal::GetBandProperties(gds, bandProperties);
162 
164  rp->set(grid);
165 
166  for(std::size_t i = 0; i < bandProperties.size(); ++i)
167  rp->add(bandProperties[i]);
168 
169  type->add(rp);
170 
171  GDALClose(gds);
172 
173  return std::auto_ptr<te::da::DataSetType>(type);
174 }
175 
176 boost::ptr_vector<te::dt::Property> te::wcs::Transactor::getProperties(const std::string& datasetName)
177 {
178  boost::ptr_vector<te::dt::Property> properties;
179 
180  std::auto_ptr<te::da::DataSetType> type = getDataSetType(datasetName);
181 
182  const std::vector<te::dt::Property*>& props = type->getProperties();
183  for(std::size_t i = 0; i < props.size(); ++i)
184  properties.push_back(props[i]->clone());
185 
186  return properties;
187 }
188 
189 std::auto_ptr<te::dt::Property> te::wcs::Transactor::getProperty(const std::string& datasetName, const std::string& name)
190 {
191  std::auto_ptr<te::da::DataSetType> type = getDataSetType(datasetName);
192 
193  const std::vector<te::dt::Property*>& props = type->getProperties();
194  for(std::size_t i = 0; i < props.size(); ++i)
195  {
196  if(props[i]->getName() == name)
197  return std::auto_ptr<te::dt::Property>(props[i]->clone());
198  }
199 
200  throw Exception(TE_TR("The informed property name could not be found in the data set."));
201 }
202 
203 std::auto_ptr<te::dt::Property> te::wcs::Transactor::getProperty(const std::string& datasetName, std::size_t propertyPos)
204 {
205  std::auto_ptr<te::da::DataSetType> type = getDataSetType(datasetName);
206 
207  const std::vector<te::dt::Property*>& props = type->getProperties();
208 
209  if(propertyPos >= props.size())
210  throw Exception(TE_TR("The informed property position could not be found in the data set."));
211 
212  return std::auto_ptr<te::dt::Property>(props[propertyPos]->clone());
213 }
214 
215 std::vector<std::string> te::wcs::Transactor::getPropertyNames(const std::string& datasetName)
216 {
217  std::vector<std::string> propertyNames;
218 
219  std::auto_ptr<te::da::DataSetType> type = getDataSetType(datasetName);
220 
221  const std::vector<te::dt::Property*>& props = type->getProperties();
222  for(std::size_t i = 0; i < props.size(); ++i)
223  propertyNames.push_back(props[i]->getName());
224 
225  return propertyNames;
226 }
227 
228 std::size_t te::wcs::Transactor::getNumberOfProperties(const std::string& datasetName)
229 {
230  return getPropertyNames(datasetName).size();
231 }
232 
233 bool te::wcs::Transactor::propertyExists(const std::string& datasetName, const std::string& name)
234 {
235  std::vector<std::string> propertyNames = getPropertyNames(datasetName);
236 
237  for(std::size_t i = 0; i < propertyNames.size(); ++i)
238  if(propertyNames[i] == name)
239  return true;
240 
241  return false;
242 }
243 
244 std::auto_ptr<te::gm::Envelope> te::wcs::Transactor::getExtent(const std::string& datasetName,
245  const std::string& propertyName)
246 {
247  std::auto_ptr<te::da::DataSetType> type = getDataSetType(datasetName);
248 
249  std::auto_ptr<te::dt::Property> prop = getProperty(datasetName, propertyName);
250 
251  te::rst::RasterProperty* rasterProperty = static_cast<te::rst::RasterProperty*>(prop.get());
252  te::gm::Envelope* e = rasterProperty->getGrid()->getExtent();
253 
254  return std::auto_ptr<te::gm::Envelope>(new te::gm::Envelope(e->getLowerLeftX(), e->getLowerLeftY(),
255  e->getUpperRightX(), e->getUpperRightY()));
256 }
257 
258 std::auto_ptr<te::gm::Envelope> te::wcs::Transactor::getExtent(const std::string& datasetName,
259  std::size_t propertyPos)
260 {
261  std::auto_ptr<te::da::DataSetType> type = getDataSetType(datasetName);
262 
263  std::auto_ptr<te::dt::Property> prop = getProperty(datasetName, propertyPos);
264 
265  te::rst::RasterProperty* rasterProperty = static_cast<te::rst::RasterProperty*>(prop.get());
266  te::gm::Envelope* e = rasterProperty->getGrid()->getExtent();
267 
268  return std::auto_ptr<te::gm::Envelope>(new te::gm::Envelope(e->getLowerLeftX(), e->getLowerLeftY(),
269  e->getUpperRightX(), e->getUpperRightY()));
270 }
271 
272 std::size_t te::wcs::Transactor::getNumberOfItems(const std::string& datasetName)
273 {
274  return 1;
275 }
276 
278 {
279  return !m_coverageName.empty();
280 }
281 
282 bool te::wcs::Transactor::dataSetExists(const std::string& name)
283 {
284  return name == m_coverageName;
285 }
286 
288 {
290 }
291 
292 /** NOT SUPPORTED METHODS */
293 //@{
294 
296 {
297  throw Exception(TE_TR("The method begin() is not supported by the WCS driver!"));
298 }
299 
301 {
302  throw Exception(TE_TR("The method commit() is not supported by the WCS driver!"));
303 }
304 
306 {
307  throw Exception(TE_TR("The method rollBack() is not supported by the WCS driver!"));
308 }
309 
311 {
312  throw Exception(TE_TR("The method isInTransaction() is not supported by the WCS driver!"));
313 }
314 
316 {
317  throw Exception(TE_TR("The method execute() is not supported by the WCS driver!"));
318 }
319 
320 void te::wcs::Transactor::execute(const std::string& /*command*/)
321 {
322  throw Exception(TE_TR("The method execute() is not supported by the WCS driver!"));
323 }
324 
325 std::auto_ptr<te::da::PreparedQuery> te::wcs::Transactor::getPrepared(const std::string& /*qName*/)
326 {
327  throw Exception(TE_TR("The method getPrepared() is not supported by the WCS driver!"));
328 }
329 
330 std::auto_ptr<te::da::BatchExecutor> te::wcs::Transactor::getBatchExecutor()
331 {
332  throw Exception(TE_TR("The method getBatchExecutor() is not supported by the WCS driver!"));
333 }
334 
336 {
337  throw Exception(TE_TR("The method cancel() is not supported by the WCS driver!"));
338 }
339 
341 {
342  throw Exception(TE_TR("The method getLastGeneratedId() is not supported by the WCS driver!"));
343 }
344 
345 std::string te::wcs::Transactor::escape(const std::string& /*value*/)
346 {
347  throw Exception(TE_TR("The method escape() is not supported by the WCS driver!"));
348 }
349 
350 bool te::wcs::Transactor::isDataSetNameValid(const std::string& /*datasetName*/)
351 {
352  throw Exception(TE_TR("The method isDataSetNameValid() is not supported by the WCS driver!"));
353 }
354 
355 bool te::wcs::Transactor::isPropertyNameValid(const std::string& /*propertyName*/)
356 {
357  throw Exception(TE_TR("The method isPropertyNameValid() is not supported by the WCS driver!"));
358 }
359 
360 void te::wcs::Transactor::addProperty(const std::string& /*datasetName*/, te::dt::Property* /*p*/)
361 {
362  throw Exception(TE_TR("The method addProperty() is not supported by the WCS driver!"));
363 }
364 
365 void te::wcs::Transactor::dropProperty(const std::string& /*datasetName*/, const std::string& /*name*/)
366 {
367  throw Exception(TE_TR("The method dropProperty() is not supported by the WCS driver!"));
368 }
369 
370 void te::wcs::Transactor::renameProperty(const std::string& /*datasetName*/, const std::string& /*propertyName*/, const std::string& /*newPropertyName*/)
371 {
372  throw Exception(TE_TR("The method renameProperty() is not supported by the WCS driver!"));
373 }
374 
375 std::auto_ptr<te::da::PrimaryKey> te::wcs::Transactor::getPrimaryKey(const std::string& /*datasetName*/)
376 {
377  throw Exception(TE_TR("The method getPrimaryKey() is not supported by the WCS driver!"));
378 }
379 
380 bool te::wcs::Transactor::primaryKeyExists(const std::string& /*datasetName*/, const std::string& /*name*/)
381 {
382  throw Exception(TE_TR("The method primaryKeyExists() is not supported by the WCS driver!"));
383 }
384 
385 void te::wcs::Transactor::addPrimaryKey(const std::string& /*datasetName*/, te::da::PrimaryKey* /*pk*/)
386 {
387  throw Exception(TE_TR("The method addPrimaryKey() is not supported by the WCS driver!"));
388 }
389 
390 void te::wcs::Transactor::dropPrimaryKey(const std::string& /*datasetName*/)
391 {
392  throw Exception(TE_TR("The method dropPrimaryKey() is not supported by the WCS driver!"));
393 }
394 
395 std::auto_ptr<te::da::ForeignKey> te::wcs::Transactor::getForeignKey(const std::string& /*datasetName*/, const std::string& /*name*/)
396 {
397  throw Exception(TE_TR("The method getForeignKey() is not supported by the WCS driver!"));
398 }
399 
400 std::vector<std::string> te::wcs::Transactor::getForeignKeyNames(const std::string& /*datasetName*/)
401 {
402  throw Exception(TE_TR("The method getForeignKeyNames() is not supported by the WCS driver!"));
403 }
404 
405 bool te::wcs::Transactor::foreignKeyExists(const std::string& /*datasetName*/, const std::string& /*name*/)
406 {
407  throw Exception(TE_TR("The method foreignKeyExists() is not supported by the WCS driver!"));
408 }
409 
410 void te::wcs::Transactor::addForeignKey(const std::string& /*datasetName*/, te::da::ForeignKey* /*fk*/)
411 {
412  throw Exception(TE_TR("The method addForeignKey() is not supported by the WCS driver!"));
413 }
414 
415 void te::wcs::Transactor::dropForeignKey(const std::string& /*datasetName*/, const std::string& /*fkName*/)
416 {
417  throw Exception(TE_TR("The method dropForeignKey() is not supported by the WCS driver!"));
418 }
419 
420 std::auto_ptr<te::da::UniqueKey> te::wcs::Transactor::getUniqueKey(const std::string& /*datasetName*/, const std::string& /*name*/)
421 {
422  throw Exception(TE_TR("The method getUniqueKey() is not supported by the WCS driver!"));
423 }
424 
425 std::vector<std::string> te::wcs::Transactor::getUniqueKeyNames(const std::string& /*datasetName*/)
426 {
427  throw Exception(TE_TR("The method getUniqueKeyNames() is not supported by the WCS driver!"));
428 }
429 
430 bool te::wcs::Transactor::uniqueKeyExists(const std::string& /*datasetName*/, const std::string& /*name*/)
431 {
432  throw Exception(TE_TR("The method uniqueKeyExists() is not supported by the WCS driver!"));
433 }
434 
435 void te::wcs::Transactor::addUniqueKey(const std::string& /*datasetName*/, te::da::UniqueKey* /*uk*/)
436 {
437  throw Exception(TE_TR("The method addUniqueKey() is not supported by the WCS driver!"));
438 }
439 
440 void te::wcs::Transactor::dropUniqueKey(const std::string& /*datasetName*/, const std::string& /*name*/)
441 {
442  throw Exception(TE_TR("The method dropUniqueKey() is not supported by the WCS driver!"));
443 }
444 
445 std::auto_ptr<te::da::CheckConstraint> te::wcs::Transactor::getCheckConstraint(const std::string& /*datasetName*/, const std::string& /*name*/)
446 {
447  throw Exception(TE_TR("The method getCheckConstraint() is not supported by the WCS driver!"));
448 }
449 
450 std::vector<std::string> te::wcs::Transactor::getCheckConstraintNames(const std::string& /*datasetName*/)
451 {
452  throw Exception(TE_TR("The method getCheckConstraintNames() is not supported by the WCS driver!"));
453 }
454 
455 bool te::wcs::Transactor::checkConstraintExists(const std::string& /*datasetName*/, const std::string& /*name*/)
456 {
457  throw Exception(TE_TR("The method checkConstraintExists() is not supported by the WCS driver!"));
458 }
459 
460 void te::wcs::Transactor::addCheckConstraint(const std::string& /*datasetName*/, te::da::CheckConstraint* /*cc*/)
461 {
462  throw Exception(TE_TR("The method addCheckConstraint() is not supported by the WCS driver!"));
463 }
464 
465 void te::wcs::Transactor::dropCheckConstraint(const std::string& /*datasetName*/, const std::string& /*name*/)
466 {
467  throw Exception(TE_TR("The method dropCheckConstraint() is not supported by the WCS driver!"));
468 }
469 
470 std::auto_ptr<te::da::Index> te::wcs::Transactor::getIndex(const std::string& /*datasetName*/, const std::string& /*name*/)
471 {
472  throw Exception(TE_TR("The method getIndex() is not supported by the WCS driver!"));
473 }
474 
475 std::vector<std::string> te::wcs::Transactor::getIndexNames(const std::string& /*datasetName*/)
476 {
477  throw Exception(TE_TR("The method getIndexNames() is not supported by the WCS driver!"));
478 }
479 
480 bool te::wcs::Transactor::indexExists(const std::string& /*datasetName*/, const std::string& /*name*/)
481 {
482  throw Exception(TE_TR("The method indexExists() is not supported by the WCS driver!"));
483 }
484 
485 void te::wcs::Transactor::addIndex(const std::string& /*datasetName*/, te::da::Index* /*idx*/, const std::map<std::string, std::string>& /*options*/)
486 {
487  throw Exception(TE_TR("The method addIndex() is not supported by the WCS driver!"));
488 }
489 
490 void te::wcs::Transactor::dropIndex(const std::string& /*datasetName*/, const std::string& /*idxName*/)
491 {
492  throw Exception(TE_TR("The method dropIndex() is not supported by the WCS driver!"));
493 }
494 
495 std::auto_ptr<te::da::Sequence> te::wcs::Transactor::getSequence(const std::string& /*name*/)
496 {
497  throw Exception(TE_TR("The method getSequence() is not supported by the WCS driver!"));
498 }
499 
500 std::vector<std::string> te::wcs::Transactor::getSequenceNames()
501 {
502  throw Exception(TE_TR("The method getSequenceNames() is not supported by the WCS driver!"));
503 }
504 
505 bool te::wcs::Transactor::sequenceExists(const std::string& /*name*/)
506 {
507  throw Exception(TE_TR("The method sequenceExists() is not supported by the WCS driver!"));
508 }
509 
511 {
512  throw Exception(TE_TR("The method addSequence() is not supported by the WCS driver!"));
513 }
514 
515 void te::wcs::Transactor::dropSequence(const std::string& /*name*/)
516 {
517  throw Exception(TE_TR("The method dropSequence() is not supported by the WCS driver!"));
518 }
519 
521  const std::map<std::string, std::string>& /*options*/)
522 {
523  throw Exception(TE_TR("The method createDataSet() is not supported by the WCS driver!"));
524 }
525 
526 void te::wcs::Transactor::cloneDataSet(const std::string& /*name*/,
527  const std::string& /*cloneName*/,
528  const std::map<std::string, std::string>& /*options*/)
529 {
530  throw Exception(TE_TR("The method cloneDataSet() is not supported by the WCS driver!"));
531 }
532 
533 void te::wcs::Transactor::dropDataSet(const std::string& /*name*/)
534 {
535  throw Exception(TE_TR("The method dropDataSet() is not supported by the WCS driver!"));
536 }
537 
538 void te::wcs::Transactor::renameDataSet(const std::string& /*name*/,
539  const std::string& /*newName*/)
540 {
541  throw Exception(TE_TR("The method renameDataSet() is not supported by the WCS driver!"));
542 }
543 
544 void te::wcs::Transactor::add(const std::string& /*datasetName*/,
545  te::da::DataSet* /*d*/,
546  const std::map<std::string, std::string>& /*options*/,
547  std::size_t /*limit*/)
548 {
549  throw Exception(TE_TR("The method add() is not supported by the WCS driver!"));
550 }
551 
552 void te::wcs::Transactor::remove(const std::string& /*datasetName*/, const te::da::ObjectIdSet* /*oids*/)
553 {
554  throw Exception(TE_TR("The method remove() is not supported by the WCS driver!"));
555 }
556 
557 void te::wcs::Transactor::update(const std::string& /*datasetName*/,
558  te::da::DataSet* /*dataset*/,
559  const std::vector<std::size_t>& /*properties*/,
560  const te::da::ObjectIdSet* /*oids*/,
561  const std::map<std::string, std::string>& /*options*/,
562  std::size_t /*limit*/)
563 {
564  throw Exception(TE_TR("The method update() is not supported by the WCS driver!"));
565 }
566 
567 void te::wcs::Transactor::optimize(const std::map<std::string, std::string>& /*opInfo*/)
568 {
569  throw Exception(TE_TR("The method optimize() is not supported by the WCS driver!"));
570 }
571 
572 //@}
void setTitle(const std::string &title)
It sets a human descriptive title for the DataSetType.
Definition: DataSetType.h:137
void set(te::rst::Grid *grid)
Sets the definition of the raster grid support.
std::vector< std::string > getForeignKeyNames(const std::string &datasetName)
It gets the foreign key names of the given dataset.
Definition: Transactor.cpp:400
void renameProperty(const std::string &datasetName, const std::string &propertyName, const std::string &newPropertyName)
It renames a property of the given dataset.
Definition: Transactor.cpp:370
std::auto_ptr< te::gm::Envelope > getExtent(const std::string &datasetName, const std::string &propertyName)
It retrieves the bounding rectangle of the spatial property for the given dataset.
Definition: Transactor.cpp:244
void addProperty(const std::string &datasetName, te::dt::Property *p)
It adds a new property to the dataset schema.
Definition: Transactor.cpp:360
void dropForeignKey(const std::string &datasetName, const std::string &fkName)
It removes the foreign key constraint from the dataset schema.
Definition: Transactor.cpp:415
CharEncoding
Supported charsets (character encoding).
Implementation of the transactor for the WCS driver.
std::auto_ptr< te::da::Index > getIndex(const std::string &datasetName, const std::string &name)
It gets the index with the given name from the dataset.
Definition: Transactor.cpp:470
Utilitary functions to access GDAL and match some of its concepts to TerraLib concepts.
TEGDALEXPORT void GetBandProperties(GDALDataset *gds, std::vector< te::rst::BandProperty * > &bprops)
Gets the list of bands definition from a GDAL dataset.
Definition: Utils.cpp:193
std::auto_ptr< te::da::DataSet > getDataSet(const std::string &name, te::common::TraverseType travType=te::common::FORWARDONLY, bool connected=false, const te::common::AccessPolicy accessPolicy=te::common::RAccess)
It gets the dataset identified by the given name. A dataset can be connected or disconnected. A connected dataset, after its creation through the data source transactor, continues to depend on the connection given by its associated data source. Differently, a disconnected dataset, after its creation, no more depends of the connection given by the data source, and it continues to live after the connection has been released to the data source.
Definition: Transactor.cpp:57
std::auto_ptr< te::da::UniqueKey > getUniqueKey(const std::string &datasetName, const std::string &name)
It gets the unique key in the dataset with the given name.
Definition: Transactor.cpp:420
void dropSequence(const std::string &name)
It removes the sequence from the data source.
Definition: Transactor.cpp:515
void dropPrimaryKey(const std::string &datasetName)
It removes the primary key constraint from the dataset schema.
Definition: Transactor.cpp:390
bool indexExists(const std::string &datasetName, const std::string &name)
It checks if an index with the given name exists in the dataset.
Definition: Transactor.cpp:480
A class that models the description of a dataset.
Definition: DataSetType.h:72
bool dataSetExists(const std::string &name)
It checks if a dataset with the given name exists in the data source.
Definition: Transactor.cpp:282
An exception class for the TerraLib WCS module.
std::string escape(const std::string &value)
It escapes a string for using in commands and queries.
Definition: Transactor.cpp:345
std::auto_ptr< te::dt::Property > getProperty(const std::string &datasetName, const std::string &name)
It retrieves the property with the given name from the dataset.
Definition: Transactor.cpp:189
const double & getUpperRightX() const
It returns a constant refernce to the x coordinate of the upper right corner.
Definition: Envelope.h:410
bool propertyExists(const std::string &datasetName, const std::string &name)
It checks if a property with the given name exists in the dataset.
Definition: Transactor.cpp:233
void cancel()
It requests that the data source stop the processing of the current command.
Definition: Transactor.cpp:335
bool checkConstraintExists(const std::string &datasetName, const std::string &name)
It checks if a check-constraint with the given name exists in the data source.
Definition: Transactor.cpp:455
std::auto_ptr< te::da::PreparedQuery > getPrepared(const std::string &qName=std::string(""))
It creates a prepared query object that may be used for query commands (select, insert, update and delete) that are used repeatedly.
Definition: Transactor.cpp:325
const double & getLowerLeftY() const
It returns a constant refernce to the y coordinate of the lower left corner.
Definition: Envelope.h:400
SpatialRelation
Spatial relations between geometric objects.
Definition: Enums.h:122
void update(const std::string &datasetName, te::da::DataSet *dataset, const std::vector< std::size_t > &properties, const te::da::ObjectIdSet *oids, const std::map< std::string, std::string > &options, std::size_t limit=0)
It updates the contents of a dataset for the set of data items.
Definition: Transactor.cpp:557
void addForeignKey(const std::string &datasetName, te::da::ForeignKey *fk)
It adds a foreign key constraint to a dataset.
Definition: Transactor.cpp:410
It describes a sequence (a number generator).
Definition: Sequence.h:56
std::auto_ptr< te::da::DataSetType > getDataSetType(const std::string &name)
It gets information about the given dataset.
Definition: Transactor.cpp:143
std::auto_ptr< te::da::PrimaryKey > getPrimaryKey(const std::string &datasetName)
It retrieves the primary key of the dataset.
Definition: Transactor.cpp:375
bool uniqueKeyExists(const std::string &datasetName, const std::string &name)
It checks if a unique key with the given name exists in the dataset.
Definition: Transactor.cpp:430
A class that describes a check constraint.
An abstract class for data providers like a DBMS, Web Services or a regular file. ...
Definition: DataSource.h:118
const double & getUpperRightY() const
It returns a constant refernce to the x coordinate of the upper right corner.
Definition: Envelope.h:420
#define TE_TR(message)
It marks a string in order to get translated.
Definition: Translator.h:347
It models a property definition.
Definition: Property.h:59
Raster property.
bool isDataSetNameValid(const std::string &datasetName)
It returns true if the given string is a valid dataset name.
Definition: Transactor.cpp:350
void addCheckConstraint(const std::string &datasetName, te::da::CheckConstraint *cc)
It adds a check constraint to the dataset.
Definition: Transactor.cpp:460
void dropDataSet(const std::string &name)
It removes the dataset schema from the data source.
Definition: Transactor.cpp:533
Transactor(const std::string &serviceURL, const std::string &coverageName)
Definition: Transactor.cpp:42
void cloneDataSet(const std::string &name, const std::string &cloneName, const std::map< std::string, std::string > &options)
It clones the dataset in the data source.
Definition: Transactor.cpp:526
boost::ptr_vector< te::dt::Property > getProperties(const std::string &datasetName)
It retrieves the properties of the dataset.
Definition: Transactor.cpp:176
std::auto_ptr< te::da::Sequence > getSequence(const std::string &name)
It gets the sequence with the given name in the data source.
Definition: Transactor.cpp:495
void addUniqueKey(const std::string &datasetName, te::da::UniqueKey *uk)
It adds a unique key constraint to the dataset.
Definition: Transactor.cpp:435
void dropProperty(const std::string &datasetName, const std::string &name)
It removes a property from the given dataset.
Definition: Transactor.cpp:365
std::size_t getNumberOfDataSets()
It retrieves the number of data sets available in the data source.
Definition: Transactor.cpp:138
te::da::DataSource * getDataSource() const
It returns the parent data source of the transactor.
Definition: Transactor.cpp:52
AccessPolicy
Supported data access policies (can be used as bitfield).
Definition: Enums.h:40
bool primaryKeyExists(const std::string &datasetName, const std::string &name)
It checks if a primary key exists in the dataset.
Definition: Transactor.cpp:380
TraverseType
A dataset can be traversed in two ways:
Definition: Enums.h:53
std::vector< std::string > getIndexNames(const std::string &datasetName)
It gets the index names of the given dataset.
Definition: Transactor.cpp:475
void add(te::rst::BandProperty *b)
It adds a new band information to the property.
bool hasDataSets()
It checks if the data source has any dataset.
Definition: Transactor.cpp:277
void execute(const te::da::Query &command)
It executes the specified command using a generic query representation.
Definition: Transactor.cpp:315
An Envelope defines a 2D rectangular region.
Definition: Envelope.h:51
This class represents a set of unique ids created in the same context. i.e. from the same data set...
Definition: ObjectIdSet.h:55
bool sequenceExists(const std::string &name)
It checks if a sequence with the given name exists in the data source.
Definition: Transactor.cpp:505
std::vector< std::string > getSequenceNames()
It gets the sequence names available in the data source.
Definition: Transactor.cpp:500
std::auto_ptr< te::da::CheckConstraint > getCheckConstraint(const std::string &datasetName, const std::string &name)
It gets the check constraint of the dataset with the given name.
Definition: Transactor.cpp:445
std::vector< std::string > getPropertyNames(const std::string &datasetName)
It gets the property names of the given dataset.
Definition: Transactor.cpp:215
bool isPropertyNameValid(const std::string &propertyName)
It checks if the given property name is valid.
Definition: Transactor.cpp:355
void optimize(const std::map< std::string, std::string > &opInfo)
For some data access drivers, this method will perform some operations to optimize the data storage...
Definition: Transactor.cpp:567
bool isInTransaction() const
It returns true if a transaction is in progress, otherwise, it returns false.
Definition: Transactor.cpp:310
It models a foreign key constraint for a DataSetType.
Definition: ForeignKey.h:50
It describes a unique key (uk) constraint.
Definition: UniqueKey.h:53
te::common::CharEncoding getEncoding()
It return the DataSource current encoding.
Definition: Transactor.cpp:287
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
Definition: Geometry.h:73
A Select models a query to be used when retrieving data from a DataSource.
Definition: Select.h:65
void addSequence(te::da::Sequence *sequence)
It creates a new sequence in the data source.
Definition: Transactor.cpp:510
void renameDataSet(const std::string &name, const std::string &newName)
It renames a dataset.
Definition: Transactor.cpp:538
std::string BuildRequest(const std::string &serviceURL, const std::string &coverageName, const te::gm::Envelope *e=0)
Definition: Utils.cpp:34
void commit()
It commits the transaction.
Definition: Transactor.cpp:300
std::size_t getNumberOfProperties(const std::string &datasetName)
It gets the number of properties of the given dataset.
Definition: Transactor.cpp:228
void remove(const std::string &datasetName, const te::da::ObjectIdSet *oids=0)
It removes all the informed items from the dataset.
Definition: Transactor.cpp:552
void add(Constraint *c)
It adds a new constraint.
te::rst::Grid * getGrid()
Returns the definition of the raster grid support.
A dataset is the unit of information manipulated by the data access module of TerraLib.
Definition: DataSet.h:112
std::auto_ptr< te::da::ForeignKey > getForeignKey(const std::string &datasetName, const std::string &name)
It retrieves the foreign key from the given dataset.
Definition: Transactor.cpp:395
void dropCheckConstraint(const std::string &datasetName, const std::string &name)
It removes the check constraint from the dataset.
Definition: Transactor.cpp:465
It describes a primary key (pk) constraint.
Definition: PrimaryKey.h:52
const double & getLowerLeftX() const
It returns a constant reference to the x coordinate of the lower left corner.
Definition: Envelope.h:390
std::vector< std::string > getUniqueKeyNames(const std::string &datasetName)
It gets the unique key names of the given dataset.
Definition: Transactor.cpp:425
te::gm::Envelope * getExtent()
Returns the geographic extension of the grid.
Definition: Grid.cpp:275
std::size_t getNumberOfItems(const std::string &datasetName)
It retrieves the number of items of the given dataset.
Definition: Transactor.cpp:272
A GDAL data set gives access to a raster file.
Definition: DataSet.h:50
std::auto_ptr< te::da::BatchExecutor > getBatchExecutor()
It creates a batch command executor.
Definition: Transactor.cpp:330
std::auto_ptr< te::da::DataSet > query(const te::da::Select &q, te::common::TraverseType travType=te::common::FORWARDONLY, bool connected=false, const te::common::AccessPolicy accessPolicy=te::common::RAccess)
It executes a query that may return some data using a generic query. A dataset can be connected or di...
Definition: Transactor.cpp:114
void dropUniqueKey(const std::string &datasetName, const std::string &name)
It removes the unique key constraint from the dataset.
Definition: Transactor.cpp:440
void rollBack()
It aborts the transaction. Any changes will be rolled-back.
Definition: Transactor.cpp:305
A rectified grid is the spatial support for raster data.
Definition: Grid.h:68
std::vector< std::string > getDataSetNames()
It It gets the dataset names available in the data source.
Definition: Transactor.cpp:130
void add(const std::string &datasetName, te::da::DataSet *d, const std::map< std::string, std::string > &options, std::size_t limit=0)
It adds data items to the dataset in the data source.
Definition: Transactor.cpp:544
TEGDALEXPORT te::rst::Grid * GetGrid(GDALDataset *gds)
Gets the grid definition from a GDAL dataset.
Definition: Utils.cpp:104
bool foreignKeyExists(const std::string &datasetName, const std::string &name)
It checks if a foreign key with the given name exists in the data source.
Definition: Transactor.cpp:405
void addIndex(const std::string &datasetName, te::da::Index *idx, const std::map< std::string, std::string > &options)
It adds an index to the dataset.
Definition: Transactor.cpp:485
void createDataSet(te::da::DataSetType *dt, const std::map< std::string, std::string > &options)
It creates the dataset schema definition in the target data source.
Definition: Transactor.cpp:520
void dropIndex(const std::string &datasetName, const std::string &idxName)
It removes the index from the dataset schema.
Definition: Transactor.cpp:490
void addPrimaryKey(const std::string &datasetName, te::da::PrimaryKey *pk)
It adds a primary key constraint to the dataset schema.
Definition: Transactor.cpp:385
std::vector< std::string > getCheckConstraintNames(const std::string &datasetName)
It gets the check constraint names of the given dataset.
Definition: Transactor.cpp:450
void begin()
NOT SUPPORTED METHODS.
Definition: Transactor.cpp:295
const Envelope * getMBR() const
It returns the minimum bounding rectangle for the geometry in an internal representation.
Definition: Geometry.cpp:104
A Query is independent from the data source language/dialect.
Definition: Query.h:46
It describes an index associated to a DataSetType.
Definition: Index.h:54
boost::int64_t getLastGeneratedId()
It returns the last id generated by an insertion command.
Definition: Transactor.cpp:340