[fdo-internals] CODE SUBMISSION -- Support accessing WMS custom
commands from Managed code
Greg Boone
greg.boone at autodesk.com
Thu Mar 20 15:23:08 EDT 2008
Author: Greg Boone
Date: Thursday, March 20, 2008
Title: Support accessing WMS custom commands from Managed code (I)
Reviewed by: Romica Dascalescu
========
Abstract
========
This submission tests and resolves issues identified when attempting to access the following WMS custom commands through the FDO API managed interface.
GetFeatureClassStyles
GetFeatureClassCRSNames
GetImageFormats
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.
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.
For the case of the commands mentioned above, the following concrete classes would have to be defined and exposed for the WMS provider:
public __gc class GetFeatureClassStylesCommand :
public ICommandImp,
public IGetFeatureClassStyles
{
...
public:
GetFeatureClassStylesCommand(ICommand* command, Boolean autoDelete);
...
}
public __gc class GetImageFormatsCommand :
public ICommandImp,
public IGetFeatureClassStyles
{
...
public:
GetImageFormatsCommand(ICommand* command, Boolean autoDelete);
...
}
public __gc class GetFeatureClassCRSNamesCommand :
public ICommandImp,
public IGetFeatureClassStyles
{
...
public:
GetFeatureClassCRSNamesCommand(ICommand* command, Boolean autoDelete);
...
}
Here is an example of how the the above wrpapper classes are to be used:
IConnectionManager connectionManager =
FeatureAccessManager.GetConnectionManager();
IConnection mConnection = connectionManager.CreateConnection("OSGeo.WMS.3.3");
mConnection.ConnectionString = @"FeatureServer=http://www2.dmsolutions.ca/cgi-
bin/mswms_gmap";
ConnectionState state = mConnection.Open();
ICommand command = mConnection.CreateCommand(CommandType_GetImageFormats);
GetImageFormatsCommand formatsCmd = new GetImageFormatsCommand(command, false);
StringCollection strColl = formatsCmd.Execute();
for (int i = 0; i < strColl.Count; i++) {
StringElement strElem = strColl.get_Item(i);
string strVal = strElem.String;
Console.WriteLine(strVal);
}
mConnection.Close();
During the implementation of this change, it was discoverd that there was no
means of retrieving the actual string value attached to the FDO StringElement
interface using the managed FDO API. It looks as if the unmanaged 'FdoString*
GetString()' method was never exposed in the managed API. To resolve this issue,
a new interface method will need to be added to StringElement as follows:
public __sealed __gc class StringElement : public Disposable
{
...
public:
__property System::String* get_String ();
...
}
TESTING PERFORMED:
<Minimum of regress>
==================
Note to Developers
==================
NONE
==================================
Note to Integration and Build Team
==================================
NONE
========
Bugfixes
========
Open Source Ticket #276: Can't access WMS custom commands from managed code
================
Module by Module
================
******FDO API******
Modified :
Fdo/Managed\Src\OSGeo\Common\mgStringElement.cpp
Fdo/Managed\Src\OSGeo\Common\mgStringElement.h
Fdo/Managed\Src\OSGeo\FDO\Commands\mgICommandImp.cpp
Fdo/Managed\Src\OSGeo\FDO\Commands\mgICommandImp.h
Fdo/Managed\Src\OSGeo\FDO\mgObjectFactory.cpp
******WMS Provider******
Modified :
Providers/WMS/Src\UnitTest\WmsTestCustomCommands.cpp
Providers/WMS/Docs\doc_src\Doxyfile_WMS_managed
Providers/WMS/Managed\Src\OSGeo\FDO\Providers\WMS\Override\stdafx.h
Providers/WMS/Managed\Src\OSGeo\FDO\Providers\WMS\Override\AssemblyVersion.cpp
Providers/WMS/Managed\Src\OSGeo\FDO\Providers\WMS\mgIGetFeatureClassCRSNames.h
Providers/WMS/Managed\Src\OSGeo\FDO\Providers\WMS\mgIGetFeatureClassCRSNamesImp.cpp
Providers/WMS/Managed\Src\OSGeo\FDO\Providers\WMS\mgIGetImageFormats.h
Providers/WMS/Managed\Src\OSGeo\FDO\Providers\WMS\mgIGetImageFormatsImp.cpp
Providers/WMS/Managed\Src\OSGeo\FDO\Providers\WMS\mgIGetFeatureClassCRSNamesImp.h
Providers/WMS/Managed\Src\OSGeo\FDO\Providers\WMS\mgIGetImageFormatsImp.h
Providers/WMS/Managed\Src\OSGeo\FDO\Providers\WMS\mgIGetFeatureClassStyles.h
Providers/WMS/Managed\Src\OSGeo\FDO\Providers\WMS\mgIGetFeatureClassStylesImp.cpp
Providers/WMS/Managed\Src\OSGeo\FDO\Providers\WMS\mgCommandType.h
Providers/WMS/Managed\Src\OSGeo\FDO\Providers\WMS\mgIGetFeatureClassStylesImp.h
Added:
Providers/WMS/Managed/UnitTest/
Providers/WMS/Managed/UnitTest/Framework/
Providers/WMS/Managed/UnitTest/Framework/BaseTest.cs
Providers/WMS/Managed/UnitTest/Framework/BaseTestWithConnection.cs
Providers/WMS/Managed/UnitTest/Framework/IConnectionProvider.cs
Providers/WMS/Managed/UnitTest/Framework/TestSuite.cs
Providers/WMS/Managed/UnitTest/Framework/XmlFormatter.cs
Providers/WMS/Managed/UnitTest/Program.cs
Providers/WMS/Managed/UnitTest/Properties/
Providers/WMS/Managed/UnitTest/Properties/AssemblyInfo.cs
Providers/WMS/Managed/UnitTest/ProviderTests/
Providers/WMS/Managed/UnitTest/ProviderTests/CommandTests.cs
Providers/WMS/Managed/UnitTest/providers.xml
Providers/WMS/Managed/UnitTest/unit_test.csproj
Providers/WMS/Managed/UnitTest/unit_test.sln
===================
Components Affected <== Identify all components that will need recompilation
===================
FDO Managed API
WMS Managed API
=====================
Reviewers' Assessment
=====================
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/fdo-internals/attachments/20080320/15233a8d/attachment.html
More information about the fdo-internals
mailing list