Changes between Initial Version and Version 1 of MapGuideRfc182


Ignore:
Timestamp:
Aug 4, 2020, 6:52:56 AM (4 years ago)
Author:
jng
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • MapGuideRfc182

    v1 v1  
     1
     2= !MapGuide RFC 182 - Library initialization entry point =
     3
     4This page contains a change request (RFC) for the !MapGuide Open Source project.
     5More !MapGuide RFCs can be found on the [wiki:MapGuideRfcs RFCs] page.
     6
     7== Status ==
     8
     9||RFC Template Version||(1.0)||
     10||Submission Date||4 Aug 2020||
     11||Last Modified||||
     12||Author||Jackie Ng||
     13||RFC Status||draft||
     14||Implementation Status||||
     15||Proposed Milestone||4.0||
     16||Assigned PSC guide(s)||(when determined)||
     17||'''Voting History'''||(vote date)||
     18||+1||||
     19||+0||||
     20||-0||||
     21||-1||||
     22||no vote|| ||
     23
     24== Overview ==
     25
     26This RFC proposes to add a new `MgInitializeLibrary` API for properly initializing the MapGuide API when used in a class library context.
     27
     28== Motivation ==
     29
     30Although an uncommon use case, it is possible to use the following parts of the MapGuide API in a context that is free of any dependencies to a MapGuide Server or Web Tier.
     31
     32 * `Foundation` (exposed to .net via the `OSGeo.MapGuide.Foundation.dll` assembly)
     33 * `Geometry` (exposed to .net via the `OSGeo.MapGuide.Geometry.dll` assembly)
     34 * `PlatformBase` (exposed to .net via the `OSGeo.MapGuide.PlatformBase.dll` assembly)
     35
     36An example of this usage is FDO Toolbox, where this subset of the MapGuide API is used to provide coordinate system lookup and transfomration services through the `MgCoordinateSystem` family of APIs.
     37
     38However, usage of the MapGuide API in this context reveals a major teething issue around exceptions. Namely any exceptions thrown in this context will not have localizable error messages because the MapGuide API has not initialized with an appropriate string bundle. As a result, exceptions thrown from the MapGuide API in this particular context will not contain any useful error messages.
     39
     40There is also the risk that we may be using code that uses the ACE library in an un-initialized state
     41
     42Normal MapGuide web applications do not have this problem as they call `MgInitializeWebTier` that will set up the localizable strings among other things. This API however, only exists in the `WebSupport` (exposed to .net via the `OSGeo.MapGuide.Web.dll` assembly) and is not available to applications using the `Foundation`/`Geometry`/`PlatformBase` subset.
     43
     44== Proposed Solution ==
     45
     46Add new `MgInitializeLibrary` and `MgUninitializeLibrary` APIs to `Foundation`
     47
     48{{{
     49
     50void MgInitializeLibrary(CREFSTRING stringResourcesPath, CREFSTRING locale);
     51
     52void MgUnintializeLibrary();
     53}}}
     54
     55The `MgInitializeLibrary` API will initialize the MapGuide API with the given path to the localized string bundle.
     56
     57To address (https://trac.osgeo.org/mapguide/ticket/1368), this API will also call `ACE::init()` to make sure any usage of ACE in the `Foundation`/`Geometry`/`PlatformBase` subset is used with the ACE library already initialized
     58
     59The `MgUnitializeLibrary` API will call `ACE::fini()` to make sure the ACE library is properly torn down. Calling this API from .net is optional and is provided for completeness.
     60
     61== Implications ==
     62
     63None. These are new APIs and only for the .net variant of the MapGuide API
     64
     65For normal MapGuide web applications, they can (and are expected to) still call `MgInitializeWebTier` as normal and do not have to call this new API.
     66
     67For applications using the `Foundation`/`Geometry`/`PlatformBase` subset, they must call this new `MgInitializeLibrary` API to ensure they get proper error messages in caught exceptions from the MapGuide API.
     68
     69== Test Plan ==
     70
     71Implement a standalone .net application that only references `Foundation`/`Geometry`/`PlatformBase` subset that calls this new API
     72
     73Verify any API that would throw an exception produces localizable error messages when inspecting the caught exception
     74
     75== Funding / Resources ==
     76
     77Community