[mapguide-commits] r1046 - in trunk/MgDev:
Common/MapGuideCommon/System Server/src/Common/Manager
Server/src/Core Server/src/Resources
Server/src/Services/Resource Web/src/mapagent/Resources
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Fri Jan 12 18:33:57 EST 2007
Author: stevedang
Date: 2007-01-12 18:33:56 -0500 (Fri, 12 Jan 2007)
New Revision: 1046
Modified:
trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.cpp
trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.h
trunk/MgDev/Server/src/Common/Manager/ServerManager.cpp
trunk/MgDev/Server/src/Core/Server.cpp
trunk/MgDev/Server/src/Core/serverconfig.ini
trunk/MgDev/Server/src/Resources/server_en.res
trunk/MgDev/Server/src/Services/Resource/ResourcePackageHandler.cpp
trunk/MgDev/Web/src/mapagent/Resources/web_en.res
Log:
Miscellaneous code cleanups and fixes:
- Added missing validations for the Logs Path and Legend Font configurations.
- Updated the resource packager handler to display the server name correctly.
- Added the Machine IP configuration so that the load balancing mechanism can identify Site/Support servers more effectively.
Modified: trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.cpp
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.cpp 2007-01-12 23:11:18 UTC (rev 1045)
+++ trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.cpp 2007-01-12 23:33:56 UTC (rev 1046)
@@ -65,6 +65,9 @@
#define MG_CONFIG_MAX_FILE_NAME_LENGTH 128
#define MG_CONFIG_FILE_NAME_RESERVED_CHARACTERS L"\\/:*?\"<>|"
+#define MG_CONFIG_MIN_FONT_NAME_LENGTH 1
+#define MG_CONFIG_MAX_FONT_NAME_LENGTH 255
+
#define MG_CONFIG_MIN_FOLDER_NAME_LENGTH 1
#define MG_CONFIG_MAX_FOLDER_NAME_LENGTH 128
#define MG_CONFIG_FOLDER_NAME_RESERVED_CHARACTERS MG_CONFIG_FILE_NAME_RESERVED_CHARACTERS
@@ -121,6 +124,8 @@
const STRING MgConfigProperties::DefaultGeneralPropertyLogsDelimiter = L"\t";
const STRING MgConfigProperties::GeneralPropertyLogsPath = L"LogsPath";
const STRING MgConfigProperties::DefaultGeneralPropertyLogsPath = L"Logs/";
+const STRING MgConfigProperties::GeneralPropertyMachineIp = L"MachineIp";
+const STRING MgConfigProperties::DefaultGeneralPropertyMachineIp = L"127.0.0.1";
const STRING MgConfigProperties::GeneralPropertyMaxLogFileSize = L"MaxLogFileSize";
const INT32 MgConfigProperties::DefaultGeneralPropertyMaxLogFileSize = 1024;
const STRING MgConfigProperties::GeneralPropertyMaxLogFileSizeEnabled = L"MaxLogFileSizeEnabled";
@@ -193,6 +198,8 @@
const bool MgConfigProperties::DefaultHostPropertyDrawingService = false;
const STRING MgConfigProperties::HostPropertyFeatureService = L"FeatureService";
const bool MgConfigProperties::DefaultHostPropertyFeatureService = false;
+const STRING MgConfigProperties::HostPropertyKmlService = L"KmlService";
+const bool MgConfigProperties::DefaultHostPropertyKmlService = false;
const STRING MgConfigProperties::HostPropertyMappingService = L"MappingService";
const bool MgConfigProperties::DefaultHostPropertyMappingService = false;
const STRING MgConfigProperties::HostPropertyRenderingService = L"RenderingService";
@@ -204,8 +211,6 @@
const bool MgConfigProperties::DefaultHostPropertySiteService = false;
const STRING MgConfigProperties::HostPropertyTileService = L"TileService";
const bool MgConfigProperties::DefaultHostPropertyTileService = false;
-const STRING MgConfigProperties::HostPropertyKmlService = L"KmlService";
-const bool MgConfigProperties::DefaultHostPropertyKmlService = false;
// ******************************************************************
// Drawing Service Properties
@@ -408,6 +413,8 @@
{ MgConfigProperties::GeneralPropertyFdoPath , MgPropertyType::String , MG_CONFIG_MIN_PATH_LENGTH , MG_CONFIG_MAX_PATH_LENGTH , MG_CONFIG_PATH_RESERVED_CHARACTERS },
{ MgConfigProperties::GeneralPropertyLicenseServerPath , MgPropertyType::String , MG_CONFIG_MIN_OPTIONAL_STRING_LENGTH , MG_CONFIG_MAX_OPTIONAL_STRING_LENGTH , L"" },
{ MgConfigProperties::GeneralPropertyLogsDelimiter , MgPropertyType::String , 1 , 128 , L"" },
+ { MgConfigProperties::GeneralPropertyLogsPath , MgPropertyType::String , MG_CONFIG_MIN_PATH_LENGTH , MG_CONFIG_MAX_PATH_LENGTH , MG_CONFIG_PATH_RESERVED_CHARACTERS },
+ { MgConfigProperties::GeneralPropertyMachineIp , MgPropertyType::String , MG_CONFIG_MIN_IP_ADDRESS_LENGTH , MG_CONFIG_MAX_IP_ADDRESS_LENGTH , L"" },
{ MgConfigProperties::GeneralPropertyMaxLogFileSize , MgPropertyType::Int32 , 1 , 2000000 , L"" },
{ MgConfigProperties::GeneralPropertyMaxLogFileSizeEnabled , MgPropertyType::Boolean , 0 , 1 , L"" },
{ MgConfigProperties::GeneralPropertyResourcesPath , MgPropertyType::String , MG_CONFIG_MIN_PATH_LENGTH , MG_CONFIG_MAX_PATH_LENGTH , MG_CONFIG_PATH_RESERVED_CHARACTERS },
@@ -457,13 +464,13 @@
{
{ MgConfigProperties::HostPropertyDrawingService , MgPropertyType::Boolean , 0 , 1 , L"" },
{ MgConfigProperties::HostPropertyFeatureService , MgPropertyType::Boolean , 0 , 1 , L"" },
+ { MgConfigProperties::HostPropertyKmlService , MgPropertyType::Boolean , 0 , 1 , L"" },
{ MgConfigProperties::HostPropertyMappingService , MgPropertyType::Boolean , 0 , 1 , L"" },
{ MgConfigProperties::HostPropertyRenderingService , MgPropertyType::Boolean , 0 , 1 , L"" },
{ MgConfigProperties::HostPropertyResourceService , MgPropertyType::Boolean , 0 , 1 , L"" },
{ MgConfigProperties::HostPropertyServerAdminService , MgPropertyType::Boolean , 1 , 1 , L"" },
{ MgConfigProperties::HostPropertySiteService , MgPropertyType::Boolean , 0 , 1 , L"" },
{ MgConfigProperties::HostPropertyTileService , MgPropertyType::Boolean , 0 , 1 , L"" },
- { MgConfigProperties::HostPropertyKmlService , MgPropertyType::Boolean , 0 , 1 , L"" },
{ L"" , 0 , 0.0 , 0.0 , L"" }
};
@@ -488,6 +495,7 @@
const MgConfigValidationInfo MgConfigProperties::sm_cviMappingServiceProperties[] =
{
+ { MgConfigProperties::MappingServicePropertyLegendFont , MgPropertyType::String , MG_CONFIG_MIN_FONT_NAME_LENGTH , MG_CONFIG_MAX_FONT_NAME_LENGTH , L"" },
{ L"" , 0 , 0.0 , 0.0 , L"" }
};
Modified: trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.h
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.h 2007-01-12 23:11:18 UTC (rev 1045)
+++ trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.h 2007-01-12 23:33:56 UTC (rev 1046)
@@ -78,6 +78,10 @@
static const STRING GeneralPropertyLogsPath; /// value("LogsPath")
static const STRING DefaultGeneralPropertyLogsPath; /// value("Logs/")
+ /// Sets the Machine IP address
+ static const STRING GeneralPropertyMachineIp; /// value("MachineIp")
+ static const STRING DefaultGeneralPropertyMachineIp; /// value("127.0.0.1")
+
/// Sets the maximum log file size (in kilobytes)
static const STRING GeneralPropertyMaxLogFileSize; /// value("MaxLogFileSize")
static const INT32 DefaultGeneralPropertyMaxLogFileSize; /// value(64)
@@ -207,6 +211,10 @@
static const STRING HostPropertyFeatureService; /// value("FeatureService")
static const bool DefaultHostPropertyFeatureService; /// value(false)
+ /// Enables/disables the Kml Service.
+ static const STRING HostPropertyKmlService; /// value("KmlService")
+ static const bool DefaultHostPropertyKmlService; /// value(false)
+
/// Enables/disables the Mapping Service
static const STRING HostPropertyMappingService; /// value("MappingService")
static const bool DefaultHostPropertyMappingService; /// value(false)
@@ -220,12 +228,6 @@
static const STRING HostPropertyResourceService; /// value("ResourceService")
static const bool DefaultHostPropertyResourceService; /// value(false)
- /// Enables/disables the Kml Service. Note that in V1.0 this service is only
- /// available on the Site Server and must be enabled there.
- static const STRING HostPropertyKmlService; /// value("KmlService")
- static const bool DefaultHostPropertyKmlService; /// value(false)
-
-
INTERNAL_API:
/// Enables/disables the ServerAdmin Service (for internal use only).
Modified: trunk/MgDev/Server/src/Common/Manager/ServerManager.cpp
===================================================================
--- trunk/MgDev/Server/src/Common/Manager/ServerManager.cpp 2007-01-12 23:11:18 UTC (rev 1045)
+++ trunk/MgDev/Server/src/Common/Manager/ServerManager.cpp 2007-01-12 23:33:56 UTC (rev 1046)
@@ -43,7 +43,9 @@
m_pSiteMessageQueue(NULL),
m_pWorkerThreads(NULL)
{
+ m_localServerAddress = MgConfigProperties::DefaultGeneralPropertyMachineIp;
m_defaultLocale = MgConfigProperties::DefaultGeneralPropertyDefaultLocale;
+ m_displayName = MgConfigProperties::DefaultGeneralPropertyDisplayName;
// Admin
m_nAdminPort = MgConfigProperties::DefaultAdministrativeConnectionPropertyPort;
@@ -60,8 +62,6 @@
m_nSiteThreads = MgConfigProperties::DefaultSiteConnectionPropertyThreadPoolSize;
m_startTime = ACE_OS::gettimeofday();
-
- m_displayName = MgConfigProperties::DefaultGeneralPropertyDisplayName;
}
// Destructor
@@ -130,9 +130,19 @@
// Set the locale
m_defaultLocale = locale;
+ m_pClientHandles = new ACE_Unbounded_Set<ACE_HANDLE>;
+
+ // Load the configuration properties
+ LoadConfigurationProperties();
+
MgConfiguration* pConfiguration = MgConfiguration::GetInstance();
- m_pClientHandles = new ACE_Unbounded_Set<ACE_HANDLE>;
+ // Determine if this server is a site or support server.
+ pConfiguration->GetBoolValue(
+ MgConfigProperties::HostPropertiesSection,
+ MgConfigProperties::HostPropertySiteService,
+ m_isSiteServer,
+ MgConfigProperties::DefaultHostPropertySiteService);
// Admin Connection
pConfiguration->GetIntValue(MgConfigProperties::AdministrativeConnectionPropertiesSection, MgConfigProperties::AdministrativeConnectionPropertyPort, m_nAdminPort, MgConfigProperties::DefaultAdministrativeConnectionPropertyPort);
@@ -153,77 +163,62 @@
pConfiguration->GetIntValue(MgConfigProperties::SiteConnectionPropertiesSection, MgConfigProperties::SiteConnectionPropertyPort, m_nSitePort, MgConfigProperties::DefaultSiteConnectionPropertyPort);
pConfiguration->GetIntValue(MgConfigProperties::SiteConnectionPropertiesSection, MgConfigProperties::SiteConnectionPropertyThreadPoolSize, m_nSiteThreads, MgConfigProperties::DefaultSiteConnectionPropertyThreadPoolSize);
- // Load the configuration properties
- LoadConfigurationProperties();
+ MgIpUtil::HostNameToAddress(siteServerAddress, m_siteServerAddress);
- // Verify whether or not this server is the site server.
+ // Validate IP configurations for this server.
+ STRING localServerAddress, hostAddress;
- bool siteServiceEnabled;
+ pConfiguration->GetStringValue(
+ MgConfigProperties::GeneralPropertiesSection,
+ MgConfigProperties::GeneralPropertyMachineIp,
+ localServerAddress,
+ MgConfigProperties::DefaultGeneralPropertyMachineIp);
- pConfiguration->GetBoolValue(
- MgConfigProperties::HostPropertiesSection,
- MgConfigProperties::HostPropertySiteService,
- siteServiceEnabled,
- MgConfigProperties::DefaultHostPropertySiteService);
-
- if (MgIpUtil::IsLocalHost(siteServerAddress))
+ if (m_isSiteServer && MgIpUtil::IsLocalHost(localServerAddress, false))
{
- if (!siteServiceEnabled)
- {
- throw new MgLogicException(
- L"MgServerManager.Initialize", __LINE__, __WFILE__, NULL, L"", NULL);
- }
+ localServerAddress = siteServerAddress;
}
- else
- {
- if (siteServiceEnabled)
- {
- throw new MgLogicException(
- L"MgServerManager.Initialize", __LINE__, __WFILE__, NULL, L"", NULL);
- }
- m_isSiteServer = false;
- }
+ MgIpUtil::HostNameToAddress(localServerAddress, m_localServerAddress);
- // Determine the local server address.
+ if (MgIpUtil::HostNameToAddress(L"localhost", hostAddress, false)
+ && (MgIpUtil::IsIpAddress(hostAddress, false) == MgIpUtil::IsIpAddress(m_localServerAddress, false))
+ && (0 != MgIpUtil::CompareAddresses(hostAddress, m_localServerAddress)))
+ {
+ MgStringCollection arguments;
+ arguments.Add(localServerAddress);
- m_localServerAddress = L"localhost";
-
+ throw new MgInvalidIpAddressException(
+ L"MgServerManager.Initialize", __LINE__, __WFILE__, &arguments,
+ L"MgInvalidIpConfigurationForLocalMachine", NULL);
+ }
+
if (m_isSiteServer)
{
- STRING localServerAddress;
-
- if (MgIpUtil::IsLocalHost(siteServerAddress, false)
- || !MgIpUtil::IsIpAddress(siteServerAddress, false))
+ if (0 != MgIpUtil::CompareAddresses(m_siteServerAddress, m_localServerAddress))
{
- MgIpUtil::HostNameToAddress(siteServerAddress, localServerAddress);
- }
+ MgStringCollection arguments;
+ arguments.Add(localServerAddress);
+ arguments.Add(siteServerAddress);
- if (localServerAddress.empty() || MgIpUtil::IsLocalHost(localServerAddress, false))
- {
- m_localServerAddress = siteServerAddress;
+ throw new MgLogicException(
+ L"MgServerManager.Initialize", __LINE__, __WFILE__, NULL,
+ L"MgInvalidIpConfigurationForSiteServer", &arguments);
}
- else
- {
- m_localServerAddress = localServerAddress;
- }
}
-
- if (MgIpUtil::IsLocalHost(m_localServerAddress, false))
+ else
{
- m_localServerAddress = MgIpUtil::GetLocalHostAddress();
- }
+ if (0 == MgIpUtil::CompareAddresses(m_siteServerAddress, m_localServerAddress))
+ {
+ MgStringCollection arguments;
+ arguments.Add(localServerAddress);
+ arguments.Add(siteServerAddress);
- // Determine the site server address.
-
- if (m_isSiteServer)
- {
- m_siteServerAddress = m_localServerAddress;
+ throw new MgLogicException(
+ L"MgServerManager.Initialize", __LINE__, __WFILE__, NULL,
+ L"MgInvalidIpConfigurationForSupportServer", &arguments);
+ }
}
- else
- {
- MgIpUtil::HostNameToAddress(siteServerAddress, m_siteServerAddress);
- }
// Create the worker thread pool
INT32 workerThreadPoolSize = 0;
@@ -427,7 +422,7 @@
pProperty = new MgStringProperty(MgServerInformationProperties::DisplayName, m_displayName);
pProperties->Add(pProperty);
- // Add the Operations info
+ // Add the Operations info
INT32 nTotalReceivedOperations = GetTotalReceivedOperations();
pProperty = new MgInt32Property(MgServerInformationProperties::TotalReceivedOperations, nTotalReceivedOperations);
pProperties->Add(pProperty);
Modified: trunk/MgDev/Server/src/Core/Server.cpp
===================================================================
--- trunk/MgDev/Server/src/Core/Server.cpp 2007-01-12 23:11:18 UTC (rev 1045)
+++ trunk/MgDev/Server/src/Core/Server.cpp 2007-01-12 23:33:56 UTC (rev 1046)
@@ -361,7 +361,7 @@
ACE_DEBUG ((LM_DEBUG, ACE_TEXT(" Test Mode : %s\n"), m_bTestMode == true ? ACE_TEXT("true") : ACE_TEXT("false")));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT(" Test FDO : %s\n"), m_bTestFdo == true ? ACE_TEXT("true") : ACE_TEXT("false")));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT("\n General Properties:\n")));
- ACE_DEBUG ((LM_DEBUG, ACE_TEXT(" IP Address : %s\n"), MG_WCHAR_TO_TCHAR(loadBalanceManager->GetLocalServerAddress())));
+ ACE_DEBUG ((LM_DEBUG, ACE_TEXT(" Machine IP : %s\n"), MG_WCHAR_TO_TCHAR(loadBalanceManager->GetLocalServerAddress())));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT(" Fdo path : %s\n"), MG_WCHAR_TO_TCHAR(fdoPath)));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT(" Logs path : %s\n"), MG_WCHAR_TO_TCHAR(pLogManager->GetLogsPath())));
ACE_DEBUG ((LM_DEBUG, ACE_TEXT(" Locale (Default) : %s\n"), MG_WCHAR_TO_TCHAR(pServerManager->GetDefaultLocale())));
Modified: trunk/MgDev/Server/src/Core/serverconfig.ini
===================================================================
--- trunk/MgDev/Server/src/Core/serverconfig.ini 2007-01-12 23:11:18 UTC (rev 1045)
+++ trunk/MgDev/Server/src/Core/serverconfig.ini 2007-01-12 23:33:56 UTC (rev 1046)
@@ -50,6 +50,8 @@
# the log files
# 0 < Length <= 128
# LogsPath Path where log files are stored
+# MachineIp IP address of the server
+# 0 < Length <= 255
# MaxLogFileSize Max size allowed for the log files in
# kilobytes (KB)
# 0 < Value <= 2000000
@@ -79,6 +81,7 @@
LicenseServerPath = @localhost
LogsDelimiter = \t
LogsPath = Logs/
+MachineIp = 127.0.0.1
MaxLogFileSize = 1024
MaxLogFileSizeEnabled = 0
ResourcesPath = Resources/
@@ -184,21 +187,21 @@
# -----------------------------------------------------------------------------
# DrawingService 0 = service unavailable, 1 = service available
# FeatureService 0 = service unavailable, 1 = service available
+# KmlService 0 = service unavailable, 1 = service available
# MappingService 0 = service unavailable, 1 = service available
# RenderingService 0 = service unavailable, 1 = service available
# ResourceService 0 = service unavailable, 1 = service available
# SiteService 0 = service unavailable, 1 = service available
# TileService 0 = service unavailable, 1 = service available
-# KmlService 0 = service unavailable, 1 = service available
# *****************************************************************************
DrawingService = 1
FeatureService = 1
+KmlService = 1
MappingService = 1
RenderingService = 1
ResourceService = 1
SiteService = 1
TileService = 1
-KmlService = 1
[DrawingServiceProperties]
# *****************************************************************************
@@ -257,6 +260,7 @@
# Property Name Description
# -----------------------------------------------------------------------------
# LegendFont Font to use when rendering legend elements
+# 0 < Length <= 255
# *****************************************************************************
LegendFont = Arial
Modified: trunk/MgDev/Server/src/Resources/server_en.res
===================================================================
--- trunk/MgDev/Server/src/Resources/server_en.res 2007-01-12 23:11:18 UTC (rev 1045)
+++ trunk/MgDev/Server/src/Resources/server_en.res 2007-01-12 23:33:56 UTC (rev 1046)
@@ -197,6 +197,9 @@
MgInvalidGeometryType = The geometry type is invalid because it is not recognized.
MgInvalidHour = The hour is invalid because it must be between 0 and 23.
MgInvalidImageSizeTooBig = The requested image size exceeds the maximum.
+MgInvalidIpConfigurationForLocalMachine = The machine IP is not a local host.
+MgInvalidIpConfigurationForSiteServer = This server (%1) is configured as a site server but has a different IP address than the site server (%2).
+MgInvalidIpConfigurationForSupportServer = This server (%1) is configured as a support server but has the same IP address as the site server (%2).
MgInvalidLogType = The log type is invalid because it is not recognized.
MgInvalidMapPlotCollectionMapPlotInstruction = The map plot is invalid because it contains an unrecognized map plot instruction.
MgInvalidMicroSecond = The microsecond is invalid because it must be between 0 and 999999.
Modified: trunk/MgDev/Server/src/Services/Resource/ResourcePackageHandler.cpp
===================================================================
--- trunk/MgDev/Server/src/Services/Resource/ResourcePackageHandler.cpp 2007-01-12 23:11:18 UTC (rev 1045)
+++ trunk/MgDev/Server/src/Services/Resource/ResourcePackageHandler.cpp 2007-01-12 23:33:56 UTC (rev 1046)
@@ -80,7 +80,7 @@
if (serverName.empty())
{
- MgIpUtil::HostAddressToName(serverAddress, serverName);
+ MgIpUtil::HostAddressToName(serverAddress, serverName, false);
}
statusInfo.SetServerName(serverName);
Modified: trunk/MgDev/Web/src/mapagent/Resources/web_en.res
===================================================================
--- trunk/MgDev/Web/src/mapagent/Resources/web_en.res 2007-01-12 23:11:18 UTC (rev 1045)
+++ trunk/MgDev/Web/src/mapagent/Resources/web_en.res 2007-01-12 23:33:56 UTC (rev 1046)
@@ -197,6 +197,9 @@
MgInvalidGeometryType = The geometry type is invalid because it is not recognized.
MgInvalidHour = The hour is invalid because it must be between 0 and 23.
MgInvalidImageSizeTooBig = The requested image size exceeds the maximum.
+MgInvalidIpConfigurationForLocalMachine = The machine IP is not a local host.
+MgInvalidIpConfigurationForSiteServer = This server (%1) is configured as a site server but has a different IP address than the site server (%2).
+MgInvalidIpConfigurationForSupportServer = This server (%1) is configured as a support server but has the same IP address as the site server (%2).
MgInvalidLogType = The log type is invalid because it is not recognized.
MgInvalidMapPlotCollectionMapPlotInstruction = The map plot is invalid because it contains an unrecognized map plot instruction.
MgInvalidMicroSecond = The microsecond is invalid because it must be between 0 and 999999.
More information about the mapguide-commits
mailing list