CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
OraDatabaseSchema.h
Go to the documentation of this file.
1 #ifndef INCLUDE_ORA_ORADATABASESCHEMA_H
2 #define INCLUDE_ORA_ORADATABASESCHEMA_H
3 
4 #include "IDatabaseSchema.h"
5 // externals
6 #include "CoralBase/AttributeList.h"
7 
8 namespace ora {
9 
10  class OraMainTable: public IMainTable {
11  public:
12  static std::string version();
13  static std::string tableName();
16  public:
17  explicit OraMainTable( coral::ISchema& dbSchema );
18  virtual ~OraMainTable();
19  void setParameter( const std::string& paramName, const std::string& paramValue );
20  bool getParameters( std::map<std::string,std::string>& destination );
22  public:
23  std::string name();
24  bool exists();
25  void create();
26  void drop();
27  };
28 
29 
31  public:
32  static std::string tableName();
35  public:
36  explicit OraSequenceTable( coral::ISchema& dbSchema );
37  OraSequenceTable( const std::string& tableName, coral::ISchema& dbSchema );
38  virtual ~OraSequenceTable();
39  bool add( const std::string& sequenceName );
40  bool getLastId( const std::string& sequenceName, int& lastId );
41  void sinchronize( const std::string& sequenceName, int lastValue );
42  void erase( const std::string& sequenceName );
43  public:
44  std::string name();
45  bool exists();
46  void create();
47  void drop();
48  private:
50  };
51 
53  public:
54  static std::string tableName();
56  public:
57  explicit OraMappingVersionTable( coral::ISchema& dbSchema );
58  virtual ~OraMappingVersionTable();
59  public:
60  std::string name();
61  bool exists();
62  void create();
63  void drop();
64  };
65 
67  public:
68  static std::string tableName();
78  public:
79  explicit OraMappingElementTable( coral::ISchema& dbSchema );
80  virtual ~OraMappingElementTable();
81  public:
82  std::string name();
83  bool exists();
84  void create();
85  void drop();
86  };
87 
89  public:
90  static std::string tableName();
95  public:
96  explicit OraContainerHeaderTable( coral::ISchema& dbSchema );
97  virtual ~OraContainerHeaderTable();
98  bool getContainerData( std::map<std::string, ContainerHeaderData>& destination );
99  void addContainer( int id, const std::string& containerName, const std::string& className );
100  void removeContainer( int id );
101  bool lockContainer( int id, ContainerHeaderData& destination );
102  void incrementNumberOfObjects( int id );
103  void decrementNumberOfObjects( int id );
104  void updateNumberOfObjects( const std::map<int,unsigned int>& numberOfObjectsForContainerIds );
105  public:
106  std::string name();
107  bool exists();
108  void create();
109  void drop();
110  private:
111  void updateContainer( int id, const std::string& setClause );
112  };
113 
115  public:
116  static std::string tableName();
117  static std::string classNameColumn();
119  static std::string classIdColumn();
123  public:
124  explicit OraClassVersionTable( coral::ISchema& dbSchema );
125  virtual ~OraClassVersionTable();
126  public:
127  std::string name();
128  bool exists();
129  void create();
130  void drop();
131  };
132 
134  public:
135  explicit OraMappingSchema( coral::ISchema& dbSchema );
136  virtual ~OraMappingSchema();
137  public:
138  bool getVersionList( std::set<std::string>& destination );
139  bool getMapping( const std::string& version, MappingRawData& destination );
140  void storeMapping( const MappingRawData& mapping );
141  void removeMapping( const std::string& version );
142  bool getContainerTableMap( std::map<std::string, int>& destination );
143  bool getMappingVersionListForContainer( int containerId, std::set<std::string>& destination, bool onlyDependency=false );
144  bool getDependentClassesInContainerMapping( int containerId, std::set<std::string>& destination );
145  bool getClassVersionListForMappingVersion( const std::string& mappingVersion, std::set<std::string>& destination );
146  bool getClassVersionListForContainer( int containerId, std::map<std::string,std::string>& versionMap );
147  bool getMappingVersionListForTable( const std::string& tableName, std::set<std::string>& destination );
148  bool selectMappingVersion( const std::string& classId, int containerId, std::string& destination );
149  bool containerForMappingVersion( const std::string& mappingVersion, int& destination );
150  void insertClassVersion( const std::string& className, const std::string& classVersion, const std::string& classId,
151  int dependencyIndex, int containerId, const std::string& mappingVersion );
152  void setMappingVersion( const std::string& classId, int containerId, const std::string& mappingVersion );
153  private:
154  coral::ISchema& m_schema;
155  };
156 
158  public:
159  static std::string tableName();
160  static std::string objectNameColumn();
162  static std::string itemIdColumn();
163  public:
164  explicit OraNamingServiceTable( coral::ISchema& dbSchema );
165  virtual ~OraNamingServiceTable();
166  void setObjectName( const std::string& name, int contId, int itemId );
167  bool eraseObjectName( const std::string& name );
168  bool eraseAllNames();
169  bool getObjectByName( const std::string& name, std::pair<int,int>& destination );
170  bool getNamesForObject( int contId, int itemId, std::vector<std::string>& destination );
171  bool getNamesForContainer( int contId, std::vector<std::string>& destination );
172  bool getAllNames( std::vector<std::string>& destination );
173 
174  public:
175  std::string name();
176  bool exists();
177  void create();
178  void drop();
179  };
180 
182  public:
183  static bool existsMainTable( coral::ISchema& dbSchema );
184 
185  public:
186  explicit OraDatabaseSchema( coral::ISchema& dbSchema );
187  virtual ~OraDatabaseSchema();
188 
189  bool exists();
190  void create( const std::string& userSchemaVersion );
191  void drop();
192  void setAccessPermission( const std::string& principal, bool forWrite );
193 
202  bool testDropPermission();
203 
204  private:
205  coral::ISchema& m_schema;
214  };
215 
216 }
217 
218 #endif
219 
220 
void updateContainer(int id, const std::string &setClause)
static std::string classIdColumn()
void sinchronize(const std::string &sequenceName, int lastValue)
OraMappingElementTable m_mappingElementTable
OraContainerHeaderTable m_containerHeaderTable
void setMappingVersion(const std::string &classId, int containerId, const std::string &mappingVersion)
OraDatabaseSchema(coral::ISchema &dbSchema)
void setParameter(const std::string &paramName, const std::string &paramValue)
static std::string objectNameColumn()
bool getMapping(const std::string &version, MappingRawData &destination)
OraMappingSchema m_mappingSchema
static std::string sequenceNameColumn()
string destination
bool getContainerTableMap(std::map< std::string, int > &destination)
void insertClassVersion(const std::string &className, const std::string &classVersion, const std::string &classId, int dependencyIndex, int containerId, const std::string &mappingVersion)
static std::string variableNameColumn()
void removeMapping(const std::string &version)
IDatabaseTable & mappingElementTable()
static std::string mappingVersionColumn()
bool lockContainer(int id, ContainerHeaderData &destination)
static std::string mappingVersionColumn()
bool getLastId(const std::string &sequenceName, int &lastId)
OraSequenceTable(coral::ISchema &dbSchema)
IDatabaseTable & classVersionTable()
static std::string containerNameColumn()
static std::string classNameColumn()
static std::string tableName()
bool getNamesForObject(int contId, int itemId, std::vector< std::string > &destination)
static std::string tableName()
bool getClassVersionListForContainer(int containerId, std::map< std::string, std::string > &versionMap)
IMappingSchema & mappingSchema()
OraMappingElementTable(coral::ISchema &dbSchema)
static std::string tableName()
IContainerHeaderTable & containerHeaderTable()
static std::string classNameColumn()
OraClassVersionTable(coral::ISchema &dbSchema)
static std::string tableNameColumn()
static std::string containerIdColumn()
std::string schemaVersion()
bool getContainerData(std::map< std::string, ContainerHeaderData > &destination)
bool getNamesForContainer(int contId, std::vector< std::string > &destination)
bool getParameters(std::map< std::string, std::string > &destination)
static std::string elementTypeColumn()
bool getClassVersionListForMappingVersion(const std::string &mappingVersion, std::set< std::string > &destination)
bool getVersionList(std::set< std::string > &destination)
OraMappingVersionTable m_mappingVersionTable
OraMappingVersionTable(coral::ISchema &dbSchema)
static std::string tableName()
static std::string variableParIndexColumn()
static std::string tableName()
static std::string numberOfObjectsColumn()
INamingServiceTable & namingServiceTable()
static std::string sequenceValueColumn()
static std::string tableName()
ISequenceTable & sequenceTable()
void erase(const std::string &sequenceName)
void setAccessPermission(const std::string &principal, bool forWrite)
static std::string itemIdColumn()
static std::string tableName()
static std::string variableTypeColumn()
static std::string parameterNameColumn()
static bool existsMainTable(coral::ISchema &dbSchema)
static std::string classVersionColumn()
OraContainerHeaderTable(coral::ISchema &dbSchema)
OraNamingServiceTable(coral::ISchema &dbSchema)
OraSequenceTable m_sequenceTable
bool getAllNames(std::vector< std::string > &destination)
bool eraseObjectName(const std::string &name)
bool getObjectByName(const std::string &name, std::pair< int, int > &destination)
static std::string mappingVersionColumn()
static std::string containerIdColumn()
bool getMappingVersionListForContainer(int containerId, std::set< std::string > &destination, bool onlyDependency=false)
static std::string dependencyIndexColumn()
coral::ISchema & m_schema
void updateNumberOfObjects(const std::map< int, unsigned int > &numberOfObjectsForContainerIds)
coral::ISchema & m_schema
bool getMappingVersionListForTable(const std::string &tableName, std::set< std::string > &destination)
void create(const std::string &userSchemaVersion)
OraNamingServiceTable m_namingServiceTable
bool containerForMappingVersion(const std::string &mappingVersion, int &destination)
static std::string scopeNameColumn()
OraMappingSchema(coral::ISchema &dbSchema)
static std::string columnNameColumn()
bool add(const std::string &sequenceName)
OraClassVersionTable m_classVersionTable
IDatabaseTable & mappingVersionTable()
void setObjectName(const std::string &name, int contId, int itemId)
static std::string elementIdColumn()
void addContainer(int id, const std::string &containerName, const std::string &className)
bool selectMappingVersion(const std::string &classId, int containerId, std::string &destination)
void storeMapping(const MappingRawData &mapping)
static std::string version()
std::string className(const T &t)
Definition: ClassName.h:30
bool getDependentClassesInContainerMapping(int containerId, std::set< std::string > &destination)
static std::string parameterValueColumn()
OraMainTable(coral::ISchema &dbSchema)
static std::string containerIdColumn()