From 0b5141d45bcd409544e909aedabc3e58e6a86a13 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Fri, 12 Mar 2010 13:16:44 -0800 Subject: Fixed SimianGrid connectors to gracefully exit if the required config sections are missing --- .../SimianGrid/SimianAssetServiceConnector.cs | 12 ++++---- .../SimianAuthenticationServiceConnector.cs | 10 +++---- .../SimianGrid/SimianAvatarServiceConnector.cs | 10 +++---- .../SimianGrid/SimianFriendsServiceConnector.cs | 10 +++---- .../SimianGrid/SimianGridServiceConnector.cs | 10 +++---- .../SimianGrid/SimianInventoryServiceConnector.cs | 10 +++---- .../SimianGrid/SimianPresenceServiceConnector.cs | 32 +++++++++++++--------- .../Connectors/SimianGrid/SimianProfiles.cs | 12 ++++---- .../SimianUserAccountServiceConnector.cs | 13 +++++---- 9 files changed, 63 insertions(+), 56 deletions(-) (limited to 'OpenSim/Services/Connectors/SimianGrid') diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs index 201bc70..89aa911 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs @@ -46,7 +46,7 @@ namespace OpenSim.Services.Connectors.SimianGrid /// Connects to the SimianGrid asset service /// [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class SimianAssetServiceConnector : IAssetService + public class SimianAssetServiceConnector : IAssetService, ISharedRegionModule { private static readonly ILog m_log = LogManager.GetLogger( @@ -73,9 +73,9 @@ namespace OpenSim.Services.Connectors.SimianGrid public SimianAssetServiceConnector() { } public string Name { get { return "SimianAssetServiceConnector"; } } - public void AddRegion(Scene scene) { scene.RegisterModuleInterface(this); } - public void RemoveRegion(Scene scene) { scene.UnregisterModuleInterface(this); } - + public void AddRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.RegisterModuleInterface(this); } } + public void RemoveRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.UnregisterModuleInterface(this); } } + #endregion ISharedRegionModule public SimianAssetServiceConnector(IConfigSource source) @@ -88,8 +88,8 @@ namespace OpenSim.Services.Connectors.SimianGrid IConfig gridConfig = source.Configs["AssetService"]; if (gridConfig == null) { - m_log.Error("[ASSET CONNECTOR]: AssetService missing from OpenSim.ini"); - throw new Exception("Asset connector init error"); + m_log.Info("[ASSET CONNECTOR]: AssetService missing from OpenSim.ini, skipping SimianAssetServiceConnector"); + return; } string serviceUrl = gridConfig.GetString("AssetServerURI"); diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs index 25e04d7..55aca36 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAuthenticationServiceConnector.cs @@ -44,7 +44,7 @@ namespace OpenSim.Services.Connectors.SimianGrid /// Connects authentication/authorization to the SimianGrid backend /// [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class SimianAuthenticationServiceConnector : IAuthenticationService + public class SimianAuthenticationServiceConnector : IAuthenticationService, ISharedRegionModule { private static readonly ILog m_log = LogManager.GetLogger( @@ -61,8 +61,8 @@ namespace OpenSim.Services.Connectors.SimianGrid public SimianAuthenticationServiceConnector() { } public string Name { get { return "SimianAuthenticationServiceConnector"; } } - public void AddRegion(Scene scene) { scene.RegisterModuleInterface(this); } - public void RemoveRegion(Scene scene) { scene.UnregisterModuleInterface(this); } + public void AddRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.RegisterModuleInterface(this); } } + public void RemoveRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.UnregisterModuleInterface(this); } } #endregion ISharedRegionModule @@ -76,8 +76,8 @@ namespace OpenSim.Services.Connectors.SimianGrid IConfig assetConfig = source.Configs["AuthenticationService"]; if (assetConfig == null) { - m_log.Error("[AUTH CONNECTOR]: AuthenticationService missing from OpenSim.ini"); - throw new Exception("Authentication connector init error"); + m_log.Info("[AUTH CONNECTOR]: AuthenticationService missing from OpenSim.ini, skipping SimianAuthenticationServiceConnector"); + return; } string serviceURI = assetConfig.GetString("AuthenticationServerURI"); diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs index 08403b9..b5cef0c 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAvatarServiceConnector.cs @@ -48,7 +48,7 @@ namespace OpenSim.Services.Connectors.SimianGrid /// Connects avatar appearance data to the SimianGrid backend /// [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class SimianAvatarServiceConnector : IAvatarService + public class SimianAvatarServiceConnector : IAvatarService, ISharedRegionModule { private static readonly ILog m_log = LogManager.GetLogger( @@ -66,8 +66,8 @@ namespace OpenSim.Services.Connectors.SimianGrid public SimianAvatarServiceConnector() { } public string Name { get { return "SimianAvatarServiceConnector"; } } - public void AddRegion(Scene scene) { scene.RegisterModuleInterface(this); } - public void RemoveRegion(Scene scene) { scene.UnregisterModuleInterface(this); } + public void AddRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.RegisterModuleInterface(this); } } + public void RemoveRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.UnregisterModuleInterface(this); } } #endregion ISharedRegionModule @@ -81,8 +81,8 @@ namespace OpenSim.Services.Connectors.SimianGrid IConfig gridConfig = source.Configs["AvatarService"]; if (gridConfig == null) { - m_log.Error("[AVATAR CONNECTOR]: AvatarService missing from OpenSim.ini"); - throw new Exception("Avatar connector init error"); + m_log.Info("[AVATAR CONNECTOR]: AvatarService missing from OpenSim.ini, skipping SimianAvatarServiceConnector"); + return; } string serviceUrl = gridConfig.GetString("AvatarServerURI"); diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs index 856381d..a569e91 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianFriendsServiceConnector.cs @@ -47,7 +47,7 @@ namespace OpenSim.Services.Connectors.SimianGrid /// Stores and retrieves friend lists from the SimianGrid backend /// [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class SimianFriendsServiceConnector : IFriendsService + public class SimianFriendsServiceConnector : IFriendsService, ISharedRegionModule { private static readonly ILog m_log = LogManager.GetLogger( @@ -64,8 +64,8 @@ namespace OpenSim.Services.Connectors.SimianGrid public SimianFriendsServiceConnector() { } public string Name { get { return "SimianFriendsServiceConnector"; } } - public void AddRegion(Scene scene) { scene.RegisterModuleInterface(this); } - public void RemoveRegion(Scene scene) { scene.UnregisterModuleInterface(this); } + public void AddRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.RegisterModuleInterface(this); } } + public void RemoveRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.UnregisterModuleInterface(this); } } #endregion ISharedRegionModule @@ -79,8 +79,8 @@ namespace OpenSim.Services.Connectors.SimianGrid IConfig assetConfig = source.Configs["FriendsService"]; if (assetConfig == null) { - m_log.Error("[FRIENDS CONNECTOR]: FriendsService missing from OpenSim.ini"); - throw new Exception("Friends connector init error"); + m_log.Info("[FRIENDS CONNECTOR]: FriendsService missing from OpenSim.ini, skipping SimianFriendsServiceConnector"); + return; } string serviceURI = assetConfig.GetString("FriendsServerURI"); diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs index c375076..2e600f0 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs @@ -51,7 +51,7 @@ namespace OpenSim.Services.Connectors.SimianGrid /// backend /// [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class SimianGridServiceConnector : IGridService + public class SimianGridServiceConnector : IGridService, ISharedRegionModule { private static readonly ILog m_log = LogManager.GetLogger( @@ -68,8 +68,8 @@ namespace OpenSim.Services.Connectors.SimianGrid public SimianGridServiceConnector() { } public string Name { get { return "SimianGridServiceConnector"; } } - public void AddRegion(Scene scene) { scene.RegisterModuleInterface(this); } - public void RemoveRegion(Scene scene) { scene.UnregisterModuleInterface(this); } + public void AddRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.RegisterModuleInterface(this); } } + public void RemoveRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.UnregisterModuleInterface(this); } } #endregion ISharedRegionModule @@ -83,8 +83,8 @@ namespace OpenSim.Services.Connectors.SimianGrid IConfig gridConfig = source.Configs["GridService"]; if (gridConfig == null) { - m_log.Error("[GRID CONNECTOR]: GridService missing from OpenSim.ini"); - throw new Exception("Grid connector init error"); + m_log.Info("[GRID CONNECTOR]: GridService missing from OpenSim.ini, skipping SimianGridServiceConnector"); + return; } string serviceUrl = gridConfig.GetString("GridServerURI"); diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs index 9879295..a50ecbc 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianInventoryServiceConnector.cs @@ -61,7 +61,7 @@ namespace OpenSim.Services.Connectors.SimianGrid /// Connects avatar inventories to the SimianGrid backend /// [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class SimianInventoryServiceConnector : IInventoryService + public class SimianInventoryServiceConnector : IInventoryService, ISharedRegionModule { private static readonly ILog m_log = LogManager.GetLogger( @@ -80,8 +80,8 @@ namespace OpenSim.Services.Connectors.SimianGrid public SimianInventoryServiceConnector() { } public string Name { get { return "SimianInventoryServiceConnector"; } } - public void AddRegion(Scene scene) { scene.RegisterModuleInterface(this); } - public void RemoveRegion(Scene scene) { scene.UnregisterModuleInterface(this); } + public void AddRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.RegisterModuleInterface(this); } } + public void RemoveRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.UnregisterModuleInterface(this); } } #endregion ISharedRegionModule @@ -95,8 +95,8 @@ namespace OpenSim.Services.Connectors.SimianGrid IConfig gridConfig = source.Configs["InventoryService"]; if (gridConfig == null) { - m_log.Error("[INVENTORY CONNECTOR]: InventoryService missing from OpenSim.ini"); - throw new Exception("Inventory connector init error"); + m_log.Info("[INVENTORY CONNECTOR]: InventoryService missing from OpenSim.ini, skipping SimianInventoryServiceConnector"); + return; } string serviceUrl = gridConfig.GetString("InventoryServerURI"); diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs index 45d1824..542093f 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianPresenceServiceConnector.cs @@ -51,7 +51,7 @@ namespace OpenSim.Services.Connectors.SimianGrid /// message routing) to the SimianGrid backend /// [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class SimianPresenceServiceConnector : IPresenceService + public class SimianPresenceServiceConnector : IPresenceService, ISharedRegionModule { private static readonly ILog m_log = LogManager.GetLogger( @@ -70,23 +70,29 @@ namespace OpenSim.Services.Connectors.SimianGrid public string Name { get { return "SimianPresenceServiceConnector"; } } public void AddRegion(Scene scene) { - scene.RegisterModuleInterface(this); + if (!String.IsNullOrEmpty(m_serverUrl)) + { + scene.RegisterModuleInterface(this); - scene.EventManager.OnMakeRootAgent += MakeRootAgentHandler; - scene.EventManager.OnNewClient += NewClientHandler; - scene.EventManager.OnSignificantClientMovement += SignificantClientMovementHandler; + scene.EventManager.OnMakeRootAgent += MakeRootAgentHandler; + scene.EventManager.OnNewClient += NewClientHandler; + scene.EventManager.OnSignificantClientMovement += SignificantClientMovementHandler; - LogoutRegionAgents(scene.RegionInfo.RegionID); + LogoutRegionAgents(scene.RegionInfo.RegionID); + } } public void RemoveRegion(Scene scene) { - scene.UnregisterModuleInterface(this); + if (!String.IsNullOrEmpty(m_serverUrl)) + { + scene.UnregisterModuleInterface(this); - scene.EventManager.OnMakeRootAgent -= MakeRootAgentHandler; - scene.EventManager.OnNewClient -= NewClientHandler; - scene.EventManager.OnSignificantClientMovement -= SignificantClientMovementHandler; + scene.EventManager.OnMakeRootAgent -= MakeRootAgentHandler; + scene.EventManager.OnNewClient -= NewClientHandler; + scene.EventManager.OnSignificantClientMovement -= SignificantClientMovementHandler; - LogoutRegionAgents(scene.RegionInfo.RegionID); + LogoutRegionAgents(scene.RegionInfo.RegionID); + } } #endregion ISharedRegionModule @@ -101,8 +107,8 @@ namespace OpenSim.Services.Connectors.SimianGrid IConfig gridConfig = source.Configs["PresenceService"]; if (gridConfig == null) { - m_log.Error("[PRESENCE CONNECTOR]: PresenceService missing from OpenSim.ini"); - throw new Exception("Presence connector init error"); + m_log.Info("[PRESENCE CONNECTOR]: PresenceService missing from OpenSim.ini, skipping SimianPresenceServiceConnector"); + return; } string serviceUrl = gridConfig.GetString("PresenceServerURI"); diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs b/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs index 32f17ae..b3b171c 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianProfiles.cs @@ -60,7 +60,7 @@ namespace OpenSim.Services.Connectors.SimianGrid /// backend /// [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class SimianProfiles + public class SimianProfiles : INonSharedRegionModule { private static readonly ILog m_log = LogManager.GetLogger( @@ -69,15 +69,15 @@ namespace OpenSim.Services.Connectors.SimianGrid private string m_serverUrl = String.Empty; #region INonSharedRegionModule - + public Type ReplaceableInterface { get { return null; } } public void RegionLoaded(Scene scene) { } public void Close() { } public SimianProfiles() { } public string Name { get { return "SimianProfiles"; } } - public void AddRegion(Scene scene) { CheckEstateManager(scene); scene.EventManager.OnClientConnect += ClientConnectHandler; } - public void RemoveRegion(Scene scene) { scene.EventManager.OnClientConnect -= ClientConnectHandler; } + public void AddRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { CheckEstateManager(scene); scene.EventManager.OnClientConnect += ClientConnectHandler; } } + public void RemoveRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.EventManager.OnClientConnect -= ClientConnectHandler; } } #endregion INonSharedRegionModule @@ -91,8 +91,8 @@ namespace OpenSim.Services.Connectors.SimianGrid IConfig gridConfig = source.Configs["UserAccountService"]; if (gridConfig == null) { - m_log.Error("[PROFILES]: UserAccountService missing from OpenSim.ini"); - throw new Exception("Profiles init error"); + m_log.Error("[PROFILES]: UserAccountService missing from OpenSim.ini, skipping SimianProfiles"); + return; } string serviceUrl = gridConfig.GetString("UserAccountServerURI"); diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs index 708ced3..855b213 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianUserAccountServiceConnector.cs @@ -47,14 +47,14 @@ namespace OpenSim.Services.Connectors.SimianGrid /// users) to the SimianGrid backend /// [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class SimianUserAccountServiceConnector : IUserAccountService + public class SimianUserAccountServiceConnector : IUserAccountService, ISharedRegionModule { private static readonly ILog m_log = LogManager.GetLogger( MethodBase.GetCurrentMethod().DeclaringType); private string m_serverUrl = String.Empty; - private ExpiringCache m_accountCache = new ExpiringCache(); + private ExpiringCache m_accountCache; #region ISharedRegionModule @@ -65,8 +65,8 @@ namespace OpenSim.Services.Connectors.SimianGrid public SimianUserAccountServiceConnector() { } public string Name { get { return "SimianUserAccountServiceConnector"; } } - public void AddRegion(Scene scene) { scene.RegisterModuleInterface(this); } - public void RemoveRegion(Scene scene) { scene.UnregisterModuleInterface(this); } + public void AddRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.RegisterModuleInterface(this); } } + public void RemoveRegion(Scene scene) { if (!String.IsNullOrEmpty(m_serverUrl)) { scene.UnregisterModuleInterface(this); } } #endregion ISharedRegionModule @@ -80,8 +80,8 @@ namespace OpenSim.Services.Connectors.SimianGrid IConfig assetConfig = source.Configs["UserAccountService"]; if (assetConfig == null) { - m_log.Error("[ACCOUNT CONNECTOR]: UserAccountService missing from OpenSim.ini"); - throw new Exception("User account connector init error"); + m_log.Error("[ACCOUNT CONNECTOR]: UserAccountService missing from OpenSim.ini, skipping SimianUserAccountServiceConnector"); + return; } string serviceURI = assetConfig.GetString("UserAccountServerURI"); @@ -91,6 +91,7 @@ namespace OpenSim.Services.Connectors.SimianGrid throw new Exception("User account connector init error"); } + m_accountCache = new ExpiringCache(); m_serverUrl = serviceURI; } -- cgit v1.1