[mapguide-commits] r5226 - in trunk/MgDev: Common/MapGuideCommon/Services Common/PlatformBase/Services Server/src/Services/Feature Server/src/Wfs Web/src/HttpHandler

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Thu Sep 30 09:46:14 EDT 2010


Author: liuar
Date: 2010-09-30 13:46:14 +0000 (Thu, 30 Sep 2010)
New Revision: 5226

Modified:
   trunk/MgDev/Common/MapGuideCommon/Services/ProxyFeatureService.cpp
   trunk/MgDev/Common/MapGuideCommon/Services/ProxyFeatureService.h
   trunk/MgDev/Common/PlatformBase/Services/FeatureService.h
   trunk/MgDev/Server/src/Services/Feature/OpGetWfsFeature.cpp
   trunk/MgDev/Server/src/Services/Feature/ServerFeatureService.cpp
   trunk/MgDev/Server/src/Services/Feature/ServerFeatureService.h
   trunk/MgDev/Server/src/Wfs/1.1.0.xml.awd
   trunk/MgDev/Web/src/HttpHandler/HttpWfsGetFeature.cpp
Log:
Ticket #1450 Enhance the GetWfsFeature API to support customized namespaceUrl and namespacePrefix

In order to pass the OGC CITE test, MapGuide need to have its !GetWfsFeature API extended to support user defined namespaceUrl and namespacePrefix. 

Two more parameters added in the the new interface: namespacePrefix and namespaceUrl 


Modified: trunk/MgDev/Common/MapGuideCommon/Services/ProxyFeatureService.cpp
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/Services/ProxyFeatureService.cpp	2010-09-30 13:11:10 UTC (rev 5225)
+++ trunk/MgDev/Common/MapGuideCommon/Services/ProxyFeatureService.cpp	2010-09-30 13:46:14 UTC (rev 5226)
@@ -1407,13 +1407,15 @@
                                                    INT32 maxFeatures,
                                                    CREFSTRING wfsVersion,
                                                    CREFSTRING outputFormat,
-                                                   CREFSTRING sortCriteria)
+                                                   CREFSTRING sortCriteria,
+                                                   CREFSTRING namespacePrefix,
+                                                   CREFSTRING namespaceUrl)
 {
     MgCommand cmd;
     cmd.ExecuteCommand(m_connProp,                                  // Connection
                        MgCommand::knObject,                         // Return type expected
                        MgFeatureServiceOpId::GetWfsFeature_Id,      // Command Code
-                       9,                                           // No of arguments
+                       11,                                          // No of arguments
                        Feature_Service,                             // Service Id
                        BUILD_VERSION(2,3,0),                        // Operation version
                        MgCommand::knObject, featureSourceId,        // Argument#1
@@ -1425,6 +1427,8 @@
                        MgCommand::knString, &wfsVersion,            // Argument#7
                        MgCommand::knString, &outputFormat,          // Argument#8
                        MgCommand::knString, &sortCriteria,          // Argument#9
+                       MgCommand::knString, &namespacePrefix,       // Argument#10
+                       MgCommand::knString, &namespaceUrl,          // Argument#11
                        MgCommand::knNone);                          // End of argument
 
     SetWarning(cmd.GetWarningObject());

Modified: trunk/MgDev/Common/MapGuideCommon/Services/ProxyFeatureService.h
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/Services/ProxyFeatureService.h	2010-09-30 13:11:10 UTC (rev 5225)
+++ trunk/MgDev/Common/MapGuideCommon/Services/ProxyFeatureService.h	2010-09-30 13:46:14 UTC (rev 5226)
@@ -1106,13 +1106,13 @@
     ///
     /// <!-- Syntax in .Net, Java, and PHP -->
     /// \htmlinclude DotNetSyntaxTop.html
-    /// virtual MgByteReader GetWfsFeature(MgResourceIdentifier featureSourceId, string featureClass, MgStringCollection requiredProperties, string srs, string filter, int maxFeatures, string wfsVersion, string outputFormat, string sortCriteria);
+    /// virtual MgByteReader GetWfsFeature(MgResourceIdentifier featureSourceId, string featureClass, MgStringCollection requiredProperties, string srs, string filter, int maxFeatures, string wfsVersion, string outputFormat, string sortCriteria, string namespacePrefix, string namespaceUrl);
     /// \htmlinclude SyntaxBottom.html
     /// \htmlinclude JavaSyntaxTop.html
-    /// virtual MgByteReader GetWfsFeature(MgResourceIdentifier featureSourceId, string featureClass, MgStringCollection requiredProperties, string srs, string filter, int maxFeatures, string wfsVersion, string outputFormat, string sortCriteria);
+    /// virtual MgByteReader GetWfsFeature(MgResourceIdentifier featureSourceId, string featureClass, MgStringCollection requiredProperties, string srs, string filter, int maxFeatures, string wfsVersion, string outputFormat, string sortCriteria, string namespacePrefix, string namespaceUrl);
     /// \htmlinclude SyntaxBottom.html
     /// \htmlinclude PHPSyntaxTop.html
-    /// virtual MgByteReader GetWfsFeature(MgResourceIdentifier featureSourceId, string featureClass, MgStringCollection requiredProperties, string srs, string filter, int maxFeatures, string wfsVersion, string outputFormat, string sortCriteria);
+    /// virtual MgByteReader GetWfsFeature(MgResourceIdentifier featureSourceId, string featureClass, MgStringCollection requiredProperties, string srs, string filter, int maxFeatures, string wfsVersion, string outputFormat, string sortCriteria, string namespacePrefix, string namespaceUrl);
     /// \htmlinclude SyntaxBottom.html
     ///
     /// \param featureSourceId (MgResourceIdentifier)
@@ -1140,6 +1140,10 @@
     /// http://portal.opengeospatial.org/files/?artifact_id=8339
     /// \param sortCriteria (String/string)
     /// A string identifying the sort criteria
+    /// \param namespacePrefix (String/string)
+    /// A string identifying the namespace prefix in the output xml
+    /// \param namespaceUrl (String/string)
+    /// A string idenyifying the namespace url in the output xml
     ///
     /// \return
     /// Returns an MgByteReader containing the requested feature information.
@@ -1148,7 +1152,7 @@
     /// \exception MgInvalidArgumentException
     ///
     MgByteReader* GetWfsFeature(MgResourceIdentifier* featureSourceId, CREFSTRING featureClass,
-        MgStringCollection* requiredProperties, CREFSTRING srs, CREFSTRING filter, INT32 maxFeatures,CREFSTRING wfsVersion, CREFSTRING outputFormat, CREFSTRING sortCriteria);
+        MgStringCollection* requiredProperties, CREFSTRING srs, CREFSTRING filter, INT32 maxFeatures,CREFSTRING wfsVersion, CREFSTRING outputFormat, CREFSTRING sortCriteria, CREFSTRING namespacePrefix, CREFSTRING namespaceUrl);
 
     ////////////////////////////////////////////////////////////////////////////////
     /// \brief

Modified: trunk/MgDev/Common/PlatformBase/Services/FeatureService.h
===================================================================
--- trunk/MgDev/Common/PlatformBase/Services/FeatureService.h	2010-09-30 13:11:10 UTC (rev 5225)
+++ trunk/MgDev/Common/PlatformBase/Services/FeatureService.h	2010-09-30 13:46:14 UTC (rev 5226)
@@ -1610,13 +1610,13 @@
     ///
     /// <!-- Syntax in .Net, Java, and PHP -->
     /// \htmlinclude DotNetSyntaxTop.html
-    /// virtual MgByteReader GetWfsFeature(MgResourceIdentifier featureSourceId, string featureClass, MgStringCollection requiredProperties, string srs, string filter, int maxFeatures, string wfsVersion, string outputFormat, string sortCriteria);
+    /// virtual MgByteReader GetWfsFeature(MgResourceIdentifier featureSourceId, string featureClass, MgStringCollection requiredProperties, string srs, string filter, int maxFeatures, string wfsVersion, string outputFormat, string sortCriteria, string namespacePrefix, string namespaceUrl);
     /// \htmlinclude SyntaxBottom.html
     /// \htmlinclude JavaSyntaxTop.html
-    /// virtual MgByteReader GetWfsFeature(MgResourceIdentifier featureSourceId, string featureClass, MgStringCollection requiredProperties, string srs, string filter, int maxFeatures, string wfsVersion, string outputFormat, string sortCriteria);
+    /// virtual MgByteReader GetWfsFeature(MgResourceIdentifier featureSourceId, string featureClass, MgStringCollection requiredProperties, string srs, string filter, int maxFeatures, string wfsVersion, string outputFormat, string sortCriteria, string namespacePrefix, string namespaceUrl);
     /// \htmlinclude SyntaxBottom.html
     /// \htmlinclude PHPSyntaxTop.html
-    /// virtual MgByteReader GetWfsFeature(MgResourceIdentifier featureSourceId, string featureClass, MgStringCollection requiredProperties, string srs, string filter, int maxFeatures, string wfsVersion, string outputFormat, string sortCriteria);
+    /// virtual MgByteReader GetWfsFeature(MgResourceIdentifier featureSourceId, string featureClass, MgStringCollection requiredProperties, string srs, string filter, int maxFeatures, string wfsVersion, string outputFormat, string sortCriteria, string namespacePrefix, string namespaceUrl);
     /// \htmlinclude SyntaxBottom.html
     ///
     /// \param featureSourceId (MgResourceIdentifier)
@@ -1644,6 +1644,10 @@
     /// http://portal.opengeospatial.org/files/?artifact_id=8339
     /// \param sortCriteria (String/string)
     /// A string identifying the sort criteria
+    /// \param namespacePrefix (String/string)
+    /// A string identifying the namespace prefix in the output xml
+    /// \param namespaceUrl (String/string)
+    /// A string idenyifying the namespace url in the output xml
     ///
     /// \return
     /// Returns an MgByteReader containing the requested feature information.
@@ -1651,7 +1655,7 @@
     /// \exception MgInvalidArgumentException
     ///
     virtual MgByteReader* GetWfsFeature(MgResourceIdentifier* featureSourceId, CREFSTRING featureClass,
-        MgStringCollection* requiredProperties, CREFSTRING srs, CREFSTRING filter, INT32 maxFeatures,CREFSTRING wfsVersion, CREFSTRING outputFormat, CREFSTRING sortCriteria) = 0;
+        MgStringCollection* requiredProperties, CREFSTRING srs, CREFSTRING filter, INT32 maxFeatures,CREFSTRING wfsVersion, CREFSTRING outputFormat, CREFSTRING sortCriteria, CREFSTRING namespacePrefix, CREFSTRING namespaceUrl) = 0;
 
     ////////////////////////////////////////////////////////////////////////////////
     /// \brief

Modified: trunk/MgDev/Server/src/Services/Feature/OpGetWfsFeature.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/OpGetWfsFeature.cpp	2010-09-30 13:11:10 UTC (rev 5225)
+++ trunk/MgDev/Server/src/Services/Feature/OpGetWfsFeature.cpp	2010-09-30 13:46:14 UTC (rev 5226)
@@ -111,7 +111,7 @@
         // Write the response
         EndExecution(byteReader);
     }
-    else if (9 == m_packet.m_NumArguments)
+    else if (11 == m_packet.m_NumArguments)
     {
         // Get the feature source
         Ptr<MgResourceIdentifier> featureSourceId = (MgResourceIdentifier*)m_stream->GetObject();
@@ -147,6 +147,14 @@
         STRING sortCriteria;
         m_stream->GetString(sortCriteria);
 
+        // Get the namespace prefix
+        STRING namespacePrefix;
+        m_stream->GetString(namespacePrefix);
+
+        // Get the namespace url
+        STRING namespaceUrl;
+        m_stream->GetString(namespaceUrl);
+
         BeginExecution();
 
         MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
@@ -167,13 +175,17 @@
         MG_LOG_OPERATION_MESSAGE_ADD_STRING(outputFormat.c_str());
         MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
         MG_LOG_OPERATION_MESSAGE_ADD_STRING(sortCriteria.c_str());
+        MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+        MG_LOG_OPERATION_MESSAGE_ADD_STRING(namespacePrefix.c_str());
+        MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+        MG_LOG_OPERATION_MESSAGE_ADD_STRING(namespaceUrl.c_str());
         MG_LOG_OPERATION_MESSAGE_PARAMETERS_END();
 
         Validate();
 
         // Execute the operation
         Ptr<MgByteReader> byteReader = m_service->GetWfsFeature(featureSourceId, featureClass,
-            requiredProperties, srs, filter, maxFeatures, wfsVersion, outputFormat, sortCriteria);
+            requiredProperties, srs, filter, maxFeatures, wfsVersion, outputFormat, sortCriteria, namespacePrefix, namespaceUrl);
 
         // Write the response
         EndExecution(byteReader);

Modified: trunk/MgDev/Server/src/Services/Feature/ServerFeatureService.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/ServerFeatureService.cpp	2010-09-30 13:11:10 UTC (rev 5225)
+++ trunk/MgDev/Server/src/Services/Feature/ServerFeatureService.cpp	2010-09-30 13:46:14 UTC (rev 5226)
@@ -1700,13 +1700,13 @@
 ///
 /// <!-- Syntax in .Net, Java, and PHP -->
 /// \htmlinclude DotNetSyntaxTop.html
-/// virtual MgByteReader GetWfsFeature(MgResourceIdentifier featureSourceId, string featureClass, MgStringCollection requiredProperties, string srs, string filter, int maxFeatures, string wfsVersion, string outputFormat, string sortCriteria);
+/// virtual MgByteReader GetWfsFeature(MgResourceIdentifier featureSourceId, string featureClass, MgStringCollection requiredProperties, string srs, string filter, int maxFeatures, string wfsVersion, string outputFormat, string sortCriteria, string namespacePrefix, string namespaceUrl);
 /// \htmlinclude SyntaxBottom.html
 /// \htmlinclude JavaSyntaxTop.html
-/// virtual MgByteReader GetWfsFeature(MgResourceIdentifier featureSourceId, string featureClass, MgStringCollection requiredProperties, string srs, string filter, int maxFeatures, string wfsVersion, string outputFormat, string sortCriteria);
+/// virtual MgByteReader GetWfsFeature(MgResourceIdentifier featureSourceId, string featureClass, MgStringCollection requiredProperties, string srs, string filter, int maxFeatures, string wfsVersion, string outputFormat, string sortCriteria, string namespacePrefix, string namespaceUrl);
 /// \htmlinclude SyntaxBottom.html
 /// \htmlinclude PHPSyntaxTop.html
-/// virtual MgByteReader GetWfsFeature(MgResourceIdentifier featureSourceId, string featureClass, MgStringCollection requiredProperties, string srs, string filter, int maxFeatures, string wfsVersion, string outputFormat, string sortCriteria);
+/// virtual MgByteReader GetWfsFeature(MgResourceIdentifier featureSourceId, string featureClass, MgStringCollection requiredProperties, string srs, string filter, int maxFeatures, string wfsVersion, string outputFormat, string sortCriteria, string namespacePrefix, string namespaceUrl);
 /// \htmlinclude SyntaxBottom.html
 ///
 /// \param featureSourceId (MgResourceIdentifier)
@@ -1734,6 +1734,10 @@
 /// http://portal.opengeospatial.org/files/?artifact_id=8339
 /// \param sortCriteria (String/string)
 /// A string identifying the sort criteria
+/// \param namespacePrefix (String/string)
+/// A string identifying the namespace prefix in the output xml
+/// \param namespaceUrl (String/string)
+/// A string idenyifying the namespace url in the output xml
 ///
 /// \return
 /// Returns an MgByteReader containing the requested feature information.
@@ -1748,7 +1752,9 @@
                                                      INT32 maxFeatures,
                                                      CREFSTRING wfsVersion,
                                                      CREFSTRING outputFormat,
-                                                     CREFSTRING sortCriteria)
+                                                     CREFSTRING sortCriteria,
+                                                     CREFSTRING namespacePrefix,
+                                                     CREFSTRING namespaceUrl)
 {
     MG_LOG_TRACE_ENTRY(L"MgServerFeatureService::GetWfsFeature()");
 
@@ -1920,9 +1926,22 @@
     
     // default namespace schema location
     flags->SetSchemaLocation(L"http://www.mynamespace.com/myns", L"http://www.mynamespace.com/myns/myns.xsd");
+    
     // set the default namespace
-    flags->SetDefaultNamespace(L"http://www.mynamespace.com/myns");
+    if(!namespacePrefix.empty())
+    {
+        STRING defaultNamespace(L"http://fdo.osgeo.org/schemas/feature/");
+        defaultNamespace += namespacePrefix;
+        
+        flags->SetDefaultNamespace(defaultNamespace.c_str());
+    }
+    else
+    {
+        flags->SetDefaultNamespace(L"http://www.mynamespace.com/myns");
+    }
 
+
+
     //create the FDO xml serializer stack and write out the features
     FdoPtr<FdoXmlWriter> xmlWriter = FdoXmlWriter::Create(fileName.c_str(), false);
     FdoPtr<FdoXmlFeaturePropertyWriter> propWriter = FdoXmlFeaturePropertyWriter::Create(xmlWriter,flags);
@@ -1960,7 +1979,7 @@
                                                      CREFSTRING wfsFilter,
                                                      INT32 maxFeatures)
 {
-    return GetWfsFeature(fs, featureClass, propNames, srs, wfsFilter, maxFeatures, L"1.0.0", L"text/xml; subtype=gml/2.1.2",L"");
+    return GetWfsFeature(fs, featureClass, propNames, srs, wfsFilter, maxFeatures, L"1.0.0", L"text/xml; subtype=gml/2.1.2", L"", L"", L"");
 }
 
 

Modified: trunk/MgDev/Server/src/Services/Feature/ServerFeatureService.h
===================================================================
--- trunk/MgDev/Server/src/Services/Feature/ServerFeatureService.h	2010-09-30 13:11:10 UTC (rev 5225)
+++ trunk/MgDev/Server/src/Services/Feature/ServerFeatureService.h	2010-09-30 13:46:14 UTC (rev 5226)
@@ -915,6 +915,12 @@
     /// <param name="sortCriteria">Input
     /// A string identifying the sort criteria
     /// </param>
+    /// <param name="namespacePrefix">Input
+    /// A string identifying the namespace prefix in the output xml
+    /// </param>
+    /// <param name="namespaceUrl">Input
+    /// A string identifying the namespace url in the output xml
+    /// </param>
     /// <returns>
     /// Returns an MgByteReader containing the requested feature information.
     /// </returns>
@@ -922,7 +928,7 @@
     /// EXCEPTIONS:
     /// MgInvalidArgumentException
     MgByteReader* GetWfsFeature(MgResourceIdentifier* featureSourceId, CREFSTRING featureClass,
-        MgStringCollection* requiredProperties, CREFSTRING srs, CREFSTRING filter, INT32 maxFeatures, CREFSTRING wfsVersion, CREFSTRING outputFormat, CREFSTRING sortCriteria);
+        MgStringCollection* requiredProperties, CREFSTRING srs, CREFSTRING filter, INT32 maxFeatures, CREFSTRING wfsVersion, CREFSTRING outputFormat, CREFSTRING sortCriteria, CREFSTRING namespacePrefix, CREFSTRING namespaceUrl);
 
     ///////////////////////////////////////////////////////////////////////////
     /// This method has been deprecated. Use the above method.

Modified: trunk/MgDev/Server/src/Wfs/1.1.0.xml.awd
===================================================================
--- trunk/MgDev/Server/src/Wfs/1.1.0.xml.awd	2010-09-30 13:11:10 UTC (rev 5225)
+++ trunk/MgDev/Server/src/Wfs/1.1.0.xml.awd	2010-09-30 13:46:14 UTC (rev 5226)
@@ -91,13 +91,9 @@
  </Define>
 
  <Define item="DescribeFeature.Import.xml">
-  <xs:import schemaLocation="&Url.DescribeFeatureType;?OPERATION=DESCRIBEFEATURESCHEMA&amp;VERSION=1.0.0&amp;LOCALE=en&amp;RESOURCEID=Library://&Enum.item;.FeatureSource&amp;SCHEMA="/>
+  <xs:import schemaLocation="&Url.DescribeFeatureType;?request=DescribeFeatureType&amp;service=WFS&amp;version=1.1.0&amp;typeName=&Feature.Prefix;:&Enum.item;"/>
  </Define>
 
- <Define item="DescribeFeature.Import.xml">
-  <xs:import schemaLocation="&Url.DescribeFeatureType;?OPERATION=DESCRIBEFEATURESCHEMA&amp;VERSION=1.0.0&amp;LOCALE=en&amp;RESOURCEID=Library://&Enum.item;.FeatureSource&amp;SCHEMA="/>
- </Define>
-
  <Define item="GetFeature.xml">
   <!-- Feature &Feature.iteration; -->
   &Feature.OuterXml;

Modified: trunk/MgDev/Web/src/HttpHandler/HttpWfsGetFeature.cpp
===================================================================
--- trunk/MgDev/Web/src/HttpHandler/HttpWfsGetFeature.cpp	2010-09-30 13:11:10 UTC (rev 5225)
+++ trunk/MgDev/Web/src/HttpHandler/HttpWfsGetFeature.cpp	2010-09-30 13:46:14 UTC (rev 5226)
@@ -234,7 +234,7 @@
 
                             // Call the C++ API
                             Ptr<MgByteReader> resultReader = featureService->GetWfsFeature(featureSourceId, ((sSchemaHash.size()==0) ? sClass : sSchemaHash + _(":") + sClass),
-                                requiredProperties, m_getFeatureParams->GetSrs(), filter, numFeaturesToRetrieve, sVersion, sOutputFormat,sSortCriteria);
+                                requiredProperties, m_getFeatureParams->GetSrs(), filter, numFeaturesToRetrieve, sVersion, sOutputFormat, sSortCriteria, sPrefix, L"");
 
                             // TODO How to determine number of features retrieved...?
                             // Note: for now, maxFeatures is managed by the MgWfsFeatures object. - TMT 2006-3-20



More information about the mapguide-commits mailing list