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.
This commit is contained in:
MW
2009-02-26 15:21:06 +00:00
parent 04a6c735d6
commit de82bf9eb5
7 changed files with 32 additions and 45 deletions

View File

@@ -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!");
@@ -61,11 +63,16 @@ 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()