00001 #ifndef FDO_RDBMSOVCLASSDEFINITION_H
00002 #define FDO_RDBMSOVCLASSDEFINITION_H
00003
00004 //
00005 //
00006 // Copyright (C) 2004-2006 Autodesk, Inc.
00007 //
00008 // This library is free software; you can redistribute it and/or
00009 // modify it under the terms of version 2.1 of the GNU Lesser
00010 // General Public License as published by the Free Software Foundation.
00011 //
00012 // This library is distributed in the hope that it will be useful,
00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00015 // Lesser General Public License for more details.
00016 //
00017 // You should have received a copy of the GNU Lesser General Public
00018 // License along with this library; if not, write to the Free Software
00019 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00020 //
00021
00022 /// <library>
00023 /// FdoRdbms.lib
00024 /// </library>
00025
00026 #include <Fdo/Commands/Schema/PhysicalClassMapping.h>
00027 #include <Utilities/SchemaMgr/Overrides/TableMappingType.h>
00028 #include <Rdbms/Override/RdbmsOv.h>
00029 #include <Rdbms/Override/RdbmsOvPropertyDefinitionCollection.h>
00030 #include <Rdbms/Override/RdbmsOvDataPropertyDefinition.h>
00031 #include <Rdbms/Override/RdbmsOvGeometricPropertyDefinition.h>
00032 #include <Rdbms/Override/RdbmsOvObjectPropertyDefinition.h>
00033 #include <Rdbms/Override/RdbmsOvTable.h>
00034
00035 ///<summary>Abstract class defining physical schema overrides for a class definition.</summary>
00036 class FdoRdbmsOvClassDefinition: public FdoPhysicalClassMapping
00037 {
00038
00039 public:
00040 ///<summary>Gets the collection of property overrides for this class
00041 ///override.</summary>
00042 /// <returns>Returns FdoRdbmsOvReadOnlyPropertyDefinitionCollection</returns>
00043 FDORDBMS_OV_API FdoRdbmsOvReadOnlyPropertyDefinitionCollection* GetProperties();
00044
00045 ///<summary>Gets the table overrides for this class override</summary>
00046 /// <returns>Returns FdoRdbmsOvTable</returns>
00047 FDORDBMS_OV_API FdoRdbmsOvTable* GetTable();
00048
00049 ///<summary>Gets the table mapping</summary>
00050 ///<returns>Returns FdoSmOvTableMappingType</returns>
00051 FDORDBMS_OV_API FdoSmOvTableMappingType GetTableMapping();
00052
00053 ///<summary>Sets the table mapping</summary>
00054 /// <param name="mappingType">Input the mapping type</param>
00055 ///<returns>Returns nothing</returns>
00056 FDORDBMS_OV_API void SetTableMapping(FdoSmOvTableMappingType mappingType);
00057
00058 //DOM-IGNORE-BEGIN
00059 FDORDBMS_OV_API void SetParent(FdoPhysicalElementMapping* value);
00060
00061 // XML Serialization functions.
00062
00063 FDORDBMS_OV_API virtual void _writeXml(FdoXmlWriter* xmlWriter, const FdoXmlFlags* flags);
00064
00065 FDORDBMS_OV_API virtual void InitFromXml(FdoXmlSaxContext* pContext, FdoXmlAttributeCollection* attrs);
00066
00067 // Serialize the XML attributes of this class:
00068 FDORDBMS_OV_API virtual void _writeXmlAttributes(FdoXmlWriter* xmlWriter, const FdoXmlFlags* flags);
00069
00070 FDORDBMS_OV_API virtual FdoXmlSaxHandler* XmlStartElement(
00071 FdoXmlSaxContext* context,
00072 FdoString* uri,
00073 FdoString* name,
00074 FdoString* qname,
00075 FdoXmlAttributeCollection* atts
00076 );
00077
00078 FDORDBMS_OV_API virtual FdoBoolean XmlEndElement(
00079 FdoXmlSaxContext* context,
00080 FdoString* uri,
00081 FdoString* name,
00082 FdoString* qname
00083 );
00084
00085 //DOM-IGNORE-END
00086
00087 protected:
00088 //<summary>Constructs a default instance of an FdoRdbmsOvClassDefinition.</summary>
00089 FDORDBMS_OV_API FdoRdbmsOvClassDefinition();
00090
00091 //<summary>Constructs an instance of an FdoRdbmsOvClassDefinition using the specified arguments.</summary>
00092 // <param name="name">Input the element name</param>
00093 FDORDBMS_OV_API FdoRdbmsOvClassDefinition(FdoString *name);
00094
00095 FDORDBMS_OV_API virtual ~FdoRdbmsOvClassDefinition();
00096
00097 //<summary>Gets the property overrides in writable form.</summary>
00098 // <returns>Returns FdoRdbmsOvPropertyDefinitionCollection</returns>
00099 FDORDBMS_OV_API FdoRdbmsOvPropertyDefinitionCollection* GetRdbmsProperties();
00100
00101 //<summary>Sets the table override<summary>
00102 // <param name="table">Input table override</param>
00103 FDORDBMS_OV_API void SetTable(FdoRdbmsOvTable* table);
00104
00105 //<summary>Sets the table override from XML attributes</summary>
00106 // <param name="context">Input context contain information about the current deserialization operation</param>
00107 // <param name="attrs">Input the XML attributes.</param>
00108 FDORDBMS_OV_API virtual void SetTable(
00109 FdoXmlSaxContext* context,
00110 FdoXmlAttributeCollection* atts
00111 )
00112 {
00113 //TODO: exception
00114 }
00115
00116 //<summary>
00117 //Creates a data property override for this class override.
00118 //Must be overridden by all providers that support
00119 //data property overrides.
00120 //</summary>
00121 // <param name="context">Input context contain information about the current deserialization operation</param>
00122 // <param name="propAttrs">Input the XML attributes for the property override.</param>
00123 // <param name="colAttrs">Input the XML attributes for the property's column override.</param>
00124 // <returns>Returns FdoRdbmsOvDataPropertyDefinition</returns>
00125 FDORDBMS_OV_API virtual FdoRdbmsOvDataPropertyDefinition* CreateDataProperty(
00126 FdoXmlSaxContext* context,
00127 FdoXmlAttributeCollection* propAtts,
00128 FdoXmlAttributeCollection* colAtts
00129 )
00130 {
00131 //TODO: exception
00132 return NULL;
00133 }
00134
00135 //<summary>
00136 //Creates a geometric property override for this class override.
00137 //Must be overridden by all providers that support
00138 //geometric property overrides.
00139 //</summary>
00140 // <param name="context">Input context contain information about the current deserialization operation</param>
00141 // <param name="propAttrs">Input the XML attributes for the property override.</param>
00142 // <param name="colAttrs">Input the XML attributes for the property's column override.</param>
00143 // <returns>Returns FdoRdbmsOvDataPropertyDefinition</returns>
00144 FDORDBMS_OV_API virtual FdoRdbmsOvGeometricPropertyDefinition* CreateGeometricProperty(
00145 FdoXmlSaxContext* context,
00146 FdoXmlAttributeCollection* propAtts,
00147 FdoXmlAttributeCollection* colAtts
00148 )
00149 {
00150 //TODO: exception
00151 return NULL;
00152 }
00153
00154 //<summary>
00155 //Creates a object property override for this class override.
00156 //Must be overridden by all providers that support
00157 //object property overrides.
00158 //</summary>
00159 // <param name="context">Input context contain information about the current deserialization operation</param>
00160 // <param name="propAttrs">Input the XML attributes for the property override.</param>
00161 // <param name="mappingAttrs">Input the XML attributes for the
00162 // object property table mapping override.</param>
00163 // <returns>Returns FdoRdbmsOvDataPropertyDefinition</returns>
00164 FDORDBMS_OV_API virtual FdoRdbmsOvObjectPropertyDefinition* CreateObjectProperty(
00165 FdoXmlSaxContext* context,
00166 FdoXmlAttributeCollection* propAtts,
00167 FdoString* mappingType,
00168 FdoXmlAttributeCollection* mappingAtts
00169 )
00170 {
00171 //TODO: exception
00172 return NULL;
00173 }
00174
00175 //<summary>
00176 //Checks if the given property is already in this class overrides's
00177 //property list. If it is then an error is logged and a SAX handler
00178 //for skipping the rest of the property's XML elements is returned.
00179 ///summary>
00180 // <param name="context">Input context contain information about the current deserialization operation</param>
00181 // <param name="pProp">Input the property to check</param>
00182 // <returns>Returns FdoXmlSaxHandler</returns>
00183 FDORDBMS_OV_API FdoXmlSaxHandler* CheckDuplicateProperty(
00184 FdoXmlSaxContext* context,
00185 FdoRdbmsOvPropertyDefinition* pProp
00186 );
00187
00188 //<summary>
00189 //Adds a property to this class definition.
00190 //<summary>
00191 FDORDBMS_OV_API virtual void AddProperty(
00192 FdoRdbmsOvPropertyDefinition* pProp
00193 ) = 0;
00194
00195 //DOM-IGNORE-BEGIN
00196 // Initializes this class override.
00197 void Init();
00198 //DOM-IGNORE-END
00199
00200 private:
00201 FdoSmOvTableMappingType mMappingType;
00202 FdoRdbmsOvPropertiesP mProperties;
00203 FdoRdbmsOvTableP mTable;
00204
00205 FdoXmlAttributesP mCurrAtts;
00206 FdoRdbmsOvPropertyDefinition* mCurrProp;
00207 FdoRdbmsOvDataPropertyP mCurrDataProp;
00208 FdoRdbmsOvGeometricPropertyP mCurrGeomProp;
00209 FdoRdbmsOvObjectPropertyP mCurrObjProp;
00210
00211 // Lists the allowable sub-elements for class definition's XML element
00212 FdoStringsP mElementSubElements;
00213 // List of Object Property Mapping element.
00214 FdoStringsP mOpSubElements;
00215 };
00216
00217 ///<summary>FdoRdbmsOvClassP is a FdoPtr on FdoRdbmsOvClassDefinition, provided for convenience.</summary>
00218 typedef FdoPtr<FdoRdbmsOvClassDefinition> FdoRdbmsOvClassP;
00219
00220 #endif
00221
00222