src/terralib/ws/ogc/wcs/dataaccess/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/ws/ogc/wcs/dataaccess/Transactor.cpp
22 
23  \brief Implementation of the transactor for WS OGC WCS driver
24 
25  \author Vinicius Campanha
26 */
27 
28 
29 // STL
30 #include <vector>
31 
32 // TerraLib
33 #include "Transactor.h"
34 #include "Exception.h"
35 #include "../../wcs/dataaccess/DataSource.h"
36 #include "../../../../core/translator/Translator.h"
37 #include "../../../../geometry/Envelope.h"
38 #include "../../../../raster/Grid.h"
39 #include "../../../../dataaccess/datasource/DataSourceFactory.h"
40 #include "../../../../dataaccess/dataset/DataSet.h"
41 #include "../../../../ws/ogc/wcs/client/WCSClient.h"
42 #include "../../../../datatype.h"
43 #include "../../../../raster/RasterProperty.h"
44 #include "../../../../raster/Grid.h"
45 #include "../../../../raster/BandProperty.h"
46 #include "../../../../common/StringUtils.h"
47 
48 te::ws::ogc::wcs::da::Transactor::Transactor(const std::shared_ptr<te::ws::ogc::WCSClient> wcs)
49 
50 {
51  m_wcs = wcs;
52 }
53 
55 
57 {
58  return m_wcs->describeCoverage(coverageName);
59 }
60 
62 {
63  m_coverageRequest = coverageRequest;
64 }
65 
67 {
68  return nullptr;
69 }
70 
71 std::unique_ptr<te::da::DataSet> te::ws::ogc::wcs::da::Transactor::getDataSet(const std::string& name,
72  te::common::TraverseType /*travType*/,
73  bool /*connected*/,
74  const te::common::AccessPolicy /*accessPolicy*/)
75 {
76  if(!dataSetExists(name))
77  throw Exception(TE_TR("The informed data set could not be found in the data source!"));
78 
81  m_coverageRequest.format = "image/tiff";
82 
83  std::string coveragePath = m_wcs->getCoverage(m_coverageRequest);
84 
85  std::unique_ptr<te::da::DataSource> dataSource = te::da::DataSourceFactory::make("GDAL", ("file://" + coveragePath));
86  dataSource->open();
87 
88  if (!dataSource->isOpened() || !dataSource->isValid())
89  throw Exception(TE_TR("Fail to build Data Set. Data Source isn't valid or open!"));
90 
91  std::string nameWithExtension = name + ".tif";
92 
93  return dataSource->getDataSet(nameWithExtension);
94 }
95 
96 std::unique_ptr<te::da::DataSet> te::ws::ogc::wcs::da::Transactor::getDataSet(
97  const std::string& name, const std::string& propertyName,
99  te::common::TraverseType travType, bool /*connected*/,
100  const te::common::AccessPolicy accessPolicy)
101 {
102  if(!dataSetExists(name))
103  throw Exception(TE_TR("The informed data set could not be found in the data source!"));
104 
107  m_coverageRequest.format = "image/tiff";
108 
109  std::string coveragePath = m_wcs->getCoverage(m_coverageRequest);
110 
111  std::unique_ptr<te::da::DataSource> dataSource = te::da::DataSourceFactory::make("GDAL", ("file://" + coveragePath));
112  dataSource->open();
113 
114  if (!dataSource->isOpened() || !dataSource->isValid())
115  throw Exception(TE_TR("Fail to build Data Set. Data Source isn't valid or open!"));
116 
117  std::string nameWithExtension = name + ".tif";
118 
119  return dataSource->getDataSet(nameWithExtension, propertyName, e, r, travType, accessPolicy);
120 }
121 
122 std::unique_ptr<te::da::DataSet> te::ws::ogc::wcs::da::Transactor::getDataSet(const std::string& name,
123  const std::string& propertyName,
124  const te::gm::Geometry* g,
126  te::common::TraverseType travType,
127  bool connected,
128  const te::common::AccessPolicy accessPolicy)
129 {
130  return getDataSet(name, propertyName, g->getMBR(), r, travType, connected, accessPolicy);
131 }
132 
133 std::unique_ptr<te::da::DataSet> te::ws::ogc::wcs::da::Transactor::getDataSet(
134  const std::string& /*name*/, const te::da::ObjectIdSet* /*oids*/,
135  te::common::TraverseType /*travType*/, bool /*connected*/,
136  const te::common::AccessPolicy /*accessPolicy*/)
137 {
138  throw Exception(TE_TR("The ObjectIdSet concept is not supported by the WCS driver!"));
139 }
140 
141 std::unique_ptr<te::da::DataSet> te::ws::ogc::wcs::da::Transactor::query(
142  const te::da::Select& /*q*/, te::common::TraverseType /*travType*/,
143  bool /*connected*/, const te::common::AccessPolicy /*accessPolicy*/)
144 {
145  throw Exception(TE_TR("Query operations is not supported by the WCS driver!"));
146 }
147 
148 std::unique_ptr<te::da::DataSet> te::ws::ogc::wcs::da::Transactor::query(
149  const std::string& /*query*/, te::common::TraverseType /*travType*/,
150  bool /*connected*/, const te::common::AccessPolicy /*accessPolicy*/)
151 {
152  throw Exception(TE_TR("Query operations is not supported by the WCS driver!"));
153 }
154 
156 {
157  return m_wcs->getCapabilities().coverages;
158 }
159 
161 {
162  return m_wcs->getCapabilities().coverages.size();
163 }
164 
165 std::unique_ptr<te::da::DataSetType> te::ws::ogc::wcs::da::Transactor::getDataSetType(const std::string& name)
166 {
167  if(!dataSetExists(name))
168  throw Exception(TE_TR("The informed data set could not be found in the data source!"));
169 
171 
172  te::da::DataSetType* type = new te::da::DataSetType(description.coverageId, 0);
173  type->setTitle(description.coverageId);
174 
175  te::ws::ogc::wcs::EnvelopeWithTimePeriod boundedBy = description.envelope;
176 
177  double llx = atof(boundedBy.lowerCorner_X.c_str());
178  double lly = atof(boundedBy.lowerCorner_Y.c_str());
179  double urx = atof(boundedBy.upperCorner_X.c_str());
180  double ury = atof(boundedBy.upperCorner_Y.c_str());
181 
182  int srid = TE_UNKNOWN_SRS;
183 
184  if (!boundedBy.srsName.empty())
185  {
186  int pos = static_cast<int>(boundedBy.srsName.find(":"));
187  std::string sridStr = boundedBy.srsName.substr(pos + 1);
188 
189  srid = atoi(sridStr.c_str());
190  }
191 
192  te::gm::Envelope* env = new te::gm::Envelope(llx, lly, urx, ury);
193 
194  unsigned int width = 0;
195  unsigned int height = 0;
196 
197  if (description.domainSet.subSet.size() == 2)
198  {
199  const SubSet& subSetX = description.domainSet.subSet[0];
200  const SubSet& subSetY = description.domainSet.subSet[1];
201 
202  width = atoi(subSetX.max.c_str());
203  height = atoi(subSetY.max.c_str());
204  }
205 
206  te::rst::Grid* grid = new te::rst::Grid(width, height, env, srid);
207 
209  rp->set(grid);
210 
211  for(std::size_t i = 0; i < description.fieldNames.size(); ++i)
212  {
214  rp->add(prop);
215  }
216 
217  type->add(rp);
218 
219  return std::unique_ptr<te::da::DataSetType>(type);
220 }
221 
222 boost::ptr_vector<te::dt::Property> te::ws::ogc::wcs::da::Transactor::getProperties(const std::string& datasetName)
223 {
224  boost::ptr_vector<te::dt::Property> properties;
225 
226  std::unique_ptr<te::da::DataSetType> type = getDataSetType(datasetName);
227 
228  const std::vector<te::dt::Property*>& props = type->getProperties();
229  for(std::size_t i = 0; i < props.size(); ++i)
230  properties.push_back(props[i]->clone());
231 
232  return properties;
233 }
234 
235 std::unique_ptr<te::dt::Property> te::ws::ogc::wcs::da::Transactor::getProperty(const std::string& datasetName, const std::string& name)
236 {
237  std::unique_ptr<te::da::DataSetType> type = getDataSetType(datasetName);
238 
239  const std::vector<te::dt::Property*>& props = type->getProperties();
240  for(std::size_t i = 0; i < props.size(); ++i)
241  {
242  if(props[i]->getName() == name)
243  return std::unique_ptr<te::dt::Property>(props[i]->clone());
244  }
245 
246  throw Exception(TE_TR("The informed property name could not be found in the data set."));
247 }
248 
249 std::unique_ptr<te::dt::Property> te::ws::ogc::wcs::da::Transactor::getProperty(const std::string& datasetName, std::size_t propertyPos)
250 {
251  std::unique_ptr<te::da::DataSetType> type = getDataSetType(datasetName);
252 
253  const std::vector<te::dt::Property*>& props = type->getProperties();
254 
255  if(propertyPos >= props.size())
256  throw Exception(TE_TR("The informed property position could not be found in the data set."));
257 
258  return std::unique_ptr<te::dt::Property>(props[propertyPos]->clone());
259 }
260 
261 std::vector<std::string> te::ws::ogc::wcs::da::Transactor::getPropertyNames(const std::string& datasetName)
262 {
263  std::vector<std::string> propertyNames;
264 
265  std::unique_ptr<te::da::DataSetType> type = getDataSetType(datasetName);
266 
267  const std::vector<te::dt::Property*>& props = type->getProperties();
268  for(std::size_t i = 0; i < props.size(); ++i)
269  propertyNames.push_back(props[i]->getName());
270 
271  return propertyNames;
272 }
273 
274 std::size_t te::ws::ogc::wcs::da::Transactor::getNumberOfProperties(const std::string& datasetName)
275 {
276  return getPropertyNames(datasetName).size();
277 }
278 
279 bool te::ws::ogc::wcs::da::Transactor::propertyExists(const std::string& datasetName, const std::string& name)
280 {
281  std::vector<std::string> propertyNames = getPropertyNames(datasetName);
282 
283  for(std::size_t i = 0; i < propertyNames.size(); ++i)
284  if(propertyNames[i] == name)
285  return true;
286 
287  return false;
288 }
289 
290 std::unique_ptr<te::gm::Envelope> te::ws::ogc::wcs::da::Transactor::getExtent(const std::string& datasetName,
291  const std::string& propertyName)
292 {
293  std::unique_ptr<te::da::DataSetType> type = getDataSetType(datasetName);
294 
295  std::unique_ptr<te::dt::Property> prop = getProperty(datasetName, propertyName);
296 /*
297  te::rst::RasterProperty* rasterProperty = static_cast<te::rst::RasterProperty*>(prop.get());
298  te::gm::Envelope* e = rasterProperty->getGrid()->getExtent();
299 
300  return std::unique_ptr<te::gm::Envelope>(new te::gm::Envelope(e->getLowerLeftX(), e->getLowerLeftY(),
301  e->getUpperRightX(), e->getUpperRightY()));
302  */
303  return std::unique_ptr<te::gm::Envelope>();
304 }
305 
306 std::unique_ptr<te::gm::Envelope> te::ws::ogc::wcs::da::Transactor::getExtent(const std::string& datasetName,
307  std::size_t propertyPos)
308 {
309  std::unique_ptr<te::da::DataSetType> type = getDataSetType(datasetName);
310 
311  std::unique_ptr<te::dt::Property> prop = getProperty(datasetName, propertyPos);
312 /*
313  te::rst::RasterProperty* rasterProperty = static_cast<te::rst::RasterProperty*>(prop.get());
314  te::gm::Envelope* e = rasterProperty->getGrid()->getExtent();
315 
316  return std::unique_ptr<te::gm::Envelope>(new te::gm::Envelope(e->getLowerLeftX(), e->getLowerLeftY(),
317  e->getUpperRightX(), e->getUpperRightY()));
318 */
319  return std::unique_ptr<te::gm::Envelope>();
320 }
321 
323  const std::string& /*datasetName*/)
324 {
325  return 1;
326 }
327 
329 {
330  if(m_wcs->getCapabilities().coverages.size() > 0)
331  return true;
332 
333  return false;
334 }
335 
337 {
338  std::vector< std::string > coverages = m_wcs->getCapabilities().coverages;
339 
340  for(unsigned int i = 0; i < coverages.size(); i ++)
341  {
342  if(coverages.at(i).compare(name) == 0)
343  return true;
344  }
345 
346  return false;
347 }
348 
349 /** NOT SUPPORTED METHODS */
350 //@{
351 
353 {
354  throw Exception(TE_TR("The method begin() is not supported by the WCS driver!"));
355 }
356 
358 {
359  throw Exception(TE_TR("The method commit() is not supported by the WCS driver!"));
360 }
361 
363 {
364  throw Exception(TE_TR("The method rollBack() is not supported by the WCS driver!"));
365 }
366 
368 {
369  throw Exception(TE_TR("The method isInTransaction() is not supported by the WCS driver!"));
370 }
371 
373 {
374  throw Exception(TE_TR("The method execute() is not supported by the WCS driver!"));
375 }
376 
377 void te::ws::ogc::wcs::da::Transactor::execute(const std::string& /*command*/)
378 {
379  throw Exception(TE_TR("The method execute() is not supported by the WCS driver!"));
380 }
381 
382 std::unique_ptr<te::da::PreparedQuery> te::ws::ogc::wcs::da::Transactor::getPrepared(const std::string& /*qName*/)
383 {
384  throw Exception(TE_TR("The method getPrepared() is not supported by the WCS driver!"));
385 }
386 
387 std::unique_ptr<te::da::BatchExecutor> te::ws::ogc::wcs::da::Transactor::getBatchExecutor()
388 {
389  throw Exception(TE_TR("The method getBatchExecutor() is not supported by the WCS driver!"));
390 }
391 
393 {
394  throw Exception(TE_TR("The method cancel() is not supported by the WCS driver!"));
395 }
396 
398 {
399  throw Exception(TE_TR("The method getLastGeneratedId() is not supported by the WCS driver!"));
400 }
401 
402 std::string te::ws::ogc::wcs::da::Transactor::escape(const std::string& /*value*/)
403 {
404  throw Exception(TE_TR("The method escape() is not supported by the WCS driver!"));
405 }
406 
407 bool te::ws::ogc::wcs::da::Transactor::isDataSetNameValid(const std::string& /*datasetName*/)
408 {
409  throw Exception(TE_TR("The method isDataSetNameValid() is not supported by the WCS driver!"));
410 }
411 
412 bool te::ws::ogc::wcs::da::Transactor::isPropertyNameValid(const std::string& /*propertyName*/)
413 {
414  throw Exception(TE_TR("The method isPropertyNameValid() is not supported by the WCS driver!"));
415 }
416 
417 void te::ws::ogc::wcs::da::Transactor::addProperty(const std::string& /*datasetName*/, te::dt::Property* /*p*/)
418 {
419  throw Exception(TE_TR("The method addProperty() is not supported by the WCS driver!"));
420 }
421 
422 void te::ws::ogc::wcs::da::Transactor::dropProperty(const std::string& /*datasetName*/, const std::string& /*name*/)
423 {
424  throw Exception(TE_TR("The method dropProperty() is not supported by the WCS driver!"));
425 }
426 
427 void te::ws::ogc::wcs::da::Transactor::renameProperty(const std::string& /*datasetName*/, const std::string& /*propertyName*/, const std::string& /*newPropertyName*/)
428 {
429  throw Exception(TE_TR("The method renameProperty() is not supported by the WCS driver!"));
430 }
431 
432 std::unique_ptr<te::da::PrimaryKey> te::ws::ogc::wcs::da::Transactor::getPrimaryKey(const std::string& /*datasetName*/)
433 {
434  throw Exception(TE_TR("The method getPrimaryKey() is not supported by the WCS driver!"));
435 }
436 
437 bool te::ws::ogc::wcs::da::Transactor::primaryKeyExists(const std::string& /*datasetName*/, const std::string& /*name*/)
438 {
439  throw Exception(TE_TR("The method primaryKeyExists() is not supported by the WCS driver!"));
440 }
441 
442 void te::ws::ogc::wcs::da::Transactor::addPrimaryKey(const std::string& /*datasetName*/, te::da::PrimaryKey* /*pk*/)
443 {
444  throw Exception(TE_TR("The method addPrimaryKey() is not supported by the WCS driver!"));
445 }
446 
447 void te::ws::ogc::wcs::da::Transactor::dropPrimaryKey(const std::string& /*datasetName*/)
448 {
449  throw Exception(TE_TR("The method dropPrimaryKey() is not supported by the WCS driver!"));
450 }
451 
452 std::unique_ptr<te::da::ForeignKey> te::ws::ogc::wcs::da::Transactor::getForeignKey(const std::string& /*datasetName*/, const std::string& /*name*/)
453 {
454  throw Exception(TE_TR("The method getForeignKey() is not supported by the WCS driver!"));
455 }
456 
457 std::vector<std::string> te::ws::ogc::wcs::da::Transactor::getForeignKeyNames(const std::string& /*datasetName*/)
458 {
459  throw Exception(TE_TR("The method getForeignKeyNames() is not supported by the WCS driver!"));
460 }
461 
462 bool te::ws::ogc::wcs::da::Transactor::foreignKeyExists(const std::string& /*datasetName*/, const std::string& /*name*/)
463 {
464  throw Exception(TE_TR("The method foreignKeyExists() is not supported by the WCS driver!"));
465 }
466 
467 void te::ws::ogc::wcs::da::Transactor::addForeignKey(const std::string& /*datasetName*/, te::da::ForeignKey* /*fk*/)
468 {
469  throw Exception(TE_TR("The method addForeignKey() is not supported by the WCS driver!"));
470 }
471 
472 void te::ws::ogc::wcs::da::Transactor::dropForeignKey(const std::string& /*datasetName*/, const std::string& /*fkName*/)
473 {
474  throw Exception(TE_TR("The method dropForeignKey() is not supported by the WCS driver!"));
475 }
476 
477 std::unique_ptr<te::da::UniqueKey> te::ws::ogc::wcs::da::Transactor::getUniqueKey(const std::string& /*datasetName*/, const std::string& /*name*/)
478 {
479  throw Exception(TE_TR("The method getUniqueKey() is not supported by the WCS driver!"));
480 }
481 
482 std::vector<std::string> te::ws::ogc::wcs::da::Transactor::getUniqueKeyNames(const std::string& /*datasetName*/)
483 {
484  throw Exception(TE_TR("The method getUniqueKeyNames() is not supported by the WCS driver!"));
485 }
486 
487 bool te::ws::ogc::wcs::da::Transactor::uniqueKeyExists(const std::string& /*datasetName*/, const std::string& /*name*/)
488 {
489  throw Exception(TE_TR("The method uniqueKeyExists() is not supported by the WCS driver!"));
490 }
491 
492 void te::ws::ogc::wcs::da::Transactor::addUniqueKey(const std::string& /*datasetName*/, te::da::UniqueKey* /*uk*/)
493 {
494  throw Exception(TE_TR("The method addUniqueKey() is not supported by the WCS driver!"));
495 }
496 
497 void te::ws::ogc::wcs::da::Transactor::dropUniqueKey(const std::string& /*datasetName*/, const std::string& /*name*/)
498 {
499  throw Exception(TE_TR("The method dropUniqueKey() is not supported by the WCS driver!"));
500 }
501 
502 std::unique_ptr<te::da::CheckConstraint> te::ws::ogc::wcs::da::Transactor::getCheckConstraint(const std::string& /*datasetName*/, const std::string& /*name*/)
503 {
504  throw Exception(TE_TR("The method getCheckConstraint() is not supported by the WCS driver!"));
505 }
506 
507 std::vector<std::string> te::ws::ogc::wcs::da::Transactor::getCheckConstraintNames(const std::string& /*datasetName*/)
508 {
509  throw Exception(TE_TR("The method getCheckConstraintNames() is not supported by the WCS driver!"));
510 }
511 
512 bool te::ws::ogc::wcs::da::Transactor::checkConstraintExists(const std::string& /*datasetName*/, const std::string& /*name*/)
513 {
514  throw Exception(TE_TR("The method checkConstraintExists() is not supported by the WCS driver!"));
515 }
516 
517 void te::ws::ogc::wcs::da::Transactor::addCheckConstraint(const std::string& /*datasetName*/, te::da::CheckConstraint* /*cc*/)
518 {
519  throw Exception(TE_TR("The method addCheckConstraint() is not supported by the WCS driver!"));
520 }
521 
522 void te::ws::ogc::wcs::da::Transactor::dropCheckConstraint(const std::string& /*datasetName*/, const std::string& /*name*/)
523 {
524  throw Exception(TE_TR("The method dropCheckConstraint() is not supported by the WCS driver!"));
525 }
526 
527 std::unique_ptr<te::da::Index> te::ws::ogc::wcs::da::Transactor::getIndex(const std::string& /*datasetName*/, const std::string& /*name*/)
528 {
529  throw Exception(TE_TR("The method getIndex() is not supported by the WCS driver!"));
530 }
531 
532 std::vector<std::string> te::ws::ogc::wcs::da::Transactor::getIndexNames(const std::string& /*datasetName*/)
533 {
534  throw Exception(TE_TR("The method getIndexNames() is not supported by the WCS driver!"));
535 }
536 
537 bool te::ws::ogc::wcs::da::Transactor::indexExists(const std::string& /*datasetName*/, const std::string& /*name*/)
538 {
539  throw Exception(TE_TR("The method indexExists() is not supported by the WCS driver!"));
540 }
541 
542 void te::ws::ogc::wcs::da::Transactor::addIndex(const std::string& /*datasetName*/, te::da::Index* /*idx*/, const std::map<std::string, std::string>& /*options*/)
543 {
544  throw Exception(TE_TR("The method addIndex() is not supported by the WCS driver!"));
545 }
546 
547 void te::ws::ogc::wcs::da::Transactor::dropIndex(const std::string& /*datasetName*/, const std::string& /*idxName*/)
548 {
549  throw Exception(TE_TR("The method dropIndex() is not supported by the WCS driver!"));
550 }
551 
552 std::unique_ptr<te::da::Sequence> te::ws::ogc::wcs::da::Transactor::getSequence(const std::string& /*name*/)
553 {
554  throw Exception(TE_TR("The method getSequence() is not supported by the WCS driver!"));
555 }
556 
558 {
559  throw Exception(TE_TR("The method getSequenceNames() is not supported by the WCS driver!"));
560 }
561 
562 bool te::ws::ogc::wcs::da::Transactor::sequenceExists(const std::string& /*name*/)
563 {
564  throw Exception(TE_TR("The method sequenceExists() is not supported by the WCS driver!"));
565 }
566 
568 {
569  throw Exception(TE_TR("The method addSequence() is not supported by the WCS driver!"));
570 }
571 
572 void te::ws::ogc::wcs::da::Transactor::dropSequence(const std::string& /*name*/)
573 {
574  throw Exception(TE_TR("The method dropSequence() is not supported by the WCS driver!"));
575 }
576 
578  const std::map<std::string, std::string>& /*options*/)
579 {
580  throw Exception(TE_TR("The method createDataSet() is not supported by the WCS driver!"));
581 }
582 
583 void te::ws::ogc::wcs::da::Transactor::cloneDataSet(const std::string& /*name*/,
584  const std::string& /*cloneName*/,
585  const std::map<std::string, std::string>& /*options*/)
586 {
587  throw Exception(TE_TR("The method cloneDataSet() is not supported by the WCS driver!"));
588 }
589 
590 void te::ws::ogc::wcs::da::Transactor::dropDataSet(const std::string& /*name*/)
591 {
592  throw Exception(TE_TR("The method dropDataSet() is not supported by the WCS driver!"));
593 }
594 
595 void te::ws::ogc::wcs::da::Transactor::renameDataSet(const std::string& /*name*/,
596  const std::string& /*newName*/)
597 {
598  throw Exception(TE_TR("The method renameDataSet() is not supported by the WCS driver!"));
599 }
600 
601 void te::ws::ogc::wcs::da::Transactor::add(const std::string& /*datasetName*/,
602  te::da::DataSet* /*d*/,
603  const std::map<std::string, std::string>& /*options*/,
604  std::size_t /*limit*/,
605  bool /*enableProgress*/)
606 {
607  throw Exception(TE_TR("The method add() is not supported by the WCS driver!"));
608 }
609 
610 void te::ws::ogc::wcs::da::Transactor::remove(const std::string& /*datasetName*/, const te::da::ObjectIdSet* /*oids*/)
611 {
612  throw Exception(TE_TR("The method remove() is not supported by the WCS driver!"));
613 }
614 
615 void te::ws::ogc::wcs::da::Transactor::update(const std::string& /*datasetName*/,
616  te::da::DataSet* /*dataset*/,
617  const std::vector<std::size_t>& /*properties*/,
618  const te::da::ObjectIdSet* /*oids*/,
619  const std::map<std::string, std::string>& /*options*/,
620  std::size_t /*limit*/)
621 {
622  throw Exception(TE_TR("The method update() is not supported by the WCS driver!"));
623 }
624 
625 void te::ws::ogc::wcs::da::Transactor::optimize(const std::map<std::string, std::string>& /*opInfo*/)
626 {
627  throw Exception(TE_TR("The method optimize() is not supported by the WCS driver!"));
628 }
629 
630 //@}
631 
void setTitle(const std::string &title)
It sets a human descriptive title for the DataSetType.
Definition: DataSetType.h:137
std::unique_ptr< te::dt::Property > getProperty(const std::string &datasetName, const std::string &name)
It retrieves the property with the given name from the dataset.
void dropIndex(const std::string &datasetName, const std::string &idxName)
It removes the index from the dataset schema.
std::size_t getNumberOfItems(const std::string &datasetName)
It retrieves the number of items of the given dataset.
static std::unique_ptr< DataSource > make(const std::string &driver, const te::core::URI &connInfo)
void set(te::rst::Grid *grid)
Sets the definition of the raster grid support.
std::unique_ptr< te::da::PrimaryKey > getPrimaryKey(const std::string &datasetName)
It retrieves the primary key of the dataset.
boost::int64_t getLastGeneratedId()
It returns the last id generated by an insertion command.
std::vector< std::string > getForeignKeyNames(const std::string &datasetName)
It gets the foreign key names of the given dataset.
std::vector< std::string > getCheckConstraintNames(const std::string &datasetName)
It gets the check constraint names of the given dataset.
std::unique_ptr< te::da::DataSetType > getDataSetType(const std::string &name)
It gets information about the given dataset.
te::da::DataSource * getDataSource() const
It returns the parent data source of the transactor.
std::unique_ptr< te::da::Sequence > getSequence(const std::string &name)
It gets the sequence with the given name in the data source.
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.
std::size_t getNumberOfDataSets()
It retrieves the number of data sets available in the data source.
#define TE_UNKNOWN_SRS
A numeric value to represent a unknown SRS identification in TerraLib.
void dropUniqueKey(const std::string &datasetName, const std::string &name)
It removes the unique key constraint from the dataset.
A raster band description.
Definition: BandProperty.h:61
Base exception class for plugin module.
A class that models the description of a dataset.
Definition: DataSetType.h:72
void dropForeignKey(const std::string &datasetName, const std::string &fkName)
It removes the foreign key constraint from the dataset schema.
void add(const std::string &datasetName, te::da::DataSet *d, const std::map< std::string, std::string > &options, std::size_t limit=0, bool enableProgress=true)
It adds data items to the dataset in the data source.
CoverageDescription coverageDescription(const std::string coverageName)
void execute(const te::da::Query &command)
It executes the specified command using a generic query representation.
SpatialRelation
Spatial relations between geometric objects.
void addUniqueKey(const std::string &datasetName, te::da::UniqueKey *uk)
It adds a unique key constraint to the dataset.
It describes a sequence (a number generator).
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.
A class that describes a check constraint.
bool primaryKeyExists(const std::string &datasetName, const std::string &name)
It checks if a primary key exists in the dataset.
An abstract class for data providers like a DBMS, Web Services or a regular file. ...
#define TE_TR(message)
It marks a string in order to get translated.
Definition: Translator.h:242
void dropDataSet(const std::string &name)
It removes the dataset schema from the data source.
bool hasDataSets()
It checks if the data source has any dataset.
It models a property definition.
Definition: Property.h:59
std::vector< std::string > getIndexNames(const std::string &datasetName)
It gets the index names of the given dataset.
Raster property.
void remove(const std::string &datasetName, const te::da::ObjectIdSet *oids=0)
It removes all the informed items from the dataset.
std::vector< std::string > getUniqueKeyNames(const std::string &datasetName)
It gets the unique key names of the given dataset.
boost::ptr_vector< te::dt::Property > getProperties(const std::string &datasetName)
It retrieves the properties of the dataset.
Transactor(const std::shared_ptr< te::ws::ogc::WCSClient > wcs)
std::unique_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.
std::vector< std::string > getDataSetNames()
It It gets the dataset names available in the data source.
void cancel()
It requests that the data source stop the processing of the current command.
AccessPolicy
Supported data access policies (can be used as bitfield).
TraverseType
A dataset can be traversed in two ways:
std::vector< std::string > getSequenceNames()
It gets the sequence names available in the data source.
std::size_t getNumberOfProperties(const std::string &datasetName)
It gets the number of properties of the given dataset.
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...
bool isPropertyNameValid(const std::string &propertyName)
It checks if the given property name is valid.
void add(te::rst::BandProperty *b)
It adds a new band information to the property.
bool sequenceExists(const std::string &name)
It checks if a sequence with the given name exists in the data source.
std::unique_ptr< te::da::BatchExecutor > getBatchExecutor()
It creates a batch command executor.
std::vector< std::string > getPropertyNames(const std::string &datasetName)
It gets the property names of the given dataset.
const Envelope * getMBR() const _NOEXCEPT_OP(true)
It returns the minimum bounding rectangle for the geometry in an internal representation.
void renameDataSet(const std::string &name, const std::string &newName)
It renames a dataset.
An Envelope defines a 2D rectangular region.
This class represents a set of unique ids created in the same context. i.e. from the same data set...
Definition: ObjectIdSet.h:55
void dropProperty(const std::string &datasetName, const std::string &name)
It removes a property from the given dataset.
void renameProperty(const std::string &datasetName, const std::string &propertyName, const std::string &newPropertyName)
It renames a property of the given dataset.
void dropSequence(const std::string &name)
It removes the sequence from the data source.
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.
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.
It models a foreign key constraint for a DataSetType.
Definition: ForeignKey.h:50
void addProperty(const std::string &datasetName, te::dt::Property *p)
It adds a new property to the dataset schema.
std::unique_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.
bool indexExists(const std::string &datasetName, const std::string &name)
It checks if an index with the given name exists in the dataset.
It describes a unique key (uk) constraint.
Definition: UniqueKey.h:53
std::unique_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.
std::unique_ptr< te::da::ForeignKey > getForeignKey(const std::string &datasetName, const std::string &name)
It retrieves the foreign key from the given dataset.
std::unique_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.
A struct to set the parameters of requested coverage.
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
A Select models a query to be used when retrieving data from a DataSource.
Definition: Select.h:65
void add(Constraint *c)
It adds a new constraint.
std::unique_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...
A dataset is the unit of information manipulated by the data access module of TerraLib.
bool isDataSetNameValid(const std::string &datasetName)
It returns true if the given string is a valid dataset name.
void dropPrimaryKey(const std::string &datasetName)
It removes the primary key constraint from the dataset schema.
void setCoverageRequest(const te::ws::ogc::wcs::CoverageRequest coverageRequest)
It describes a primary key (pk) constraint.
Definition: PrimaryKey.h:52
void addForeignKey(const std::string &datasetName, te::da::ForeignKey *fk)
It adds a foreign key constraint to a dataset.
bool uniqueKeyExists(const std::string &datasetName, const std::string &name)
It checks if a unique key with the given name exists in the dataset.
void dropCheckConstraint(const std::string &datasetName, const std::string &name)
It removes the check constraint from the dataset.
void rollBack()
It aborts the transaction. Any changes will be rolled-back.
std::unique_ptr< te::da::Index > getIndex(const std::string &datasetName, const std::string &name)
It gets the index with the given name from the dataset.
void addPrimaryKey(const std::string &datasetName, te::da::PrimaryKey *pk)
It adds a primary key constraint to the dataset schema.
bool dataSetExists(const std::string &name)
It checks if a dataset with the given name exists in the data source.
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.
std::string escape(const std::string &value)
It escapes a string for using in commands and queries.
void addCheckConstraint(const std::string &datasetName, te::da::CheckConstraint *cc)
It adds a check constraint to the dataset.
void addSequence(te::da::Sequence *sequence)
It creates a new sequence in the data source.
A rectified grid is the spatial support for raster data.
Definition: raster/Grid.h:68
bool propertyExists(const std::string &datasetName, const std::string &name)
It checks if a property with the given name exists in the dataset.
bool isInTransaction() const
It returns true if a transaction is in progress, otherwise, it returns false.
A Query is independent from the data source language/dialect.
Definition: Query.h:46
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.
It describes an index associated to a DataSetType.
std::unique_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.
Implementation of the transactor for the WS OGC WCS.