FDO API Reference Feature Data Objects

SchemaMapping.h

Go to the documentation of this file.
00001 #ifndef FDO_XMLSCHEMAMAPPING_H_
00002 #define FDO_XMLSCHEMAMAPPING_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 #ifdef _WIN32
00022 #pragma once
00023 #endif
00024 
00025 #include <FdoStd.h>
00026 #include <Fdo/Xml/Serializable.h>
00027 #include <Fdo/Commands/Schema/PhysicalSchemaMapping.h>
00028 #include <Fdo/Xml/ClassMappingCollection.h>
00029 
00030 /// \brief
00031 /// FdoXmlSchemaMapping specifies overrides for translating a feature schema between 
00032 /// FDO and GML.
00033 class FdoXmlSchemaMapping :
00034     public FdoPhysicalSchemaMapping
00035 {
00036  
00037 public:
00038     /// \brief
00039     /// Creates an XML Schema Mapping Set.
00040     /// 
00041     /// \return
00042     /// FdoXmlSchemaMapping
00043     /// 
00044     FDO_API static FdoXmlSchemaMapping* Create( FdoString* name );
00045 
00046     /// \brief
00047     /// Gets the provider name.
00048     /// 
00049     /// \return
00050     /// Returns "OSGeo.GML.1.0". 
00051     /// \note
00052     /// This is the name given to this
00053     /// particular type of Schema Override set and is not the name of an actual FDO provider.
00054     /// 
00055     ///  
00056     FDO_API virtual FdoString* GetProvider();
00057 
00058     /// \brief
00059     /// Sets the target namespace URI for the GML version of this schema.
00060     /// When the Feature Schema for these overrides is written to GML, its targetNamespace
00061     /// is set to this value.
00062     /// 
00063     /// \param url 
00064     /// Input the target namespace.
00065     /// 
00066     FDO_API void SetTargetNamespace( FdoString* url );
00067 
00068     /// \brief
00069     /// Gets the target namespace URI for the GML version of this schema.
00070     /// 
00071     /// \return
00072     /// Returns the target namespace.
00073     /// 
00074     FDO_API FdoString* GetTargetNamespace();
00075 
00076     /// \brief
00077     /// Gets the mappings between GML global elements and their types as Fdo Classes. These
00078     /// mappings are used in two circumstances:
00079     /// <ul>
00080     ///     <li> when features are read from a GML Document, these mappings determine the Feature
00081     ///     class of each feature, based on its element name. If the element name is not 
00082     ///     in these mappings then the class name defaults to the element name.
00083     ///     <li> when the Feature Schema for these overrides is written to GML, a global element
00084     ///     is created from each item in element mappings collection. 
00085     /// </ul>
00086     /// 
00087     /// \return
00088     /// Returns FdoXmlElementMappingCollection*
00089     /// 
00090     FDO_API FdoXmlElementMappingCollection* GetElementMappings();
00091 
00092     /// \brief
00093     /// Gets the mappings for FDO Classes.
00094     /// 
00095     /// \return
00096     /// Returns FdoXmlClassMappingCollection*
00097     /// 
00098     FDO_API FdoXmlClassMappingCollection* GetClassMappings();
00099 
00100 protected:
00101 /// \cond DOXYGEN-IGNORE
00102     FdoXmlSchemaMapping() {}
00103 
00104     FdoXmlSchemaMapping( FdoString* name );
00105 
00106     virtual ~FdoXmlSchemaMapping();
00107 
00108     virtual void Dispose();
00109 
00110     /// Functions for XML support
00111 
00112     /// \brief
00113     /// Initializes this Xml Schema Mapping from its XML attributes. Called when
00114     /// the element is deserialized from XML. 
00115     /// 
00116     /// \param pContext 
00117     /// Input context contain information about the current deserialization operation
00118     /// \param attrs 
00119     /// Input the XML attributes.
00120     /// 
00121     /// \return
00122     /// Returns nothing
00123     /// 
00124     virtual void InitFromXml(FdoXmlSaxContext* pContext, FdoXmlAttributeCollection* attrs);
00125 
00126     /// \brief
00127     /// Writes this XML Schema Mapping to XML. Called when
00128     /// the element is serialized to XML. 
00129     /// 
00130     /// \param xmlWriter 
00131     /// Input write the element to this XML writer
00132     /// \param flags 
00133     /// Input flags that control the writing of the element.
00134     /// 
00135     /// \return
00136     /// Returns nothing
00137     /// 
00138     virtual void _writeXml(
00139         FdoXmlWriter* xmlWriter, 
00140         const FdoXmlFlags* flags
00141     );
00142 /// \endcond
00143 
00144 private:
00145     FdoStringP mTargetNamespace;
00146     FdoXmlElementMappingsP mElementMappings;
00147     FdoXmlClassMappingsP mClassMappings;
00148 };
00149 
00150 /// \brief
00151 /// FdoXmlSchemaMappingP is a FdoPtr on FdoXmlSchemaMapping, provided for convenience.
00152 typedef FdoPtr<FdoXmlSchemaMapping> FdoXmlSchemaMappingP;
00153 
00154 #endif
00155 
00156 

Comments or suggestions? Send us feedback.