00001 #ifndef FDO_RDBMSOVPHYSICALSCHEMAMAPPING_H
00002 #define FDO_RDBMSOVPHYSICALSCHEMAMAPPING_H
00003 //
00004 //
00005 // Copyright (C) 2004-2006 Autodesk, Inc.
00006 //
00007 // This library is free software; you can redistribute it and/or
00008 // modify it under the terms of version 2.1 of the GNU Lesser
00009 // General Public License as published by the Free Software Foundation.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00019 //
00020
00021 #include <Fdo/Commands/Schema/PhysicalSchemaMapping.h>
00022 #include <Utilities/SchemaMgr/Overrides/TableMappingType.h>
00023 #include <Utilities/SchemaMgr/Overrides/GeometricColumnType.h>
00024 #include <Utilities/SchemaMgr/Overrides/GeometricContentType.h>
00025 #include <Rdbms/Override/RdbmsOv.h>
00026 #include <Rdbms/Override/RdbmsOvClassCollection.h>
00027 #include <Rdbms/Override/RdbmsOvSchemaAutoGeneration.h>
00028
00029 /// <library>
00030 /// FdoRdbms.lib
00031 /// </library>
00032
00033 ///<summary>Abstract base class for RDBMS type provider schema
00034 ///override sets.</summary>
00035 class FdoRdbmsOvPhysicalSchemaMapping : public FdoPhysicalSchemaMapping
00036 {
00037
00038 public:
00039 ///<summary>Gets the collection of class overrides for this schema
00040 ///override set.</summary>
00041 /// <returns>Returns FdoRdbmsOvReadOnlyClassCollection</returns>
00042 FDORDBMS_OV_API FdoRdbmsOvReadOnlyClassCollection* GetClasses();
00043
00044 ///<summary>Gets the table mapping</summary>
00045 ///<returns>Returns the table mapping</returns>
00046 FDORDBMS_OV_API FdoSmOvTableMappingType GetTableMapping();
00047
00048 ///<summary>Sets the table mapping</summary>
00049 /// <param name="mappingType">Input the mapping type</param>
00050 ///<returns>Returns nothing</returns>
00051 FDORDBMS_OV_API void SetTableMapping(FdoSmOvTableMappingType mappingType);
00052
00053 ///<summary>Gets the default geometric column type for newly-created geometric properties</summary>
00054 ///<returns>Returns the default geometric column type</returns>
00055 FDORDBMS_OV_API FdoSmOvGeometricColumnType GetGeometricColumnType();
00056
00057 ///<summary>Sets default geometric column type for newly-created geometric properties</summary>
00058 /// <param name="columnType">Input the default geometric column type</param>
00059 ///<returns>Returns nothing</returns>
00060 FDORDBMS_OV_API void SetGeometricColumnType(FdoSmOvGeometricColumnType columnType);
00061
00062 ///<summary>Gets the default geometric content type for newly-created geometric properties</summary>
00063 ///<returns>Returns the default geometric content type</returns>
00064 FDORDBMS_OV_API FdoSmOvGeometricContentType GetGeometricContentType();
00065
00066 ///<summary>Sets default geometric content type for newly-created geometric properties</summary>
00067 /// <param name="contentType">Input the default geometric content type</param>
00068 ///<returns>Returns nothing</returns>
00069 FDORDBMS_OV_API void SetGeometricContentType(FdoSmOvGeometricContentType contentType);
00070
00071 ///<summary>Gets the settings for AutoGenerating classes for this feature
00072 ///schema from the physical schema of the connected datastore.
00073 ///</summary>
00074 ///<returns>Returns FdoRdbmsOvSchemaAutoGeneration</returns>
00075 FDORDBMS_OV_API FdoRdbmsOvSchemaAutoGeneration* GetAutoGeneration();
00076
00077 ///<summary>Sets class autogeneration settings.</summary>
00078 /// <param name="autoGeneration">
00079 /// Input the autogeneration settings. If NULL then no schema autogeneration
00080 /// takes place.
00081 /// </param>
00082 ///<returns>Returns nothing</returns>
00083 FDORDBMS_OV_API void SetAutoGeneration(FdoRdbmsOvSchemaAutoGeneration* autoGeneration);
00084
00085 //DOM-IGNORE-BEGIN
00086
00087 FDORDBMS_OV_API void SetParent(FdoPhysicalElementMapping* value);
00088
00089 FDORDBMS_OV_API FdoXmlSaxHandler* XmlStartElement(
00090 FdoXmlSaxContext* context,
00091 FdoString* uri,
00092 FdoString* name,
00093 FdoString* qname,
00094 FdoXmlAttributeCollection* atts
00095 );
00096 //DOM-IGNORE-END
00097
00098 protected:
00099 FDORDBMS_OV_API FdoRdbmsOvPhysicalSchemaMapping();
00100 FDORDBMS_OV_API FdoRdbmsOvPhysicalSchemaMapping(FdoString* name);
00101 FDORDBMS_OV_API virtual ~FdoRdbmsOvPhysicalSchemaMapping();
00102
00103 // Initialize this element from its XML attributes
00104 FDORDBMS_OV_API virtual void InitFromXml(FdoXmlSaxContext* pContext, FdoXmlAttributeCollection* attrs);
00105
00106 // Serialize this property to XML.
00107 FDORDBMS_OV_API virtual void _writeXml(FdoXmlWriter* xmlWriter, const FdoXmlFlags* flags);
00108
00109 // Write any provider-specific parts that become XML attributes.
00110 FDORDBMS_OV_API virtual void _writeXmlAttributes(FdoXmlWriter* xmlWriter, const FdoXmlFlags* flags);
00111
00112 // Write any provider-specific parts that become XML elements.
00113 FDORDBMS_OV_API virtual void _writeXmlElements(FdoXmlWriter* xmlWriter, const FdoXmlFlags* flags);
00114
00115 // Get a writable version of the class override collection.
00116 FDORDBMS_OV_API FdoRdbmsOvClassCollection* GetRdbmsClasses();
00117
00118 // Create a class override. Each provider that supports class overrides
00119 // must override this function.
00120 FDORDBMS_OV_API virtual FdoRdbmsOvClassDefinition* CreateClass(
00121 FdoXmlSaxContext* context,
00122 FdoXmlAttributeCollection* atts
00123 )
00124 {
00125 // TODO: exception
00126 return NULL;
00127 }
00128
00129 // Add a class override to this schema override set. Each provider that
00130 // supports class overrides must override this function.
00131 FDORDBMS_OV_API virtual void AddClass(
00132 FdoRdbmsOvClassDefinition* pClass
00133 )
00134 {
00135 // TODO: exception
00136 }
00137
00138 private:
00139 FdoSmOvTableMappingType mMappingType;
00140 FdoSmOvGeometricColumnType mDefaultGeometricColumnType;
00141 FdoSmOvGeometricContentType mDefaultGeometricContentType;
00142 FdoRdbmsOvClassesP mClasses;
00143 FdoRdbmsOvSchemaAutoGenerationP mAutoGeneration;
00144 };
00145
00146 ///<summary>FdoRdbmsOvSchemaMappingP is a FdoPtr on FdoRdbmsOvPhysicalSchemaMapping, provided for convenience.</summary>
00147 typedef FdoPtr<FdoRdbmsOvPhysicalSchemaMapping> FdoRdbmsOvSchemaMappingP;
00148
00149 #endif
00150