It represents the system catalog of a DataSource. More...
#include <DataSourceCatalog.h>
  
 Classes | |
| struct | dataset_name_cmp | 
| struct | sequence_name_cmp | 
Public Member Functions | |
Basic Methods  | |
Basic methods for a DataSourceCatalog.  | |
| DataSourceCatalog () | |
| It creates a new DataSourceCatalog.  More... | |
| ~DataSourceCatalog () | |
| Destructor.  More... | |
| unsigned int | getId () const | 
| It returns the catalog identifier.  More... | |
| void | setId (unsigned int id) | 
| It sets the catalog identifier.  More... | |
| DataSource * | getDataSource () const | 
| It returns the DataSource associated to the catalog.  More... | |
| void | setDataSource (DataSource *ds) | 
| It sets the DataSource associated to the catalog.  More... | |
| void | clear () | 
| It clears the catalog, releasing all the resources used by it.  More... | |
DataSetType Management Methods  | |
Methods for managing DataSetTypes.  | |
| std::size_t | getNumberOfDataSets () const | 
| It returns the number of datasets in the catalog.  More... | |
| bool | datasetExists (const std::string &name) const | 
| It checks if a dataset schema with the given name is in the catalog.  More... | |
| void | add (const DataSetTypePtr &dt) | 
| It adds a new dataset schema to the catalog.  More... | |
| void | remove (DataSetType *dt, const bool cascade=false) | 
| It removes the dataset schema from the catalog.  More... | |
| void | rename (DataSetType *dt, const std::string &newName) | 
| It renames the dataset schema in the catalog.  More... | |
| const DataSetTypePtr & | getDataSetType (std::size_t i) const | 
| It returns the i-th dataset schema.  More... | |
| const DataSetTypePtr & | getDataSetType (const std::string &name) const | 
| It searches for a dataset schema with the given name in the catalog.  More... | |
Sequence Management Methods  | |
Methods for managing Sequences.  | |
| std::size_t | getNumberOfSequences () const | 
| It returns the number of sequences in the catalog.  More... | |
| void | add (Sequence *s) | 
| It adds a new sequence to the catalog.  More... | |
| void | remove (Sequence *s) | 
| It removes the sequence from the catalog.  More... | |
| void | detach (Sequence *s) | 
| It will detaches the Sequence from the catalog.  More... | |
| Sequence * | getSequence (std::size_t i) const | 
| It returns the i-th Sequence.  More... | |
| Sequence * | getSequence (const std::string &name) const | 
| It searches for a Sequence with the given name in the catalog.  More... | |
Helper Methods  | |
Methods used to keep the associations among catalog's objects.  | |
| void | addRef (ForeignKey *fk) | 
| It checks if the referenced DataSetType is in the catalog and associate the fk to it.  More... | |
| void | removeRef (ForeignKey *fk) | 
| It drops the reference between the foreign key and its referenced DataSetType.  More... | |
| std::pair< std::multimap< DataSetType *, ForeignKey * >::const_iterator, std::multimap< DataSetType *, ForeignKey * >::const_iterator > | getRefFK (DataSetType *dt) const | 
| It returns the list of fk referencing the given DataSetType in the catalog.  More... | |
| void | dropDependentSequences (te::dt::Property *p) | 
| It drops Sequences that depends on the property.  More... | |
Protected Member Functions | |
Helper Methods for Sequences  | |
Methods used in the internals of DataSourceCatalog to manage Sequences.  | |
| void | checkSequenceDependency (Sequence *s) const | 
| It checks if the Sequence is owned by a DataSetType property and if that DataSetType is in the catalog.  More... | |
| void | indexSequenceDependency (Sequence *s) | 
| It looks if the sequence is owned by a given DataSetType property and insert this information into the sequence depency index.  More... | |
| void | dropDependentSequences (DataSetType *dt) | 
| It drops Sequences that depends on the DataSetType dt.  More... | |
| void | dropDependentSequenceEntry (Sequence *s) | 
| It drops the Sequence entry in the DataSetType sequence dependency list.  More... | |
Helper Methods for Foreign Keys  | |
Methods used in the internals of DataSourceCatalog to manage Foreign Keys.  | |
| void | checkFKsDependency (DataSetType *dt) const | 
| It checks if the DataSetTypes referenced by dt's foreign keys are in the catalog.  More... | |
| void | indexFKs (DataSetType *dt) | 
| It looks for foreign keys in the DataSetType dt and try to index then with respect to referenced DataSetTypes.  More... | |
| void | dropDependentFKs (DataSetType *dt) | 
| It drops foreign keys from other DataSetTypes that depends on the attributes in the given DataSetType dt.  More... | |
Private Types | |
| typedef boost::multi_index::multi_index_container< DataSetTypePtr, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< dataset_name_cmp >, boost::multi_index::random_access<> > > | dataset_idx_type | 
| typedef boost::multi_index::multi_index_container< Sequence *, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< sequence_name_cmp >, boost::multi_index::random_access<> > > | sequence_idx_type | 
Private Attributes | |
| dataset_idx_type | m_datasets | 
| std::multimap< DataSetType *, ForeignKey * > | m_dependentFkIdx | 
| A multimap : datasettype -> fk. It tells for a DataSetType the list of fk referencing it.  More... | |
| DataSource * | m_ds | 
| The DataSource associated to the Catalog.  More... | |
| unsigned int | m_id | 
| An identification number inside the DataSource.  More... | |
| std::multimap< DataSetType *, sequence_idx_type::iterator > | m_seqFTIdx | 
| A multimap : owner-dt -> sequence-it.  More... | |
| sequence_idx_type | m_sequences | 
Static Private Attributes | |
| static DataSetTypePtr | sm_nullds | 
It represents the system catalog of a DataSource.
Definition at line 68 of file DataSourceCatalog.h.
      
  | 
  private | 
Definition at line 459 of file DataSourceCatalog.h.
      
  | 
  private | 
Definition at line 474 of file DataSourceCatalog.h.
| te::da::DataSourceCatalog::DataSourceCatalog | ( | ) | 
It creates a new DataSourceCatalog.
| te::da::DataSourceCatalog::~DataSourceCatalog | ( | ) | 
Destructor.
| void te::da::DataSourceCatalog::add | ( | const DataSetTypePtr & | dt | ) | 
It adds a new dataset schema to the catalog.
| dt | The dataset schema to be added to the catalog. | 
| Exception | It throws an exception if the dataset schema can not be added. | 
| void te::da::DataSourceCatalog::add | ( | Sequence * | s | ) | 
It adds a new sequence to the catalog.
| s | The sequence to be added to the catalog. | 
| Exception | It throws an exception if the sequence can not be added. | 
| Exception | It throws an exception if the sequence is owned by a given DataSetType property and this DataSetType is not in the catalog. | 
| void te::da::DataSourceCatalog::addRef | ( | ForeignKey * | fk | ) | 
It checks if the referenced DataSetType is in the catalog and associate the fk to it.
| fk | The foreign key to keep the association. | 
| It | throws an exception if the referenced DataSetType is not in the DataSourceCatalog. | 
      
  | 
  protected | 
It checks if the DataSetTypes referenced by dt's foreign keys are in the catalog.
| dt | The DataSetType we are checking the foreign key dependency is ok. | 
| Exception | It throws an exception if one of the foreign key has a referenced FetaureType that is not in the catalog. | 
      
  | 
  protected | 
It checks if the Sequence is owned by a DataSetType property and if that DataSetType is in the catalog.
| s | The Sequence we are checking the dependency of a FetaureType. | 
| Exception | It throws an exception if the sequence is owned by a FetaureType that is not in the catalog nor could be determined. | 
| void te::da::DataSourceCatalog::clear | ( | ) | 
It clears the catalog, releasing all the resources used by it.
| bool te::da::DataSourceCatalog::datasetExists | ( | const std::string & | name | ) | const | 
It checks if a dataset schema with the given name is in the catalog.
| name | The dataset schema name to be cheked in the catalog. | 
| void te::da::DataSourceCatalog::detach | ( | Sequence * | s | ) | 
      
  | 
  protected | 
It drops foreign keys from other DataSetTypes that depends on the attributes in the given DataSetType dt.
| dt | A DataSetType that belongs to the catalog. | 
      
  | 
  protected | 
It drops the Sequence entry in the DataSetType sequence dependency list.
| s | A Sequence to be removed from the list of dependency. | 
| Exception | It throws an exception if the sequence is owned by a dt and it is not in the catalog. | 
| void te::da::DataSourceCatalog::dropDependentSequences | ( | te::dt::Property * | p | ) | 
It drops Sequences that depends on the property.
| p | A Property that may owns a sequence in the catalog. | 
      
  | 
  protected | 
It drops Sequences that depends on the DataSetType dt.
| dt | A DataSetType that belongs to the catalog. | 
| const DataSetTypePtr& te::da::DataSourceCatalog::getDataSetType | ( | std::size_t | i | ) | const | 
It returns the i-th dataset schema.
| i | The dataset schema index. | 
| const DataSetTypePtr& te::da::DataSourceCatalog::getDataSetType | ( | const std::string & | name | ) | const | 
It searches for a dataset schema with the given name in the catalog.
| name | The name of the searched dataset schema. | 
      
  | 
  inline | 
It returns the DataSource associated to the catalog.
Definition at line 505 of file DataSourceCatalog.h.
      
  | 
  inline | 
It returns the catalog identifier.
Definition at line 495 of file DataSourceCatalog.h.
      
  | 
  inline | 
It returns the number of datasets in the catalog.
Definition at line 515 of file DataSourceCatalog.h.
      
  | 
  inline | 
It returns the number of sequences in the catalog.
Definition at line 520 of file DataSourceCatalog.h.
      
  | 
  inline | 
It returns the list of fk referencing the given DataSetType in the catalog.
| dt | The DataSetType we are searching for foreign keys referencing it. | 
Definition at line 340 of file DataSourceCatalog.h.
| Sequence* te::da::DataSourceCatalog::getSequence | ( | std::size_t | i | ) | const | 
It returns the i-th Sequence.
| i | The Sequence index. | 
| Sequence* te::da::DataSourceCatalog::getSequence | ( | const std::string & | name | ) | const | 
      
  | 
  protected | 
It looks for foreign keys in the DataSetType dt and try to index then with respect to referenced DataSetTypes.
| dt | The DataSetType whose foreign keys will be indexed. | 
      
  | 
  protected | 
It looks if the sequence is owned by a given DataSetType property and insert this information into the sequence depency index.
| s | The sequence we want to index owner information. | 
| Exception | It throws an exception if the sequence is owned by a FetaureType that is not in the catalog nor could be determined. | 
| void te::da::DataSourceCatalog::remove | ( | DataSetType * | dt, | 
| const bool | cascade = false  | 
        ||
| ) | 
It removes the dataset schema from the catalog.
| dt | The dataset schema to be removed from the catalog. | 
| cascade | If true the method will remove also all objects that depends on the dataset schema (like sequences and foreign keys). | 
| void te::da::DataSourceCatalog::remove | ( | Sequence * | s | ) | 
It removes the sequence from the catalog.
| s | The sequence to be removed from the catalog. | 
| void te::da::DataSourceCatalog::removeRef | ( | ForeignKey * | fk | ) | 
It drops the reference between the foreign key and its referenced DataSetType.
| fk | The foreign key to remove the association from the catalog. | 
| It | throws an exception if the referenced DataSetType is not in the DataSourceCatalog. | 
| void te::da::DataSourceCatalog::rename | ( | DataSetType * | dt, | 
| const std::string & | newName | ||
| ) | 
It renames the dataset schema in the catalog.
| dt | The dataset schema to be renamed. | 
| newName | The new name to be assigned to dt. | 
| Exception | It throws an exception if there is already a dataset schema with the new name in the catalog, or if it doesn't belong to the catalog. | 
      
  | 
  inline | 
It sets the DataSource associated to the catalog.
| ds | The DataSource to be associated to the catalog. | 
Definition at line 510 of file DataSourceCatalog.h.
      
  | 
  inline | 
It sets the catalog identifier.
| id | A number that can be used to identify the catalog in its DataSource. | 
Definition at line 500 of file DataSourceCatalog.h.
      
  | 
  private | 
Definition at line 477 of file DataSourceCatalog.h.
      
  | 
  private | 
A multimap : datasettype -> fk. It tells for a DataSetType the list of fk referencing it.
Definition at line 485 of file DataSourceCatalog.h.
      
  | 
  private | 
The DataSource associated to the Catalog.
Definition at line 488 of file DataSourceCatalog.h.
      
  | 
  private | 
An identification number inside the DataSource.
Definition at line 487 of file DataSourceCatalog.h.
      
  | 
  private | 
A multimap : owner-dt -> sequence-it.
Definition at line 482 of file DataSourceCatalog.h.
      
  | 
  private | 
Definition at line 480 of file DataSourceCatalog.h.
      
  | 
  staticprivate | 
Definition at line 490 of file DataSourceCatalog.h.