CMS 3D CMS Logo

Public Member Functions | Static Public Member Functions | Private Attributes

ora::OraDatabaseSchema Class Reference

#include <OraDatabaseSchema.h>

Inheritance diagram for ora::OraDatabaseSchema:
ora::IDatabaseSchema

List of all members.

Public Member Functions

IDatabaseTableclassVersionTable ()
IContainerHeaderTablecontainerHeaderTable ()
void create (const std::string &userSchemaVersion)
void drop ()
bool exists ()
IMainTablemainTable ()
IDatabaseTablemappingElementTable ()
IMappingSchemamappingSchema ()
IDatabaseTablemappingVersionTable ()
INamingServiceTablenamingServiceTable ()
 OraDatabaseSchema (coral::ISchema &dbSchema)
ISequenceTablesequenceTable ()
void setAccessPermission (const std::string &principal, bool forWrite)
bool testDropPermission ()
virtual ~OraDatabaseSchema ()

Static Public Member Functions

static bool existsMainTable (coral::ISchema &dbSchema)

Private Attributes

OraClassVersionTable m_classVersionTable
OraContainerHeaderTable m_containerHeaderTable
OraMainTable m_mainTable
OraMappingElementTable m_mappingElementTable
OraMappingSchema m_mappingSchema
OraMappingVersionTable m_mappingVersionTable
OraNamingServiceTable m_namingServiceTable
coral::ISchema & m_schema
OraSequenceTable m_sequenceTable

Detailed Description

Definition at line 181 of file OraDatabaseSchema.h.


Constructor & Destructor Documentation

ora::OraDatabaseSchema::OraDatabaseSchema ( coral::ISchema &  dbSchema) [explicit]

Definition at line 1267 of file OraDatabaseSchema.cc.

                                                               :
  IDatabaseSchema( dbSchema ),
  m_schema( dbSchema ),
  m_mainTable( dbSchema ),
  m_sequenceTable( dbSchema ),
  m_mappingVersionTable( dbSchema ),
  m_mappingElementTable( dbSchema ),
  m_containerHeaderTable( dbSchema ),
  m_classVersionTable( dbSchema ),
  m_mappingSchema( dbSchema ),
  m_namingServiceTable( dbSchema ){
}
ora::OraDatabaseSchema::~OraDatabaseSchema ( ) [virtual]

Definition at line 1280 of file OraDatabaseSchema.cc.

                                        {
}

Member Function Documentation

ora::IDatabaseTable & ora::OraDatabaseSchema::classVersionTable ( ) [virtual]

Implements ora::IDatabaseSchema.

Definition at line 1354 of file OraDatabaseSchema.cc.

                                                          {
  return m_classVersionTable;  
}
ora::IContainerHeaderTable & ora::OraDatabaseSchema::containerHeaderTable ( ) [virtual]

Implements ora::IDatabaseSchema.

Definition at line 1350 of file OraDatabaseSchema.cc.

void ora::OraDatabaseSchema::create ( const std::string &  userSchemaVersion) [virtual]
void ora::OraDatabaseSchema::drop ( ) [virtual]
bool ora::OraDatabaseSchema::exists ( ) [virtual]

Implements ora::IDatabaseSchema.

Definition at line 1283 of file OraDatabaseSchema.cc.

References ora::throwException().

                                 {
  if(!m_mainTable.exists()){
    return false;
  }
  if(!m_namingServiceTable.exists())
     throwException( "ORA database is corrupted. Naming Service table is missing", "OraDatabaseSchema::exists");
  if(!m_sequenceTable.exists()) 
     throwException( "ORA database is corrupted. Sequence table is missing.","OraDatabaseSchema::exists");
  if(!m_mappingVersionTable.exists())
     throwException( "ORA database is corrupted. Mapping Version table is missing.","OraDatabaseSchema::exists");
  if(!m_mappingElementTable.exists())
     throwException( "ORA database is corrupted. Mapping Element table is missing.","OraDatabaseSchema::exists");
  if(!m_containerHeaderTable.exists())
     throwException( "ORA database is corrupted. Container Header table is missing.","OraDatabaseSchema::exists");
  if(!m_classVersionTable.exists()) 
     throwException( "ORA database is corrupted. Class Version table is missing.","OraDatabaseSchema::exists");
  return true;
}
bool ora::OraDatabaseSchema::existsMainTable ( coral::ISchema &  dbSchema) [static]

Definition at line 1067 of file OraDatabaseSchema.cc.

References ora::OraMainTable::exists(), and tmp.

Referenced by ora::IDatabaseSchema::createSchemaHandle().

                                                                  {
  OraMainTable tmp( dbSchema );
  return tmp.exists();
}
ora::IMainTable & ora::OraDatabaseSchema::mainTable ( ) [virtual]

Implements ora::IDatabaseSchema.

Definition at line 1334 of file OraDatabaseSchema.cc.

                                              {
  return m_mainTable;
}
ora::IDatabaseTable & ora::OraDatabaseSchema::mappingElementTable ( ) [virtual]

Implements ora::IDatabaseSchema.

Definition at line 1346 of file OraDatabaseSchema.cc.

                                                            {
  return m_mappingElementTable;  
}
ora::IMappingSchema & ora::OraDatabaseSchema::mappingSchema ( ) [virtual]

Implements ora::IDatabaseSchema.

Definition at line 1358 of file OraDatabaseSchema.cc.

                                                      {
  return m_mappingSchema;  
}
ora::IDatabaseTable & ora::OraDatabaseSchema::mappingVersionTable ( ) [virtual]

Implements ora::IDatabaseSchema.

Definition at line 1342 of file OraDatabaseSchema.cc.

                                                            {
  return m_mappingVersionTable;  
}
ora::INamingServiceTable & ora::OraDatabaseSchema::namingServiceTable ( ) [virtual]

Implements ora::IDatabaseSchema.

Definition at line 1362 of file OraDatabaseSchema.cc.

                                                                {
  return m_namingServiceTable;
}
ora::ISequenceTable & ora::OraDatabaseSchema::sequenceTable ( ) [virtual]

Implements ora::IDatabaseSchema.

Definition at line 1338 of file OraDatabaseSchema.cc.

                                                      {
  return m_sequenceTable;
}
void ora::OraDatabaseSchema::setAccessPermission ( const std::string &  principal,
bool  forWrite 
) [virtual]

Implements ora::IDatabaseSchema.

Definition at line 1323 of file OraDatabaseSchema.cc.

                                                                  {
  m_mainTable.setAccessPermission( principal, forWrite );  
  m_sequenceTable.setAccessPermission( principal, forWrite );  
  m_mappingVersionTable.setAccessPermission( principal, forWrite );  
  m_mappingElementTable.setAccessPermission( principal, forWrite );  
  m_containerHeaderTable.setAccessPermission( principal, forWrite );  
  m_classVersionTable.setAccessPermission( principal, forWrite ); 
  m_namingServiceTable.setAccessPermission( principal, forWrite ); 
}
bool ora::OraDatabaseSchema::testDropPermission ( ) [virtual]

Implements ora::IDatabaseSchema.

Definition at line 1366 of file OraDatabaseSchema.cc.

References Exception, run_regression::ret, stor::utils::sleep(), and ora::throwException().

                                             {
  // horrible work-around to avoid the attempt to DROP a db with no permission:
  // due to Oracle implicit COMMIT after any DDL attempt (successful or not...), the previous DELETE on containers are commited 
  // as a result the ora db is left corrupted
  bool ret = false;
  std::string tableName("ORA_TEST_DROP");
  if( m_schema.existsTable( tableName )){
    throwException( "ORA_TEST_DROP table already exists in this schema.",
                    "OraNameTable::testDropPermission");
  }
  try{
    coral::TableDescription descr( "OraDb" );
    descr.setName( tableName );
    descr.insertColumn( "DUMMY",
                        coral::AttributeSpecification::typeNameForType<int>() );
    m_schema.createTable( descr );
    ret = true;
    ::sleep(1);
  }catch ( const coral::Exception& ){
    ret = false;
  }
  if(ret ) m_schema.dropIfExistsTable( tableName );
  return ret;
}

Member Data Documentation

Definition at line 211 of file OraDatabaseSchema.h.

Definition at line 210 of file OraDatabaseSchema.h.

Definition at line 206 of file OraDatabaseSchema.h.

Definition at line 209 of file OraDatabaseSchema.h.

Definition at line 212 of file OraDatabaseSchema.h.

Definition at line 208 of file OraDatabaseSchema.h.

Definition at line 213 of file OraDatabaseSchema.h.

coral::ISchema& ora::OraDatabaseSchema::m_schema [private]

Reimplemented from ora::IDatabaseSchema.

Definition at line 205 of file OraDatabaseSchema.h.

Definition at line 207 of file OraDatabaseSchema.h.