| 1 | = !MapGuide RFC 21 - Expose functionality for manipulating Runtime map, using Xml format = |
| 2 | |
| 3 | This page contains a change request (RFC) for the !MapGuide Open Source project. |
| 4 | More !MapGuide RFCs can be found on the [wiki:MapGuideRfcs RFCs] page. |
| 5 | |
| 6 | == Status == |
| 7 | |
| 8 | ||RFC Template Version||(1.0)|| |
| 9 | ||Submission Date||May 7, 2007|| |
| 10 | ||Last Modified||Kenneth, GEOGRAF A/S [[Timestamp]]|| |
| 11 | ||Author||Kenneth, GEOGRAF A/S|| |
| 12 | ||RFC Status||draft|| |
| 13 | ||Implementation Status||pending|| |
| 14 | ||Proposed Milestone||1.3|| |
| 15 | ||Assigned PSC guide(s)|||| |
| 16 | ||'''Voting History'''|||| |
| 17 | ||+1|||| |
| 18 | ||+0|||| |
| 19 | ||-0|||| |
| 20 | ||-1|||| |
| 21 | |
| 22 | == Overview == |
| 23 | |
| 24 | This RFC exposes some existing functionality as well as some new functionality for manipulating the runtime map. |
| 25 | |
| 26 | == Motivation == |
| 27 | |
| 28 | The map definition is Xml based, and easy to manipulate. The runtime map is in binary format, and tightly tied to the inner workings of the MapGuide server. It should be expected that the current format will change over time, thus breaking compatibility with external binary reader/writer applications. |
| 29 | |
| 30 | When using the current MapGuide API, the code for creating and maintaining the runtime map is found in code shared by the server and the API. This means that an application must be adapted to fit a specific version of the MapGuide server. Or at least have the correct version of the codebase (eg. dll's). |
| 31 | |
| 32 | == Proposed Solution == |
| 33 | |
| 34 | There already exists code in the server to create a runtime map from a map defintion. |
| 35 | There should be two more functions in the MgMap class: |
| 36 | {{{ |
| 37 | void MgMap::UpdateRuntimeMap(MgResourceService* resourceService, MgResourceIdentifier* mapDefinition, CREFSTRING mapName); |
| 38 | void MgMap::UpdateMapDefinition(MgResourceService* resourceService, MgResourceIdentifier* mapDefinition, CREFSTRING mapName); |
| 39 | }}} |
| 40 | |
| 41 | The UpdateMapDefinition should just overwrite the mapDefinition with the current runtimemap. |
| 42 | The UpdateRuntimeMap should try to sync the runtime map, by settings map properties. This will allow the current change-list scheme to work. |
| 43 | |
| 44 | These two functions should be exposed in the HttpHandler, along with the existing MgMap::CreateMap(...). |
| 45 | |
| 46 | == Considerations == |
| 47 | |
| 48 | This is prone to a race condition, as the client must get a copy of the runtime map, update it, and write it back. There is currently a generation scheme, at least with the Ajax viewer. This can be used to catch such problems. |
| 49 | |
| 50 | There may be an unwanted overhead, as the mapDefinition must be written to the server, resulting in the following scenario: |
| 51 | {{{ |
| 52 | Call UpdateMapDefinition |
| 53 | Download MapDefinition |
| 54 | Modify map on client |
| 55 | Upload MapDefintion |
| 56 | Call UpdateRuntimeMap |
| 57 | }}} |
| 58 | |
| 59 | In some cases it might be more efficient to use these three variants: |
| 60 | {{{ |
| 61 | void MgMap::UpdateRuntimeMap(MgResourceService* resourceService, MgByteReader* mapDefinitionAsXml, CREFSTRING mapName); |
| 62 | MgByteReader* MgMap::MapDefinitionFromRuntimeMap(MgResourceService* resourceService, CREFSTRING mapName); |
| 63 | void MgMap::CreateMap(MgResourceService* resourceService, MgByteReader* mapDefinitionAsXml, CREFSTRING mapName); |
| 64 | }}} |
| 65 | |
| 66 | Which could reduce the number of service calls from 4 to 2: |
| 67 | {{{ |
| 68 | Call MapDefinitionFromRuntimeMap |
| 69 | Modify map on client |
| 70 | Call UpdateRuntimeMap |
| 71 | }}} |
| 72 | |
| 73 | == Implications == |
| 74 | |
| 75 | This RFC is strictly an API enhancement. If the update to the runtime map, is done as a "diff" on the current map (as opposed to overwrite), there should be no compatibility problems. Any errors in this code, will effect only applications using this extension. Worst case would be a corrupted runtime map. |
| 76 | |
| 77 | == Test Plan == |
| 78 | |
| 79 | Write a small test application that calls the functions through the HttpHandler. Should be very easy to test. |
| 80 | |
| 81 | == Funding/Resources == |
| 82 | |
| 83 | Community contributed enhancement. |