<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
        {mso-style-priority:99;
        mso-style-link:"Plain Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.5pt;
        font-family:Consolas;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.PlainTextChar
        {mso-style-name:"Plain Text Char";
        mso-style-priority:99;
        mso-style-link:"Plain Text";
        font-family:Consolas;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=EN-US link=blue vlink=purple>
<div class=Section1>
<p class=MsoPlainText>Author: Greg Boone<o:p></o:p></p>
<p class=MsoPlainText>Date: Thursday, March 20, 2008<o:p></o:p></p>
<p class=MsoPlainText>Title: Support accessing WMS custom commands
from Managed code (I)<o:p></o:p></p>
<p class=MsoPlainText>Reviewed by: Romica Dascalescu <o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText>========<o:p></o:p></p>
<p class=MsoPlainText>Abstract<o:p></o:p></p>
<p class=MsoPlainText>========<o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText>This submission tests and resolves issues identified when
attempting to access the following WMS custom commands through the FDO API
managed interface.<o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText>GetFeatureClassStyles<o:p></o:p></p>
<p class=MsoPlainText>GetFeatureClassCRSNames<o:p></o:p></p>
<p class=MsoPlainText>GetImageFormats<o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText>Through testing, it was discovered that no mechanism
existed to allow custom commands created at the provider level to be exposed
through the FDO ICommand Managed interface. The reason why these commands are
not supported is that the creation of the managed wrapper object around the
custom command is attempted in the FDO managed API component, where the WMS
specific managed interfaces are unknown. Only the published non-custom FDO
commands are known at this level. <o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText>To resolve this issue, I fell back on the command pattern
used to resolve a similar issue identified with the provider specific
implementations of FDO PhysicalSchemaMappings. In that case, it was decided
that the provider specific implementation of the PhysicalSchemaMapping
interface would be exposed as a concrete class rather than a derived interface.
As a part of the definition of the concrete class, a constructor would be
defined that accepted the result of the call to IConnection::CreateCommand. It
was then the responsibility of the managed class to construct itself correctly
in a manner by which it is able to interface with the underlying unmanaged
object. <o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText>For the case of the commands mentioned above, the
following concrete classes would have to be defined and exposed for the WMS
provider:<o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText>public __gc class GetFeatureClassStylesCommand : <o:p></o:p></p>
<p class=MsoPlainText> public ICommandImp, <o:p></o:p></p>
<p class=MsoPlainText> public IGetFeatureClassStyles <o:p></o:p></p>
<p class=MsoPlainText>{<o:p></o:p></p>
<p class=MsoPlainText> ...<o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText>public:<o:p></o:p></p>
<p class=MsoPlainText> GetFeatureClassStylesCommand(ICommand* command,
Boolean autoDelete);<o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText> ...<o:p></o:p></p>
<p class=MsoPlainText>}<o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText>public __gc class GetImageFormatsCommand : <o:p></o:p></p>
<p class=MsoPlainText> public ICommandImp, <o:p></o:p></p>
<p class=MsoPlainText> public IGetFeatureClassStyles <o:p></o:p></p>
<p class=MsoPlainText>{<o:p></o:p></p>
<p class=MsoPlainText> ...<o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText>public:<o:p></o:p></p>
<p class=MsoPlainText> GetImageFormatsCommand(ICommand* command, Boolean
autoDelete);<o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText> ...<o:p></o:p></p>
<p class=MsoPlainText>}<o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText>public __gc class GetFeatureClassCRSNamesCommand : <o:p></o:p></p>
<p class=MsoPlainText> public ICommandImp, <o:p></o:p></p>
<p class=MsoPlainText> public IGetFeatureClassStyles <o:p></o:p></p>
<p class=MsoPlainText>{<o:p></o:p></p>
<p class=MsoPlainText> ...<o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText>public: <o:p></o:p></p>
<p class=MsoPlainText> GetFeatureClassCRSNamesCommand(ICommand* command,
Boolean autoDelete);<o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText> ...<o:p></o:p></p>
<p class=MsoPlainText>}<o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText>Here is an example of how the the above wrpapper classes
are to be used:<o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText>IConnectionManager connectionManager = <o:p></o:p></p>
<p class=MsoPlainText>FeatureAccessManager.GetConnectionManager();<o:p></o:p></p>
<p class=MsoPlainText>IConnection mConnection =
connectionManager.CreateConnection("OSGeo.WMS.3.3");<o:p></o:p></p>
<p class=MsoPlainText>mConnection.ConnectionString =
@"FeatureServer=http://www2.dmsolutions.ca/cgi-<o:p></o:p></p>
<p class=MsoPlainText>bin/mswms_gmap";<o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText>ConnectionState state = mConnection.Open();<o:p></o:p></p>
<p class=MsoPlainText>ICommand command =
mConnection.CreateCommand(CommandType_GetImageFormats);<o:p></o:p></p>
<p class=MsoPlainText>GetImageFormatsCommand formatsCmd = new
GetImageFormatsCommand(command, false);<o:p></o:p></p>
<p class=MsoPlainText>StringCollection strColl = formatsCmd.Execute();<o:p></o:p></p>
<p class=MsoPlainText>for (int i = 0; i < strColl.Count; i++) {<o:p></o:p></p>
<p class=MsoPlainText> StringElement strElem = strColl.get_Item(i);<o:p></o:p></p>
<p class=MsoPlainText> string strVal = strElem.String;<o:p></o:p></p>
<p class=MsoPlainText> Console.WriteLine(strVal);<o:p></o:p></p>
<p class=MsoPlainText>}<o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText>mConnection.Close();<o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText>During the implementation of this change, it was
discoverd that there was no <o:p></o:p></p>
<p class=MsoPlainText>means of retrieving the actual string value attached to
the FDO StringElement <o:p></o:p></p>
<p class=MsoPlainText>interface using the managed FDO API. It looks as if the
unmanaged 'FdoString* <o:p></o:p></p>
<p class=MsoPlainText>GetString()' method was never exposed in the managed API.
To resolve this issue, <o:p></o:p></p>
<p class=MsoPlainText>a new interface method will need to be added to
StringElement as follows:<o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText>public __sealed __gc class StringElement : public
Disposable<o:p></o:p></p>
<p class=MsoPlainText>{<o:p></o:p></p>
<p class=MsoPlainText> ...<o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText>public:<o:p></o:p></p>
<p class=MsoPlainText> __property System::String* get_String ();<o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText> ...<o:p></o:p></p>
<p class=MsoPlainText>}<o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText>TESTING PERFORMED:<o:p></o:p></p>
<p class=MsoPlainText><Minimum of regress><o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText>==================<o:p></o:p></p>
<p class=MsoPlainText>Note to Developers<o:p></o:p></p>
<p class=MsoPlainText>==================<o:p></o:p></p>
<p class=MsoPlainText>NONE<o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText>==================================<o:p></o:p></p>
<p class=MsoPlainText>Note to Integration and Build Team<o:p></o:p></p>
<p class=MsoPlainText>==================================<o:p></o:p></p>
<p class=MsoPlainText>NONE<o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText>========<o:p></o:p></p>
<p class=MsoPlainText>Bugfixes<o:p></o:p></p>
<p class=MsoPlainText>========<o:p></o:p></p>
<p class=MsoPlainText>Open Source Ticket #276: Can't access WMS custom commands
from managed code<o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText>================<o:p></o:p></p>
<p class=MsoPlainText>Module by Module<o:p></o:p></p>
<p class=MsoPlainText>================<o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText>******FDO API******<o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText>Modified : <o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText>Fdo/Managed\Src\OSGeo\Common\mgStringElement.cpp<o:p></o:p></p>
<p class=MsoPlainText>Fdo/Managed\Src\OSGeo\Common\mgStringElement.h<o:p></o:p></p>
<p class=MsoPlainText>Fdo/Managed\Src\OSGeo\FDO\Commands\mgICommandImp.cpp<o:p></o:p></p>
<p class=MsoPlainText>Fdo/Managed\Src\OSGeo\FDO\Commands\mgICommandImp.h<o:p></o:p></p>
<p class=MsoPlainText>Fdo/Managed\Src\OSGeo\FDO\mgObjectFactory.cpp<o:p></o:p></p>
<p class=MsoPlainText><br>
<br>
<o:p></o:p></p>
<p class=MsoPlainText>******WMS Provider******<o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText>Modified : <o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText>Providers/WMS/Src\UnitTest\WmsTestCustomCommands.cpp<o:p></o:p></p>
<p class=MsoPlainText>Providers/WMS/Docs\doc_src\Doxyfile_WMS_managed<o:p></o:p></p>
<p class=MsoPlainText>Providers/WMS/Managed\Src\OSGeo\FDO\Providers\WMS\Override\stdafx.h<o:p></o:p></p>
<p class=MsoPlainText>Providers/WMS/Managed\Src\OSGeo\FDO\Providers\WMS\Override\AssemblyVersion.cpp<o:p></o:p></p>
<p class=MsoPlainText>Providers/WMS/Managed\Src\OSGeo\FDO\Providers\WMS\mgIGetFeatureClassCRSNames.h<o:p></o:p></p>
<p class=MsoPlainText>Providers/WMS/Managed\Src\OSGeo\FDO\Providers\WMS\mgIGetFeatureClassCRSNamesImp.cpp<o:p></o:p></p>
<p class=MsoPlainText>Providers/WMS/Managed\Src\OSGeo\FDO\Providers\WMS\mgIGetImageFormats.h<o:p></o:p></p>
<p class=MsoPlainText>Providers/WMS/Managed\Src\OSGeo\FDO\Providers\WMS\mgIGetImageFormatsImp.cpp<o:p></o:p></p>
<p class=MsoPlainText>Providers/WMS/Managed\Src\OSGeo\FDO\Providers\WMS\mgIGetFeatureClassCRSNamesImp.h<o:p></o:p></p>
<p class=MsoPlainText>Providers/WMS/Managed\Src\OSGeo\FDO\Providers\WMS\mgIGetImageFormatsImp.h<o:p></o:p></p>
<p class=MsoPlainText>Providers/WMS/Managed\Src\OSGeo\FDO\Providers\WMS\mgIGetFeatureClassStyles.h<o:p></o:p></p>
<p class=MsoPlainText>Providers/WMS/Managed\Src\OSGeo\FDO\Providers\WMS\mgIGetFeatureClassStylesImp.cpp<o:p></o:p></p>
<p class=MsoPlainText>Providers/WMS/Managed\Src\OSGeo\FDO\Providers\WMS\mgCommandType.h<o:p></o:p></p>
<p class=MsoPlainText>Providers/WMS/Managed\Src\OSGeo\FDO\Providers\WMS\mgIGetFeatureClassStylesImp.h<o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText>Added:<o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText>Providers/WMS/Managed/UnitTest/<o:p></o:p></p>
<p class=MsoPlainText>Providers/WMS/Managed/UnitTest/Framework/<o:p></o:p></p>
<p class=MsoPlainText>Providers/WMS/Managed/UnitTest/Framework/BaseTest.cs<o:p></o:p></p>
<p class=MsoPlainText>Providers/WMS/Managed/UnitTest/Framework/BaseTestWithConnection.cs<o:p></o:p></p>
<p class=MsoPlainText>Providers/WMS/Managed/UnitTest/Framework/IConnectionProvider.cs<o:p></o:p></p>
<p class=MsoPlainText>Providers/WMS/Managed/UnitTest/Framework/TestSuite.cs<o:p></o:p></p>
<p class=MsoPlainText>Providers/WMS/Managed/UnitTest/Framework/XmlFormatter.cs<o:p></o:p></p>
<p class=MsoPlainText>Providers/WMS/Managed/UnitTest/Program.cs<o:p></o:p></p>
<p class=MsoPlainText>Providers/WMS/Managed/UnitTest/Properties/<o:p></o:p></p>
<p class=MsoPlainText>Providers/WMS/Managed/UnitTest/Properties/AssemblyInfo.cs<o:p></o:p></p>
<p class=MsoPlainText>Providers/WMS/Managed/UnitTest/ProviderTests/<o:p></o:p></p>
<p class=MsoPlainText>Providers/WMS/Managed/UnitTest/ProviderTests/CommandTests.cs<o:p></o:p></p>
<p class=MsoPlainText>Providers/WMS/Managed/UnitTest/providers.xml<o:p></o:p></p>
<p class=MsoPlainText>Providers/WMS/Managed/UnitTest/unit_test.csproj<o:p></o:p></p>
<p class=MsoPlainText>Providers/WMS/Managed/UnitTest/unit_test.sln<o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText>===================<o:p></o:p></p>
<p class=MsoPlainText>Components Affected <== Identify all components that
will need recompilation<o:p></o:p></p>
<p class=MsoPlainText>===================<o:p></o:p></p>
<p class=MsoPlainText>FDO Managed API<o:p></o:p></p>
<p class=MsoPlainText>WMS Managed API<o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoPlainText>=====================<o:p></o:p></p>
<p class=MsoPlainText>Reviewers' Assessment<o:p></o:p></p>
<p class=MsoPlainText>=====================<o:p></o:p></p>
<p class=MsoPlainText><o:p> </o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
</div>
</body>
</html>