[mapguide-commits] r4402 - in trunk/MgDev: Common
Common/MapGuideCommon/Services Common/Schema
Server/src/Common/Manager Server/src/Core
Server/src/Services/ServerAdmin
UnitTest/WebTier/MapAgent/MapAgentForms Web/src/ApacheAgent
Web/src/CgiAgent Web/src/HttpHandler Web/src/IsapiAgent
Web/src/viewerfiles
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Wed Dec 9 16:05:10 EST 2009
Author: brucedechant
Date: 2009-12-09 16:05:09 -0500 (Wed, 09 Dec 2009)
New Revision: 4402
Added:
trunk/MgDev/Common/Schema/SiteInformation-2.2.0.xsd
trunk/MgDev/Common/Schema/SiteStatus-2.2.0.xsd
trunk/MgDev/Common/Schema/SiteVersion-2.2.0.xsd
trunk/MgDev/Server/src/Services/ServerAdmin/OpGetSiteStatus.cpp
trunk/MgDev/Server/src/Services/ServerAdmin/OpGetSiteStatus.h
trunk/MgDev/Server/src/Services/ServerAdmin/OpGetSiteVersion.cpp
trunk/MgDev/Server/src/Services/ServerAdmin/OpGetSiteVersion.h
trunk/MgDev/UnitTest/WebTier/MapAgent/MapAgentForms/getsitestatusform.html
trunk/MgDev/Web/src/HttpHandler/HttpGetSiteStatus.cpp
trunk/MgDev/Web/src/HttpHandler/HttpGetSiteStatus.h
Modified:
trunk/MgDev/Common/MapGuideCommon/Services/ServerAdmin.cpp
trunk/MgDev/Common/MapGuideCommon/Services/ServerAdmin.h
trunk/MgDev/Common/MapGuideCommon/Services/ServerAdminDefs.cpp
trunk/MgDev/Common/MapGuideCommon/Services/ServerAdminDefs.h
trunk/MgDev/Common/ProductVersion.h
trunk/MgDev/Server/src/Common/Manager/ServerManager.cpp
trunk/MgDev/Server/src/Common/Manager/ServerManager.h
trunk/MgDev/Server/src/Common/Manager/ServerManager.vcproj
trunk/MgDev/Server/src/Core/OperationThread.cpp
trunk/MgDev/Server/src/Services/ServerAdmin/Makefile.am
trunk/MgDev/Server/src/Services/ServerAdmin/ServerAdminOperationFactory.cpp
trunk/MgDev/Server/src/Services/ServerAdmin/ServerAdminService.cpp
trunk/MgDev/Server/src/Services/ServerAdmin/ServerAdminService.h
trunk/MgDev/Server/src/Services/ServerAdmin/ServerAdminService.vcproj
trunk/MgDev/Server/src/Services/ServerAdmin/ServerAdminServiceBuild.cpp
trunk/MgDev/UnitTest/WebTier/MapAgent/MapAgentForms/getsiteinfoform.html
trunk/MgDev/UnitTest/WebTier/MapAgent/MapAgentForms/getsiteversionform.html
trunk/MgDev/UnitTest/WebTier/MapAgent/MapAgentForms/siteserviceapi.html
trunk/MgDev/Web/src/ApacheAgent/ApacheAgent.cpp
trunk/MgDev/Web/src/CgiAgent/CgiAgent.cpp
trunk/MgDev/Web/src/HttpHandler/HttpGetSiteInfo.cpp
trunk/MgDev/Web/src/HttpHandler/HttpGetSiteInfo.h
trunk/MgDev/Web/src/HttpHandler/HttpGetSiteVersion.cpp
trunk/MgDev/Web/src/HttpHandler/HttpGetSiteVersion.h
trunk/MgDev/Web/src/HttpHandler/HttpHandler.vcproj
trunk/MgDev/Web/src/HttpHandler/HttpHandlerBuild.cpp
trunk/MgDev/Web/src/HttpHandler/HttpRequest.cpp
trunk/MgDev/Web/src/HttpHandler/HttpResourceStrings.cpp
trunk/MgDev/Web/src/HttpHandler/HttpResourceStrings.h
trunk/MgDev/Web/src/HttpHandler/Makefile.am
trunk/MgDev/Web/src/IsapiAgent/IsapiAgent.cpp
trunk/MgDev/Web/src/viewerfiles/ajaxmappane.templ
Log:
Fix for trac ticket 1195 - Implement RFC 87 - SiteInformation enhancements
http://trac.osgeo.org/mapguide/ticket/1195
Notes:
- Implemented RFC 87
- Made the GetSiteVersion HTTP operation an actual operation instead of using the existing GetInformationProperties. This was mostly done for speed as GetInformationProperties returns way more information then needed for GetSiteVersion.
- Added GetSiteStatus HTTP operation
Modified: trunk/MgDev/Common/MapGuideCommon/Services/ServerAdmin.cpp
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/Services/ServerAdmin.cpp 2009-12-09 19:55:58 UTC (rev 4401)
+++ trunk/MgDev/Common/MapGuideCommon/Services/ServerAdmin.cpp 2009-12-09 21:05:09 UTC (rev 4402)
@@ -622,6 +622,63 @@
///////////////////////////////////////////////////////////////////////////////////
/// <summary>
+/// Gets the site version.
+/// </summary>
+/// <returns>
+/// The site version.
+/// </returns>
+///
+/// EXCEPTIONS:
+/// MgConnectionNotOpenException
+STRING MgServerAdmin::GetSiteVersion()
+{
+ MgCommand cmd;
+
+ cmd.ExecuteCommand(m_connProp, // Connection
+ MgCommand::knString, // Return type expected
+ MgServerAdminServiceOpId::GetSiteVersion, // Command Code
+ 0, // No of arguments
+ ServerAdmin_Service, // Service Id
+ BUILD_VERSION(1,0,0), // Operation version
+ MgCommand::knNone);
+
+ SetWarning(cmd.GetWarningObject());
+
+ STRING retVal = *(cmd.GetReturnValue().val.m_str);
+ delete cmd.GetReturnValue().val.m_str;
+
+ return retVal;
+}
+
+///////////////////////////////////////////////////////////////////////////////////
+/// <summary>
+/// Gets the status properties for the server.
+/// </summary>
+/// <returns>
+/// The collection of status properties.
+/// </returns>
+///
+/// EXCEPTIONS:
+/// MgConnectionNotOpenException
+MgPropertyCollection* MgServerAdmin::GetSiteStatus()
+{
+ MgCommand cmd;
+
+ cmd.ExecuteCommand(m_connProp, // Connection
+ MgCommand::knObject, // Return type expected
+ MgServerAdminServiceOpId::GetSiteStatus, // Command Code
+ 0, // No of arguments
+ ServerAdmin_Service, // Service Id
+ BUILD_VERSION(2,2,0), // Operation version
+ MgCommand::knNone);
+
+ SetWarning(cmd.GetWarningObject());
+
+ return (MgPropertyCollection*)cmd.GetReturnValue().val.m_obj;
+}
+
+///////////////////////////////////////////////////////////////////////////////////
+/// <summary>
/// Delete the specified package, if able.
/// </summary>
///
Modified: trunk/MgDev/Common/MapGuideCommon/Services/ServerAdmin.h
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/Services/ServerAdmin.h 2009-12-09 19:55:58 UTC (rev 4401)
+++ trunk/MgDev/Common/MapGuideCommon/Services/ServerAdmin.h 2009-12-09 21:05:09 UTC (rev 4402)
@@ -365,6 +365,28 @@
///////////////////////////////////////////////////////////////////////////////////
/// \brief
+ /// Gets the site version.
+ ///
+ /// \return
+ /// The site version.
+ ///
+ /// \exception MgConnectionNotOpenException
+ ///
+ STRING GetSiteVersion();
+
+ ///////////////////////////////////////////////////////////////////////////////////
+ /// \brief
+ /// Gets the status properties for the server.
+ ///
+ /// \return
+ /// The collection of status properties.
+ ///
+ /// \exception MgConnectionNotOpenException
+ ///
+ MgPropertyCollection* GetSiteStatus();
+
+ ///////////////////////////////////////////////////////////////////////////////////
+ /// \brief
/// Delete the specified package, if able.
///
/// \param packageName
Modified: trunk/MgDev/Common/MapGuideCommon/Services/ServerAdminDefs.cpp
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/Services/ServerAdminDefs.cpp 2009-12-09 19:55:58 UTC (rev 4401)
+++ trunk/MgDev/Common/MapGuideCommon/Services/ServerAdminDefs.cpp 2009-12-09 21:05:09 UTC (rev 4402)
@@ -76,3 +76,9 @@
const STRING MgServerInformationProperties::TotalConnections = L"TotalConnections";
const STRING MgServerInformationProperties::TotalActiveConnections = L"TotalActiveConnections";
const STRING MgServerInformationProperties::OperatingSystemVersion = L"OperatingSystemVersion";
+const STRING MgServerInformationProperties::ApiVersion = L"ApiVersion";
+const STRING MgServerInformationProperties::MachineIp = L"MachineIp";
+const STRING MgServerInformationProperties::WorkingSet = L"WorkingSet";
+const STRING MgServerInformationProperties::VirtualMemory = L"VirtualMemory";
+const STRING MgServerInformationProperties::CacheSize = L"CacheSize";
+const STRING MgServerInformationProperties::CacheDroppedEntries = L"CacheDroppedEntries";
Modified: trunk/MgDev/Common/MapGuideCommon/Services/ServerAdminDefs.h
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/Services/ServerAdminDefs.h 2009-12-09 19:55:58 UTC (rev 4401)
+++ trunk/MgDev/Common/MapGuideCommon/Services/ServerAdminDefs.h 2009-12-09 21:05:09 UTC (rev 4402)
@@ -114,6 +114,8 @@
/// The server's version
static const STRING ServerVersion; /// value("ServerVersion")
+ /// The API version
+ static const STRING ApiVersion; /// value("ApiVersion")
/// STATISTIC PROPERTIES SECTION -----------------------------------------------------------------------------------
@@ -156,6 +158,9 @@
/// Gets the server display name
static const STRING DisplayName; /// value("DisplayName")
+ /// Gets the server machine Ip
+ static const STRING MachineIp; /// value("MachineIp")
+
/// Gets the total operations received
static const STRING TotalReceivedOperations; /// value("TotalReceivedOperations")
@@ -170,6 +175,18 @@
/// Gets the operating system version
static const STRING OperatingSystemVersion; /// value("OperatingSystemVersion")
+
+ /// Gets the process working set memory
+ static const STRING WorkingSet; /// value("WorkingSet")
+
+ /// Gets the process virtual memory
+ static const STRING VirtualMemory; /// value("VirtualMemory")
+
+ /// Gets the current size of the server cache
+ static const STRING CacheSize; /// value("CacheSize")
+
+ /// Gets the number of dropped cache entries
+ static const STRING CacheDroppedEntries; /// value("CacheDroppedEntries")
};
@@ -209,6 +226,8 @@
static const int NotifyResourcesChanged = 0x1111EA1A;
static const int MakePackage = 0x1111EA1B;
static const int RemoveConfigurationProperties = 0x1111EA1C;
+ static const int GetSiteVersion = 0x1111EA1D;
+ static const int GetSiteStatus = 0x1111EA1E;
};
/// \endcond
Modified: trunk/MgDev/Common/ProductVersion.h
===================================================================
--- trunk/MgDev/Common/ProductVersion.h 2009-12-09 19:55:58 UTC (rev 4401)
+++ trunk/MgDev/Common/ProductVersion.h 2009-12-09 21:05:09 UTC (rev 4402)
@@ -19,5 +19,6 @@
#define PRODUCTVERSION_H_
const STRING ProductVersion = L"2.2.0.0";
+const STRING ApiVersion = L"2.2"; // Major.Minor only
#endif // PRODUCTVERSION_H_
Added: trunk/MgDev/Common/Schema/SiteInformation-2.2.0.xsd
===================================================================
--- trunk/MgDev/Common/Schema/SiteInformation-2.2.0.xsd (rev 0)
+++ trunk/MgDev/Common/Schema/SiteInformation-2.2.0.xsd 2009-12-09 21:05:09 UTC (rev 4402)
@@ -0,0 +1,157 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified" version="2.2.0">
+ <xs:element name="SiteInformation">
+ <xs:annotation>
+ <xs:documentation>Site Information</xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="SiteInformationType">
+ <xs:attribute name="version" type="xs:string" fixed="2.2.0"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:complexType name="SiteInformationType">
+ <xs:sequence>
+ <xs:element name="Server">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="IpAddress" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>The MapGuide server's Ip address.</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="DisplayName" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>The MapGuide server's display name.</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="Status" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>The MapGuide server's status. Either Online or Offline</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="Version" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>The MapGuide server's version.</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="OperatingSystem">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="AvailablePhysicalMemory" type="xs:integer">
+ <xs:annotation>
+ <xs:documentation>The available physical memory for the operating system in bytes.</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="TotalPhysicalMemory" type="xs:integer">
+ <xs:annotation>
+ <xs:documentation>The total physical memory for the operating system in bytes.</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="AvailableVirtualMemory" type="xs:integer">
+ <xs:annotation>
+ <xs:documentation>The available virtual memory for the operating system in bytes.</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="TotalVirtualMemory" type="xs:integer">
+ <xs:annotation>
+ <xs:documentation>The total virtual memory for the operating system in bytes.</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="Version" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>The operating system version.</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="Statistics">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="AdminOperationsQueueCount" type="xs:integer">
+ <xs:annotation>
+ <xs:documentation>The number of operations in the Admin queue.</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="ClientOperationsQueueCount" type="xs:integer">
+ <xs:annotation>
+ <xs:documentation>The number of operations in the Client queue.</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="SiteOperationsQueueCount" type="xs:integer">
+ <xs:annotation>
+ <xs:documentation>The number of operations in the Site queue.</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="AverageOperationTime" type="xs:integer">
+ <xs:annotation>
+ <xs:documentation>The average time it takes to process an operation in milliseconds.</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="CpuUtilization" type="xs:integer">
+ <xs:annotation>
+ <xs:documentation>The cpu utilization as a percentage.</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="WorkingSet" type="xs:integer">
+ <xs:annotation>
+ <xs:documentation>The working set memory of the MapGuide server in bytes.</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="VirtualMemory" type="xs:integer">
+ <xs:annotation>
+ <xs:documentation>The virtual memory of the MapGuide server in bytes.</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="TotalOperationTime" type="xs:integer">
+ <xs:annotation>
+ <xs:documentation>The total operation time of the MapGuide server in seconds.</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="ActiveConnections" type="xs:integer">
+ <xs:annotation>
+ <xs:documentation>The number of active connections to the MapGuide server.</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="TotalConnections" type="xs:integer">
+ <xs:annotation>
+ <xs:documentation>The total number of connections that have been made to the MapGuide server.</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="TotalOperationsProcessed" type="xs:integer">
+ <xs:annotation>
+ <xs:documentation>The total number of operations processed by the MapGuide server.</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="TotalOperationsReceived" type="xs:integer">
+ <xs:annotation>
+ <xs:documentation>The total number of operations received by the MapGuide server.</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="Uptime" type="xs:integer">
+ <xs:annotation>
+ <xs:documentation>The total time the MapGuide server has been running in seconds.</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="CacheSize" type="xs:integer">
+ <xs:annotation>
+ <xs:documentation>The current number of entries in the MapGuide server cache.</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="CacheDroppedEntries" type="xs:integer">
+ <xs:annotation>
+ <xs:documentation>The total number of entries in the MapGuide server cache that have been dropped.</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+</xs:schema>
Property changes on: trunk/MgDev/Common/Schema/SiteInformation-2.2.0.xsd
___________________________________________________________________
Added: svn:eol-style
+ native
Added: trunk/MgDev/Common/Schema/SiteStatus-2.2.0.xsd
===================================================================
--- trunk/MgDev/Common/Schema/SiteStatus-2.2.0.xsd (rev 0)
+++ trunk/MgDev/Common/Schema/SiteStatus-2.2.0.xsd 2009-12-09 21:05:09 UTC (rev 4402)
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified" version="2.2.0">
+ <xs:element name="SiteInformation">
+ <xs:annotation>
+ <xs:documentation>Site Status</xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="SiteStatusType">
+ <xs:attribute name="version" type="xs:string" fixed="2.2.0"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:complexType name="SiteStatusType">
+ <xs:sequence>
+ <xs:element name="Server">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="DisplayName" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>The MapGuide server's display name.</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="Status" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>The MapGuide server's status. Either Online or Offline</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ <xs:element name="ApiVersion" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>The MapGuide server's API version.</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+</xs:schema>
Property changes on: trunk/MgDev/Common/Schema/SiteStatus-2.2.0.xsd
___________________________________________________________________
Added: svn:eol-style
+ native
Added: trunk/MgDev/Common/Schema/SiteVersion-2.2.0.xsd
===================================================================
--- trunk/MgDev/Common/Schema/SiteVersion-2.2.0.xsd (rev 0)
+++ trunk/MgDev/Common/Schema/SiteVersion-2.2.0.xsd 2009-12-09 21:05:09 UTC (rev 4402)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
+ <xs:element name="SiteVersion">
+ <xs:annotation>
+ <xs:documentation>Site Version</xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:complexContent>
+ <xs:extension base="SiteVersionType">
+ <xs:attribute name="version" type="xs:string" fixed="2.2.0"/>
+ </xs:extension>
+ </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+ <xs:complexType name="SiteVersionType">
+ <xs:sequence>
+ <xs:element name="Server">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="Version" type="xs:string">
+ <xs:annotation>
+ <xs:documentation>The MapGuide server's version.</xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+</xs:schema>
Property changes on: trunk/MgDev/Common/Schema/SiteVersion-2.2.0.xsd
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: trunk/MgDev/Server/src/Common/Manager/ServerManager.cpp
===================================================================
--- trunk/MgDev/Server/src/Common/Manager/ServerManager.cpp 2009-12-09 19:55:58 UTC (rev 4401)
+++ trunk/MgDev/Server/src/Common/Manager/ServerManager.cpp 2009-12-09 21:05:09 UTC (rev 4402)
@@ -23,6 +23,14 @@
#include "WorkerThread.h"
#include "WorkerThreadData.h"
+#ifdef _WIN32
+#include <Psapi.h>
+#else
+#include <sys/time.h>
+#include <sys/resource.h>
+#include <unistd.h>
+#endif
+
const STRING MgServerManager::DocumentExtension = L".awd";
const STRING MgServerManager::DocumentPath = L"DocumentPath";
@@ -444,8 +452,8 @@
pProperties->Add(pProperty);
// Add the Uptime
- INT32 nUptime = GetUptime();
- pProperty = new MgInt32Property(MgServerInformationProperties::Uptime, nUptime);
+ time_t nUptime = GetUptime();
+ pProperty = new MgInt64Property(MgServerInformationProperties::Uptime, nUptime);
pProperties->Add(pProperty);
// Add the TotalPhysicalMemory
@@ -469,13 +477,13 @@
pProperties->Add(pProperty);
// Add the TotalOperationTime
- INT32 nTotalOperationTime = GetTotalOperationTime();
- pProperty = new MgInt32Property(MgServerInformationProperties::TotalOperationTime, nTotalOperationTime);
+ time_t nTotalOperationTime = GetTotalOperationTime();
+ pProperty = new MgInt64Property(MgServerInformationProperties::TotalOperationTime, nTotalOperationTime);
pProperties->Add(pProperty);
// Add the AverageOperationTime
- INT32 nAverageOperationTime = GetAverageOperationTime();
- pProperty = new MgInt32Property(MgServerInformationProperties::AverageOperationTime, nAverageOperationTime);
+ time_t nAverageOperationTime = GetAverageOperationTime();
+ pProperty = new MgInt64Property(MgServerInformationProperties::AverageOperationTime, nAverageOperationTime);
pProperties->Add(pProperty);
// Add the server Version
@@ -486,6 +494,10 @@
pProperty = new MgStringProperty(MgServerInformationProperties::DisplayName, m_displayName);
pProperties->Add(pProperty);
+ // Add the MachineIp
+ pProperty = new MgStringProperty(MgServerInformationProperties::MachineIp, m_localServerAddress);
+ pProperties->Add(pProperty);
+
// Add the Operations info
INT32 nTotalReceivedOperations = GetTotalReceivedOperations();
pProperty = new MgInt32Property(MgServerInformationProperties::TotalReceivedOperations, nTotalReceivedOperations);
@@ -509,11 +521,105 @@
pProperty = new MgStringProperty(MgServerInformationProperties::OperatingSystemVersion, osVersion);
pProperties->Add(pProperty);
+#ifdef _WIN32
+ HANDLE procHandle = GetCurrentProcess();
+ PROCESS_MEMORY_COUNTERS counters;
+ counters.cb = sizeof(counters);
+ BOOL ok = GetProcessMemoryInfo(procHandle, &counters, sizeof(counters));
+ if (ok)
+ {
+ pProperty = new MgInt64Property(MgServerInformationProperties::WorkingSet, counters.WorkingSetSize);
+ pProperties->Add(pProperty);
+ pProperty = new MgInt64Property(MgServerInformationProperties::VirtualMemory, counters.PagefileUsage);
+ pProperties->Add(pProperty);
+ }
+#else
+ // getrusage does not work on Linux so pull information directly
+ // from proc filesystem.
+ int pageSize = getpagesize();
+ char procName[256];
+ sprintf(procName,"/proc/%d/status",getpid());
+ FILE* fp = fopen(procName,"rb");
+ if (NULL != fp)
+ {
+ char buf[1024];
+ memset(buf,0,1024);
+ fread(buf, 1024, 1, fp);
+ fclose(fp);
+
+ char* strRss = "VmRSS:";
+ char* end = NULL;
+ char* loc = strstr(buf, strRss);
+ if (NULL != loc)
+ {
+ long kbytes = strtol(loc + strlen(strRss) + 1, &end, 10);
+ INT64 workingSet = kbytes * 1000;
+ pProperty = new MgInt64Property(MgServerInformationProperties::WorkingSet, workingSet);
+ pProperties->Add(pProperty);
+ }
+
+ char* strSize = "VmSize:";
+ loc = strstr(buf, strSize);
+ if (NULL != loc)
+ {
+ long kbytes = strtol(loc + strlen(strSize) + 1, &end, 10);
+ INT64 workingSet = kbytes * 1000;
+ pProperty = new MgInt64Property(MgServerInformationProperties::VirtualMemory, workingSet);
+ pProperties->Add(pProperty);
+ }
+ }
+#endif
+
MG_CATCH_AND_THROW(L"MgServerManager.GetInformationProperties")
return pProperties.Detach();
}
+///////////////////////////////////////////////////////////////////////////////////
+/// <summary>
+/// Gets the site version.
+/// </summary>
+STRING MgServerManager::GetSiteVersion()
+{
+ return ProductVersion;
+}
+
+///////////////////////////////////////////////////////////////////////////////////
+/// <summary>
+/// Gets the status properties for the server.
+/// </summary>
+MgPropertyCollection* MgServerManager::GetSiteStatus()
+{
+ Ptr<MgPropertyCollection> pProperties;
+ pProperties = NULL;
+
+ MG_TRY()
+
+ MG_LOG_TRACE_ENTRY(L"MgServerManager::GetSiteStatus()");
+
+ pProperties = new MgPropertyCollection();
+
+ // Add the information properties
+ Ptr<MgProperty> pProperty;
+
+ // Add the DisplayName
+ pProperty = new MgStringProperty(MgServerInformationProperties::DisplayName, m_displayName);
+ pProperties->Add(pProperty);
+
+ // Add the Status
+ bool bOnline = IsOnline();
+ pProperty = new MgBooleanProperty(MgServerInformationProperties::Status, bOnline);
+ pProperties->Add(pProperty);
+
+ // Add the API Version
+ pProperty = new MgStringProperty(MgServerInformationProperties::ApiVersion, ApiVersion);
+ pProperties->Add(pProperty);
+
+ MG_CATCH_AND_THROW(L"MgServerManager.GetSiteStatus")
+
+ return pProperties.Detach();
+}
+
MgByteReader* MgServerManager::GetDocument(CREFSTRING identifier)
{
Ptr<MgByteReader> pByteReader;
@@ -711,12 +817,12 @@
return m_totalProcessedOperations.value();
}
-INT32 MgServerManager::GetTotalOperationTime()
+time_t MgServerManager::GetTotalOperationTime()
{
return m_totalOperationTime.value();
}
-void MgServerManager::IncrementOperationTime(INT32 operationTime)
+void MgServerManager::IncrementOperationTime(time_t operationTime)
{
m_totalOperationTime += operationTime;
}
@@ -1022,7 +1128,7 @@
///
/// EXCEPTIONS:
/// MgConnectionNotOpenException
-INT32 MgServerManager::GetUptime()
+time_t MgServerManager::GetUptime()
{
ACE_Time_Value upTime(0);
@@ -1032,7 +1138,7 @@
MG_CATCH_AND_THROW(L"MgServerManager.GetUptime");
- return (INT32)upTime.sec();
+ return upTime.sec();
}
///////////////////////////////////////////////////////////////////////////////////
@@ -1045,7 +1151,7 @@
///
/// EXCEPTIONS:
/// MgConnectionNotOpenException
-INT32 MgServerManager::GetAverageOperationTime()
+time_t MgServerManager::GetAverageOperationTime()
{
double avgTime = 0.0;
@@ -1059,7 +1165,7 @@
MG_CATCH_AND_THROW(L"MgServerManager.GetAverageOperationTime")
- return (INT32)avgTime;
+ return time_t(avgTime);
}
///////////////////////////////////////////////////////////////////////////////////
Modified: trunk/MgDev/Server/src/Common/Manager/ServerManager.h
===================================================================
--- trunk/MgDev/Server/src/Common/Manager/ServerManager.h 2009-12-09 19:55:58 UTC (rev 4401)
+++ trunk/MgDev/Server/src/Common/Manager/ServerManager.h 2009-12-09 21:05:09 UTC (rev 4402)
@@ -36,6 +36,7 @@
class MgWorkerThread;
typedef ACE_Atomic_Op<ACE_Thread_Mutex, INT32> SAFE_INT32;
+typedef ACE_Atomic_Op<ACE_Thread_Mutex, time_t> SAFE_TIME_T;
class MG_SERVER_MANAGER_API MgServerManager : public MgGuardDisposable
{
@@ -60,6 +61,8 @@
void RemoveConfigurationProperties(CREFSTRING propertySection, MgPropertyCollection* properties);
MgPropertyCollection* GetInformationProperties();
+ MgPropertyCollection* GetSiteStatus();
+ STRING GetSiteVersion();
MgByteReader* GetDocument(CREFSTRING identifier);
void SetDocument(CREFSTRING identifier, MgByteReader* data);
@@ -97,9 +100,9 @@
ACE_Time_Value GetStartTime();
INT32 GetTotalReceivedOperations();
INT32 GetTotalProcessedOperations();
- INT32 GetTotalOperationTime();
+ time_t GetTotalOperationTime();
- void IncrementOperationTime(INT32 operationTime);
+ void IncrementOperationTime(time_t operationTime);
void IncrementReceivedOperations();
void IncrementProcessedOperations();
@@ -114,8 +117,8 @@
INT32 GetClientOperationsQueueCount();
INT32 GetSiteOperationsQueueCount();
- INT32 GetUptime();
- INT32 GetAverageOperationTime();
+ time_t GetUptime();
+ time_t GetAverageOperationTime();
INT64 GetTotalPhysicalMemory();
INT64 GetAvailablePhysicalMemory();
@@ -173,7 +176,7 @@
INT32 m_nSiteThreads;
ACE_Time_Value m_startTime;
- SAFE_INT32 m_totalOperationTime; // This value is tracked in seconds
+ SAFE_TIME_T m_totalOperationTime; // This value is tracked in seconds
SAFE_INT32 m_totalReceivedOperations;
SAFE_INT32 m_totalProcessedOperations;
Modified: trunk/MgDev/Server/src/Common/Manager/ServerManager.vcproj
===================================================================
--- trunk/MgDev/Server/src/Common/Manager/ServerManager.vcproj 2009-12-09 19:55:58 UTC (rev 4401)
+++ trunk/MgDev/Server/src/Common/Manager/ServerManager.vcproj 2009-12-09 21:05:09 UTC (rev 4402)
@@ -65,7 +65,7 @@
/>
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="ACEd.lib FDO.lib FDOCommon.lib pdh.lib"
+ AdditionalDependencies="ACEd.lib FDO.lib FDOCommon.lib pdh.lib psapi.lib"
OutputFile="$(OutDir)\MgServerManagerd.dll"
LinkIncremental="2"
AdditionalLibraryDirectories="..\..\..\..\Oem\ACE\ACE_wrappers\lib;..\..\..\..\Oem\FDO\lib"
@@ -147,7 +147,7 @@
/>
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="ACEd.lib FDO.lib FDOCommon.lib pdh.lib"
+ AdditionalDependencies="ACEd.lib FDO.lib FDOCommon.lib pdh.lib psapi.lib"
OutputFile="$(OutDir)\MgServerManagerd.dll"
LinkIncremental="2"
AdditionalLibraryDirectories="..\..\..\..\Oem\ACE\ACE_wrappers\lib64;..\..\..\..\Oem\FDO\lib64"
@@ -225,7 +225,7 @@
/>
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="ACE.lib FDO.lib FDOCommon.lib pdh.lib"
+ AdditionalDependencies="ACE.lib FDO.lib FDOCommon.lib pdh.lib psapi.lib"
OutputFile="$(OutDir)\MgServerManager.dll"
LinkIncremental="1"
AdditionalLibraryDirectories="..\..\..\..\Oem\ACE\ACE_wrappers\lib;..\..\..\..\Oem\FDO\lib"
@@ -306,7 +306,7 @@
/>
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="ACE.lib FDO.lib FDOCommon.lib pdh.lib"
+ AdditionalDependencies="ACE.lib FDO.lib FDOCommon.lib pdh.lib psapi.lib"
OutputFile="$(OutDir)\MgServerManager.dll"
LinkIncremental="1"
AdditionalLibraryDirectories="..\..\..\..\Oem\ACE\ACE_wrappers\lib64;..\..\..\..\Oem\FDO\lib64"
Modified: trunk/MgDev/Server/src/Core/OperationThread.cpp
===================================================================
--- trunk/MgDev/Server/src/Core/OperationThread.cpp 2009-12-09 19:55:58 UTC (rev 4401)
+++ trunk/MgDev/Server/src/Core/OperationThread.cpp 2009-12-09 21:05:09 UTC (rev 4402)
@@ -408,7 +408,7 @@
// We increment operations processed for successful operations only.
if (IMgServiceHandler::mpsDone == stat)
{
- INT32 opTime = operationTime.sec();
+ time_t opTime = operationTime.sec();
pConnection->IncrementProcessedOperations();
pConnection->SetCurrentOperationTime(opTime);
Modified: trunk/MgDev/Server/src/Services/ServerAdmin/Makefile.am
===================================================================
--- trunk/MgDev/Server/src/Services/ServerAdmin/Makefile.am 2009-12-09 19:55:58 UTC (rev 4401)
+++ trunk/MgDev/Server/src/Services/ServerAdmin/Makefile.am 2009-12-09 21:05:09 UTC (rev 4402)
@@ -35,6 +35,8 @@
OpGetLogFile.cpp \
OpGetPackageLog.cpp \
OpGetPackageStatus.cpp \
+ OpGetSiteStatus.cpp \
+ OpGetSiteVersion.cpp \
OpIsMaximumLogSizeEnabled.cpp \
OpIsOnline.cpp \
OpLoadPackage.cpp \
@@ -69,6 +71,8 @@
OpGetLogFile.h \
OpGetPackageLog.h \
OpGetPackageStatus.h \
+ OpGetSiteStatus.h \
+ OpGetSiteVersion.h \
OpIsMaximumLogSizeEnabled.h \
OpIsOnline.h \
OpLoadPackage.h \
Added: trunk/MgDev/Server/src/Services/ServerAdmin/OpGetSiteStatus.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/ServerAdmin/OpGetSiteStatus.cpp (rev 0)
+++ trunk/MgDev/Server/src/Services/ServerAdmin/OpGetSiteStatus.cpp 2009-12-09 21:05:09 UTC (rev 4402)
@@ -0,0 +1,117 @@
+//
+// Copyright (C) 2004-2009 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#include "MapGuideCommon.h"
+#include "ServerAdminService.h"
+#include "OpGetSiteStatus.h"
+#include "LogManager.h"
+
+
+///----------------------------------------------------------------------------
+/// <summary>
+/// Constructs the object.
+/// </summary>
+///----------------------------------------------------------------------------
+MgOpGetSiteStatus::MgOpGetSiteStatus()
+{
+}
+
+
+///----------------------------------------------------------------------------
+/// <summary>
+/// Destructs the object.
+/// </summary>
+///----------------------------------------------------------------------------
+MgOpGetSiteStatus::~MgOpGetSiteStatus()
+{
+}
+
+
+///----------------------------------------------------------------------------
+/// <summary>
+/// Gets the role(s) required to perform this operation.
+/// </summary>
+///----------------------------------------------------------------------------
+MgStringCollection* MgOpGetSiteStatus::GetRoles() const
+{
+ return NULL; // for anonymous/everyone
+}
+
+
+///----------------------------------------------------------------------------
+/// <summary>
+/// Executes the operation.
+/// </summary>
+///
+/// <exceptions>
+/// MgException
+/// </exceptions>
+///----------------------------------------------------------------------------
+void MgOpGetSiteStatus::Execute()
+{
+ ACE_DEBUG((LM_DEBUG, ACE_TEXT(" (%t) MgOpGetSiteStatus::Execute()\n")));
+
+ MG_LOG_OPERATION_MESSAGE(L"MgOpGetSiteStatus");
+
+ MG_TRY()
+
+ MG_LOG_OPERATION_MESSAGE_INIT(m_packet.m_OperationVersion, m_packet.m_NumArguments);
+
+ ACE_ASSERT(m_stream != NULL);
+
+ if (0 == m_packet.m_NumArguments)
+ {
+ BeginExecution();
+
+ MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
+ MG_LOG_OPERATION_MESSAGE_PARAMETERS_END();
+
+ // Authentication not required for this operation
+ //Validate();
+
+ Ptr<MgPropertyCollection> propertyCollection = m_service->GetSiteStatus();
+
+ EndExecution(propertyCollection);
+ }
+ else
+ {
+ MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
+ MG_LOG_OPERATION_MESSAGE_PARAMETERS_END();
+ }
+
+ if (!m_argsRead)
+ {
+ throw new MgOperationProcessingException(L"MgOpGetSiteStatus.Execute",
+ __LINE__, __WFILE__, NULL, L"", NULL);
+ }
+
+ // Successful operation
+ MG_LOG_OPERATION_MESSAGE_ADD_STRING(MgResources::Success.c_str());
+
+ MG_CATCH(L"MgOpGetSiteStatus.Execute")
+
+ if (mgException != NULL)
+ {
+ // Failed operation
+ MG_LOG_OPERATION_MESSAGE_ADD_STRING(MgResources::Failure.c_str());
+ }
+
+ // Add admin log entry for operation
+ MG_LOG_OPERATION_MESSAGE_ADMIN_ENTRY();
+
+ MG_THROW()
+}
Property changes on: trunk/MgDev/Server/src/Services/ServerAdmin/OpGetSiteStatus.cpp
___________________________________________________________________
Added: svn:eol-style
+ native
Added: trunk/MgDev/Server/src/Services/ServerAdmin/OpGetSiteStatus.h
===================================================================
--- trunk/MgDev/Server/src/Services/ServerAdmin/OpGetSiteStatus.h (rev 0)
+++ trunk/MgDev/Server/src/Services/ServerAdmin/OpGetSiteStatus.h 2009-12-09 21:05:09 UTC (rev 4402)
@@ -0,0 +1,36 @@
+//
+// Copyright (C) 2004-2009 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#ifndef MGOPGETSITESTATUS_H_
+#define MGOPGETSITESTATUS_H_
+
+#include "ServerAdminOperation.h"
+
+class MgOpGetSiteStatus : public MgServerAdminOperation
+{
+ public:
+ MgOpGetSiteStatus();
+ virtual ~MgOpGetSiteStatus();
+
+ public:
+ virtual void Execute();
+
+ protected:
+ virtual MgStringCollection* GetRoles() const;
+};
+
+#endif
Property changes on: trunk/MgDev/Server/src/Services/ServerAdmin/OpGetSiteStatus.h
___________________________________________________________________
Added: svn:eol-style
+ native
Added: trunk/MgDev/Server/src/Services/ServerAdmin/OpGetSiteVersion.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/ServerAdmin/OpGetSiteVersion.cpp (rev 0)
+++ trunk/MgDev/Server/src/Services/ServerAdmin/OpGetSiteVersion.cpp 2009-12-09 21:05:09 UTC (rev 4402)
@@ -0,0 +1,116 @@
+//
+// Copyright (C) 2004-2009 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#include "MapGuideCommon.h"
+#include "ServerAdminService.h"
+#include "OpGetSiteVersion.h"
+#include "LogManager.h"
+
+
+///----------------------------------------------------------------------------
+/// <summary>
+/// Constructs the object.
+/// </summary>
+///----------------------------------------------------------------------------
+MgOpGetSiteVersion::MgOpGetSiteVersion()
+{
+}
+
+
+///----------------------------------------------------------------------------
+/// <summary>
+/// Destructs the object.
+/// </summary>
+///----------------------------------------------------------------------------
+MgOpGetSiteVersion::~MgOpGetSiteVersion()
+{
+}
+
+
+///----------------------------------------------------------------------------
+/// <summary>
+/// Gets the role(s) required to perform this operation.
+/// </summary>
+///----------------------------------------------------------------------------
+MgStringCollection* MgOpGetSiteVersion::GetRoles() const
+{
+ return NULL; // for anonymous/everyone
+}
+
+
+///----------------------------------------------------------------------------
+/// <summary>
+/// Executes the operation.
+/// </summary>
+///
+/// <exceptions>
+/// MgException
+/// </exceptions>
+///----------------------------------------------------------------------------
+void MgOpGetSiteVersion::Execute()
+{
+ ACE_DEBUG((LM_DEBUG, ACE_TEXT(" (%t) MgOpGetSiteVersion::Execute()\n")));
+
+ MG_LOG_OPERATION_MESSAGE(L"MgOpGetSiteVersion");
+
+ MG_TRY()
+
+ MG_LOG_OPERATION_MESSAGE_INIT(m_packet.m_OperationVersion, m_packet.m_NumArguments);
+
+ ACE_ASSERT(m_stream != NULL);
+
+ if (0 == m_packet.m_NumArguments)
+ {
+ BeginExecution();
+
+ MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
+ MG_LOG_OPERATION_MESSAGE_PARAMETERS_END();
+
+ Validate();
+
+ STRING version = m_service->GetSiteVersion();
+
+ EndExecution(version);
+ }
+ else
+ {
+ MG_LOG_OPERATION_MESSAGE_PARAMETERS_START();
+ MG_LOG_OPERATION_MESSAGE_PARAMETERS_END();
+ }
+
+ if (!m_argsRead)
+ {
+ throw new MgOperationProcessingException(L"MgOpGetSiteVersion.Execute",
+ __LINE__, __WFILE__, NULL, L"", NULL);
+ }
+
+ // Successful operation
+ MG_LOG_OPERATION_MESSAGE_ADD_STRING(MgResources::Success.c_str());
+
+ MG_CATCH(L"MgOpGetSiteVersion.Execute")
+
+ if (mgException != NULL)
+ {
+ // Failed operation
+ MG_LOG_OPERATION_MESSAGE_ADD_STRING(MgResources::Failure.c_str());
+ }
+
+ // Add admin log entry for operation
+ MG_LOG_OPERATION_MESSAGE_ADMIN_ENTRY();
+
+ MG_THROW()
+}
Property changes on: trunk/MgDev/Server/src/Services/ServerAdmin/OpGetSiteVersion.cpp
___________________________________________________________________
Added: svn:eol-style
+ native
Added: trunk/MgDev/Server/src/Services/ServerAdmin/OpGetSiteVersion.h
===================================================================
--- trunk/MgDev/Server/src/Services/ServerAdmin/OpGetSiteVersion.h (rev 0)
+++ trunk/MgDev/Server/src/Services/ServerAdmin/OpGetSiteVersion.h 2009-12-09 21:05:09 UTC (rev 4402)
@@ -0,0 +1,36 @@
+//
+// Copyright (C) 2004-2009 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#ifndef MGOPGETSITEVERSION_H_
+#define MGOPGETSITEVERSION_H_
+
+#include "ServerAdminOperation.h"
+
+class MgOpGetSiteVersion : public MgServerAdminOperation
+{
+ public:
+ MgOpGetSiteVersion();
+ virtual ~MgOpGetSiteVersion();
+
+ public:
+ virtual void Execute();
+
+ protected:
+ virtual MgStringCollection* GetRoles() const;
+};
+
+#endif
Property changes on: trunk/MgDev/Server/src/Services/ServerAdmin/OpGetSiteVersion.h
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: trunk/MgDev/Server/src/Services/ServerAdmin/ServerAdminOperationFactory.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/ServerAdmin/ServerAdminOperationFactory.cpp 2009-12-09 19:55:58 UTC (rev 4401)
+++ trunk/MgDev/Server/src/Services/ServerAdmin/ServerAdminOperationFactory.cpp 2009-12-09 21:05:09 UTC (rev 4402)
@@ -35,6 +35,8 @@
#include "OpGetLogFile.h"
#include "OpGetPackageLog.h"
#include "OpGetPackageStatus.h"
+#include "OpGetSiteStatus.h"
+#include "OpGetSiteVersion.h"
#include "OpIsMaximumLogSizeEnabled.h"
#include "OpIsOnline.h"
#include "OpLoadPackage.h"
@@ -301,6 +303,28 @@
}
break;
+ case MgServerAdminServiceOpId::GetSiteVersion:
+ switch (VERSION_NO_PHASE(operationVersion))
+ {
+ case VERSION_SUPPORTED(1,0): // Original 1.0 operation actually called GetInformationProperties
+ handler.reset(new MgOpGetSiteVersion());
+ break;
+ default:
+ break;
+ }
+ break;
+
+ case MgServerAdminServiceOpId::GetSiteStatus:
+ switch (VERSION_NO_PHASE(operationVersion))
+ {
+ case VERSION_SUPPORTED(2,2):
+ handler.reset(new MgOpGetSiteStatus());
+ break;
+ default:
+ break;
+ }
+ break;
+
case MgServerAdminServiceOpId::RegisterServicesOnServers :
switch (VERSION_NO_PHASE(operationVersion))
{
Modified: trunk/MgDev/Server/src/Services/ServerAdmin/ServerAdminService.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/ServerAdmin/ServerAdminService.cpp 2009-12-09 19:55:58 UTC (rev 4401)
+++ trunk/MgDev/Server/src/Services/ServerAdmin/ServerAdminService.cpp 2009-12-09 21:05:09 UTC (rev 4402)
@@ -550,6 +550,57 @@
return pProperties.Detach();
}
+//////////////////////////////////////////////////////////////////
+/// <summary>
+/// Gets the site version.
+/// </summary>
+STRING MgServerAdminService::GetSiteVersion()
+{
+ STRING version = L"";
+
+ MG_TRY()
+
+ MG_LOG_TRACE_ENTRY(L"MgServerAdminService::GetSiteVersion()");
+
+ MgServerManager* pMan = MgServerManager::GetInstance();
+ if (NULL == pMan)
+ {
+ throw new MgNullReferenceException(L"MgServerAdminService::GetSiteVersion", __LINE__, __WFILE__, NULL, L"", NULL);
+ }
+
+ version = pMan->GetSiteVersion();
+
+ MG_CATCH_AND_THROW(L"MgServerAdminService.GetSiteVersion");
+
+ return version;
+}
+
+//////////////////////////////////////////////////////////////////
+/// <summary>
+/// Gets the status properties for the server.
+/// </summary>
+MgPropertyCollection* MgServerAdminService::GetSiteStatus()
+{
+ Ptr<MgPropertyCollection> pProperties;
+ pProperties = NULL;
+
+ MG_TRY()
+
+ MG_LOG_TRACE_ENTRY(L"MgServerAdminService::GetSiteStatus()");
+
+ MgServerManager* pMan = MgServerManager::GetInstance();
+ if (NULL == pMan)
+ {
+ throw new MgNullReferenceException(L"MgServerAdminService::GetSiteStatus", __LINE__, __WFILE__, NULL, L"", NULL);
+ }
+
+ pProperties = pMan->GetSiteStatus();
+
+ MG_CATCH_AND_THROW(L"MgServerAdminService.GetSiteStatus");
+
+ return pProperties.Detach();
+}
+
///----------------------------------------------------------------------------
/// <summary>
/// Registers services on the specified servers.
Modified: trunk/MgDev/Server/src/Services/ServerAdmin/ServerAdminService.h
===================================================================
--- trunk/MgDev/Server/src/Services/ServerAdmin/ServerAdminService.h 2009-12-09 19:55:58 UTC (rev 4401)
+++ trunk/MgDev/Server/src/Services/ServerAdmin/ServerAdminService.h 2009-12-09 21:05:09 UTC (rev 4402)
@@ -62,6 +62,8 @@
void SetDocument(CREFSTRING identifier, MgByteReader* data);
MgPropertyCollection* GetInformationProperties();
+ MgPropertyCollection* GetSiteStatus();
+ STRING GetSiteVersion();
// Service Management Methods
Modified: trunk/MgDev/Server/src/Services/ServerAdmin/ServerAdminService.vcproj
===================================================================
--- trunk/MgDev/Server/src/Services/ServerAdmin/ServerAdminService.vcproj 2009-12-09 19:55:58 UTC (rev 4401)
+++ trunk/MgDev/Server/src/Services/ServerAdmin/ServerAdminService.vcproj 2009-12-09 21:05:09 UTC (rev 4402)
@@ -951,6 +951,86 @@
>
</File>
<File
+ RelativePath=".\OpGetSiteStatus.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|x64"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|x64"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\OpGetSiteStatus.h"
+ >
+ </File>
+ <File
+ RelativePath=".\OpGetSiteVersion.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|x64"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|x64"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\OpGetSiteVersion.h"
+ >
+ </File>
+ <File
RelativePath=".\OpIsMaximumLogSizeEnabled.cpp"
>
<FileConfiguration
Modified: trunk/MgDev/Server/src/Services/ServerAdmin/ServerAdminServiceBuild.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/ServerAdmin/ServerAdminServiceBuild.cpp 2009-12-09 19:55:58 UTC (rev 4401)
+++ trunk/MgDev/Server/src/Services/ServerAdmin/ServerAdminServiceBuild.cpp 2009-12-09 21:05:09 UTC (rev 4402)
@@ -32,6 +32,8 @@
#include "OpGetLogFile.cpp"
#include "OpGetPackageLog.cpp"
#include "OpGetPackageStatus.cpp"
+#include "OpGetSiteStatus.cpp"
+#include "OpGetSiteVersion.cpp"
#include "OpIsOnline.cpp"
#include "OpIsMaximumLogSizeEnabled.cpp"
#include "OpLoadPackage.cpp"
Modified: trunk/MgDev/UnitTest/WebTier/MapAgent/MapAgentForms/getsiteinfoform.html
===================================================================
--- trunk/MgDev/UnitTest/WebTier/MapAgent/MapAgentForms/getsiteinfoform.html 2009-12-09 19:55:58 UTC (rev 4401)
+++ trunk/MgDev/UnitTest/WebTier/MapAgent/MapAgentForms/getsiteinfoform.html 2009-12-09 21:05:09 UTC (rev 4402)
@@ -13,7 +13,7 @@
<b>Operation:</b>
<input type="text" name="OPERATION" value="GETSITEINFO" size="50" ID="Text1">
<p> Version:
- <input type="text" name="VERSION" value="1.0.0" size="10" ID="Text2">
+ <input type="text" name="VERSION" value="2.2.0" size="10" ID="Text2">
<p> Locale:
<input type="text" name="LOCALE" value="en" size="10" ID="Text4">
<p> Client Agent:
Added: trunk/MgDev/UnitTest/WebTier/MapAgent/MapAgentForms/getsitestatusform.html
===================================================================
--- trunk/MgDev/UnitTest/WebTier/MapAgent/MapAgentForms/getsitestatusform.html (rev 0)
+++ trunk/MgDev/UnitTest/WebTier/MapAgent/MapAgentForms/getsitestatusform.html 2009-12-09 21:05:09 UTC (rev 4402)
@@ -0,0 +1,25 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+ <head>
+ <title></title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
+ <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
+ <script type="text/javascript" src="setactiontarget.js" >
+ </script>
+ </head>
+ <body>
+ <form name="input" action="" method="get" ID="Form1">
+ <b>Operation:</b>
+ <input type="text" name="OPERATION" value="GETSITESTATUS" size="50" ID="Text1">
+ <p> Version:
+ <input type="text" name="VERSION" value="2.1.0" size="10" ID="Text2">
+ <p> Locale:
+ <input type="text" name="LOCALE" value="en" size="10" ID="Text4">
+ <p> Client Agent:
+ <input type="text" name="CLIENTAGENT" value="MapGuide Developer" size="100">
+ <p>
+ <input type="submit" value="Submit" onclick="SetActionTarget()"> <input type="reset">
+ </form>
+ </body>
+</html>
Property changes on: trunk/MgDev/UnitTest/WebTier/MapAgent/MapAgentForms/getsitestatusform.html
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: trunk/MgDev/UnitTest/WebTier/MapAgent/MapAgentForms/getsiteversionform.html
===================================================================
--- trunk/MgDev/UnitTest/WebTier/MapAgent/MapAgentForms/getsiteversionform.html 2009-12-09 19:55:58 UTC (rev 4401)
+++ trunk/MgDev/UnitTest/WebTier/MapAgent/MapAgentForms/getsiteversionform.html 2009-12-09 21:05:09 UTC (rev 4402)
@@ -13,7 +13,7 @@
<b>Operation:</b>
<input type="text" name="OPERATION" value="GETSITEVERSION" size="50" ID="Text1">
<p> Version:
- <input type="text" name="VERSION" value="1.0.0" size="10" ID="Text2">
+ <input type="text" name="VERSION" value="2.2.0" size="10" ID="Text2">
<p> Locale:
<input type="text" name="LOCALE" value="en" size="10" ID="Text4">
<p> Client Agent:
Modified: trunk/MgDev/UnitTest/WebTier/MapAgent/MapAgentForms/siteserviceapi.html
===================================================================
--- trunk/MgDev/UnitTest/WebTier/MapAgent/MapAgentForms/siteserviceapi.html 2009-12-09 19:55:58 UTC (rev 4401)
+++ trunk/MgDev/UnitTest/WebTier/MapAgent/MapAgentForms/siteserviceapi.html 2009-12-09 21:05:09 UTC (rev 4402)
@@ -10,8 +10,9 @@
<ul>
<li><a href="enumerateusersform.html" target="showform">EnumerateUsers</a>
<li><a href="enumerategroupsform.html" target="showform">EnumerateGroups</a>
+<li><a href="getsiteinfoform.html" target="showform">GetSiteInfo</a>
+<li><a href="getsitestatusform.html" target="showform">GetSiteStatus</a>
<li><a href="getsiteversionform.html" target="showform">GetSiteVersion</a>
-<li><a href="getsiteinfoform.html" target="showform">GetSiteInfo</a>
</ul>
</body>
Modified: trunk/MgDev/Web/src/ApacheAgent/ApacheAgent.cpp
===================================================================
--- trunk/MgDev/Web/src/ApacheAgent/ApacheAgent.cpp 2009-12-09 19:55:58 UTC (rev 4401)
+++ trunk/MgDev/Web/src/ApacheAgent/ApacheAgent.cpp 2009-12-09 21:05:09 UTC (rev 4402)
@@ -202,6 +202,13 @@
if (!bValid)
bValid = params->GetXmlPostData().length() != 0;
+ // Certain operations do not require authentication
+ STRING operation = params->GetParameterValue(L"OPERATION");
+ if((_wcsicmp(operation.c_str(), L"GETSITESTATUS") == 0))
+ {
+ bValid = true;
+ }
+
if (!bValid)
{
// Invalid authentication information is not fatal, we should continue.
Modified: trunk/MgDev/Web/src/CgiAgent/CgiAgent.cpp
===================================================================
--- trunk/MgDev/Web/src/CgiAgent/CgiAgent.cpp 2009-12-09 19:55:58 UTC (rev 4401)
+++ trunk/MgDev/Web/src/CgiAgent/CgiAgent.cpp 2009-12-09 21:05:09 UTC (rev 4402)
@@ -210,6 +210,13 @@
if (!bValid)
bValid = params->GetXmlPostData().length() != 0;
+ // Certain operations do not require authentication
+ STRING operation = params->GetParameterValue(L"OPERATION");
+ if((_wcsicmp(operation.c_str(), L"GETSITESTATUS") == 0))
+ {
+ bValid = true;
+ }
+
if (!bValid)
{
// Invalid authentication information is not fatal, we should continue.
Modified: trunk/MgDev/Web/src/HttpHandler/HttpGetSiteInfo.cpp
===================================================================
--- trunk/MgDev/Web/src/HttpHandler/HttpGetSiteInfo.cpp 2009-12-09 19:55:58 UTC (rev 4401)
+++ trunk/MgDev/Web/src/HttpHandler/HttpGetSiteInfo.cpp 2009-12-09 21:05:09 UTC (rev 4402)
@@ -52,14 +52,79 @@
// Check common parameters
ValidateCommonParameters();
- // Create ServerAdmin object
- Ptr<MgServerAdmin> serverAdmin = new MgServerAdmin();
- serverAdmin->Open(m_userInfo);
+ STRING xml;
+ xml += BeginXml();
- // call the C++ APIs
- Ptr<MgPropertyCollection> properties = serverAdmin->GetInformationProperties();
- STRING xml = GetXml(properties);
+ if (m_userInfo->GetApiVersion() >= MG_API_VERSION(2,2,0))
+ {
+ MgSiteManager* siteManager = MgSiteManager::GetInstance();
+ if(siteManager)
+ {
+ MgSiteVector* sites = siteManager->GetSites();
+ if(sites)
+ {
+ for(size_t i=0;i<sites->size();i++)
+ {
+ MgSiteInfo* siteInfo = sites->at(i);
+ // Check the server status - though this status could be out of date and an exception might be thrown
+ bool bHaveSiteInfo = false;
+ STRING message = MgResources::Unknown;
+
+ if (MgSiteInfo::Ok == siteInfo->GetStatus())
+ {
+ MG_HTTP_HANDLER_TRY()
+
+ // Create ServerAdmin object
+ Ptr<MgServerAdmin> serverAdmin = new MgServerAdmin();
+ serverAdmin->Open(siteInfo->GetTarget(), m_userInfo);
+
+ // call the C++ APIs
+ Ptr<MgPropertyCollection> properties = serverAdmin->GetInformationProperties();
+ xml += GetXml(properties);
+ bHaveSiteInfo = true;
+
+ MG_HTTP_HANDLER_CATCH(L"MgHttpGetSiteInfo.Execute")
+ if (mgException != NULL)
+ {
+ message = mgException->GetMessage();
+ }
+ }
+
+ if(!bHaveSiteInfo)
+ {
+ // This server is not available
+ xml += L"\t<Server>\n";
+
+ xml += L"\t\t<IpAddress>";
+ xml += siteInfo->GetTarget();
+ xml += L"</IpAddress>\n";
+ xml += L"\t\t<DisplayName></DisplayName>\n";
+ xml += L"\t\t<Status>";
+ xml += message;
+ xml += L"</Status>\n";
+ xml += L"\t\t<Version></Version>\n";
+ xml += L"\t\t<OperatingSystem></OperatingSystem>\n";
+ xml += L"\t\t<Statistics></Statistics>\n";
+
+ xml += L"\t</Server>\n";
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ // Create ServerAdmin object
+ Ptr<MgServerAdmin> serverAdmin = new MgServerAdmin();
+ serverAdmin->Open(m_userInfo);
+
+ // call the C++ APIs
+ Ptr<MgPropertyCollection> properties = serverAdmin->GetInformationProperties();
+ xml += GetXml(properties);
+ }
+ xml += EndXml();
+
Ptr<MgHttpPrimitiveValue> value = new MgHttpPrimitiveValue(xml);
if(!value)
throw new MgOutOfMemoryException(L"", __LINE__, __WFILE__, NULL, L"", NULL);
@@ -69,6 +134,32 @@
MG_HTTP_HANDLER_CATCH_AND_THROW_EX(L"MgHttpGetSiteInfo.Execute")
}
+STRING MgHttpGetSiteInfo::BeginXml()
+{
+ STRING xml = L"";
+
+ xml += L"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
+ if (m_userInfo->GetApiVersion() >= MG_API_VERSION(2,2,0))
+ {
+ xml += L"<SiteInformation xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"SiteInformation-2.2.0.xsd\">\n";
+ }
+ else
+ {
+ xml += L"<SiteInformation xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"SiteInformation-1.0.0.xsd\">\n";
+ }
+
+ return xml;
+}
+
+STRING MgHttpGetSiteInfo::EndXml()
+{
+ STRING xml = L"";
+
+ xml = L"</SiteInformation>\n";
+
+ return xml;
+}
+
STRING MgHttpGetSiteInfo::GetXml(MgPropertyCollection* properties)
{
STRING xml;
@@ -78,11 +169,23 @@
Ptr<MgInt32Property> int32Prop;
Ptr<MgBooleanProperty> boolProp;
- // this XML follows the SiteInformation-1.0.0.xsd schema
- xml += L"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
- xml += L"<SiteInformation xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"SiteInformation-1.0.0.xsd\">\n";
- xml += L"\t<SiteServer>\n";
+ if (m_userInfo->GetApiVersion() >= MG_API_VERSION(2,2,0))
+ {
+ xml += L"\t<Server>\n";
+ }
+ else
+ {
+ xml += L"\t<SiteServer>\n";
+ }
+ if (m_userInfo->GetApiVersion() >= MG_API_VERSION(2,2,0))
+ {
+ xml += L"\t\t<IpAddress>";
+ strProp = (MgStringProperty*)properties->GetItem(MgServerInformationProperties::MachineIp);
+ xml += strProp->GetValue();
+ xml += L"</IpAddress>\n";
+ }
+
xml += L"\t\t<DisplayName>";
strProp = (MgStringProperty*)properties->GetItem(MgServerInformationProperties::DisplayName);
xml += strProp->GetValue();
@@ -131,7 +234,10 @@
xml += L"\t\t</OperatingSystem>\n";
- xml += L"\t</SiteServer>\n";
+ if (m_userInfo->GetApiVersion() == MG_API_VERSION(1,0,0))
+ {
+ xml += L"\t</SiteServer>\n";
+ }
xml += L"\t<Statistics>\n";
@@ -165,6 +271,21 @@
xml += MgUtil::MultiByteToWideChar(tmpStr);
xml += L"</CpuUtilization>\n";
+ if (m_userInfo->GetApiVersion() >= MG_API_VERSION(2,2,0))
+ {
+ xml += L"\t\t<WorkingSet>";
+ int64Prop = (MgInt64Property*)properties->GetItem(MgServerInformationProperties::WorkingSet);
+ MgUtil::Int64ToString(int64Prop->GetValue(), tmpStr);
+ xml += MgUtil::MultiByteToWideChar(tmpStr);
+ xml += L"</WorkingSet>\n";
+
+ xml += L"\t\t<VirtualMemory>";
+ int64Prop = (MgInt64Property*)properties->GetItem(MgServerInformationProperties::VirtualMemory);
+ MgUtil::Int64ToString(int64Prop->GetValue(), tmpStr);
+ xml += MgUtil::MultiByteToWideChar(tmpStr);
+ xml += L"</VirtualMemory>\n";
+ }
+
xml += L"\t\t<TotalOperationTime>";
int32Prop = (MgInt32Property*)properties->GetItem(MgServerInformationProperties::TotalOperationTime);
MgUtil::Int32ToString(int32Prop->GetValue(), tmpStr);
@@ -201,9 +322,27 @@
xml += MgUtil::MultiByteToWideChar(tmpStr);
xml += L"</Uptime>\n";
+ if (m_userInfo->GetApiVersion() >= MG_API_VERSION(2,2,0))
+ {
+ xml += L"\t\t<CacheSize>";
+ int32Prop = (MgInt32Property*)properties->GetItem(MgServerInformationProperties::CacheSize);
+ MgUtil::Int32ToString(int32Prop->GetValue(), tmpStr);
+ xml += MgUtil::MultiByteToWideChar(tmpStr);
+ xml += L"</CacheSize>\n";
+
+ xml += L"\t\t<CacheDroppedEntries>";
+ int32Prop = (MgInt32Property*)properties->GetItem(MgServerInformationProperties::CacheDroppedEntries);
+ MgUtil::Int32ToString(int32Prop->GetValue(), tmpStr);
+ xml += MgUtil::MultiByteToWideChar(tmpStr);
+ xml += L"</CacheDroppedEntries>\n";
+ }
+
xml += L"\t</Statistics>\n";
- xml += L"</SiteInformation>\n";
+ if (m_userInfo->GetApiVersion() >= MG_API_VERSION(2,2,0))
+ {
+ xml += L"\t</Server>\n";
+ }
return xml;
}
Modified: trunk/MgDev/Web/src/HttpHandler/HttpGetSiteInfo.h
===================================================================
--- trunk/MgDev/Web/src/HttpHandler/HttpGetSiteInfo.h 2009-12-09 19:55:58 UTC (rev 4401)
+++ trunk/MgDev/Web/src/HttpHandler/HttpGetSiteInfo.h 2009-12-09 21:05:09 UTC (rev 4402)
@@ -46,6 +46,8 @@
private:
STRING GetXml(MgPropertyCollection* properties);
+ STRING BeginXml();
+ STRING EndXml();
};
#endif
Added: trunk/MgDev/Web/src/HttpHandler/HttpGetSiteStatus.cpp
===================================================================
--- trunk/MgDev/Web/src/HttpHandler/HttpGetSiteStatus.cpp (rev 0)
+++ trunk/MgDev/Web/src/HttpHandler/HttpGetSiteStatus.cpp 2009-12-09 21:05:09 UTC (rev 4402)
@@ -0,0 +1,163 @@
+//
+// Copyright (C) 2004-2009 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#include "HttpHandler.h"
+#include "HttpGetSiteStatus.h"
+
+HTTP_IMPLEMENT_CREATE_OBJECT(MgHttpGetSiteStatus)
+
+/// <summary>
+/// Initializes the common parameters and parameters specific to this request.
+/// </summary>
+/// <param name="name">Input
+/// MgHttpRequest
+/// This contains all the parameters of the request.
+/// </param>
+/// <returns>
+/// nothing
+/// </returns>
+MgHttpGetSiteStatus::MgHttpGetSiteStatus(MgHttpRequest *hRequest)
+{
+ InitializeCommonParameters(hRequest);
+}
+
+/// <summary>
+/// Executes the specific request.
+/// </summary>
+/// <returns>
+/// MgHttpResponse
+/// This contains the response (including MgHttpResult and StatusCode) from the server.
+/// </returns>
+void MgHttpGetSiteStatus::Execute(MgHttpResponse& hResponse)
+{
+ Ptr<MgHttpResult> hResult = hResponse.GetResult();
+
+ MG_HTTP_HANDLER_TRY()
+
+ // Check common parameters
+ ValidateCommonParameters();
+
+ STRING xml = BeginXml();
+
+ MgSiteManager* siteManager = MgSiteManager::GetInstance();
+ if(siteManager)
+ {
+ MgSiteVector* sites = siteManager->GetSites();
+ if(sites)
+ {
+ for(size_t i=0;i<sites->size();i++)
+ {
+ MgSiteInfo* siteInfo = sites->at(i);
+
+ // Check the server status - though this status could be out of date and an exception might be thrown
+ bool bHaveSiteStatus = false;
+ STRING message = MgResources::Unknown;
+
+ if (MgSiteInfo::Ok == siteInfo->GetStatus())
+ {
+ MG_HTTP_HANDLER_TRY()
+ // Create ServerAdmin object
+ Ptr<MgServerAdmin> serverAdmin = new MgServerAdmin();
+ serverAdmin->Open(siteInfo->GetTarget(), m_userInfo);
+
+ // call the C++ APIs
+ Ptr<MgPropertyCollection> properties = serverAdmin->GetSiteStatus();
+ xml += GetXml(properties);
+ bHaveSiteStatus = true;
+
+ MG_HTTP_HANDLER_CATCH(L"MgHttpGetSiteStatus.Execute")
+ if (mgException != NULL)
+ {
+ message = mgException->GetMessage();
+ }
+ }
+
+ if(!bHaveSiteStatus)
+ {
+ // This server is not available
+ xml += L"\t<Server>\n";
+
+ xml += L"\t\t<DisplayName></DisplayName>\n";
+ xml += L"\t\t<Status>";
+ xml += message;
+ xml += L"</Status>\n";
+ xml += L"\t\t<ApiVersion></ApiVersion>\n";
+
+ xml += L"\t</Server>\n";
+ }
+ }
+ }
+ }
+
+ xml += EndXml();
+
+ Ptr<MgHttpPrimitiveValue> value = new MgHttpPrimitiveValue(xml);
+ if(!value)
+ throw new MgOutOfMemoryException(L"", __LINE__, __WFILE__, NULL, L"", NULL);
+
+ hResult->SetResultObject(value, MgMimeType::Xml);
+
+ MG_HTTP_HANDLER_CATCH_AND_THROW_EX(L"MgHttpGetSiteStatus.Execute")
+}
+
+STRING MgHttpGetSiteStatus::BeginXml()
+{
+ STRING xml = L"";
+
+ // this XML follows the SiteStatus-2.2.0.xsd schema
+ xml += L"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
+ xml += L"<SiteStatus xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"SiteStatus-2.2.0.xsd\">\n";
+
+ return xml;
+}
+
+STRING MgHttpGetSiteStatus::EndXml()
+{
+ STRING xml = L"";
+
+ xml = L"</SiteStatus>\n";
+
+ return xml;
+}
+
+STRING MgHttpGetSiteStatus::GetXml(MgPropertyCollection* properties)
+{
+ STRING xml = L"";
+ Ptr<MgStringProperty> strProp;
+ Ptr<MgBooleanProperty> boolProp;
+
+ xml += L"\t<Server>\n";
+
+ xml += L"\t\t<DisplayName>";
+ strProp = (MgStringProperty*)properties->GetItem(MgServerInformationProperties::DisplayName);
+ xml += strProp->GetValue();
+ xml += L"</DisplayName>\n";
+
+ xml += L"\t\t<Status>";
+ boolProp = (MgBooleanProperty*)properties->GetItem(MgServerInformationProperties::Status);
+ xml += boolProp->GetValue() ? L"Online" : L"Offline";
+ xml += L"</Status>\n";
+
+ xml += L"\t\t<ApiVersion>";
+ strProp = (MgStringProperty*)properties->GetItem(MgServerInformationProperties::ApiVersion);
+ xml += strProp->GetValue();
+ xml += L"</ApiVersion>\n";
+
+ xml += L"\t</Server>\n";
+
+ return xml;
+}
Property changes on: trunk/MgDev/Web/src/HttpHandler/HttpGetSiteStatus.cpp
___________________________________________________________________
Added: svn:eol-style
+ native
Added: trunk/MgDev/Web/src/HttpHandler/HttpGetSiteStatus.h
===================================================================
--- trunk/MgDev/Web/src/HttpHandler/HttpGetSiteStatus.h (rev 0)
+++ trunk/MgDev/Web/src/HttpHandler/HttpGetSiteStatus.h 2009-12-09 21:05:09 UTC (rev 4402)
@@ -0,0 +1,52 @@
+//
+// Copyright (C) 2004-2009 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#ifndef _S_GET_SITE_STATUS_H
+#define _S_GET_SITE_STATUS_H
+
+class MgHttpGetSiteStatus : public MgHttpRequestResponseHandler
+{
+HTTP_DECLARE_CREATE_OBJECT()
+
+public:
+ /// <summary>
+ /// Initializes the common parameters of the request.
+ /// </summary>
+ /// <param name="name">Input
+ /// MgHttpRequest
+ /// This contains all the parameters of the request.
+ /// </param>
+ /// <returns>
+ /// nothing
+ /// </returns>
+ MgHttpGetSiteStatus(MgHttpRequest *hRequest);
+
+ /// <summary>
+ /// Executes the specific request.
+ /// </summary>
+ /// <param name="hResponse">Input
+ /// This contains the response (including MgHttpResult and StatusCode) from the server.
+ /// </param>
+ void Execute(MgHttpResponse& hResponse);
+
+private:
+ STRING GetXml(MgPropertyCollection* properties);
+ STRING BeginXml();
+ STRING EndXml();
+};
+
+#endif
Property changes on: trunk/MgDev/Web/src/HttpHandler/HttpGetSiteStatus.h
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: trunk/MgDev/Web/src/HttpHandler/HttpGetSiteVersion.cpp
===================================================================
--- trunk/MgDev/Web/src/HttpHandler/HttpGetSiteVersion.cpp 2009-12-09 19:55:58 UTC (rev 4401)
+++ trunk/MgDev/Web/src/HttpHandler/HttpGetSiteVersion.cpp 2009-12-09 21:05:09 UTC (rev 4402)
@@ -51,14 +51,72 @@
// Check common parameters
ValidateCommonParameters();
- // Create ServerAdmin object
- Ptr<MgServerAdmin> serverAdmin = new MgServerAdmin();
- serverAdmin->Open(m_userInfo);
+ STRING xml;
+ xml += BeginXml();
- // call the C++ APIs
- Ptr<MgPropertyCollection> properties = serverAdmin->GetInformationProperties();
- STRING xml = GetXml(properties);
+ if (m_userInfo->GetApiVersion() >= MG_API_VERSION(2,2,0))
+ {
+ MgSiteManager* siteManager = MgSiteManager::GetInstance();
+ if(siteManager)
+ {
+ MgSiteVector* sites = siteManager->GetSites();
+ if(sites)
+ {
+ for(size_t i=0;i<sites->size();i++)
+ {
+ MgSiteInfo* siteInfo = sites->at(i);
+ // Check the server status - though this status could be out of date and an exception might be thrown
+ bool bHaveSiteVersion = false;
+ STRING message = MgResources::Unknown;
+
+ if (MgSiteInfo::Ok == siteInfo->GetStatus())
+ {
+ MG_HTTP_HANDLER_TRY()
+
+ // Create ServerAdmin object
+ Ptr<MgServerAdmin> serverAdmin = new MgServerAdmin();
+ serverAdmin->Open(siteInfo->GetTarget(), m_userInfo);
+
+ // call the C++ APIs
+ STRING version = serverAdmin->GetSiteVersion();
+ xml += GetXml(version);
+ bHaveSiteVersion = true;
+
+ MG_HTTP_HANDLER_CATCH(L"MgHttpGetSiteInfo.Execute")
+ if (mgException != NULL)
+ {
+ message = mgException->GetMessage();
+ }
+ }
+
+ if(!bHaveSiteVersion)
+ {
+ // This server is not available
+ xml += L"\t<Server>\n";
+
+ xml += L"\t\t<Version>";
+ xml += message;
+ xml += L"</Version>\n";
+
+ xml += L"\t</Server>\n";
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ // Create ServerAdmin object
+ Ptr<MgServerAdmin> serverAdmin = new MgServerAdmin();
+ serverAdmin->Open(m_userInfo);
+
+ // call the C++ APIs
+ STRING version = serverAdmin->GetSiteVersion();
+ xml += GetXml(version);
+ }
+ xml += EndXml();
+
Ptr<MgHttpPrimitiveValue> value = new MgHttpPrimitiveValue(xml);
if(!value)
throw new MgOutOfMemoryException(L"", __LINE__, __WFILE__, NULL, L"", NULL);
@@ -68,18 +126,49 @@
MG_HTTP_HANDLER_CATCH_AND_THROW_EX(L"MgHttpGetSiteVersion.Execute")
}
-STRING MgHttpGetSiteVersion::GetXml(MgPropertyCollection* properties)
+STRING MgHttpGetSiteVersion::BeginXml()
{
- Ptr<MgStringProperty> property = (MgStringProperty*)properties->GetItem(L"ServerVersion");
STRING xml = L"";
- // this XML follows the SiteVersion-1.0.0.xsd schema
- xml += L"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
- xml += L"<SiteVersion xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"SiteVersion-1.0.0.xsd\">\n";
+ if (m_userInfo->GetApiVersion() >= MG_API_VERSION(2,2,0))
+ {
+ xml += L"<SiteVersion xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"SiteVersion-2.2.0.xsd\">\n";
+ }
+ else
+ {
+ xml += L"<SiteVersion xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"SiteVersion-1.0.0.xsd\">\n";
+ }
+
+ return xml;
+}
+
+STRING MgHttpGetSiteVersion::EndXml()
+{
+ STRING xml = L"";
+
+ xml += L"</SiteVersion>\n";
+
+ return xml;
+}
+
+STRING MgHttpGetSiteVersion::GetXml(CREFSTRING version)
+{
+ STRING xml = L"";
+
+ if (m_userInfo->GetApiVersion() >= MG_API_VERSION(2,2,0))
+ {
+ xml += L"\t<Server>\n";
+ }
+
xml += L"\t<Version>";
- xml += property->GetValue();
+ xml += version;
xml += L"</Version>\n";
xml += L"</SiteVersion>\n";
+ if (m_userInfo->GetApiVersion() >= MG_API_VERSION(2,2,0))
+ {
+ xml += L"\t</Server>\n";
+ }
+
return xml;
}
Modified: trunk/MgDev/Web/src/HttpHandler/HttpGetSiteVersion.h
===================================================================
--- trunk/MgDev/Web/src/HttpHandler/HttpGetSiteVersion.h 2009-12-09 19:55:58 UTC (rev 4401)
+++ trunk/MgDev/Web/src/HttpHandler/HttpGetSiteVersion.h 2009-12-09 21:05:09 UTC (rev 4402)
@@ -44,7 +44,9 @@
void Execute(MgHttpResponse& hResponse);
private:
- STRING GetXml(MgPropertyCollection* properties);
+ STRING GetXml(CREFSTRING version);
+ STRING BeginXml();
+ STRING EndXml();
};
Modified: trunk/MgDev/Web/src/HttpHandler/HttpHandler.vcproj
===================================================================
--- trunk/MgDev/Web/src/HttpHandler/HttpHandler.vcproj 2009-12-09 19:55:58 UTC (rev 4401)
+++ trunk/MgDev/Web/src/HttpHandler/HttpHandler.vcproj 2009-12-09 21:05:09 UTC (rev 4402)
@@ -2723,6 +2723,46 @@
>
</File>
<File
+ RelativePath=".\HttpGetSiteStatus.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug|x64"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|x64"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\HttpGetSiteStatus.h"
+ >
+ </File>
+ <File
RelativePath=".\HttpGetSiteVersion.cpp"
>
<FileConfiguration
Modified: trunk/MgDev/Web/src/HttpHandler/HttpHandlerBuild.cpp
===================================================================
--- trunk/MgDev/Web/src/HttpHandler/HttpHandlerBuild.cpp 2009-12-09 19:55:58 UTC (rev 4401)
+++ trunk/MgDev/Web/src/HttpHandler/HttpHandlerBuild.cpp 2009-12-09 21:05:09 UTC (rev 4402)
@@ -85,6 +85,7 @@
#include "HttpGetIdentityProperties.cpp"
#include "HttpGetSchemaMapping.cpp"
#include "HttpGetSiteInfo.cpp"
+#include "HttpGetSiteStatus.cpp"
#include "HttpGetSiteVersion.cpp"
#include "HttpGetSpatialContexts.cpp"
#include "HttpGetTileImage.cpp"
Modified: trunk/MgDev/Web/src/HttpHandler/HttpRequest.cpp
===================================================================
--- trunk/MgDev/Web/src/HttpHandler/HttpRequest.cpp 2009-12-09 19:55:58 UTC (rev 4401)
+++ trunk/MgDev/Web/src/HttpHandler/HttpRequest.cpp 2009-12-09 21:05:09 UTC (rev 4402)
@@ -353,6 +353,7 @@
httpClassCreators[MgHttpResourceStrings::opEnumerateGroups] = MgHttpEnumerateGroups::CreateObject;
httpClassCreators[MgHttpResourceStrings::opGetSiteVersion] = MgHttpGetSiteVersion::CreateObject;
httpClassCreators[MgHttpResourceStrings::opGetSiteInfo] = MgHttpGetSiteInfo::CreateObject;
+ httpClassCreators[MgHttpResourceStrings::opGetSiteStatus] = MgHttpGetSiteStatus::CreateObject;
httpClassCreators[MgHttpResourceStrings::opGetDrawingCoordinateSpace] = MgHttpGetDrawingCoordinateSpace::CreateObject;
httpClassCreators[MgHttpResourceStrings::opCreateSession] = MgHttpCreateSession::CreateObject;
httpClassCreators[MgHttpResourceStrings::opGetSessionTimeout] = MgHttpGetSessionTimeout::CreateObject;
Modified: trunk/MgDev/Web/src/HttpHandler/HttpResourceStrings.cpp
===================================================================
--- trunk/MgDev/Web/src/HttpHandler/HttpResourceStrings.cpp 2009-12-09 19:55:58 UTC (rev 4401)
+++ trunk/MgDev/Web/src/HttpHandler/HttpResourceStrings.cpp 2009-12-09 21:05:09 UTC (rev 4402)
@@ -322,6 +322,7 @@
const STRING MgHttpResourceStrings::opEnumerateGroups = L"ENUMERATEGROUPS";
const STRING MgHttpResourceStrings::opGetSiteVersion = L"GETSITEVERSION";
const STRING MgHttpResourceStrings::opGetSiteInfo = L"GETSITEINFO";
+const STRING MgHttpResourceStrings::opGetSiteStatus = L"GETSITESTATUS";
// Other requests
const STRING MgHttpResourceStrings::opCreateSession = L"CREATESESSION";
Modified: trunk/MgDev/Web/src/HttpHandler/HttpResourceStrings.h
===================================================================
--- trunk/MgDev/Web/src/HttpHandler/HttpResourceStrings.h 2009-12-09 19:55:58 UTC (rev 4401)
+++ trunk/MgDev/Web/src/HttpHandler/HttpResourceStrings.h 2009-12-09 21:05:09 UTC (rev 4402)
@@ -327,6 +327,7 @@
static const STRING opEnumerateGroups;
static const STRING opGetSiteVersion;
static const STRING opGetSiteInfo;
+ static const STRING opGetSiteStatus;
// Other requests
static const STRING opCreateSession;
Modified: trunk/MgDev/Web/src/HttpHandler/Makefile.am
===================================================================
--- trunk/MgDev/Web/src/HttpHandler/Makefile.am 2009-12-09 19:55:58 UTC (rev 4401)
+++ trunk/MgDev/Web/src/HttpHandler/Makefile.am 2009-12-09 21:05:09 UTC (rev 4402)
@@ -86,6 +86,7 @@
HttpGetSessionTimeout.cpp \
HttpGetSiteInfo.cpp \
HttpGetSiteVersion.cpp \
+ HttpGetSiteStatus.cpp \
HttpGetSpatialContexts.cpp \
HttpGetTileImage.cpp \
HttpGetVisibleMapExtent.cpp \
@@ -207,6 +208,7 @@
HttpGetSessionTimeout.h \
HttpGetSiteInfo.h \
HttpGetSiteVersion.h \
+ HttpGetSiteStatus.h \
HttpGetSpatialContexts.h \
HttpGetTileImage.h \
HttpGetVisibleMapExtent.h \
Modified: trunk/MgDev/Web/src/IsapiAgent/IsapiAgent.cpp
===================================================================
--- trunk/MgDev/Web/src/IsapiAgent/IsapiAgent.cpp 2009-12-09 19:55:58 UTC (rev 4401)
+++ trunk/MgDev/Web/src/IsapiAgent/IsapiAgent.cpp 2009-12-09 21:05:09 UTC (rev 4402)
@@ -169,6 +169,13 @@
if (!bValid)
bValid = params->GetXmlPostData().length() != 0;
+ // Certain operations do not require authentication
+ STRING operation = params->GetParameterValue(L"OPERATION");
+ if((_wcsicmp(operation.c_str(), L"GETSITESTATUS") == 0))
+ {
+ bValid = true;
+ }
+
if (!bValid)
{
// Invalid authentication information is not fatal, we should continue.
Modified: trunk/MgDev/Web/src/viewerfiles/ajaxmappane.templ
===================================================================
--- trunk/MgDev/Web/src/viewerfiles/ajaxmappane.templ 2009-12-09 19:55:58 UTC (rev 4401)
+++ trunk/MgDev/Web/src/viewerfiles/ajaxmappane.templ 2009-12-09 21:05:09 UTC (rev 4402)
@@ -1737,7 +1737,7 @@
url = webAgent + "?OPERATION=GETDYNAMICMAPOVERLAYIMAGE&FORMAT=PNG&VERSION=2.1.0&SESSION=" + sessionId + "&MAPNAME=" + encodeComponent(mapName) + "&SEQ=" + Math.random() + "&CLIENTAGENT=" + encodeComponent(clientAgent) + "&BEHAVIOR=2";
url += viewParams;
document.getElementById("overlay").innerHTML =
- '<img class="mapImage" name="' + reqId + '" id="mapImage" src="' + url + '" width=' + mapDevW + ' height=' + mapDevH + ' border=0 vspace=0 hspace=0 style="visibility: hidden; width: ' + mapDevW + 'px; height: ' + mapDevH + 'px;" onload="return OnMapOverlayImageLoaded(event)">';
+ '<img class="mapImage" name="' + reqId + '" id="mapImage" src="' + url + '" width=' + mapDevW + ' height=' + mapDevH + ' border=0 vspace=0 hspace=0 style="visibility: hidden; width: ' + mapDevW + 'px; height: ' + mapDevH + 'px;" onload="return OnMapOverlayImageLoaded(event)" onerror="return OnMapOverlayImageLoadedError(event)">';
if (opera)
document.getElementById("mapImage").src = document.getElementById("mapImage").src;
}
@@ -1747,7 +1747,7 @@
url = webAgent + "?OPERATION=GETDYNAMICMAPOVERLAYIMAGE&FORMAT=PNG&VERSION=2.1.0&SESSION=" + sessionId + "&MAPNAME=" + encodeComponent(mapName) + "&SEQ=" + Math.random() + "&CLIENTAGENT=" + encodeComponent(clientAgent) + "&BEHAVIOR=5&SELECTIONCOLOR=" + selectionColor;
url += viewParams;
document.getElementById('selOverlay').innerHTML =
- '<img class="mapImage" name="' + reqId + '" id="selectionImage" src="' + url + '" width=' + mapDevW + ' height=' + mapDevH + ' border=0 vspace=0 hspace=0 style="visibility: hidden; width: ' + mapDevW + 'px; height: ' + mapDevH + 'px;" onload="return OnSelectionOverlayImageLoaded(event)">';
+ '<img class="mapImage" name="' + reqId + '" id="selectionImage" src="' + url + '" width=' + mapDevW + ' height=' + mapDevH + ' border=0 vspace=0 hspace=0 style="visibility: hidden; width: ' + mapDevW + 'px; height: ' + mapDevH + 'px;" onload="return OnSelectionOverlayImageLoaded(event)" onerror="return OnSelectionOverlayImageLoadedError(event)">';
if (opera)
document.getElementById("selectionImage").src = document.getElementById("selectionImage").src;
}
@@ -1806,6 +1806,28 @@
return false;
}
+function OnMapOverlayImageLoadedError(e)
+{
+ var frmParent = parent.frames["tbFrame"];
+ var objDivRefresh = frmParent.document.getElementById("divRefresh");
+ if(objDivRefresh != null)
+ {
+ objDivRefresh.style.display='none';
+ }
+ mapLoading = false;
+
+ var text = this.req.responseText;
+
+ var startPos = text.indexOf("<h2>");
+ startPos = startPos + 4;
+ var endPos = text.indexOf("</h2>", startPos);
+ var message = text.substring(startPos, endPos);
+
+ alert(message);
+
+ return false;
+}
+
function OnSelectionOverlayImageLoaded(e)
{
if(msie)
@@ -1854,6 +1876,20 @@
return false;
}
+function OnSelectionOverlayImageLoadedError(e)
+{
+ var text = this.req.responseText;
+
+ var startPos = text.indexOf("<h2>");
+ startPos = startPos + 4;
+ var endPos = text.indexOf("</h2>", startPos);
+ var message = text.substring(startPos, endPos);
+
+ alert(message);
+
+ return false;
+}
+
function OnAlternateImageLoaded()
{
altimg = document.getElementById(curimg == "mapImage1"? "mapImage2": "mapImage1");
@@ -1890,7 +1926,12 @@
function RequestFailed(text)
{
- //placeholder for debugging output
+ var startPos = text.indexOf("<h2>");
+ startPos = startPos + 4;
+ var endPos = text.indexOf("</h2>", startPos);
+ var message = text.substring(startPos, endPos);
+
+ alert(message);
}
function DraggingShape(e)
@@ -2928,7 +2969,7 @@
dr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
dr.send(reqParams);
- if(dr.responseXML)
+ if(dr.status == 200)
{
var env = ParseEnvelope(dr.responseXML.documentElement);
if(env != null)
@@ -2941,6 +2982,8 @@
GotoView(centerX, centerY, scale, true, true);
}
}
+ else
+ RequestFailed(dr.responseText);
}
function ParseEnvelope(xmlRoot)
More information about the mapguide-commits
mailing list