From ec3c31e61e5e540f822891110df9bc978655bbaf Mon Sep 17 00:00:00 2001 From: Revolution Date: Fri, 22 Jan 2010 18:09:33 -0600 Subject: Updates all IRegionModules to the new style region modules. Signed-off-by: Melanie --- OpenSim/Region/CoreModules/InterGrid/OGSRadmin.cs | 31 +++---- .../InterGrid/OpenGridProtocolModule.cs | 100 +++++++++++++-------- 2 files changed, 72 insertions(+), 59 deletions(-) (limited to 'OpenSim/Region/CoreModules/InterGrid') diff --git a/OpenSim/Region/CoreModules/InterGrid/OGSRadmin.cs b/OpenSim/Region/CoreModules/InterGrid/OGSRadmin.cs index 0f2ba32..4534024 100644 --- a/OpenSim/Region/CoreModules/InterGrid/OGSRadmin.cs +++ b/OpenSim/Region/CoreModules/InterGrid/OGSRadmin.cs @@ -32,6 +32,7 @@ using System.Net; using System.Reflection; using System.Text; using log4net; +using Mono.Addins; using Nini.Config; using Nwc.XmlRpc; using OpenMetaverse; @@ -42,7 +43,8 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.CoreModules.InterGrid { - public class OGSRadmin : IRegionModule + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + public class OGSRadmin : ISharedRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private readonly List m_scenes = new List(); @@ -56,7 +58,6 @@ namespace OpenSim.Region.CoreModules.InterGrid get { return "OGS Supporting RAdmin"; } } - public void Initialise(IConfigSource source) { m_settings = source; @@ -67,6 +68,11 @@ namespace OpenSim.Region.CoreModules.InterGrid } + public Type ReplaceableInterface + { + get { return null; } + } + public void AddRegion(Scene scene) { lock (m_scenes) @@ -77,15 +83,11 @@ namespace OpenSim.Region.CoreModules.InterGrid { lock (m_scenes) m_scenes.Remove(scene); + MainServer.Instance.RemoveXmlRPCHandler("grid_message"); } public void RegionLoaded(Scene scene) { - - } - - public void PostInitialise() - { if (m_settings.Configs["Startup"].GetBoolean("gridmode", false)) { m_com = m_scenes[0].CommsManager; @@ -93,21 +95,8 @@ namespace OpenSim.Region.CoreModules.InterGrid } } - #endregion - - #region IRegionModule - - public void Initialise(Scene scene, IConfigSource source) - { - m_settings = source; - - lock (m_scenes) - m_scenes.Add(scene); - } - - public bool IsSharedModule + public void PostInitialise() { - get { return true; } } #endregion diff --git a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs index 10a3232..8bb0fa9 100644 --- a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs +++ b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs @@ -35,6 +35,7 @@ using System.Security.Cryptography.X509Certificates; using System.Threading; using System.Web; using log4net; +using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenMetaverse.StructuredData; @@ -75,8 +76,9 @@ namespace OpenSim.Region.CoreModules.InterGrid public bool visible_to_parent; public string teleported_into_region; } - - public class OpenGridProtocolModule : IRegionModule + + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + public class OpenGridProtocolModule : ISharedRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private List m_scene = new List(); @@ -92,21 +94,22 @@ namespace OpenSim.Region.CoreModules.InterGrid private bool httpSSL = false; private uint httpsslport = 0; private bool GridMode = false; + private bool m_enabled = false; + private IConfig cfg = null; + private IConfig httpcfg = null; + private IConfig startupcfg = null; + + #region ISharedRegionModule Members - #region IRegionModule Members - - public void Initialise(Scene scene, IConfigSource config) + public void Initialise(IConfigSource config) { - bool enabled = false; - IConfig cfg = null; - IConfig httpcfg = null; - IConfig startupcfg = null; try { cfg = config.Configs["OpenGridProtocol"]; - } catch (NullReferenceException) + } + catch (NullReferenceException) { - enabled = false; + m_enabled = false; } try @@ -128,15 +131,15 @@ namespace OpenSim.Region.CoreModules.InterGrid if (startupcfg != null) { - GridMode = enabled = startupcfg.GetBoolean("gridmode", false); + GridMode = m_enabled = startupcfg.GetBoolean("gridmode", false); } if (cfg != null) { - enabled = cfg.GetBoolean("ogp_enabled", false); + m_enabled = cfg.GetBoolean("ogp_enabled", false); LastNameSuffix = cfg.GetString("ogp_lastname_suffix", "_EXTERNAL"); FirstNamePrefix = cfg.GetString("ogp_firstname_prefix", ""); - if (enabled) + if (m_enabled) { m_log.Warn("[OGP]: Open Grid Protocol is on, Listening for Clients on /agent/"); lock (m_scene) @@ -165,35 +168,61 @@ namespace OpenSim.Region.CoreModules.InterGrid } } - // can't pick the region 'agent' because it would conflict with our agent domain handler - // a zero length region name would conflict with are base region seed cap - if (!SceneListDuplicateCheck(scene.RegionInfo.RegionName) && scene.RegionInfo.RegionName.ToLower() != "agent" && scene.RegionInfo.RegionName.Length > 0) - { - MainServer.Instance.AddLLSDHandler( - "/" + HttpUtility.UrlPathEncode(scene.RegionInfo.RegionName.ToLower()), - ProcessRegionDomainSeed); - } - - if (!m_scene.Contains(scene)) - m_scene.Add(scene); } } } - lock (m_scene) + } + + public Type ReplaceableInterface + { + get { return null; } + } + + public void AddRegion(Scene scene) + { + if (m_enabled) { - if (m_scene.Count == 1) + lock (m_scene) { - if (httpcfg != null) + if (m_scene.Count == 1) { - httpSSL = httpcfg.GetBoolean("http_listener_ssl", false); - httpsCN = httpcfg.GetString("http_listener_cn", scene.RegionInfo.ExternalHostName); - if (httpsCN.Length == 0) - httpsCN = scene.RegionInfo.ExternalHostName; - httpsslport = (uint)httpcfg.GetInt("http_listener_sslport",((int)scene.RegionInfo.HttpPort + 1)); + if (httpcfg != null) + { + httpSSL = httpcfg.GetBoolean("http_listener_ssl", false); + httpsCN = httpcfg.GetString("http_listener_cn", scene.RegionInfo.ExternalHostName); + if (httpsCN.Length == 0) + httpsCN = scene.RegionInfo.ExternalHostName; + httpsslport = (uint)httpcfg.GetInt("http_listener_sslport", ((int)scene.RegionInfo.HttpPort + 1)); + } } } + // can't pick the region 'agent' because it would conflict with our agent domain handler + // a zero length region name would conflict with are base region seed cap + if (!SceneListDuplicateCheck(scene.RegionInfo.RegionName) && scene.RegionInfo.RegionName.ToLower() != "agent" && scene.RegionInfo.RegionName.Length > 0) + { + MainServer.Instance.AddLLSDHandler( + "/" + HttpUtility.UrlPathEncode(scene.RegionInfo.RegionName.ToLower()), + ProcessRegionDomainSeed); + } + + if (!m_scene.Contains(scene)) + m_scene.Add(scene); } } + + public void RegionLoaded(Scene scene) + { + } + + public void RemoveRegion(Scene scene) + { + MainServer.Instance.RemoveLLSDHandler( + "/" + HttpUtility.UrlPathEncode(scene.RegionInfo.RegionName.ToLower()), + ProcessRegionDomainSeed); + + if (m_scene.Contains(scene)) + m_scene.Remove(scene); + } public void PostInitialise() { @@ -209,11 +238,6 @@ namespace OpenSim.Region.CoreModules.InterGrid get { return "OpenGridProtocolModule"; } } - public bool IsSharedModule - { - get { return true; } - } - #endregion public OSD ProcessRegionDomainSeed(string path, OSD request, string endpoint) -- cgit v1.1