FDO API Reference Feature Data Objects

MergeContext.h

Go to the documentation of this file.
00001 #ifndef FDO_SCHEMA_MERGECONTEXT_H
00002 #define FDO_SCHEMA_MERGECONTEXT_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 #include <FdoStd.h>
00023 #include <Fdo/Schema/FeatureSchemaCollection.h>
00024 #include <Fdo/Schema/FeatureClass.h>
00025 #include <Fdo/Schema/NetworkLinkFeatureClass.h>
00026 #include <Fdo/Schema/NetworkClass.h>
00027 #include <Fdo/Schema/NetworkNodeFeatureClass.h>
00028 #include <Fdo/Schema/RasterPropertyDefinition.h>
00029 #include <Fdo/Schema/UniqueConstraint.h>
00030 #include <Fdo/Schema/ObjectPropertyDefinition.h>
00031 #include <Fdo/Xml/Flags.h>
00032 
00033 /// \cond DOXYGEN-IGNORE
00034 /// \brief
00035 /// FdoSchemaMergeContext provides support for updating a set of feature schemas
00036 /// base on a second set of schemas. It's main purpose is to support the reading 
00037 /// of feature schemas from XML and the IApplySchema command implementations of 
00038 /// certain providers (e.g. SDF Provider). 
00039 ///
00040 /// The schema updates can be done as an additive merge or based on the element states
00041 /// in the second set of schemas.
00042 ///
00043 /// \warning This class is not yet part of the FDO API and is subject to change in the 
00044 /// future. It's functions are exported for use by the SDF Provider.
00045 class FdoSchemaMergeContext : public FdoContext
00046 {
00047 public:
00048     /// \brief
00049     /// Constructs the Schema Merge Context
00050     /// 
00051     /// \param schemas 
00052     /// Input the features schemas to updated.
00053     ///
00054     /// \param defaultCapability
00055     /// Input if true, then all types of schema element modifications are allowed by default.
00056     /// If false then none are allowed by default.
00057     /// 
00058     /// 
00059     /// \return
00060     /// Returns FdoSchemaMergeContext
00061     /// 
00062     FDO_API static FdoSchemaMergeContext* Create( FdoFeatureSchemaCollection* schemas, bool defaultCapability = false  );
00063 
00064     /// \brief
00065     /// Gets the current IgnoreStates setting
00066     ///
00067     /// \return
00068     /// Returns true if element states on second set of schemas are ignored. Second set of schemas
00069     /// is additively merged into schemas to update.
00070     /// Returns false if element states determine how schemas are merged
00071     /// 
00072     FDO_API bool GetIgnoreStates();
00073 
00074     /// \brief
00075     /// Sets the IgnoreStates setting
00076     /// 
00077     /// \param ignoreStates 
00078     /// Input the new IgnoreStates setting.
00079     ///
00080     FDO_API void SetIgnoreStates( bool ignoreStates );
00081 
00082     /// \brief
00083     /// Gets the current ReplaceClass setting
00084     ///
00085     /// \return
00086     /// Returns true if properties, in the schemas to update, are deleted if not 
00087     /// present in the second set of schemas.
00088     /// Returns false if class properties are additively merged (Properties in scheams
00089     /// to update are kept, even if not present in second set of schemas).
00090     /// 
00091     FDO_API virtual bool GetReplaceClass();
00092     
00093     /// \brief
00094     /// Sets the ReplaceClass setting
00095     /// 
00096     /// \param replaceClass 
00097     /// Input the new ReplaceClass setting.
00098     ///
00099     FDO_API virtual void SetReplaceClass( bool replaceClass );
00100 
00101     /// \brief
00102     /// Gets the current CopyElement setting
00103     ///
00104     /// \return
00105     /// Returns true elements are always copied when the schemas are merged.
00106     /// Returns false if it is ok to simply move elements from the second set of 
00107     /// schems to the schemas to update. CopyElements should only be false when
00108     /// the second set of schemas will be discarded when the schema merge is complete
00109     /// 
00110     FDO_API virtual bool GetCopyElements();
00111     
00112     /// \brief
00113     /// Sets the CopyElements setting
00114     /// 
00115     /// \param copyElements 
00116     /// Input the new CopyElements setting.
00117     ///
00118     FDO_API virtual void SetCopyElements( bool copyElements );
00119 
00120     /// \brief
00121     /// Gets the current error level. Determines how strict the error checking is.
00122     ///
00123     /// \return
00124     /// Returns current error level.
00125     /// 
00126     FdoXmlFlags::ErrorLevel GetErrorLevel();
00127 
00128     /// \brief
00129     /// Sets the current error level
00130     /// 
00131     /// \param errorLevel 
00132     /// Input the new error level.
00133     ///
00134     void SetErrorLevel( FdoXmlFlags::ErrorLevel errorLevel );
00135 
00136     /// \brief
00137     /// Gets the schemas to update
00138     ///
00139     /// \return
00140     /// Returns FdoFeatureSchemaCollection
00141     /// 
00142     FDO_API FdoFeatureSchemaCollection* GetSchemas() const;
00143 
00144     /// \brief
00145     /// Gets the second set of schemas.
00146     ///
00147     /// \return
00148     /// Returns FdoFeatureSchemaCollection
00149     /// 
00150     FdoPtr<FdoFeatureSchemaCollection> GetUpdSchemas() const;
00151 
00152     /// \brief
00153     /// Sets the second set of schemas. This function must only be used
00154     /// when the current IgnoreStates setting is true.
00155     /// 
00156     /// \param schemas 
00157     /// Input the schemas.
00158     ///
00159     FDO_API void SetUpdSchemas( FdoFeatureSchemaCollection* schemas );
00160 
00161     /// \brief
00162     /// Sets the second set of schemas to be a single feature schema.
00163     /// This gets around a problem where a feature schema's element
00164     /// state is always changed to "Added" when it is added to a collection.
00165     /// 
00166     /// \param schemas 
00167     /// Input the schema.
00168     ///
00169     FDO_API void SetUpdSchema( FdoFeatureSchema* schema );
00170 
00171     /// \brief
00172     /// Gets the FDO connection used by this context. 
00173     ///
00174     /// \return
00175     /// Returns FdoIConnection. NULL if there is no current connection
00176     /// 
00177     FDO_API FdoIConnection* GetConnection();
00178 
00179     /// \brief
00180     /// Sets the FDO connection used by this context. If a connection is
00181     /// provided then this context can do extra error checking based on
00182     /// the connection's provider capabilities and datastore contents.
00183     /// 
00184     /// \param connection 
00185     /// Input the FDO connection.
00186     ///
00187     FDO_API void SetConnection( FdoIConnection* connection );
00188 
00189     /// \brief
00190     /// Merges the second set of schemas into the schemas to update.
00191     /// Resolves all references. If there
00192     /// are any errors these are thrown. 
00193     ///
00194     FDO_API void CommitSchemas();
00195 
00196     // The following functions check whether certain schema element modifications
00197     // can be carried out. Each calls the corresponding Can* function to see if the
00198     // modification is supported at all. If it is then the element is examined 
00199     // further to see if the modification can be done. If this context is provided
00200     // a connection, the connection is also check to see if the modification is
00201     // allowed (for example class delete is disallowed if the connected datastore
00202     // has any objects of that class definition.
00203     //
00204     // Each function returns true of the modification can be performed and false if not.
00205     // An error is logged if the modification cannot be performed.
00206 
00207     FDO_API virtual bool CheckDeleteClass( FdoClassDefinition* classDef );
00208 
00209     FDO_API virtual bool CheckAddProperty( FdoPropertyDefinition* prop );
00210 
00211     FDO_API virtual bool CheckDeleteProperty( FdoPropertyDefinition* prop );
00212 
00213     FDO_API virtual bool CheckDeleteSchema( FdoFeatureSchema* schema );
00214 
00215     // The following functions represent each type of schema element modification.
00216     // Each returns true if the modification is allowed.
00217     //
00218     // The return value is the defaultCapability passed to the Create() function. 
00219     // Sub-classes can override any of these functions if their return value needs
00220     // to differ from the default capability. 
00221     //
00222     // For example, if only 3 modifications are supported then set default capability
00223     // to false and override the 3 functions, for these modifications, to return true.
00224 
00225 
00226     FDO_API virtual bool CanModElementDescription( FdoSchemaElement* element );
00227 
00228 
00229     FDO_API virtual bool CanAddSchema( FdoFeatureSchema* schema );
00230     FDO_API virtual bool CanDeleteSchema( FdoFeatureSchema* schema );
00231     FDO_API virtual bool CanModSchemaName( FdoFeatureSchema* schema );
00232 
00233     FDO_API virtual bool CanAddClass( FdoClassDefinition* classDef );
00234     FDO_API virtual bool CanDeleteClass( FdoClassDefinition* classDef );
00235     FDO_API virtual bool CanModClassName( FdoClassDefinition* classDef );
00236     FDO_API virtual bool CanModBaseClass( FdoClassDefinition* classDef );
00237     FDO_API virtual bool CanModClassAbstract( FdoClassDefinition* classDef );
00238     FDO_API virtual bool CanModIdProps( FdoClassDefinition* classDef );
00239 
00240     FDO_API virtual bool CanModFeatGeometry( FdoFeatureClass* classDef );
00241 
00242     FDO_API virtual bool CanModNetLayer( FdoNetworkClass* classDef );
00243 
00244     FDO_API virtual bool CanModNetCost( FdoNetworkFeatureClass* classDef );
00245     FDO_API virtual bool CanModNetProp( FdoNetworkFeatureClass* classDef );
00246     FDO_API virtual bool CanModNetFeat( FdoNetworkFeatureClass* classDef );
00247     FDO_API virtual bool CanModNetParent( FdoNetworkFeatureClass* classDef );
00248 
00249     FDO_API virtual bool CanModLinkStartNode( FdoNetworkLinkFeatureClass* classDef );
00250     FDO_API virtual bool CanModLinkEndNode( FdoNetworkLinkFeatureClass* classDef );
00251 
00252     FDO_API virtual bool CanModNodeLayer( FdoNetworkNodeFeatureClass* classDef );
00253 
00254     FDO_API virtual bool CanAddProperty( FdoPropertyDefinition* prop );
00255     FDO_API virtual bool CanDeleteProperty( FdoPropertyDefinition* prop );
00256     FDO_API virtual bool CanModPropertyName( FdoPropertyDefinition* prop );
00257 
00258     FDO_API virtual bool CanModDataType( FdoDataPropertyDefinition* prop );
00259     FDO_API virtual bool CanModDefaultValue( FdoDataPropertyDefinition* prop );
00260     FDO_API virtual bool CanModDataNullable( FdoDataPropertyDefinition* prop );
00261     FDO_API virtual bool CanModDataLength( FdoDataPropertyDefinition* prop );
00262     FDO_API virtual bool CanModDataPrecision( FdoDataPropertyDefinition* prop );
00263     FDO_API virtual bool CanModDataScale( FdoDataPropertyDefinition* prop );
00264     FDO_API virtual bool CanModDataAutoGenerated( FdoDataPropertyDefinition* prop );
00265     FDO_API virtual bool CanModDataReadOnly( FdoDataPropertyDefinition* prop );
00266     FDO_API virtual bool CanModDataConstraint( FdoDataPropertyDefinition* prop );
00267 
00268     FDO_API virtual bool CanModGeomTypes( FdoGeometricPropertyDefinition* prop );
00269     FDO_API virtual bool CanModGeomElevation( FdoGeometricPropertyDefinition* prop );
00270     FDO_API virtual bool CanModGeomMeasure( FdoGeometricPropertyDefinition* prop );
00271     FDO_API virtual bool CanModGeomSC( FdoGeometricPropertyDefinition* prop );
00272     FDO_API virtual bool CanModGeomReadOnly( FdoGeometricPropertyDefinition* prop );
00273 
00274     FDO_API virtual bool CanModAssocClass( FdoAssociationPropertyDefinition* prop );
00275     FDO_API virtual bool CanModAssocReverseName( FdoAssociationPropertyDefinition* prop );
00276     FDO_API virtual bool CanModAssocDeleteRule( FdoAssociationPropertyDefinition* prop );
00277     FDO_API virtual bool CanModAssocLockCascade( FdoAssociationPropertyDefinition* prop );
00278     FDO_API virtual bool CanModAssocMultiplicity( FdoAssociationPropertyDefinition* prop );
00279     FDO_API virtual bool CanModAssocReverseMultiplicity( FdoAssociationPropertyDefinition* prop );
00280     FDO_API virtual bool CanModAssocIdentity( FdoAssociationPropertyDefinition* prop );
00281     FDO_API virtual bool CanModAssocReverseIdentity( FdoAssociationPropertyDefinition* prop );
00282     FDO_API virtual bool CanModAssocReadOnly( FdoAssociationPropertyDefinition* prop );
00283 
00284     FDO_API virtual bool CanModObjClass( FdoObjectPropertyDefinition* prop );
00285     FDO_API virtual bool CanModObjId( FdoObjectPropertyDefinition* prop );
00286     FDO_API virtual bool CanModObjType( FdoObjectPropertyDefinition* prop );
00287     FDO_API virtual bool CanModObjOrder( FdoObjectPropertyDefinition* prop );
00288 
00289     FDO_API virtual bool CanModRasterReadOnly( FdoRasterPropertyDefinition* prop );
00290     FDO_API virtual bool CanModRasterNullable( FdoRasterPropertyDefinition* prop );
00291     FDO_API virtual bool CanModRasterModel( FdoRasterPropertyDefinition* prop );
00292     FDO_API virtual bool CanModRasterXSize( FdoRasterPropertyDefinition* prop );
00293     FDO_API virtual bool CanModRasterYSize( FdoRasterPropertyDefinition* prop );
00294     FDO_API virtual bool CanModRasterSC( FdoRasterPropertyDefinition* prop );
00295 
00296     /// \brief
00297     /// Checks if a class has objects.
00298     ///
00299     /// \warning This function is used as a pre-check to see if a class definition can 
00300     /// be deleted. However, there is a chance that the class has no objects when this
00301     /// check is done, but an object is created by someone else before the class is 
00302     /// deleted. Providers that need to prevent this race condition can do so by 
00303     /// extending this function.
00304     /// 
00305     /// \param classDef
00306     /// Input the class to check
00307     ///
00308     /// \return
00309     /// Returns true if the class has objects ( the datastore for the current connection
00310     /// is checked for objects).
00311     /// Returns false if the class does not have objects or this context does not have
00312     /// a connection.
00313     FDO_API virtual bool ClassHasObjects( FdoClassDefinition* classDef );
00314 
00315     // When the schemas are merged. references between schema elements cannot be resolved
00316     // right away, since the referenced element might not yet have been copied to the 
00317     // schemas to update. Therefore, the merge process simply builds lists of these
00318     // references and then resolves them after the merge is complete. 
00319 
00320     // The following functions support building the lists of referneces
00321 
00322     // Add reference between qualified name of schema element and actual object.
00323     // This may start as an element in the second set of schemas, but then changes
00324     // to the corresponding element in the schemas to update, after the element
00325     // has been copied to the schemas to update
00326     void AddElementMap( FdoSchemaElement* pElement );
00327 
00328     // Adds a reference between a class and its base class.
00329     // These references are resolved after all the classes have been read.
00330     //
00331     // Parameters:
00332     //      pReferencer - the class.
00333     //      schemaName - base class schema name.
00334     //      className - base class name.
00335     void AddBaseClassRef( FdoClassDefinition* pReferencer, FdoString* schemaName, FdoString* className );
00336 
00337     // Adds a reference between an object property and its class.
00338     // These references are resolved after all the classes have been read.
00339     //
00340     // Parameters:
00341     //      pReferencer - the object property.
00342     //      schemaName - class schema name.
00343     //      className - class name.
00344     void AddObjPropRef( FdoObjectPropertyDefinition* pReferencer, FdoString* schemaName, FdoString* className );
00345 
00346 
00347     // Adds a reference between a network node feature class and the layer association proeprty.
00348     //
00349     // Parameters:
00350     //      pReferencer - the network node feature class.
00351     //      assoc - the layer association property name
00352     //      
00353     void AddNetworkNodeAssocPropRef( FdoNetworkNodeFeatureClass* pReferencer, FdoString* assoc );
00354 
00355     // Adds a reference between a network link feature class and the start association property.
00356     //
00357     // Parameters:
00358     //      pReferencer - the network link feature class.
00359     //      assoc - the start association property name
00360     void AddNetworkLinkStartAssocPropRef( FdoNetworkLinkFeatureClass* pReferencer, FdoString* assoc );
00361 
00362     // Adds a reference between a network link feature class and the end association property.
00363     //
00364     // Parameters:
00365     //      pReferencer - the network link feature class.
00366     //      assoc - the end association property name
00367     void AddNetworkLinkEndAssocPropRef( FdoNetworkLinkFeatureClass* pReferencer, FdoString* assoc );
00368 
00369     // Adds a reference between a network feature class and the cost association property.
00370     // These references are resolved after all the classes have been read.
00371     //
00372     // Parameters:
00373     //      pReferencer - the network feature class
00374     //      cost - the cost association property name
00375     void AddNetworkFeatureCostPropRef( FdoNetworkFeatureClass* pReferencer, FdoString* cost );
00376 
00377 
00378     // Adds a reference between a network feature and the network property association property.
00379     // These references are resolved after all the classes have been read.
00380     //
00381     // Parameters:
00382     //      pReferencer - the network feature class
00383     //      networkProp - the association network property name
00384     void AddNetworkFeatureNetworkPropRef( FdoNetworkFeatureClass* pReferencer, FdoString* networkProp );
00385 
00386     // Adds a reference between a network feature class and the reference feature association property.
00387     // These references are resolved after all the classes have been read.
00388     //
00389     // Parameters:
00390     //      pReferencer - the network feature class
00391     //      refFeatProp - the reference feature property association name
00392     void AddNetworkFeatureRefFeatPropRef( FdoNetworkFeatureClass* pReferencer, FdoString* refFeatProp );
00393 
00394     // Adds a reference between a network feature class and the parent network feature assocaition property.
00395     // These references are resolved after all the classes have been read.
00396     //
00397     // Parameters:
00398     //      pReferencer - the network feature class
00399     //      parentNetworkFeatProp - the parent network feature association property name
00400     void AddNetworkFeatureParentNetworkFeatPropRef( FdoNetworkFeatureClass* pReferencer, FdoString* parentNetworkFeatProp );
00401 
00402     // Adds a reference between a network class and its layer class.
00403     // These references are resolved after all the classes have been read.
00404     //
00405     // Parameters:
00406     //      pReferencer - the network class.
00407     //      schemaName - class schema name.
00408     //      className - class name.
00409     void AddNetworkClassRef( FdoNetworkClass* pReferencer, FdoString* schemaName, FdoString* className );
00410 
00411 
00412     // Adds a reference between a associate property and its associated class.
00413     // These references are resolved after all the classes have been read.
00414     //
00415     // Parameters:
00416     //      pReferencer - the associate property.
00417     //      schemaName - associate class schema name.
00418     //      className - associate class name.
00419     void AddAssocPropRef( FdoAssociationPropertyDefinition* pReferencer, FdoString* schemaName, FdoString* className );
00420 
00421     // Adds a reference between a class and its identity properties.
00422     // These references are resolved after all the classes have been read.
00423     //
00424     // Parameters:
00425     //      pReferencer - the class
00426     //      idProps - the identity property names.
00427     void AddIdPropRef( FdoClassDefinition* pReferencer, FdoStringsP idProps );
00428 
00429     // Adds a reference between a class' unique constraint and its properties.
00430     // These references are resolved after all the classes have been read.
00431     //
00432     // Parameters:
00433     //      pReferencer - the class
00434     //      pUniConsRef - this class's unique constraint
00435     //      props - the property names.
00436     void AddUniqueConstraintRef( FdoClassDefinition* pClsRef, FdoUniqueConstraint* pUniConsRef, FdoStringsP props );
00437 
00438     // Adds a reference between an object property and its identity property.
00439     // These references are resolved after all the classes have been read.
00440     //
00441     // Parameters:
00442     //      pReferencer - the object property
00443     //      idProp - the identity property name.
00444     void AddObjIdPropRef( FdoObjectPropertyDefinition* pReferencer, FdoString* idProp );
00445     
00446     // Adds a reference between an association property and its identity properties.
00447     // These references are resolved after all the classes have been read.
00448     //
00449     // Parameters:
00450     //      pReferencer - the association property
00451     //      idProps - the identity property names.
00452     void AddAssocIdPropRef( FdoAssociationPropertyDefinition* pReferencer, FdoStringsP idProps );
00453 
00454     void AddAssocIdReversePropRef( FdoAssociationPropertyDefinition* pReferencer, FdoStringsP idProps );
00455 
00456     // Adds a reference between a feature class and its geometry property.
00457     // These references are resolved after all the classes have been read.
00458     //
00459     // Parameters:
00460     //      pReferencer - the feature class
00461     //      geomProp - the geometry property name.
00462     void AddGeomPropRef( FdoFeatureClass* pReferencer, FdoString* geomProp );
00463 
00464     FdoClassDefinition* FindClass( FdoFeatureSchemaCollection* pSchemas, FdoClassDefinition* pClass );
00465     // Find a class in the given schema collection.
00466     FdoClassDefinition* FindClass( FdoFeatureSchemaCollection* pSchemas, const FdoString* schemaName, const FdoString* className );
00467     
00468 
00469 protected:
00470     FDO_API FdoSchemaMergeContext() {}
00471     FDO_API FdoSchemaMergeContext( FdoFeatureSchemaCollection* schemas, bool defaultCapability = false );
00472     FDO_API virtual ~FdoSchemaMergeContext();
00473 
00474 private:
00475     // Merge the schemas that were read, into the schema collection.
00476     void MergeSchemas();
00477     void MergeSchema( FdoFeatureSchema* newSchema );
00478 
00479     void CheckReferences();
00480 
00481     // Various functions for resolving references.
00482     void ResolveBaseClasses();
00483     void ResolveObjPropClasses();
00484     void ResolveAssociatedPropClasses();
00485     void ResolveNetworkLinkProps();
00486     void ResolveNetworkProps();
00487     void ResolveNetworkNodeProps();
00488     void ResolveNetworkFeatureProps();
00489     void ResolveIdProps();
00490     void ResolveObjIdProps();
00491     void ResolveAssocIdProps();
00492     void ResolveAssocIdReverseProps();
00493     void ResolveGeomProps();
00494     void ResolveUniqueConstraints();
00495     // For each referencing class, without geometryProperty, pick a geometryProperty
00496     // for it. One is pick only if there is only geometric property on the class and
00497     // all of its ancestors.
00498     void ResolveDefaultGeomProps();
00499 
00500     FdoSchemaElement* MapElement( FdoSchemaElement* pElement );
00501 
00502     // Various functions for finding FDO elements. 
00503 
00504     // Find a class property. Walks up the base classes until the property is found.
00505     FdoPropertyDefinition* FindProperty( FdoClassDefinition* pClass, const FdoString* propName, FdoBoolean checkUpdSchemas = true );
00506     // Find an identity property. Checks the topmost base class.
00507     FdoDataPropertyDefinition* GetIdProperty( FdoClassDefinition* pClass, const FdoInt32 idx, FdoBoolean checkUpdSchemas = true );
00508 
00509     // Gets the topmost base class for a class.
00510     FdoClassDefinition* GetTopClass( FdoClassDefinition* pClass );
00511     // Gets the base class for a class. Gets the most recent object. Returns the
00512     // object read from XML. If the base class was not read from XML then its
00513     // original object is returned.
00514     FdoClassDefinition* GetBaseClass( FdoClassDefinition* pClass );
00515 
00516     // Definition for a reference to a class.
00517     class ElementMap : public FdoIDisposable 
00518     {
00519     public:
00520         static ElementMap* Create( FdoSchemaElement* pElement );
00521 
00522         // Get the referencing element.
00523         FdoSchemaElement* GetElement();
00524         void SetElement( FdoSchemaElement* pElement );
00525         FdoStringP GetName(); 
00526 
00527         // Indicates that this object does not allow its name
00528         // to change. Not allowing name change allows more efficient 
00529         // random access to FdoDictionary.
00530         virtual FdoBoolean CanSetName()
00531         {
00532             return false;
00533         }
00534 
00535     protected:
00536         ElementMap() {}
00537         ElementMap( FdoSchemaElement* pReferencer );
00538         virtual ~ElementMap() {}
00539 
00540         virtual void Dispose();
00541 
00542     private:
00543         FdoSchemaElementP mElement;
00544         FdoStringP mElementName;
00545     };
00546     
00547     // Collection of references to classes.
00548     class ElementMaps : public FdoNamedCollection<ElementMap,FdoException>
00549     {
00550     protected:
00551         virtual void Dispose();
00552 
00553         ElementMaps() {}
00554 
00555     public:
00556         /// <summary>Gets the number of items in the collection.</summary>
00557         /// <returns>Returns number of items in the collection</returns> 
00558         static ElementMaps* Create()
00559         {
00560             return new  ElementMaps();
00561         }
00562     };
00563 
00564     // Definition for a reference to a class.
00565     class ClassRef : public FdoIDisposable 
00566     {
00567     public:
00568         static ClassRef* Create( FdoSchemaElement* pReferencer, FdoStringP schemaName, FdoStringP className );
00569 
00570         // Get the referencing element.
00571         FdoSchemaElement* GetReferencer();
00572         void SetReferencer( FdoSchemaElement* referencer );
00573         FdoSchemaElement* GetNewReferenced();
00574         void SetNewReferenced( FdoSchemaElement* pNewReferenced );
00575         FdoStringP GetSchemaName();
00576         FdoStringP GetClassName();
00577         FdoStringP GetName(); 
00578 
00579         // Indicates that this object does not allow its name
00580         // to change. Not allowing name change allows more efficient 
00581         // random access to FdoDictionary.
00582         virtual FdoBoolean CanSetName()
00583         {
00584             return false;
00585         }
00586 
00587     protected:
00588         ClassRef() {}
00589         ClassRef( FdoSchemaElement* pReferencer, FdoStringP schemaName, FdoStringP className );
00590         virtual ~ClassRef() {}
00591 
00592         virtual void Dispose();
00593 
00594     private:
00595         FdoSchemaElementP mReferencer;
00596         FdoSchemaElementP mNewReferenced;
00597         FdoStringP mReferencerName;
00598         FdoStringP mSchemaName;
00599         FdoStringP mClassName;
00600     };
00601     
00602     // Collection of references to classes.
00603     class ClassRefs : public FdoNamedCollection<ClassRef,FdoException>
00604     {
00605     protected:
00606         virtual void Dispose();
00607 
00608         ClassRefs() {}
00609 
00610     public:
00611         /// <summary>Gets the number of items in the collection.</summary>
00612         /// <returns>Returns number of items in the collection</returns> 
00613         static ClassRefs* Create()
00614         {
00615             return new  ClassRefs();
00616         }
00617     };
00618 
00619     // Definition of a reference to a collection of strings.
00620     class StringsRef : public FdoIDisposable 
00621     {
00622     public:
00623         static StringsRef* Create( FdoSchemaElement* pReferencer, FdoStringsP strings );
00624 
00625         FdoSchemaElement* GetReferencer();
00626         void SetReferencer( FdoSchemaElement* referencer );
00627         FdoStringsP GetStrings();
00628         FdoStringP GetName(); 
00629 
00630         // Indicates that this object does not allow its name
00631         // to change. Not allowing name change allows more efficient 
00632         // random access to FdoDictionary.
00633         virtual FdoBoolean CanSetName()
00634         {
00635             return false;
00636         }
00637 
00638     protected:
00639         StringsRef() {}
00640         StringsRef( FdoSchemaElement* pReferencer, FdoStringsP strings );
00641         virtual ~StringsRef() {}
00642 
00643         virtual void Dispose();
00644 
00645     private:
00646         FdoPtr<FdoSchemaElement> mReferencer;
00647         FdoStringsP mStrings;
00648         FdoStringP mQName;
00649     };
00650     
00651     // Collection of references to string collections
00652     class StringsRefs : public FdoNamedCollection<StringsRef,FdoException>
00653     {
00654     protected:
00655         virtual void Dispose();
00656 
00657         StringsRefs() {}
00658 
00659     public:
00660         /// <summary>Gets the number of items in the collection.</summary>
00661         /// <returns>Returns number of items in the collection</returns> 
00662         static StringsRefs* Create()
00663         {
00664             return new  StringsRefs();
00665         }
00666     };
00667 
00668     // Definition of a reference to unique constraint
00669     class UniqueConstraintRef : public FdoDisposable
00670     {
00671     public:
00672         static UniqueConstraintRef* Create( FdoClassDefinition* pClsRef, FdoUniqueConstraint* pUniConsRef, FdoStringsP strings );
00673 
00674         FdoClassDefinition* GetRefClass();
00675         void SetRefClass( FdoClassDefinition* referencer );
00676         FdoUniqueConstraint* GetRefUniqueConstraint();
00677         FdoStringsP GetStrings();
00678         FdoStringP GetName(); 
00679 
00680         // Indicates that this object does not allow its name
00681         // to change. Not allowing name change allows more efficient 
00682         // random access to FdoDictionary.
00683         virtual FdoBoolean CanSetName()
00684         {
00685             return false;
00686         }
00687 
00688     protected:
00689         UniqueConstraintRef() {}
00690         UniqueConstraintRef( FdoClassDefinition* pClsRef, FdoUniqueConstraint* pUniConsRef, FdoStringsP strings );
00691         virtual ~UniqueConstraintRef() {}
00692 
00693     private:
00694         FdoPtr<FdoClassDefinition> mClsRef;
00695         FdoPtr<FdoUniqueConstraint> mUniConsRef;
00696         FdoStringsP mStrings;
00697         FdoStringP mQName;
00698     };
00699 
00700     // Collection of references to unique constraint references
00701     class UniqueConstraintRefs : public FdoNamedCollection<UniqueConstraintRef,FdoException>
00702     {
00703     protected:
00704         virtual void Dispose();
00705 
00706         UniqueConstraintRefs() {}
00707 
00708     public:
00709         /// <summary>Gets the number of items in the collection.</summary>
00710         /// <returns>Returns number of items in the collection</returns> 
00711         static UniqueConstraintRefs* Create()
00712         {
00713             return new  UniqueConstraintRefs();
00714         }
00715     };
00716 
00717     void CopyNetworkAssocProp( FdoPtr<StringsRef> ref );
00718 
00719     // The current Feature Schemas
00720     FdoPtr<FdoFeatureSchemaCollection> mSchemas;
00721     // The Feature Schemas being read from the XML document.
00722     FdoPtr<FdoFeatureSchemaCollection> mUpdSchemas;
00723     FdoFeatureSchema* mUpdSchema;
00724 
00725     FdoPtr<FdoIConnection> mConnection;
00726 
00727     bool mIgnoreStates;
00728     bool mDefaultCapability;
00729     bool mReplaceClass;
00730     bool mCopyElements;
00731 
00732     // Element name to object maps.
00733     FdoPtr<ElementMaps> mElementMaps;
00734     // Base class references
00735     FdoPtr<ClassRefs> mBaseClassRefs;
00736     // Object Property class references
00737     FdoPtr<ClassRefs> mObjPropRefs;
00738     // Associate class reference
00739     FdoPtr<ClassRefs> mAssocPropRefs;
00740     // Identity property references
00741     FdoPtr<StringsRefs> mIdPropRefs;
00742     // Unique constraint references
00743     FdoPtr<UniqueConstraintRefs> mUniConsRefs;
00744     // Object Property identity property references
00745     FdoPtr<StringsRefs> mObjIdPropRefs;
00746 
00747     // Network Node association property references
00748     FdoPtr<StringsRefs> mNetworkNodeAssocPropRefs;
00749     // Network Link Start association property reference
00750     FdoPtr<StringsRefs> mNetworkLinkStartAssocPropRefs;
00751     // Network Link End association property reference
00752     FdoPtr<StringsRefs> mNetworkLinkEndAssocPropRefs;
00753     // Network Feature Cost property reference
00754     FdoPtr<StringsRefs> mNetworkFeatureCostPropRefs;
00755     // Network Feature network property reference
00756     FdoPtr<StringsRefs> mNetworkFeatureNetworkPropRefs;
00757     // Network Feature reference feature property reference
00758     FdoPtr<StringsRefs> mNetworkFeatureRefFeatPropRef;
00759     // Network Feature parent network feature property reference
00760     FdoPtr<StringsRefs> mNetworkFeatureParentNetworkFeatPropRef;
00761     // Network reference 
00762     FdoPtr<ClassRefs> mNetworkRefs;
00763 
00764     // Association Property identity property references
00765     FdoPtr<StringsRefs> mAssocIdPropRefs;
00766     // Association Property identity reverse property references
00767     FdoPtr<StringsRefs> mAssocIdReversePropRefs;
00768 
00769     // Geometry property references.
00770     FdoPtr<StringsRefs> mGeomPropRefs;
00771 
00772     FdoXmlFlags::ErrorLevel mErrorLevel;
00773 
00774     FdoDictionaryP mClassHasObjects;
00775 };
00776 
00777 /// \brief
00778 /// FdoSchemaMergeContextP is a FdoPtr on FdoSchemaMergeContext, provided for convenience.
00779 typedef FdoPtr<FdoSchemaMergeContext> FdoSchemaMergeContextP;
00780 /// \endcond
00781 
00782 #endif
00783 
00784 

Comments or suggestions? Send us feedback.