- Main Page
- Related Pages
- Modules
- Classes
- Files

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

Please send us your comment about this page