= !MapGuide RFC 70 - Apply Schema = This page contains an change request (RFC) for the !MapGuide Open Source project. More !MapGuide RFCs can be found on the [wiki:MapGuideRfcs RFCs] page. == Status == ||RFC Template Version||(1.0)|| ||Submission Date||June 26, 2009|| ||Last Modified||Leaf Li [[Timestamp]]|| ||Author||Leaf Li|| ||RFC Status||adopted|| ||Implementation Status||implemented|| ||Proposed Milestone||2.2|| ||Assigned PSC guide(s)||Bruce Dechant|| ||'''Voting History'''||July 10, 2009|| ||+1||Andy, Bob, Bruce, Jason, Kenneth, Paul, Tom|| ||+0|||| ||-0|||| ||-1|| ||no vote||Haris|| == Overview == This proposal is to extend MapGuide Feature Service to support applying schema. == Motivation == Currently MapGuide Web API doesn’t support any functionality to create or modify schema of a feature source. The RFC is used to eliminate this limitation. == Proposed Solution == ==== Changes to !MgFeatureSchema, !MgClassDefinition and !MgPropertyDefinition ==== !ApplySchema need not only support adding, modifying but also support deleting schema elements. So we need a method to mark the schema element for deletion. The method Delete() will be added to classes !MgFeatureSchema, !MgClassDefinition, !MgPropertyDefinition for it. {{{ /// \brief /// Contains one or more feature class definitions, which specify the structure /// of feature data in a datastore. class MgFeatureSchema: public MgNamedSerializable { PUBLISHED_API: ...... /// \brief /// Marks the schema for deletion. /// /// \return /// Returns nothing. void Delete(); }; /// \brief /// Defines a feature class belonging to a schema. class MgClassDefinition: public MgNamedSerializable { PUBLISHED_API: ...... /// \brief /// Marks the class for deletion. /// /// \return /// Returns nothing. void Delete(); }; /// \brief /// Defines the base class for the concreate property definition classes which /// are used to create data, geometric, object, and raster property definitions. class MgPropertyDefinition: public MgProperty { PUBLISHED_API: ...... /// \brief /// Marks the property for deletion. /// /// \return /// Returns nothing. void Delete(); }; }}} ==== Changes to Feature Service ==== Feature Service will be extended to add one method to apply a schema. {{{ class MgFeatureService : public MgService { PUBLISHED_API: /// \brief /// Creates or updates a feature schema within the DataStore. /// /// \param resource (MgResourceIdentifier) /// A resource identifier referring to a feature source. /// \param schema /// Input schema to be created or updated. /// /// \return /// Returns nothing. /// virtual void ApplySchema( MgResourceIdentifier* resource, MgFeatureSchema* schema) = 0; }; }}} ==== Changes to !MgPropertyType ==== Many FDO data sources support decimal property type. Users can add a decimal property in a feature class in those datasources. However, class !MgPropertyType doesn't define a decimal property type. So we will extend class !MgPropertyType to add a new type name 'Decimal' so that method MgFeatureService::!ApplySchema(...) can handle the decimal property. {{{ class MgPropertyType { PUBLISHED_API: ...... /////////////////////////////////////////////////// /// \brief /// Type name for a decimal property. /// /// \remarks /// This property type name is currently used to /// apply schema only. static const int Decimal = 15; }; }}} == Implications == This is new API only. There are no effects on existing applications. However, API documentation need to be updated. == Test Plan == Add unit tests for method MgFeatureService::!ApplySchema(...) into the existing Feature Service unit tests. == Funding/Resources == Supplied by Autodesk.