| 1 | = !MapGuide RFC 77 - Create Feature Source = |
| 2 | |
| 3 | This page contains an change request (RFC) for the !MapGuide Open Source project. |
| 4 | More !MapGuide RFCs can be found on the [wiki:MapGuideRfcs RFCs] page. |
| 5 | |
| 6 | |
| 7 | == Status == |
| 8 | |
| 9 | ||RFC Template Version||(1.0)|| |
| 10 | ||Submission Date||July 09, 2009|| |
| 11 | ||Last Modified||Leaf Li [[Timestamp]]|| |
| 12 | ||Author||Leaf Li|| |
| 13 | ||RFC Status||draft|| |
| 14 | ||Implementation Status||under development|| |
| 15 | ||Proposed Milestone||2.2|| |
| 16 | ||Assigned PSC guide(s)||Bruce || |
| 17 | ||'''Voting History'''||(vote date)|| |
| 18 | ||+1|||| |
| 19 | ||+0|||| |
| 20 | ||-0|||| |
| 21 | ||-1|| |
| 22 | ||no vote|| || |
| 23 | |
| 24 | == Overview == |
| 25 | |
| 26 | This proposal is to extend MapGuide Feature Service to support applying schema. |
| 27 | |
| 28 | == Motivation == |
| 29 | |
| 30 | 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. |
| 31 | |
| 32 | == Proposed Solution == |
| 33 | |
| 34 | ==== Changes to !MgFeatureSchema, !MgClassDefinition and !MgPropertyDefinition ==== |
| 35 | |
| 36 | !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. |
| 37 | |
| 38 | {{{ |
| 39 | /// \brief |
| 40 | /// Contains one or more feature class definitions, which specify the structure |
| 41 | /// of feature data in a datastore. |
| 42 | class MgFeatureSchema: public MgNamedSerializable |
| 43 | { |
| 44 | PUBLISHED_API: |
| 45 | ...... |
| 46 | /// \brief |
| 47 | /// Marks the schema for deletion. |
| 48 | /// |
| 49 | /// \return |
| 50 | /// Returns nothing. |
| 51 | void Delete(); |
| 52 | }; |
| 53 | |
| 54 | /// \brief |
| 55 | /// Defines a feature class belonging to a schema. |
| 56 | class MgClassDefinition: public MgNamedSerializable |
| 57 | { |
| 58 | PUBLISHED_API: |
| 59 | ...... |
| 60 | /// \brief |
| 61 | /// Marks the class for deletion. |
| 62 | /// |
| 63 | /// \return |
| 64 | /// Returns nothing. |
| 65 | void Delete(); |
| 66 | }; |
| 67 | |
| 68 | /// \brief |
| 69 | /// Defines the base class for the concreate property definition classes which |
| 70 | /// are used to create data, geometric, object, and raster property definitions. |
| 71 | class MgPropertyDefinition: public MgProperty |
| 72 | { |
| 73 | PUBLISHED_API: |
| 74 | ...... |
| 75 | /// \brief |
| 76 | /// Marks the property for deletion. |
| 77 | /// |
| 78 | /// \return |
| 79 | /// Returns nothing. |
| 80 | void Delete(); |
| 81 | }; |
| 82 | }}} |
| 83 | |
| 84 | ==== Changes to Feature Service ==== |
| 85 | |
| 86 | Feature Service will be extended to add one method to apply a schema. |
| 87 | |
| 88 | {{{ |
| 89 | class MgFeatureService : public MgService |
| 90 | { |
| 91 | PUBLISHED_API: |
| 92 | /// \brief |
| 93 | /// Creates or updates a feature schema within the DataStore. |
| 94 | /// |
| 95 | /// \param resource (MgResourceIdentifier) |
| 96 | /// A resource identifier referring to a feature source. |
| 97 | /// \param schema |
| 98 | /// Input schema to be created or updated. |
| 99 | /// |
| 100 | /// \return |
| 101 | /// Returns nothing. |
| 102 | /// |
| 103 | virtual void ApplySchema( |
| 104 | MgResourceIdentifier* resource, |
| 105 | MgFeatureSchema* schema) = 0; |
| 106 | }; |
| 107 | }}} |
| 108 | |
| 109 | ==== Changes to !MgPropertyType ==== |
| 110 | |
| 111 | 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. |
| 112 | |
| 113 | {{{ |
| 114 | class MgPropertyType |
| 115 | { |
| 116 | PUBLISHED_API: |
| 117 | ...... |
| 118 | /////////////////////////////////////////////////// |
| 119 | /// \brief |
| 120 | /// Type name for a decimal property. |
| 121 | /// |
| 122 | /// \remarks |
| 123 | /// This property type name is currently used to |
| 124 | /// apply schema only. |
| 125 | static const int Decimal = 15; |
| 126 | }; |
| 127 | }}} |
| 128 | |
| 129 | == Implications == |
| 130 | |
| 131 | This is new API only. There are no effects on existing applications. However, API documentation need to be updated. |
| 132 | |
| 133 | == Test Plan == |
| 134 | |
| 135 | Add unit tests for method MgFeatureService::!ApplySchema(...) into the existing Feature Service unit tests. |
| 136 | |
| 137 | == Funding/Resources == |
| 138 | |
| 139 | Supplied by Autodesk. |