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 
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 
00269     FDO_API virtual bool CanModGeomTypes( FdoGeometricPropertyDefinition* prop );
00270     FDO_API virtual bool CanModGeomElevation( FdoGeometricPropertyDefinition* prop );
00271     FDO_API virtual bool CanModGeomMeasure( FdoGeometricPropertyDefinition* prop );
00272     FDO_API virtual bool CanModGeomSC( FdoGeometricPropertyDefinition* prop );
00273     FDO_API virtual bool CanModGeomReadOnly( FdoGeometricPropertyDefinition* prop );
00274 
00275     FDO_API virtual bool CanModAssocClass( FdoAssociationPropertyDefinition* prop );
00276     FDO_API virtual bool CanModAssocReverseName( FdoAssociationPropertyDefinition* prop );
00277     FDO_API virtual bool CanModAssocDeleteRule( FdoAssociationPropertyDefinition* prop );
00278     FDO_API virtual bool CanModAssocLockCascade( FdoAssociationPropertyDefinition* prop );
00279     FDO_API virtual bool CanModAssocMultiplicity( FdoAssociationPropertyDefinition* prop );
00280     FDO_API virtual bool CanModAssocReverseMultiplicity( FdoAssociationPropertyDefinition* prop );
00281     FDO_API virtual bool CanModAssocIdentity( FdoAssociationPropertyDefinition* prop );
00282     FDO_API virtual bool CanModAssocReverseIdentity( FdoAssociationPropertyDefinition* prop );
00283     FDO_API virtual bool CanModAssocReadOnly( FdoAssociationPropertyDefinition* prop );
00284 
00285     FDO_API virtual bool CanModObjClass( FdoObjectPropertyDefinition* prop );
00286     FDO_API virtual bool CanModObjId( FdoObjectPropertyDefinition* prop );
00287     FDO_API virtual bool CanModObjType( FdoObjectPropertyDefinition* prop );
00288     FDO_API virtual bool CanModObjOrder( FdoObjectPropertyDefinition* prop );
00289 
00290     FDO_API virtual bool CanModRasterReadOnly( FdoRasterPropertyDefinition* prop );
00291     FDO_API virtual bool CanModRasterNullable( FdoRasterPropertyDefinition* prop );
00292     FDO_API virtual bool CanModRasterModel( FdoRasterPropertyDefinition* prop );
00293     FDO_API virtual bool CanModRasterXSize( FdoRasterPropertyDefinition* prop );
00294     FDO_API virtual bool CanModRasterYSize( FdoRasterPropertyDefinition* prop );
00295     FDO_API virtual bool CanModRasterSC( FdoRasterPropertyDefinition* prop );
00296 
00297     /// \brief
00298     /// Checks if a class has objects.
00299     ///
00300     /// \warning This function is used as a pre-check to see if a class definition can 
00301     /// be deleted. However, there is a chance that the class has no objects when this
00302     /// check is done, but an object is created by someone else before the class is 
00303     /// deleted. Providers that need to prevent this race condition can do so by 
00304     /// extending this function.
00305     /// 
00306     /// \param classDef
00307     /// Input the class to check
00308     ///
00309     /// \return
00310     /// Returns true if the class has objects ( the datastore for the current connection
00311     /// is checked for objects).
00312     /// Returns false if the class does not have objects or this context does not have
00313     /// a connection.
00314     FDO_API virtual bool ClassHasObjects( FdoClassDefinition* classDef );
00315 
00316     // When the schemas are merged. references between schema elements cannot be resolved
00317     // right away, since the referenced element might not yet have been copied to the 
00318     // schemas to update. Therefore, the merge process simply builds lists of these
00319     // references and then resolves them after the merge is complete. 
00320 
00321     // The following functions support building the lists of referneces
00322 
00323     // Add reference between qualified name of schema element and actual object.
00324     // This may start as an element in the second set of schemas, but then changes
00325     // to the corresponding element in the schemas to update, after the element
00326     // has been copied to the schemas to update
00327     void AddElementMap( FdoSchemaElement* pElement );
00328 
00329     // Adds a reference between a class and its base class.
00330     // These references are resolved after all the classes have been read.
00331     //
00332     // Parameters:
00333     //      pReferencer - the class.
00334     //      schemaName - base class schema name.
00335     //      className - base class name.
00336     void AddBaseClassRef( FdoClassDefinition* pReferencer, FdoString* schemaName, FdoString* className );
00337 
00338     // Adds a reference between an object property and its class.
00339     // These references are resolved after all the classes have been read.
00340     //
00341     // Parameters:
00342     //      pReferencer - the object property.
00343     //      schemaName - class schema name.
00344     //      className - class name.
00345     void AddObjPropRef( FdoObjectPropertyDefinition* pReferencer, FdoString* schemaName, FdoString* className );
00346 
00347 
00348     // Adds a reference between a network node feature class and the layer association proeprty.
00349     //
00350     // Parameters:
00351     //      pReferencer - the network node feature class.
00352     //      assoc - the layer association property name
00353     //      
00354     void AddNetworkNodeAssocPropRef( FdoNetworkNodeFeatureClass* pReferencer, FdoString* assoc );
00355 
00356     // Adds a reference between a network link feature class and the start association property.
00357     //
00358     // Parameters:
00359     //      pReferencer - the network link feature class.
00360     //      assoc - the start association property name
00361     void AddNetworkLinkStartAssocPropRef( FdoNetworkLinkFeatureClass* pReferencer, FdoString* assoc );
00362 
00363     // Adds a reference between a network link feature class and the end association property.
00364     //
00365     // Parameters:
00366     //      pReferencer - the network link feature class.
00367     //      assoc - the end association property name
00368     void AddNetworkLinkEndAssocPropRef( FdoNetworkLinkFeatureClass* pReferencer, FdoString* assoc );
00369 
00370     // Adds a reference between a network feature class and the cost association property.
00371     // These references are resolved after all the classes have been read.
00372     //
00373     // Parameters:
00374     //      pReferencer - the network feature class
00375     //      cost - the cost association property name
00376     void AddNetworkFeatureCostPropRef( FdoNetworkFeatureClass* pReferencer, FdoString* cost );
00377 
00378 
00379     // Adds a reference between a network feature and the network property association property.
00380     // These references are resolved after all the classes have been read.
00381     //
00382     // Parameters:
00383     //      pReferencer - the network feature class
00384     //      networkProp - the association network property name
00385     void AddNetworkFeatureNetworkPropRef( FdoNetworkFeatureClass* pReferencer, FdoString* networkProp );
00386 
00387     // Adds a reference between a network feature class and the reference feature association property.
00388     // These references are resolved after all the classes have been read.
00389     //
00390     // Parameters:
00391     //      pReferencer - the network feature class
00392     //      refFeatProp - the reference feature property association name
00393     void AddNetworkFeatureRefFeatPropRef( FdoNetworkFeatureClass* pReferencer, FdoString* refFeatProp );
00394 
00395     // Adds a reference between a network feature class and the parent network feature assocaition property.
00396     // These references are resolved after all the classes have been read.
00397     //
00398     // Parameters:
00399     //      pReferencer - the network feature class
00400     //      parentNetworkFeatProp - the parent network feature association property name
00401     void AddNetworkFeatureParentNetworkFeatPropRef( FdoNetworkFeatureClass* pReferencer, FdoString* parentNetworkFeatProp );
00402 
00403     // Adds a reference between a network class and its layer class.
00404     // These references are resolved after all the classes have been read.
00405     //
00406     // Parameters:
00407     //      pReferencer - the network class.
00408     //      schemaName - class schema name.
00409     //      className - class name.
00410     void AddNetworkClassRef( FdoNetworkClass* pReferencer, FdoString* schemaName, FdoString* className );
00411 
00412 
00413     // Adds a reference between a associate property and its associated class.
00414     // These references are resolved after all the classes have been read.
00415     //
00416     // Parameters:
00417     //      pReferencer - the associate property.
00418     //      schemaName - associate class schema name.
00419     //      className - associate class name.
00420     void AddAssocPropRef( FdoAssociationPropertyDefinition* pReferencer, FdoString* schemaName, FdoString* className );
00421 
00422     // Adds a reference between a class and its identity properties.
00423     // These references are resolved after all the classes have been read.
00424     //
00425     // Parameters:
00426     //      pReferencer - the class
00427     //      idProps - the identity property names.
00428     void AddIdPropRef( FdoClassDefinition* pReferencer, FdoStringsP idProps );
00429 
00430     // Adds a reference between a class' unique constraint and its properties.
00431     // These references are resolved after all the classes have been read.
00432     //
00433     // Parameters:
00434     //      pReferencer - the class
00435     //      pUniConsRef - this class's unique constraint
00436     //      props - the property names.
00437     void AddUniqueConstraintRef( FdoClassDefinition* pClsRef, FdoUniqueConstraint* pUniConsRef, FdoStringsP props );
00438 
00439     // Adds a reference between an object property and its identity property.
00440     // These references are resolved after all the classes have been read.
00441     //
00442     // Parameters:
00443     //      pReferencer - the object property
00444     //      idProp - the identity property name.
00445     void AddObjIdPropRef( FdoObjectPropertyDefinition* pReferencer, FdoString* idProp );
00446     
00447     // Adds a reference between an association property and its identity properties.
00448     // These references are resolved after all the classes have been read.
00449     //
00450     // Parameters:
00451     //      pReferencer - the association property
00452     //      idProps - the identity property names.
00453     void AddAssocIdPropRef( FdoAssociationPropertyDefinition* pReferencer, FdoStringsP idProps );
00454 
00455     void AddAssocIdReversePropRef( FdoAssociationPropertyDefinition* pReferencer, FdoStringsP idProps );
00456 
00457     // Adds a reference between a feature class and its geometry property.
00458     // These references are resolved after all the classes have been read.
00459     //
00460     // Parameters:
00461     //      pReferencer - the feature class
00462     //      geomProp - the geometry property name.
00463     void AddGeomPropRef( FdoFeatureClass* pReferencer, FdoString* geomProp );
00464 
00465     FdoClassDefinition* FindClass( FdoFeatureSchemaCollection* pSchemas, FdoClassDefinition* pClass );
00466     // Find a class in the given schema collection.
00467     FdoClassDefinition* FindClass( FdoFeatureSchemaCollection* pSchemas, const FdoString* schemaName, const FdoString* className );
00468     
00469     bool CheckModDataConstraint( FdoDataPropertyDefinition* oldProp, FdoDataPropertyDefinition* newProp );
00470 
00471 protected:
00472     FDO_API FdoSchemaMergeContext() {}
00473     FDO_API FdoSchemaMergeContext( FdoFeatureSchemaCollection* schemas, bool defaultCapability = false );
00474     FDO_API virtual ~FdoSchemaMergeContext();
00475 
00476 private:
00477     // Merge the schemas that were read, into the schema collection.
00478     void MergeSchemas();
00479     void MergeSchema( FdoFeatureSchema* newSchema );
00480 
00481     void CheckReferences();
00482 
00483     // Various functions for resolving references.
00484     void ResolveBaseClasses();
00485     void ResolveObjPropClasses();
00486     void ResolveAssociatedPropClasses();
00487     void ResolveNetworkLinkProps();
00488     void ResolveNetworkProps();
00489     void ResolveNetworkNodeProps();
00490     void ResolveNetworkFeatureProps();
00491     void ResolveIdProps();
00492     void ResolveObjIdProps();
00493     void ResolveAssocIdProps();
00494     void ResolveAssocIdReverseProps();
00495     void ResolveGeomProps();
00496     void ResolveUniqueConstraints();
00497     // For each referencing class, without geometryProperty, pick a geometryProperty
00498     // for it. One is pick only if there is only geometric property on the class and
00499     // all of its ancestors.
00500     void ResolveDefaultGeomProps();
00501 
00502     FdoSchemaElement* MapElement( FdoSchemaElement* pElement );
00503 
00504     // Various functions for finding FDO elements. 
00505 
00506     // Find a class property. Walks up the base classes until the property is found.
00507     FdoPropertyDefinition* FindProperty( FdoClassDefinition* pClass, const FdoString* propName, FdoBoolean checkUpdSchemas = true );
00508     // Find an identity property. Checks the topmost base class.
00509     FdoDataPropertyDefinition* GetIdProperty( FdoClassDefinition* pClass, const FdoInt32 idx, FdoBoolean checkUpdSchemas = true );
00510 
00511     // Gets the topmost base class for a class.
00512     FdoClassDefinition* GetTopClass( FdoClassDefinition* pClass );
00513     // Gets the base class for a class. Gets the most recent object. Returns the
00514     // object read from XML. If the base class was not read from XML then its
00515     // original object is returned.
00516     FdoClassDefinition* GetBaseClass( FdoClassDefinition* pClass );
00517 
00518     // Definition for a reference to a class.
00519     class ElementMap : public FdoIDisposable 
00520     {
00521     public:
00522         static ElementMap* Create( FdoSchemaElement* pElement );
00523 
00524         // Get the referencing element.
00525         FdoSchemaElement* GetElement();
00526         void SetElement( FdoSchemaElement* pElement );
00527         FdoStringP GetName(); 
00528 
00529         // Indicates that this object does not allow its name
00530         // to change. Not allowing name change allows more efficient 
00531         // random access to FdoDictionary.
00532         virtual FdoBoolean CanSetName()
00533         {
00534             return false;
00535         }
00536 
00537     protected:
00538         ElementMap() {}
00539         ElementMap( FdoSchemaElement* pReferencer );
00540         virtual ~ElementMap() {}
00541 
00542         virtual void Dispose();
00543 
00544     private:
00545         FdoSchemaElementP mElement;
00546         FdoStringP mElementName;
00547     };
00548     
00549     // Collection of references to classes.
00550     class ElementMaps : public FdoNamedCollection<ElementMap,FdoException>
00551     {
00552     protected:
00553         virtual void Dispose();
00554 
00555         ElementMaps() {}
00556 
00557     public:
00558         /// <summary>Gets the number of items in the collection.</summary>
00559         /// <returns>Returns number of items in the collection</returns> 
00560         static ElementMaps* Create()
00561         {
00562             return new  ElementMaps();
00563         }
00564     };
00565 
00566     // Definition for a reference to a class.
00567     class ClassRef : public FdoIDisposable 
00568     {
00569     public:
00570         static ClassRef* Create( FdoSchemaElement* pReferencer, FdoStringP schemaName, FdoStringP className );
00571 
00572         // Get the referencing element.
00573         FdoSchemaElement* GetReferencer();
00574         void SetReferencer( FdoSchemaElement* referencer );
00575         FdoSchemaElement* GetNewReferenced();
00576         void SetNewReferenced( FdoSchemaElement* pNewReferenced );
00577         FdoStringP GetSchemaName();
00578         FdoStringP GetClassName();
00579         FdoStringP GetName(); 
00580 
00581         // Indicates that this object does not allow its name
00582         // to change. Not allowing name change allows more efficient 
00583         // random access to FdoDictionary.
00584         virtual FdoBoolean CanSetName()
00585         {
00586             return false;
00587         }
00588 
00589     protected:
00590         ClassRef() {}
00591         ClassRef( FdoSchemaElement* pReferencer, FdoStringP schemaName, FdoStringP className );
00592         virtual ~ClassRef() {}
00593 
00594         virtual void Dispose();
00595 
00596     private:
00597         FdoSchemaElementP mReferencer;
00598         FdoSchemaElementP mNewReferenced;
00599         FdoStringP mReferencerName;
00600         FdoStringP mSchemaName;
00601         FdoStringP mClassName;
00602     };
00603     
00604     // Collection of references to classes.
00605     class ClassRefs : public FdoNamedCollection<ClassRef,FdoException>
00606     {
00607     protected:
00608         virtual void Dispose();
00609 
00610         ClassRefs() {}
00611 
00612     public:
00613         /// <summary>Gets the number of items in the collection.</summary>
00614         /// <returns>Returns number of items in the collection</returns> 
00615         static ClassRefs* Create()
00616         {
00617             return new  ClassRefs();
00618         }
00619     };
00620 
00621     // Definition of a reference to a collection of strings.
00622     class StringsRef : public FdoIDisposable 
00623     {
00624     public:
00625         static StringsRef* Create( FdoSchemaElement* pReferencer, FdoStringsP strings );
00626 
00627         FdoSchemaElement* GetReferencer();
00628         void SetReferencer( FdoSchemaElement* referencer );
00629         FdoStringsP GetStrings();
00630         FdoStringP GetName(); 
00631 
00632         // Indicates that this object does not allow its name
00633         // to change. Not allowing name change allows more efficient 
00634         // random access to FdoDictionary.
00635         virtual FdoBoolean CanSetName()
00636         {
00637             return false;
00638         }
00639 
00640     protected:
00641         StringsRef() {}
00642         StringsRef( FdoSchemaElement* pReferencer, FdoStringsP strings );
00643         virtual ~StringsRef() {}
00644 
00645         virtual void Dispose();
00646 
00647     private:
00648         FdoPtr<FdoSchemaElement> mReferencer;
00649         FdoStringsP mStrings;
00650         FdoStringP mQName;
00651     };
00652     
00653     // Collection of references to string collections
00654     class StringsRefs : public FdoNamedCollection<StringsRef,FdoException>
00655     {
00656     protected:
00657         virtual void Dispose();
00658 
00659         StringsRefs() {}
00660 
00661     public:
00662         /// <summary>Gets the number of items in the collection.</summary>
00663         /// <returns>Returns number of items in the collection</returns> 
00664         static StringsRefs* Create()
00665         {
00666             return new  StringsRefs();
00667         }
00668     };
00669 
00670     // Definition of a reference to unique constraint
00671     class UniqueConstraintRef : public FdoDisposable
00672     {
00673     public:
00674         static UniqueConstraintRef* Create( FdoClassDefinition* pClsRef, FdoUniqueConstraint* pUniConsRef, FdoStringsP strings );
00675 
00676         FdoClassDefinition* GetRefClass();
00677         void SetRefClass( FdoClassDefinition* referencer );
00678         FdoUniqueConstraint* GetRefUniqueConstraint();
00679         FdoStringsP GetStrings();
00680         FdoStringP GetName(); 
00681 
00682         // Indicates that this object does not allow its name
00683         // to change. Not allowing name change allows more efficient 
00684         // random access to FdoDictionary.
00685         virtual FdoBoolean CanSetName()
00686         {
00687             return false;
00688         }
00689 
00690     protected:
00691         UniqueConstraintRef() {}
00692         UniqueConstraintRef( FdoClassDefinition* pClsRef, FdoUniqueConstraint* pUniConsRef, FdoStringsP strings );
00693         virtual ~UniqueConstraintRef() {}
00694 
00695     private:
00696         FdoPtr<FdoClassDefinition> mClsRef;
00697         FdoPtr<FdoUniqueConstraint> mUniConsRef;
00698         FdoStringsP mStrings;
00699         FdoStringP mQName;
00700     };
00701 
00702     // Collection of references to unique constraint references
00703     class UniqueConstraintRefs : public FdoNamedCollection<UniqueConstraintRef,FdoException>
00704     {
00705     protected:
00706         virtual void Dispose();
00707 
00708         UniqueConstraintRefs() {}
00709 
00710     public:
00711         /// <summary>Gets the number of items in the collection.</summary>
00712         /// <returns>Returns number of items in the collection</returns> 
00713         static UniqueConstraintRefs* Create()
00714         {
00715             return new  UniqueConstraintRefs();
00716         }
00717     };
00718 
00719     void CopyNetworkAssocProp( FdoPtr<StringsRef> ref );
00720 
00721     // The current Feature Schemas
00722     FdoPtr<FdoFeatureSchemaCollection> mSchemas;
00723     // The Feature Schemas being read from the XML document.
00724     FdoPtr<FdoFeatureSchemaCollection> mUpdSchemas;
00725     FdoFeatureSchema* mUpdSchema;
00726 
00727     FdoPtr<FdoIConnection> mConnection;
00728 
00729     bool mIgnoreStates;
00730     bool mDefaultCapability;
00731     bool mReplaceClass;
00732     bool mCopyElements;
00733 
00734     // Element name to object maps.
00735     FdoPtr<ElementMaps> mElementMaps;
00736     // Base class references
00737     FdoPtr<ClassRefs> mBaseClassRefs;
00738     // Object Property class references
00739     FdoPtr<ClassRefs> mObjPropRefs;
00740     // Associate class reference
00741     FdoPtr<ClassRefs> mAssocPropRefs;
00742     // Identity property references
00743     FdoPtr<StringsRefs> mIdPropRefs;
00744     // Unique constraint references
00745     FdoPtr<UniqueConstraintRefs> mUniConsRefs;
00746     // Object Property identity property references
00747     FdoPtr<StringsRefs> mObjIdPropRefs;
00748 
00749     // Network Node association property references
00750     FdoPtr<StringsRefs> mNetworkNodeAssocPropRefs;
00751     // Network Link Start association property reference
00752     FdoPtr<StringsRefs> mNetworkLinkStartAssocPropRefs;
00753     // Network Link End association property reference
00754     FdoPtr<StringsRefs> mNetworkLinkEndAssocPropRefs;
00755     // Network Feature Cost property reference
00756     FdoPtr<StringsRefs> mNetworkFeatureCostPropRefs;
00757     // Network Feature network property reference
00758     FdoPtr<StringsRefs> mNetworkFeatureNetworkPropRefs;
00759     // Network Feature reference feature property reference
00760     FdoPtr<StringsRefs> mNetworkFeatureRefFeatPropRef;
00761     // Network Feature parent network feature property reference
00762     FdoPtr<StringsRefs> mNetworkFeatureParentNetworkFeatPropRef;
00763     // Network reference 
00764     FdoPtr<ClassRefs> mNetworkRefs;
00765 
00766     // Association Property identity property references
00767     FdoPtr<StringsRefs> mAssocIdPropRefs;
00768     // Association Property identity reverse property references
00769     FdoPtr<StringsRefs> mAssocIdReversePropRefs;
00770 
00771     // Geometry property references.
00772     FdoPtr<StringsRefs> mGeomPropRefs;
00773 
00774     FdoXmlFlags::ErrorLevel mErrorLevel;
00775 
00776     FdoDictionaryP mClassHasObjects;
00777 };
00778 
00779 /// \brief
00780 /// FdoSchemaMergeContextP is a FdoPtr on FdoSchemaMergeContext, provided for convenience.
00781 typedef FdoPtr<FdoSchemaMergeContext> FdoSchemaMergeContextP;
00782 /// \endcond
00783 
00784 #endif
00785 
00786 

Comments or suggestions? Send us feedback.