[fdo-trac] #276: Can't access WMS custom commands from managed
code
FDO
trac_fdo at osgeo.org
Wed Mar 19 18:08:18 EDT 2008
#276: Can't access WMS custom commands from managed code
-----------------------+----------------------------------------------------
Reporter: ssakharov | Owner: gregboone
Type: defect | Status: assigned
Priority: major | Milestone: 3.3.1
Component: FDO API | Version: 3.3.0
Severity: 3 | Resolution:
Keywords: | External_id:
-----------------------+----------------------------------------------------
Changes (by gregboone):
* status: new => assigned
Comment:
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 ();
...
}
}}}
The following Files were modified:
{{{
*
******Fdocore******
Modified : Fdo/Managed\Src\OSGeo\Common\mgStringElement.cpp
Modified : Fdo/Managed\Src\OSGeo\Common\mgStringElement.h
Modified : Fdo/Managed\Src\OSGeo\FDO\Commands\mgICommandImp.cpp
Modified : Fdo/Managed\Src\OSGeo\FDO\Commands\mgICommandImp.h
Modified : Fdo/Managed\Src\OSGeo\FDO\mgObjectFactory.cpp
*
******WMS******
Modified : Providers/WMS/Src\UnitTest\WmsTestCustomCommands.cpp
Modified : Providers/WMS/Docs\doc_src\Doxyfile_WMS_managed
Modified :
Providers/WMS/Managed\Src\OSGeo\FDO\Providers\WMS\Override\stdafx.h
Modified :
Providers/WMS/Managed\Src\OSGeo\FDO\Providers\WMS\Override\AssemblyVersion.cpp
Modified :
Providers/WMS/Managed\Src\OSGeo\FDO\Providers\WMS\mgIGetFeatureClassCRSNames.h
Modified :
Providers/WMS/Managed\Src\OSGeo\FDO\Providers\WMS\mgIGetFeatureClassCRSNamesImp.cpp
Modified :
Providers/WMS/Managed\Src\OSGeo\FDO\Providers\WMS\mgIGetImageFormats.h
Modified :
Providers/WMS/Managed\Src\OSGeo\FDO\Providers\WMS\mgIGetImageFormatsImp.cpp
Modified :
Providers/WMS/Managed\Src\OSGeo\FDO\Providers\WMS\mgIGetFeatureClassCRSNamesImp.h
Modified :
Providers/WMS/Managed\Src\OSGeo\FDO\Providers\WMS\mgIGetImageFormatsImp.h
Modified :
Providers/WMS/Managed\Src\OSGeo\FDO\Providers\WMS\mgIGetFeatureClassStyles.h
Modified :
Providers/WMS/Managed\Src\OSGeo\FDO\Providers\WMS\mgIGetFeatureClassStylesImp.cpp
Modified :
Providers/WMS/Managed\Src\OSGeo\FDO\Providers\WMS\mgCommandType.h
Modified :
Providers/WMS/Managed\Src\OSGeo\FDO\Providers\WMS\mgIGetFeatureClassStylesImp.h
*
}}}
--
Ticket URL: <http://trac.osgeo.org/fdo/ticket/276#comment:1>
FDO <http://fdo.osgeo.org/>
Feature Data Objects
More information about the fdo-trac
mailing list