[mapguide-commits] r5065 - in sandbox/adsk/2.2gp: Common/MapGuideCommon/Services Common/PlatformBase/Services Server/src/Services/Feature UnitTest/WebTier/MapAgent/MapAgentForms Web/src/HttpHandler

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Wed Aug 4 15:19:09 EDT 2010


Author: brucedechant
Date: 2010-08-04 19:19:09 +0000 (Wed, 04 Aug 2010)
New Revision: 5065

Modified:
   sandbox/adsk/2.2gp/Common/MapGuideCommon/Services/ProxyFeatureService.cpp
   sandbox/adsk/2.2gp/Common/MapGuideCommon/Services/ProxyFeatureService.h
   sandbox/adsk/2.2gp/Common/PlatformBase/Services/FeatureService.h
   sandbox/adsk/2.2gp/Server/src/Services/Feature/OpGetCapabilities.cpp
   sandbox/adsk/2.2gp/Server/src/Services/Feature/ServerFeatureService.cpp
   sandbox/adsk/2.2gp/Server/src/Services/Feature/ServerFeatureService.h
   sandbox/adsk/2.2gp/Server/src/Services/Feature/ServerGetProviderCapabilities.cpp
   sandbox/adsk/2.2gp/Server/src/Services/Feature/ServerGetProviderCapabilities.h
   sandbox/adsk/2.2gp/UnitTest/WebTier/MapAgent/MapAgentForms/getcapabilitiesform.html
   sandbox/adsk/2.2gp/Web/src/HttpHandler/HttpGetCapabilities.cpp
   sandbox/adsk/2.2gp/Web/src/HttpHandler/HttpGetCapabilities.h
Log:
Fix for trac ticket 1415 - Implement RFC 105
http://trac.osgeo.org/mapguide/ticket/1415

Notes:
- Enhance feature service GetCapabilities API with connection string support


Modified: sandbox/adsk/2.2gp/Common/MapGuideCommon/Services/ProxyFeatureService.cpp
===================================================================
--- sandbox/adsk/2.2gp/Common/MapGuideCommon/Services/ProxyFeatureService.cpp	2010-08-03 08:03:52 UTC (rev 5064)
+++ sandbox/adsk/2.2gp/Common/MapGuideCommon/Services/ProxyFeatureService.cpp	2010-08-04 19:19:09 UTC (rev 5065)
@@ -277,16 +277,21 @@
 /// Subject to change with FDO R2
 MgByteReader* MgProxyFeatureService::GetCapabilities(CREFSTRING providerName)
 {
-    Ptr<MgUserInformation> userInfo = m_connProp->GetUserInfo();
+    STRING connectionString = L"";
+    return GetCapabilities(providerName, connectionString);
+}
 
+MgByteReader* MgProxyFeatureService::GetCapabilities(CREFSTRING providerName, CREFSTRING connectionString)
+{
     MgCommand cmd;
     cmd.ExecuteCommand(m_connProp,                                  // Connection
                        MgCommand::knObject,                         // Return type expected
                        MgFeatureServiceOpId::GetCapabilities_Id,    // Command Code
-                       1,                                           // No of arguments
+                       2,                                           // No of arguments
                        Feature_Service,                             // Service Id
-                       userInfo->GetApiVersion(),                   // Operation version
+                       BUILD_VERSION(1,0,0),                        // Operation version
                        MgCommand::knString, &providerName,          // Argument#1
+                       MgCommand::knString, &connectionString,      // Argument#2
                        MgCommand::knNone);                          // End of argument
 
     SetWarning(cmd.GetWarningObject());

Modified: sandbox/adsk/2.2gp/Common/MapGuideCommon/Services/ProxyFeatureService.h
===================================================================
--- sandbox/adsk/2.2gp/Common/MapGuideCommon/Services/ProxyFeatureService.h	2010-08-03 08:03:52 UTC (rev 5064)
+++ sandbox/adsk/2.2gp/Common/MapGuideCommon/Services/ProxyFeatureService.h	2010-08-04 19:19:09 UTC (rev 5065)
@@ -207,6 +207,39 @@
 
     /////////////////////////////////////////////////////////////////
     /// \brief
+    /// This method returns capabilities of the provider applicable for the
+    /// specified connection string.
+    ///
+    /// \remarks
+    /// This would provide details on the following
+    /// capabilities:
+    /// <ol>
+    /// <li>Connection</li>
+    /// <li>Schema</li>
+    /// <li>Command</li>
+    /// <li>Filter</li>
+    /// <li>Expression</li>
+    /// </ol>
+    /// \n
+    /// Schema Definition: FeatureProviderCapabilities.xsd
+    /// Sample XML:        FeatureProviderCapabilities.xml
+    ///
+    /// \param providerName
+    /// Input
+    /// Name of provider for which capabilities are requested
+    /// \param connectionString
+    /// Input
+    /// The connection string to use
+    ///
+    /// \return
+    /// Byte array representing XML (or NULL)
+    ///
+    /// \exception MgInvalidProviderNameException
+    ///
+    MgByteReader* GetCapabilities(CREFSTRING providerName, CREFSTRING connectionString);
+
+    /////////////////////////////////////////////////////////////////
+    /// \brief
     /// This method returns list of ALL schemas names available with
     /// with the provider
     ///

Modified: sandbox/adsk/2.2gp/Common/PlatformBase/Services/FeatureService.h
===================================================================
--- sandbox/adsk/2.2gp/Common/PlatformBase/Services/FeatureService.h	2010-08-03 08:03:52 UTC (rev 5064)
+++ sandbox/adsk/2.2gp/Common/PlatformBase/Services/FeatureService.h	2010-08-04 19:19:09 UTC (rev 5065)
@@ -349,6 +349,46 @@
 
     /////////////////////////////////////////////////////////////////////////////////////////////
     /// \brief
+    /// Gets the capabilities of an FDO Provider expressed in XML
+    /// according to the \link FdoProviderCapabilities_schema FdoProviderCapabilities \endlink schema.
+    ///
+    /// \remarks
+    /// MgFeatureService derives most of its capabilities from the
+    /// FDO Provider to which it is connected. Capabilities vary
+    /// among providers. For example, the FDO Provider for ArcSDE
+    /// supports all of the spatial operators, and the FDO Provider
+    /// for Oracle supports only a subset. For a fuller discussion,
+    /// see \link ProviderCapabilities Provider Capabilities \endlink.
+    ///
+    /// <!-- Syntax in .Net, Java, and PHP -->
+    /// \htmlinclude DotNetSyntaxTop.html
+    /// virtual MgByteReader GetCapabilities(string providerName);
+    /// \htmlinclude SyntaxBottom.html
+    /// \htmlinclude JavaSyntaxTop.html
+    /// virtual MgByteReader GetCapabilities(String providerName);
+    /// \htmlinclude SyntaxBottom.html
+    /// \htmlinclude PHPSyntaxTop.html
+    /// virtual MgByteReader GetCapabilities(string providerName);
+    /// \htmlinclude SyntaxBottom.html
+    ///
+    /// \param providerName (String/string)
+    /// The name of the FDO provider. Get the exact
+    /// form of the name from
+    /// MgFeatureService::GetFeatureProviders.
+    /// \param connectionString (String/string)
+    /// The connection string to use.
+    ///
+    /// \return
+    /// Returns an MgByteReader containing the capabilities in XML
+    /// format (or NULL).
+    ///
+    /// \exception MgInvalidArgumentException
+    /// \exception MgFdoException
+    ///
+    virtual MgByteReader* GetCapabilities(CREFSTRING providerName, CREFSTRING connectionString) = 0;
+
+    /////////////////////////////////////////////////////////////////////////////////////////////
+    /// \brief
     /// Creates or updates a feature schema within the specified feature source.
     ///
     /// <!-- Syntax in .Net, Java, and PHP -->

Modified: sandbox/adsk/2.2gp/Server/src/Services/Feature/OpGetCapabilities.cpp
===================================================================
--- sandbox/adsk/2.2gp/Server/src/Services/Feature/OpGetCapabilities.cpp	2010-08-03 08:03:52 UTC (rev 5064)
+++ sandbox/adsk/2.2gp/Server/src/Services/Feature/OpGetCapabilities.cpp	2010-08-04 19:19:09 UTC (rev 5065)
@@ -82,6 +82,30 @@
         // Write the response
         EndExecution(byteReader);
     }
+    else if (2 == m_packet.m_NumArguments)
+    {
+        // Get property name
+        STRING providerName;
+        m_stream->GetString(providerName);
+        STRING connectionString;
+        m_stream->GetString(connectionString);
+
+        BeginExecution();
+
+        MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
+        MG_LOG_OPERATION_MESSAGE_ADD_STRING(providerName.c_str());
+        MG_LOG_OPERATION_MESSAGE_ADD_SEPARATOR();
+        MG_LOG_OPERATION_MESSAGE_ADD_STRING(connectionString.c_str());
+        MG_LOG_OPERATION_MESSAGE_PARAMETERS_END();
+
+        Validate();
+
+        // Execute the operation
+        Ptr<MgByteReader> byteReader = m_service->GetCapabilities(providerName, connectionString);
+
+        // Write the response
+        EndExecution(byteReader);
+    }
     else
     {
         MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();

Modified: sandbox/adsk/2.2gp/Server/src/Services/Feature/ServerFeatureService.cpp
===================================================================
--- sandbox/adsk/2.2gp/Server/src/Services/Feature/ServerFeatureService.cpp	2010-08-03 08:03:52 UTC (rev 5064)
+++ sandbox/adsk/2.2gp/Server/src/Services/Feature/ServerFeatureService.cpp	2010-08-04 19:19:09 UTC (rev 5065)
@@ -258,10 +258,19 @@
             L"MgServerFeatureService.GetCapabilities", __LINE__, __WFILE__, NULL, L"", NULL);
     }
 
-    MgServerGetProviderCapabilities msgpc(providerName);
+    STRING connectionString = L"";
+    MgServerGetProviderCapabilities msgpc(providerName, connectionString);
     return msgpc.GetProviderCapabilities();
 }
 
+MgByteReader* MgServerFeatureService::GetCapabilities( CREFSTRING providerName, CREFSTRING connectionString )
+{
+    MG_LOG_TRACE_ENTRY(L"MgServerFeatureService::GetCapabilities()");
+
+    MgServerGetProviderCapabilities msgpc(providerName, connectionString);
+    return msgpc.GetProviderCapabilities();
+}
+
 /////////////////////////////////////////////////////////////////////////////////////////////
 /// \brief
 /// Creates or updates a feature schema within the specified feature source.

Modified: sandbox/adsk/2.2gp/Server/src/Services/Feature/ServerFeatureService.h
===================================================================
--- sandbox/adsk/2.2gp/Server/src/Services/Feature/ServerFeatureService.h	2010-08-03 08:03:52 UTC (rev 5064)
+++ sandbox/adsk/2.2gp/Server/src/Services/Feature/ServerFeatureService.h	2010-08-04 19:19:09 UTC (rev 5065)
@@ -187,6 +187,34 @@
 
     //////////////////////////////////////////////////////////////////
     /// <summary>
+    /// This method returns capabilities of the provider applicable for the
+    /// connection. This would provide details on the following
+    /// capabilities:
+    /// 1. Connection
+    /// 2. Schema
+    /// 3. Command
+    /// 4. Filter
+    /// 5. Expression
+    ///
+    /// Schema Definition: FeatureProviderCapabilities.xsd
+    /// Sample XML:        FeatureProviderCapabilities.xml
+    /// </summary>
+    /// <param name="providerName">Input
+    /// Name of provider for which capabilities are being requested
+    /// </param>
+    /// <returns>
+    /// <param name="connectionString">Input
+    /// The connection string to use
+    /// </param>
+    /// Byte array representing XML (or NULL)
+    /// </returns>
+    ///
+    /// EXCEPTIONS:
+    /// MgInvalidProviderNameException
+    MgByteReader* GetCapabilities(CREFSTRING providerName, CREFSTRING connectionString);
+
+    //////////////////////////////////////////////////////////////////
+    /// <summary>
     /// This method returns list of ALL schemas names available with
     /// with the provider
     /// </summary>

Modified: sandbox/adsk/2.2gp/Server/src/Services/Feature/ServerGetProviderCapabilities.cpp
===================================================================
--- sandbox/adsk/2.2gp/Server/src/Services/Feature/ServerGetProviderCapabilities.cpp	2010-08-03 08:03:52 UTC (rev 5064)
+++ sandbox/adsk/2.2gp/Server/src/Services/Feature/ServerGetProviderCapabilities.cpp	2010-08-04 19:19:09 UTC (rev 5065)
@@ -38,7 +38,7 @@
 bool MgServerGetProviderCapabilities::m_isInitialized = MgServerGetProviderCapabilities::Initialize();
 
 
-MgServerGetProviderCapabilities::MgServerGetProviderCapabilities(CREFSTRING providerName)
+MgServerGetProviderCapabilities::MgServerGetProviderCapabilities(CREFSTRING providerName, CREFSTRING connectionString)
 {
     if (providerName.empty())
     {
@@ -64,6 +64,16 @@
     // TODO: Should this connection be cached?
     // use a smart pointer until the end in case there's an exception
     FdoPtr<FdoIConnection> fdoConn = connManager->CreateConnection(providerNoVersion.c_str());
+
+    // Note: WFS doesn't return the proper capabilities if a connection is not opened to the actual server using a connection string.
+
+    // Check if a connection string was specified
+    if(!connectionString.empty())
+    {
+        fdoConn->SetConnectionString(connectionString.c_str());
+        fdoConn->Open();
+    }
+
     CHECKNULL(fdoConn, L"MgServerGetProviderCapabilities.MgServerGetProviderCapabilities");
 
     m_xmlUtil = new MgXmlUtil();
@@ -80,6 +90,12 @@
 
 MgServerGetProviderCapabilities::~MgServerGetProviderCapabilities()
 {
+    // Check if the connection needs to be closed
+    if(m_fdoConn->GetConnectionState() == FdoConnectionState_Open)
+    {
+        m_fdoConn->Close();
+    }
+
     m_fdoConn = NULL;
 
     if (NULL != m_xmlUtil)

Modified: sandbox/adsk/2.2gp/Server/src/Services/Feature/ServerGetProviderCapabilities.h
===================================================================
--- sandbox/adsk/2.2gp/Server/src/Services/Feature/ServerGetProviderCapabilities.h	2010-08-03 08:03:52 UTC (rev 5064)
+++ sandbox/adsk/2.2gp/Server/src/Services/Feature/ServerGetProviderCapabilities.h	2010-08-04 19:19:09 UTC (rev 5065)
@@ -26,7 +26,7 @@
 class MgServerGetProviderCapabilities
 {
 public:
-    MgServerGetProviderCapabilities(CREFSTRING providerName);
+    MgServerGetProviderCapabilities(CREFSTRING providerName, CREFSTRING connectionString);
     ~MgServerGetProviderCapabilities();
     MgByteReader* GetProviderCapabilities();
 

Modified: sandbox/adsk/2.2gp/UnitTest/WebTier/MapAgent/MapAgentForms/getcapabilitiesform.html
===================================================================
--- sandbox/adsk/2.2gp/UnitTest/WebTier/MapAgent/MapAgentForms/getcapabilitiesform.html	2010-08-03 08:03:52 UTC (rev 5064)
+++ sandbox/adsk/2.2gp/UnitTest/WebTier/MapAgent/MapAgentForms/getcapabilitiesform.html	2010-08-04 19:19:09 UTC (rev 5065)
@@ -20,6 +20,8 @@
         <input type="text" name="CLIENTAGENT" value="MapGuide Developer" size="100">
         <p> Provider:
         <input type="text" name="PROVIDER" value="OSGeo.SDF" size="100" ID="Text5">
+        <p> Connection String: (optional)
+        <input type="text" name="CONNECTIONSTRING" value="" size="100" ID="Text6">
         <p> Format:
 		<select name="FORMAT">
 		<option value="text/xml">text/xml</option>

Modified: sandbox/adsk/2.2gp/Web/src/HttpHandler/HttpGetCapabilities.cpp
===================================================================
--- sandbox/adsk/2.2gp/Web/src/HttpHandler/HttpGetCapabilities.cpp	2010-08-03 08:03:52 UTC (rev 5064)
+++ sandbox/adsk/2.2gp/Web/src/HttpHandler/HttpGetCapabilities.cpp	2010-08-04 19:19:09 UTC (rev 5065)
@@ -35,7 +35,8 @@
     InitializeCommonParameters(hRequest);
 
     Ptr<MgHttpRequestParam> params = hRequest->GetRequestParam();
-    this->m_providerName = params->GetParameterValue(MgHttpResourceStrings::reqFeatProvider);
+    m_providerName = params->GetParameterValue(MgHttpResourceStrings::reqFeatProvider);
+    m_connectionString = params->GetParameterValue(MgHttpResourceStrings::reqFeatConnectionString);
 }
 
 /// <summary>
@@ -58,7 +59,7 @@
     Ptr<MgFeatureService> service = (MgFeatureService*)(CreateService(MgServiceType::FeatureService));
 
     // call the C++ API
-    Ptr<MgByteReader> byteReader = service->GetCapabilities(m_providerName);
+    Ptr<MgByteReader> byteReader = service->GetCapabilities(m_providerName, m_connectionString);
 
     // Convert to requested response format, if necessary
     ProcessFormatConversion(byteReader);

Modified: sandbox/adsk/2.2gp/Web/src/HttpHandler/HttpGetCapabilities.h
===================================================================
--- sandbox/adsk/2.2gp/Web/src/HttpHandler/HttpGetCapabilities.h	2010-08-03 08:03:52 UTC (rev 5064)
+++ sandbox/adsk/2.2gp/Web/src/HttpHandler/HttpGetCapabilities.h	2010-08-04 19:19:09 UTC (rev 5065)
@@ -45,6 +45,7 @@
 
 private:
     STRING  m_providerName;
+    STRING  m_connectionString;
 };
 
 #endif  // _FS_GET_CAPABILITIES_H



More information about the mapguide-commits mailing list