CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/CondCore/ORA/src/ContainerSchema.h

Go to the documentation of this file.
00001 #ifndef INCLUDE_ORA_CONTAINERSCHEMA_H
00002 #define INCLUDE_ORA_CONTAINERSCHEMA_H
00003 
00004 #include "MappingTree.h"
00005 #include "Sequences.h"
00006 // externals
00007 #include "Reflex/Type.h"
00008 
00009 namespace coral {
00010   class ISchema;
00011 }
00012 
00013 namespace ora {
00014 
00015   class DatabaseSession;
00016   class IBlobStreamingService;
00017   class IReferenceHandler;
00018 
00019   class ContainerSchema {
00020     public:
00021 
00022     ContainerSchema( int containerId,
00023                      const std::string& containerName,
00024                      const Reflex::Type& containerType,
00025                      DatabaseSession& session );
00026 
00027     ContainerSchema( int containerId,
00028                      const std::string& containerName,
00029                      const std::string& className,
00030                      DatabaseSession& session );
00031 
00032     ~ContainerSchema();
00033 
00034     void create();
00035 
00036     void drop();
00037 
00038     void evolve();
00039 
00040     void create( const Reflex::Type& dependentClass );
00041 
00042     void evolve( const Reflex::Type& dependentClass, MappingTree& baseMapping );
00043     
00044     void setAccessPermission( const std::string& principal, bool forWrite );
00045     
00046     const Reflex::Type& type();
00047 
00048     MappingTree& mapping( bool writeEnabled=false);
00049 
00050     bool extendIfRequired( const Reflex::Type& dependentClass );
00051     
00052     MappingElement& mappingForDependentClass( const Reflex::Type& dependentClass, bool writeEnabled=false );
00053 
00054     bool mappingForDependentClasses( std::vector<MappingElement>& destination );
00055 
00056     Sequences& containerSequences();
00057 
00058     IBlobStreamingService* blobStreamingService();
00059 
00060     IReferenceHandler* referenceHandler();
00061 
00062     int containerId();
00063 
00064     const std::string& containerName();
00065 
00066     const std::string& className();
00067 
00068     const std::string& mappingVersion();
00069 
00070     coral::ISchema& storageSchema();
00071 
00072     DatabaseSession& dbSession();
00073 
00074     private:
00075     void initClassDict();
00076     bool loadMappingForDependentClass( const Reflex::Type& dependentClass );
00077     void extend( const Reflex::Type& dependentClass );
00078     void getTableHierarchy( const std::set<std::string>& containerMappingVersions, std::vector<std::string>& destination );
00079     private:
00080 
00081     int m_containerId;
00082     std::string m_containerName;
00083     std::string m_className;
00084     Reflex::Type m_classDict;
00085     DatabaseSession& m_session;
00086     bool m_loaded;
00087     Sequences m_containerSchemaSequences;
00088     MappingTree m_mapping;
00089     std::map<std::string,MappingTree*> m_dependentMappings;
00090     
00091   };
00092 }
00093   
00094 #endif