From de82bf9eb53cdd3be94b5a730b81c70d1e244b70 Mon Sep 17 00:00:00 2001 From: MW Date: Thu, 26 Feb 2009 15:21:06 +0000 Subject: Added a PostInitialise method to IApplicationPlugin, this allows us to do work in there knowing that all other ApplicationPlugins have been initialised by that time. Moved the loadRegions code in LoadRegionsPlugin to the PostInitialise method. --- .../LoadRegions/LoadRegionsPlugin.cs | 27 ++++++++++++++-------- 1 file changed, 17 insertions(+), 10 deletions(-) (limited to 'OpenSim/ApplicationPlugins/LoadRegions') diff --git a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs index c988ad8..24372fe 100644 --- a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs +++ b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs @@ -54,6 +54,8 @@ namespace OpenSim.ApplicationPlugins.LoadRegions public string Version { get { return m_version; } } public string Name { get { return m_name; } } + protected OpenSimBase m_openSim; + public void Initialise() { m_log.Info("[LOADREGIONS]: " + Name + " cannot be default-initialized!"); @@ -62,10 +64,15 @@ namespace OpenSim.ApplicationPlugins.LoadRegions public void Initialise(OpenSimBase openSim) { + m_openSim = openSim; + } + + public void PostInitialise() + { m_log.Info("[LOADREGIONS]: Load Regions addin being initialised"); IRegionLoader regionLoader; - if (openSim.ConfigSource.Source.Configs["Startup"].GetString("region_info_source", "filesystem") == "filesystem") + if (m_openSim.ConfigSource.Source.Configs["Startup"].GetString("region_info_source", "filesystem") == "filesystem") { m_log.Info("[LOADREGIONS]: Loading Region Info from filesystem"); regionLoader = new RegionLoaderFileSystem(); @@ -76,14 +83,14 @@ namespace OpenSim.ApplicationPlugins.LoadRegions regionLoader = new RegionLoaderWebServer(); } - regionLoader.SetIniConfigSource(openSim.ConfigSource.Source); + regionLoader.SetIniConfigSource(m_openSim.ConfigSource.Source); RegionInfo[] regionsToLoad = regionLoader.LoadRegions(); - openSim.ModuleLoader.LoadDefaultSharedModule(new DynamicTextureModule()); - openSim.ModuleLoader.LoadDefaultSharedModule(new InstantMessageModule()); - openSim.ModuleLoader.LoadDefaultSharedModule(new LoadImageURLModule()); - openSim.ModuleLoader.LoadDefaultSharedModule(new XMLRPCModule()); - openSim.ModuleLoader.LoadDefaultSharedModule(new AssetTransactionModule()); + m_openSim.ModuleLoader.LoadDefaultSharedModule(new DynamicTextureModule()); + m_openSim.ModuleLoader.LoadDefaultSharedModule(new InstantMessageModule()); + m_openSim.ModuleLoader.LoadDefaultSharedModule(new LoadImageURLModule()); + m_openSim.ModuleLoader.LoadDefaultSharedModule(new XMLRPCModule()); + m_openSim.ModuleLoader.LoadDefaultSharedModule(new AssetTransactionModule()); if (!CheckRegionsForSanity(regionsToLoad)) { m_log.Error("[LOADREGIONS]: Halting startup due to conflicts in region configurations"); @@ -94,11 +101,11 @@ namespace OpenSim.ApplicationPlugins.LoadRegions { m_log.Debug("[LOADREGIONS]: Creating Region: " + regionsToLoad[i].RegionName + " (ThreadID: " + Thread.CurrentThread.ManagedThreadId.ToString() + ")"); - openSim.CreateRegion(regionsToLoad[i], true); + m_openSim.CreateRegion(regionsToLoad[i], true); } - openSim.ModuleLoader.PostInitialise(); - openSim.ModuleLoader.ClearCache(); + m_openSim.ModuleLoader.PostInitialise(); + m_openSim.ModuleLoader.ClearCache(); } public void Dispose() -- cgit v1.1